/* NexusForever progress dashboard. Colour tokens first; light by default, dark through prefers-color-scheme
   (unless the page is stamped light) or an explicit data-theme="dark". */
:root {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --surface-3: #e7e6e0;
  --ink: #121211;
  --ink-2: #4f4e4a;
  --muted: #6b6963;
  --faint: #8d8b84;
  --grid: #e6e5df;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, .09);
  --border-strong: rgba(11, 11, 11, .17);
  --accent: #2a78d6;
  --accent-wash: rgba(42, 120, 214, .10);
  --link: #1c5cab;
  --good-ink: #006300;
  --bad-ink: #b02626;
  --mark: rgba(250, 178, 25, .38);
  --s-works: #0ca30c;
  --s-partial: #f0a50e;
  --s-broken: #d03b3b;
  --s-untested: #9c9a92;
  --s-not-started: #c6c4bb;
  --s-out-of-scope: #dfded7;
  --s-other: #7c74c9;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-other: #a3a19a;
  --shadow: 0 1px 2px rgba(20, 20, 18, .05), 0 2px 8px rgba(20, 20, 18, .04);
  --shadow-pop: 0 6px 24px rgba(20, 20, 18, .14), 0 1px 3px rgba(20, 20, 18, .08);
  --header-bg: rgba(252, 252, 251, .86);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Cambria, "Noto Serif", "DejaVu Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px;
  --radius-s: 8px;
  --gutter: 24px;
  --maxw: 1320px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2c2c29;
    --ink: #f3f3ef;
    --ink-2: #c6c5bb;
    --muted: #a09e95;
    --faint: #85837b;
    --grid: #2b2b29;
    --axis: #3b3b38;
    --border: rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .16);
    --accent: #3987e5;
    --accent-wash: rgba(57, 135, 229, .16);
    --link: #86b6ef;
    --good-ink: #3dc43d;
    --bad-ink: #f07b7b;
    --mark: rgba(250, 178, 25, .30);
    --s-works: #18b318;
    --s-partial: #fab219;
    --s-broken: #e04848;
    --s-untested: #807e77;
    --s-not-started: #55544f;
    --s-out-of-scope: #393936;
    --s-other: #9085e9;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-other: #6d6b65;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55), 0 1px 3px rgba(0, 0, 0, .5);
    --header-bg: rgba(20, 20, 19, .84);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --surface-3: #2c2c29;
  --ink: #f3f3ef;
  --ink-2: #c6c5bb;
  --muted: #a09e95;
  --faint: #85837b;
  --grid: #2b2b29;
  --axis: #3b3b38;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --accent: #3987e5;
  --accent-wash: rgba(57, 135, 229, .16);
  --link: #86b6ef;
  --good-ink: #3dc43d;
  --bad-ink: #f07b7b;
  --mark: rgba(250, 178, 25, .30);
  --s-works: #18b318;
  --s-partial: #fab219;
  --s-broken: #e04848;
  --s-untested: #807e77;
  --s-not-started: #55544f;
  --s-out-of-scope: #393936;
  --s-other: #9085e9;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-other: #6d6b65;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55), 0 1px 3px rgba(0, 0, 0, .5);
  --header-bg: rgba(20, 20, 19, .84);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans);
  overflow-x: clip; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; outline: none; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
code, .mono { font-family: var(--mono); font-size: .88em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 30; background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px var(--gutter);
  display: grid; grid-template-columns: auto auto minmax(200px, 1fr) auto; gap: 18px; align-items: center;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; color: var(--accent); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; letter-spacing: .005em; }
.brand-sub { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--ink-2); padding: 7px 11px; border-radius: 8px; font-size: .9rem; font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-3); }
.search { position: relative; }
.search input {
  width: 100%; height: 38px; padding: 0 34px 0 36px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-key {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 .72rem var(--mono); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; pointer-events: none;
}
.search input:focus ~ .search-key { display: none; }
.top-tools { display: flex; align-items: center; gap: 8px; }
.fresh { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .82rem; white-space: nowrap; padding: 6px 8px; border-radius: 8px; }
.fresh:hover { background: var(--surface-2); text-decoration: none; }
.fresh-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--s-untested); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-untested) 22%, transparent); }
.fresh.ok .fresh-dot { background: var(--s-works); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-works) 22%, transparent); }
.fresh.warn .fresh-dot { background: var(--s-partial); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-partial) 25%, transparent); }
.fresh.bad .fresh-dot { background: var(--s-broken); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-broken) 22%, transparent); }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border);
  background: transparent; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* typeahead */
.typeahead {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px;
  min-width: min(440px, calc(100vw - 32px));
}
.ta-group { padding: 8px 10px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: flex; justify-content: space-between; }
.ta-item {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 7px 10px; border-radius: 8px;
  color: var(--ink); cursor: pointer;
}
.ta-item:hover, .ta-item[aria-selected="true"] { background: var(--surface-2); text-decoration: none; }
.ta-item .ta-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ta-item .ta-meta { grid-column: 2; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-foot { display: block; padding: 9px 10px; margin-top: 4px; border-top: 1px solid var(--border); font-size: .85rem; }
.ta-empty { padding: 14px 10px; color: var(--muted); font-size: .9rem; }

.newdata {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow-pop);
  font-size: .9rem; max-width: calc(100vw - 32px);
}

/* ------------------------------------------------------------------ page */
.page { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(1.7rem, 3.2vw, 2.35rem); font-weight: 600; letter-spacing: -.015em; line-height: 1.15; }
.page-head .lede { color: var(--ink-2); max-width: 70ch; margin-top: 6px; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.boot { padding: 60px 0; text-align: center; }
.boot .loading-line { max-width: 240px; margin: 0 auto 14px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 18px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head { padding: 16px 20px 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.panel-head h2 { font-size: 1rem; }
.panel-head .sub { color: var(--muted); font-size: .85rem; flex-basis: 100%; }
.panel-head .actions { display: flex; gap: 8px; align-items: center; font-size: .85rem; }
.panel-body { padding: 14px 20px 18px; transition: opacity .2s; min-width: 0; }
.panel-body.stale { opacity: .55; }
.panel-body.flush { padding: 10px 0 0; }

.loading-line {
  height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--accent-wash) 50%, var(--surface-3) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin: 10px 0;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .loading-line { animation: none; } }

.empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-s); padding: 18px 16px; color: var(--muted);
  display: grid; gap: 4px; font-size: .9rem; background: var(--surface-2);
}
.empty strong { color: var(--ink-2); font-weight: 600; }
.empty.error { border-style: solid; border-color: color-mix(in srgb, var(--s-broken) 40%, transparent); background: color-mix(in srgb, var(--s-broken) 6%, var(--surface)); }

/* ------------------------------------------------------------------ status pills & bars */
.s-works { --pc: var(--s-works); }
.s-partial { --pc: var(--s-partial); }
.s-broken { --pc: var(--s-broken); }
.s-untested { --pc: var(--s-untested); }
.s-not-started { --pc: var(--s-not-started); }
.s-out-of-scope { --pc: var(--s-out-of-scope); }
.s-other { --pc: var(--s-other); }
.pill {
  display: inline-flex; align-items: center; gap: .42em; padding: .08em .6em .08em .48em; border-radius: 999px;
  font-size: .78rem; font-weight: 550; line-height: 1.55; white-space: nowrap; color: var(--ink);
  background: color-mix(in srgb, var(--pc) 15%, transparent); border: 1px solid color-mix(in srgb, var(--pc) 34%, transparent);
}
.pill .dot { width: .52em; height: .52em; border-radius: 50%; background: var(--pc); flex: none; }
.pill.s-not-started, .pill.s-out-of-scope { color: var(--muted); }
.pill.s-out-of-scope { border-style: dashed; border-color: var(--border-strong); }
.pill.s-not-started { border-color: var(--border-strong); }
.chip {
  display: inline-flex; align-items: center; gap: .4em; padding: .1em .55em; border-radius: 6px; font-size: .76rem; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap;
}
.chip .swatch { width: 8px; height: 8px; border-radius: 2px; }

.sbar { display: flex; gap: 2px; height: 10px; border-radius: 3px; overflow: hidden; background: var(--surface-2); min-width: 0; }
.sbar.tall { height: 14px; }
.sbar.thin { height: 6px; }
.sbar .seg { flex: 1 1 0; min-width: 3px; background: var(--pc); display: block; transition: filter .12s; }
.sbar .seg:first-child { border-radius: 3px 0 0 3px; }
.sbar .seg:last-child { border-radius: 0 3px 3px 0; }
.sbar .seg:only-child { border-radius: 3px; }
.sbar a.seg:hover, .sbar a.seg:focus-visible { filter: brightness(1.12) saturate(1.1); }
.sbar a.seg:focus-visible { outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: .82rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--pc); flex: none; }
.legend-item .swatch.line { height: 2px; width: 14px; border-radius: 1px; }
.legend-item .swatch.tick { width: 3px; height: 13px; border-radius: 1px; background: var(--ink); }
.legend-item b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
a.legend-item:hover { text-decoration: none; color: var(--ink); }
a.legend-item:hover b { text-decoration: underline; }

.meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter.good > span { background: var(--s-works); }
.meter.small { height: 5px; }

/* ------------------------------------------------------------------ overview cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative;
}
.card.wide { grid-column: span 2; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-title { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.card-title a { color: inherit; }
.ago { font-size: .74rem; color: var(--faint); white-space: nowrap; }
.ago.failed { color: var(--bad-ink); }
.hero { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big {
  font-family: var(--serif); font-size: clamp(2.3rem, 4.2vw, 2.9rem); line-height: 1; font-weight: 500; color: var(--ink);
  letter-spacing: -.02em; font-variant-numeric: lining-nums proportional-nums;
}
a.big:hover { text-decoration: none; color: var(--link); }
.of { font-family: var(--serif); font-size: 1.15rem; color: var(--muted); font-variant-numeric: lining-nums; }
.of a { color: var(--muted); }
.of a:hover { color: var(--link); }
.pct-badge { margin-left: auto; font-size: .9rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.card-line { font-size: .86rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.card-line a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.card-line a:hover { color: var(--link); text-decoration-color: currentColor; }
.card-line b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--bad-ink); }
.delta.flat { color: var(--muted); }
.spark-row { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.spark { flex: 1; min-width: 0; height: 36px; }
.spark svg { display: block; width: 100%; height: 36px; overflow: visible; }
.spark-label { font-size: .72rem; color: var(--faint); white-space: nowrap; }
.card-foot { margin-top: auto; padding-top: 4px; font-size: .85rem; font-weight: 550; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card-foot .ago { font-weight: 400; }
.card.full { grid-column: 1 / -1; }
.card-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px 32px; align-items: start; }
.card-split > div { display: grid; gap: 10px; min-width: 0; }
@media (max-width: 900px) { .card-split { grid-template-columns: minmax(0, 1fr); } }
.minirows { display: grid; gap: 7px; font-size: .84rem; }
.minirow { display: grid; grid-template-columns: minmax(84px, auto) 1fr auto; gap: 10px; align-items: center; }
.minirow > :first-child { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.minirow .n { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; }
.minirow .n a { color: var(--ink); }
.minirow .n small { color: var(--muted); font-weight: 400; }
.soak-line { font-size: .86rem; color: var(--ink-2); line-height: 1.45; background: var(--surface-2); border-radius: 8px; padding: 9px 11px; border: 1px solid var(--border); overflow-wrap: anywhere; }
.agent-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--series-other); flex: none; }
.agent-claude { --ac: var(--series-1); --pc: var(--series-1); }
.agent-codex { --ac: var(--series-2); --pc: var(--series-2); }
.agent-zcode { --ac: var(--series-3); --pc: var(--series-3); }
.agent-other { --ac: var(--series-other); --pc: var(--series-other); }
.c-accent, .tc-accent { --pc: var(--accent); }
.tc-series-1 { --pc: var(--series-1); }
.tc-series-2 { --pc: var(--series-2); }
.tc-series-3 { --pc: var(--series-3); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 26px; }
.stat { min-width: 0; display: grid; gap: 4px; align-content: start; text-align: left; }
button.stat { border: 0; background: none; padding: 6px 8px; margin: -6px -8px; border-radius: 10px; cursor: pointer; font: inherit; color: inherit; }
button.stat:hover { background: var(--surface-2); }
button.stat[aria-pressed="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.stat .big { font-size: clamp(1.75rem, 3vw, 2.25rem); }
.stat .card-line { font-size: .8rem; }
.panel-note { font-size: .8rem; color: var(--muted); margin-top: 10px; }
.agent-dot[class*="agent-"] { background: var(--ac); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 34px 0 12px; gap: 12px; }
.section-title h2 { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }

/* ------------------------------------------------------------------ filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 18px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.field { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.field input[type="search"], .field input[type="text"], .field input[type="number"], .field select {
  height: 34px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); padding: 0 10px; color: var(--ink);
  min-width: 0; outline: none;
}
.field input[type="number"] { width: 72px; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.field.grow { flex: 1 1 220px; }
.field.grow input { width: 100%; }
.toggles { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .82rem; color: var(--ink-2); white-space: nowrap;
}
.toggle:hover { background: var(--surface-2); }
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.toggle[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--surface); }
.toggle .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--accent)); }
.toggle .count { font-variant-numeric: tabular-nums; opacity: .7; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .85rem; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-small { height: 28px; padding: 0 11px; font-size: .8rem; border-radius: 999px; }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tabs a {
  padding: 9px 14px; color: var(--ink-2); font-weight: 550; font-size: .92rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a .count { color: var(--muted); font-weight: 400; margin-left: 4px; font-size: .85em; }

/* ------------------------------------------------------------------ tables */
.dtable-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 0 20px 10px; font-size: .85rem; color: var(--muted); }
.dtable-bar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.data th, table.data td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data thead th {
  position: sticky; top: 0; background: var(--surface); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600; white-space: nowrap; z-index: 1;
}
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.id { font-family: var(--mono); font-size: .8rem; white-space: nowrap; }
table.data.mini { font-size: .8rem; }
table.data.mini th, table.data.mini td { padding: 5px 10px; }
table.data.mini th:first-child, table.data.mini td:first-child { padding-left: 0; }
table.data.mini thead th { position: static; }
table.data td.nowrap { white-space: nowrap; }
table.data td.wrap { min-width: 15rem; max-width: 28rem; }
table.data td.narrow-wrap { min-width: 9rem; max-width: 13rem; overflow-wrap: anywhere; }
table.data td.title { min-width: 12rem; font-weight: 550; }
table.data td.title a { color: var(--ink); }
table.data td.title a:hover { color: var(--link); }
.sort-btn {
  border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
  display: inline-flex; align-items: center; gap: 4px;
}
.sort-btn:hover { color: var(--ink); }
.sort-btn .arrow { opacity: .35; font-size: .9em; }
th[aria-sort] .sort-btn { color: var(--ink); }
th[aria-sort] .sort-btn .arrow { opacity: 1; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); font-size: .84rem; }
.clamp:hover { -webkit-line-clamp: unset; line-clamp: unset; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 20px 14px; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); }
.pager .btn[disabled] { opacity: .45; cursor: default; }
.inline-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inline-bar .ib { width: 64px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: none; }
.inline-bar .ib > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.yes { color: var(--good-ink); font-weight: 600; }
.no { color: var(--faint); }

/* ------------------------------------------------------------------ charts */
.zone-rows { display: grid; gap: 7px; }
.zone-row {
  display: grid; grid-template-columns: minmax(96px, 168px) minmax(0, 1fr) 92px; gap: 12px; align-items: center; font-size: .84rem;
  padding: 2px 4px; margin: 0 -4px; border-radius: 6px;
}
.zone-row:hover { background: var(--surface-2); }
.zone-rows.wide .zone-row { grid-template-columns: minmax(120px, 280px) minmax(0, 1fr) 92px; }
.zone-row .zl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit; }
.zone-row .zl:hover { color: var(--link); text-decoration: underline; }
.zone-row .zl[aria-pressed="true"] { color: var(--ink); font-weight: 650; }
.zone-row .zn { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.zone-row .zn b { color: var(--ink); font-weight: 600; }
.track { position: relative; height: 12px; }
.track .sbar { height: 12px; position: absolute; left: 0; top: 0; }
.tick { position: absolute; top: -3px; width: 2px; height: 18px; background: var(--ink); border-radius: 1px; opacity: .8; pointer-events: none; }
.cols { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 18px; position: relative; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.col-plot { flex: 1; width: 100%; max-width: 44px; position: relative; display: flex; flex-direction: column-reverse; gap: 2px; }
.col-plot .seg { background: var(--pc); width: 100%; display: block; min-height: 0; }
.col-plot .seg:last-child { border-radius: 4px 4px 0 0; }
.col-plot .cap { position: absolute; left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-plot .ctick { position: absolute; left: -4px; right: -4px; height: 2px; background: var(--ink); opacity: .8; border-radius: 1px; pointer-events: none; }
.col-label { font-size: .74rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; border: 0; background: none; padding: 0; cursor: pointer; }
.col-label:hover { color: var(--link); }
.col-label[aria-pressed="true"] { color: var(--ink); font-weight: 650; }
.col-hit { position: absolute; inset: -18px -5px 0; cursor: pointer; border-radius: 6px; border: 0; background: transparent; padding: 0; appearance: none; }
.col-hit[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
.col-hit:hover, .col-hit:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.baseline { position: absolute; left: 0; right: 0; bottom: 22px; height: 1px; background: var(--axis); }
.chart { width: 100%; min-width: 0; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis text { fill: var(--faint); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .axis path, .chart .axis line { stroke: var(--axis); shape-rendering: crispEdges; }
.hit { fill: transparent; cursor: crosshair; outline: none; }
.hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
.crosshair { stroke: var(--ink-2); stroke-width: 1; opacity: .5; pointer-events: none; }
.chart .end-label { fill: var(--ink); font: 600 12px var(--sans); font-variant-numeric: tabular-nums; }
.chart .bar { transition: filter .12s; }
.chart .bar:hover, .chart .bar.on { filter: brightness(1.15); }
.chart-title { font-size: .86rem; font-weight: 600; margin-bottom: 2px; }
.chart-sub { font-size: .78rem; color: var(--muted); margin-bottom: 8px; }
.multiples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; }

/* tooltip */
.tip {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; max-width: min(320px, calc(100vw - 16px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-pop);
  padding: 9px 11px; font-size: .82rem; line-height: 1.4;
}
.tip-title { font-weight: 600; margin-bottom: 4px; color: var(--ink-2); font-size: .78rem; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row .k { width: 12px; height: 2px; border-radius: 1px; background: var(--pc, var(--accent)); flex: none; }
.tip-row .kbox { width: 9px; height: 9px; border-radius: 2px; background: var(--pc, var(--accent)); flex: none; }
.tip-row b { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 3ch; }
.tip-row span { color: var(--ink-2); }
.tip-note { color: var(--muted); margin-top: 4px; font-size: .76rem; }

/* ------------------------------------------------------------------ entity & search */
.entity-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 8px; }
.entity-id { font-family: var(--mono); font-size: .85rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 22px; }
.fact { min-width: 0; }
.fact dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: 3px; }
.fact dd { margin: 0; font-size: .93rem; overflow-wrap: anywhere; }
.fact.long { grid-column: 1 / -1; }
.fact.long dd { color: var(--ink-2); line-height: 1.55; max-width: 90ch; }
.prose { color: var(--ink-2); line-height: 1.6; max-width: 90ch; }
.timeline { display: flex; flex-wrap: wrap; gap: 4px; }
.timeline .tl { width: 22px; height: 22px; border-radius: 5px; background: var(--pc); display: block; }
.timeline .tl:focus-visible { outline-offset: 1px; }
.results-group { margin-bottom: 22px; }
.results-group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 8px; display: flex; gap: 10px; align-items: baseline; }
.results-group h2 a { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 500; }
.result {
  display: grid; grid-template-columns: minmax(6.9rem, auto) 1fr; gap: 3px 12px; padding: 12px 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border); margin-bottom: 6px; color: var(--ink);
}
.result:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow); }
.result .r-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.result > .pill { justify-self: start; }
.result .r-name .entity-id { margin-left: 6px; font-weight: 400; }
.result .r-meta { grid-column: 2; font-size: .82rem; color: var(--muted); }
.result .r-snip { grid-column: 2; font-size: .85rem; color: var(--ink-2); overflow-wrap: anywhere; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
details.raw summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
details.raw pre { font: .78rem/1.5 var(--mono); background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.big-search { display: flex; gap: 10px; margin-bottom: 14px; }
.big-search input { flex: 1; height: 46px; font-size: 1.05rem; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; min-width: 0; }
.big-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.facet-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.facet-row .label { font-size: .78rem; color: var(--muted); margin-right: 4px; min-width: 52px; }

.foot {
  max-width: var(--maxw); margin: 0 auto; width: 100%; padding: 18px var(--gutter) 28px; color: var(--faint); font-size: .8rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border);
}
.foot a { color: var(--muted); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .top-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .nav { grid-column: 1 / -1; grid-row: 2; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card.wide { grid-column: auto; }
  .multiples { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  body { font-size: 14.5px; }
  .top-inner { gap: 10px 12px; padding-top: 8px; padding-bottom: 6px; }
  .brand-sub { display: none; }
  .fresh-text { display: none; }
  .search-key { display: none; }
  .page { padding-top: 20px; }
  .hide-sm { display: none; }
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
  .col-label.alt { visibility: hidden; }
  .zone-row { grid-template-columns: minmax(78px, 112px) minmax(0, 1fr) 70px; gap: 8px; }
  .cols { gap: 5px; }
  .col-plot .cap { font-size: .66rem; }
  .col-label { font-size: .66rem; }
  .filters { padding: 10px; }
  .field { flex-wrap: wrap; }
  table.data th, table.data td { padding: 8px 9px; }
  table.data th:first-child, table.data td:first-child { padding-left: 14px; }
  .panel-head { padding: 14px 16px 0; }
  .panel-body { padding: 12px 16px 16px; }
  .dtable-bar { padding: 0 16px 10px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .brand-name { font-size: 1rem; }
  .brand-mark { width: 24px; height: 24px; }
  .top-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .icon-btn { width: 32px; height: 32px; }
  .search input { padding-right: 10px; }
}
@media (forced-colors: active) {
  .sbar .seg, .col-plot .seg, .pill .dot, .legend-item .swatch { forced-color-adjust: none; }
}
@media print {
  .top, .filters, .newdata, .pager, .foot { display: none; }
  .panel, .card { box-shadow: none; break-inside: avoid; }
}
@media (max-width: 1360px) { .hide-lg { display: none; } }
