/* ============================================================
   济南市房产信息查询系统 — 统一设计系统（UI Designer 重构）
   设计令牌 → 顶栏 / 子菜单 / 统计 / 筛选 / 房源卡片 / 弹窗 / 贷款 / AI / 趋势 / 页脚
   注意：仅重构视觉层，所有 JS 依赖的 class / id 均保持不变。
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 品牌色 */
  --brand-900: #0f2440;
  --brand-800: #16304d;
  --brand-700: #1e3a5f;   /* 主色 */
  --brand-600: #24527f;
  --brand-500: #2c5282;
  --accent:    #2563eb;   /* 交互强调 */
  --accent-soft: #eaf1fd;

  /* 中性色 */
  --bg:        #eef1f5;
  --surface:   #ffffff;
  --surface-2: #f7f9fc;
  --border:    #e6eaf0;
  --border-strong: #d4dbe6;
  --text:      #1f2937;
  --text-2:    #475569;
  --text-3:    #94a3b8;

  /* 语义色 */
  --success: #16a34a;
  --warning: #f59e0b;
  --danger:  #dc2626;

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* 阴影 */
  --sh-sm: 0 1px 2px rgba(15,23,42,.06);
  --sh-md: 0 4px 14px rgba(15,23,42,.08);
  --sh-lg: 0 12px 32px rgba(15,23,42,.12);

  /* 间距 */
  --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); height: 100vh; display: flex; flex-direction: column; }

.hidden { display: none !important; }

/* ---------- 主滚动容器 ---------- */
.page-scroll { flex: 1; overflow-y: auto; background: var(--bg); min-height: 0; height: calc(100vh - 116px); }

/* ---------- 顶栏：品牌化头部 ---------- */
.topbar {
  position: relative;
  height: 64px;
  background: linear-gradient(120deg, var(--brand-900) 0%, var(--brand-700) 55%, var(--brand-600) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-md);
  padding: 0 20px;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.topbar h1 {
  font-size: 24px; font-weight: 800; letter-spacing: 3px; color: #fff;
  text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.topbar .brand-tag {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
  padding: 5px 12px; border-radius: var(--r-pill); white-space: nowrap;
}
@media (max-width: 640px) { .topbar .brand-tag { display: none; } .topbar h1 { font-size: 19px; letter-spacing: 1px; } }

/* ---------- 子菜单（图标导航） ---------- */
.subnav {
  height: 52px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 6px; box-shadow: var(--sh-sm);
}
.subnav .sub {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; background: transparent; font-size: 14px; font-weight: 500;
  color: var(--text-2); padding: 8px 16px; border-radius: 10px; cursor: pointer;
  transition: all .18s;
}
.subnav .sub:hover { color: var(--brand-700); background: var(--surface-2); }
.subnav .sub.active { background: var(--brand-700); color: #fff; box-shadow: var(--sh-sm); }
.sub-ico { width: 18px; height: 18px; flex: none; color: var(--brand-600); transition: color .18s; }
.subnav .sub.active .sub-ico { color: #fff; }

/* ---------- 房源信息视区 ---------- */
#houseView { height: 100%; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }

/* 统计概览（已合并到房价趋势视图，整体更紧凑） */
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 12px 0 4px; max-width: 900px; }
.trend-bottom .stats-bar { margin: 0 auto 14px; }
.stat-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 10px 12px 10px 16px;
  display: flex; flex-direction: column; gap: 1px; box-shadow: var(--sh-sm); overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--brand-600), var(--accent)); }
.stat-ico { width: 18px; height: 18px; color: var(--brand-600); margin-bottom: 4px; }
.stat-label { font-size: 11px; color: var(--text-3); }
.stat-value { font-size: 22px; font-weight: 800; color: var(--brand-900); line-height: 1.15; }
.stat-unit { font-size: 11px; color: var(--text-3); }

/* 工具栏 + 筛选 */
.house-toolbar { flex: none; background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 24px; box-shadow: var(--sh-sm); }
.house-toolbar .search-box {
  display: flex; max-width: 780px; border: 1.5px solid var(--brand-600);
  border-radius: var(--r-md); overflow: hidden; background: #fff; box-shadow: var(--sh-sm);
}
.house-toolbar .search-box input { flex: 1; border: none; padding: 11px 14px; font-size: 14px; outline: none; background: transparent; font-family: var(--font); }
.house-toolbar .search-box button { background: var(--brand-700); color: #fff; border: none; padding: 0 22px; font-size: 14px; cursor: pointer; transition: background .2s; }
.house-toolbar .search-box button:hover { background: var(--brand-600); }
.house-toolbar .reset-btn { background: var(--surface-2) !important; color: var(--text-2) !important; border-left: 1px solid var(--border) !important; padding: 0 16px !important; }
.house-toolbar .reset-btn:hover { background: #eef2f7 !important; }

.filter-bar { margin-top: 14px; }
.filter-primary { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.filter-block { display: flex; align-items: center; gap: 10px; }
.filter-label { flex: none; font-size: 13px; color: var(--text-2); font-weight: 600; min-width: 42px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-advanced { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 14px 30px; }

/* chip（位置/房型/AI 通用） */
.chip {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  font-size: 13px; padding: 6px 14px; border-radius: var(--r-pill); cursor: pointer;
  transition: all .15s; white-space: nowrap; font-family: var(--font);
}
.chip:hover { border-color: var(--brand-600); color: var(--brand-700); }
.chip.active { background: var(--accent-soft); border-color: var(--brand-600); color: var(--brand-700); font-weight: 600; }

/* checkbox 组（朝向/楼层/标签） */
.filter-group label {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2);
  background: #fff; border: 1px solid var(--border-strong); padding: 5px 12px; border-radius: var(--r-pill);
  cursor: pointer; transition: all .15s;
}
.filter-group label:hover { border-color: var(--brand-600); color: var(--brand-700); }
.filter-group input[type=checkbox] { accent-color: var(--brand-600); width: 14px; height: 14px; }
.filter-group input[type=checkbox]:checked + span { color: var(--brand-700); font-weight: 600; }

/* 区间输入 */
.range-fields { display: flex; align-items: center; gap: 8px; }
.range-fields input { width: 110px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 13px; outline: none; background: #fff; font-family: var(--font); }
.range-fields input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 2px rgba(30,58,95,.12); }
.range-sep { color: var(--text-3); }

/* 更多筛选按钮 */
.more-toggle {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
  border: 1px dashed var(--border-strong); background: var(--surface-2); color: var(--brand-700);
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: var(--r-sm); cursor: pointer; transition: all .15s;
}
.more-toggle:hover { border-color: var(--brand-600); background: var(--accent-soft); }
.more-toggle .chev { transition: transform .2s; }
.more-toggle.open .chev { transform: rotate(180deg); }

/* 收藏 / 活动筛选 */
.filter-actions { align-items: center; }
.fav-toggle { border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); padding: 7px 14px; border-radius: var(--r-pill); font-size: 13px; cursor: pointer; transition: all .15s; font-family: var(--font); }
.fav-toggle:hover { border-color: var(--brand-600); color: var(--brand-700); }
.fav-toggle.active { background: #fff7ed; border-color: #dd6b20; color: #c05621; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; margin-left: 8px; }
.af-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--brand-700); border: 1px solid #cfe0f5; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; }
.af-chip b { cursor: pointer; font-weight: 700; color: #94a3b8; }
.af-chip b:hover { color: var(--danger); }

/* 常驻操作行（收藏 + 活动筛选标签） */
.filter-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* 地图 + 列表布局：Grid 确保左右两列严格填满剩余高度，互不撑开 */
.house-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 56% 1fr; }
.house-map-col { position: relative; min-height: 0; height: 100%; display: flex; flex-direction: column; background: #e8eaed; border-right: 1px solid var(--border); overflow: hidden; }
.house-map-col .map { flex: 1; position: relative; min-height: 0; height: 100%; }
.map-legend { flex: none; display: flex; align-items: center; gap: 8px; background: var(--surface); border-top: 1px solid var(--border); padding: 8px 14px; font-size: 12px; color: var(--text-3); }
.map-legend .bar { height: 10px; width: 160px; border-radius: 5px; background: linear-gradient(90deg, rgb(104,159,56), rgb(173,196,70), rgb(244,196,48), rgb(237,125,49), rgb(214,69,65)); }
.map-legend #legendRange { color: var(--text); font-weight: 600; }

.house-list-col { position: relative; min-height: 0; height: 100%; overflow-y: auto; background: var(--bg); }
.house-list-col .listing-grid { padding: 16px 16px 0; }

/* 排序栏 */
.sort-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; gap: 12px; flex-wrap: wrap; }
.sort-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.sort-tabs button { border: none; background: transparent; padding: 8px 14px; font-size: 14px; color: var(--text-2); cursor: pointer; position: relative; font-family: var(--font); white-space: nowrap; }
.sort-tabs button.active { color: var(--brand-700); font-weight: 600; }
.sort-tabs button.active::after { content: ""; position: absolute; bottom: -1px; left: 16px; right: 16px; height: 2px; background: var(--brand-700); }
.result-count { font-size: 14px; color: var(--text-2); }
.result-count b { color: var(--brand-700); font-size: 18px; margin: 0 2px; }

/* 房源卡片 */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.listing-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  transition: box-shadow .2s, transform .12s, border-color .2s;
}
.listing-card:hover { box-shadow: var(--sh-lg); transform: translateY(-3px); border-color: #c9d6e6; }
.card-img {
  position: relative; height: 128px; overflow: hidden;
  background: radial-gradient(120% 120% at 80% 0%, #2c5282 0%, #1e3a5f 55%, #16304d 100%);
}
.card-img::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(135deg, rgba(255,255,255,.07) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.07) 75%, transparent 75%);
  background-size: 18px 18px;
}
.card-img span {
  position: absolute; left: 12px; top: 12px; background: rgba(15,23,42,.5); color: #fff;
  font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: var(--r-pill); backdrop-filter: blur(2px);
}
.card-body { padding: 12px 14px 14px; }
.card-title { font-size: 15px; color: var(--text); font-weight: 700; line-height: 1.4; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-loc { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 0; }
.ltag { font-size: 11px; padding: 2px 7px; border-radius: 4px; background: var(--surface-2); color: var(--text-3); }
.ltag.muted { color: #b6c0cc; }
.card-meta { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--surface-2); padding-top: 10px; }
.card-price { color: var(--danger); font-size: 20px; font-weight: 800; }
.card-price small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.card-unit { font-size: 12px; color: var(--text-3); }

.fav-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.92); color: #cbd5e1;
  font-size: 16px; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .1s, color .15s;
}
.fav-btn:hover { transform: scale(1.1); }
.fav-btn.on { color: #f6a609; }
.fav-btn.big { position: static; width: 40px; height: 40px; font-size: 22px; box-shadow: none; background: var(--surface-2); }

/* 骨架屏 */
.listing-card.skel { cursor: default; }
.skel-img { height: 128px; background: #eef1f4; }
.skel-body { padding: 12px 14px; }
.skel-line { height: 12px; background: #eef1f4; border-radius: 4px; margin-bottom: 8px; animation: shimmer 1.2s infinite; }
.skel-line.w40 { width: 40%; } .skel-line.w50 { width: 50%; } .skel-line.w70 { width: 70%; } .skel-line.w90 { width: 90%; }
@keyframes shimmer { 0% { opacity: .55; } 50% { opacity: 1; } 100% { opacity: .55; } }

/* 分页 / 空态 */
.pagination { display: flex; justify-content: center; gap: 8px; padding: 12px 0 24px; flex-wrap: wrap; }
.pagination button { min-width: 34px; height: 34px; border: 1px solid var(--border-strong); background: #fff; border-radius: var(--r-sm); font-size: 13px; cursor: pointer; color: var(--text-2); transition: all .15s; font-family: var(--font); }
.pagination button:hover:not(:disabled) { border-color: var(--brand-600); color: var(--brand-700); }
.pagination button.active { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.pagination button:disabled { color: #d1d5db; cursor: not-allowed; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ---------- 详情弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { position: relative; width: 100%; max-width: 560px; background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-lg); max-height: 86vh; overflow-y: auto; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.modal-close { position: absolute; top: 10px; right: 12px; z-index: 4; border: none; background: transparent; font-size: 26px; line-height: 1; color: var(--text-3); cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px 24px 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-right: 30px; }
.modal-title { font-size: 18px; font-weight: 800; color: var(--text); }
.modal-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.modal-price { margin: 14px 0; color: var(--danger); font-size: 22px; font-weight: 800; }
.modal-price .modal-unit { font-size: 13px; color: var(--text-3); font-weight: 400; margin-left: 8px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; background: var(--surface-2); border-radius: var(--r-md); padding: 14px 16px; }
.modal-grid > div { display: flex; flex-direction: column; }
.modal-grid span { font-size: 12px; color: var(--text-3); }
.modal-grid b { font-size: 14px; color: var(--text); font-weight: 600; }
.modal-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.modal-tags-label { font-size: 12px; color: var(--text-3); }
.modal-tip { font-size: 12px; color: var(--text-3); margin-top: 14px; line-height: 1.6; }

/* ---------- 返回顶部 / 页脚 ---------- */
.back-top { position: fixed; right: 24px; bottom: 28px; z-index: 60; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--brand-700); color: #fff; font-size: 20px; cursor: pointer; box-shadow: var(--sh-md); transition: transform .15s, background .15s; }
.back-top:hover { background: var(--brand-600); transform: translateY(-2px); }
.site-footer { background: var(--brand-900); color: #cbd5e1; padding: 22px 24px; }
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-title { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.footer-note { font-size: 12px; line-height: 1.7; color: #94a3b8; margin: 0; }

/* ---------- 房价趋势（页面底部） ---------- */
.trend-bottom { padding: 24px 24px 48px; background: var(--bg); border-top: 2px solid var(--border); }
.trend-bottom .section-title { font-size: 18px; color: var(--text); margin-bottom: 6px; }

/* ---------- 贷款计算器 ---------- */
#loanView { min-height: calc(100vh - 116px); background: var(--bg); }
.loan-wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px 40px; }
.loan-head { margin-bottom: 18px; }
.loan-head .section-title { font-size: 20px; color: var(--text); }
.loan-sub { color: var(--text-2); font-size: 13px; margin-top: 6px; line-height: 1.6; }
.loan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.loan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px 22px; box-shadow: var(--sh-sm); }
.loan-card h3 { font-size: 15px; color: var(--brand-700); margin-bottom: 16px; border-left: 3px solid var(--brand-700); padding-left: 8px; }

.form-row { margin-bottom: 16px; }
.form-row > label { display: block; font-size: 13px; color: var(--text); margin-bottom: 7px; font-weight: 600; }
.form-row .hint { color: var(--text-3); font-weight: 400; font-size: 12px; margin-left: 6px; }
.chk-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400 !important; cursor: pointer; }
.chk-label input { width: auto; }

.loan-card input[type="number"], .loan-card select { width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 14px; color: var(--text); background: #fff; box-sizing: border-box; font-family: var(--font); }
.loan-card input[type="number"]:focus, .loan-card select:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 2px rgba(30,58,95,.12); }
.down-wrap { display: flex; align-items: center; gap: 12px; }
.down-wrap input[type="range"] { flex: 1; accent-color: var(--brand-600); }
.down-wrap output { font-weight: 600; color: var(--brand-700); min-width: 42px; text-align: right; }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn { border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); font-size: 13px; padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer; transition: all .15s; font-family: var(--font); }
.seg-btn:hover { border-color: var(--brand-600); color: var(--brand-700); }
.seg-btn.active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }

.combo-fields { border-top: 1px dashed var(--border); padding-top: 14px; margin-top: 4px; }
.rate-fields { display: flex; flex-direction: column; gap: 10px; }
.rate-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.rate-field span { min-width: 84px; }
.rate-field input { width: 110px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 14px; font-family: var(--font); }

.loan-result .result-hero { background: linear-gradient(135deg, var(--brand-700), var(--brand-500)); color: #fff; border-radius: var(--r-md); padding: 18px 20px; margin-bottom: 18px; }
.result-hero .hero-label { font-size: 13px; opacity: .85; }
.result-hero .hero-value { font-size: 30px; font-weight: 800; margin-top: 4px; }
.result-hero .hero-value small { font-size: 14px; font-weight: 400; opacity: .8; margin-left: 6px; }
.result-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.result-kv > div { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; }
.result-kv span { display: block; font-size: 12px; color: var(--text-3); }
.result-kv b { font-size: 16px; color: var(--text); }
.result-rates { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-rate { background: var(--accent-soft); color: var(--brand-700); font-size: 12px; padding: 5px 10px; border-radius: var(--r-pill); }
.chip-rate b { font-weight: 700; }
.result-cmp { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 14px; }
.result-cmp .cmp-title { font-size: 12px; color: #15803d; }
.result-cmp .cmp-val { font-size: 14px; color: #166534; margin-top: 4px; }
.result-cmp .cmp-val b { font-size: 16px; }
.result-cmp .cmp-sub { font-size: 12px; color: #4b7c52; margin-top: 4px; }
.result-warn { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; font-size: 13px; border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px; }
.amort { margin-top: 6px; }
.amort summary { cursor: pointer; font-size: 13px; color: var(--brand-700); padding: 8px 0; user-select: none; }
.amort-box { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.amort table { width: 100%; border-collapse: collapse; font-size: 12px; }
.amort th, .amort td { padding: 7px 10px; text-align: right; border-bottom: 1px solid #f0f0f0; }
.amort th:first-child, .amort td:first-child { text-align: left; }
.amort thead th { background: var(--surface-2); color: var(--text-3); position: sticky; top: 0; }
.amort-total td { font-weight: 700; background: var(--surface-2); }
.loan-foot { margin-top: 22px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.loan-foot b { color: var(--brand-700); }

@media (max-width: 860px) { .loan-grid { grid-template-columns: 1fr; } }

/* ---------- AI 选房小助手 ---------- */
#aiView { padding: 16px 18px 28px; min-height: calc(100vh - 116px); background: var(--bg); }
.ai-head { margin-bottom: 12px; }
.ai-head h2 { font-size: 20px; color: var(--brand-700); margin-bottom: 4px; }
.ai-head p { color: var(--text-2); font-size: 13px; line-height: 1.6; max-width: 880px; }
.ai-form { background: var(--surface); border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--sh-sm); margin-bottom: 16px; }
.ai-form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ai-form-row > label { width: 96px; color: var(--text); font-size: 14px; font-weight: 600; flex: none; }
.ai-form-row .hint-inline { color: var(--text-3); font-size: 12px; }
.ai-form input[type=number] { width: 170px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 14px; font-family: var(--font); }
.ai-form input[type=number]:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(30,58,95,.12); }
.ai-form select { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 14px; font-family: var(--font); }
.ai-actions { display: flex; gap: 12px; margin-top: 6px; }
.btn-primary { background: var(--brand-700); color: #fff; border: none; padding: 10px 24px; border-radius: var(--r-sm); font-size: 15px; cursor: pointer; transition: background .15s; font-family: var(--font); }
.btn-primary:hover { background: var(--brand-800); }
.btn-ghost { background: #fff; color: var(--brand-700); border: 1px solid var(--border-strong); padding: 10px 18px; border-radius: var(--r-sm); font-size: 15px; cursor: pointer; font-family: var(--font); }
.btn-ghost:hover { background: var(--surface-2); }

.ai-summary { background: var(--accent-soft); border-left: 4px solid var(--brand-700); padding: 12px 16px; border-radius: var(--r-sm); color: var(--brand-700); font-size: 14px; margin-bottom: 16px; line-height: 1.6; }
.ai-winners { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.ai-winner { background: var(--surface); border-radius: var(--r-md); padding: 14px; box-shadow: var(--sh-sm); cursor: pointer; border-top: 3px solid var(--brand-700); transition: .15s; }
.ai-winner:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.ai-winner-head { font-weight: 700; color: var(--brand-700); margin-bottom: 8px; font-size: 15px; }
.ai-winner-title { font-size: 14px; color: var(--text); margin-bottom: 4px; font-weight: 600; line-height: 1.4; }
.ai-winner-loc { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }

.ai-list { display: flex; flex-direction: column; gap: 10px; }
.ai-card { background: var(--surface); border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 14px; box-shadow: var(--sh-sm); cursor: pointer; transition: .15s; align-items: center; }
.ai-card:hover { box-shadow: var(--sh-md); }
.ai-card-main { flex: 1; min-width: 0; }
.ai-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ai-card .fav-btn { position: static; top: auto; right: auto; width: 28px; height: 28px; font-size: 16px; background: var(--surface-2); box-shadow: none; flex: none; }
.ai-card-title { font-weight: 600; color: var(--text); font-size: 15px; line-height: 1.4; }
.ai-card-loc { color: var(--text-2); font-size: 12px; margin: 4px 0 8px; }
.ai-card-meta { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.ai-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-reason { background: var(--accent-soft); color: var(--brand-700); font-size: 12px; padding: 3px 9px; border-radius: var(--r-pill); }
.ai-scores { display: flex; flex-direction: column; gap: 6px; flex: none; }
.score-pill { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 56px; height: 46px; border-radius: var(--r-sm); }
.score-pill span { font-size: 11px; color: var(--text-2); }
.score-pill b { font-size: 18px; color: var(--text); }
.score-pill.suit { background: #e6f0ff; }
.score-pill.value { background: #e9f7ef; }
.score-pill.ret { background: #fef3e2; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .page-scroll { height: auto; }
  #houseView { height: auto; min-height: calc(100vh - 116px); }
  .stats-bar { grid-template-columns: repeat(2, 1fr); padding: 10px 14px 4px; max-width: none; }
  .stat-value { font-size: 18px; }
  .house-layout { grid-template-columns: 1fr; grid-template-rows: 50vh auto; }
  .house-map-col { width: auto; height: 100%; }
  .house-list-col { overflow: visible; height: auto; }
  .listing-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .site-footer { padding: 18px 14px; }
  .sort-bar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 10px 14px; }
  .ai-winners { grid-template-columns: 1fr; }
  .ai-form-row > label { width: auto; }
  .ai-card { flex-direction: column; align-items: stretch; }
  .ai-card .fav-btn { align-self: flex-end; }
  .ai-scores { flex-direction: row; justify-content: flex-start; }
}
