/* ==========================================================================
   GIS HUB — Päästöatlas (/päästöt/)
   Canonical GIS HUB Dark Theme Stylesheet
   Palette: #0f1419, #1a2129, #232c37, #2e3946, #e6edf3, #93a1b0, #2f81f7
   WCAG 2.1 AA Compliant (Contrast >= 4.5:1, Focus indicators, Legible type)
   ========================================================================== */

:root {
  --bg: #0f1419;
  --panel: #1a2129;
  --panel-2: #232c37;
  --border: #2e3946;
  --text: #e6edf3;
  --muted: #93a1b0;
  --accent: #2f81f7;
  --accent-2: #1f6feb;
  --accent-fg: #58a6ff;
  --danger: #f85149;
  --ok: #3fb950;
  --warn: #d29922;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
}

/* ---------- Reset & Base ---------- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select {
  font: inherit;
}

button, a, select, input[type=range] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

a {
  color: var(--accent-fg);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* WCAG 2.1 AA Accessible Focus Indicator */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button svg, a svg {
  flex-shrink: 0;
}

svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

[hidden] {
  display: none !important;
}

.skip {
  position: fixed;
  top: -100px;
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 200;
  font-weight: 600;
}
.skip:focus {
  top: 8px;
  left: 8px;
}

/* ---------- Left Navigation Rail ---------- */
.rail {
  width: 78px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #13181f;
  border-right: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-direction: column;
  z-index: 30;
  padding: 24px 8px 18px;
  gap: 12px;
}

.rail-brand {
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rail-brand svg {
  width: 32px;
  height: 32px;
  stroke-width: 1.6;
}

.rail-link {
  width: 62px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.rail-link svg {
  width: 20px;
  height: 20px;
}
.rail-link:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}
.rail-link.selected {
  color: var(--text);
  background: var(--panel-2);
  position: relative;
  font-weight: 600;
}
.rail-link.selected::before {
  content: "";
  position: absolute;
  left: -8px;
  height: 24px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.rail-spacer {
  flex: 1;
}

.rail-foot {
  font-size: 11.5px;
  font-weight: 600;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  width: 40px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Workspace & Top Header ---------- */
.workspace {
  margin-left: 78px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.wordmark {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  gap: 1px;
}
.wordmark:hover {
  text-decoration: none;
}
.wordmark > span {
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--muted);
}
.wordmark strong {
  font-size: 20px;
  letter-spacing: -0.5px;
  font-weight: 700;
  color: var(--text);
}

.view-nav {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.view-nav svg {
  width: 16px;
  height: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.button:hover {
  background: #2c3745;
  border-color: #3b4859;
}

.export-button {
  margin-left: auto;
}
.export-button svg {
  width: 15px;
  height: 15px;
}

/* ---------- Main Container & Intro ---------- */
main {
  padding: 28px 32px;
  max-width: 1770px;
  width: 100%;
  margin: 0 auto;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 0 0 24px;
}

.eyebrow {
  font-size: 11.5px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

h1 {
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.8px;
  margin: 6px 0 4px;
  font-weight: 700;
  color: var(--text);
}

.intro p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.intro-status {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.status-pill {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  color: var(--text);
  background: var(--panel-2);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 550;
  color: var(--accent-fg);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.text-button:hover {
  color: #58a6ff;
  text-decoration: underline;
}
.text-button svg {
  width: 14px;
  height: 14px;
}

/* ---------- Toolbar ---------- */
.toolbar {
  border: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  height: 52px;
  gap: 14px;
  padding: 6px 14px;
  box-shadow: var(--shadow-sm);
}

.search-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  width: 280px;
  color: var(--muted);
}
.search-wrap > svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.search-wrap input {
  border: none;
  outline: none;
  background: transparent;
  min-width: 0;
  width: 100%;
  font-size: 13px;
  color: var(--text);
}
.search-wrap input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.icon-button {
  display: inline-flex;
  padding: 6px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-button:hover {
  background: var(--panel-2);
  color: var(--text);
}
.icon-button svg {
  width: 16px;
  height: 16px;
}

.toolbar-divider {
  height: 22px;
  width: 1px;
  background: var(--border);
}

.select-label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.select-label svg {
  width: 16px;
  height: 16px;
}
.select-label select {
  border: 0;
  background: var(--panel);
  color: var(--text);
  padding: 6px 12px 6px 0;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}
.select-label select option {
  background: var(--panel);
  color: var(--text);
}

.toolbar-spacer {
  flex: 1;
}

.year-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.year-picker {
  border: 1px solid var(--border);
  background: var(--panel-2);
  display: flex;
  gap: 2px;
  align-items: center;
  border-radius: var(--radius-sm);
  height: 36px;
  padding: 2px 4px;
}
.year-picker select {
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 0;
  font-size: 13px;
  padding: 4px;
  appearance: none;
  text-align: center;
  width: 58px;
  cursor: pointer;
}
.year-picker select option {
  background: var(--panel-2);
  color: var(--text);
}

/* ---------- Context Line & Error Banner ---------- */
.error-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(248, 81, 73, 0.12);
  color: #ff7b72;
  font-size: 13px;
  margin-top: 14px;
}
.error-banner .text-button {
  color: #ff7b72;
  font-weight: 600;
}

.context-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  font-size: 12px;
  color: var(--muted);
  min-height: 20px;
}
.context-line > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
}
.context-line svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.context-line > span:nth-child(2) {
  border-left: 1px solid var(--border);
  padding-left: 12px;
}
.scenario-badge {
  background: rgba(47, 129, 247, 0.15);
  border: 1px solid rgba(47, 129, 247, 0.4);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  color: var(--accent-fg);
  font-weight: 600;
  font-size: 11.5px;
}

/* ---------- KPI Cards ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi {
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-primary {
  background: var(--panel);
  border-color: #384759;
}
.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}
.kpi-label svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.kpi-value {
  font-size: 30px;
  letter-spacing: -0.8px;
  font-weight: 700;
  margin: 8px 0;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--text);
}
.kpi-value small {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 6px;
}
.kpi-bottom {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  min-height: 22px;
}
.change-pill {
  color: var(--ok);
  background: rgba(63, 185, 80, 0.15);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 11.5px;
}
.change-pill.up {
  color: var(--warn);
  background: rgba(210, 153, 34, 0.15);
  border-color: rgba(210, 153, 34, 0.3);
}
.spark {
  width: 75px;
  height: 26px;
  margin-left: auto;
  overflow: visible;
}
.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Functional Mini-Dot (Preserved for Legends) */
.mini-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Panels & Dashboard Layout ---------- */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dashboard-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: stretch;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  gap: 12px;
}
h2 {
  font-size: 16px;
  letter-spacing: -0.2px;
  margin: 0;
  font-weight: 600;
  color: var(--text);
}
.panel-head p {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}
.panel-head > svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.small-tag {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ---------- Map Card & Controls ---------- */
.map-card {
  display: flex;
  flex-direction: column;
}
.map-metrics {
  padding: 0 20px 14px;
  display: flex;
  gap: 6px;
}
.map-metrics button {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.15s;
}
.map-metrics button:hover {
  color: var(--text);
  border-color: #3b4859;
}
.map-metrics button.active {
  background: var(--accent-2);
  color: #ffffff;
  border-color: var(--accent-2);
  font-weight: 600;
}

.map-container {
  position: relative;
  flex: 1;
  min-height: 500px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
#map {
  position: absolute;
  inset: 0;
}

.map-top-note {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(26, 33, 41, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
  font-size: 11.5px;
  color: var(--muted);
  pointer-events: none;
}
.map-top-note svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.map-reset {
  position: absolute;
  right: 12px;
  top: 110px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  padding: 6px;
  color: var(--text);
  z-index: 2;
  box-shadow: var(--shadow-sm);
}
.map-reset:hover {
  background: var(--panel-2);
  border-color: var(--accent);
}
.map-reset svg {
  width: 18px;
  height: 18px;
}

.map-legend {
  position: absolute;
  bottom: 24px;
  left: 18px;
  z-index: 2;
  border: 1px solid var(--border);
  background: rgba(26, 33, 41, 0.92);
  backdrop-filter: blur(6px);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  width: 250px;
  box-shadow: var(--shadow);
}
.legend-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}
.legend-heading > span:last-child {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}
.legend-colors {
  display: flex;
  height: 8px;
  border-radius: 3px;
  overflow: hidden;
}
.legend-colors > span {
  flex: 1;
}
.legend-colors > span:nth-child(1) { background: #16324f; }
.legend-colors > span:nth-child(2) { background: #1f5385; }
.legend-colors > span:nth-child(3) { background: #2575c0; }
.legend-colors > span:nth-child(4) { background: #2f81f7; }
.legend-colors > span:nth-child(5) { background: #79c0ff; }

.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-top: 5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.legend-missing {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-missing > span:first-child {
  background: #1e2630;
  width: 10px;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  display: inline-block;
}
.legend-note {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.maplibregl-ctrl-attrib {
  background: rgba(15, 20, 25, 0.85) !important;
  color: var(--muted) !important;
  font-size: 11px !important;
}
.maplibregl-ctrl-attrib a {
  color: var(--muted) !important;
}
.maplibregl-ctrl-logo {
  opacity: 0.6;
}
.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
}
.maplibregl-ctrl-group button {
  border-bottom: 1px solid var(--border) !important;
}
.maplibregl-ctrl-group button+button {
  border-top: none !important;
}
.maplibregl-popup-content {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 14px !important;
  box-shadow: var(--shadow) !important;
  font-family: inherit;
  color: var(--text) !important;
}
.maplibregl-popup-content strong {
  font-size: 13px;
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}
.maplibregl-popup-content p {
  font-size: 12px;
  margin: 0;
  color: var(--muted);
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--panel) !important; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--panel) !important; }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--panel) !important; }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--panel) !important; }

/* Timeline & Slider */
.timeline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.play-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 50%;
  height: 34px;
  width: 34px;
  flex-shrink: 0;
  color: var(--accent-fg);
  transition: all 0.15s;
}
.play-button:hover {
  background: var(--accent-2);
  color: #ffffff;
  border-color: var(--accent-2);
}
.play-button svg {
  width: 14px;
  height: 14px;
}
.timeline-body {
  flex: 1;
}
input[type=range] {
  accent-color: var(--accent);
  width: 100%;
  height: 6px;
  cursor: pointer;
  margin: 6px 0;
  background: var(--panel-2);
  border-radius: 3px;
}
.year-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.year-ticks button {
  font-size: 11.5px;
  padding: 2px 4px;
  color: var(--muted);
  font-weight: 500;
  border-radius: 4px;
}
.year-ticks button:hover {
  color: var(--text);
}
.year-ticks button.active {
  color: var(--accent-fg);
  font-weight: 700;
}

/* Road Summary */
.road-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  gap: 20px;
  background: var(--panel-2);
}
.road-summary > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.road-summary > div + div {
  border-left: 1px solid var(--border);
  padding-left: 20px;
}
.road-summary span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.road-summary svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.road-summary strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.road-summary small {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- Aside Insights ---------- */
.insights {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.region-card {
  padding: 20px 22px 16px;
}
.region-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.region-top svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.region-card h2 {
  font-size: 24px;
  letter-spacing: -0.6px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
}
.region-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 16px;
}
.chart-title {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  color: var(--text);
}
.chart-title > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.trend-chart {
  height: 120px;
  margin-top: 8px;
}
.region-footer {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.breakdown-card .panel-head {
  padding-bottom: 12px;
}
.breakdown-content {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 0 20px 16px;
}
.donut-wrap {
  width: 115px;
  height: 115px;
  position: relative;
  flex-shrink: 0;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-center strong {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.donut-center > span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.class-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}
.class-legend > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.class-legend strong {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.class-legend > div > span:nth-child(2) {
  color: var(--muted);
}

.heavy-insight {
  margin: 0 16px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-sm);
}
.heavy-insight svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}
.heavy-insight p {
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  color: var(--muted);
}
.heavy-insight strong {
  color: var(--text);
  font-weight: 600;
}

.fleet-card {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
}
.fleet-heading {
  display: flex;
  gap: 10px;
  align-items: center;
}
.fleet-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 36px;
  width: 36px;
  background: rgba(47, 129, 247, 0.15);
  border: 1px solid rgba(47, 129, 247, 0.3);
  border-radius: var(--radius-sm);
  color: var(--accent);
}
.fleet-icon svg {
  width: 18px;
  height: 18px;
}
.fleet-heading h2 {
  font-size: 13.5px;
  font-weight: 600;
}
.fleet-heading p {
  font-size: 11.5px;
  color: var(--muted);
  margin: 2px 0 0;
}
.fleet-heading strong {
  margin-left: auto;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.5px;
  color: var(--accent);
}
.fuel-bar {
  display: flex;
  gap: 2px;
  height: 8px;
  margin: 16px 0 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel-2);
}
.fuel-bar span {
  min-width: 1px;
}
.fuel-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
}
.fuel-caption svg {
  width: 13px;
  height: 13px;
}

/* ---------- Evidence Panel & Register Drawer ---------- */
.evidence-panel {
  margin-top: 22px;
}
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 22px 22px;
  gap: 18px;
}
.evidence-grid article {
  position: relative;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  min-width: 0;
}
.evidence-icon {
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}
.evidence-icon svg {
  width: 20px;
  height: 20px;
}
.evidence-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.evidence-grid strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}
.evidence-grid p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 8px 0 10px;
}
.evidence-grid small {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  display: block;
}
.evidence-meter {
  height: 4px;
  background: #19222b;
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden;
}
.evidence-meter span {
  display: block;
  background: var(--accent);
  height: 100%;
}

.evidence-foot {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
}
.evidence-foot button {
  flex-shrink: 0;
}

.register-detail {
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.register-detail .panel-head {
  align-items: flex-start;
}
.register-detail h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.register-detail .panel-head p {
  font-size: 12px;
  line-height: 1.6;
  max-width: 800px;
  color: var(--muted);
}
.register-detail > p {
  font-size: 12px;
  line-height: 1.6;
  margin: 14px 22px 18px;
  color: var(--muted);
}

/* Method Select In Toolbar */
.method-select {
  border-left: 1px solid var(--border);
  padding-left: 14px;
}
.method-select select {
  max-width: 190px;
}
/* The model dropdown shares the row; the year options already name their type. */
@media (min-width: 821px) and (max-width: 1250px) {
  .toolbar .year-label {
    display: none;
  }
  .toolbar .search-wrap {
    min-width: 150px;
  }
}

/* ---------- Trends View & Comparison View ---------- */
.alternate-view {
  min-height: 600px;
}
.alternate-view .panel-head h2 {
  font-size: 22px;
  margin-top: 6px;
}
.alternate-view .panel-head p {
  font-size: 13px;
}
.large-chart {
  height: 340px;
  margin: 16px 28px 24px;
}
.chart-note {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 0 28px 20px;
  align-items: center;
}
.chart-note svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Accessible Data Tables */
.table-scroll {
  overflow: auto;
  max-height: 560px;
  border-top: 1px solid var(--border);
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}
th {
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
td {
  padding: 12px 18px;
  border-bottom: 1px solid #232c37;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
td a, td button {
  font-weight: 600;
  color: var(--accent-fg);
}
td a:hover, td button:hover {
  text-decoration: underline;
}
tbody tr:hover {
  background: rgba(47, 129, 247, 0.06);
}
th button {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
}
th button:hover {
  color: var(--text);
}
th button svg {
  width: 13px;
  height: 13px;
}
td input[type=checkbox] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.compare-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}
.comparison-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 0 22px 18px;
}
.comparison-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  position: relative;
}
.comparison-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 24px 10px 0;
  color: var(--text);
}
.comparison-card > button {
  position: absolute;
  top: 10px;
  right: 10px;
}
.comparison-card > strong {
  font-size: 22px;
  letter-spacing: -0.5px;
  display: block;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.comparison-card small {
  font-size: 12px;
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.comparison-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  padding: 18px;
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.comparison-alas-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.comparison-alas-row .alas-title {
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
}
.comparison-alas-row strong {
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.comparison-alas-row .alas-diff {
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.comparison-alas-row .alas-diff.diff-up,
.alas-table-diff.diff-up {
  color: #79c0ff;
}
.comparison-alas-row .alas-diff.diff-down,
.alas-table-diff.diff-down {
  color: #56d364;
}
.comparison-alas-row .alas-diff.diff-zero,
.alas-table-diff.diff-zero {
  color: var(--muted);
}
.comparison-alas-row .alas-tag-na {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.alas-table-diff {
  font-size: 11.5px;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.alas-cell-na {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  opacity: 0.85;
}

/* ---------- Scenario Calculator ---------- */
.scenario-panel {
  margin-top: 22px;
  padding: 22px 24px;
  background: var(--panel);
}
.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.scenario-title {
  display: flex;
  gap: 12px;
  align-items: center;
}
.scenario-title h2 {
  font-size: 16px;
}
.scenario-title p {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}
.scenario-icon {
  height: 36px;
  width: 36px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-fg);
  flex-shrink: 0;
}
.scenario-icon svg {
  width: 18px;
  height: 18px;
}
.scenario-header > .text-button {
  font-size: 12px;
}
.scenario-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin-top: 24px;
}
.scenario-controls label > span,
.model-weight > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  align-items: center;
}
.scenario-controls output,
.model-weight output {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--accent-fg);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.scenario-controls input {
  margin: 12px 0 8px;
}
.scenario-controls small,
.model-weight small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}
.scenario-result {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  color: var(--ok);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Method Dialog (Modal) ---------- */
dialog {
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  border-radius: var(--radius-lg);
  color: var(--text);
  width: min(900px, 94vw);
  padding: 0;
  max-height: 88vh;
  background: var(--panel);
}
dialog::backdrop {
  background: rgba(10, 14, 18, 0.82);
  backdrop-filter: blur(4px);
}
.dialog-head {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 3;
  border-bottom: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dialog-head h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text);
}
.dialog-body {
  padding: 24px 28px 32px;
}
.dialog-body p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.dialog-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}
.dialog-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent-fg);
}

.method-warning {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.35);
  border-radius: var(--radius-sm);
  color: #e3b341;
}
.method-warning > svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--warn);
}
.method-warning strong {
  font-size: 13px;
  color: var(--text);
}
.method-warning p {
  font-size: 12px;
  margin: 4px 0 0;
  color: #e3b341;
}

.method-formula {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 22px 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.method-formula > span {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
}
.method-formula strong {
  font-weight: 700;
  color: var(--accent-fg);
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.method-grid article {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius-sm);
}
.method-grid .step-number {
  font-size: 11px;
  color: var(--accent-fg);
  font-weight: 700;
}
.method-grid h3 {
  margin: 6px 0 8px;
  font-size: 13px;
  color: var(--text);
}
.method-grid p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.model-weight {
  display: block;
  margin-top: 18px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.model-weight input {
  margin: 16px 0 10px;
}

.factor-table {
  font-size: 12px;
}
.factor-table td, .factor-table th {
  padding: 8px 12px;
}

.source-list {
  display: grid;
  gap: 8px;
}
.source-item {
  border: 1px solid var(--border);
  background: var(--panel-2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.source-item a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  gap: 5px;
}
.source-item a svg {
  width: 14px;
  height: 14px;
}
.source-item small {
  font-size: 11.5px;
  color: var(--muted);
}
.method-small {
  font-size: 12px !important;
  color: var(--muted);
  line-height: 1.6;
}
.method-downloads {
  margin-top: 22px;
}

/* ---------- Toast, Footer & Fallback ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 100;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  margin: 28px 0 12px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}
.footer > span:first-child {
  display: flex;
  gap: 8px;
  align-items: center;
}
.footer .text-button {
  font-size: 12px;
}

.map-fallback {
  position: absolute;
  inset: 80px 24px auto;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  z-index: 3;
}

/* ---------- Responsive Breakpoints (Strict WCAG Text >= 11px) ---------- */
@media (min-width: 1550px) {
  main {
    padding: 32px 40px;
  }
  .dashboard-view {
    grid-template-columns: minmax(0, 1fr) 390px;
  }
  .map-container {
    min-height: 540px;
  }
  .insights {
    gap: 18px;
  }
  .trend-chart {
    height: 140px;
  }
  .region-card {
    padding: 22px 24px 16px;
  }
  .panel-head {
    padding: 20px 24px;
  }
  .breakdown-content {
    padding: 0 24px 18px;
  }
  .donut-wrap {
    height: 124px;
    width: 124px;
  }
  .fleet-card {
    padding: 20px;
  }
}

@media (max-width: 1250px) {
  .header {
    padding: 0 20px;
    gap: 16px;
  }
  .wordmark {
    min-width: 170px;
  }
  .view-nav {
    gap: 12px;
  }
  .view-nav a {
    font-size: 12px;
    padding: 0 10px;
  }
  .view-nav svg {
    display: none;
  }
  main {
    padding: 24px 20px;
  }
  .dashboard-view {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
  }
  .kpi {
    padding: 16px 16px 14px;
  }
  .kpi-value {
    font-size: 27px;
  }
  .kpi-label {
    font-size: 11.5px;
  }
  .spark {
    display: none;
  }
  .evidence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar .search-wrap {
    width: 220px;
  }
  .toolbar .method-select select {
    max-width: 160px;
    font-size: 12px;
  }
  .toolbar .method-select {
    padding-left: 10px;
  }
  .toolbar .method-select > svg {
    display: none;
  }
  .scenario-controls {
    gap: 22px;
  }
}

@media (max-width: 1020px) {
  .rail {
    width: 64px;
    padding-left: 4px;
    padding-right: 4px;
  }
  .rail-link {
    width: 54px;
    font-size: 11px;
  }
  .rail-link.selected::before {
    left: -4px;
  }
  .workspace {
    margin-left: 64px;
  }
  .header {
    height: 56px;
  }
  .export-button span {
    display: none;
  }
  .export-button {
    padding: 8px 10px;
  }
  .dashboard-view {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 14px;
  }
  .kpis {
    gap: 12px;
  }
  .kpi-value {
    font-size: 24px;
  }
}

@media (max-width: 820px) {
  .rail {
    display: none;
  }
  .workspace {
    margin-left: 0;
  }
  .header {
    padding: 0 16px;
    height: 56px;
    gap: 12px;
  }
  main {
    padding: 20px 16px;
  }
  .dashboard-view {
    grid-template-columns: minmax(0, 1fr);
  }
  .map-container {
    min-height: 480px;
  }
  .insights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .fleet-card {
    grid-column: 1 / -1;
  }
  .region-card {
    height: 100%;
  }
  .trend-chart {
    height: 130px;
  }
  .year-label {
    display: none;
  }
  .search-wrap {
    width: 220px;
  }
  .comparison-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .evidence-foot {
    align-items: flex-start;
    flex-direction: column;
  }
  .source-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .toolbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 52px;
  }
  .toolbar .method-select {
    order: 4;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 8px 0 0;
    flex-basis: 100%;
  }
  .toolbar .method-select select {
    max-width: none;
  }
}

@media (max-width: 540px) {
  .header {
    height: auto;
    min-height: 64px;
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 10px;
    justify-content: space-between;
  }
  .wordmark {
    min-width: 0;
  }
  .wordmark > span {
    font-size: 11px;
    letter-spacing: 1px;
  }
  .wordmark strong {
    font-size: 18px;
  }
  .export-button {
    order: 1;
    margin: 0;
  }
  .view-nav {
    order: 2;
    width: 100%;
    height: 40px;
    flex: none;
    gap: 0;
    justify-content: space-between;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 4px;
  }
  .view-nav a {
    height: 36px;
    font-size: 12px;
    gap: 6px;
    padding: 0 8px;
  }
  .view-nav svg {
    display: block;
    width: 14px;
    height: 14px;
  }
  main {
    padding: 18px 12px;
  }
  .intro {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }
  h1 {
    font-size: 26px;
  }
  .intro p {
    font-size: 13px;
  }
  .intro-status {
    align-items: flex-start;
  }
  .toolbar {
    gap: 8px;
    height: auto;
    padding: 10px;
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .toolbar .search-wrap {
    flex: 1;
    min-width: 140px;
    width: auto;
    order: 0;
  }
  .toolbar-divider {
    display: none;
  }
  .toolbar .year-picker {
    flex: 0 0 110px;
    width: 110px;
    margin-left: 0;
    justify-content: space-between;
  }
  .toolbar .select-label {
    order: 2;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }
  .toolbar .select-label select {
    width: 100%;
    font-size: 12.5px;
  }
  .context-line {
    font-size: 11.5px;
    margin: 12px 0 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .context-line > span:nth-child(2) {
    padding-left: 8px;
  }
  .kpis {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .kpi {
    min-height: 110px;
    padding: 14px 12px;
  }
  .kpi-value {
    font-size: 23px;
    margin: 6px 0;
  }
  .kpi-label {
    font-size: 11px;
  }
  .kpi-bottom {
    font-size: 11px;
  }
  .map-metrics {
    padding: 0 10px 10px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .map-metrics button {
    font-size: 11.5px;
    padding: 6px 8px;
    flex: 1 1 calc(50% - 4px);
    text-align: center;
  }
  .map-container {
    min-height: 420px;
  }
  .map-legend {
    width: 210px;
    padding: 10px 12px;
    bottom: 20px;
    left: 10px;
  }
  .timeline {
    padding: 12px 14px;
    gap: 10px;
  }
  .road-summary {
    grid-template-columns: 1fr;
    padding: 12px 14px;
    gap: 12px;
  }
  .road-summary > div + div {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 12px;
  }
  .insights {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .breakdown-content {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .class-legend {
    width: 100%;
  }
  .evidence-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 14px 16px;
  }
  .evidence-foot {
    padding: 12px 14px;
  }
  .scenario-controls {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 18px;
  }
  .comparison-cards {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }
  .compare-tools {
    padding: 12px 14px;
  }
  .compare-tools .search-wrap {
    width: 100%;
  }
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-size: 11.5px;
  }
  .dialog-head {
    padding: 16px;
  }
  .dialog-body {
    padding: 16px;
  }
  .method-grid {
    grid-template-columns: 1fr;
  }
  .method-formula {
    flex-wrap: wrap;
    font-size: 12px;
  }
  .large-chart {
    height: 260px;
    margin: 12px 14px 20px;
  }
  .chart-note {
    font-size: 11px;
    padding: 0 14px 16px;
  }
  td, th {
    padding: 10px 12px;
    font-size: 12px;
  }
}

.model03 { margin: 24px 0; padding-bottom: 20px; }
.model03[data-forecast="true"] { border-color: #d29922; }
.model-gases { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; padding: 0 24px; }
.model-gases article { padding: 16px; background: #161d26; border: 1px solid #2e3946; border-radius: 10px; }
.model-gases span { display: block; color: #93a1b0; font-size: 12px; margin-bottom: 9px; }
.model-gases strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.model-gases article:last-child { border-color: #3fb950; }
.model-gas-bar { display: flex; height: 12px; margin: 20px 24px 10px; border-radius: 6px; overflow: hidden; }
.model-caption,.model03>p { margin: 12px 24px; color: #93a1b0; font-size: 12px; line-height: 1.7; }
.model-details { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; padding: 12px 24px; }
.model-details h3 { font-size: 13px; margin: 12px 0; }
.model-details strong { font-size: 14px; }
.model-details p { color: #93a1b0; font-size: 12px; line-height: 1.7; }
.model-euro-bars>div { display: grid; grid-template-columns: 88px 1fr 48px; gap: 9px; align-items: center; margin: 8px 0; font-size: 11px; }
.model-euro-bars b { text-align: right; font-variant-numeric: tabular-nums; }
.model-euro-meter { height: 6px; background: linear-gradient(to right,#58a6ff var(--share),#232c37 var(--share)); border-radius: 4px; }
@media(max-width:900px) { .model-gases { grid-template-columns: repeat(2,minmax(0,1fr)); } .model-details { grid-template-columns: 1fr; gap: 6px; } }
@media(max-width:600px) { .model-gases { padding: 0 14px; gap: 10px; } .model-gases strong { font-size: 16px; } .model-details { padding: 12px 14px; } }

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

/* Phone widths: two KPI columns must shrink, long values and the forecast
   tag wrap instead of widening the page, and all year ticks stay visible. */
@media (max-width: 540px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { min-width: 0; }
  .kpi-value { white-space: normal; overflow-wrap: anywhere; }
  .kpi-label { flex-wrap: wrap; row-gap: 2px; }
  #main[data-forecast="true"] .kpi-label::after { flex-basis: 100%; margin-left: 0; }
  .timeline-body { min-width: 0; }
  .year-ticks { flex-wrap: wrap; justify-content: flex-start; gap: 2px 3px; }
}

/* The header search and selects remove their own outline (equal specificity,
   later rule), which hid keyboard focus: show it on the wrapper instead. */
.search-wrap:focus-within,
.select-label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
