@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/geist-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
}
:root {
  color-scheme: light;
  --bg: #f4f4f4; --surface: #ffffff; --surface-2: #ededed; --sunken: #e5e5e5;
  --border: #dedede; --border-strong: #c6c6c6;
  --text: #181818; --muted: #666666; --faint: #8e8e8e;
  --ink: #181818; --paper: #f4f4f4;
  --accent: #3a3a3a; --ok: #56665c; --warn: #756b5d; --bad: #8f5a5a;
  --c1: #2f2f2f; --c2: #5c5c5c; --c3: #808080; --c4: #a3a3a3; --c5: #c0c0c0; --c6: #d6d6d6;
  --chart-1: #3b5b92; --chart-2: #2f7d6d; --chart-3: #a06a2c; --chart-4: #8b4a63;
  --chart-5: #6a5a9e; --chart-6: #4f7f9e; --chart-7: #6f7f3f; --chart-8: #8a5a3f;
  --radius: 12px; --pad: 18px;
  --font-heading: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --shadow-lift: 0 12px 30px -24px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101010; --surface: #171717; --surface-2: #202020; --sunken: #282828;
    --border: #303030; --border-strong: #484848;
    --text: #ededed; --muted: #a0a0a0; --faint: #787878;
    --ink: #ededed; --paper: #101010;
    --accent: #d0d0d0; --ok: #93a399; --warn: #b0a596; --bad: #c39c9c;
    --c1: #e6e6e6; --c2: #c2c2c2; --c3: #9e9e9e; --c4: #7a7a7a; --c5: #565656; --c6: #3a3a3a;
    --chart-1: #8fb4e8; --chart-2: #6fc7b4; --chart-3: #e0b071; --chart-4: #e79bb4;
    --chart-5: #b3a1ea; --chart-6: #89c3e6; --chart-7: #c2d47e; --chart-8: #d6a184;
    --shadow: 0 1px 2px rgba(0,0,0,.5);
    --shadow-lift: 0 14px 34px -26px rgba(0,0,0,.9);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The page itself never scrolls: the header is fixed in the flex column and
   only the content below it gets the scrollbar. */
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  margin: 0; color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  background: var(--bg);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#app {
  flex: 1 1 auto; min-height: 0; width: 100%;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  padding: 0 max(var(--pad), env(safe-area-inset-right)) max(56px, env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
}
main { max-width: 1120px; margin: 0 auto; }
h1, h2, h3 { font-family: var(--font-heading); }
h1 { font-size: 18px; margin: 0; letter-spacing: -.015em; font-weight: 700; }
h2 { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
     margin: 30px 0 11px; font-weight: 600; display: flex; align-items: baseline; gap: 9px; }
h2::before { content: ""; width: 14px; height: 1px; border-radius: 1px; background: var(--border-strong); align-self: center; flex: none; }
h2 .hint { font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.hidden { display: none !important; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }

/* header */
.topbar {
  position: relative; flex: none; z-index: 20;
  display: grid; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right)) 10px max(var(--pad), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(150%) blur(16px); backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1120px; margin: 0 auto; width: 100%; }
.brandmark { display: flex; align-items: baseline; gap: 9px; text-decoration: none; color: var(--text); min-width: 0; }
.brandmark .wordmark { font-family: var(--font-heading); font-size: 19px; font-weight: 600; letter-spacing: -.025em; line-height: 1; }
.brandmark .product {
  font-family: var(--font-body); font-size: 12px; font-weight: 400; letter-spacing: 0;
  color: var(--muted); background: transparent; padding: 0; line-height: 1;
}
.live { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; box-shadow: 0 0 0 0 transparent; }
.pulse.ok { background: var(--ok); box-shadow: 0 0 9px -1px var(--ok); }
.pulse.bad { background: var(--bad); box-shadow: 0 0 9px -1px var(--bad); }
.stamp { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px;
  max-width: 1120px; margin: 0 auto; width: 100%;
}
.segmented button, .segmented a {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-family: var(--font-body); font-size: 13.5px; font-weight: 500; padding: 8px 12px; border-radius: 8px;
  cursor: pointer; min-height: 36px; transition: background .15s, color .15s, transform .15s;
  text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center;
}
.segmented button:hover, .segmented a:hover { color: var(--text); }
.segmented button[aria-selected="true"], .segmented a[aria-selected="true"],
.segmented button[aria-pressed="true"], .segmented button.active {
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow);
}
.segmented.ranges { max-width: none; width: auto; }
.segmented.ranges button { padding: 7px 10px; min-width: 46px; font-size: 12.5px; }
@media (min-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; align-items: center; }
  .topbar nav { justify-self: end; width: auto; }
  .segmented { width: auto; }
}
@media (max-width: 759px) {
  .topbar nav { min-width: 0; max-width: 100%; }
  .segmented {
    grid-auto-columns: max-content; justify-content: start;
    max-width: 100%; overflow-x: auto; scrollbar-width: none;
  }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button, .segmented a { white-space: nowrap; font-size: 12.5px; padding: 7px 10px; }
}
@media (max-width: 520px) {
  .segmented button, .segmented a { font-size: 11px; padding: 7px 5px; }
  .live { min-width: 0; }
  .stamp { min-width: 0; }
}
@media (max-width: 420px) {
  .segmented button, .segmented a { font-size: 10.5px; padding: 7px 4px; }
}

/* page head */
.pagehead { padding: 26px 0 8px; }
.pagehead h1 { font-size: clamp(28px, 4.4vw, 38px); line-height: 1.05; letter-spacing: -.035em; font-weight: 700; }
.pagehead p { margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 62ch; text-wrap: pretty; }

/* chips + banner */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px auto 2px; max-width: 1120px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 11px; font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 650; font-family: var(--font-mono); font-size: 11px; }
.banner {
  display: none; margin: 10px auto; max-width: 1120px; padding: 11px 13px; border-radius: 11px; font-size: 13px;
  background: color-mix(in srgb, var(--bad) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--bad) 38%, var(--border));
  color: var(--bad);
}

/* generic card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }

/* accounts */
.account { padding: 17px 17px 15px; display: grid; gap: 13px; }
.account.off { opacity: .74; }
.account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.acct { font-weight: 600; font-size: 15px; font-family: var(--font-mono); letter-spacing: -.02em; }
.account-head .sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.pill { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em;
        border-radius: 999px; padding: 4px 8px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 42%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 42%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 42%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.capacity { display: flex; align-items: flex-end; gap: 10px; }
.cap-main { display: flex; align-items: baseline; gap: 3px; }
.cap-main b { font-family: var(--font-heading); font-size: 36px; line-height: .95; font-weight: 700; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.cap-main span { font-family: var(--font-heading); font-size: 18px; font-weight: 600; color: var(--muted); }
.cap-main em { font-family: var(--font-mono); font-size: 9px; font-style: normal; text-transform: uppercase;
               letter-spacing: .12em; color: var(--muted); margin-left: 7px; }
.cap-info { appearance: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-strong);
            background: transparent; color: var(--muted); font-family: var(--font-mono); font-size: 10px;
            line-height: 1; padding: 0; margin-left: 4px; flex: none; }
.cap-info:hover { color: var(--text); border-color: var(--text); }
.window { display: grid; gap: 5px; }
.window .line { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.window .line .k { color: var(--muted); }
.window .line .v { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 11.5px; }
.track { height: 6px; border-radius: 999px; background: var(--sunken); border: 0; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; background: var(--ok); transition: width .3s; }
.fill.warn { background: var(--warn); }
.fill.bad { background: var(--bad); }
.foot { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12px;
        padding-top: 10px; border-top: 1px dashed var(--border); }
.foot .err { color: var(--bad); }

/* controls */
.controls { display: grid; gap: 8px; margin-top: 14px; align-items: end; }
@media (min-width: 900px) {
  .controls { grid-template-columns: auto 168px minmax(170px, 1fr) minmax(190px, 1fr); align-items: end; }
}
.control-field { display: grid; gap: 5px; min-width: 0; }
.control-field > span { color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; padding-left: 2px; }
select {
  appearance: none; width: 100%; padding: 9px 34px 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  background-color: var(--surface); color: var(--text); font-family: var(--font-body); font-size: 13px; min-height: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.filter-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; color: var(--faint); font-size: 12px; min-height: 30px; }
.filter-summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* multiselect */
.multiselect { position: relative; min-width: 0; }
.multiselect summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 13px; cursor: pointer; user-select: none;
}
.multiselect summary::-webkit-details-marker { display: none; }
.multiselect summary::after { content: ""; width: 5px; height: 5px; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted);
  transform: rotate(45deg) translateY(-2px); flex: none; }
.multiselect summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multiselect[open] summary { border-color: var(--border-strong); }
.multiselect[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.ms-menu {
  position: absolute; z-index: 30; top: calc(100% + 5px); left: 0; right: 0; min-width: 210px;
  max-height: 300px; overflow: auto; padding: 6px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lift);
}
.ms-menu label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; font-size: 12.5px; cursor: pointer; }
.ms-menu label:hover { background: var(--surface-2); }
.ms-menu input { width: 15px; height: 15px; accent-color: var(--ink); flex: none; }
.ms-menu .ms-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-menu .ms-count { margin-left: auto; color: var(--faint); font-family: var(--font-mono); font-size: 10px; }
.ms-menu .ms-all { border-bottom: 1px solid var(--border); border-radius: 7px 7px 0 0; margin-bottom: 4px; font-weight: 600; }
.ms-empty { padding: 10px; color: var(--faint); font-size: 12px; }

/* stats */
.stats { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; box-shadow: var(--shadow); }
.stat .k { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .11em; }
.stat .v { display: block; font-family: var(--font-heading); font-size: 24px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.1; }
.stat .h { display: block; color: var(--faint); font-size: 11px; line-height: 1.35; margin-top: 3px; }
.note { color: var(--faint); font-size: 11.5px; margin: 10px 0 0; }

/* charts */
.chartcard { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
             box-shadow: var(--shadow); padding: 14px 12px 10px; margin-top: 10px; }
.chartcard .title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 4px 10px; flex-wrap: wrap; }
.chartcard .title b { font-family: var(--font-heading); font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.chartcard .title span { color: var(--faint); font-size: 11.5px; }
.chartcard .title .hint { color: var(--faint); font-size: 10.5px; font-family: var(--font-mono); }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
svg.chart:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 4px; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; opacity: .75; stroke-dasharray: 2 4; }
svg.chart text { fill: var(--faint); font-size: 9.5px; font-family: var(--font-mono); }
svg.chart text.y { text-anchor: end; }
svg.chart text.x { text-anchor: middle; }
svg.chart rect.seg-ok { fill: var(--c1); }
svg.chart rect.seg-cancel { fill: var(--c6); opacity: .65; }
svg.chart rect.seg-trunc { fill: var(--c5); opacity: .7; }
svg.chart rect.seg-warn { fill: var(--c3); }
svg.chart rect.seg-err { fill: var(--bad); }
svg.chart rect.seg-cost { fill: var(--chart-1); opacity: .9; }
svg.chart rect.hot { filter: brightness(1.18) saturate(1.1); }
svg.chart path.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart path.series.dim { opacity: .18; }
svg.chart circle.dot { stroke: var(--surface); stroke-width: 2; }
svg.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
svg.chart .crosshair.on { opacity: .7; }
svg.chart .plot-hit { fill: transparent; pointer-events: all; cursor: crosshair; }
.chart-tip {
  position: absolute; z-index: 8; pointer-events: none; min-width: 190px; max-width: min(300px, calc(100% - 16px));
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: var(--shadow-lift); font-size: 12px; line-height: 1.45;
}
.chart-tip[hidden] { display: none; }
.chart-tip .tip-head { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; }
.chart-tip .tip-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 1px 0; }
.chart-tip .tip-row span { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chart-tip .tip-row b { font-family: var(--font-mono); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-tip .tip-sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip .tip-hint { margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--border); color: var(--faint); font-size: 10.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 5px 8px; padding: 9px 4px 2px; color: var(--muted); font-size: 11.5px; }
.legend button.item {
  appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 7px; font: inherit; cursor: pointer;
}
.legend button.item:hover { background: var(--surface-2); color: var(--text); }
.legend button.item.off { opacity: .38; text-decoration: line-through; }
.legend .item b { color: var(--text); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; }
.legend .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend .dash { width: 14px; height: 0; border-top: 2px solid currentColor; flex: none; }
.legend .muted { color: var(--faint); font-size: 10.5px; align-self: center; }

/* quota usage: one sparkline per account/window, never overlapped */
.quota-usage .title { padding-bottom: 8px; }
.speed-usage .title { padding-bottom: 8px; }
.speed-rank { display: grid; gap: 9px; padding: 4px 2px 2px; }
.speed-rank-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(80px, 3fr) 78px; gap: 10px; align-items: center; }
.speed-rank-name { font-family: var(--font-mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speed-rank-name .rank { color: var(--faint); font-size: 9px; margin-right: 6px; }
.speed-rank-track { height: 10px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.speed-rank-track i { display: block; height: 100%; border-radius: 999px; background: var(--chart-1); }
.speed-rank-value { text-align: right; font-family: var(--font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.speed-rank-value em { color: var(--faint); font-style: normal; font-size: 9px; }
.speed-rank-meta { grid-column: 1 / -1; color: var(--faint); font-size: 10.5px; margin-top: -4px; }
@media (max-width: 620px) {
  .speed-rank-row { grid-template-columns: minmax(0, 1fr) 62px; }
  .speed-rank-track { grid-column: 1 / -1; grid-row: 2; }
  .speed-rank-value { grid-column: 2; grid-row: 1; }
}
.speed-grid { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.speed-card { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
              background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.speed-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 6px; }
.speed-card .acct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; overflow: hidden;
                    text-overflow: ellipsis; white-space: nowrap; }
.speed-card .sub { color: var(--faint); font-size: 10.5px; margin-top: 2px; }
.speed-value { font-family: var(--font-heading); font-size: 22px; font-weight: 650; line-height: 1;
               letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.speed-value em { display: block; font-family: var(--font-mono); font-size: 8.5px; font-style: normal;
                  color: var(--faint); text-align: right; letter-spacing: .06em; margin-top: 3px; }
.speed-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 6px; margin-top: 4px;
              border-top: 1px dashed var(--border); color: var(--faint); font-family: var(--font-mono); font-size: 9.5px; }
svg.spark.speed-spark { height: 52px; }
.quota-grid { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.quota-account { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
                 background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.quota-account header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 5px; }
.quota-account .acct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; overflow: hidden;
                       text-overflow: ellipsis; white-space: nowrap; }
.quota-account .sub { color: var(--faint); font-size: 10.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota-credit { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; white-space: nowrap; }
.quota-window { display: grid; grid-template-columns: 58px minmax(0, 1fr) 44px; align-items: center; gap: 8px;
                padding: 4px 0; border-top: 1px dashed var(--border); }
.quota-window .k { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.quota-window .v { text-align: right; font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quota-window .v.ok { color: var(--ok); }
.quota-window .v.warn { color: var(--warn); }
.quota-window .v.bad { color: var(--bad); }
svg.spark { display: block; width: 100%; height: 32px; overflow: visible; cursor: crosshair; touch-action: pan-y; }
svg.spark:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
svg.spark .spark-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
svg.spark .spark-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
svg.spark .spark-dot { fill: currentColor; stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
svg.spark .spark-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; pointer-events: none; }
svg.spark .spark-cross.on { opacity: .7; }

/* repositories: aggregate row + branch drill-down */
.repo-note { margin: 4px 0 8px; }
.repos { display: grid; gap: 8px; margin-top: 10px; }
.repo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.repo summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
                cursor: pointer; list-style: none; }
.repo summary::-webkit-details-marker { display: none; }
.repo summary::marker { content: ""; }
.repo summary:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.repo summary:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.repo[open] summary { border-bottom: 1px solid var(--border); }
.repo-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.repo-chev { width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
             transform: rotate(-45deg); transition: transform .15s; flex: none; }
.repo[open] .repo-chev { transform: rotate(45deg); }
.repo-name { font-family: var(--font-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-count { color: var(--faint); font-size: 10.5px; white-space: nowrap; }
.repo-metrics { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }
.repo-metrics span { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.repo-metrics b { font-family: var(--font-heading); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.repo-metrics em { color: var(--faint); font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.repo-body { padding: 2px 14px 12px; }
.repo-body-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px 0;
                  color: var(--faint); font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; }
.repo-body table.data { margin-top: 8px; }
@media (max-width: 719px) {
  .repo summary { align-items: flex-start; flex-direction: column; gap: 8px; }
  .repo-metrics { justify-content: flex-start; gap: 8px 14px; }
  .repo-body { padding: 0 10px 10px; }
}
.empty { color: var(--muted); text-align: center; padding: 26px 14px; font-size: 13px;
         background: color-mix(in srgb, var(--surface) 60%, transparent); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

.perfhead { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em;
            color: var(--faint); margin: 16px 0 4px; display: flex; align-items: center; gap: 8px; }
.perfhead::before { content: ""; width: 10px; height: 1px; background: var(--border-strong); }

/* tables -> cards on mobile */
.tablewrap { margin-top: 10px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th { text-align: right; color: var(--muted); font-family: var(--font-mono); font-weight: 500; font-size: 9.5px;
                text-transform: uppercase; letter-spacing: .09em; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td:first-child { white-space: normal; overflow-wrap: anywhere; }
table.data td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
                font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
table.data { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data td.mono, table.data th.mono { font-family: var(--font-mono); font-size: 11.5px; }
table.data.compact th, table.data.compact td { padding: 7px 9px; }
.linkbtn { appearance: none; border: 0; background: transparent; color: var(--text); font: inherit; padding: 0;
           text-align: left; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { text-decoration-color: var(--text); }
@media (max-width: 719px) {
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data { border: 0; background: transparent; border-radius: 0; }
  table.data thead { display: none; }
  table.data tr { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
                  padding: 11px 13px; margin-top: 8px; box-shadow: var(--shadow); }
  table.data td { border: 0; padding: 2px 0; display: flex; align-items: baseline; justify-content: space-between;
                  gap: 12px; text-align: right; white-space: normal; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 400; text-align: left; }
  table.data td:first-child { display: block; text-align: left; font-size: 14px; font-weight: 600; padding-bottom: 6px; }
  table.data td:first-child::before { content: none; }
  table.data td:empty { display: none; }
}

/* keys */
.keys { display: grid; gap: 11px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .keys { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.keycard { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
           padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; overflow: hidden; }
.keycard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--border-strong); }
.keycard.revoked::before { background: var(--border-strong); }
.keycard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.keycard .name { font-family: var(--font-heading); font-weight: 650; font-size: 17px; letter-spacing: -.02em; line-height: 1.2; }
.keycard .id { color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; margin-top: 3px; }
.key-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.key-stats div { background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.key-stats span { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .09em; }
.key-stats b { display: block; font-family: var(--font-heading); font-size: 16px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.budget { display: grid; gap: 6px; }
.budget .line { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.budget .line b { color: var(--text); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.budgetbar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.budgetbar i { display: block; height: 100%; border-radius: 999px; background: var(--ink); transition: width .3s; }
.budgetbar i.warn { background: var(--warn); }
.budgetbar i.bad { background: var(--bad); }
.budget .cap { font-size: 10.5px; color: var(--faint); }
.keycard .actions { display: flex; justify-content: flex-end; gap: 7px; padding-top: 2px; }
.keycard.revoked { opacity: .72; }

/* subscriptions */
.subhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.subhead h2 { margin: 0; }
.subs { display: grid; gap: 11px; grid-template-columns: minmax(0, 1fr); margin-top: 10px; }
@media (min-width: 760px) { .subs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.subcard.off { opacity: .72; }
.subcard.off::before { background: var(--border-strong); }
.submeta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding-top: 10px; border-top: 1px dashed var(--border); }
.submeta div { min-width: 0; }
.submeta .wide { grid-column: 1 / -1; }
.submeta span { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9px;
                text-transform: uppercase; letter-spacing: .09em; margin-bottom: 2px; }
.submeta b { display: block; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; overflow-wrap: anywhere; }
.check { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); flex: none; }
.field input:disabled { opacity: .62; }
dialog.subdialog { width: min(560px, calc(100vw - 32px)); }
.subdialog .row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .subdialog .row { grid-template-columns: minmax(0, 1fr); } }

/* live */
.live-hero { display: grid; gap: 9px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
@media (min-width: 760px) { .live-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .live-hero { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.live-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; box-shadow: var(--shadow); min-width: 0; }
.live-card span { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .1em; }
.live-card b { display: block; font-family: var(--font-heading); font-size: 25px; line-height: 1.05; letter-spacing: -.035em; font-variant-numeric: tabular-nums; margin-top: 5px; }
.live-card em { display: block; color: var(--faint); font-style: normal; font-size: 10.5px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card.hot { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }
.live-grid { display: grid; gap: 10px; margin-top: 12px; }
@media (min-width: 900px) { .live-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.live-panel { min-width: 0; align-content: start; }
.live-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.live-panel h2 { margin: 0; }
.live-updated { color: var(--faint); font-family: var(--font-mono); font-size: 9.5px; white-space: nowrap; }
.live-panel .empty { margin-top: 10px; }

/* models */
.model-controls { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .model-controls { grid-template-columns: minmax(220px, 1fr) 160px 150px auto; align-items: end; }
}
.control-field input {
  width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: 13px; min-height: 40px;
}
.control-field input::placeholder { color: var(--faint); }
.model-controls > .primary { min-height: 40px; }
@media (max-width: 759px) { .model-controls > .primary { width: 100%; } }
.family-panel { margin-top: 12px; }
.family-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.family-panel h2 { margin: 0; }
.family-panel .hintline { margin-top: 4px; }
.family-order { display: flex; flex-wrap: wrap; gap: 6px; }
.family-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 9px;
               background: var(--surface-2); padding: 5px 6px 5px 10px; font-size: 12px; }
.family-chip b { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; }
.family-chip .ord { color: var(--faint); font-family: var(--font-mono); font-size: 9.5px; }
.family-chip button { appearance: none; border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px;
                      border-radius: 6px; padding: 0; font-size: 13px; line-height: 1; }
.family-chip button:hover { background: var(--surface); color: var(--text); }
.family-chip button:disabled { opacity: .25; cursor: default; }
.model-list { display: grid; gap: 8px; margin-top: 10px; }
.model-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
              padding: 13px 14px; box-shadow: var(--shadow); display: grid; gap: 9px; }
.model-card.off { opacity: .66; }
.model-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.model-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.model-title code { font-family: var(--font-mono); font-size: 12.5px; background: transparent; border: 0; padding: 0;
                    overflow-wrap: anywhere; }
.model-meta { color: var(--faint); font-size: 10.5px; font-family: var(--font-mono); }
.model-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.model-actions button { min-height: 30px; padding: 4px 9px; font-size: 11.5px; }
.model-switch { appearance: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong);
                background: var(--surface); color: var(--muted); border-radius: 999px; padding: 3px 9px 3px 4px;
                font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.model-switch > span { width: 18px; height: 18px; border-radius: 50%; background: var(--sunken); position: relative; flex: none; }
.model-switch > span::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--faint); }
.model-switch.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.model-switch.on > span { background: color-mix(in srgb, var(--ok) 22%, var(--sunken)); }
.model-switch.on > span::after { background: var(--ok); }
.provider-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.provider-toggle { appearance: none; display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
                   border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
                   border-radius: 9px; padding: 6px 9px; font: inherit; font-size: 11.5px; text-align: left; }
.provider-toggle:hover { background: var(--surface-2); }
.provider-toggle[aria-pressed="false"] { border-style: dashed; color: var(--faint); background: transparent; }
.provider-toggle .pdot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.provider-toggle[aria-pressed="false"] .pdot { background: var(--faint); }
.provider-toggle .pfam { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.provider-toggle .pup { color: var(--faint); font-family: var(--font-mono); font-size: 9.5px; overflow: hidden;
                        text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.model-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
              color: var(--faint); font-size: 11px; border-top: 1px dashed var(--border); padding-top: 7px; }
.model-foot .pref { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.model-foot .pref b { color: var(--muted); font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.model-foot .pref .arrow { color: var(--border-strong); }
@media (max-width: 620px) {
  .model-head { flex-direction: column; }
  .model-actions { justify-content: flex-start; }
  .provider-toggle .pup { max-width: 150px; }
}
.modeldialog { width: min(640px, calc(100vw - 32px)); }
.alias-rows { display: grid; gap: 8px; }
.alias-row { display: grid; grid-template-columns: 145px minmax(0, 1fr) auto auto; gap: 7px; align-items: center; }
.alias-row select { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.alias-row input[type="text"] { min-height: 38px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
                                background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: 12px; }
.alias-row .alias-on { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.alias-row .alias-on input { width: 15px; height: 15px; accent-color: var(--ink); }
.alias-row .x { width: 28px; height: 28px; }
@media (max-width: 620px) {
  .alias-row { grid-template-columns: minmax(0, 1fr) auto; }
  .alias-row .alias-upstream { grid-column: 1 / -1; }
  .alias-row .alias-on { grid-column: 1; }
}
.prefDialog { width: min(520px, calc(100vw - 32px)); }
.pref-rows { display: grid; gap: 6px; }
.pref-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 9px;
            background: var(--surface-2); padding: 6px 8px; }
.pref-row .n { color: var(--faint); font-family: var(--font-mono); font-size: 10px; width: 18px; }
.pref-row .name { flex: 1; font-family: var(--font-mono); font-size: 12px; }
.pref-row button { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
                   width: 27px; height: 27px; border-radius: 7px; padding: 0; font-size: 12px; line-height: 1; }
.pref-row button:hover { color: var(--text); }
.pref-row button:disabled { opacity: .3; cursor: default; }
.pref-add { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pref-add select { flex: 1; min-width: 150px; }
.pref-add button { min-height: 34px; padding: 5px 10px; font-size: 12px; }
.pref-label { margin: 14px 0 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.pref-section { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.pref-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); cursor: pointer; }
.pref-toggle input { width: 15px; height: 15px; accent-color: var(--ink); }
.pref-windows { display: grid; gap: 6px; margin: 8px 0; }
.pref-window { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; border: 1px solid var(--border);
               border-radius: 9px; padding: 7px 8px; background: var(--surface-2); }
.pref-days { display: flex; gap: 5px; flex-wrap: wrap; flex: 1 0 100%; }
.pref-days label { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono);
                   font-size: 10px; color: var(--muted); }
.pref-days input { width: 14px; height: 14px; accent-color: var(--ink); }
.pref-window input[type="time"] { width: 92px; }
.pref-dash { color: var(--faint); }
.pref-window button { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
                      width: 27px; height: 27px; border-radius: 7px; padding: 0; font-size: 12px; line-height: 1; }
.pref-window button:hover { color: var(--text); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
         padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.panel .row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 620px) { .panel .row { grid-template-columns: minmax(0, 1fr) 220px; align-items: end; } }
.field { display: grid; gap: 6px; }
.field span { color: var(--muted); font-size: 11px; font-family: var(--font-mono); letter-spacing: .04em; }
.field input {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; min-height: 42px;
}
.field input::placeholder { color: var(--faint); }
.field input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
button { font: inherit; cursor: pointer; }
.primary, .danger, .ghost {
  min-height: 42px; padding: 10px 16px; border-radius: 9px; font-family: var(--font-body);
  font-weight: 600; font-size: 14px; border: 1px solid transparent;
}
.primary { background: var(--ink); color: var(--paper); }
.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.primary:active { transform: translateY(0); }
.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.ghost:hover { background: var(--surface-2); }
.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, var(--border)); font-size: 13px; min-height: 36px; padding: 7px 12px; }
.danger:hover { background: color-mix(in srgb, var(--bad) 7%, transparent); }
.ghost.small, .danger.small { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.danger:disabled { opacity: .5; cursor: default; }
.hintline { color: var(--faint); font-size: 12px; margin: 0; }
.panel > .primary { justify-self: start; }
@media (max-width: 759px) { .panel .primary { width: 100%; } }
.secret { margin-top: 12px; background: var(--surface-2);
          border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 15px; display: grid; gap: 9px; box-shadow: var(--shadow); }
.secret b { font-family: var(--font-heading); font-size: 15px; }
.secret .keyval { font-family: var(--font-mono); font-size: 12px; word-break: break-all;
                  background: var(--surface); border: 1px solid var(--border); padding: 10px 11px; border-radius: 8px; }
.secret .hint { color: var(--muted); font-size: 12px; }
.secret .row { display: flex; gap: 8px; flex-wrap: wrap; }
.secret .row button { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* dialogs */
dialog.keydialog {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 18px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lift);
}
dialog.keydialog::backdrop { background: color-mix(in srgb, var(--ink) 28%, transparent); backdrop-filter: blur(3px); }
.keydialog form { padding: 20px; display: grid; gap: 14px; }
.keydialog .body { padding: 20px; display: grid; gap: 14px; }
.keydialog .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.keydialog h2 { margin: 0; font-family: var(--font-heading); font-size: 20px; font-weight: 650; letter-spacing: -.025em; text-transform: none; color: var(--text); }
.keydialog h2::before { display: none; }
.keydialog .sub { color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; margin-top: 3px; }
.keydialog .x { appearance: none; border: 1px solid var(--border); background: transparent; color: var(--muted);
                width: 30px; height: 30px; border-radius: 50%; font-size: 16px; line-height: 1; flex: none; }
.keydialog .actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.keydialog .spent { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.keydialog .spent b { color: var(--text); font-family: var(--font-mono); font-size: 11.5px; }

dialog.capacitydialog { width: min(520px, calc(100vw - 32px)); }
.capacitydialog .formula { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.capacitydialog .formula b { color: var(--text); font-weight: 600; }
.capacitydialog .calc { display: grid; gap: 0; border-top: 1px solid var(--border); }
.capacitydialog .calcrow { display: grid; grid-template-columns: 44px 1fr 56px; gap: 9px; align-items: baseline;
                           padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12px; }
.capacitydialog .calcrow .h { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase;
                              letter-spacing: .08em; color: var(--muted); }
.capacitydialog .calcrow .v { color: var(--text); }
.capacitydialog .calcrow .w { text-align: right; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.capacitydialog .calcline { display: flex; justify-content: space-between; gap: 12px; padding-top: 9px; font-size: 12.5px; color: var(--muted); }
.capacitydialog .calcline b { color: var(--text); font-family: var(--font-mono); font-size: 12px; }
.capacitydialog .total { margin-top: 4px; padding-top: 11px; border-top: 1px solid var(--border); align-items: baseline; }
.capacitydialog .total span { color: var(--text); font-weight: 600; }
.capacitydialog .total b { font-family: var(--font-heading); font-size: 24px; letter-spacing: -.03em; }

dialog.detaildialog { width: min(940px, calc(100vw - 32px)); }
.detaildialog .body { max-height: min(82vh, 900px); overflow: auto; }
.detaildialog .detail-stats { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .detaildialog .detail-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.detaildialog .detail-stats .stat { padding: 10px 11px; }
.detaildialog .detail-stats .stat .v { font-size: 20px; }
.detaildialog h3 { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
                   color: var(--muted); margin: 16px 0 4px; display: flex; align-items: baseline; gap: 8px; }
.detaildialog h3::before { content: ""; width: 10px; height: 1px; background: var(--border-strong); align-self: center; }
.detaildialog .empty { padding: 16px; }
.detail-loading { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--ink); color: var(--paper); border-radius: 999px; padding: 10px 16px;
  font-size: 12.5px; box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* gate */
#gate { max-width: 430px; margin: 16vh auto 0; padding: 26px; display: grid; gap: 16px; }
#gate .lockup { display: flex; align-items: baseline; gap: 8px; }
#gate .lockup .wordmark { font-family: var(--font-heading); font-size: 21px; font-weight: 600; letter-spacing: -.025em; }
#gate .lockup .product { font-family: var(--font-body); font-size: 12px; font-weight: 400;
                         letter-spacing: 0; color: var(--muted); background: transparent; padding: 0; }
#gate h2 { margin: 0; font-family: var(--font-heading); font-size: 27px; line-height: 1.1; letter-spacing: -.035em;
           font-weight: 700; color: var(--text); display: block; text-transform: none; }
#gate h2::before { display: none; }
#gate p { margin: 0; color: var(--muted); font-size: 13px; }
#gate .field input { min-height: 46px; }
@media (max-width: 400px) { #gate { margin-top: 9vh; padding: 20px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
