/* =========================================================================
   U.S. Real-Estate & Demographics Explorer — mobile-first design system.
   ========================================================================= */
:root {
  /* brand + ink */
  --brand:#1f6f8b; --brand-dark:#15596f; --brand-light:#e8f4f7; --accent:#e08a3c;
  --ink:#0b2533; --muted:#5b7280; --faint:#667085; --bg:#f6f9fb; --surface:#fff;  /* --faint ~4.98:1 on white (WCAG AA) */
  --line:#e2e8f0; --line-soft:#f0f4f7;
  /* status */
  --good:#15803d; --good-bg:#dcfce7; --warn:#b45309; --warn-bg:#fef3c7; --bad:#b91c1c; --bad-bg:#fee2e2;
  --scrim:rgba(11,37,51,.45);
  /* type scale (fluid) */
  --f-h1:clamp(22px,5vw,32px); --f-h2:clamp(18px,4vw,23px); --f-h3:clamp(15px,3vw,18px);
  --f-body:clamp(13px,2vw,15px); --f-label:clamp(11px,1.8vw,13px); --f-small:clamp(11px,1.5vw,12px);
  /* spacing */
  --sp1:4px; --sp2:8px; --sp3:12px; --sp4:16px; --sp5:20px; --sp6:24px; --sp8:32px; --sp10:40px;
  --pad:16px; --max:1400px; --nav-h:54px; --rail:262px; --tap:44px;
  /* radius + shadow */
  --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:18px; --r-full:999px;
  --sh-card:0 2px 10px rgba(15,61,79,.05); --sh-pop:0 8px 24px rgba(15,61,79,.12);
  --sh-float:0 14px 36px rgba(15,61,79,.18);
  --t-fast:150ms ease; --t:250ms ease; --t-slow:350ms ease;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; padding-top: var(--nav-h); font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: var(--f-body); line-height: 1.5; -webkit-text-size-adjust: 100%; }
body.no-scroll { overflow: hidden; }
h1,h2,h3,h4 { line-height: 1.2; }
a { color: var(--brand); }
button { font-family: inherit; }

/* ---------------- sticky nav ---------------- */
.nav { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 100;
  display: flex; align-items: center; gap: var(--sp3); padding: 0 var(--pad);
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%); color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.nav-home { display: flex; align-items: center; gap: 7px; color: #fff; text-decoration: none; font-weight: 800; white-space: nowrap; }
.nav-glyph { color: var(--accent); font-size: 15px; }
.nav-word { font-size: 14px; letter-spacing: -.2px; } .nav-word span { color: var(--accent); }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none; padding: 2px 0; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 11px; border-radius: var(--r-full);
  background: rgba(255,255,255,.14); color: #fff; text-decoration: none; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.crumb:hover { background: rgba(255,255,255,.26); }
.crumb.crumb-cur { background: #fff; color: var(--brand-dark); }
.crumb[aria-disabled="true"] { opacity: .6; }
.crumb-sep { color: rgba(255,255,255,.5); font-size: 11px; }
.metric-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.12); color: #fff; border-radius: var(--r-full); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.metric-btn:hover { background: rgba(255,255,255,.24); }
.metric-btn-ico { color: var(--accent); }
.nav-bar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.nav-bar .status { display: block; height: 100%; }
.status:not(:empty) { position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 95;
  background: var(--brand-light); color: var(--brand-dark); font-size: 12px; font-weight: 600;
  padding: 5px var(--pad); border-bottom: 1px solid #cfe3ea; }

/* ---------------- location command bar ---------------- */
.locbar { display: flex; align-items: center; gap: var(--sp3); padding: var(--sp3) var(--pad) 0; max-width: var(--max); margin: 0 auto; }
.loc-btn { flex: 1; display: flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink);
  font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: var(--sh-card); }
.loc-btn .loc-caret { margin-left: auto; color: var(--muted); }
.loc-controls { display: flex; flex-direction: column; gap: var(--sp3); }
.loc-controls label { display: flex; flex-direction: column; gap: 4px; font-size: var(--f-label); font-weight: 600; color: var(--muted); }
.loc-controls select { min-height: var(--tap); font-size: 15px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--ink); background: var(--surface); width: 100%; }
.loc-controls #refreshBtn { min-height: var(--tap); background: var(--brand); color: #fff; border: 0; border-radius: var(--r-md);
  font-size: 14px; font-weight: 700; cursor: pointer; }
.loc-controls #refreshBtn:hover { background: var(--brand-dark); }
.badge { background: var(--brand-light); border: 1px solid #cfe3ea; color: var(--brand-dark); border-radius: var(--r-full);
  padding: 7px 13px; font-size: 12px; font-weight: 700; white-space: nowrap; display: none; }
.badge.live { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------------- page + blocks ---------------- */
.page { max-width: var(--max); margin: 0 auto; padding: var(--sp4) var(--pad) var(--sp10); }
.block { margin-top: var(--sp6); }
.block-h { font-size: var(--f-h2); color: var(--ink); margin: 0 0 var(--sp3); font-weight: 800; letter-spacing: -.3px; }
.block-sub { color: var(--muted); font-weight: 500; font-size: .72em; }

/* ---------------- hero map ---------------- */
.hero { margin-bottom: var(--sp4); }
.hero-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp3); margin-bottom: var(--sp2); }
.hero-kicker { font-size: var(--f-h3); font-weight: 800; color: var(--ink); }
.hero-metric { font-size: var(--f-small); font-weight: 700; color: var(--brand); background: var(--brand-light);
  padding: 3px 10px; border-radius: var(--r-full); white-space: nowrap; }
.hero-map { width: 100vw; margin-left: calc(50% - 50vw); border-radius: 0; border-left: 0; border-right: 0;
  height: clamp(248px, 46vh, 320px); }

/* ---------------- plots ---------------- */
.plot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px;
  box-shadow: var(--sh-card); height: 300px; overflow: hidden; }
.plot-wide { height: 280px; margin-top: var(--sp4); }
.plot-empty { display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;
  color: var(--faint); font-size: 13px; padding: 0 24px; }
.grid { display: grid; gap: var(--sp4); }

/* ---------------- KPI carousel ---------------- */
.kpis { display: flex; gap: var(--sp3); overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; padding: 2px 0 var(--sp2); scrollbar-width: none; margin-bottom: var(--sp2); }
.kpis::-webkit-scrollbar { display: none; }
.kpis:empty { display: none; }
.kpi { scroll-snap-align: start; flex: 0 0 42%; min-width: 138px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--sh-card); }
.kpi-v { font-size: 21px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------------- stat cards ---------------- */
.cardbox { margin-top: var(--sp4); }
.cards-h { font-size: var(--f-h3); color: var(--ink); margin: 0 0 var(--sp3); font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp3); }
.card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r-md); padding: 13px 15px; }
.card-v { font-size: 20px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.card-l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.moe { font-size: 11px; color: var(--faint); font-weight: 600; }

/* ---------------- national range filters ---------------- */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-card); overflow: hidden; }
.filters-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 13px 16px; background: none; border: 0;
  cursor: pointer; text-align: left; }
.filters-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.filters-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.filters-chevron { color: var(--muted); transition: transform var(--t-fast); }
.filters.open .filters-chevron { transform: rotate(180deg); }
.filters-body { display: none; padding: 0 16px 16px; }
.filters.open .filters-body { display: block; }
.filters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp4) var(--sp5); }
#resetFilters { margin-top: var(--sp4); width: 100%; background: var(--brand-light); color: var(--brand-dark); border: 1px solid #cfe3ea;
  border-radius: var(--r-md); padding: 9px 13px; font-size: 13px; font-weight: 700; cursor: pointer; }
#resetFilters:hover { background: #d8eaf0; }
.rng-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.rng-head .rng-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.rng-head .rng-val { font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.rng-inputs { display: flex; align-items: center; gap: 6px; }
.rng-field { display: flex; align-items: center; gap: 3px; flex: 1 1 0; min-width: 0; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 9px; }
.rng-field:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 2px rgba(31,111,139,.12); }
.rng-pfx { font-size: 12px; color: var(--muted); }
.rng-num { width: 100%; min-width: 0; border: 0; background: transparent; font-size: 14px; color: var(--ink);
  font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; }
.rng-num::-webkit-outer-spin-button, .rng-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rng-num::placeholder { color: #b6c2cc; }
.rng-dash { color: var(--muted); font-size: 12px; }

/* ---------------- breadcrumb fallback (in-page) + banners ---------------- */
.local-banner { background: var(--brand-light); border: 1px solid #cfe3ea; border-left: 4px solid var(--brand);
  border-radius: var(--r-md); padding: 11px 14px; margin-bottom: var(--sp4); font-size: 13px; color: #2a5566; }
.local-banner a { font-weight: 700; text-decoration: none; white-space: nowrap; }
.local-banner a:hover { text-decoration: underline; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 14px; background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--r-lg); }
.empty a { font-weight: 700; cursor: pointer; }

/* ============ Buyer lens ============ */
.assum-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp3); margin-bottom: var(--sp4); }
.assum-trigger { display: inline-flex; align-items: center; gap: 7px; min-height: var(--tap); padding: 0 15px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); font-size: 13.5px; cursor: pointer; box-shadow: var(--sh-card); }
.assum-trigger b { color: var(--brand); }
.assum-ico { color: var(--accent); }
.assum-note { font-size: 12px; color: var(--faint); }
.assum-fields { display: flex; flex-direction: column; gap: var(--sp4); }
.assum-fields label { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--ink); }
.ifield { display: inline-flex; align-items: center; gap: 4px; }
.assum-fields input { width: 92px; min-height: var(--tap); padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 15px; color: var(--ink); }
.assum-fields .unit { color: var(--muted); }
.assum-fields #resetAssum { min-height: var(--tap); background: var(--brand-light); color: var(--brand-dark); border: 1px solid #cfe3ea;
  border-radius: var(--r-md); padding: 0 16px; font-size: 14px; font-weight: 700; cursor: pointer; }

.tile2 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh-card); }
.tile2 h4 { margin: 0 0 14px; font-size: 14px; color: var(--brand); }
.grid-eq { grid-template-columns: 1fr; }

.buy-hero { display: grid; grid-template-columns: 1fr; justify-items: center; text-align: center; gap: var(--sp4);
  background: linear-gradient(135deg, var(--brand-light) 0%, #fff 65%); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 22px; margin-bottom: var(--sp4); box-shadow: var(--sh-card); }
.buy-hero:empty { display: none; }
.grade-chip { width: 96px; height: 96px; border-radius: var(--r-xl); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; box-shadow: var(--sh-float); }
.grade-letter { font-size: 42px; font-weight: 800; line-height: 1; }
.grade-score { font-size: 12px; font-weight: 700; opacity: .92; margin-top: 4px; }
.hero-mid h3 { margin: 0 0 6px; font-size: var(--f-h2); color: var(--ink); }
.hero-sum { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
.vpill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: var(--r-full); }
.vpill.good { background: var(--good-bg); color: var(--good); } .vpill.mid { background: var(--warn-bg); color: var(--warn); } .vpill.bad { background: var(--bad-bg); color: var(--bad); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp3); width: 100%; max-width: 360px; }
.hero-stat .v { font-size: 20px; font-weight: 800; color: var(--ink); }
.hero-stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

.fbar-row { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 10px; margin-bottom: 11px; }
.fbar-label { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.fbar-track { position: relative; height: 12px; background: var(--brand-light); border-radius: var(--r-full); overflow: hidden; }
.fbar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-full); transition: width var(--t-slow); }
.fbar-badge { font-size: 11px; font-weight: 800; color: #fff; border-radius: var(--r-sm); text-align: center; padding: 2px 0; }

.mathrow { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.mathrow .lbl { color: var(--muted); } .mathrow .val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.mathrow.tot { border-bottom: 0; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.mathrow.tot .val { color: var(--brand); }
.mathrow .sub { font-size: 11px; color: var(--faint); font-weight: 500; }
.delta-callout { margin: 12px 0 4px; padding: 10px 14px; border-radius: var(--r-md); font-size: 13.5px; text-align: center; }
.delta-callout b { font-size: 16px; }
.delta-callout.good { background: var(--good-bg); color: var(--good); } .delta-callout.bad { background: #fff1e9; color: var(--warn); }
.gauge-wrap { margin-top: 14px; }
.gauge-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.gauge { position: relative; height: 14px; border-radius: var(--r-full); overflow: hidden;
  background: linear-gradient(90deg, #34a36b 0 56%, #e6b800 56% 72%, #e0663b 72% 100%); }
.gauge-marker { position: absolute; top: -3px; width: 3px; height: 20px; background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 2px #fff; transition: left var(--t-slow); }
.gauge-foot { font-size: 11.5px; color: var(--faint); margin-top: 6px; }

.be-wrap { margin-top: var(--sp4); }
.plot-be { height: 260px; border: 0; box-shadow: none; padding: 0; background: none; }
.be-note { font-size: 13px; color: var(--muted); margin: 8px 4px 0; }
.be-note b { color: var(--ink); }

/* scorecard */
.table-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp3); margin: var(--sp6) 0 var(--sp3); flex-wrap: wrap; }
.table-h { font-size: var(--f-h3); color: var(--ink); margin: 0; font-weight: 700; }
.view-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full); padding: 3px; }
.view-toggle button { border: 0; background: none; padding: 6px 14px; border-radius: var(--r-full); font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.view-toggle button.on { background: var(--brand); color: #fff; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-card); }
.buytable { border-collapse: collapse; width: 100%; font-size: 13px; }
.buytable th { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  padding: 11px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; background: #fafcfd; }
.buytable th.l, .buytable td.l { text-align: left; }
.buytable td { padding: 9px 8px; text-align: center; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.buytable tbody tr { cursor: pointer; }
.buytable tbody tr:hover { background: var(--bg); }
.buytable tr.sel { background: var(--brand-light); }
.zname { font-weight: 700; color: var(--ink); } .zsub { font-size: 11px; color: var(--muted); }
.gchip { display: inline-block; min-width: 30px; padding: 3px 7px; border-radius: var(--r-sm); color: #fff; font-weight: 800; font-size: 12px; }
.fchip { display: inline-block; min-width: 26px; padding: 2px 6px; border-radius: var(--r-sm); color: #fff; font-weight: 700; font-size: 11px; }
.spark { display: block; }
.table-foot { font-size: 12px; color: var(--faint); margin: 8px 4px 0; }
.table-foot code, .ft code { background: var(--brand-light); padding: 1px 5px; border-radius: 4px; }

/* card-mode scorecard (phone): rows become stacked cards */
.buytable.cards-mode, .buytable.cards-mode tbody, .buytable.cards-mode tr, .buytable.cards-mode td { display: block; width: 100%; }
.buytable.cards-mode thead { display: none; }
.buytable.cards-mode tr { border: 1px solid var(--line); border-radius: var(--r-md); margin: 0 0 10px; padding: 6px 12px; }
.buytable.cards-mode tr.sel { border-color: var(--brand); }
.buytable.cards-mode td { display: flex; justify-content: space-between; align-items: center; text-align: right; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.buytable.cards-mode td:last-child { border-bottom: 0; }
.buytable.cards-mode td::before { content: attr(data-label); text-align: left; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.buytable.cards-mode td.l { font-size: 15px; }
.buytable.cards-mode td.l::before { content: ""; }

/* ---------------- footer ---------------- */
.ft { margin-top: var(--sp10); padding: var(--sp6) 0 0; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
.ft p { margin: 0 0 8px; } .ft .note { color: #7889a0; }

/* ---------------- sheets + scrim ---------------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(2px); z-index: 200; }
.scrim[hidden] { display: none; }
.sheet, .loc-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 210; background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 10px var(--pad) calc(var(--pad) + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--sh-float); transform: translateY(100%); transition: transform var(--t); max-height: 88vh; overflow-y: auto; }
.sheet.open, .loc-sheet.open { transform: translateY(0); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 2px auto 12px; }
.sheet-h { font-size: 15px; margin: 0 0 14px; color: var(--ink); }
.metric-list { display: flex; flex-direction: column; gap: 8px; }
.metric-opt { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 14px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface); font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.metric-opt.on { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); }
.metric-opt .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.metric-opt.on .dot { background: var(--brand); }

/* ---------------- tooltips (hover on desktop, tap/focus on mobile) ---------------- */
.tip { position: relative; cursor: help; border-bottom: 1px dotted var(--faint); outline: none; }
.tip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px; }
.tip::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 7px); z-index: 60;
  width: max-content; max-width: 240px; background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 500; line-height: 1.45; text-align: left; text-transform: none; letter-spacing: normal;
  padding: 9px 11px; border-radius: 9px; box-shadow: var(--sh-pop); white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(-3px); transition: opacity var(--t-fast), transform var(--t-fast); pointer-events: none;
}
.tip::before {   /* little arrow */
  content: ""; position: absolute; left: 12px; top: calc(100% + 1px); z-index: 61;
  border: 6px solid transparent; border-bottom-color: var(--ink);
  opacity: 0; visibility: hidden; transition: opacity var(--t-fast);
}
.tip:hover::after, .tip:focus::after, .tip:focus-within::after { opacity: 1; visibility: visible; transform: translateY(0); }
.tip:hover::before, .tip:focus::before, .tip:focus-within::before { opacity: 1; visibility: visible; }

/* =========================================================================
   Breakpoints (min-width ladder)
   ========================================================================= */
@media (min-width: 480px) {
  .kpi { flex-basis: 30%; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .hero-map { height: clamp(280px, 44vh, 340px); }
}
@media (min-width: 769px) {
  :root { --pad: var(--sp6); --nav-h: 56px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-eq { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .kpis { flex-wrap: wrap; overflow: visible; } .kpi { flex: 1 1 0; min-width: 120px; }
  .hero-map { width: 100%; margin-left: 0; border-radius: var(--r-lg); border: 1px solid var(--line); height: 360px; }
  .plot { height: 340px; } .plot-wide { height: 320px; } .plot-be { height: 300px; }
  /* buyer hero becomes a row */
  .buy-hero { grid-template-columns: auto 1fr auto; justify-items: stretch; text-align: left; align-items: center; gap: var(--sp6); padding: 22px 26px; }
  .buy-hero .hero-stats { max-width: none; }
  .buytable th { position: sticky; top: var(--nav-h); z-index: 1; }
}
@media (min-width: 1025px) {
  .loc-btn { display: none; }
  .loc-sheet { position: static; transform: none; box-shadow: none; background: none; padding: 0; max-height: none; overflow: visible; border-radius: 0; flex: 1; }
  .loc-sheet .sheet-grip, .loc-sheet .sheet-h { display: none; }
  .loc-controls { flex-direction: row; align-items: flex-end; gap: var(--sp4); }
  .loc-controls label { flex: 1; }
  .loc-controls #refreshBtn { flex: 0 0 auto; padding: 0 18px; }
  .badge { display: inline-block; }
  /* national filters become a sticky left rail beside the US map */
  .shell { display: grid; grid-template-columns: var(--rail) 1fr; gap: var(--sp5); align-items: start; }
  .rail { position: sticky; top: calc(var(--nav-h) + var(--sp4)); }
  .filters-toggle { cursor: default; } .filters-chevron { display: none; }
  .filters-body { display: block !important; }
  .hero-map { height: 420px; }
}
@media (hover: hover) {
  .crumb, .metric-btn, .loc-btn, .card, .kpi { transition: background var(--t-fast), box-shadow var(--t-fast); }
  .card:hover, .kpi:hover { box-shadow: var(--sh-pop); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto; } }
