/* ==========================================================================
   Design tokens
   ========================================================================== */
/* Palette: the original dashboard's browns — dark brown ink, saddle-brown
   accent, light-brown lines and cream tints — extended to a full scale. */
:root {
  color-scheme: light;
  --page: #faf5ee;
  --surface: #ffffff;
  --surface-2: #fdf9f3;
  --surface-3: #f2e6d5;
  --ink: #3d2817;
  --ink-2: #5c3a1a;
  --muted: #8a7560;
  --line: #eadccb;
  --line-strong: #d9c4ab;
  --accent: #8b5a2b;
  --accent-ink: #ffffff;
  --accent-soft: #f2e6d5;
  --accent-strong: #5c3a1a;
  --good: #2a7a3d;
  --good-soft: #e3f0e4;
  --bad: #a33333;
  --bad-soft: #f7e3e0;
  --warn: #a8600f;
  --warn-soft: #fbeedb;
  /* chart series — brown, teal, ochre (CVD-checked: worst adjacent ΔE 14.1) */
  --s1: #8b5a2b;
  --s2: #2b6b8b;
  --s3: #c98a1e;
  --grid: #efe4d6;
  --shadow-sm: 0 1px 2px rgba(92, 58, 26, .07);
  --shadow: 0 1px 3px rgba(92, 58, 26, .08), 0 6px 24px rgba(92, 58, 26, .07);
  --shadow-lg: 0 12px 40px rgba(61, 40, 23, .18);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --sidebar: 236px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Light is the default. data-theme="dark" forces dark; data-theme="auto"
   follows the device setting. Set in <head> from the viewer's saved choice. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --page: #17110c;
    --surface: #211811;
    --surface-2: #281d15;
    --surface-3: #33261b;
    --ink: #f5ebdd;
    --ink-2: #d9c4ab;
    --muted: #a08b74;
    --line: #3a2b1f;
    --line-strong: #4d3a2a;
    --accent: #c98e5a;
    --accent-ink: #1a120c;
    --accent-soft: #3d2a1b;
    --accent-strong: #e2b184;
    --good: #6cc07e;
    --good-soft: #1b2e1e;
    --bad: #ec7b72;
    --bad-soft: #3a1d19;
    --warn: #e0a95a;
    --warn-soft: #3a2a16;
    --s1: #c98e5a;
    --s2: #5fa3c7;
    --s3: #e8c170;
    --grid: #33261b;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 235, 210, .04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #17110c;
    --surface: #211811;
    --surface-2: #281d15;
    --surface-3: #33261b;
    --ink: #f5ebdd;
    --ink-2: #d9c4ab;
    --muted: #a08b74;
    --line: #3a2b1f;
    --line-strong: #4d3a2a;
    --accent: #c98e5a;
    --accent-ink: #1a120c;
    --accent-soft: #3d2a1b;
    --accent-strong: #e2b184;
    --good: #6cc07e;
    --good-soft: #1b2e1e;
    --bad: #ec7b72;
    --bad-soft: #3a1d19;
    --warn: #e0a95a;
    --warn-soft: #3a2a16;
    --s1: #c98e5a;
    --s2: #5fa3c7;
    --s3: #e8c170;
    --grid: #33261b;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 235, 210, .04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  }

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: .85rem; }
.xs { font-size: .76rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }

/* ==========================================================================
   Shell: sidebar (desktop) / bottom bar (mobile)
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 800; font-size: 1.08rem; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2);
  font-weight: 600; font-size: .92rem; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: .76rem; color: var(--muted); }
.sidebar-foot button { margin-top: 8px; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
  padding: 12px 32px; display: flex; align-items: center; gap: 16px; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .search { max-width: 520px; flex: 1; }
.page { padding: 8px 32px 64px; max-width: 1280px; margin: 0 auto; }
.page.full { max-width: none; padding: 0; }

.bottombar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .topbar { padding: 10px 16px; }
  .page { padding: 8px 16px 40px; }
  .bottombar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottombar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 600;
    color: var(--muted); padding: 4px 6px; border-radius: 10px; min-width: 56px; }
  .bottombar a.active { color: var(--accent); }
  .bottombar svg.ic { width: 22px; height: 22px; }
  h1 { font-size: 1.5rem; }
}
.mobile-brand { display: none; font-weight: 800; align-items: center; gap: 8px; }
@media (max-width: 900px) { .mobile-brand { display: flex; } }

/* ==========================================================================
   Components
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head p { margin-top: 3px; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head p { margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .g4 { gap: 10px; } .g4 .stat { padding: 14px; } .g4 .stat .value { font-size: 1.3rem; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 650; cursor: pointer; font-size: .9rem;
  transition: background .12s, border-color .12s, transform .06s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { color: var(--accent); font-weight: 650; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .74rem;
  font-weight: 650; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent-strong); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.delta { font-weight: 700; font-size: .82rem; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 650; font-size: .84rem;
  color: var(--ink-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button:hover:not(.active) { color: var(--ink); }

/* form fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .74rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.input, select.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-affix { position: relative; }
.input-affix .input { padding-left: 30px; }
.input-affix span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.hint { font-size: .76rem; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* search with suggestions */
.search { position: relative; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 0 14px; transition: border-color .12s, box-shadow .12s; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: 0; outline: 0; background: transparent; padding: 11px 0; flex: 1; min-width: 0; }
.search-box .ic { color: var(--muted); }
.search.search-hero .search-box { padding: 4px 8px 4px 18px; border-radius: 16px; box-shadow: var(--shadow); }
.search.search-hero .search-box input { padding: 14px 0; font-size: 1.05rem; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; max-height: 420px; overflow-y: auto; }
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.suggest-item:hover, .suggest-item.sel { background: var(--surface-3); }
.suggest-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-strong); }
.suggest-icon.hdb { background: color-mix(in srgb, var(--s2) 14%, var(--surface)); color: var(--s2); }
.suggest-icon.area { background: color-mix(in srgb, var(--s3) 14%, var(--surface)); color: var(--s3); }
.suggest-title { font-weight: 650; }
.suggest-sub { font-size: .8rem; color: var(--muted); }
.suggest-empty { padding: 14px; color: var(--muted); font-size: .9rem; }

/* stat tiles */
.stat { padding: 18px 20px; }
.stat .label { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 600; color: var(--muted); }
.stat .value { font-size: 1.65rem; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.stat .sub { font-size: .8rem; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* table */
.table-wrap { overflow: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.table-wrap.tall { max-height: 560px; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; z-index: 1; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th.sorted { color: var(--accent-strong); }
.tbl tr.clickable { cursor: pointer; }

/* progress */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; }

/* range bar (valuation, stats) */
.rangebar { position: relative; height: 10px; border-radius: 999px; margin: 12px 0 8px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 25%, var(--surface-3)), var(--accent), color-mix(in srgb, var(--accent) 25%, var(--surface-3))); }
.rangebar .marker { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--surface);
  border: 3px solid var(--accent-strong); transform: translate(-50%, -50%); box-shadow: var(--shadow); }

/* empty / loading */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg.ic { width: 40px; height: 40px; stroke-width: 1.4; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%;
  animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px; color: var(--muted); }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: .85rem; color: var(--ink-2); }
.callout svg.ic { color: var(--muted); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); border-color: transparent; color: var(--ink); }

/* chips (filters) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2);
  cursor: pointer; font-size: .8rem; font-weight: 600; white-space: nowrap; user-select: none; transition: all .12s; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip.disabled { opacity: .35; pointer-events: none; }

/* chart containers */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 360px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.box { width: 10px; height: 10px; border-radius: 3px; }

/* ==========================================================================
   Page-specific
   ========================================================================== */
/* home hero */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 44px 40px 40px; margin-top: 8px;
  background: radial-gradient(1200px 400px at 90% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
              radial-gradient(800px 300px at -10% 120%, color-mix(in srgb, var(--s1) 14%, transparent), transparent 60%),
              var(--surface);
  border: 1px solid var(--line); }
.hero h1 { font-size: 2.3rem; max-width: 640px; }
.hero p.lead { color: var(--ink-2); margin-top: 10px; max-width: 580px; font-size: 1.02rem; }
.hero .search { margin-top: 24px; max-width: 640px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero-tags button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  font-size: .8rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.hero-tags button:hover { border-color: var(--accent); color: var(--accent-strong); }
@media (max-width: 700px) { .hero { padding: 28px 20px; } .hero h1 { font-size: 1.6rem; } }

.action { display: flex; flex-direction: column; gap: 10px; padding: 18px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.action:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.action-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.action-icon svg.ic { width: 22px; height: 22px; }
.action h3 { font-size: .98rem; }
.action p { font-size: .83rem; color: var(--muted); }

.launch-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.launch-card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.hscroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto;
  padding-bottom: 6px; scroll-snap-type: x mandatory; }
.hscroll > * { scroll-snap-align: start; }

/* detail pages */
.crumbs { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); margin: 6px 0 14px; }
.crumbs a:hover { color: var(--ink); }
.detail-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.detail-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; margin-top: 20px; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.minimap { height: 220px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.list-plain li:last-child { border-bottom: 0; }

/* valuation */
.val-result { padding: 26px; }
.val-figure { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; }
@media (max-width: 700px) { .val-figure { font-size: 2rem; } }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 650; color: var(--muted); }
.step b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .78rem; }
.step.on { color: var(--ink); }
.step.on b { background: var(--accent); color: var(--accent-ink); }
.step + .step::before { content: ""; width: 24px; height: 1px; background: var(--line-strong); }

/* affordability */
.area-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.big-number { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; }

/* map */
.map-page { position: relative; height: 100vh; height: 100dvh; }
@media (max-width: 900px) { .map-page { height: calc(100dvh - 58px - 72px); } }
.map-page #map, .map-page .map { position: absolute; inset: 0; }
.map-panel { position: absolute; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); }
.map-layers { top: 14px; left: 14px; width: 290px; padding: 14px; max-height: calc(100% - 28px); overflow-y: auto; }
.map-layers h3 { font-size: .9rem; margin-bottom: 8px; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 8px; cursor: pointer; font-size: .87rem; font-weight: 600; }
.layer-row:hover { background: var(--surface-3); }
.layer-row input { accent-color: var(--accent); width: 16px; height: 16px; }
.layer-row .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.layer-row .count { margin-left: auto; font-size: .74rem; color: var(--muted); font-weight: 600; }
.map-legend { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--ink-2); }
.ramp { height: 8px; border-radius: 4px; margin: 6px 0 3px; }
.map-info { top: 14px; right: 14px; width: 330px; padding: 16px; max-height: calc(100% - 28px); overflow-y: auto; }
@media (max-width: 700px) {
  .map-layers { width: auto; right: 14px; max-height: 44%; }
  .map-layers.collapsed .layer-body { display: none; }
  .map-info { top: auto; bottom: 14px; left: 14px; right: 14px; width: auto; max-height: 48%; }
}
.maplibregl-popup-content { border-radius: 12px !important; padding: 12px 14px !important; font-family: var(--font); box-shadow: var(--shadow-lg) !important;
  background: var(--surface) !important; color: var(--ink); }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-ctrl-group { border-radius: 10px !important; }

/* sun */
.sun-bottom { left: 14px; right: 14px; bottom: 14px; padding: 14px 18px; }
.sun-card { top: 14px; right: 14px; width: 320px; padding: 16px; }
.sun-left { top: 14px; left: 14px; width: 300px; padding: 14px; }
@media (max-width: 900px) {
  .sun-card { top: auto; bottom: 150px; left: 14px; right: 14px; width: auto; max-height: 34%; overflow-y: auto; }
  .sun-left { width: auto; right: 14px; }
}
.facade { display: grid; grid-template-columns: 22px 1fr 56px; align-items: center; gap: 8px; font-size: .8rem; margin-top: 6px; }
.facade .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.facade .bar div { height: 100%; background: var(--s3); border-radius: 3px; }
.time-row { display: flex; align-items: center; gap: 14px; }
.play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ink); color: var(--surface); display: grid;
  place-items: center; cursor: pointer; flex: none; }
.play svg.ic { width: 18px; height: 18px; }
.time-big { font-size: 1.5rem; font-weight: 800; min-width: 104px; font-variant-numeric: tabular-nums; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-top: 10px; }
.months button { border: 0; background: transparent; padding: 5px 0; font-size: .74rem; font-weight: 650; color: var(--muted);
  border-radius: 6px; cursor: pointer; }
.months button.active { background: var(--accent-soft); color: var(--accent-strong); }

/* explore */
.filterbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-block { padding: 16px; }
.filter-block h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); display: flex;
  justify-content: space-between; margin-bottom: 8px; }
.filter-block h4 button { text-transform: none; letter-spacing: 0; font-size: .74rem; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.chips.scroll { max-height: 150px; overflow-y: auto; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: 10px; font-size: .88rem; z-index: 100; box-shadow: var(--shadow-lg); }
@media (max-width: 900px) { .toast { bottom: 90px; } }

.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(40, 26, 14, .45); display: grid; place-items: center;
  padding: 16px; backdrop-filter: blur(2px); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(760px, 100%); }
textarea.input { min-height: 90px; resize: vertical; font: inherit; }

/* user chip, facts */
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid;
  place-items: center; font-weight: 800; font-size: .8rem; flex: none; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 20px; }
.fact { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fact .label { text-transform: none; letter-spacing: 0; font-size: .76rem; font-weight: 600; color: var(--muted); }
.fact .v { font-weight: 700; margin-top: 2px; }
.fact .src { font-size: .7rem; color: var(--muted); }
.fact.missing .v { color: var(--muted); font-weight: 500; font-style: italic; }
.star-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.star-btn.on svg.ic { fill: currentColor; }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent-strong); font-size: .85rem; margin: 8px 0 4px; flex-wrap: wrap; }

/* sign-in page */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 30px; }

/* collapsible map panels (sun page) */
.panel-head { display: flex; align-items: center; gap: 8px; }
.panel-head .panel-toggle { margin-left: auto; padding: 4px 6px; }
.panel-summary { display: none; font-size: .82rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.map-panel.collapsed { width: auto !important; max-width: calc(100% - 28px); padding: 6px 8px 6px 12px; bottom: auto !important; }
.map-panel.collapsed .panel-body { display: none; }
.map-panel.collapsed .panel-summary { display: block; }
.map-panel.collapsed .panel-head { cursor: pointer; }
.map-panel.collapsed .panel-head .label { display: none; }
@media (max-width: 900px) { .sun-card.collapsed { top: 64px; bottom: auto; left: auto; right: 14px; } }

/* floor plans & site plan */
.plan-drop { border: 2px dashed transparent; border-radius: 12px; transition: border-color .12s, background .12s; }
.plan-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.plan-tile { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: zoom-in;
  transition: box-shadow .12s, border-color .12s; }
.plan-tile:hover, .plan-tile:focus { border-color: var(--accent); box-shadow: var(--shadow); outline: none; }
.plan-tile img, .plan-pdf { width: 100%; height: 150px; object-fit: contain; background: #fff; display: block; }
.plan-pdf { display: grid; place-items: center; align-content: center; gap: 4px; color: var(--accent-strong); font-weight: 800; }
.plan-pdf svg.ic { width: 34px; height: 34px; }
.plan-tile figcaption { padding: 8px 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-empty { display: flex; gap: 14px; align-items: center; padding: 26px; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; }
.plan-empty svg.ic { width: 34px; height: 34px; color: var(--muted); }
.modal.viewer { width: min(1100px, 100%); }
.viewer-stage { background: #fff; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; min-height: 50vh; }
.viewer-stage img { max-width: 100%; max-height: 72vh; object-fit: contain; }
.viewer-stage iframe { width: 100%; height: 72vh; border: 0; border-radius: 10px; }

/* calculators */
.calc-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .calc-grid { grid-template-columns: minmax(0, 1fr); } }
.calc-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calc-tabs .seg { flex-wrap: nowrap; }
.input-affix.suf .input { padding-left: 12px; padding-right: 30px; }
.input-affix.suf span { left: auto; right: 12px; }
details.collapse { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
details.collapse > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; margin-right: -4px; }
details.collapse[open] > summary::before { transform: rotate(90deg); }
details.collapse > summary > span:first-of-type { flex: 1; }
details.collapse .table-wrap { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.tbl.amort tr.yr-row { cursor: pointer; }
.tbl.amort tr.yr-row td { background: var(--surface-2); }
.tbl.amort tr.mo-row { display: none; }
.tbl.amort tbody.open tr.mo-row { display: table-row; }
.tbl.amort .chev { display: inline-block; color: var(--muted); transition: transform .15s; }
.tbl.amort tbody.open .chev { transform: rotate(90deg); }
.tbl.amort tfoot td { position: sticky; bottom: 0; background: var(--surface-2); border-top: 1px solid var(--line); padding: 10px 12px; }

/* buyer pool: today vs at-exit comparison (stacks on phones) */
.cmp { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cmp-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px;
  padding: 11px 14px; border-top: 1px solid var(--line); align-items: center; font-size: .9rem; }
.cmp.one .cmp-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.cmp-row > div:not(.cmp-label) { text-align: right; }
.cmp-head { border-top: 0; background: var(--surface-2); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.cmp-yr { display: none; }
@media (max-width: 640px) {
  .cmp-head { display: none; }
  .cmp-row, .cmp.one .cmp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 4px; }
  .cmp-row:nth-child(2) { border-top: 0; }
  .cmp-label { grid-column: 1 / -1; color: var(--muted); font-size: .82rem; }
  .cmp-row > div:not(.cmp-label) { text-align: left; }
  .cmp-yr { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; }
}

/* stack sunlight */
.stacks-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; margin-top: 20px; align-items: start; }
@media (max-width: 1000px) { .stacks-layout { grid-template-columns: minmax(0, 1fr); } }
.stacks-map-card { position: relative; overflow: hidden; padding: 0; }
.stacks-map { height: min(68vh, 620px); min-height: 380px; }
.stacks-map-tools { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 70px); }
.stacks-map-tools .chip { background: var(--surface); box-shadow: var(--shadow-sm); }
.stacks-map-foot { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
i.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid rgba(0,0,0,.08); }
i.sw.stripes, .heat-c.shade { background: repeating-linear-gradient(135deg, #c9bfb1 0 3px, #f2ebe1 3px 6px); }
.block-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.block-btn { text-align: left; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  display: flex; flex-direction: column; gap: 1px; font-size: .78rem; color: var(--muted); cursor: pointer; }
.block-btn b { color: var(--ink); font-size: .88rem; }
.block-btn.on { background: var(--accent-strong); border-color: var(--accent-strong); color: #eadccb; }
.block-btn.on b { color: #fff; }
.accent-text { color: var(--accent); font-weight: 700; }
.heat-sentence { font-size: 1.05rem; line-height: 1.5; margin: 6px 0 14px; max-width: 900px; }
.heat-wrap { overflow-x: auto; }
.heat { display: grid; gap: 3px; min-width: 620px; align-items: center; }
.heat-m { font-size: .75rem; color: var(--muted); }
.heat-m.on { color: var(--ink); font-weight: 700; }
.heat-c { height: 20px; border: 0; border-radius: 4px; background: #e8e5e0; padding: 0; cursor: pointer; }
.heat-c.sun { background: rgba(214, 160, 40, var(--i)); }
.heat-c.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat-x { font-size: .65rem; color: var(--muted); white-space: nowrap; overflow: visible; }

.stacks-view-note { margin-bottom: 8px; padding: 6px 10px; border-radius: 8px;
  background: var(--accent-soft); font-size: .75rem; color: var(--ink-2); }

/* stack sunlight: floor plan with sun patches */
.stacks-plan-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.stacks-plan { background: #fcf8f2; border-radius: 10px; overflow: hidden; }
.stacks-plan svg { display: block; width: 100%; height: auto; max-height: 560px; }
@media (max-width: 900px) { .stacks-plan-grid { grid-template-columns: minmax(0, 1fr); } }
