:root {
  color-scheme: light;
  --ink: #20232a;
  --muted: #69717f;
  --line: #d9dde5;
  --paper: #f7f8fa;
  --panel: #ffffff;
  --blue: #2477b8;
  --red: #d44f35;
  --gold: #c58a18;
  --green: #2e7d5b;
  --violet: #6750a4;
  --shadow: 0 16px 40px rgba(31, 35, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-note {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 93px);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 93px);
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #eef2f5;
  overflow: auto;
}

.control-panel {
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #3b424d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #c7ced8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input {
  margin-bottom: 8px;
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

.segmented {
  display: grid;
  gap: 8px;
}

.segmented button,
.tool-button {
  border: 1px solid #c6ccd6;
  border-radius: 6px;
  background: #fff;
  color: #29313c;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.segmented button {
  min-height: 42px;
  padding: 8px 10px;
  text-align: left;
}

.segmented button.active {
  border-color: currentColor;
  color: var(--active);
  background: color-mix(in srgb, var(--active) 10%, #fff);
}

.tool-button {
  min-width: 44px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.map {
  height: 330px;
  border: 1px solid #cbd2db;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.map svg,
.chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.station-dot {
  cursor: pointer;
  transition: r 120ms ease, opacity 120ms ease;
}

.station-dot:hover {
  r: 6;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: 24px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.narrative {
  max-width: 920px;
  margin-top: 12px;
  color: #4f5966;
  font-size: 15px;
  line-height: 1.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.metric[hidden] {
  display: none;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metric strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(31, 35, 42, 0.06);
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.chart {
  height: 330px;
  padding: 10px;
}

.heatmap {
  min-height: 360px;
  padding: 12px;
  overflow: auto;
}

.heat-grid {
  display: grid;
  grid-template-columns: 56px repeat(12, minmax(18px, 1fr));
  gap: 3px;
  align-items: center;
  min-width: 460px;
}

.heat-cell,
.heat-label {
  min-height: 20px;
  border-radius: 4px;
  font-size: 10px;
}

.heat-label {
  display: flex;
  align-items: center;
  color: var(--muted);
}

.heat-cell {
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.table-wrap {
  max-height: 330px;
  overflow: auto;
}

.annual-table {
  max-height: 430px;
}

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

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid #eceff3;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #4c5664;
  font-size: 12px;
}

.axis-label {
  fill: #69717f;
  font-size: 11px;
}

.grid-line {
  stroke: #e6e9ee;
  stroke-width: 1;
}

.axis-line {
  stroke: #aab2bf;
  stroke-width: 1;
}

.empty {
  padding: 24px;
  color: var(--muted);
}

.subnote {
  padding: 8px 14px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.subnote:empty {
  display: none;
}

.panel[hidden] {
  display: none;
}

.rose {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 330px;
  padding: 10px;
}

.rose svg {
  display: block;
  height: 100%;
}

@media (max-width: 980px) {
  .topbar {
    display: block;
    padding: 20px;
  }

  .source-note {
    margin-top: 10px;
  }

  .layout,
  .summary-band,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 16px;
  }

  .map {
    height: 300px;
  }
}
