:root {
  --bg: #131722;
  --panel: #1e222d;
  --card: #1e222d;
  --text: #d1d4dc;
  --muted: #787b86;
  --accent: #2962ff;
  --good: #26a69a;
  --bad: #ef5350;
  --border: #2a2e39;
  --highlight: rgba(41, 98, 255, 0.12);
}
[data-theme="light"] {
  --bg: #f4f6f9;
  --panel: #fff;
  --card: #fff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --border: #d8dee6;
  --highlight: #e8f4fd;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.loading { padding: 2rem; color: var(--muted); }
header.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
h1 { margin: 0; font-size: 1.35rem; color: var(--accent); }
.subtitle a.nav-link { color: var(--accent); text-decoration: none; }
.subtitle a.nav-link:hover { text-decoration: underline; }
.theme-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.hero {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.hero-compare {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-wide .sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
.highlight-stat {
  border-color: var(--accent);
  background: rgba(41, 98, 255, 0.08);
}
.explainer {
  background: rgba(41, 98, 255, 0.1);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.explainer p { margin: 0 0 0.5rem; }
.explainer p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-weight: normal; font-size: 0.82rem; }
tfoot .total-row td {
  border-top: 2px solid var(--border);
  background: var(--panel);
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.stat .label { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.2rem; }
.stat .value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
section h2 { margin: 0 0 0.65rem; font-size: 1rem; color: var(--accent); }
.note { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.75rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { padding: 0.45rem 0.55rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: var(--highlight); }
.tip-wrap { position: relative; display: inline-flex; margin-left: 4px; }
.tip-icon { color: var(--accent); cursor: help; font-size: 0.75rem; }
.tip-panel {
  display: none;
  position: absolute;
  z-index: 20;
  left: 0;
  top: 1.2rem;
  width: min(320px, 90vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.tip-wrap:hover .tip-panel, .tip-wrap:focus-within .tip-panel { display: block; }
.tip-k { display: block; font-weight: 600; color: var(--accent); margin-top: 0.35rem; }
.tip-ex { margin-top: 0.35rem; padding: 0.35rem 0.5rem; background: rgba(41,98,255,.08); border-radius: 4px; }
.chart-grid { display: grid; gap: 1rem; }
.chart-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #131722;
  resize: vertical;
  min-height: 280px;
  height: 380px;
  display: flex;
  flex-direction: column;
}
.chart-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.chart-head strong { font-size: 0.95rem; }
.chart-body { flex: 1; min-height: 200px; position: relative; }
.chart-resize-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 2px 0 4px;
  border-top: 1px dashed var(--border);
  user-select: none;
}
.flags { display: grid; gap: 0.5rem; }
.flag {
  border-left: 3px solid var(--bad);
  padding: 0.45rem 0.65rem;
  background: rgba(239,83,80,.08);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
}
.flag.warning { border-color: #ffa726; background: rgba(255,167,38,.08); }
.hourly { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hour-chip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
}
@media (max-width: 700px) {
  .wrap { padding: 0.75rem; }
}
