/* Poggle — analytical portal for valuation specialists.
   Cool survey-paper neutrals, one survey-blue accent, IBM Plex with tabular figures.
   The single expressive element is the valuation range strip ("forest"); everything else stays quiet. */

:root {
  --bg: #eceff1;
  --surface: #ffffff;
  --surface-2: #f5f7f8;
  --ink: #16212b;
  --ink-2: #455462;
  --muted: #76838e;
  --rule: #d8dee3;
  --rule-2: #e7ebee;
  --accent: #1f5fa8;
  --accent-soft: #e3ecf7;
  --comp: #b8691a;
  --under: #0b6e60;      /* trades below model */
  --over: #85285b;       /* trades above model */
  --ok: #2c7a4b;
  --warn: #b7791f;
  --fail: #b3362f;
  --s1: #1f5fa8;
  --s2: #c07a2c;
  --s3: #3a8a78;
  --uplift: #26836f;
  --range: #9fbbe0;
  --shadow: 0 1px 2px rgba(22, 33, 43, .06), 0 4px 16px rgba(22, 33, 43, .06);

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-cond: "IBM Plex Sans Condensed", "IBM Plex Sans", "Arial Narrow", system-ui, sans-serif;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 30px;
  --r-sm: 3px;
  --r: 6px;
  --topbar: 52px;
  --panel-w: clamp(440px, 40vw, 680px);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0c1216;
  --surface: #131b21;
  --surface-2: #19232a;
  --ink: #e1e7eb;
  --ink-2: #a8b4bd;
  --muted: #7b8892;
  --rule: #26323b;
  --rule-2: #1e2930;
  --accent: #6ea6e6;
  --accent-soft: #1b2a3b;
  --comp: #e0954a;
  --under: #4fb8a6;
  --over: #d986b1;
  --ok: #5cbf84;
  --warn: #e0a84a;
  --fail: #ec7a72;
  --s1: #6ea6e6;
  --s2: #e0a35a;
  --s3: #5cc0a8;
  --uplift: #5cc0a8;
  --range: #35577f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 var(--fs)/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 4px; z-index: 2000; background: var(--surface); padding: 6px 10px; border-radius: var(--r); }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.center { text-align: center; }
.num { text-align: right; }
.noscript { padding: 24px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  height: var(--topbar);
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: relative; z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 28px; height: 16px; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; fill: none; }
.brand-mark circle { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.brand-word { font-weight: 600; font-size: var(--fs-lg); letter-spacing: -0.01em; }

.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search input {
  width: 100%; height: 32px; padding: 0 10px 0 30px;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface-2);
}
.search input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.search-ico { position: absolute; left: 9px; top: 9px; width: 14px; height: 14px; stroke: var(--muted); stroke-width: 1.6; fill: none; }
.search-list {
  position: absolute; top: 36px; left: 0; right: 0; margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow);
  max-height: 340px; overflow: auto;
}
.search-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 6px 10px; cursor: pointer; align-items: baseline; }
.search-list li[aria-selected="true"], .search-list li:hover { background: var(--accent-soft); }
.search-list .sr-meta { color: var(--muted); font-size: var(--fs-sm); }
.search-list .sr-num { font-size: var(--fs-sm); color: var(--ink-2); }
.search-list .search-empty { display: block; color: var(--muted); cursor: default; }
.search-list .search-empty:hover { background: none; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; flex: none; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 0 11px; height: 30px; cursor: pointer; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.seg button:hover:not(.on) { color: var(--ink); }

.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.health {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px;
  border: 1px solid var(--rule); border-radius: 15px; background: var(--surface); cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2);
}
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
[data-status="ok"] .health-dot { background: var(--ok); }
[data-status="degraded"] .health-dot { background: var(--warn); }
[data-status="down"] .health-dot { background: var(--fail); }
.icon-btn { width: 32px; height: 30px; display: grid; place-items: center; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--r); cursor: pointer; }
.icon-btn svg { width: 15px; height: 15px; fill: var(--ink-2); stroke: var(--ink-2); stroke-width: 1.3; }

/* ---------------------------------------------------------------- layout */
.layout { display: flex; height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); }
.map-pane { flex: 1 1 auto; position: relative; min-width: 0; }
.map { position: absolute; inset: 0; background: var(--surface-2); }
.panel { flex: 0 0 var(--panel-w); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--rule); min-width: 0; }

.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--rule); flex: none; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; padding: 12px 10px 10px; cursor: pointer; white-space: nowrap;
  color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--ink); }
.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow-y: auto; padding: 14px 16px 40px; scrollbar-gutter: stable; }
.view:focus { outline: none; }
.site-footer { flex: none; padding: 6px 16px; border-top: 1px solid var(--rule); line-height: 1.35; max-height: 40vh; overflow-y: auto; }
.site-footer p { margin: 0; }
.site-footer summary { cursor: pointer; }
.site-footer ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- blocks + type */
.block { padding: 14px 0; border-top: 1px solid var(--rule-2); }
.block:first-child { border-top: 0; padding-top: 4px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-md); margin-bottom: 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.block-head h3 { margin-bottom: 0; }
h4 { font-size: var(--fs); margin: 16px 0 6px; color: var(--ink); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.h-sub { font-weight: 400; font-size: var(--fs-sm); color: var(--muted); margin: 2px 0 8px; }
h3 .h-sub, h4 .h-sub { margin: 0; }
.note { font-size: var(--fs-sm); color: var(--muted); margin: 8px 0 0; max-width: 75ch; }
.note-warn { color: var(--ink-2); border-left: 3px solid var(--warn, var(--comp)); padding: 2px 0 2px 8px; }

/* ---------------------------------------------------------------- states */
.state { padding: 20px 4px; color: var(--ink-2); }
.state p { margin: 4px 0; max-width: 60ch; }
.state-title { font-weight: 600; color: var(--ink); }
.state.small { padding: 8px 0; }
.state-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.state-error .state-title { color: var(--fail); }
.state-error .btn { margin-top: 8px; }
.intro { padding-top: 32px; }
.spinner {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; margin-right: 6px; vertical-align: -1px;
  border: 2px solid var(--rule); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- controls */
.btn {
  height: 30px; padding: 0 12px; border: 1px solid var(--rule); background: var(--surface); border-radius: var(--r);
  cursor: pointer; font-weight: 500; font-size: var(--fs-sm); color: var(--ink);
}
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .btn-primary { color: #0c1216; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-small { height: 26px; padding: 0 9px; }
.btn-row { display: flex; gap: 6px; }
.linklike { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
.input-sm { height: 28px; padding: 0 8px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface-2); width: 180px; }
select, input[type="number"], input[type="month"], input[type="text"] {
  height: 30px; padding: 0 8px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); min-width: 0;
}
select:focus, input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: var(--fs-xs); font-weight: 500; line-height: 16px; white-space: nowrap; border: 1px solid transparent; }
.pill-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 9%, transparent); }
.pill-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.pill-muted { color: var(--muted); border-color: var(--rule); }
.badge { font-size: var(--fs-xs); font-weight: 600; padding: 1px 6px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- property header */
.prop-head { padding-bottom: 12px; }
.prop-title { font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.prop-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; color: var(--ink-2); font-size: var(--fs-sm); margin: 6px 0 10px; }
.stations-near { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 13px;
  border: 1px solid var(--rule); background: var(--surface-2); cursor: pointer; font-size: var(--fs-sm);
}
.chip:hover { border-color: var(--ink-2); }
.chip-sub { color: var(--muted); }
.chip-num { color: var(--ink-2); }

/* ---------------------------------------------------------------- stats */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 16px; margin: 4px 0; }
.stat-k { font-size: var(--fs-xs); color: var(--muted); }
.stat-v { font-size: var(--fs-md); font-weight: 600; margin-top: 1px; }
.stat-s { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.stat-s .pill { margin-top: 2px; }
.weights { display: inline-flex; flex-wrap: wrap; gap: 2px 8px; font-size: var(--fs-sm); font-weight: 500; }
.access-routes { margin: 4px 0 0; padding-left: 18px; font-size: var(--fs-sm); color: var(--ink-2); }
.access-routes li { margin: 2px 0; }

/* ---------------------------------------------------------------- headline valuation */
.headline { display: grid; grid-template-columns: auto 1fr; gap: 12px 28px; align-items: end; margin: 6px 0 14px; }
.headline-v { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.headline-range { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 6px; }
.headline-range b { font-weight: 600; color: var(--ink); }
.headline-side { display: grid; grid-template-columns: repeat(3, auto); gap: 16px; justify-content: end; }
.block.flash { animation: flash .9s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

/* The range strip: four models on one shared money axis. */
.forest { border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.forest-row { display: grid; grid-template-columns: 112px 72px 1fr 92px; gap: 10px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--rule-2); }
.forest-head { border-top: 0; background: var(--surface-2); font-size: var(--fs-xs); color: var(--muted); padding-top: 5px; padding-bottom: 5px; }
.forest-axis { position: relative; height: 14px; }
.forest-axis i { position: absolute; transform: translateX(-50%); font-style: normal; white-space: nowrap; top: 0; }
.forest-name { font-weight: 500; color: var(--ink-2); }
.forest-val { font-weight: 600; }
.forest-track { position: relative; height: 18px; }
.forest-track .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule-2); }
.forest-track .rb { position: absolute; top: 6px; height: 6px; border-radius: 3px; background: var(--range); }
.forest-track .pt { position: absolute; top: 3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-2); }
.forest-row.is-blend { background: var(--accent-soft); }
.forest-row.is-blend .forest-name, .forest-row.is-blend .forest-val { color: var(--ink); font-weight: 600; }
.forest-row.is-blend .rb { background: var(--accent); opacity: .45; }
.forest-row.is-blend .pt { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }

.conf { display: inline-flex; align-items: center; gap: 2px; }
.conf i { width: 6px; height: 10px; border-radius: 1px; background: var(--rule); display: inline-block; }
.conf i.on { background: var(--ink-2); }
.is-blend .conf i.on { background: var(--accent); }
.conf-num { font-size: var(--fs-xs); color: var(--muted); margin-left: 5px; min-width: 26px; text-align: right; }

/* ---------------------------------------------------------------- forms */
.subject-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px 12px; align-items: end; }
.subject-form label, .filters label { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-xs); color: var(--muted); }
.subject-form label > *, .filters label > * { font-size: var(--fs); color: var(--ink); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-status { font-size: var(--fs-sm); color: var(--muted); display: inline-flex; align-items: center; }
.form-status.is-error { color: var(--fail); }
.form-status.is-ok { color: var(--ok); }
.unit-hint { grid-column: 1 / -1; margin-top: 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px 12px; margin-top: 8px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r); }
table.grid { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.grid th, .grid td { padding: 5px 8px; border-bottom: 1px solid var(--rule-2); text-align: left; vertical-align: middle; white-space: nowrap; }
.grid td.wrap { white-space: normal; min-width: 180px; max-width: 360px; color: var(--ink-2); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid th { background: var(--surface-2); font-family: var(--font-cond); font-weight: 600; color: var(--ink-2); padding: 0; position: sticky; top: 0; z-index: 1; }
.grid th button { all: unset; display: flex; gap: 3px; align-items: center; padding: 6px 8px; cursor: pointer; width: 100%; box-sizing: border-box; }
.grid th.num button { justify-content: flex-end; }
.grid th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.grid th.sorted { color: var(--ink); }
.sort-ind { font-size: 9px; width: 8px; color: var(--accent); }
.grid .num { text-align: right; }
.grid tr.clickable { cursor: pointer; }
.grid tr.clickable:hover td { background: var(--surface-2); }
.grid tr.active td { background: var(--accent-soft); }
.grid .addr { font-weight: 500; color: var(--ink); white-space: normal; display: inline-block; min-width: 140px; }
.table-note { font-size: var(--fs-xs); color: var(--muted); padding: 4px 2px; }
.under { color: var(--under); font-weight: 600; }
.over { color: var(--over); font-weight: 600; }
.up { color: var(--ok); }
.down { color: var(--fail); }
.flag { color: var(--warn); font-weight: 600; }
.ext { font-size: var(--fs-xs); }

.effect { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.sbar { position: relative; width: 60px; height: 8px; display: inline-block; background: linear-gradient(var(--rule), var(--rule)) center / 1px 100% no-repeat; }
.sbar-fill { position: absolute; top: 1px; bottom: 1px; border-radius: 1px; }
.sbar-fill.pos { background: var(--s1); }
.sbar-fill.neg { background: var(--s2); }
.mbar { width: 44px; height: 6px; display: inline-block; background: var(--rule-2); border-radius: 3px; overflow: hidden; }
.mbar span { display: block; height: 100%; background: var(--comp); }

.ci { position: relative; display: inline-block; width: 120px; height: 12px; vertical-align: middle; }
.ci-zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.ci-bar { position: absolute; top: 5px; height: 2px; background: var(--ink-2); }
.ci-pt { position: absolute; top: 2px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--ink-2); }
.ci-pt.sig { background: var(--accent); border-color: var(--accent); }
.ci-pt.sig.neg { background: var(--s2); border-color: var(--s2); }
.group + .group { margin-top: 6px; }
.group h4 { margin-top: 10px; }

.health-line { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.sources { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: var(--fs-sm); }
.sources dt { font-weight: 600; }
.sources dd { margin: 0; color: var(--ink-2); max-width: 70ch; }

/* ---------------------------------------------------------------- charts */
.chart-box { width: 100%; min-height: 60px; margin: 6px 0 10px; }
/* uPlot canvas charts (public/js/charts.js); base layout rules in /css/uplot-1.6.32.css. Colours are drawn from the theme. */
.chart { display: block; width: 100%; font-size: 10.5px; font-family: var(--font); }
.chart .uplot { font-family: var(--font); width: 100%; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 20px; padding-right: 12px; }
.chart .axis-label { color: var(--muted); font-size: 10px; }
.chart-legend { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; color: var(--ink-2); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chart-legend .lg-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.chart-legend .lg-line { width: 12px; height: 0; border-top: 2.2px solid var(--c); }
.chart-legend .lg-line.dash { border-top-style: dashed; }
.chart .u-cursor-x { border-right: 1px solid color-mix(in srgb, var(--ink-2) 35%, transparent); }
.chart-ring {
  position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--ink); pointer-events: none; display: none;
}
.chart-tip {
  position: fixed; z-index: 3000; pointer-events: none; display: none; min-width: 140px; max-width: 280px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 7px 9px; font-size: var(--fs-sm);
}
.tip-title { font-weight: 600; margin-bottom: 3px; }
.tip-row { display: flex; justify-content: space-between; gap: 14px; }
.tip-k { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.tip-key { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--s1); }
.tip-key.s2 { background: var(--s2); }
.tip-key.s3 { background: var(--s3); }
.tip-key.muted { background: var(--muted); }

/* ---------------------------------------------------------------- map */
.map-status {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 800;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 15px; box-shadow: var(--shadow);
  padding: 4px 12px; font-size: var(--fs-sm); color: var(--ink-2); display: flex; align-items: center; gap: 4px; max-width: 80%;
}
.map-status[hidden] { display: none; }
.map-status.error { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, var(--rule)); }
.map-status.info { color: var(--ink); border-color: var(--accent); }
.map.placing .maplibregl-canvas-container.maplibregl-interactive, .map.placing canvas { cursor: crosshair !important; }

.maplibregl-map { font: inherit; background: var(--surface-2); }
.maplibregl-ctrl-group { background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow) !important; border-radius: var(--r); }
.maplibregl-ctrl-group button + button { border-top-color: var(--rule); }
[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
.maplibregl-ctrl-attrib-button { background-color: var(--surface); }
.maplibregl-ctrl-scale { background: color-mix(in srgb, var(--surface) 80%, transparent); border-color: var(--ink-2); color: var(--ink-2); }

.map-layers { font-size: var(--fs-sm); color: var(--ink); }
.map-layers summary { list-style: none; width: 29px; height: 29px; display: grid; place-items: center; cursor: pointer; }
.map-layers summary::-webkit-details-marker { display: none; }
.map-layers summary svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.map-layers fieldset { border: 0; margin: 0; padding: 4px 10px 8px; display: grid; gap: 4px; }
.map-layers label { display: flex; gap: 6px; align-items: center; white-space: nowrap; cursor: pointer; }
.map-layers .map-cluster { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--rule); cursor: default; }
.map-layers .map-cluster select { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 4px; }
.map-layers fieldset { max-height: calc(100vh - 220px); overflow-y: auto; }
.map-plan { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--rule); display: grid; gap: 4px; }
.map-plan-title { font-weight: 600; }
.map-plan-group { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.map-plan-hint { color: var(--muted); font-size: var(--fs-xs); }
.map-plan-attr { color: var(--muted); font-size: var(--fs-xs); white-space: normal; max-width: 220px; }
.legend-plan { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule-2); }
.legend-lu { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin-top: 4px; }
.legend-lu span { display: inline-flex; align-items: center; gap: 4px; line-height: 1.2; }
.legend-lu i { width: 10px; height: 10px; border-radius: 2px; flex: none; opacity: 0.85; }

.map-legend {
  margin: 0 0 10px 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 8px 10px; font-size: var(--fs-xs); color: var(--ink-2); width: 220px;
}
.legend-title { font-weight: 600; color: var(--ink); margin-bottom: 5px; font-size: var(--fs-sm); }
.legend-ramp { display: flex; height: 8px; border-radius: 2px; overflow: hidden; }
.legend-ramp i { flex: 1; }
.legend-scale, .legend-hint { display: flex; justify-content: space-between; margin-top: 3px; }
.legend-hint { color: var(--muted); }
.legend-row { margin-top: 6px; display: flex; gap: 10px; }
.legend-row span, .legend-stn span { display: inline-flex; align-items: center; gap: 4px; }
.legend-nd { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-stn { display: flex; gap: 10px; margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--rule-2); }

.stn { display: inline-block; width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box; vertical-align: -1px; flex: none; }
.stn-open { background: var(--ink); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--ink); }
.stn-planned { background: var(--surface); border: 2px solid var(--ink); }
.stn-hypothetical { background: var(--comp); border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--comp); }
.sch-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-sizing: border-box; border: 1.5px solid var(--ink); flex: none; }
.sch-dot.sm { width: 8px; height: 8px; border-width: 1px; }
.sch-dot.top { background: var(--surface); border: 2.5px solid #d4a000; }
[data-theme="dark"] .sch-dot.top { border-color: #f2c94c; }

.ring-label { background: none; border: 0; }
.ring-label span { display: inline-block; padding: 0 4px; font-size: 10px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--surface) 85%, transparent); border-radius: 3px; }
.ring-label.school span { color: #b0407a; }
[data-theme="dark"] .ring-label.school span { color: #e07ab0; }

.map-tip { pointer-events: none; z-index: 5; }
.map-tip .maplibregl-popup-content { font: var(--fs-sm)/1.4 var(--font); background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow); padding: 7px 9px; min-width: 180px; }
.map-tip .maplibregl-popup-tip { display: none; }
.mt-title { font-weight: 600; }
.mt-sub { color: var(--muted); font-size: var(--fs-xs); display: flex; flex-wrap: wrap; gap: 0 8px; margin-bottom: 4px; }
.mt-grid { border-collapse: collapse; width: 100%; }
.mt-grid td { padding: 1px 0; }
.mt-grid td:last-child { text-align: right; font-weight: 500; padding-left: 12px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  :root { --panel-w: clamp(400px, 48vw, 560px); }
  .seg button { padding: 0 8px; }
  .headline { grid-template-columns: 1fr; }
  .headline-side { justify-content: start; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 8px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  /* five colour modes: take the full row and share it, so the control never runs past a phone screen */
  #seg-color { display: flex; flex: 1 1 100%; max-width: 100%; }
  #seg-color button { flex: 1 1 auto; padding: 0 5px; white-space: nowrap; }
  .layout { flex-direction: column; height: auto; }
  .map-pane { height: 52vh; flex: none; }
  .panel { flex: none; border-left: 0; border-top: 1px solid var(--rule); }
  .views { min-height: 70vh; }
  .view { position: static; }
  .view[hidden] { display: none; }
  .forest-row { grid-template-columns: 92px 64px 1fr 74px; gap: 6px; }
}
@media (max-width: 480px) {
  #seg-color .seg-more { display: none; } /* "Transit", "Green": full names stay in the button titles */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
