/* Milagro Metrics — light, left-rail layout */
:root {
  --ink: #111A17;
  --ink-2: #2D3834;
  --muted: #42504B;
  --subtle: #5B6763;
  --ground: #F5F7F6;
  --panel: #FFFFFF;
  --line: #E1E6E4;
  --line-2: #EEF1F0;
  --field: #C9D2CF;
  --accent: #0B7A61;
  --accent-ink: #075A47;
  --accent-soft: #EAF3EF;
  --land: #2D63C8;
  --cost: #D99A1E;
  --pass-bg: #DDF1E8; --pass-fg: #0B5F4B;
  --risk-bg: #FBF0DA; --risk-fg: #7E5200;
  --unk-bg: #F0F3F2; --unk-fg: #42504B;
  --todo-bg: #E8EEF9; --todo-fg: #1F4F8F;
  --loss-bg: #F8E1DC; --loss-fg: #8E2A1E;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  /* spacing, radius, elevation (use in new code) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(17,26,23,.12);
  --shadow-2: 0 4px 16px rgba(17,26,23,.12);
  --field-line: #D5DDDA; --soft: #F0F3F2; --accent-faint: #F1F9F5; --bar-muted: #9FB0AB; --ink-hover: #24302C; --gold: #E7C277;
  --user-bg: var(--accent-soft); --user-fg: var(--accent-ink);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 15px; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; text-wrap: balance; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.rail { width: 248px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: 11px; color: var(--subtle); letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.nav a.active { background: var(--accent-soft); color: var(--ink); font-weight: 700; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle); }
.tree-block { display: flex; flex-direction: column; gap: 8px; }
.tree-block .eyebrow { padding: 0 10px; }
.tree-block input { font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--field-line); background: var(--ground); color: var(--ink); margin: 0 4px; }
.tree { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.tree .state { display: flex; justify-content: space-between; padding: 8px 10px 4px; font-weight: 700; color: var(--ink); text-decoration: none; border-radius: 6px; }
.tree .county { display: block; padding: 6px 10px 2px 18px; font-size: 12px; color: var(--subtle); text-decoration: none; border-radius: 6px; }
.tree a.county:hover { color: var(--ink); }
.tree .county.active { background: var(--ink); color: #fff; }
.tree .city { display: flex; justify-content: space-between; padding: 6px 10px 6px 26px; color: var(--ink); text-decoration: none; border-radius: 6px; }
.tree .city.empty { color: var(--subtle); }
.tree .count { font-family: var(--mono); color: var(--subtle); }
.tree .active { background: var(--ink); color: #fff; }
.tree .active .count { color: #fff; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.crumbs { flex: 1 1 auto; font-size: 13px; color: var(--subtle); }
.crumbs a { color: var(--subtle); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .here { color: var(--ink); font-weight: 600; }
#search { font: inherit; font-size: 13px; width: 260px; max-width: 100%; padding: 9px 12px; border-radius: 7px; border: 1px solid var(--field-line); background: var(--ground); color: var(--ink); }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); display: grid; place-items: center; color: var(--ink); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.menu-btn { display: none; }

#view { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; outline: none; }
.loading, .empty-state { color: var(--subtle); padding: 24px 0; }

/* Buttons, tags */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 7px; border: 1px solid var(--field); background: var(--panel); color: var(--ink); text-decoration: none; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; min-height: 38px; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.btn-dark:hover { background: var(--ink-hover); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }
.tag { display: inline-block; flex: none; align-self: start; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 7px; border-radius: 4px; white-space: nowrap; }
.tag.pass { background: var(--pass-bg); color: var(--pass-fg); }
.tag.risk { background: var(--risk-bg); color: var(--risk-fg); }
.tag.unknown { background: var(--unk-bg); color: var(--unk-fg); }
.tag.todo { background: var(--todo-bg); color: var(--todo-fg); }
.tag.user { background: var(--user-bg); color: var(--user-fg); box-shadow: inset 0 0 0 1px var(--accent); }
.tag.loss { background: var(--loss-bg); color: var(--loss-fg); }
.tag.lg { font-size: 11px; padding: 4px 8px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.chip.unknown { background: transparent; border: 1px dashed #A9B5B1; color: var(--muted); }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head .title-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.page-head h1 { font-size: 34px; font-weight: 700; letter-spacing: -.015em; line-height: 1.1; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; max-width: 80ch; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.meta-row .mono { font-size: 12px; color: var(--subtle); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kpi { background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); font-weight: 600; }
.kpi .value { font-family: var(--mono); font-size: 23px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi .value.good { color: var(--accent); }
.kpi .value.bad { color: var(--loss-fg); }
.kpi .sub { font-size: 12px; color: var(--subtle); }

/* Panels */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 700; }
.panel-head .note, .note { font-size: 12px; color: var(--subtle); }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-2); font-size: 13px; align-items: start; }
.row .name { font-weight: 600; }
.row .detail { color: var(--subtle); font-size: 12px; }
.row.kv { grid-template-columns: 150px minmax(0, 1fr) auto; }
.row.kv .k { color: var(--subtle); }
.row.split { grid-template-columns: minmax(0, 1fr) auto; }

/* Scenario switch */
.scenario-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; background: var(--soft); border-radius: 8px; padding: 3px; }
.segmented button { font: inherit; font-size: 13px; font-weight: 500; padding: 7px 12px; min-height: 36px; border: 0; border-radius: 6px; cursor: pointer; background: transparent; color: var(--muted); }
.segmented button[aria-checked="true"] { background: var(--panel); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(17,26,23,.12); }

/* Strategy cards */
.strategies { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.strategy { border: 1px dashed var(--field); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.strategy.on { border: 1px solid var(--accent); background: var(--accent-faint); }
.strategy .s-name { font-weight: 700; font-size: 14px; }
.strategy .s-value { font-family: var(--mono); font-size: 21px; }
.strategy.on .s-value { color: var(--accent); }
.strategy:not(.on) .s-name { color: var(--muted); }
.strategy:not(.on) .s-value { color: #8A9692; }
.strategy .s-sub { font-size: 12px; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); font-weight: 700; padding: 9px 10px; white-space: nowrap; }
table.data td { padding: 10px; border-top: 1px solid var(--line-2); }
table.data .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data a { font-weight: 700; }

/* Sensitivity grid */
table.grid { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 380px; font-size: 14px; }
table.grid th { font-size: 12px; color: var(--subtle); font-weight: 700; padding: 4px; }
table.grid th.rowhead { text-align: left; font-size: 13px; color: var(--muted); }
table.grid th.rowhead.sel { color: var(--ink); }
table.grid td { text-align: center; font-family: var(--mono); padding: 12px 6px; border-radius: 6px; }
table.grid td.sel { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 70px; gap: 12px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--cost); }
.bar-fill.land { background: var(--land); }
.bar-fill.subject { background: var(--ink); }
.bar-fill.comp { background: var(--bar-muted); }
.bar-row .val { font-family: var(--mono); text-align: right; }
.est { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: var(--soft); color: var(--subtle); margin-left: 4px; }

/* Timeline */
.gantt { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; align-items: center; font-size: 13px; }
.gantt .scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--subtle); }
.gantt .lane { position: relative; height: 18px; background: repeating-linear-gradient(90deg, var(--line-2) 0, var(--line-2) 1px, transparent 1px, transparent 25%); }
.gantt .seg { position: absolute; top: 3px; height: 12px; border-radius: 3px; }

/* Scorecard */
.score-bar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; gap: 2px; }
.score-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 0 18px; }
.score-grid .row { font-size: 12px; }

/* Map and site plan */
.map { height: 380px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.map-placeholder { height: 260px; border-radius: 8px; border: 1px dashed #B8C2BF; background-color: #F2F5F4; background-image: linear-gradient(#E6ECEA 1px, transparent 1px), linear-gradient(90deg, #E6ECEA 1px, transparent 1px); background-size: 28px 28px; display: grid; place-items: center; padding: 20px; }
.map-placeholder .card { display: flex; flex-direction: column; gap: 8px; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; text-align: center; align-items: center; }
.map-toggle { display: flex; gap: 4px; }
.siteplan svg { width: 100%; height: auto; max-height: 420px; display: block; }
.facts4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: 12px; }
.facts4 div { display: flex; flex-direction: column; gap: 2px; }
.facts4 span:first-child { color: var(--subtle); }
.facts4 span:last-child { font-family: var(--mono); }
.message { font-size: 13px; padding: 10px 12px; border-radius: 7px; }
.message.ok { background: var(--pass-bg); color: var(--pass-fg); }
.message.err { background: var(--loss-bg); color: var(--loss-fg); }

/* Market stats */
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats3 > div { background: var(--ground); border-radius: 8px; padding: 12px; }
.stats3 .s-label { font-size: 12px; color: var(--subtle); }
.stats3 .s-value { font-family: var(--mono); font-size: 18px; }
.warn { font-size: 12px; color: var(--risk-fg); font-weight: 600; }

/* City sections (locations page) */
.city-section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.city-head { padding: 16px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; border-bottom: 1px solid var(--line); }
.city-head .names { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; }
.city-head .names span { font-size: 12px; color: var(--subtle); }
.city-head h2 { font-size: 20px; }
.city-head .chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 2 1 420px; justify-content: flex-end; }
.city-section table.data th:first-child, .city-section table.data td:first-child { padding-left: 18px; }
.city-section table.data thead { background: #FAFBFB; }
.city-empty { padding: 16px 18px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

/* Forms */
form.panel label.f { font-size: 13px; font-weight: 700; }
form.panel .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
form.panel input[type=text], form.panel input[type=url], form.panel textarea, form.panel select { font: inherit; font-size: 14px; padding: 11px 12px; border: 1px solid var(--field); border-radius: 7px; background: var(--panel); color: var(--ink); }
form.panel fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
form.panel legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
form.panel .check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; min-height: 28px; }
form.panel .check input { width: 18px; height: 18px; margin: 1px 0 0; }
.fields-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.optional { font-weight: 500; color: var(--subtle); }
.error-text { color: var(--loss-fg); font-size: 13px; }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.step.last { background: var(--ink); color: #fff; border-color: var(--ink); }
.step .num { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.step.last .num { color: #8FD3BC; }
.step .t { font-weight: 700; font-size: 17px; }
.step .d { font-size: 13px; color: var(--muted); line-height: 1.45; }
.step.last .d { color: #D8E0DD; }

/* Phone */
@media (max-width: 900px) {
  .rail { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .rail.open { transform: none; }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 14px; }
  #search { order: 5; width: 100%; }
  #view { padding: 16px 14px 40px; }
  .page-head h1 { font-size: 26px; }
  .row.kv { grid-template-columns: 110px minmax(0, 1fr) auto; }
  .bar-row { grid-template-columns: 120px minmax(0, 1fr) 60px; }
  .gantt { grid-template-columns: 110px minmax(0, 1fr); }
  .facts4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats3 { grid-template-columns: 1fr; }
}
/* Generic helpers */
.plain-link { color: inherit; text-decoration: none; }
.plain-link:hover { color: var(--accent-ink); text-decoration: underline; }
.src-link { font-size: 12px; font-weight: 700; text-decoration: none; }
.tab-body { display: flex; flex-direction: column; gap: 18px; outline: none; }

/* Tabs (role=tablist) styled like .segmented */
.tabs { display: flex; gap: var(--sp-1); background: var(--unk-bg); border-radius: var(--r-md); padding: 3px; align-self: flex-start; max-width: 100%; overflow-x: auto; }
.tab { font: inherit; font-size: 13px; font-weight: 500; padding: 7px var(--sp-4); min-height: 36px; display: inline-flex; align-items: center; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--panel); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-1); }

/* Estimates tab */
.est-intro { margin: 0; max-width: 90ch; }
.est-rows { display: flex; flex-direction: column; }
.est-group .panel-head { border-bottom: 1px solid var(--line); padding-bottom: var(--sp-3); margin-bottom: 0; }
.est-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(110px, auto) minmax(0, 1.6fr) 36px; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--line-2); align-items: center; font-size: 13px; }
.est-rows > .est-row:first-child { border-top: 0; }
.est-label { font-weight: 700; font-size: 14px; display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.est-source { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.est-badge { font-size: 12px; color: var(--muted); background: var(--unk-bg); border-radius: var(--r-pill); padding: 2px 10px; white-space: nowrap; }
.est-badge.here { background: var(--ink); color: #fff; font-weight: 600; }
.est-badge.none { background: transparent; border: 1px dashed #A9B5B1; }
.est-srclink { font-size: 12px; }
.est-value { font-size: 15px; font-weight: 500; text-align: right; white-space: nowrap; }
.est-note { color: var(--ink-2); font-size: 12px; font-weight: 400; }
.est-flag { color: var(--risk-fg); background: var(--risk-bg); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; padding: 3px 8px; align-self: flex-start; }
.est-edit { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.est-edit:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-faint); }
.est-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.est-edit svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.est-ro { font-size: 11px; text-align: center; }
.est-editor-slot { grid-column: 1 / -1; }
.est-editor-slot:empty { display: none; }
.est-editor { display: flex; flex-direction: column; gap: var(--sp-3); background: var(--ground); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); box-shadow: var(--shadow-1); }
.est-inputs { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.est-in-range { display: none; gap: var(--sp-3); flex-wrap: wrap; }
.est-editor[data-mode="range"] .est-in-range { display: flex; }
.est-editor[data-mode="range"] .est-in-value { display: none; }
.est-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; }
.est-field .optional { font-weight: 400; color: var(--subtle); }
.est-field input, .est-field textarea { font: inherit; font-size: 14px; font-weight: 400; padding: 9px 12px; border: 1px solid var(--field); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); }
.est-field input:focus, .est-field textarea:focus, .area-picker select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.est-field input[type=number] { width: 160px; font-family: var(--mono); }
.est-field textarea { width: 100%; resize: vertical; box-sizing: border-box; }
.est-mode { align-self: flex-start; }
.est-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; }
.tag.nosrc { background: var(--unk-bg); color: var(--subtle); }
a.tag-link { text-decoration: none; }
a.tag-link:hover { text-decoration: underline; }
/* Settings page: area picker */
.area-picker { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4); }
.picker-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 160px; flex: 1 1 160px; max-width: 260px; }
.area-picker select { font: inherit; font-size: 14px; font-weight: 500; padding: 9px 12px; border: 1px solid var(--field); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); min-height: 40px; }
.area-picker select:disabled { background: var(--soft); color: var(--subtle); }
.picker-sep { color: var(--subtle); padding-bottom: 10px; font-size: 18px; }
.picker-link { margin-left: auto; font-size: 13px; padding-bottom: 10px; }
.nav-foot { margin-top: auto; padding-bottom: var(--sp-2); }
.nav-foot + .rail-user { margin-top: 0; }
.est-errors:empty { display: none; }

/* Phone refinements (~600px) */
@media (max-width: 600px) {
  body { font-size: 14px; }
  #view { padding: var(--sp-4) 12px 32px; gap: var(--sp-4); }
  .topbar { gap: var(--sp-2); }
  .topbar .btn-dark { padding: 8px 10px; }
  .page-head h1 { font-size: 24px; }
  .panel { padding: var(--sp-4) 14px; }
  .kpi { padding: var(--sp-3); }
  .kpi .value { font-size: 20px; }
  .city-head { padding: var(--sp-3) 14px; }
  .city-head .chips { justify-content: flex-start; }
  .row.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .row.kv > :last-child:not(:first-child) { justify-self: start; }
  .tabs { align-self: stretch; }
  .tab { flex: 1; justify-content: center; }
  .est-row { grid-template-columns: minmax(0, 1fr) auto; }
  .est-source { grid-column: 1 / -1; }
  .picker-sep { display: none; }
  .picker-field { max-width: none; }
  .est-edit, .est-edit-spacer, .est-ro, .est-editor-slot { display: none; }
  .est-value { font-size: 14px; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr) 54px; gap: var(--sp-2); }
  .gantt { grid-template-columns: 90px minmax(0, 1fr); }
  .scenario-bar { padding: var(--sp-2) var(--sp-3); }
}

/* How it works */
.hw-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.hw-step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--sp-4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); }
.hw-num { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--r-pill); width: 32px; height: 32px; display: grid; place-items: center; }
.hw-body { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.hw-body h3 { font-size: 16px; font-weight: 700; }
.hw-body p { font-size: 14px; color: var(--muted); line-height: 1.5; margin: 0; max-width: 70ch; }
.hw-body p.note { font-size: 12px; color: var(--subtle); }
.hw-link { font-size: 13px; font-weight: 600; color: var(--accent-ink); text-decoration: none; align-self: flex-start; }
.hw-link:hover { text-decoration: underline; }
.hw-bar { display: flex; height: 26px; border-radius: var(--r-sm); overflow: hidden; background: var(--unk-bg); gap: 2px; }
.hw-seg { min-width: 3px; }
.hw-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); font-size: 12px; color: var(--muted); }
.hw-legend li { display: inline-flex; align-items: center; gap: 6px; }
.hw-legend strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.hw-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.seg-streets { background: #7B8A85; }
.seg-open { background: #9CC9B3; }
.seg-detention { background: var(--land); }
.seg-net { background: var(--accent); }
.seg-a { background: var(--land); }
.seg-b { background: #9CC9B3; }
.seg-c { background: var(--cost); }
.seg-d { background: #7B8A85; }
.hw-math { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.hw-math > div { background: var(--panel); padding: var(--sp-3); display: flex; flex-direction: column; gap: 2px; }
.hw-math span { font-size: 11px; color: var(--subtle); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.hw-math strong { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.hw-bullets { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.hw-bullets strong { color: var(--ink); }
.hw-marks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: var(--sp-2) var(--sp-4); }
.hw-marks > div { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; color: var(--muted); }
.hw-marks .tag { min-width: 72px; text-align: center; }
.hw-status-head { margin-top: var(--sp-4); }
.hw-h2 { font-size: 22px; font-weight: 700; }
.hw-status { display: flex; flex-direction: column; gap: var(--sp-4); }
.hw-last { margin: 0; }
.hw-empty { margin: 0; }
.hw-table-wrap { overflow-x: auto; }
.hw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hw-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); font-weight: 600; padding: 6px var(--sp-3) 6px 0; }
.hw-table td { padding: 8px var(--sp-3) 8px 0; border-top: 1px solid var(--line-2); white-space: nowrap; }
.hw-table .r { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .hw-step { grid-template-columns: minmax(0, 1fr); padding: var(--sp-4) 14px; gap: var(--sp-2); }
  .hw-h2 { font-size: 19px; }
  .hw-bar { height: 22px; }
}

@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* Sign in */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.login-brand { justify-content: center; }
.login-card { gap: 14px; padding: 24px; }
.login-card h1 { font-size: 22px; }
.login-card .field { display: flex; flex-direction: column; gap: 6px; }
.login-card label.f { font-size: 13px; font-weight: 700; }
.login-card input { font: inherit; font-size: 15px; padding: 11px 12px; border: 1px solid var(--field); border-radius: 7px; background: var(--panel); color: var(--ink); }
.login-btn { justify-content: center; min-height: 44px; font-size: 14px; }
.login-wrap > .note { text-align: center; }
.rail-user { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.rail-user .who { display: flex; flex-direction: column; min-width: 0; }
.rail-user .who strong { overflow: hidden; text-overflow: ellipsis; }
.rail-user button { font: inherit; font-size: 12px; font-weight: 600; background: none; border: 1px solid var(--field); border-radius: 6px; padding: 6px 10px; cursor: pointer; color: var(--ink); min-height: 32px; }
.rail-user button:hover { border-color: var(--ink); }

/* Map-first Locations (#/locations): the map fills the content area under the topbar */
body.map-route .main-col { height: 100vh; height: 100dvh; }
body.map-route #view { padding: 0; gap: 0; flex: 1; min-height: 0; overflow: hidden; }
.mv { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px minmax(0, 1fr); }
.mv-panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 2; }
.mv-handle { display: none; }
.mv-cardhost { display: none; }
.mv-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); }
.mv-top { display: flex; gap: var(--sp-2); }
#mv-q { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 10px 12px; border-radius: 7px; border: 1px solid var(--field); background: var(--ground); color: var(--ink); }
.mv-filter-btn { display: none; }
.mv-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); }
.mv-filters { display: flex; flex-direction: column; gap: var(--sp-3); }
.mv-group { display: flex; flex-direction: column; gap: 6px; }
.mv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mv-chip { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; padding: 5px 11px; min-height: 30px; border-radius: var(--r-pill); border: 1px solid var(--field); background: var(--panel); color: var(--ink-2); cursor: pointer; }
.mv-chip:hover { border-color: var(--ink); }
.mv-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.mv-clear { align-self: flex-start; font: inherit; font-size: 12px; font-weight: 600; background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; text-decoration: underline; }
.mv-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px var(--field); }
.mv-dot.good { background: var(--pass-fg); }
.mv-dot.conditional { background: var(--risk-fg); }
.mv-dot.poor { background: var(--loss-fg); }
.mv-dot.unknown { background: var(--unk-fg); }
.mv-chip[aria-pressed="true"] .mv-dot { box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 2.5px #fff; }
.mv-area { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line-2); }
.mv-crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--sp-2); font-size: 13px; }
.mv-trail { flex: 1 1 auto; min-width: 0; color: var(--subtle); }
.mv-trail a { color: var(--subtle); text-decoration: none; }
.mv-trail a:hover { color: var(--ink); text-decoration: underline; }
.mv-trail .here { color: var(--ink); font-weight: 700; }
.mv-areapage { font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.mv-children { display: flex; flex-direction: column; }
.mv-child { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13px; }
.mv-child:hover { background: var(--accent-soft); }
.mv-child .count { font-family: var(--mono); color: var(--subtle); }
.mv-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.mv-kpis > div { background: var(--panel); padding: 8px 12px; display: flex; align-items: baseline; gap: 8px; }
.mv-kpis .v { font-family: var(--mono); font-size: 18px; }
.mv-kpis .l { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--subtle); font-weight: 600; }
.mv-listhead { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.mv-all { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }
.mv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.mv-item { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.mv-item:hover { border-color: var(--field); }
.mv-item.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.mv-item-main { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.mv-item-main .mv-dot { margin-top: 5px; }
.mv-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.mv-item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 20px; }
.mv-open { margin-left: auto; font-size: 12px; font-weight: 700; text-decoration: none; }
.mv-empty { font-size: 13px; color: var(--subtle); padding: 8px 0; }
.mv-offgroup { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line-2); }
.mv-mapwrap { position: relative; z-index: 0; min-width: 0; min-height: 0; }
.mv-map { position: absolute; inset: 0; background: #E6ECEA; }
.mv-mapui { position: absolute; top: 12px; left: 12px; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); pointer-events: none; }
.mv-mapui > * { pointer-events: auto; box-shadow: var(--shadow-2); }
.mv-basemap { background: var(--panel); }
.mv-basemap button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.mv-legend { position: absolute; left: 12px; bottom: 28px; z-index: 1; box-shadow: var(--shadow-2); display: flex; flex-wrap: wrap; gap: 4px 12px; background: var(--panel); border-radius: var(--r-md); padding: 7px 10px; font-size: 12px; color: var(--ink-2); }
.mv-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mm-popup .maplibregl-popup-content { padding: 12px 14px; border-radius: var(--r-md); font-family: var(--font); box-shadow: var(--shadow-2); }
.pop { display: flex; flex-direction: column; gap: 4px; min-width: 190px; font-size: 13px; }
.pop-title { font-size: 14px; padding-right: 14px; }
.pop-stats { font-size: 12px; color: var(--ink-2); }
.pop-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: 4px; }
.pop-foot a { font-weight: 700; font-size: 12px; }
.pop-card { width: 260px; max-width: 100%; gap: 5px; }
.pop-photo { aspect-ratio: 16 / 10; margin: -12px -14px 4px; background: var(--soft); border-radius: var(--r-md) var(--r-md) 0 0; overflow: hidden; }
.pop-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pop-price { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); line-height: 1.15; }
.pop-facts { display: flex; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.pop-facts span + span::before { content: '|'; margin: 0 8px; color: var(--field); }
.pop-analyze { width: 100%; justify-content: center; margin-top: 4px; }
.pop-queued { margin-top: 4px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--pass-bg); color: var(--pass-fg); font-weight: 700; font-size: 13px; text-align: center; }
.tag.sale { background: transparent; color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mv-dot.sale { background: #fff; box-shadow: 0 0 0 2px var(--accent); width: 8px; height: 8px; margin: 1px; }
.mv-layers { background: var(--panel); }
.mv-layers button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.mv-sale { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line-2); }
.mv-sale:empty { display: none; }
.mv-salehead { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mv-salehead .mv-label { margin-right: auto; }
.mv-scan { font-size: 12px; padding: 5px 10px; min-height: 30px; }
.mv-scan:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 600px) {
  body.map-route #view { padding: 0; }
  .mv { display: block; position: relative; }
  .mv-mapwrap { position: absolute; inset: 0; }
  .mv-panel { position: absolute; left: 0; right: 0; bottom: 0; height: 66%; border: 0; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 16px rgba(17,26,23,.16); z-index: 3; transform: translateY(calc(100% - var(--peek, 52px))); transition: transform .2s ease; display: flex; flex-direction: column; }
  .mv-cardhost:not([hidden]) { display: block; flex: none; position: relative; max-height: 45vh; overflow-y: auto; padding: var(--sp-3) var(--sp-3) 0; border-bottom: 1px solid var(--line-2); }
  .mv-card { position: relative; }
  .mv-card-close { position: absolute; top: 0; right: 0; width: 32px; height: 32px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--ink-2, var(--ink)); cursor: pointer; z-index: 1; }
  .mv.sheet-open .mv-panel { transform: none; }
  .mv:not(.sheet-open) .mv-body { visibility: hidden; }
  .mv-handle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 52px; flex: none; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line-2); font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer; }
  .mv-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--field); }
  .mv-body { padding: var(--sp-3); }
  .mv-filter-btn { display: inline-flex; }
  .mv-filters { display: none; }
  .mv.filters-open .mv-filters { display: flex; }
  .mv-mapui { top: 8px; left: 8px; }
  .mv-legend { display: none; }
  .pop-card { width: min(260px, calc(100vw - 80px)); }
  .pop-photo { aspect-ratio: 2 / 1; }
}
@media (max-width: 900px) and (min-width: 601px) { .mv { grid-template-columns: 300px minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .mv-panel { transition: none; } }

/* Phase 7 polish */
.flush { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.r { text-align: right; }
.empty-quiet { margin: 0; padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--field); border-radius: var(--r-md); background: var(--ground); color: var(--subtle); font-size: 13px; text-align: center; }
.empty-state { text-align: center; border: 1px dashed var(--field); border-radius: var(--r-lg); background: var(--panel); padding: var(--sp-6) var(--sp-4); margin: var(--sp-4) 0; }
.chip.unknown { font-style: italic; }
.row.kv .k { overflow-wrap: anywhere; }
.row.kv > span { min-width: 0; overflow-wrap: anywhere; }
.table-wrap, .hw-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-wrap > table { min-width: 560px; }
.table-wrap > table.cost-table { min-width: 0; }
.panel { min-width: 0; }
.rule-list { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 600px) {
  .hw-step { grid-template-columns: 32px minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-3); }
  .mv-panel .table-wrap > table { min-width: 0; }
}

/* Live updates: toasts, "updated" bar, analyzing strip */
.toast-stack { position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 50; display: flex; flex-direction: column; gap: var(--sp-2); width: min(380px, calc(100vw - 2 * var(--sp-4))); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--sp-3); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); font-size: 13px; color: var(--ink); }
.toast.err { border-left-color: var(--loss-fg); }
.toast-text { flex: 1; min-width: 0; line-height: 1.4; }
.toast-text a { font-weight: 700; }
.toast-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: var(--r-sm); background: none; color: var(--subtle); font-size: 20px; line-height: 1; cursor: pointer; }
.toast-close:hover { background: var(--soft); color: var(--ink); }
.update-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); background: var(--risk-bg); color: var(--risk-fg); border: 1px solid var(--gold); border-radius: var(--r-lg); padding: var(--sp-2) var(--sp-4); font-size: 13px; font-weight: 600; }
.update-bar .btn { min-height: 32px; padding: 5px 12px; }
.mv-analyzing { display: flex; flex-direction: column; gap: var(--sp-2); }
.mv-analyzing[hidden] { display: none; }
.mv-an { display: flex; align-items: center; gap: var(--sp-3); background: var(--accent-faint); border: 1px solid var(--accent); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); font-size: 13px; }
.mv-an-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mv-an-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.mv-an .note { flex: none; font-family: var(--mono); }
.mv-spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: mv-spin 1s linear infinite; }
@keyframes mv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mv-spin { animation: none; } }

/* Property page: comps on the parcel map and in the panels */
.subject-pin { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid #fff; box-shadow: var(--shadow-1); }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); font-size: 12px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px var(--field); }
.lg-dot.subject { background: var(--ink); }
.lg-dot.active { background: var(--accent); }
.lg-dot.sold { background: var(--land); }
.lg-dot.other { background: var(--subtle); }
.lookup-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.comp-link { font-weight: 600; }
.comps-table td:first-child { min-width: 180px; }
.comp-map-btn { min-height: 30px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.sub-head { margin: var(--sp-2) 0 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); font-weight: 700; }

/* Property page sections */
.pg-section { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.sec-head { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--subtle); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); }
.sec-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 1200px) { .grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); } }
.seg-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.cell-good { background: var(--pass-bg); color: var(--pass-fg); }
.cell-mid { background: var(--risk-bg); color: var(--risk-fg); }
.cell-bad { background: var(--loss-bg); color: var(--loss-fg); }
.cost-table td { padding: var(--sp-2) var(--sp-1); }
.cost-table tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.cost-table tr.opt td { color: var(--subtle); font-style: italic; }
.unknown-cost { color: var(--risk-fg); font-weight: 600; }
.note-list { margin: 0; padding-left: var(--sp-5); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: var(--sp-1); }
.warn-msg { background: var(--risk-bg); color: var(--risk-fg); }
.warn-msg a { color: inherit; font-weight: 700; }
#rerun-msg:empty { display: none; }
details.fold > summary { cursor: pointer; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--sp-2); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { font-size: 15px; font-weight: 700; }
details.fold > summary h2::before { content: '▸'; display: inline-block; width: 1.1em; color: var(--subtle); }
details.fold[open] > summary h2::before { content: '▾'; }
details.fold[open] > summary { margin-bottom: var(--sp-3); }
details.fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.tag.new { background: var(--accent); color: #fff; margin-left: 6px; vertical-align: 1px; }

/* retry control on failed requests */
.retry { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.retry-box { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.retry-buttons { display: flex; gap: 6px; }
.retry-box[hidden], .retry-open[hidden], .retry-buttons[hidden] { display: none; }
.retry-box .actions { display: flex; gap: 6px; }
.retry-msg:empty { display: none; }
/* Styled confirm dialog (replaces browser popups) */
.mm-dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 18px 48px rgba(17,26,23,.22); color: var(--ink); background: var(--panel); }
.mm-dialog::backdrop { background: rgba(17,26,23,.38); }
.mm-dialog form { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.mm-dialog h2 { font-size: 17px; margin: 0; }
.mm-dialog p { margin: 0; color: var(--muted); line-height: 1.45; }
.mm-dialog-details { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; padding: 10px 12px; background: var(--ground); border-radius: var(--r-md, 8px); font-size: 13px; }
.mm-dialog-details dt { color: var(--subtle); }
.mm-dialog-details dd { margin: 0; font-family: var(--mono); }
.mm-dialog-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--subtle); }
.mm-dialog-field textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md, 8px); padding: 8px 10px; resize: vertical; }
.archive-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-left: 4px solid var(--unk-fg); border-radius: var(--r-lg); background: var(--ground); }
.archive-banner .grow { flex: 1 1 260px; }
.mv-item.archived { opacity: .6; }
.mv-dot.archived { background: #9AA5A1; }
.mm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Teardown candidates layer (public-record points) */
.mv-diamond { display: inline-block; width: 10px; height: 10px; background: #8B5CF6; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #5B21B6; transform: rotate(45deg) scale(.8); }
.mv-td { background: var(--panel); border-radius: var(--r-md); padding: 7px 10px; font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; max-width: 280px; }
.mv-td[hidden] { display: none; }
.mv-td-min { display: inline-flex; align-items: center; gap: 6px; }
.mv-td-min input { width: 90px; }
.pop-dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; font-size: 13px; }
.pop-dl dt { color: var(--ink-2); }
.pop-dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.mm-dialog-choices { border: 1px solid var(--line, #E2DACB); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.mm-dialog-choices legend { font-weight: 700; padding: 0 6px; }
