:root {
  color-scheme: dark;
  --canvas: #0d1322;
  --deep: #080e1d;
  --surface: #151b2b;
  --surface-raised: #191f2f;
  --surface-high: #242a3a;
  --line: rgba(148, 163, 184, .14);
  --line-soft: rgba(148, 163, 184, .09);
  --text: #dde2f8;
  --muted: #91a0b5;
  --quiet: #66758a;
  --cyan: #4cd7f6;
  --green: #4edea3;
  --violet: #d0bcff;
  --amber: #ffb86b;
  --red: #ff8e8e;
  font-family: Inter, sans-serif;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background-color: var(--canvas);
  background-image: linear-gradient(rgba(86, 112, 151, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(86, 112, 151, .035) 1px, transparent 1px);
  background-size: 34px 34px;
  font-size: 13px;
}
button, input { font: inherit; }
button { color: inherit; }
.material-symbols-outlined { font-size: 18px; line-height: 1; font-weight: 400; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; }
.topbar { min-height: 66px; display: flex; align-items: center; gap: 24px; padding: 10px 28px; background: rgba(8, 14, 29, .96); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 215px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; background: var(--cyan); color: #06222a; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: 1px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: 1.1px; }
.top-status { display: flex; align-items: center; gap: 18px; }
.status-pill, .live-indicator { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .6px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--green); box-shadow: 0 0 9px rgba(78, 222, 163, .5); }
.status-pill .status-dot { animation: pulse 2s ease-in-out infinite; }
.sync-countdown { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.sync-countdown .material-symbols-outlined { color: var(--cyan); font-size: 15px; }
.sync-countdown b { color: var(--cyan); font-family: ui-monospace, monospace; }
.top-metrics { display: flex; gap: 24px; margin-left: auto; }
.top-metrics div { display: flex; flex-direction: column; gap: 4px; }
.top-metrics span, .eyebrow { color: var(--quiet); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.top-metrics b { font-size: 12px; font-family: ui-monospace, monospace; }
.icon-button { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--cyan); cursor: pointer; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 2px rgba(76, 215, 246, .12); }
.refresh-button { flex: 0 0 auto; }
.refresh-button.is-busy .material-symbols-outlined, .primary-button.is-busy .material-symbols-outlined { animation: spin .9s linear infinite; }
main { max-width: 1800px; margin: 0 auto; padding: 0 24px 28px; }
.sync-bar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.sync-copy, .sync-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 11px; }
.muted b { color: var(--text); font-weight: 500; }
.sync-message { color: var(--amber); font-size: 11px; }
.sync-message:empty { display: none; }
.range-control { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 4px; background: var(--deep); }
.range-control button { padding: 5px 8px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; cursor: pointer; }
.range-control button:hover { color: var(--text); }
.range-control button.active { background: var(--cyan); color: #06222a; }
.custom-range { display: flex; align-items: flex-end; gap: 6px; }
.custom-range label { display: grid; gap: 4px; color: var(--quiet); font-size: 8px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.custom-range input { width: 148px; height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 3px; outline: 0; background: var(--deep); color: var(--text); color-scheme: dark; font-size: 10px; }
.custom-range input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(76, 215, 246, .1); }
.custom-range.applied .secondary-button { border-color: rgba(76, 215, 246, .55); color: var(--cyan); }
.range-message { max-width: 190px; color: var(--red); font-size: 9px; }
.range-message:empty { display: none; }
.primary-button, .secondary-button { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid transparent; border-radius: 4px; font-size: 11px; font-weight: 700; cursor: pointer; }
.primary-button { background: var(--cyan); color: #06222a; }
.primary-button:hover { background: #7de6fb; box-shadow: 0 0 12px rgba(76, 215, 246, .22); }
.primary-button .material-symbols-outlined { font-size: 16px; }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--text); }
.secondary-button:hover { border-color: var(--cyan); }
.overview-strip { display: flex; align-items: center; gap: 22px; min-height: 46px; padding: 7px 1px; border-bottom: 1px solid var(--line); }
.overview-strip > div { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.overview-strip b { color: var(--text); font-size: 12px; }
.cyan { color: var(--cyan) !important; }
.green { color: var(--green) !important; }
.violet { color: var(--violet) !important; }
.amber { color: var(--amber) !important; }
.workspace { display: grid; grid-template-columns: minmax(270px, 310px) minmax(0, 1fr); gap: 22px; align-items: start; padding-top: 20px; }
.station-column { min-width: 0; }
.station-tools, .model-sources, .station-card, .chart-panel, .chart-heading, .map-section { border: 1px solid var(--line); background: rgba(21, 27, 43, .96); }
.station-tools, .model-sources { padding: 14px; border-radius: 5px; }
.section-title, .section-title > div { display: flex; align-items: center; }
.section-title { justify-content: space-between; gap: 8px; }
.section-title > div { min-width: 0; gap: 8px; }
.section-title h1, .section-title h2 { margin: 0; color: var(--text); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.subtle-tag { padding: 4px 6px; border: 1px solid rgba(76, 215, 246, .2); border-radius: 3px; color: var(--cyan); font-size: 8px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.search-field { display: flex; align-items: center; gap: 7px; height: 35px; margin-top: 13px; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--deep); color: var(--quiet); }
.search-field:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(76, 215, 246, .1); }
.search-field .material-symbols-outlined { font-size: 16px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }
.search-field input::placeholder { color: var(--quiet); }
.station-actions { display: flex; justify-content: space-between; margin-top: 10px; }
.station-actions button { padding: 3px 0; border: 0; background: transparent; color: var(--cyan); font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; cursor: pointer; }
.station-actions button:last-child { color: var(--muted); }
.station-list { display: grid; gap: 7px; margin-top: 9px; }
.station-card { position: relative; padding: 12px; border-radius: 4px; transition: background .15s, border-color .15s; }
.station-card:hover { background: #1b2436; border-color: rgba(76, 215, 246, .28); }
.station-card.selected { border-left: 2px solid var(--station-color); padding-left: 11px; }
.station-main { display: flex; align-items: flex-start; gap: 9px; }
.station-main input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--cyan); cursor: pointer; }
.station-info { min-width: 0; flex: 1; }
.station-name-row { display: flex; align-items: center; gap: 6px; }
.station-swatch { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--station-color); }
.station-name { overflow: hidden; color: var(--text); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.station-place { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.station-state { flex: 0 0 auto; margin-left: 5px; padding: 3px 5px; border-radius: 2px; background: rgba(78, 222, 163, .1); color: var(--green); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.station-state.sample { background: rgba(255, 184, 107, .1); color: var(--amber); }
.station-state.error { background: rgba(255, 142, 142, .1); color: var(--red); }
.station-values { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 11px; padding: 8px 6px; border-radius: 3px; background: rgba(8, 14, 29, .64); }
.station-value { min-width: 0; }
.station-value span { display: block; color: var(--quiet); font-size: 8px; font-weight: 700; letter-spacing: .4px; }
.station-value b { display: block; overflow: hidden; margin-top: 4px; color: var(--text); font: 600 10px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.station-value.temp b { color: var(--station-color); }
.station-value.gust b { color: var(--amber); }
.station-foot { display: flex; justify-content: space-between; gap: 7px; margin-top: 8px; color: var(--quiet); font-size: 9px; }
.station-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-sources { margin-top: 12px; }
.compact-title h2 { font-size: 11px; }
.small-icon { width: 27px; height: 27px; }
.small-icon .material-symbols-outlined { font-size: 17px; }
.model-list { display: grid; gap: 6px; margin-top: 9px; }
.empty-note { margin: 0; color: var(--quiet); font-size: 10px; }
.model-row { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.model-line { width: 18px; border-top: 2px dashed var(--model-color); }
.model-row span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-remove { width: 24px; height: 24px; border: 0; border-radius: 3px; background: transparent; color: var(--quiet); cursor: pointer; }
.model-remove:hover { color: var(--red); background: rgba(255, 142, 142, .08); }
.charts-column { display: grid; gap: 10px; min-width: 0; }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 68px; padding: 12px 15px; border-radius: 5px; }
.chart-heading h2 { margin: 3px 0 3px; font-size: 17px; }
.chart-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.forecast-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 9px; color: var(--muted); font-size: 10px; cursor: pointer; }
.forecast-toggle input { margin: 0; accent-color: var(--cyan); }
.legend { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--legend-color); }
.legend-dash { width: 13px; border-top: 2px dashed var(--legend-color); }
.chart-panel { min-width: 0; padding: 12px 14px 10px; border-radius: 5px; }
.chart-title { display: flex; align-items: center; gap: 9px; min-height: 27px; padding-bottom: 9px; border-bottom: 1px solid var(--line-soft); }
.chart-title h3 { display: inline; margin: 0; font-size: 12px; font-weight: 600; }
.chart-title div span { margin-left: 5px; color: var(--muted); font-size: 10px; }
.chart-unit { margin-left: auto; color: var(--quiet); font-size: 8px; font-weight: 700; letter-spacing: .8px; }
.chart-wrap { position: relative; height: 190px; margin-top: 8px; padding: 7px; border-radius: 3px; background: rgba(8, 14, 29, .72); }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-empty { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; margin: 0; color: var(--quiet); font-size: 11px; pointer-events: none; }
.chart-empty.visible { display: flex; }
.map-section { padding: 14px; border-radius: 5px; }
.map-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.map-heading > div { display: flex; align-items: center; gap: 10px; }
.map-heading > div > .material-symbols-outlined { font-size: 22px; }
.map-heading h2 { margin: 3px 0 0; font-size: 15px; }
.map-caption { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
#stationMap { height: 440px; margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #080e1d; }
.leaflet-container { background: #080e1d; font-family: Inter, sans-serif; }
.leaflet-tile-pane { filter: invert(.88) hue-rotate(180deg) saturate(.45) brightness(1.08) contrast(.9); }
.leaflet-control-zoom a, .leaflet-control-attribution { background: rgba(8, 14, 29, .9) !important; color: var(--text) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { font-size: 9px !important; }
.station-popup { color: #151b2b; font-family: Inter, sans-serif; font-size: 11px; }
.station-popup strong { display: block; margin-bottom: 4px; }
footer { display: flex; justify-content: space-between; gap: 15px; padding: 15px 28px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 9px; letter-spacing: .4px; }
footer code { color: var(--muted); }
.footer-separator { padding: 0 4px; color: var(--cyan); }
dialog { width: min(440px, calc(100vw - 28px)); padding: 0; border: 1px solid rgba(148, 163, 184, .22); border-radius: 6px; background: var(--surface); color: var(--text); box-shadow: 0 18px 60px rgba(0, 0, 0, .48); }
dialog::backdrop { background: rgba(3, 7, 15, .75); backdrop-filter: blur(2px); }
dialog form { padding: 18px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.dialog-heading h2 { margin: 5px 0 0; font-size: 17px; }
dialog label { display: grid; gap: 7px; margin: 12px 0; color: var(--muted); font-size: 10px; font-weight: 600; }
dialog input { width: 100%; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; outline: 0; background: var(--deep); color: var(--text); font-size: 11px; }
dialog input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(76, 215, 246, .1); }
.dialog-note { color: var(--muted); font-size: 10px; line-height: 1.6; }
.dialog-note code { color: var(--cyan); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .topbar { gap: 15px; padding-inline: 18px; }
  .top-metrics { gap: 14px; }
  main { padding-inline: 18px; }
  .workspace { grid-template-columns: minmax(250px, 285px) minmax(0, 1fr); gap: 14px; }
  .chart-heading { align-items: flex-start; flex-direction: column; }
  .legend { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .topbar { min-height: 58px; flex-wrap: wrap; gap: 9px 14px; padding: 9px 14px; }
  .brand { min-width: 0; flex: 1; }
  .top-status { order: 3; width: 100%; justify-content: space-between; padding-top: 7px; border-top: 1px solid var(--line-soft); }
  .top-metrics { display: none; }
  main { padding-inline: 12px; }
  .sync-bar { align-items: flex-start; flex-direction: column; gap: 10px; padding-block: 12px; }
  .sync-copy { gap: 9px 14px; }
  .sync-actions { width: 100%; justify-content: space-between; }
  .custom-range { flex-wrap: wrap; }
  .custom-range input { width: 142px; }
  .range-control button { padding-inline: 7px; }
  .overview-strip { align-items: flex-start; justify-content: space-between; gap: 8px; }
  .overview-strip > div { flex-wrap: wrap; gap: 4px 6px; }
  .overview-strip > div span:nth-child(2) { max-width: 78px; }
  .workspace { grid-template-columns: 1fr; gap: 14px; padding-top: 14px; }
  .station-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
  .station-column { display: contents; }
  .station-tools { order: 0; }
  .station-list { order: 1; }
  .model-sources { order: 2; }
  .charts-column { order: 3; }
  .chart-heading { min-height: 0; }
  .chart-wrap { height: 180px; }
  .map-section { padding: 11px; }
  #stationMap { height: 340px; }
  footer { flex-direction: column; padding-inline: 14px; }
}
@media (max-width: 420px) {
  .sync-actions { align-items: flex-start; flex-direction: column; }
  .range-control { width: 100%; justify-content: space-between; }
  .range-control button { flex: 1; }
  .custom-range { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-range input { width: 100%; min-width: 0; }
  .custom-range .secondary-button { grid-column: 1 / -1; }
  .primary-button { min-height: 36px; }
  .chart-heading h2 { font-size: 15px; }
  .chart-wrap { height: 165px; }
  #stationMap { height: 300px; }
}