/* 布局：顶部筛选条 + 左侧地图 + 右侧 ZIP 列表/详情面板（手机上上下堆叠） */
:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --ink: #15201c;
  --muted: #5b6a64;
  --line: #dbe2de;
  --accent: #1d6b58;
  --accent-ink: #ffffff;
  --map-bg: #e4ebe7;
  --land: #f7faf8;
  --land-line: #9fb1a9;
  --y-lo: #c2524a;
  --y-mid: #d49a2a;
  --y-hi: #2b8f63;
  --warn-bg: #fff4dc;
  --warn-ink: #6b4a06;
  --shadow: 0 1px 2px rgb(20 32 28 / .08), 0 4px 14px rgb(20 32 28 / .06);
  --font-display: "Archivo", "IBM Plex Sans", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --panel-w: 440px;
  --top-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #151d1a; --surface-2: #1b2521; --ink: #e4ebe7; --muted: #92a29b;
    --line: #26322d; --accent: #5cc3a2; --accent-ink: #0b1210; --map-bg: #0b100e; --land: #18211d;
    --land-line: #3d4d46; --y-lo: #e06a5f; --y-mid: #e3ad45; --y-hi: #46b883;
    --warn-bg: #3a2e12; --warn-ink: #f2d48a; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 18px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #151d1a; --surface-2: #1b2521; --ink: #e4ebe7; --muted: #92a29b;
  --line: #26322d; --accent: #5cc3a2; --accent-ink: #0b1210; --map-bg: #0b100e; --land: #18211d;
  --land-line: #3d4d46; --y-lo: #e06a5f; --y-mid: #e3ad45; --y-hi: #46b883;
  --warn-bg: #3a2e12; --warn-ink: #f2d48a; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 18px rgb(0 0 0 / .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font-body);
  display: flex; flex-direction: column;
}
button, input, select { font: inherit; color: inherit; }
: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); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* 顶部条 */
.topbar {
  display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; color: inherit; text-decoration: none; }
.logo { width: 28px; height: 28px; flex: none; display: block; }
.logo-bg { fill: var(--accent); }
.logo-dot { fill: #f2c14e; }
.brand-name { font: 700 19px/1 var(--font-display); letter-spacing: -.01em; color: var(--ink); }
.brand-name b { font-weight: 800; color: var(--accent); }
.lang {
  margin-left: auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.lang:hover { background: var(--surface-2); }
/* 搜索框：标签 + 输入框 */
.search {
  flex: 1 1 240px; min-width: 0; max-width: 440px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 3px 6px 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: text;
}
.search-ico { width: 16px; height: 16px; color: var(--muted); flex: none; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search input { flex: 1 1 110px; min-width: 80px; border: 0; background: transparent; padding: 5px 6px; outline: none; }
.chips { display: contents; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  font: 500 12.5px var(--font-num); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 2px 1px 9px; white-space: nowrap;
}
.chip .n { color: var(--muted); font-weight: 400; }
.chip.bad { color: var(--y-lo); border-color: currentColor; }
.chip.bad .lbl { text-decoration: line-through; }
.chip button {
  border: 0; background: none; cursor: pointer; color: var(--muted); width: 18px; height: 18px;
  border-radius: 50%; display: grid; place-items: center; font-size: 14px; line-height: 1; padding: 0;
}
.chip button:hover { background: var(--surface-2); color: var(--ink); }

/* 多选条 + 对比 */
.cmp-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  padding: 9px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px;
}
.cmp-actions { display: flex; align-items: center; gap: 10px; }
.btn-primary {
  border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 500;
}
.btn-primary:hover { filter: brightness(1.08); }
/* 筛选下拉按钮 */
.fwrap { position: relative; flex: none; }
.fbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px;
  padding: 0 11px 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  cursor: pointer; white-space: nowrap; color: var(--ink); font-size: 13.5px; font-weight: 500;
}
.fbtn:hover { background: var(--surface-2); }
.fbtn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); }
.fbtn.open { border-color: var(--ink); }
.caret { width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: translateY(-2px) rotate(45deg); opacity: .7; transition: transform .15s; }
.fbtn.open .caret { transform: translateY(1px) rotate(-135deg); }
.fpop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: max-content; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.fpop.pad { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 260px; }
.fpop-title { font-weight: 600; font-size: 14px; }
.fpop-note { margin: 0; font-size: 12px; color: var(--muted); max-width: 300px; }
.range-row { display: flex; align-items: flex-end; gap: 8px; }
.range-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.range-row select {
  width: 128px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 14px;
}
.range-row .dash { padding-bottom: 8px; color: var(--muted); }
.fpop-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.st-pop { width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; max-height: min(480px, 70vh); }
.st-pop[hidden] { display: none; }
.st-top { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--line); }
.st-top input {
  flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
}
.st-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.st-list label {
  display: grid; grid-template-columns: auto 30px 1fr auto; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer;
}
.st-list label:hover { background: var(--surface-2); }
.st-list input { margin: 0; accent-color: var(--accent); }
.st-ab { font: 500 12.5px var(--font-num); }
.st-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-nm small { color: var(--muted); }
.st-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.st-meta .ydot { margin: 0 3px 0 0; width: 7px; height: 7px; }
.st-foot { padding: 8px 12px; border-top: 1px solid var(--line); }
.btn-reset {
  border: 0; background: none; color: var(--accent); border-radius: 6px;
  padding: 5px 6px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.btn-reset:hover { background: var(--surface-2); }
.btn-link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px; }
.btn-ghost {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-size: 12.5px;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost:disabled { color: var(--muted); cursor: default; }
.d-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.d-nav .back { align-self: auto; }
.cmp table { font-size: 12.5px; }
.cmp thead th { vertical-align: bottom; }
.cmp th[scope="row"], .cmp thead th:first-child {
  position: sticky; left: 0; z-index: 1; text-align: left; background: var(--surface-2);
}
.cmp-zip {
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent);
  font: 500 13px var(--font-num); text-decoration: underline; text-underline-offset: 2px;
}
.cmp-city { display: block; font-weight: 400; color: var(--muted); font-size: 11px; max-width: 110px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; }
.cmp td.best { background: color-mix(in srgb, var(--y-hi) 16%, transparent); font-weight: 600; }
.cmp tr.sep th { text-align: left; font-size: 11px; letter-spacing: .06em; padding-top: 10px; }
@media (min-width: 821px) {
  .panel.wide { width: min(640px, 58vw); flex-basis: min(640px, 58vw); }
}
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; padding: 7px 12px; flex: 1; cursor: pointer; color: var(--muted);
  border-right: 1px solid var(--line); white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); background: var(--surface-2); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.field-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; font-size: 13px; }
.field-inline select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink);
}

.notice {
  background: var(--warn-bg); color: var(--warn-ink); font-size: 13px;
  padding-block: 7px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* 主体 */
.layout { flex: 1; min-height: 0; display: flex; }
.map-wrap { position: relative; flex: 1; min-width: 0; background: var(--map-bg); }
.map { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.map.dragging { cursor: grabbing; }
/* MapLibre 会给容器加 position: relative，用 id 选择器盖过去 */
#tiles { position: absolute; inset: 0; pointer-events: none; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.tip {
  position: absolute; pointer-events: none; z-index: 3; transform: translate(-50%, calc(-100% - 12px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; box-shadow: var(--shadow); font-size: 12px; white-space: nowrap;
}
.tip b { font-family: var(--font-num); font-weight: 500; }
.map-ctrl {
  position: absolute; top: 12px; left: 12px; z-index: 4; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow);
}
.map-ctrl button { width: 34px; height: 34px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 17px; }
.map-ctrl button:last-child { border-bottom: 0; font-size: 15px; }
.map-ctrl button:hover { background: var(--surface-2); }
.legend {
  position: absolute; left: 12px; bottom: 26px; z-index: 4; width: 190px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow);
}
.legend-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.legend-bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--y-lo), var(--y-mid), var(--y-hi)); }
.legend-ticks { display: flex; justify-content: space-between; font: 11px var(--font-num); color: var(--muted); margin-top: 4px; }
.attrib {
  position: absolute; right: 0; bottom: 0; z-index: 4; font-size: 10px; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 2px 6px; border-top-left-radius: 6px;
}
.attrib a { color: inherit; }

/* 右侧面板 */
.panel {
  width: var(--panel-w); flex: 0 0 var(--panel-w); min-width: 0; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line);
}
.list-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 14px 16px 10px;
}
.sort-ctl { display: flex; align-items: center; gap: 6px; }
.sort-dir {
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  color: var(--ink); cursor: pointer; font-size: 13px; white-space: nowrap;
}
.sort-dir:hover { background: var(--surface-2); }
.list-count { font: 700 18px/1.2 var(--font-display); }
.list-sub { color: var(--muted); font-size: 12px; }
.zip-list { list-style: none; margin: 0; padding: 0; }
.zip-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.zip-row:hover, .zip-row.hover { background: var(--surface-2); }
.zip-row:focus-visible { outline-offset: -2px; }
.zr-main { min-width: 0; }
.zr-zip { font: 500 15px var(--font-num); }
.zr-city { color: var(--muted); margin-left: 8px; }
.zr-nums { grid-column: 1; display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.zr-nums .num { color: var(--ink); }
.pill {
  grid-row: 1 / span 2; grid-column: 2; justify-self: end;
  font: 500 14px var(--font-num); padding: 4px 9px; border-radius: 999px; color: #fff; min-width: 64px; text-align: center;
}
.pill.na { background: var(--surface-2); color: var(--muted); }
.pill.lc { background: var(--surface); border: 2px solid; padding: 2px 8px; line-height: 1.2; }
.pill small { display: block; font: 10px var(--font-body); opacity: .85; }
.legend-lc { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.legend-lc i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); background: var(--surface); }
.empty { padding: 28px 16px; color: var(--muted); }

/* 详情 */
.detail { padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 20px; }
.back {
  align-self: flex-start; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 13px;
}
.d-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.d-zip { font: 700 28px/1 var(--font-display); letter-spacing: .01em; }
.d-place { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kpi { background: var(--surface); padding: 10px 12px; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-val { font: 500 20px/1.3 var(--font-num); }
.kpi-sub { font-size: 11.5px; color: var(--muted); }
.up { color: var(--y-hi); } .down { color: var(--y-lo); }
h3 { font: 600 13px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.h3-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.h3-row h3 { margin: 0 0 8px; }
.hint { font-size: 12px; color: var(--muted); }

.range { position: relative; height: 56px; margin: 4px 0 0; }
.range-track, .range-fill { position: absolute; left: 0; right: 0; top: 24px; height: 6px; border-radius: 3px; }
.range-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 25%, transparent), color-mix(in srgb, var(--accent) 60%, transparent)); }
.range-dot { position: absolute; top: 19px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); }
.range-lbl { position: absolute; font: 11.5px var(--font-num); color: var(--muted); white-space: nowrap; }
.range-lbl.mid { top: 0; color: var(--ink); transform: translateX(-50%); }
.range-lbl.lo { top: 36px; left: 0; }
.range-lbl.hi { top: 36px; right: 0; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-weight: 500; color: var(--muted); font-size: 12px; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, td .num { font-family: var(--font-num); }
tr.cur td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.rng { display: block; font-size: 11px; color: var(--muted); }
.src { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-family: var(--font-body); }
.src.thin { background: var(--warn-bg); color: var(--warn-ink); }
.ydot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.kpi-date { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fact { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.fact.warn { border-color: var(--y-mid); background: color-mix(in srgb, var(--y-mid) 10%, transparent); }
.fact-val { font: 500 16px var(--font-num); }
.calc { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.calc-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 12px; }
.calc-in label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.calc-in input, .calc-in select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  font-family: var(--font-num); color: var(--ink);
}
.calc-out { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.calc-out > div { background: var(--surface-2); padding: 9px 12px; min-width: 0; }
.calc-out .big { grid-column: 1 / -1; }
.calc-out .lbl { font-size: 12px; color: var(--muted); }
.calc-out .val { font: 500 16px var(--font-num); }
.calc-out .big .val { font-size: 22px; }

.tabs { display: inline-flex; gap: 4px; }
/* 趋势图 */
#trendBox { display: flex; flex-direction: column; gap: 14px; }
.tlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.tlegend span { display: inline-flex; align-items: center; gap: 6px; }
.tlegend i { width: 18px; height: 0; border-top: 2px solid var(--accent); }
.tlegend i.ls { border-top: 1.5px dashed var(--muted); }
.tchart { border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 6px; background: var(--surface); }
.tchart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.tc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-bottom: 4px; }
.tc-val { font: 500 18px/1.3 var(--font-num); }
.tc-when { font: 400 12px var(--font-body); color: var(--muted); }
.tc-chg { font: 500 12.5px var(--font-num); text-align: right; white-space: nowrap; }
.tc-src { font-size: 11px; color: var(--muted); }
.muted { color: var(--muted); }
.tg { stroke: var(--line); stroke-width: 1; }
.tl { fill: var(--muted); font: 10px var(--font-num); }
.tline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.tline.est { stroke-dasharray: 5 3; }
.tref { fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-dasharray: 3 3; opacity: .8; }
.xh { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.xd { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.hitbox { fill: transparent; cursor: crosshair; }
.tabs button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 11px; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.tabs button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.listings { display: flex; flex-direction: column; gap: 8px; }
.lcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.lcard-addr { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.lcard-meta { color: var(--muted); font-size: 12px; }
.lcard-price { font: 500 16px var(--font-num); text-align: right; }
.lcard-y { grid-column: 2; text-align: right; font-size: 12px; }
.lcard-y .num { font-weight: 500; }
.nolist { border: 1px dashed var(--line); border-radius: 10px; padding: 14px; color: var(--muted); font-size: 13px; }
.nolist code { font-family: var(--font-num); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.fine { font-size: 11.5px; color: var(--muted); line-height: 1.6; }

.foot {
  font-size: 11.5px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line);
  padding-block: 6px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* 手机：上下堆叠，整页滚动 */
@media (max-width: 820px) {
  body { height: auto; display: block; }
  .layout { flex-direction: column; }
  .map-wrap { height: 52vh; min-height: 300px; flex: none; }
  .panel { width: 100%; flex: none; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .list-head { position: static; flex-wrap: wrap; align-items: flex-start; }
  .list-head > div:first-child { flex: 1 1 180px; min-width: 0; }
  .sort-ctl { flex-wrap: wrap; }
  .legend { width: 170px; bottom: 22px; }
  .legend-ticks.aff { font-size: 10px; }
  .topbar { gap: 10px; }
  .lang, .dev-btn { order: 2; }
  .search { max-width: none; flex-basis: 100%; order: 3; }
  .filters { order: 4; flex-basis: 100%; position: relative; }
  .fwrap { position: static; }
  .fpop { left: 0; right: 0; width: auto; max-width: none; }
  .fpop.pad { min-width: 0; }
  .range-row select { width: 100%; }
  .range-row label { flex: 1; }
  .seg button { padding: 7px 6px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.seg.tbeds { flex-wrap: wrap; }
.seg.tbeds button { flex: 0 1 auto; }
.legend-note { font-size: 10.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.dev-btn {
  border: 1px dashed var(--accent); background: transparent; color: var(--accent);
  border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: 12.5px; white-space: nowrap; margin-left: auto;
}
.dev-btn + .lang { margin-left: 8px; }
.notice.dev { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--ink); }
/* 外部房源链接 */
.links { display: flex; flex-direction: column; gap: 8px; }
.links-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.links-row .kpi-label { width: 64px; flex: none; }
.ext {
  display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none; font-size: 13px; background: var(--surface);
}
.ext:hover { border-color: var(--accent); color: var(--accent); }
.rc-block { margin-top: 16px; }
/* 租还是买 */
.rvb { display: flex; flex-direction: column; gap: 12px; }
.rvb-years { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.rvb-years b { color: var(--ink); font-family: var(--font-num); }
.rvb-years input { flex: 1 1 100%; accent-color: var(--accent); }
.rvb-verdict { font-size: 15px; }
.rvb-verdict { color: var(--ink); }
.rvb-verdict.up b { color: var(--y-hi); }
.rvb-verdict.down b { color: var(--y-lo); }
.rvb-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.rvb-sub b { color: var(--ink); font-family: var(--font-num); font-weight: 500; }
.rvb-chart { width: 100%; height: auto; display: block; overflow: visible; }
/* 风险 */
.risks { display: flex; flex-wrap: wrap; gap: 8px; }
.risk { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 10px; border-radius: 8px; font-size: 13px; border: 1px solid var(--line); background: var(--surface); }
.risk b { font-weight: 600; }
.risk.lv4 b, .risk.lv5 b { color: var(--y-lo); }
.risk.lv4, .risk.lv5 { border-color: color-mix(in srgb, var(--y-lo) 45%, var(--line)); background: color-mix(in srgb, var(--y-lo) 8%, var(--surface)); }
.risk.lv1 b, .risk.lv2 b { color: var(--y-hi); }
.rule { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5; background: var(--surface-2); }
.rule b { margin-right: 6px; }
/* 对比页趋势 */
.cmp-trend { margin-top: 20px; }
.ct-range { margin: 8px 0; }
.ct-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; margin-bottom: 6px; }
.ct-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ct-legend i { width: 12px; height: 3px; border-radius: 2px; }
.ct-legend small { color: var(--muted); }
.ct-svg { display: block; width: 100%; height: auto; overflow: visible; }
/* 全局假设 */
.as-row { padding: 8px 16px; border-bottom: 1px solid var(--line); }
.fbtn.small { height: 28px; font-size: 12.5px; padding: 0 9px 0 11px; }
.as-pop { width: min(340px, calc(100vw - 32px)); }
.as-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.as-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.as-grid input { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: 14px var(--font-num); width: 100%; box-sizing: border-box; }
.rule.warnbox { background: color-mix(in srgb, var(--y-lo) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--y-lo) 35%, var(--line)); margin-top: 12px; }

/* ---------- 你的情况（主要功能） ---------- */
.you-btn { font-weight: 600; }
.you-btn:not(.on) { border-color: var(--accent); color: var(--accent); }
.you-pop { width: min(460px, calc(100vw - 32px)); }
.you-card {
  position: absolute; z-index: 30; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgb(0 0 0 / .18);
  padding: 22px 22px 18px;
}
.you-card h2 { margin: 0 28px 6px 0; font: 700 20px/1.3 var(--font-display); text-wrap: balance; }
.you-lead { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.you-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.you-form { display: flex; flex-direction: column; gap: 12px; }
.you-q { font-weight: 600; font-size: 13.5px; }
.you-goal button { flex: 1; padding: 8px 6px; }
.seg.small button { padding: 5px 8px; font-size: 12.5px; }
.you-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.you-hint { grid-column: 1 / -1; margin-top: -4px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.you-grid input::placeholder { font-family: var(--font-body); }
.you-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.you-grid input, .you-grid select {
  padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink);
  font: 15px var(--font-num); width: 100%; box-sizing: border-box;
}
.you-where { display: flex; flex-direction: column; gap: 5px; margin: 12px 0 10px; }
.you-where > label { font-size: 13px; font-weight: 700; color: var(--ink); }
.you-where > input, .you-rad select { padding: 9px 10px; border: 1.5px solid var(--accent); border-radius: 8px; background: var(--bg); color: var(--ink); font: 15px var(--font-body); width: 100%; min-width: 0; box-sizing: border-box; text-overflow: ellipsis; }
.you-where > input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.you-where-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.you-rad { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.you-rad select { width: auto; padding: 5px 8px; border: 1px solid var(--line); font: 13px var(--font-num); }
.you-where-hint { font-size: 12px; color: var(--muted); }
.you-loc { font-size: 12.5px; padding: 0; }
.you-loc:disabled { opacity: .6; cursor: progress; }
.you-hh { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.you-hh > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.you-grid input:focus, .you-grid select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.you-more summary { cursor: pointer; font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.you-err { margin: 0; color: var(--y-lo); font-size: 13px; }
.you-privacy { margin: 0; font-size: 12px; color: var(--muted); }
.you-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn-primary.small { padding: 6px 12px; font-size: 13px; }
/* 列表上方的结论 */
.you-box { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.you-box .you-goal { align-self: flex-start; }
.you-verdict { font-size: 14.5px; line-height: 1.45; }
.you-verdict b { font-family: var(--font-num); font-weight: 600; }
.you-by { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; background: var(--surface-2); color: var(--muted); }
.you-note, .you-fine { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.you-counts { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.you-counts b { color: var(--ink); font-family: var(--font-num); font-weight: 500; }
.you-counts span[class^="dot"] { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.dot2 { background: var(--y-hi); } .dot1 { background: var(--y-mid); } .dot0 { background: var(--muted); opacity: .6; }
/* 列表里的推荐理由 */
.zr-why { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; margin-top: 2px; }
.zr-why .ok { color: var(--ink); }
.zr-why .ok::before { content: "✓ "; color: var(--y-hi); font-weight: 700; }
.zr-why .warn { color: var(--muted); }
.zr-why .warn::before { content: "⚠ "; color: var(--y-lo); }
/* 详情页“对你来说” */
.for-you { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: 12px; padding: 14px; }
.for-you h3 { margin-top: 0; }
.you-who { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.aff-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.aff-tag.a2 { background: color-mix(in srgb, var(--y-hi) 18%, var(--surface)); color: var(--y-hi); }
.aff-tag.a1 { background: color-mix(in srgb, var(--y-mid) 22%, var(--surface)); color: var(--ink); }
.aff-tag.a0 { background: var(--surface-2); color: var(--muted); }
.you-why { list-style: none; padding: 0; margin: 10px 0 4px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.you-why .ok::before { content: "✓ "; color: var(--y-hi); font-weight: 700; }
.you-why .warn { color: var(--muted); }
.you-why .warn::before { content: "⚠ "; color: var(--y-lo); }
@media (max-width: 820px) {
  .you-card { position: fixed; top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-height: 88vh; border-radius: 16px 16px 0 0;
    padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .you-grid { grid-template-columns: 1fr; }
}
.pill.a1:not(.lc), .pill.a0:not(.lc) { color: var(--ink); }
.pill.a0:not(.lc) { background: var(--surface-2) !important; color: var(--muted); }
.legend-ticks.aff { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 4px; line-height: 1.2; font-family: var(--font-body); grid-template-columns: 1fr auto 1fr; }
.legend-ticks.aff > :first-child { text-align: left; }
.legend-ticks.aff > :last-child { text-align: right; }
.legend-ticks.aff span:first-child { text-align: left; } .legend-ticks.aff span:last-child { text-align: right; }
.pill.a0, .pill.a1, .pill.a2 { font: 600 12.5px var(--font-body); min-width: 86px; }
.pill.a0 small, .pill.a1 small, .pill.a2 small { font: 500 11px var(--font-num); }

/* ---------- 算账：每月账本 ---------- */
.you-budget { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 8px; margin: 8px 0 2px; font-size: 12px; }
.you-budget span { display: flex; flex-direction: column; line-height: 1.15; }
.you-budget small { color: var(--muted); font-size: 11px; }
.you-budget b { font: 700 14px var(--font-num); }
.you-budget span.neg b { color: var(--warn-ink); }
.you-budget i { font-style: normal; color: var(--muted); padding-bottom: 1px; }
.you-budget em { flex-basis: 100%; font-style: normal; color: var(--muted); font-size: 11px; }
.ledger { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ledger > summary { cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 6px; }
.ledger > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.ledger[open] > summary::before { transform: rotate(90deg); }
.ledger > summary::-webkit-details-marker, .lg-det > summary::-webkit-details-marker { display: none; }
.lg { padding: 0 12px 6px; }
.lg-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: 13px; }
.lg-row.lg-top { border-top: 0; }
.lg-l { min-width: 0; display: flex; flex-direction: column; }
.lg-l small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.lg-v { font: 600 13px var(--font-num); white-space: nowrap; text-align: right; }
.lg-row.lg-sub { padding-left: 14px; border-top-style: dashed; font-size: 12.5px; }
.lg-row.lg-sub .lg-v { font-weight: 500; color: var(--muted); }
.lg-row.lg-sum { border-top: 1.5px solid var(--ink); font-weight: 700; }
.lg-row.lg-sum .lg-v { font-weight: 800; font-size: 14px; }
.lg-row.lg-ok .lg-v { color: var(--y-hi); }
.lg-row.lg-warn .lg-v { color: var(--warn-ink); }
.lg-row.lg-bad .lg-v { color: var(--y-lo); }
.lg-det > summary { list-style: none; cursor: pointer; }
.lg-det > summary .lg-v::after { content: " ▸"; color: var(--muted); font-weight: 400; }
.lg-det[open] > summary .lg-v::after { content: " ▾"; }
.lg-h { margin: 12px 0 2px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.lg-src { margin: 0; padding: 8px 12px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.lg-row.lg-sum small { font-weight: 400; }
