/* Tokens from the dataviz reference palette (light + dark, selected per mode). */
:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --s7: #6250d6; --s8: #e34948;
  --accent: #2a78d6; --good: #006300; --critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --s7: #9085e9; --s8: #e66767;
    --accent: #3987e5; --good: #0ca30c; --critical: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  --s7: #9085e9; --s8: #e66767;
  --accent: #3987e5; --good: #0ca30c; --critical: #e66767;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink);
       font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
         padding: 10px 16px; border-bottom: 1px solid var(--ring); background: var(--surface); }
header nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
#who { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
header nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
header nav a[aria-current="page"] { color: var(--ink); background: var(--page); font-weight: 600; }
h1 { font-size: 17px; margin: 0; white-space: nowrap; }
h2 { font-size: 16px; margin: 0 0 4px; }
main { max-width: 1120px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.sub { color: var(--ink-2); font-size: 13px; margin: 0 0 12px; }
button, select, input { font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--ring); border-radius: 6px; padding: 5px 10px; }
button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
a.button { display: inline-block; text-decoration: none; border: 1px solid var(--ring);
           border-radius: 6px; padding: 5px 10px; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button[aria-pressed="true"] { border-color: var(--ink-2); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: 8px;
        padding: 16px; margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 16px; }
.filters .group { display: flex; gap: 4px; align-items: center; }
.filters label { color: var(--ink-2); font-size: 13px; }
.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(--ring); border-radius: 8px; padding: 12px 14px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 22px; font-weight: 600; margin-top: 2px; }
.tile .meta { color: var(--muted); font-size: 12px; }
.loading { opacity: 0.5; transition: opacity 0.15s; }
.notes { color: var(--muted); font-size: 12px; margin: 8px 0 0; padding-left: 18px; }
.error { color: var(--critical); }

/* chart */
.chart { position: relative; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .direct { font-size: 12px; fill: var(--ink-2); }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface);
  border: 1px solid var(--ring); border-radius: 6px; padding: 6px 10px; font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); white-space: nowrap; display: none; }
.chart .tip .t { color: var(--ink-2); margin-bottom: 2px; }
.chart .tip .row { display: flex; align-items: center; gap: 6px; }
.chart .tip .row b { font-variant-numeric: tabular-nums; }
.chart .tip .key, .legend .key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px;
          margin: 4px 0 8px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.table-toggle { font-size: 12px; padding: 2px 8px; margin-left: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 8px; }
table.data th, table.data td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums; }
table.data th:first-child, table.data td:first-child { text-align: left; }
.table-wrap { max-height: 320px; overflow: auto; }

/* tables, bars, panels */
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; color: var(--ink-2); font-weight: 500; font-size: 13px;
           border-bottom: 1px solid var(--axis); padding: 6px 8px; }
.list td { border-bottom: 1px solid var(--grid); padding: 6px 8px; }
.list td.num, .list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.list tr.sel td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.list .swatch { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle;
                margin-right: 6px; }
.scroll-x { overflow-x: auto; }
.pos { color: var(--good); } .neg { color: var(--critical); }
.bar { position: relative; height: 8px; background: var(--grid); border-radius: 4px; min-width: 60px; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--s1); border-radius: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
a.link, button.link { color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-align: left; }
.pill { display: inline-block; font-size: 12px; color: var(--ink-2); border: 1px solid var(--ring);
        border-radius: 10px; padding: 0 8px; }
@media (max-width: 600px) { .hide-narrow { display: none; } }
