/* Palette roles: dataviz reference instance (light + selected dark steps). */
.viz-root {
  color-scheme: light;
  --page:           #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --critical:       #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --critical:       #d03b3b;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page, #f9f9f7);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) { html, body { background: #0d0d0d; } }

.viz-root {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  background: var(--page);
  color: var(--text-primary);
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-head .sub {
  margin: 0 0 24px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.page-head code { font-size: 12px; color: var(--text-muted); }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 18px 12px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* vega-embed injects `.vega-embed { display: inline-block }`, which makes the
   container shrink to zero width and `width: "container"` resolve to 0.
   The id selector outranks it. */
#chart, #chart.vega-embed { display: block; width: 100%; min-height: 420px; }
.error { color: var(--critical); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table {
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  width: 100%;
}
th, td {
  padding: 5px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--gridline);
}
thead th {
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--baseline);
}
tbody th, thead th:first-child { text-align: left; font-weight: 500; }
tbody th { color: var(--text-primary); }
td { color: var(--text-secondary); }
td.zero { color: var(--text-muted); }
tfoot th, tfoot td {
  border-top: 1px solid var(--baseline);
  border-bottom: none;
  color: var(--text-primary);
  font-weight: 600;
}
.swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: baseline;
}

.page-foot {
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
