:root {
  color-scheme: light;
  --surface-0: #f4f3f0;
  --surface-1: #fcfcfb;
  --border: #e2e1dc;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --series-peak: #2a78d6;   /* slot 1 blue: electricity, peak rate */
  --series-gas: #eb6834;    /* slot 2 orange: gas */
  --series-cheap: #1baf7a;  /* slot 3 aqua: electricity, cheap rate */
  --critical: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --border: #2e2e2b;
    --grid: #262624;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --series-peak: #3987e5;
    --series-gas: #d95926;
    --series-cheap: #199e70;
    --critical: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110; --surface-1: #1a1a19; --border: #2e2e2b; --grid: #262624;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9a998f;
  --series-peak: #3987e5; --series-gas: #d95926; --series-cheap: #199e70; --critical: #e66767;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--surface-0); color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header, main, .error { max-width: 1100px; margin: 0 auto; padding: 16px; }
header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 4px; }
.meta, .note { color: var(--text-secondary); margin: 0; font-size: 13px; }
.meta { flex: 1 1 auto; }
.foot { margin-top: 8px; }
button {
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; cursor: pointer;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.tile, .card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.label { color: var(--text-secondary); font-size: 13px; }
.value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sub { color: var(--text-muted); font-size: 12px; }
.card { margin-bottom: 12px; }
.chart { position: relative; height: 280px; margin-top: 10px; }
details { margin-top: 8px; font-size: 13px; }
summary { cursor: pointer; color: var(--text-secondary); }
.table-wrap { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-secondary); font-weight: 500; }
.error { color: var(--critical); }
