:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #76756f;
  --series: #2a78d6;
  --track: #e8e7e2;
  --grid: #e2e1dc;
  --good: #0ca30c;
  --critical: #d03b3b;
  --accent-ink: #1c5cab;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #121211;
    --surface: #1a1a19;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #98978e;
    --series: #3987e5;
    --track: #2c2c29;
    --grid: #2c2c29;
    --accent-ink: #86b6ef;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
h2 { font-size: 1.05rem; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.muted { color: var(--text-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
.who { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 0.9rem; }
.who form { margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-ink); font: inherit; cursor: pointer; }
button.link:hover { text-decoration: underline; }

main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-block; margin-bottom: 4px; font-size: 0.9rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented a { padding: 6px 12px; color: var(--text-2); font-size: 0.9rem; border-left: 1px solid var(--border); }
.segmented a:first-child { border-left: 0; }
.segmented a:hover { text-decoration: none; background: var(--track); }
.segmented a[aria-current] { background: var(--text); color: var(--surface); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 64px auto; }
.card.narrow h1 { margin-bottom: 8px; }
.button { display: inline-block; margin-top: 8px; padding: 9px 16px; border-radius: 8px; background: var(--text); color: var(--surface); font-weight: 600; }
.button:hover { text-decoration: none; opacity: 0.88; }
.button.small { margin-top: 0; padding: 6px 12px; font-size: 0.9rem; font-weight: 500; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.button.small:hover { background: var(--track); opacity: 1; }
.empty { color: var(--text-3); margin: 8px 0 0; }
.note { color: var(--text-3); font-size: 0.875rem; max-width: 80ch; }
.count { color: var(--text-3); font-weight: 400; margin-left: 4px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .label { color: var(--text-2); font-size: 0.85rem; }
.tile .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; }
.tile .value small { font-size: 0.85rem; font-weight: 400; color: var(--text-3); }
.tile .sub { font-size: 0.85rem; }
.tile.hero .value { font-size: 2.4rem; }
.tile .meter { margin-top: 4px; width: 100%; }

.scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }
table.data .rank { width: 2.5rem; }
td.dim { min-width: 150px; white-space: nowrap; }
.dim-value { display: inline-block; width: 2.2rem; }
td.dim .meter { width: 96px; vertical-align: middle; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--track); color: var(--text-2); font-size: 0.75rem; }

.delta { white-space: nowrap; }
.up { color: var(--good); }
.down { color: var(--critical); }

.meter { height: 8px; display: inline-block; }
.meter .track { fill: var(--track); }
.meter .fill { fill: var(--series); }

.chart { width: 100%; max-width: 720px; height: auto; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .point:hover .dot { r: 6; }
.chart .end-label { fill: var(--text); font-size: 12px; font-weight: 600; }

details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent-ink); font-size: 0.9rem; }
details .scroll { margin-top: 8px; }

@media (max-width: 600px) {
  .top { padding: 10px 16px; }
  .tile.hero .value { font-size: 2rem; }
}
@media print {
  .top .who, .filters, .back { display: none; }
  body { background: #fff; }
  .card, .tile { break-inside: avoid; }
}
