.viz-root {
  color-scheme: light;
  --page: #f9f9f7; --surface-1: #fcfcfb; --text-primary: #0b0b0b; --text-secondary: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --wash: rgba(11,11,11,0.04); --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  .viz-root {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --text-primary: #ffffff; --text-secondary: #c3c2b7;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --wash: rgba(255,255,255,0.05); --accent: #3987e5;
  }
}
* { box-sizing: border-box; }
body { margin: 0; }
.viz-root { background: var(--page); color: var(--text-primary); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; padding: 20px 24px 60px; }
h1 { font-size: 22px; margin: 0 0 2px; font-weight: 650; }
h2 { font-size: 16px; margin: 28px 0 10px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; color: var(--text-secondary); }
.sub { color: var(--text-secondary); font-size: 13px; }
.muted { color: var(--muted); }
.note { margin: 10px 0 0; }
header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, input, button { font: inherit; color: inherit; }
select, input { background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button.ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
button.ghost:hover { background: var(--wash); color: var(--text-primary); }
button:disabled { opacity: .5; cursor: default; }
nav { position: sticky; top: 0; background: var(--page); padding: 10px 0; margin: 12px 0 4px; z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
nav a { color: var(--text-secondary); padding: 4px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; user-select: none; }
nav a:hover { background: var(--wash); color: var(--text-primary); }
nav a.on { background: var(--wash); color: var(--text-primary); font-weight: 600; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 16px; overflow-x: auto; }
.login { max-width: 340px; margin: 12vh auto; }
.login form { display: grid; gap: 10px; margin-top: 14px; }
.err { color: var(--critical); font-size: 13px; min-height: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 12px; }
.tile .v { font-size: 28px; font-weight: 650; line-height: 1.1; }
.tile .l { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.gap { margin-top: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12px; border-bottom: 1px solid var(--axis); padding: 6px 8px; white-space: nowrap; }
td { border-bottom: 1px solid var(--grid); padding: 7px 8px; vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--muted); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--wash); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge i { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 11px; color: #0b0b0b; font-weight: 800; }
.find { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.find:last-child { border-bottom: 0; }
.find .d { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); margin: 0 0 6px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 5px; vertical-align: -1px; }
svg text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.tip { position: fixed; pointer-events: none; background: var(--surface-1, #fff); color: var(--text-primary, #000); border: 1px solid rgba(0,0,0,.12); box-shadow: 0 4px 16px rgba(0,0,0,.12); border-radius: 8px; padding: 8px 10px; font: 12px system-ui, sans-serif; display: none; z-index: 20; min-width: 140px; }
.tip .t { font-weight: 600; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .r .k::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--wash); border-radius: 4px; padding: 1px 6px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.switch { cursor: pointer; }
