:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-1-wash: rgba(42,120,214,0.10);
  --track: #cde2fb;
  --deemph: #d8d7d0;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --critical: #d03b3b;
  --shadow: 0 1px 2px rgba(11,11,11,0.04), 0 4px 12px rgba(11,11,11,0.03);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19; --page: #0d0d0d;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-1-wash: rgba(57,135,229,0.14);
    --track: #184f95; --deemph: #3a3a37;
    --good: #0ca30c; --good-text: #0ca30c; --warning: #fab219; --critical: #d03b3b;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19; --page: #0d0d0d;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-1-wash: rgba(57,135,229,0.14);
  --track: #184f95; --deemph: #3a3a37;
  --good: #0ca30c; --good-text: #0ca30c; --warning: #fab219; --critical: #d03b3b;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page); color: var(--text-primary);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }
a { color: var(--series-1); }

/* nav */
.nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 22px; }
.nav a { display: inline-block; padding: 6px 14px; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); font-size: 13.5px; }
.nav a:hover { color: var(--text-primary); }
.nav a[aria-current="page"] { background: var(--series-1); border-color: var(--series-1); color: #fff; font-weight: 560; }
.nav .spacer { flex: 1; }
.theme-toggle { background: var(--surface-1); color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.theme-toggle:hover { color: var(--text-primary); }

/* header */
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
h1 { font-size: 30px; line-height: 1.15; margin: 8px 0 10px; font-weight: 640; letter-spacing: -0.02em; }
.provenance { color: var(--text-secondary); font-size: 13.5px; max-width: 78ch; }
code { background: var(--surface-1); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.notes code, .callout code { background: var(--page); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.dot.warn { background: var(--warning); }
.dot.bad { background: var(--critical); }

/* filters */
.filters { position: sticky; top: 0; z-index: 30; background: var(--page); border-bottom: 1px solid var(--border);
  padding: 12px 0; margin: 22px 0 26px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.fgroup { display: flex; flex-direction: column; gap: 5px; }
.flabel { font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.segmented { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.segmented button { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 13.5px;
  padding: 6px 13px; border-radius: 6px; cursor: pointer; white-space: nowrap; min-height: 32px; }
.segmented button[aria-pressed="true"] { background: var(--series-1); color: #fff; font-weight: 560; }
.segmented button:not([aria-pressed="true"]):hover { color: var(--text-primary); }
select, input[type="search"] { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 11px; font: inherit; font-size: 13.5px; min-height: 34px; }
input[type="search"] { min-width: 210px; }
.check { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13.5px; min-height: 34px; }
.check input { accent-color: var(--series-1); width: 15px; height: 15px; }

/* hero + kpis */
.hero-band { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px;
  padding: 26px 28px; margin-bottom: 22px; box-shadow: var(--shadow); }
.hero-fig { font-size: 60px; line-height: 1; font-weight: 660; letter-spacing: -0.03em; }
.hero-fig.sm { font-size: 40px; }
.hero-cap { color: var(--text-secondary); font-size: 15px; margin-top: 10px; max-width: 64ch; }
.hero-sub { color: var(--text-muted); font-size: 13px; margin-top: 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 30px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 12.5px; color: var(--text-muted); font-weight: 560; }
.kpi .k-value { font-size: 27px; font-weight: 640; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.kpi .k-note { font-size: 12.5px; color: var(--text-secondary); margin-top: 5px; }

/* cards */
section { margin-bottom: 34px; }
h2 { font-size: 19px; font-weight: 620; letter-spacing: -0.015em; margin: 0 0 6px; }
.section-note { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 16px; max-width: 84ch; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.card h3 { font-size: 15px; font-weight: 600; margin: 0; }
.card .sub { font-size: 12.5px; color: var(--text-muted); margin: 3px 0 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.tbtn { border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font: inherit;
  font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; min-height: 26px; }
.tbtn:hover { color: var(--text-primary); }
.tbtn[aria-pressed="true"] { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.chartwrap { overflow-x: auto; }
svg { display: block; max-width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: 12.5px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* tables */
.tablewrap { overflow-x: auto; margin-top: 4px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; letter-spacing: .03em; text-transform: uppercase;
  position: sticky; top: 0; background: var(--surface-1); z-index: 2; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th .arrow { opacity: .45; font-size: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { white-space: normal; min-width: 200px; max-width: 330px; }
tbody tr:hover { background: var(--series-1-wash); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 560; border: 1px solid var(--border); }
.pill.yes { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.no { color: var(--text-muted); }
.pill.bad { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.tablefoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px;
  font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; }

/* notes */
.notes { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; box-shadow: var(--shadow); }
.notes h3 { font-size: 14.5px; margin: 22px 0 7px; font-weight: 620; }
.notes h3:first-child { margin-top: 0; }
.notes p, .notes li { color: var(--text-secondary); font-size: 13.5px; }
.notes p { margin: 0 0 9px; max-width: 90ch; }
.notes ul { margin: 0 0 9px; padding-left: 20px; }
.notes li { margin-bottom: 5px; max-width: 88ch; }
.callout { border-left: 3px solid var(--warning); background: color-mix(in srgb, var(--warning) 7%, transparent);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 12px 0; }
.callout.stop { border-left-color: var(--critical); background: color-mix(in srgb, var(--critical) 7%, transparent); }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text-primary); }

#tip { position: fixed; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 100;
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,.16); max-width: 300px; }
#tip .t-title { font-weight: 620; margin-bottom: 3px; }
#tip .t-row { color: var(--text-secondary); }
.hit { cursor: pointer; }
.hit:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.lift { font-weight: 640; }
.lift.up { color: var(--good-text); }
.lift.down { color: var(--critical); }
