:root {
  --ink: #17212b;
  --muted: #667483;
  --line: #dce2e7;
  --surface: #ffffff;
  --canvas: #eef2f4;
  --positive: #b64d28;
  --negative: #167f92;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body { background: var(--canvas); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }

main { display: grid; grid-template-columns: minmax(0, 1fr) 390px; height: 100%; }

.map-panel { min-width: 0; position: relative; }

#map { height: 100%; width: 100%; }

.maplibregl-ctrl-top-right { right: 16px; top: 16px; }

aside { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }

.heading { border-bottom: 1px solid var(--line); padding: 24px 22px 18px; }

h1 { font-size: 22px; letter-spacing: 0; line-height: 1.2; margin: 0; }

.subtitle { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 8px 0 0; }

.sidebar-scroll { min-height: 0; overflow: auto; padding: 0 22px 24px; }

.section { border-bottom: 1px solid var(--line); padding: 20px 0; }

.section:last-child { border-bottom: 0; }

.section-title { font-size: 15px; font-weight: 700; letter-spacing: 0; margin: 0 0 12px; }

.mode-tabs { display: grid; gap: 4px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mode-tabs button { background: #f4f6f7; border: 1px solid #d9e0e4; border-radius: 4px; color: #384855; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; min-height: 36px; padding: 6px 5px; }

.mode-tabs button:hover { background: #edf1f3; }

.mode-tabs button.is-active { background: #273847; border-color: #273847; color: #ffffff; }

.legend { margin-top: 14px; }

.legend-title { font-size: 13px; font-weight: 700; margin: 0 0 8px; }

.legend-scale { height: 10px; width: 100%; }

.legend-scale.difference { background: linear-gradient(90deg, #167f92 0%, #f1f3f3 50%, #c65f28 100%); }

.legend-scale.share-2022 { background: linear-gradient(90deg, #f5e9e2 0%, #c65f28 100%); }

.legend-scale.share-2026 { background: linear-gradient(90deg, #e2f0f1 0%, #167f92 100%); }

.legend-labels { color: var(--muted); display: flex; font-size: 11px; justify-content: space-between; margin-top: 5px; }

.legend-note { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 10px 0 0; }

.selection-name { font-size: 18px; font-weight: 700; margin: 0 0 6px; }

.selection-meta { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 14px; }

.metric-row { border-top: 1px solid #edf0f2; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) auto; padding: 9px 0; }

.metric-label { font-size: 14px; line-height: 1.25; }

.metric-value { font-size: 14px; font-weight: 700; text-align: right; }

.positive { color: var(--positive); }

.negative { color: var(--negative); }

.coverage { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 0; }

table { border-collapse: collapse; font-size: 13px; width: 100%; }

th, td { border-bottom: 1px solid #edf0f2; padding: 9px 2px; text-align: left; white-space: nowrap; }

th { background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 700; position: sticky; top: 0; }

td:not(:first-child), th:not(:first-child) { text-align: right; }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; grid-template-rows: minmax(430px, 66vh) auto; height: auto; min-height: 100%; }
  aside { border-left: 0; border-top: 1px solid var(--line); }
  .heading { padding: 20px 18px 16px; }
  .sidebar-scroll { max-height: none; overflow: visible; padding: 0 18px 20px; }
}

@media (max-width: 420px) {
  .mode-tabs { grid-template-columns: 1fr; }
  .mode-tabs button { min-height: 34px; }
}
