.viz-root {
  color-scheme: light;
  --page:           #f6f6f4;
  --surface-1:      #ffffff;
  --text-primary:   #191919;
  --text-secondary: #666666;
  --grid:           #e6e6e6;
  --axis:           #c8c8c8;
  --series-1:       #257de0;
  --band:           rgba(37, 125, 224, 0.12);
  --freeze:         #9c9c9c;
  --warning:        #b86e00;
  --warning-bg:     #fff4e0;
}
@media (prefers-color-scheme: dark) {
  .viz-root {
    color-scheme: dark;
    --page:           #111111;
    --surface-1:      #191919;
    --text-primary:   #efefef;
    --text-secondary: #9c9c9c;
    --grid:           #2c2c2c;
    --axis:           #444444;
    --series-1:       #338ced;
    --band:           rgba(51, 140, 237, 0.16);
    --freeze:         #6e6e6e;
    --warning:        #f2a600;
    --warning-bg:     #2b2110;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #f6f6f4; }
@media (prefers-color-scheme: dark) { body { background: #111111; } }
.viz-root {
  max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary); background: var(--page);
}
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 2px; font-weight: 600; }
.sub { color: var(--text-secondary); margin: 0 0 12px; font-size: 13px; }
header { margin-bottom: 16px; }

.status { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px;
  background: var(--warning-bg); color: var(--text-primary); }
.status::before { content: "⚠ "; color: var(--warning); font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile, .chart-card, .table-card { background: var(--surface-1); border-radius: 12px; padding: 14px 16px; }
.tile .label { display: block; color: var(--text-secondary); font-size: 13px; }
.tile .value { display: block; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 2px 0; }
.tile .note  { display: block; color: var(--text-secondary); font-size: 12px; min-height: 1em; }

.chart-card { margin-bottom: 16px; }
.chart { position: relative; width: 100%; height: 360px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { fill: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .freeze { stroke: var(--freeze); stroke-width: 1; }
.chart .band { fill: var(--band); stroke: none; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--text-secondary); stroke-width: 1; }
.chart .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.chart .empty { fill: var(--text-secondary); font-size: 14px; }

.tooltip { position: absolute; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--grid); border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tooltip b { display: block; font-weight: 600; margin-bottom: 2px; }
.tooltip .k { color: var(--text-secondary); }

.table-card summary { cursor: pointer; font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--grid); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-secondary); font-weight: 500; }
