.viz-root {
  color-scheme: light;
  --surface-0: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #e2e1dc;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --accent: #2a78d6;
  --error: #c62828;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
}
@media (prefers-color-scheme: dark) {
  .viz-root {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --border: #2f2f2d;
    --grid: #262624;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a9990;
    --accent: #3987e5;
    --error: #ef6b6b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #0ca30c;
    --series-7: #9085e9;
    --series-8: #e66767;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
}
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 28px 0 10px; color: var(--text-secondary); font-weight: 600; }
.top { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 16px; }
.muted { color: var(--text-muted); }
.note { font-size: 12px; margin-top: 28px; }
button {
  font: inherit; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer;
}
button.link { background: none; border: none; color: var(--text-secondary); text-decoration: underline; padding: 0; }
input, select {
  font: inherit; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-primary);
}
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-secondary); }
.filters input[type="text"] { width: 210px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 14px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--text-secondary); }
.tile .value { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--text-muted); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; }
th, td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
tr.total td { font-weight: 600; border-top: 2px solid var(--border); }
td.project { max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: baseline; }
.stale { color: var(--error); }
.chart { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { fill: var(--text-muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; font-size: 12px; color: var(--text-secondary); }
.tooltip {
  position: fixed; pointer-events: none; z-index: 10; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.tooltip table { border: none; background: none; }
.tooltip td { padding: 1px 4px; border: none; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--text-secondary); }
.login { max-width: 320px; margin: 15vh auto; padding: 24px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.error { color: var(--error); margin: 0; }
