:root {
  --bg: #0d0e12; --surface: #14161c; --raised: #1b1e26; --line: #262a34; --grid: #23262f;
  --ink: #f1f3f8; --muted: #a2a9b8; --faint: #717889; --accent: #a5b4fc;
  --lab: #E4003B; --con: #2E8BEA; --ref: #1FBFD0; --grn: #02A95B; --ld: #F2930D; --snp: #E6D43C; --pc: #0F8F7A; --rb: #9B7BE0;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f8; --surface: #ffffff; --raised: #eef0f5; --line: #dfe2e9; --grid: #e9ebf0;
  --ink: #171a21; --muted: #535b6b; --faint: #717889; --accent: #4552c9;
  --con: #0A6AD1; --ref: #0B8FA3; --ld: #D9780A; --snp: #A89400;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }
h2 { font-size: 1.1rem; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.masthead { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.masthead__in { max-width: 1180px; margin: 0 auto; padding: 0.7rem 16px; display: flex; align-items: center; gap: 0.5rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 750; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.02em; }
.updated { margin-left: auto; font-size: 0.8rem; color: var(--faint); }
.theme, .home-link { width: 34px; height: 34px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.home-link { display: grid; place-items: center; color: var(--ink); }
.home-link:hover { border-color: var(--accent); }
.home-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.page { max-width: 1180px; margin: 0 auto; padding: 1.25rem 16px 2rem; display: grid; gap: 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.note { font-size: 0.8rem; color: var(--faint); }
.note a { color: var(--muted); }
.error { color: var(--ink); font-size: 0.9rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 0.75rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 0.9rem; border-top: 3px solid var(--party); }
.tile__name { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.tile__value { font-size: 2rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile__change { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; background: none; padding: 0.25rem 0.7rem; font-size: 0.8rem; color: var(--muted); }
.segmented button.is-on { background: var(--raised); color: var(--ink); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; margin-bottom: 0.6rem; }
.legend button { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid var(--line); background: none; font-size: 0.8rem; color: var(--ink); }
.legend button[aria-pressed="false"] { color: var(--faint); }
.legend button[aria-pressed="false"] i { opacity: 0.25; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--party); }

.chart { position: relative; width: 100%; height: 400px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart text { font-size: 12px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.chart .end-label { fill: var(--ink); font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { opacity: 0.22; }
.chart .crosshair { stroke: var(--faint); stroke-width: 1; }
.tooltip { position: absolute; top: 8px; z-index: 2; min-width: 150px; padding: 0.5rem 0.65rem; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); font-size: 0.8rem; pointer-events: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.tooltip b { display: block; margin-bottom: 0.2rem; }
.tooltip div { display: flex; align-items: center; gap: 0.4rem; font-variant-numeric: tabular-nums; }
.tooltip i { width: 8px; height: 8px; border-radius: 50%; background: var(--party); }
.tooltip span { margin-left: auto; padding-left: 0.8rem; font-weight: 600; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.table-wrap { overflow-x: auto; }
.polls { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.polls th { font-size: 0.72rem; color: var(--faint); font-weight: 600; text-align: right; padding: 0.3rem 0.35rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.polls td { padding: 0.45rem 0.35rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.polls th:first-child, .polls td:first-child { text-align: left; white-space: normal; min-width: 130px; }
.polls small { display: block; color: var(--faint); font-size: 0.72rem; }
.polls td.lead-cell { font-weight: 750; box-shadow: inset 0 -2px 0 var(--party); }
.polls a { text-decoration: none; font-weight: 600; }
.polls a:hover { text-decoration: underline; }
.badge { display: inline-block; margin-left: 0.3rem; padding: 0 0.3rem; border-radius: 4px; background: var(--accent); color: var(--bg); font-size: 0.65rem; font-weight: 750; vertical-align: 1px; }
.more { margin-top: 0.75rem; width: 100%; padding: 0.4rem; border: 1px solid var(--line); border-radius: 8px; background: none; font-size: 0.82rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.chips button { padding: 0.12rem 0.55rem; border-radius: 999px; border: 1px solid var(--line); background: none; font-size: 0.78rem; color: var(--muted); }
.chips button.is-on { background: var(--raised); color: var(--ink); border-color: var(--faint); font-weight: 600; }
.news { list-style: none; }
.news li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.news li:last-child { border-bottom: 0; }
.news a { text-decoration: none; font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.news a:hover { text-decoration: underline; }
.news__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.2rem; font-size: 0.75rem; color: var(--faint); }
.news__meta i { width: 8px; height: 8px; border-radius: 50%; background: var(--party); }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 16px 2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; font-size: 0.78rem; color: var(--faint); }

@media (max-width: 900px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 320px; }
}

/* ---------- Modern look: layered over the base styles above ---------- */
:root { --bg: #f6f5fa; --surface: rgba(255, 255, 255, .82); --raised: #eeecf6; --line: rgba(40, 20, 70, .11); --grid: rgba(40, 20, 70, .08); --ink: #15112a; --muted: #5a5470; --accent: #6d28d9; --blob-a: rgba(109, 40, 217, .17); --blob-b: rgba(217, 158, 33, .15); --grad: linear-gradient(100deg, #6d28d9, #c026d3 55%, #d99e21); }
:root[data-theme="dark"] { --bg: #0b0814; --surface: rgba(25, 20, 42, .74); --raised: #241d3a; --line: rgba(255, 255, 255, .09); --grid: rgba(255, 255, 255, .07); --ink: #f4f1fb; --muted: #aaa3c2; --faint: #857e9e; --accent: #c4b5fd; --blob-a: rgba(139, 92, 246, .24); --blob-b: rgba(217, 158, 33, .1); --grad: linear-gradient(100deg, #c4b5fd, #f0abfc 55%, #fcd34d); }
body { overflow-x: clip; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(60vmax 40vmax at 6% -8%, var(--blob-a), transparent 70%), radial-gradient(52vmax 34vmax at 98% -6%, var(--blob-b), transparent 70%); }
.masthead { background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; letter-spacing: -.03em; }
.theme, .home-link { background: var(--surface); }
h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.025em; }
.panel { border-radius: 20px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tile { background: var(--surface); border-radius: 16px; border-top-width: 4px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .2s, box-shadow .2s; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -22px var(--party); }
.tile__value { font-size: 2.35rem; font-weight: 800; letter-spacing: -.04em; }
.news li { transition: padding-left .15s; }
.news li:hover { padding-left: 4px; }
.chips button.is-on, .segmented button.is-on { color: #fff; border-color: transparent; background: linear-gradient(100deg, #6d28d9, #a21caf); }
@media (prefers-reduced-motion: reduce) { .tile, .news li { transition: none; } }
