/* ============================================================================
   Finnegan Listings — internal database tool.  Binding spec: aesthetics.md.
   An app shell (persistent top nav + workspace) with four views, comfortable
   density, hairline structure, one blue for interaction, status colors for
   state, mono for data, and instant/minimal motion. Every value traces to a §.
   ============================================================================ */

/* Fonts are loaded via a <link> in index.html's <head> (parallel fetch), NOT an
   @import here — an @import would serialize the font fetch after this stylesheet
   downloads, delaying first paint. Keep the families in sync with that <link>. */

/* ---- tokens (§1, §2, §3, §4, §6, §9) ------------------------------------- */
:root {
  /* the one blue — interaction / focus / active / lead data only (§1) */
  --blue: #0071E3;
  --blue-hover: #0077ED;
  --blue-pressed: #006EDB;
  --blue-ink: #003D80;
  --blue-tint: #E8F1FD;

  /* neutrals — the entire structural surface (§2) */
  --bg: #FFFFFF;
  --bg-subtle: #F5F5F7;
  --surface: #FFFFFF;
  --ink: #1D1D1F;
  --ink-secondary: #6E6E73;
  --ink-tertiary: #86868B;
  --line: #D2D2D7;
  --line-strong: #B0B0B8;
  --area-land: #E4E4E8;   /* inert municipality fill on the area-picker map (between --bg-subtle and --line) */
  --hover: #ECECEF;       /* neutral hover wash on a light surface (menu rows, accordion heads) */
  --scrim: rgba(29, 29, 31, 0.32);   /* modal / drawer backdrop dim */

  /* status / semantic — state only, never decoration (§2) */
  --success: #1E8E5A; --success-tint: #E6F4EC;
  --warning: #B8821A; --warning-tint: #FBF1DC;
  --error:   #C5413B; --error-tint:   #FBE9E8;

  /* starred / saved — a warm gold accent, the one sanctioned non-blue interaction
     colour (it marks a user's own saved listings; distinct from the ochre data-3). */
  --gold: #C28A1A;
  --gold-strong: #A6760F;
  --gold-tint: rgba(194, 138, 26, 0.16);

  /* data palette — map/charts only, blue leads (§2) */
  --data-1: #0071E3;
  --data-2: #2D8C8C;
  --data-3: #B8843A;
  --data-4: #6B6B99;

  /* type (§3) — app-scale; SF Pro first on macOS, Inter fallback */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Geist Mono", Menlo, monospace;

  /* shape (§6) — depth = hairline + value shift, never decorative shadow */
  --radius-sm: 4px;
  --radius: 6px;
  --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.08); /* the ONLY shadow — floating UI (§6) */

  /* motion (§9) — instant/minimal, ease-out, no springs */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t: 0.12s;

  /* density (§4) — 8px grid */
  --nav-h: 56px;
  --row-h: 40px;
  --ctrl-h: 32px;
  --pad: 24px;
}

/* ---- dark theme (aesthetics.md §2 "Dark theme" — per-user opt-in) ----------
   Light is still the default + design baseline. Dark is a faithful TRANSPOSITION
   of the same system, not a new palette: same one blue (nudged brighter so it
   reads on a dark field), same status semantics, depth still from hairline +
   value shift (never decorative shadow). Every value below maps 1:1 to a light
   token, so the 240-odd var() references flip automatically. The dark token set
   is declared once and shared by an explicit choice ([data-theme="dark"]) and by
   "system" when the OS prefers dark — the head-script sets data-theme pre-paint
   so there is no flash. */
[data-theme="dark"] {
  --blue: #2B93FF;
  --blue-hover: #4AA4FF;
  --blue-pressed: #1E84F0;
  --blue-ink: #9CC8FF;
  --blue-tint: #143049;          /* selected-row band on a dark surface */

  --bg: #1A1A1C;                 /* near-black canvas — never pure #000 (§2 honesty) */
  --bg-subtle: #232326;          /* panels, headers, alternating zones */
  --surface: #202023;            /* cards/panels, separated by hairline not shadow */
  --ink: #F2F2F5;                /* primary text — never pure #FFF */
  --ink-secondary: #A0A0A8;
  --ink-tertiary: #6E6E76;
  --line: #38383D;               /* hairline borders & dividers */
  --line-strong: #4C4C54;
  --area-land: #2C2C31;
  --hover: #2C2C30;
  --scrim: rgba(0, 0, 0, 0.55);

  --success: #3DB37C; --success-tint: #15301F;
  --warning: #D29A3A; --warning-tint: #322713;
  --error:   #E1635C; --error-tint:   #3A1A18;

  --gold: #D7A53C;
  --gold-strong: #E2B454;
  --gold-tint: rgba(215, 165, 60, 0.18);

  /* keep the data hues distinguishable on dark (value-lifted, blue still leads) */
  --data-1: #2B93FF; --data-2: #45AEAE; --data-3: #D0A256; --data-4: #9696C6;

  --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.5);
}
/* "System" follows the OS only when the user hasn't forced light/dark. Mirrors the
   block above (CSS has no mixins; kept in lockstep with [data-theme="dark"]). */
@media (prefers-color-scheme: dark) {
  [data-theme="system"], :root:not([data-theme]) {
    --blue: #2B93FF; --blue-hover: #4AA4FF; --blue-pressed: #1E84F0;
    --blue-ink: #9CC8FF; --blue-tint: #143049;
    --bg: #1A1A1C; --bg-subtle: #232326; --surface: #202023;
    --ink: #F2F2F5; --ink-secondary: #A0A0A8; --ink-tertiary: #6E6E76;
    --line: #38383D; --line-strong: #4C4C54; --area-land: #2C2C31;
    --hover: #2C2C30; --scrim: rgba(0, 0, 0, 0.55);
    --success: #3DB37C; --success-tint: #15301F;
    --warning: #D29A3A; --warning-tint: #322713;
    --error: #E1635C; --error-tint: #3A1A18;
    --gold: #D7A53C; --gold-strong: #E2B454; --gold-tint: rgba(215, 165, 60, 0.18);
    --data-1: #2B93FF; --data-2: #45AEAE; --data-3: #D0A256; --data-4: #9696C6;
    --shadow-float: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}
/* The map tiles (MapLibre raster/clinical base) are inherently light; in dark mode
   gently knock back their luminance so the bright rectangle doesn't fight the UI.
   The data layers (deck.gl points/heatmap) are drawn separately and unaffected. */
[data-theme="dark"] #map-canvas .maplibregl-canvas,
[data-theme="dark"] .areamap svg { filter: brightness(0.82) contrast(1.04); }
@media (prefers-color-scheme: dark) {
  [data-theme="system"] #map-canvas .maplibregl-canvas,
  [data-theme="system"] .areamap svg { filter: brightness(0.82) contrast(1.04); }
}

/* ---- reset / base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* hidden wins over flex/grid display rules */
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; height: 100%;
  font-family: var(--font);
  font-optical-sizing: auto;
  font-size: 0.9375rem;       /* body / UI default 15px (§3) */
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;            /* the workspace owns scrolling, not the page */
}
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: var(--radius-sm); }
button { font-family: inherit; }

/* ---- shared type bits (§3) ----------------------------------------------- */
.eyebrow {
  font-size: 0.75rem; font-weight: 500; line-height: 1.3;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-secondary);
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 0.8125rem; line-height: 1.45; }
.cell-muted { color: var(--ink-secondary); }
.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; }   /* visually hidden, still announced */

/* ============================================================================
   App shell — top nav + workspace (§5.1)
   ============================================================================ */
.appbar {
  height: var(--nav-h); flex: none;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.appbar__inner {
  height: 100%; display: flex; align-items: center; gap: 24px;
  padding: 0 var(--pad);
}
.appbar__spacer { flex: 1; }

.wordmark { display: flex; align-items: baseline; gap: 8px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.wordmark__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); align-self: center; }
.wordmark__sub { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-secondary); }

/* view switcher — active item in blue (§5.1, §5.5) */
.viewswitch { display: flex; gap: 4px; }
.viewswitch button {
  border: none; background: transparent; cursor: pointer;
  height: var(--ctrl-h); padding: 0 12px; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--ink-secondary);
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.viewswitch button:hover { color: var(--ink); background: var(--bg-subtle); }
.viewswitch button[aria-selected="true"] { color: var(--blue); }

/* freshness — neutral metadata; the dot is a success-state cue (§2) */
.freshness { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--ink-secondary); }
.freshness__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
.freshness.is-stale .freshness__dot { background: var(--warning); }

/* account / sign-out — right-side actions (§5.1) */
.account { display: inline-flex; align-items: center; gap: 12px; }
.account[hidden] { display: none; }
.account__user { font-size: 0.8125rem; color: var(--ink-secondary); }

/* ---- workspace + views (§5.1, §5.2) -------------------------------------- */
.workspace { height: calc(100% - var(--nav-h)); position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: var(--pad); overflow: auto; }
.view[hidden] { display: none; }
.view--map { padding: 0; }

.view__head { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; flex: none; }
.view__head--map { padding: 16px var(--pad); margin-bottom: 0; border-bottom: 1px solid var(--line); }
.view__title { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
.view__sub { font-size: 0.875rem; color: var(--ink-secondary); }

/* ============================================================================
   Dashboard — KPI stat blocks + map centerpiece + recent glance (§8.4)
   ============================================================================ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; flex: none; margin-bottom: 24px; }
.kpi { background: var(--surface); padding: 16px 20px; }
.kpi__value { font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 2rem; font-weight: 600; line-height: 1.1; color: var(--ink); }
.kpi__label { margin-top: 6px; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-secondary); }

.dash-body { flex: 1; min-height: 360px; display: flex; gap: 16px; }
.dash-map { flex: 1; min-width: 0; display: flex; }
.recent { width: 300px; flex: none; display: flex; flex-direction: column; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel__head { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-subtle); }
.panel__note { display: block; margin-top: 4px; font-size: 0.6875rem; line-height: 1.35; color: var(--ink-secondary); cursor: help; }
.recent__list { overflow: auto; flex: 1; }
.recent__row { display: block; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background var(--t) var(--ease); }
.recent__row:last-child { border-bottom: none; }
.recent__row:hover { background: var(--bg-subtle); }
.recent__top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.recent__addr { font-size: 0.8125rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent__price { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.8125rem; color: var(--ink); flex: none; }
.recent__sub { margin-top: 2px; font-size: 0.75rem; color: var(--ink-secondary); }
.recent__rank { font-family: var(--mono); color: var(--ink-secondary); }

/* Dashboard insights accordion — exactly one section open at a time; the others
   collapse to their header only. The body collapse animates via grid-template-rows
   0fr→1fr (animates the real content height; respects prefers-reduced-motion). */
.accordion { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.acc { display: flex; flex-direction: column; border-bottom: 1px solid var(--line); min-height: 0; }
.acc:last-child { border-bottom: none; }
/* The open section grows to fill the panel, so any collapsed section below it is
   pushed to the bottom of the widget (trailing space sits below the open content). */
.acc.is-open { flex: 1 1 auto; }
.acc:not(.is-open) { flex: 0 0 auto; }
.acc__head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 12px 16px; background: var(--bg-subtle); border: 0; text-align: left;
  cursor: pointer; color: inherit; font: inherit; transition: background var(--t) var(--ease); }
.acc__head:hover { background: var(--hover); }
.acc__titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acc__hint { font-size: 0.6875rem; line-height: 1.35; color: var(--ink-secondary); }
.acc:not(.is-open) .acc__hint { display: none; }            /* collapsed = label only */
.acc__chev { flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-secondary);
  border-bottom: 1.5px solid var(--ink-secondary); transform: rotate(45deg);
  transition: transform var(--t) var(--ease); }
.acc.is-open .acc__chev { transform: rotate(-135deg); }
.acc__bodywrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s var(--ease); }
.acc.is-open .acc__bodywrap { grid-template-rows: 1fr; }
.acc__body { min-height: 0; overflow: hidden; }
.acc.is-open .acc__body { border-top: 1px solid var(--line); }
.acc.is-open .acc__body .recent__list { max-height: 360px; }

/* ============================================================================
   Tables — the primary workspace (§8.2)
   ============================================================================ */
.dataset { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dataset[hidden] { display: none; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; flex: none; }
.toolbar--search { margin-bottom: 24px; }
.toolbar__end { margin-left: auto; }   /* push trailing actions (e.g. Export CSV) to the right */

.table-frame { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; flex: 1; min-height: 0; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
  position: sticky; top: 0; z-index: 1; background: var(--bg-subtle);
  text-align: left; padding: 0 16px; height: var(--row-h);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-secondary);
  cursor: pointer; user-select: none; white-space: nowrap;
}
table.data thead th.num { text-align: right; }
table.data thead th.static { cursor: default; }
table.data thead th .arrow { font-family: var(--mono); color: var(--blue); margin-left: 6px; }
table.data tbody td { padding: 0 16px; height: var(--row-h); border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.8125rem; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data tbody td .unit { color: var(--ink-secondary); margin-left: 3px; }
table.data tbody tr { cursor: pointer; transition: background var(--t) var(--ease); }
table.data tbody tr:hover { background: var(--bg-subtle); }
table.data tbody tr.selected { background: var(--blue-tint); }
/* Group-by-type section header row (non-data): an uppercase label + count band, not clickable. */
table.data tbody tr.group-row, table.data tbody tr.group-row:hover { cursor: default; background: var(--bg-subtle); }
table.data tbody tr.group-row td {
  height: 32px; border-bottom: 1px solid var(--line-strong);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-secondary);
}

/* status cell: dot + label, state-colored, never color-only (§2, §8.2) */
.statuscell { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.statusdot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ink-tertiary); }
.statusdot--success { background: var(--success); }
.statusdot--warning { background: var(--warning); }
.statusdot--neutral { background: var(--ink-tertiary); }

/* neutral hairline tags (§10) */
.tag { display: inline-block; font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-secondary); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.tag--note { text-transform: none; letter-spacing: 0; color: var(--ink-secondary); }

/* ---- development-potential scoring (§16) --------------------------------- */
/* Tier badge — a ranking of LEAD data, so blue is allowed (§2); restraint via
   tint/solid steps. S/A = strong (blue), B = neutral outline, C/D = muted. */
.tierbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px;
  height: 18px; padding: 0 6px; border-radius: var(--radius-sm); font-family: var(--mono);
  font-size: 0.6875rem; font-weight: 600; vertical-align: middle;
  border: 1px solid var(--line); color: var(--ink-secondary); background: var(--surface); }
.tierbadge--S { background: var(--blue); border-color: var(--blue); color: #fff; }
.tierbadge--A { background: var(--blue-tint); border-color: var(--blue-tint); color: var(--blue-ink); }
.tierbadge--B { color: var(--ink); border-color: var(--line-strong); }
.tierbadge--C, .tierbadge--D { color: var(--ink-tertiary); }

/* Dev cell in the main table — badge + score on one line, right-aligned (§8.2) */
.devcell { white-space: nowrap; }
.devcell .mono { margin-left: 6px; }

/* a calm informational callout (e.g. the residential low-confidence note) */
.callout { font-size: 0.8125rem; color: var(--ink-secondary); background: var(--bg-subtle);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 16px; }
.callout[hidden] { display: none; }

/* drawer breakdown */
.devhead { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.devscore { font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.devscore__max { font-size: 0.8125rem; font-weight: 400; color: var(--ink-tertiary); margin-left: 1px; }
.devrationale { margin-bottom: 12px; }
.devfactors { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.devfactor { display: grid; grid-template-columns: 110px 1fr 34px; align-items: center; gap: 10px; font-size: 0.75rem; color: var(--ink-secondary); }
.devfactor__bar { height: 5px; background: var(--bg-subtle); border-radius: 3px; overflow: hidden; }
.devfactor__bar > span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.devfactor__pts { text-align: right; color: var(--ink); }

/* ---- site intelligence / enrichment (enrichment-plan.md §6) -------------- */
/* Provenanced public-source fields in the drawer. Honest status chips: found =
   success, partial = warning, blocked/error = neutral/error, n/a = muted line. */
.enrich-meta { margin: 2px 0 8px; }
.enrich-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.tag--flag { margin-left: 0; text-transform: none; letter-spacing: 0; color: var(--ink);
  background: var(--warning-tint); border-color: var(--warning-tint); }
.enrich-group { margin-bottom: 14px; }
.enrich-group__title { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.6875rem;
  margin-bottom: 6px; }
.enrich-field { padding: 7px 0; border-top: 1px solid var(--line); }
.enrich-field__head { display: flex; align-items: center; gap: 6px; }
.enrich-field__label { font-size: 0.75rem; color: var(--ink-secondary); }
.enrich-field__val { font-size: 0.875rem; color: var(--ink); margin-top: 2px; }
.enrich-field__note { margin-top: 3px; }
.enrich-field__src { margin-top: 2px; }
.enrich-chip { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 1px 5px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--ink-secondary); }
.enrich-chip--found { background: var(--success-tint); border-color: var(--success-tint); color: var(--success); }
.enrich-chip--partial { background: var(--warning-tint); border-color: var(--warning-tint); color: var(--warning); }
.enrich-chip--blocked, .enrich-chip--error { background: var(--error-tint); border-color: var(--error-tint); color: var(--error); }
.enrich-chip--not_available { color: var(--ink-tertiary); }
.enrich-conf { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-tertiary); }
.enrich-disclaimer { margin: 10px 0 8px; }
.enrich-actions { margin: 8px 0 16px; }

/* ---- drop / restore top picks (§16) -------------------------------------- */
/* Compact row action — flat hairline button, neutral until hovered (no colour:
   dropping is a neutral curation action, not a status). */
.rowbtn { font-family: var(--font); font-size: 0.75rem; font-weight: 500; color: var(--ink-secondary);
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 3px 9px; cursor: pointer; white-space: nowrap; transition: background 120ms ease-out, color 120ms ease-out; }
.rowbtn:hover { background: var(--bg-subtle); color: var(--ink); border-color: var(--line-strong); }
.rowbtn:disabled { color: var(--ink-tertiary); background: var(--bg-subtle); cursor: not-allowed; }
/* the action column is narrow + right-aligned; reveal the Drop button on row hover */
table.data th.col-action, table.data td.col-action { width: 1%; text-align: right; padding-right: 16px; }
.rowbtn--drop { opacity: 0; }
table.data tbody tr:hover .rowbtn--drop,
.rowbtn--drop:focus-visible { opacity: 1; }
@media (hover: none) { .rowbtn--drop { opacity: 1; } }   /* always visible on touch */

/* Dropped panel — a disclosure under the ranking table. */
.dropped { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.dropped[hidden] { display: none; }
.dropped__head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px;
  background: var(--bg-subtle); border: 0; text-align: left; cursor: pointer; }
.dropped__head .acc__titles { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dropped__count { flex: none; font-variant-numeric: tabular-nums; color: var(--ink-secondary);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 7px; font-size: 0.75rem; }
.dropped__head .acc__chev { transition: transform 120ms ease-out; }
.dropped__head[aria-expanded="true"] .acc__chev { transform: rotate(225deg); }
.dropped__body { border-top: 1px solid var(--line); max-height: 280px; overflow: auto; }
.dropped__body[hidden] { display: none; }
.dropped__row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.dropped__row:last-child { border-bottom: none; }
.dropped__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dropped__addr { font-size: 0.8125rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* drawer drop/restore button row */
.dev-actions { margin: 4px 0 16px; }

/* ---- starred / saved listings (§16-adjacent: shared, file-backed curation) -- */
/* The leading ★ on each table row. A set star is the user's own LEAD curation, so it
   gets the sanctioned gold accent; an unset star stays out of the way (hidden until the
   row is hovered/focused, mirroring the Drop button's restraint). */
table.data th.col-star, table.data td.col-star { width: 1%; padding-left: 16px; padding-right: 4px; text-align: center; }
.starbtn { font-size: 0.95rem; line-height: 1; color: var(--ink-tertiary); background: transparent;
  border: 0; padding: 2px 4px; cursor: pointer; border-radius: var(--radius-sm);
  transition: color 120ms ease-out, opacity 120ms ease-out, transform 80ms ease-out; }
.starbtn:hover { color: var(--gold); }
.starbtn:active { transform: scale(0.85); }
.starbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.starbtn.is-on { color: var(--gold); }
/* In the dense table, an UNSET star is invisible until the row is hovered (or the
   button focused); a SET star is always shown so saved rows read at a glance. */
table.data tbody tr .starbtn:not(.is-on) { opacity: 0; }
table.data tbody tr:hover .starbtn:not(.is-on),
table.data tbody tr .starbtn:not(.is-on):focus-visible { opacity: 1; }
@media (hover: none) { table.data tbody tr .starbtn:not(.is-on) { opacity: 0.5; } }   /* touch: always offer it */

/* A starred row glows gold from its top-left corner (a radial wash + a gold left edge),
   so saved listings stand out at a glance among the rest. Repeated for :hover because the
   base tr:hover uses the `background` shorthand, which would otherwise clear the wash. */
table.data tbody tr.is-starred,
table.data tbody tr.is-starred:hover {
  background-image: radial-gradient(150px at top left, var(--gold-tint), transparent);
  box-shadow: inset 3px 0 0 0 var(--gold);
}
table.data tbody tr.is-starred:hover { background-color: var(--bg-subtle); }

/* Starred dashboard widget row — leading ★, then the address/price/meta block. */
.recent__row.star__row { display: flex; align-items: center; gap: 10px; }
.star__main { flex: 1; min-width: 0; }
.star__row .starbtn { flex: none; opacity: 1; }
.star__row .starbtn:disabled { cursor: default; opacity: 0.5; }

/* ---- Changes feed: recent price/status moves on existing listings (last 14d) ----- */
/* State indicators, not interaction — status colors only, each paired with an icon and
   text so meaning never rests on color alone (aesthetics §2). success = a buy-side
   opportunity (price cut / back on market); warning = needs attention (price up / under
   agreement); neutral = gone (off market) or a generic status flip. */
.recent__row.chg__row { display: flex; align-items: center; gap: 10px; }
.chg__main { flex: 1; min-width: 0; }
.chgdot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 0.8125rem; line-height: 1;
  border: 1px solid var(--line); color: var(--ink-secondary); background: var(--surface); }
.chgdot--drop, .chgdot--back { color: var(--success); border-color: var(--success); background: var(--success-tint); }
.chgdot--rise, .chgdot--uag  { color: var(--warning); border-color: var(--warning); background: var(--warning-tint); }
/* Inline table pill — a small tinted badge (the lightest touch §2). */
.tag--chg { text-transform: none; letter-spacing: 0; font-weight: 600; }
.tag--chg-drop, .tag--chg-back { color: var(--success); border-color: var(--success-tint); background: var(--success-tint); }
.tag--chg-rise, .tag--chg-uag  { color: var(--warning); border-color: var(--warning-tint); background: var(--warning-tint); }
.tag--chg-off, .tag--chg-status { color: var(--ink-secondary); }

/* Drawer star toggle — a labelled secondary button that goes gold once saved. */
.drawer__actions { margin: 10px 0 4px; }
.starbtn-text__icon { margin-right: 7px; color: var(--ink-tertiary); font-size: 0.95rem; line-height: 1; }
.starbtn-text.is-on { border-color: var(--gold); color: var(--gold-strong); }
.starbtn-text.is-on .starbtn-text__icon { color: var(--gold); }

/* ---- comments / notes (shared, file-backed per listing; §15) ------------- */
/* Row indicator: a quiet "✎ n" tag marking listings that already have notes. */
.tag--cmt { text-transform: none; letter-spacing: 0; color: var(--ink-secondary); }
/* Drawer thread: stacked note cards + an add-comment form. */
.eyebrow--comments { margin-top: 18px; }
.comments { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 12px; }
.comment { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--bg-subtle); }
.comment__head { display: flex; align-items: baseline; gap: 8px; }
.comment__author { font-size: 0.75rem; font-weight: 600; color: var(--ink); }
.comment__when { flex: 1; }
.comment__del { flex: none; border: 0; background: transparent; color: var(--ink-tertiary); cursor: pointer;
  padding: 0 2px; font-size: 0.8rem; line-height: 1; border-radius: var(--radius-sm); }
.comment__del:hover { color: var(--error); }
.comment__del:disabled { opacity: 0.4; cursor: default; }
.comment__body { margin-top: 4px; font-size: 0.8125rem; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.comment-input { resize: vertical; min-height: 40px; font-family: var(--font); font-size: 0.8125rem; line-height: 1.4; padding: 8px 10px; }
.comment-form__foot { display: flex; align-items: center; gap: 10px; }
.comment-form__msg { flex: 1; }

.statusbar { flex: none; padding-top: 12px; display: flex; align-items: center; gap: 16px; }
.table-meta { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-secondary); }

/* ---- inputs / search (§10) ----------------------------------------------- */
.input { font-family: var(--font); font-size: 0.875rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  height: var(--ctrl-h); padding: 0 12px; width: 100%;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0,113,227,0.25); }
.input::placeholder { color: var(--ink-tertiary); }
.input--search { width: 280px; }
.input--query { height: 44px; font-size: 1rem; max-width: 560px; }

/* segmented control (§10) */
.segmented { display: inline-flex; flex-wrap: wrap; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { flex: 0 0 auto; white-space: nowrap; border: none; background: transparent; font-family: var(--font); font-size: 0.8125rem; font-weight: 500;
  color: var(--ink-secondary); padding: 0 12px; height: 26px; border-radius: 3px; cursor: pointer;
  transition: color var(--t) var(--ease), background var(--t) var(--ease); }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
/* hairline divider inside a segmented control — sets the "Top picks" ranking mode apart
   from the plain subset filters (a meaning step, not decoration; §2/§7). */
.seg-div { flex: 0 0 auto; align-self: stretch; width: 1px; margin: 2px 4px; background: var(--line); }
/* full-width variant — the map panel's "Show" filter fills its column and wraps to rows. */
.segmented--stack { display: flex; width: 100%; }

/* (The property-type searchable combobox was removed in UX-A.1 — the property-type
   axis now lives as multi-select checkboxes inside the "+ Filter" menu below.) */

/* ---- buttons (§10, §11.2) ------------------------------------------------ */
.btn { font-family: var(--font); font-size: 0.875rem; font-weight: 500; line-height: 1;
  height: var(--ctrl-h); padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { background: var(--blue-pressed); transform: scale(0.98); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-secondary[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue); }
.btn:disabled { background: var(--bg-subtle); color: var(--ink-tertiary); cursor: not-allowed; }

.iconbtn { border: 1px solid transparent; background: transparent; color: var(--ink-secondary);
  width: var(--ctrl-h); height: var(--ctrl-h); border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.9375rem;
  transition: background var(--t) var(--ease), color var(--t) var(--ease); }
.iconbtn:hover { background: var(--bg-subtle); color: var(--ink); }

/* ---- empty / loading states (§10) ---------------------------------------- */
.emptystate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; color: var(--ink-secondary); }
.emptystate__msg { font-size: 0.9375rem; max-width: 42ch; }
.emptystate code { font-family: var(--mono); background: var(--bg-subtle); padding: 2px 6px; border-radius: var(--radius-sm); }

/* ============================================================================
   Map — working view with one floating control panel (§8.3)
   ============================================================================ */
.map-slot { flex: 1; min-height: 0; display: flex; }
.map-shell { position: relative; flex: 1; min-height: 0; background: var(--bg-subtle); }
.map-shell.in-dash { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#map-canvas { position: absolute; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* the one permitted shadow — a floating control panel (§6, §8.3) */
.map-controls {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  width: 280px; max-width: calc(100% - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.map-controls__head { display: flex; align-items: center; justify-content: space-between; }
.ctrl-group { display: flex; flex-direction: column; gap: 12px; }
.ctrl-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ctrl-row__label { display: flex; align-items: center; gap: 9px; font-size: 0.8125rem; }
.ctrl-row.is-disabled { opacity: 0.4; pointer-events: none; }
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.ctrl-count { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-secondary); }
.ctrl-divider { height: 1px; background: var(--line); }

/* toggle / switch — the one allowed pill (§10) */
.toggle { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--line);
  border: none; cursor: pointer; flex: none; padding: 0; transition: background var(--t) var(--ease); }
.toggle__knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform var(--t) var(--ease); }
.toggle[aria-checked="true"] { background: var(--blue); }
.toggle[aria-checked="true"] .toggle__knob { transform: translateX(16px); }

/* sliders — hairline track, blue fill, mono readout (§11) */
.slider { position: relative; height: 24px; cursor: pointer; touch-action: none; }
.slider.grabbing { cursor: grabbing; }
.slider__track { position: absolute; top: 11px; left: 0; right: 0; height: 2px; background: var(--line); border-radius: 1px; }
.slider__fill { position: absolute; top: 11px; height: 2px; background: var(--blue); border-radius: 1px; }
.slider__tick { position: absolute; top: 8px; width: 1px; height: 8px; background: var(--line); transform: translateX(-0.5px); }
.slider__thumb { position: absolute; top: 5px; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong);
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease); }
.slider__thumb:hover, .slider .slider__thumb--active { box-shadow: 0 0 0 4px rgba(0,113,227,0.16); border-color: var(--blue); }
.slider__thumb:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--blue); }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.slider-head__value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.8125rem; color: var(--ink); }

/* density legend (§8.3) */
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend__item { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--ink-secondary); }
.legend__bar { width: 64px; height: 7px; border-radius: 2px; flex: none; }
.legend__sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend__count { font-family: var(--mono); color: var(--ink); margin-left: auto; }
.legend__hint { color: var(--ink-tertiary); }

/* ============================================================================
   Modal — alerts (§10)
   ============================================================================ */
.modal-scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-scrim[hidden] { display: none; }
.modal { width: 440px; max-width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-float); padding: 24px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal__title { font-size: 1.125rem; font-weight: 600; }
.modal__sub { font-size: 0.875rem; color: var(--ink-secondary); margin-bottom: 20px; }
.modal__form { display: flex; gap: 8px; }
.modal__form .input { flex: 1; }
.modal__form .btn { flex: none; }
/* Stacked variant — for multi-control forms (e.g. feedback: type + message + send). */
.modal__form--stack { flex-direction: column; align-items: stretch; }
.modal__form--stack .btn { align-self: flex-end; }
/* Multi-line text field — the fixed control height doesn't apply to a textarea. */
.input--area { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical;
  line-height: 1.5; }
.modal__msg { min-height: 1.2em; margin-top: 12px; color: var(--ink-secondary); }

/* ============================================================================
   Area picker — a small municipality-selection map in a modal
   ============================================================================ */
.modal--areas { width: 920px; max-width: 100%; }
.areas-body { display: grid; grid-template-columns: 1fr 256px; gap: 16px; align-items: stretch; }
.areamap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-subtle);
  overflow: hidden; min-height: 360px; display: flex; }
#areas-svg { width: 100%; height: auto; max-height: 56vh; display: block; cursor: crosshair; touch-action: none;
  user-select: none; -webkit-user-select: none; }
#areas-svg.can-pan { cursor: grab; }
#areas-svg.panning { cursor: grabbing; }
/* on-map zoom controls (the picker is a small static map; zoom/pan move the viewBox) */
.areamap__zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.mapzoom { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 1rem; line-height: 1; color: var(--ink);
  transition: background var(--t) var(--ease), color var(--t) var(--ease); }
.mapzoom:hover { background: var(--bg-subtle); color: var(--blue); border-color: var(--line-strong); }
/* municipality boundaries: inert land = subtle neutral; towns with listings pop to the
   surface white + become interactive; selected towns fill blue. Dividers use --line;
   non-scaling-stroke + evenodd keep them crisp + hole-correct at any zoom (§2/§7). */
.areatown { fill: var(--area-land); stroke: var(--line); stroke-width: 0.6;
  fill-rule: evenodd; vector-effect: non-scaling-stroke; }
.areatown.is-active { fill: var(--surface); stroke: var(--line-strong); cursor: pointer;
  transition: fill var(--t) var(--ease); }
.areatown.is-active:hover { fill: var(--blue-tint); }
.areatown.is-on, .areatown.is-on:hover { fill: var(--blue); }
.area-msg { fill: var(--ink-tertiary); font-family: var(--font); font-size: 13px; }
.arealabel { font-family: var(--font); fill: var(--blue-ink); text-anchor: middle;
  pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 2.5px; stroke-linejoin: round;
  vector-effect: non-scaling-stroke; }
.areas-rubber { fill: var(--blue-tint); fill-opacity: 0.5; stroke: var(--blue); stroke-width: 1; stroke-dasharray: 4 3; }
.areas-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.areas-list { border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto;
  max-height: 52vh; flex: 1; background: var(--surface); }
.arearow { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left;
  cursor: pointer; font: inherit; color: var(--ink); transition: background var(--t) var(--ease); }
.arearow:last-child { border-bottom: 0; }
.arearow:hover { background: var(--bg-subtle); }
.arearow__check { position: relative; width: 14px; height: 14px; border: 1px solid var(--line-strong);
  border-radius: 3px; flex: none; }
.arearow.is-on .arearow__check { background: var(--blue); border-color: var(--blue); }
.arearow.is-on .arearow__check::after { content: "✓"; position: absolute; top: -2px; left: 1.5px;
  font-size: 10px; line-height: 1; color: #fff; }
.arearow__name { flex: 1; font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arearow__count { font-size: 0.75rem; color: var(--ink-secondary); }
.arearow--empty { color: var(--ink-tertiary); cursor: default; justify-content: center; }
.areas-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.areas-foot__spacer { flex: 1; }
.areas-count { font-size: 0.8125rem; color: var(--ink-secondary); }

/* active-area filter bar — removable chips under a toolbar */
.areabar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 16px; }
.areabar[hidden] { display: none; }
.areachip { display: inline-flex; align-items: center; gap: 2px; font-size: 0.75rem; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px 4px 2px 8px; background: var(--surface); }
.areachip__x { border: 0; background: transparent; color: var(--ink-tertiary); cursor: pointer;
  font-size: 0.9375rem; line-height: 1; padding: 0 3px; border-radius: var(--radius-sm); }
.areachip__x:hover { color: var(--ink); }
.areachip--clear { cursor: pointer; color: var(--ink-secondary); padding: 2px 8px;
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease); }
.areachip--clear:hover { color: var(--blue); border-color: var(--blue); }

/* ============================================================================
   UX-A.1 — unified Listings filter bar: quick-toggles + "+ Filter" menu + chips.
   The one interaction nuance (DESIGN.md): a quick-TOGGLE is an active control, so
   it goes BLUE when ON; a CHIP reflects state, so it stays NEUTRAL. Never mix them.
   ========================================================================== */
/* Quick-toggle — toolbar filter shortcut (New / ★Starred / Top picks). */
.qtoggle { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); font-family: var(--font); font-size: 0.8125rem; font-weight: 500; color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease); }
.qtoggle:hover { background: var(--bg-subtle); }
.qtoggle[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-ink); }
.qtoggle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--blue); }

/* "+ Filter" grouped popover menu. */
.filtermenu { position: relative; display: inline-flex; }
.filtermenu__caret { font-size: 0.75rem; color: var(--ink-secondary); }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: 340px; max-width: 92vw;
  max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); }
.menu[hidden] { display: none; }
.menu__grp { padding: 10px 12px 12px; }
.menu__grp + .menu__grp { border-top: 1px solid var(--line); }
.menu__grphead { margin-bottom: 8px; }
.label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-secondary); }
.menu__empty { font-style: italic; }
.opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.opts--score { gap: 10px 14px; }
.opt { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--ink); cursor: pointer; }
.opt--inline { gap: 6px; }
.opt__cb { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }
.opt__cb:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
/* Sort control (UX-A.2): a narrower popover; sort fields stack as radios. */
.menu--sort { width: 220px; }
.opts--sort { flex-direction: column; align-items: stretch; gap: 4px; }
.opts--sort .opt { padding: 3px 2px; }
.opt__radio { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.opt__radio:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.pill-sel { height: 28px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 10px;
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface); color: var(--ink);
  font-family: var(--font); font-size: 0.8125rem; cursor: pointer;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease); }
.pill-sel:hover { background: var(--bg-subtle); }
.menu__select { height: 28px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  color: var(--ink); font-family: var(--font); font-size: 0.8125rem; padding: 0 6px; cursor: pointer; }
.rangebox { height: 28px; width: 56px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 0.8125rem; padding: 0 8px; }
.pill-sel:focus-visible, .menu__select:focus-visible, .rangebox:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--blue); }
.anno { color: var(--ink-tertiary); font-size: 0.75rem; }

/* Active-filter chips — neutral state summary, with a per-chip × and a Clear-all. */
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -6px 0 16px; min-height: 26px; }
.chips[hidden] { display: none; }
.chips__lead { font-size: 0.75rem; color: var(--ink-tertiary); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-subtle); font-size: 0.75rem; color: var(--ink); }
.chip__x { border: 0; background: transparent; color: var(--ink-secondary); cursor: pointer; line-height: 1;
  font-size: 0.9375rem; width: 18px; height: 18px; border-radius: 3px; display: grid; place-items: center; }
.chip__x:hover { background: var(--line); color: var(--ink); }
.chips__clear { border: 0; background: transparent; font-family: var(--font); font-size: 0.75rem; color: var(--blue); cursor: pointer; padding: 2px 4px; }
.chips__clear:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .areas-body { grid-template-columns: 1fr; }
}

/* ============================================================================
   Property detail drawer — docks from the right (§5.1, §9)
   ============================================================================ */
.drawer-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 80; opacity: 0;
  pointer-events: none; transition: opacity var(--t) var(--ease); }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 440px; max-width: 92vw; z-index: 81;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-float);
  transform: translateX(100%); transition: transform 0.15s var(--ease); overflow-y: auto; padding: 28px; }
.drawer.open { transform: none; }
.drawer__close { position: absolute; top: 18px; right: 18px; }
.drawer .eyebrow { margin-bottom: 6px; }
.drawer h3 { font-size: 1.125rem; font-weight: 600; }
.drawer dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 20px; margin: 20px 0; }
.drawer dt { color: var(--ink-secondary); font-size: 0.8125rem; }
.drawer dd { margin: 0; text-align: right; font-size: 0.8125rem; }
.drawer dd.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.drawer__listing { border-top: 1px solid var(--line); padding: 14px 0; }
.drawer__listing-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }

/* ============================================================================
   Login — pre-auth screen, outside the app shell (§5.7)
   One bordered card on a pure-white field; wordmark-only branding; one blue
   button; honest, calm validation. No map, texture, gradient, or imagery.
   ============================================================================ */
body.login { overflow: auto; background: var(--bg); }   /* not the app shell — page may scroll if short */
.login__stage {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center;
  /* sit a touch above optical center (§5.7): more space below than above */
  justify-content: center;
  padding: 8vh 24px 14vh;
}
.login-card {
  width: 380px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; display: flex; flex-direction: column; gap: 20px;
  /* no shadow — it isn't floating (§5.7, §6) */
}
.login-card__brand { display: flex; align-items: baseline; gap: 8px; justify-content: center; margin-bottom: 4px; }
.login-card__name { font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }

/* quiet company attribution beneath the card — the only copy on this screen (§5.7) */
.login__attrib {
  margin-top: 18px; text-align: center;
  font-size: 0.75rem; letter-spacing: 0.04em; color: var(--ink-secondary);
}
.login__attrib strong { font-weight: 600; color: var(--ink); }

/* fields (§10) — label in the compact/label style, bordered input, blue focus ring */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-secondary);
}
.login-card .input { height: 40px; }            /* prominent form input (§4/§10) */
.field__wrap { position: relative; }
.field__wrap .input { padding-right: 40px; }    /* room for the reveal toggle */

/* show-password toggle — icon-only, inside the field (§5.7) */
.field__reveal {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: transparent; cursor: pointer;
  color: var(--ink-tertiary); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.field__reveal:hover { color: var(--ink-secondary); background: var(--bg-subtle); }
.field__reveal[aria-pressed="true"] { color: var(--blue); }

/* remember / forgot row (§5.7) */
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 0.8125rem; color: var(--ink-secondary); user-select: none; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.login-forgot { font-size: 0.8125rem; color: var(--blue); }

/* the one blue button on the page — full card width (§5.7) */
.login-submit { width: 100%; height: 40px; position: relative; }
.login-submit:disabled { background: var(--blue); color: #fff; opacity: 0.6; cursor: progress; }
.login-submit.is-loading .login-submit__label { opacity: 0.85; }

/* honest, calm validation message — error fades in ≤150ms, never harsh (§5.7, §2) */
.login-msg {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.8125rem; line-height: 1.4; border-radius: var(--radius-sm);
  padding: 8px 10px; margin: -4px 0; opacity: 0; transition: opacity 0.15s var(--ease);
}
.login-msg:not([hidden]) { opacity: 1; }
.login-msg::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 1px;
  background: currentColor; -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.login-msg--error { color: var(--error); background: var(--error-tint);
  /* circle-alert glyph (icon + text, never color alone §2) */ }
.login-msg--error::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E");
}
.login-msg--info { color: var(--ink-secondary); background: var(--bg-subtle); }
.login-msg--info::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}

/* inline button spinner — progress, not flourish (§9); reduced-motion stills it */
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff; animation: spin 0.6s linear infinite; margin-left: 8px; }
.login-submit__label + .spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 420px) {
  .login-card { padding: 24px; }
  .login__stage { padding: 6vh 16px 10vh; }
}

/* ============================================================================
   Account menu — the signed-in user, preferences, admin, sign out (§5.1)
   A quiet trigger in the top nav opens a small floating menu (§6 shadow). The
   menu carries Preferences (everyone) and Admin (admins only) + Sign out.
   ============================================================================ */
.account { position: relative; display: inline-flex; }
.account__trigger { display: inline-flex; align-items: center; gap: 7px; height: var(--ctrl-h);
  padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--ink); cursor: pointer; font: inherit; font-size: 0.8125rem;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease); }
.account__trigger:hover { background: var(--bg-subtle); border-color: var(--line-strong); }
.account__trigger .account__user { font-size: 0.8125rem; color: var(--ink); }
.account__chev { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 4px solid var(--ink-tertiary); margin-left: 2px; }
.account__menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; z-index: 70;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-float); padding: 6px; }
.account__menu[hidden] { display: none; }
.account__who { padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account__who-name { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--ink); }
.account__who-role { display: block; font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-secondary); margin-top: 2px; }
.menu__item { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 8px; border: 0;
  background: transparent; border-radius: var(--radius-sm); font: inherit; font-size: 0.8125rem; color: var(--ink);
  text-align: left; cursor: pointer; transition: background var(--t) var(--ease); }
.menu__item:hover { background: var(--hover); }
.menu__item[hidden] { display: none; }

/* ============================================================================
   Preferences modal — per-user theme, defaults, saved views, email opt-in (§10)
   ============================================================================ */
.modal--prefs { width: 480px; }
.prefs__section { padding: 16px 0; border-top: 1px solid var(--line); }
.prefs__section:first-of-type { border-top: 0; padding-top: 0; }
.prefs__label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-secondary); margin-bottom: 4px; }
.prefs__hint { font-size: 0.8125rem; color: var(--ink-secondary); margin-bottom: 12px; }
.prefs__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.prefs__actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.prefs__btn { height: var(--ctrl-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: 0.8125rem;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease); }
.prefs__btn:hover { background: var(--bg-subtle); border-color: var(--line-strong); color: var(--blue); }
.prefs__current { font-size: 0.8125rem; color: var(--ink-secondary); margin-top: 8px; }
.prefs__current .mono { color: var(--ink); }
/* saved views — a small list of named filter snapshots */
.savedviews { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.savedview { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); }
.savedview__name { flex: 1; font-size: 0.8125rem; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.savedview__apply, .savedview__del { border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: 0.8125rem; padding: 2px 6px; border-radius: var(--radius-sm); }
.savedview__apply { color: var(--blue); }
.savedview__apply:hover { background: var(--blue-tint); }
.savedview__del { color: var(--ink-tertiary); }
.savedview__del:hover { color: var(--error); background: var(--error-tint); }
.savedviews__empty { font-size: 0.8125rem; color: var(--ink-tertiary); margin-top: 8px; }

/* ============================================================================
   Admin panel — approve signups + manage accounts (§10; file-backed §15)
   ============================================================================ */
.modal--admin { width: 620px; }
.admin__group { padding: 12px 0; border-top: 1px solid var(--line); }
.admin__group:first-of-type { border-top: 0; }
.admin__grouptitle { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-secondary); margin-bottom: 8px; }
.admin__empty { font-size: 0.8125rem; color: var(--ink-tertiary); }
.userrow { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 6px; }
.userrow__id { flex: 1; min-width: 0; }
.userrow__name { font-size: 0.875rem; font-weight: 500; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.userrow__meta { font-size: 0.75rem; color: var(--ink-secondary); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.userrow__meta .mono { color: var(--ink-secondary); }
.userrow__badges { display: inline-flex; gap: 4px; flex: none; }
.userrow__actions { display: inline-flex; gap: 6px; flex: none; }
.userbadge { font-size: 0.6875rem; font-weight: 500; padding: 1px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); color: var(--ink-secondary); }
.userbadge--admin { color: var(--blue-ink); border-color: var(--blue); background: var(--blue-tint); }
.userbadge--pending { color: var(--warning); border-color: var(--warning); background: var(--warning-tint); }
.userbadge--disabled { color: var(--ink-tertiary); }
.userbadge--active { color: var(--success); border-color: var(--success); background: var(--success-tint); }
.userbadge--analyst { color: var(--ink); border-color: var(--line-strong); font-weight: 600; }
.ubtn { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: 0.75rem;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease); }
.ubtn:hover { background: var(--bg-subtle); border-color: var(--line-strong); }
.ubtn--primary { border-color: var(--blue); color: var(--blue); }
.ubtn--primary:hover { background: var(--blue-tint); }
.ubtn--danger:hover { color: var(--error); border-color: var(--error); background: var(--error-tint); }
.ubtn:disabled { color: var(--ink-tertiary); cursor: default; background: var(--bg-subtle); }
.admin__msg { min-height: 1.2em; margin-top: 12px; font-size: 0.8125rem; color: var(--ink-secondary); }

/* ============================================================================
   Login — "Request access" (signup) panel toggled in/out of the sign-in card
   ============================================================================ */
.login-alt { margin-top: 16px; text-align: center; font-size: 0.8125rem; color: var(--ink-secondary); }
.login-altlink { color: var(--blue); cursor: pointer; background: 0; border: 0; font: inherit; padding: 0; }
.login-altlink:hover { text-decoration: underline; }
.login-card[data-mode="signup"] .login-signin-only { display: none; }
.login-card:not([data-mode="signup"]) .login-signup-only { display: none; }

/* ---- reduced motion (§9) ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .spinner { animation: none; border-top-color: rgba(255,255,255,0.9); }
}

/* ---- responsive: desktop-first, must not break on a laptop (§5.6) -------- */
@media (max-width: 1080px) {
  .dash-body { flex-direction: column; }
  .recent { width: auto; }
  .acc.is-open .acc__body .recent__list { max-height: 280px; }
}
@media (max-width: 760px) {
  :root { --pad: 16px; }
  .appbar__inner { gap: 12px; }
  .viewswitch button { padding: 0 8px; }
  .freshness { display: none; }
  .input--search { width: 100%; }
  .map-controls { position: static; width: auto; max-width: none; margin: 12px; box-shadow: none; }
  .drawer { width: 100%; }
}
