/* 北京租房监控 · 前端样式
   目标：信息密度高但读得下去。房源页是长时间盯的页面，优先保证对比效率。 */

:root {
  --bg: #f5f4f1;
  --panel: #ffffff;
  --ink: #1f2328;
  --ink-2: #4b5563;
  --ink-3: #8b9199;
  --line: #e6e3dd;
  --line-2: #efedE8;
  --accent: #c1502e;
  --accent-soft: #fbf0eb;
  --ok: #2f7d4f;
  --ok-soft: #eaf4ee;
  --warn: #a06a00;
  --warn-soft: #fdf4e3;
  --bad: #b02a1c;
  --bad-soft: #fbebe8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.04), 0 4px 12px rgba(31, 35, 40, 0.04);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.app { display: flex; min-height: 100vh; }

/* ── 侧栏 ───────────────────────────────────────────── */
.side {
  width: 216px;
  flex: 0 0 216px;
  background: #1d2024;
  color: #d8dbdf;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 600;
  letter-spacing: 0;
}
.brand-title { font-size: 14px; font-weight: 600; color: #f2f4f6; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: #8b929b; margin-top: 1px; }

.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  font-size: 13.5px; color: #b9bec6;
  transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #eef1f4; }
.nav a.active { background: rgba(193,80,46,.18); color: #fff; }
.nav .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.nav a.active .dot { opacity: 1; background: var(--accent); box-shadow: 0 0 0 3px rgba(193,80,46,.25); }

.side-foot {
  margin-top: auto; padding: 14px 18px 18px;
  font-size: 11.5px; color: #7c838c; line-height: 1.7;
  border-top: 1px solid rgba(255,255,255,.07);
}
.side-foot b { color: #c8cdd4; font-weight: 500; }
.side-foot .pill {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: rgba(255,255,255,.08); color: #c8cdd4; font-size: 11px; margin-top: 6px;
}

/* ── 主区 ───────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 28px 14px;
}
.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: .3px; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.view { padding: 0 28px 40px; }

/* ── 通用块 ─────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--ink-3); }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.metric .k { font-size: 12px; color: var(--ink-3); }
.metric .v { font-size: 25px; font-weight: 600; letter-spacing: .5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.metric .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.metric.accent .v { color: var(--accent); }

/* ── 按钮 ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13px; transition: all .12s;
}
.btn:hover { border-color: #d5d0c7; color: var(--ink); background: #fbfaf8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ab4527; border-color: #ab4527; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f1eee9; }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 表单 ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
input[type=text], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: #cfc7ba; box-shadow: 0 0 0 3px rgba(193,80,46,.09); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b9199' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 26px; }

.range { display: flex; align-items: center; gap: 6px; }
.range span { color: var(--ink-3); font-size: 12px; }

/* ── 筛选栏 ─────────────────────────────────────────── */
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.filters .field.wide { grid-column: span 2; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.chip:hover { border-color: #d5d0c7; }
.chip.on { background: var(--accent-soft); border-color: #edc9bb; color: var(--accent); }

.searchbar { display: flex; gap: 8px; align-items: flex-end; }

/* ── 提示条 ─────────────────────────────────────────── */
.notice {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 13px; border-radius: 8px; font-size: 12.5px; line-height: 1.6;
  background: var(--warn-soft); color: var(--warn); border: 1px solid #f1e2c3;
}
.notice.info { background: #eef3fa; color: #2b5b96; border-color: #d9e4f2; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: #cfe5d8; }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: #f2d3cd; }
.notice + .notice { margin-top: 8px; }

.result-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 2px; font-size: 13px; color: var(--ink-2);
}
.result-line b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.result-line .sep { color: #d5d0c7; }

/* ── 房源卡 ─────────────────────────────────────────── */
.listing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.listing {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .14s, border-color .14s, transform .14s;
}
.listing:hover { box-shadow: 0 6px 20px rgba(31,35,40,.09); border-color: #dcd7ce; transform: translateY(-1px); }
.listing.unread { border-left: 3px solid var(--accent); }
.listing.fav { background: #fffdf8; }
.listing.removed { opacity: .62; }
.listing-img {
  position: relative; height: 132px; overflow: hidden;
  background: linear-gradient(135deg, #f1eee8 0%, #e6e1d7 100%);
  display: flex; align-items: flex-end;
}
/* 图床有防盗链：链家 CDN（image1.ljcdn.com）在「带外部 Referer」时直接 403，
 * 只在没有 Referer 时放行（实测 2026-11-16）。所以 img 上必须挂
 * referrerpolicy="no-referrer"（见 ui.js 的 listingCard），
 * 否则整页链家房源都只有渐变底色，看起来像「没有预览图」。
 * 兜底：真加载失败就露出渐变底，不留白块。 */
.listing-img img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.listing-img .price {
  position: relative; z-index: 1;
  margin: 0 0 8px 10px; padding: 2px 8px; border-radius: 6px;
  background: rgba(20,22,25,.78); color: #fff; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums; backdrop-filter: blur(2px);
}
.listing-img .price i { font-style: normal; font-size: 11px; font-weight: 400; opacity: .8; }
.listing-img .flags { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; z-index: 1; }
.badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 11px; line-height: 1.6; background: #f1eee9; color: var(--ink-2);
}
.badge.new { background: var(--accent); color: #fff; }
.badge.drop { background: var(--ok-soft); color: var(--ok); }
.badge.removed { background: #f1eee9; color: var(--ink-3); }
.badge.line { background: var(--accent-soft); color: var(--accent); }

/* 平台来源标签：两个平台的房源混在一个列表里，必须一眼分清 */
.src {
  display: inline-block; padding: 0 5px; border-radius: 3px;
  font-size: 11px; line-height: 1.7; font-weight: 600; letter-spacing: .2px;
  border: 1px solid transparent; vertical-align: 1px;
}
.src[data-src="lianjia"] { background: #eaf1fb; color: #2268b3; border-color: #cfe0f5; }
.src[data-src="5i5j"] { background: #fdeee6; color: #b3491a; border-color: #f7d5c4; }

.listing-body { padding: 11px 13px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.listing-title { font-size: 14px; font-weight: 600; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 标题也进详情页；全局 a 已经不带下划线，这里只补 hover 提示可点 */
.listing-title a:hover { color: var(--accent); }
.listing-meta { font-size: 12.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.listing-meta .none { color: var(--ink-3); }
.listing-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line-2);
  font-size: 11.5px; color: var(--ink-3);
}
.listing-acts { display: flex; gap: 2px; }
.icon-btn {
  border: 0; background: transparent; padding: 3px 6px; border-radius: 5px;
  font-size: 12px; color: var(--ink-3);
}
.icon-btn:hover { background: #f3f0eb; color: var(--ink); }
.icon-btn.on { color: var(--accent); }

/* ── 表格 ───────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
th { font-weight: 500; font-size: 12px; color: var(--ink-3); background: #fbfaf8; white-space: nowrap; }
tbody tr:hover { background: #fcfbf9; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ── 柱状图（纯 CSS，不引图表库）────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 118px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.bars .bar i {
  display: block; width: 100%; max-width: 46px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #d9805f, var(--accent)); min-height: 2px;
  transition: height .3s;
}
.bars .bar i.zero { background: #e9e6e0; }
.bars .bar em { font-size: 10.5px; color: var(--ink-3); font-style: normal; }
.bars .bar:hover i { filter: brightness(1.06); }

/* ── 折线趋势图（概览 · 在租存量）───────────────────── */
.trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
/* 每点的数值标签：白色描边压在折线上也读得清 */
.trend-svg .pt-val {
  fill: var(--ink-2); font-size: 10px; font-weight: 600;
  paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round;
}
.trend-svg .pt-val.is-last { fill: var(--ink); font-size: 10.5px; }

/* ── 双系列柱（新增 / 下架）─────────────────────────── */
/* .bars .bar i 默认 width:100%，两组并排必须收窄，否则会挤成一根 */
.bars.pair .bar .pair { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; height: 100%; }
.bars.pair .bar .pair i { width: 46%; max-width: 18px; min-width: 3px; border-radius: 3px 3px 0 0; position: relative; }
.bars.pair .bar .pair i.a { background: linear-gradient(180deg, #d9805f, var(--accent)); }
.bars.pair .bar .pair i.b { background: linear-gradient(180deg, #9fb2bf, #7c929f); }
.bars.pair .bar .pair i.zero { background: #e9e6e0; }
/* 柱顶数值：0 也照常显示，不然「当天没下架」和「当天没数据」看起来一样；
   算不出的那天（null）不标 0，直接空着 —— 两者含义不同 */
.bars.pair .bar .pair i b {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  margin-bottom: 2px; font-size: 10px; font-weight: 600; line-height: 1;
  color: var(--ink-2); white-space: nowrap; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.bars.pair .bar:hover .pair i b { color: var(--ink); }
.bars.pair .bar em { font-size: 10px; }

/* ── 图例 ───────────────────────────────────────────── */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* 趋势卡顶部三个数字 */
.stat-row { display: flex; gap: 22px; margin-bottom: 10px; flex-wrap: wrap; }
.stat-row > div { display: flex; flex-direction: column; gap: 2px; }
.stat-row .sub { font-size: 12px; color: var(--ink-3); }
.stat-row b { font-size: 19px; font-weight: 600; line-height: 1.2; }

/* ── 状态点 ─────────────────────────────────────────── */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.state.ok::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(47,125,79,.14); }
.state.warn::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(160,106,0,.14); }
.state.bad::before { background: var(--bad); box-shadow: 0 0 0 3px rgba(176,42,28,.14); }

/* ── 空状态 / 加载 ──────────────────────────────────── */
.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty b { display: block; color: var(--ink-2); font-size: 14px; margin-bottom: 4px; font-weight: 500; }
.loading { padding: 60px; text-align: center; color: var(--ink-3); }
.skel { height: 14px; border-radius: 4px; background: linear-gradient(90deg,#f0eee9,#f7f6f2,#f0eee9); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── 方案卡片 ───────────────────────────────────────── */
.profile { padding: 15px 18px; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.profile-tags .t { font-size: 12px; color: var(--ink-2); background: #f7f5f1; border: 1px solid var(--line-2); border-radius: 5px; padding: 2px 8px; }
.profile-tags .t em { font-style: normal; color: var(--ink-3); margin-right: 3px; }
.switch { position: relative; width: 36px; height: 20px; flex: 0 0 36px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #ddd9d2; transition: background .16s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .16s; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }

/* ── 三级联动（推送范围）───────────────────────────── */
.scope-step { display: grid; grid-template-columns: 178px 1fr; gap: 14px; padding: 15px 0; border-bottom: 1px dashed var(--line-2); }
.scope-step:last-of-type { border-bottom: 0; }
.scope-step .lbl { font-size: 13px; font-weight: 500; padding-top: 5px; }
.scope-step .lbl small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; line-height: 1.5; }
.scope-preview {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px;
  background: #fbfaf8; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); line-height: 1.8;
}
.scope-preview b { color: var(--ink); }

.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 10px; border-radius: 6px; font-size: 12.5px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid #edc9bb;
}
.tag button { border: 0; background: transparent; color: inherit; opacity: .6; padding: 0 2px; font-size: 13px; line-height: 1; }
.tag button:hover { opacity: 1; }
.tag-input input, .tag-input select { width: auto; min-width: 130px; flex: 0 1 auto; }

/* ── 房源详情 ─────────────────────────────────────── */
.detail-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.detail-bar .btn.primary { margin-left: auto; }
.detail-hero { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; padding: 18px; }
/* 图片区是「主图 + 缩略图条」的竖排，不能再固定 4/3 的比例（那会把缩略图挤没） */
.detail-photo { position: relative; display: flex; flex-direction: column; gap: 6px; }
.photo-main {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in;
  border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #efece6, #e2ddd3);
}
.photo-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-main.broken { background: #f2efe9; }
.photo-main.broken img { visibility: hidden; }
.photo-count {
  position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .58); color: #fff; font-size: 11px; letter-spacing: .4px;
}
.photo-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.photo-thumbs button {
  position: relative; padding: 0; border: 0; cursor: zoom-in; border-radius: 6px; overflow: hidden;
  aspect-ratio: 4 / 3; background: #eee;
}
.photo-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumbs .more-btn span {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px; letter-spacing: .5px;
}
.photo-empty {
  display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 10px;
  background: linear-gradient(135deg, #efece6, #e2ddd3); font-size: 13px;
}
.detail-flags { position: absolute; top: 10px; left: 10px; display: flex; gap: 5px; pointer-events: none; }
.detail-main { min-width: 0; }
.detail-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .2px; }
.detail-sub { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.detail-price {
  font-size: 27px; font-weight: 600; color: var(--accent); margin-top: 10px;
  letter-spacing: .5px; font-variant-numeric: tabular-nums;
}
.detail-price i { font-style: normal; font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.detail-drop { font-size: 12px; font-weight: 400; color: var(--ok); margin-left: 8px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; margin: 16px 0 0; }
.detail-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.detail-row dt { width: 92px; flex: none; color: var(--ink-3); white-space: nowrap; }
.detail-row dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.inline-link { color: var(--accent); text-decoration: none; white-space: nowrap; }
.inline-link:hover { text-decoration: underline; }
.detail-fac { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail-fac span {
  font-size: 12px; color: var(--ink-2); padding: 2px 8px; border-radius: 999px;
  background: #f4f2ee; border: 1px solid var(--line-2);
}
.detail-acts { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ── 全屏看图 ─────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 10, .97); padding: 28px;
}
.lightbox .lb-img {
  max-width: min(1180px, 92vw); max-height: 86vh; object-fit: contain;
  border-radius: 4px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); background: #111;
}
.lightbox button {
  position: absolute; border: 0; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .1);
  border-radius: 999px; display: grid; place-items: center; line-height: 1; transition: background .15s;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .35);
}
.lightbox button:hover { background: rgba(255, 255, 255, .22); }
.lb-close { top: 16px; right: 18px; width: 36px; height: 36px; font-size: 16px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 28px; padding-bottom: 4px; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }
.lb-count {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: rgba(255, 255, 255, .82); font-size: 12px; letter-spacing: 1px;
}

/* ── 响应式 ─────────────────────────────────────────── */
@media (max-width: 1280px) {
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: static; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0 10px 10px; }
  .nav a { white-space: nowrap; }
  .side-foot { display: none; }
  .topbar, .view { padding-left: 16px; padding-right: 16px; }
  .filters, .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .listing-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scope-step { grid-template-columns: 1fr; gap: 8px; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* 窄屏放不下 14 组 × 2 个数字（每组不到 30px），柱顶数值会互相压住。
   手机上宁可不标，也不要糊成一团 —— hover 的 title 和卡片上的合计数字还在。 */
@media (max-width: 760px) {
  .bars.pair .bar .pair i b { display: none; }
  .trend-svg .pt-val { font-size: 9px; }
}
