/* Heatwise — urban heat mitigation console.

   Design rules this file holds to (redesign brief §13–§16):
   - one restrained accent; amber/red/green mean something, they are not decor
   - the temperature ramp is data, and never appears in the chrome
   - borders and spacing carry hierarchy; there are no shadows and no glow
   - radii are 3–6px, never pill-shaped panels
   - transitions are 150–200ms and only on state changes a user caused */

:root {
  /* surfaces — neutral charcoal-navy, not a gradient in sight */
  --bg:          #0C1017;
  --surface:     #11161F;
  --surface-2:   #161C27;
  --surface-3:   #1C2431;
  --line:        #222B3A;
  --line-2:      #2C3749;

  /* type */
  --fg:          #E8EAF0;
  --fg-2:        #9AA6BC;
  --fg-3:        #6B7891;

  /* one accent */
  --accent:      #4C8DD9;
  --accent-dim:  rgba(76, 141, 217, .14);
  --accent-line: rgba(76, 141, 217, .45);

  /* semantic only */
  --warn:        #E0A23C;
  --danger:      #D8635F;
  --ok:          #5E9E7E;

  --r:    3px;
  --r-md: 5px;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --dur: 160ms;
  --ease: cubic-bezier(.2, .6, .35, 1);

  --appbar-h: 60px;
  --metrics-h: 62px;
  --panel-w: 33%;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-rows: var(--appbar-h) 1fr auto auto auto;
  /* Without an explicit column, this grid's single implicit column is sized to
     max-content -- the app bar's un-shrinkable width. Combined with
     overflow:hidden that does not produce a scrollbar, it silently CROPS the
     right-hand end of the bar, so the Export button was partly off-screen at
     1600px. minmax(0, 1fr) holds the column to the viewport and lets the
     bar's own overflow rules do their job. */
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
button, input, select { font: inherit; color: inherit; }

/* ── boot ────────────────────────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity var(--dur) var(--ease), visibility var(--dur);
}
.boot.is-done { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.boot-sub { margin: 0; font-size: 12.5px; color: var(--fg-3); font-family: var(--mono); }
.boot-sub.is-error { color: var(--danger); }

/* ── application bar ─────────────────────────────────────────────────────── */
.appbar {
  display: flex; align-items: center; gap: 24px;
  /* min-width:0 lets the bar shrink below its content; without it the flex
     items' min-content width wins and the bar overflows again. */
  min-width: 0;
  height: var(--appbar-h);
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 2px; }
.brand-name {
  margin: 0; font-size: 13px; font-weight: 600;
  letter-spacing: .13em; font-family: var(--mono);
}
.brand-sub { margin: 0; font-size: 11px; color: var(--fg-3); }

.appbar-meta {
  display: flex; align-items: center; gap: 20px;
  /* flex-basis 0 so this yields space before the controls do. It is the only
     part of the bar that can be dropped without losing a control, and every
     figure in it also appears in the panels below. */
  flex: 1 1 0; min-width: 0; overflow: hidden;
  font-size: 12px; color: var(--fg-2);
}
/* flex: none, or the columns shrink below their content and the values wrap
   onto a second line inside a 60px bar. */
.appbar-meta span {
  display: flex; flex-direction: column; gap: 1px;
  white-space: nowrap; flex: none;
}
.appbar-meta i {
  font-style: normal; font-size: 10px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--fg-3);
}
.appbar-meta b { font-weight: 500; font-family: var(--mono); font-size: 12px; color: var(--fg); }

.appbar-actions { display: flex; gap: 6px; flex: none; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--fg-2);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: var(--surface-3); color: var(--fg); }
.btn.is-armed { background: var(--accent-dim); border-color: var(--accent-line); color: var(--fg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #5C99DF; color: #fff; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.icon-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r);
  color: var(--fg-3); cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { color: var(--fg); background: var(--surface-3); }

/* ── workspace: map dominant, plan panel beside it ───────────────────────── */
.workspace {
  position: relative;
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  min-height: 0;
}

.map-region { position: relative; min-width: 0; background: var(--bg); }
.map-region.is-arming { cursor: crosshair; }
.map-canvas { position: absolute; inset: 0; }

.map-overlay { position: absolute; z-index: 500; }
.map-tl { top: 10px; left: 10px; right: 64px; }
.map-tr { top: 10px; right: 52px; }
.map-bl { bottom: 12px; left: 10px; }

/* scope bar */
.chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-label {
  padding: 5px 9px;
  background: rgba(17, 22, 31, .92);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-size: 12px; color: var(--fg-2);
}
.chip-clear {
  padding: 5px 9px;
  background: rgba(17, 22, 31, .92);
  border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--fg-2); font-size: 12px; cursor: pointer;
}
.chip-clear:hover { color: var(--fg); }

.seg {
  display: flex;
  background: rgba(17, 22, 31, .92);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  overflow: hidden;
}
.seg button {
  padding: 5px 10px;
  background: transparent; border: 0;
  border-right: 1px solid var(--line);
  color: var(--fg-3); font-size: 12px; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--fg); background: var(--surface-3); }
.seg button.is-on { background: var(--accent-dim); color: var(--fg); }

/* layer control */
#layer-control {
  width: 178px; padding: 10px;
  background: rgba(17, 22, 31, .94);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.ctl-title {
  margin: 0 0 6px; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-3);
}
.ctl-sep { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.ctl-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12.5px; cursor: pointer; }
.ctl-row input { accent-color: var(--accent); width: 13px; height: 13px; }
.ctl-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ctl-seg button {
  padding: 5px 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--fg-3);
  font-size: 11px; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ctl-seg button.is-on { background: var(--accent-dim); border-color: var(--accent-line); color: var(--fg); }

/* legend */
#legend {
  min-width: 190px; padding: 10px;
  background: rgba(17, 22, 31, .94);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.legend-block + .legend-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.legend-title {
  margin: 0 0 6px; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-3);
}
.ramp { height: 9px; border-radius: 1px; border: 1px solid rgba(0,0,0,.4); }
.ramp-scale {
  display: flex; justify-content: space-between;
  margin-top: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--fg-3);
}
.legend-syms { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.legend-syms li { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-2); }
.legend-syms .sym { width: 10px; height: 10px; border-radius: 1px; border: 1px solid rgba(0,0,0,.5); flex: none; }
.legend-syms b { margin-left: auto; font-family: var(--mono); font-weight: 500; font-size: 11.5px; color: var(--fg-3); }

/* compare divider — labels ride at mid-height, clear of the scope bar above
   and the legend below, both of which occupy the corners. */
.compare-rail {
  position: absolute; inset: 50% 0 auto; z-index: 480;
  display: flex; justify-content: space-between; padding: 0 14px;
  transform: translateY(-50%);
  pointer-events: none;
}
.compare-end {
  padding: 3px 8px;
  background: rgba(12, 16, 23, .82);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--fg-2);
}
.compare-handle {
  position: absolute; top: 0; bottom: 0; z-index: 490;
  width: 26px; margin-left: -13px;
  cursor: ew-resize; touch-action: none;
}
.compare-handle i {
  position: absolute; top: 0; bottom: 0; left: 12px;
  width: 2px; background: rgba(232, 234, 240, .85);
}
.compare-handle::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  background: var(--surface-2);
  border: 1px solid rgba(232, 234, 240, .7);
  border-radius: 50%;
}
.compare-handle:focus-visible { outline: none; }
.compare-handle:focus-visible::after { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }

.sel-band {
  position: absolute; z-index: 600;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  pointer-events: none;
}

/* ── plan panel ──────────────────────────────────────────────────────────── */
.plan-panel {
  position: relative;
  min-width: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.panel-scroll { height: 100%; overflow-y: auto; }
.panel-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-sec-summary { border-bottom: 0; }
.panel-h { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg); }
.panel-sh {
  margin: 0 0 10px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-3); font-weight: 500;
}

/* budget */
.budget { margin-top: 12px; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-row label { font-size: 12.5px; color: var(--fg-2); }
.field-row output { font-family: var(--mono); font-size: 20px; font-weight: 500; }
.field-row.sub { margin-top: 5px; font-size: 12px; color: var(--fg-3); }
.field-row.sub b { font-family: var(--mono); font-weight: 500; color: var(--fg-2); }

#budget-input { width: 100%; margin: 10px 0 8px; accent-color: var(--accent); }
.budget-bar { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.budget-bar i { display: block; height: 100%; background: var(--accent); transition: width var(--dur) var(--ease); }

.preset-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.preset-row button {
  padding: 6px 2px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--fg-3);
  font-size: 11.5px; font-family: var(--mono); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.preset-row button:hover { color: var(--fg); }
.preset-row button.is-on { background: var(--accent-dim); border-color: var(--accent-line); color: var(--fg); }

/* measures */
.iv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.iv {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center; gap: 9px;
  padding: 8px 6px;
  border-radius: var(--r);
  transition: background var(--dur) var(--ease);
}
.iv:hover { background: var(--surface-2); }
.iv.is-muted { opacity: .5; }
.iv.is-off { grid-template-columns: auto 1fr; opacity: .42; }
.iv-check input { accent-color: var(--accent); width: 13px; height: 13px; }
.iv-sym {
  display: grid; place-items: center;
  width: 22px; height: 22px;
  background: color-mix(in srgb, var(--tint) 18%, transparent);
  border: 1px solid var(--tint);
  border-radius: 2px;
  color: var(--tint);
}
.iv-sym svg { width: 14px; height: 14px; }
.iv-name { margin: 0; font-size: 13px; }
.iv-note { margin: 1px 0 0; font-size: 11.5px; color: var(--fg-3); }
.iv-figs { text-align: right; }
.iv-figs b { display: block; font-family: var(--mono); font-size: 12.5px; font-weight: 500; }
.iv-figs span { font-size: 11px; color: var(--fg-3); font-family: var(--mono); }

/* plan result */
.fig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fig b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fig span { font-size: 11px; color: var(--fg-3); }

/* decision summary */
.kpi-lead { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.kpi-lead b {
  display: block; font-size: 34px; font-weight: 600; line-height: 1.05;
  color: var(--ok); font-variant-numeric: tabular-nums;
}
.kpi-lead span { display: block; margin-top: 3px; font-size: 12px; color: var(--fg-3); }
.summary-list { margin: 10px 0 0; display: grid; gap: 5px; }
.summary-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.summary-list dt { color: var(--fg-3); }
.summary-list dd { margin: 0; font-family: var(--mono); color: var(--fg-2); }
.summary-list em { font-style: normal; color: var(--ok); }
.caveat {
  margin: 14px 0 0; padding: 8px 10px;
  border-left: 2px solid var(--warn);
  background: rgba(224, 162, 60, .07);
  font-size: 11.5px; color: var(--fg-2);
}

/* ── inspector ───────────────────────────────────────────────────────────── */
.inspector {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 700;
  width: var(--panel-w);
  padding: 14px 16px 24px;
  background: var(--surface);
  border-left: 1px solid var(--line-2);
  overflow-y: auto;
}
.ins-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ins-eyebrow { margin: 0; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.ins-id { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.ins-place { margin: 10px 0 2px; font-size: 13px; }
.ins-place.is-dim { color: var(--fg-3); }
.ins-coords { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--fg-3); }

.ins-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.ins-sec h3 {
  margin: 0 0 8px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-3); font-weight: 500;
}
.ins-why { margin: 0 0 12px; font-size: 13px; color: var(--fg-2); }

.fx { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fx-k { font-size: 12.5px; color: var(--fg-2); }
.fx-v { font-family: var(--mono); font-size: 12.5px; font-weight: 500; text-align: right; }
.fx-n { grid-column: 1 / -1; font-size: 11px; color: var(--fg-3); }
.fx-bar { grid-column: 1 / -1; display: block; height: 2px; background: var(--surface-3); border-radius: 1px; }
.fx-bar em { display: block; height: 100%; background: var(--accent); }

.rec { margin-top: 4px; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.rec.is-funded { border-color: var(--accent-line); background: var(--accent-dim); }
.rec.is-excluded { background: var(--surface-2); }
.rec-head { display: flex; align-items: center; gap: 9px; }
.rec-name { margin: 0; font-size: 13.5px; font-weight: 500; }
.rec-unit { margin: 1px 0 0; font-size: 11px; color: var(--fg-3); }
.rec-state {
  margin-left: auto; padding: 2px 7px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-2);
}
.rec.is-funded .rec-state { border-color: var(--accent-line); color: var(--accent); }
.rec-figs { display: grid; gap: 4px; margin: 10px 0 0; }
.rec-figs > div { display: flex; justify-content: space-between; font-size: 12.5px; }
.rec-figs dt { color: var(--fg-3); }
.rec-figs dd { margin: 0; font-family: var(--mono); }
.rec-why { margin: 8px 0 0; font-size: 11.5px; color: var(--fg-3); }

.ins-links { display: flex; gap: 6px; }
.ins-links a {
  flex: 1; text-align: center; padding: 7px 8px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--r); color: var(--fg-2);
  font-size: 12.5px; text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ins-links a:hover { background: var(--surface-3); color: var(--fg); }
.ins-box { margin: 8px 0 0; font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); }

/* ── metrics strip ───────────────────────────────────────────────────────── */
.metrics {
  display: flex; align-items: center; gap: 0;
  height: var(--metrics-h);
  padding: 0 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  overflow-x: auto;
}
.metric { padding: 0 22px 0 0; margin-right: 22px; border-right: 1px solid var(--line); white-space: nowrap; }
.metric:last-child { border-right: 0; }
.metric b {
  display: block; font-size: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.metric span { font-size: 11px; color: var(--fg-3); }
.metric.is-key b { color: var(--accent); }

/* ── drawers ─────────────────────────────────────────────────────────────── */
.drawer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 14px 16px 18px;
  max-height: 46vh;
  overflow-y: auto;
}
.drawer-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.drawer-head h2 { font-size: 14px; }
.drawer-head p { margin: 0; font-size: 12px; color: var(--fg-3); }
.drawer-head .icon-btn { margin-left: auto; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.chart-card { margin: 0; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.chart-card figcaption { margin-bottom: 8px; font-size: 12px; color: var(--fg-2); }
.chart-box { height: 210px; }

.method-body { max-width: 900px; }
.method-list { margin: 0; display: grid; gap: 8px; }
.method-list > div { display: grid; grid-template-columns: 190px 1fr; gap: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.method-list dt { font-size: 12.5px; color: var(--fg-2); }
.method-list dd { margin: 0; font-size: 12.5px; color: var(--fg-3); }
.method-foot { margin: 12px 0 0; font-size: 12px; color: var(--fg-3); }
.method-foot code { font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); }

/* ── toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 950;
  transform: translateX(-50%);
  margin: 0; padding: 8px 14px;
  background: var(--surface-3); border: 1px solid var(--line-2);
  border-radius: var(--r); font-size: 12.5px;
}

/* ── city picker ─────────────────────────────────────────────────────────── */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.city-pick { display: inline-flex; align-items: center; }

.city-select {
  height: 32px; padding: 0 26px 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--fg);
  font: inherit; font-size: 13px;
  cursor: pointer;
  /* The native arrow is drawn in the platform colour and reads as a light
     control dropped into a dark bar, so it is replaced. */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239AA6BC' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 9px;
}
.city-select:hover { background-color: var(--surface-3); }
.city-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.city-select:disabled { opacity: .5; cursor: progress; }

body.is-loading-city .map-region { opacity: .45; transition: opacity var(--dur) var(--ease); }

/* ── load-your-grid control ──────────────────────────────────────────────── */

/* Deliberately wider than the other buttons. This is the feature the whole
   multi-city path exists for, and as a plain 90px button labelled "Open city
   file" it read as a minor utility and was missed entirely. */
.btn-load {
  height: 32px;
  padding: 0 12px;
  gap: 8px;
  background: var(--accent-dim);
  border-color: var(--accent-line);
  color: var(--fg);
}
.btn-load:hover { background: rgba(76, 141, 217, .22); border-color: var(--accent); }
.btn-load span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.btn-load i {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: .02em;
  color: var(--fg-3);
}
.btn-load svg { width: 15px; height: 15px; flex: none; }

@media (max-width: 1500px) {
  .btn-load i { display: none; }
}

/* ── download menu ───────────────────────────────────────────────────────── */

.dl-wrap { position: relative; display: inline-flex; }

.dl-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 900;
  width: 268px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
}
/* The overlay lesson, applied: an element toggled through the hidden
   attribute must not be given a display value that outranks it. */
.dl-menu[hidden] { display: none; }

.dl-head {
  margin: 2px 4px 7px;
  font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-3);
}
.dl-menu ul { list-style: none; margin: 0; padding: 0; }
.dl-menu li + li { margin-top: 2px; }
.dl-menu a {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 8px;
  border-radius: var(--r);
  text-decoration: none;
  color: var(--fg-2);
}
.dl-menu a:hover { background: var(--surface-3); }
.dl-menu a b { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--fg); }
.dl-menu a i { font-style: normal; font-size: 11px; color: var(--fg-3); }
.dl-foot, .dl-empty {
  margin: 8px 4px 2px;
  font-size: 10.5px; line-height: 1.45;
  color: var(--fg-3);
}
.dl-empty { margin: 4px; }

/* ── cost-basis banner ───────────────────────────────────────────────────── */

/* Only shown when the money on screen needs qualifying. It sits above the
   budget control rather than beside it because it is a precondition for
   reading anything below, not an annotation on one figure. */
.cost-basis {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 12.5px;
  line-height: 1.5;
}
.cost-basis strong { display: block; margin-bottom: 3px; color: var(--fg); font-weight: 600; }
.cost-basis code { font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); }
.cost-basis.is-invalid {
  border-color: var(--danger);
  background: rgba(216, 99, 95, .10);
}
.cost-basis.is-invalid strong { color: var(--danger); }
.cost-basis.is-unverified {
  border-color: var(--warn);
  background: rgba(224, 162, 60, .10);
}
.cost-basis.is-unverified strong { color: var(--warn); }

/* ── file drop ───────────────────────────────────────────────────────────── */

.drop-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: rgba(12, 16, 23, .82);
  backdrop-filter: blur(2px);
}
/* Required, and not optional the way it looks.
   The browser's own [hidden] { display: none } lives in the user-agent
   stylesheet, which every author rule outranks -- so the `display: grid`
   above silently defeated the hidden attribute and left this overlay painted
   over the whole dashboard from first load. Any element given a display value
   unconditionally needs this line; the other panels here default to
   display:none and opt in via a class, which is why only this one broke. */
.drop-overlay[hidden] { display: none; }
.drop-card {
  padding: 26px 32px;
  border: 1px dashed var(--accent-line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
  max-width: 380px;
}
.drop-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--fg); }
.drop-sub { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--fg-2); }
.drop-sub code { font-family: var(--mono); font-size: 11.5px; }

/* ── leaflet overrides ───────────────────────────────────────────────────── */
.leaflet-container { background: #0A0D13; font-family: var(--font); }
.leaflet-control-zoom a {
  background: rgba(17, 22, 31, .94) !important;
  border-color: var(--line-2) !important;
  color: var(--fg-2) !important;
}
.leaflet-control-zoom a:hover { background: var(--surface-3) !important; color: var(--fg) !important; }
.leaflet-control-attribution {
  background: rgba(12, 16, 23, .78) !important;
  color: var(--fg-3) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--fg-2) !important; }
.leaflet-control-geocoder {
  background: rgba(17, 22, 31, .94) !important;
  border: 1px solid var(--line-2) !important;
  border-radius: var(--r) !important;
}
.leaflet-control-geocoder-form input { background: transparent; color: var(--fg); border: 0; }

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --panel-w: 38%; }
  .appbar-meta span:nth-child(3) { display: none; }
}

@media (max-width: 860px) {
  body { grid-template-rows: auto auto auto auto auto; overflow: auto; }
  .appbar { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .appbar-meta { order: 3; width: 100%; gap: 16px; }
  .workspace { grid-template-columns: 1fr; }
  .map-region { height: 58vh; }
  .plan-panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { max-height: none; }
  .inspector { position: fixed; width: min(100%, 380px); }
  .metrics { height: auto; flex-wrap: wrap; gap: 12px 0; padding: 12px 16px; }
  .map-tl { right: 10px; }
  .map-tr { top: auto; bottom: 12px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
