/* ============================================================
   重点ETF资金看板 — 样式
   设计基调：金融终端式浅色不动产（与看板数据密度匹配）
   令牌：背景 #f4f6f9 / 卡片 #fff / 发丝线 #e4e8ee / 墨 #1b2430
   语义色遵循 A 股习惯：红=净申购/上涨，绿=净赎回/下跌
   ============================================================ */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --line: #e4e8ee;
  --line-strong: #d4dae4;
  --text: #1b2430;
  --muted: #5c6a7a;
  --faint: #8593a3;
  --red: #d93630;
  --green: #0aa06e;
  --blue: #2b5fd9;
  --amber: #f0b429;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(27, 36, 48, .04), 0 8px 24px rgba(27, 36, 48, .04);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  padding: 0 16px 40px;
  scroll-behavior: smooth;
}
a { color: inherit; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  margin: 0 -16px 18px;
  padding: 0 16px;
  background: rgba(244, 246, 249, .86);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 22px;
  height: 58px;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand .mark {
  font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .14em;
  color: var(--text);
}
.brand .mark::after { content: ""; display: inline-block; width: 6px; height: 6px;
  background: var(--red); margin-left: 6px; vertical-align: 2px; }
.brand .name { font-size: 13px; color: var(--muted); }
.topnav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  text-decoration: none; font-size: 12.5px; color: var(--muted);
  padding: 6px 10px; border-radius: var(--radius-sm); white-space: nowrap;
}
.topnav a:hover { background: #e9edf3; color: var(--text); }
.topbar .back { font-size: 12px; color: var(--faint); text-decoration: none; white-space: nowrap; }
.topbar .back:hover { color: var(--text); }

.wrap { max-width: 1180px; margin: 0 auto; }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.page-head .lede { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.page-head .lede b { font-weight: 600; color: var(--text); }

/* ---------- 区块 ---------- */
.part { margin-top: 34px; scroll-margin-top: 74px; }
.part-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.part-head .num {
  font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .08em;
}
.part-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.005em; }
.part-head .desc { font-size: 12.5px; color: var(--muted); width: 100%; margin-top: 3px; }
.part-head .desc em { font-style: normal; color: var(--text); font-weight: 500; }
.part-rule { height: 1px; background: var(--line); margin: 12px 0 14px; }

/* ---------- 状态条 ---------- */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.tag {
  background: #e9edf3; border-radius: 4px; padding: 3px 9px;
  font-variant-numeric: tabular-nums;
}
.tag.ok { background: #e6f6ef; color: #0a7a54; }
.tag.err { background: #fdeceb; color: #b0342c; }
.tag.live { background: #e6f6ef; color: #0a7a54; }
.tag.warn { background: #fff4e0; color: #906000; }
.tag.ghost { background: transparent; border: 1px solid var(--line-strong); }
button, .btn {
  font: inherit; font-size: 12px; padding: 5px 11px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover { background: #eef1f6; border-color: #c3ccd8; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}

/* ---------- 卡片 / 图表 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px 10px; margin-bottom: 14px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: baseline; gap: 8px; }
.card-title .hint { font-size: 11.5px; color: var(--faint); font-weight: 400; }
.chart { width: 100%; height: 400px; }
#chart { height: 360px; }
#chartCum, #chartBroad { height: 340px; }
#chartAmt, #chartNf, #chartDAmt, #chartDNf { height: 380px; }
.cum-pick { display: flex; align-items: center; gap: 8px; padding: 0 2px 8px; font-size: 12px; color: var(--muted); }
.cum-pick select {
  font: inherit; font-size: 12px; padding: 4px 8px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}

/* 区间框选求和 */
.chart-holder { position: relative; }
.brush-band { position: absolute; display: none; pointer-events: none; z-index: 4;
  background: rgba(240, 180, 41, .16); border-left: 1px solid #b07a1a; border-right: 1px solid #b07a1a; }
.brush-tip { position: absolute; display: none; pointer-events: none; z-index: 6;
  transform: translateX(-50%); white-space: nowrap;
  background: rgba(255, 255, 255, .97); border: 1px solid #e0c48a; border-radius: 4px;
  padding: 4px 10px; font-size: 12px; color: #8a5a00; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }

/* ---------- 表格 ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px 6px; margin-top: 14px; }
.table-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.table-card .sub { font-size: 11.5px; color: var(--faint); margin-bottom: 8px; }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 12px;
  font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #eef1f5; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; border-bottom-color: var(--line-strong); }
td.num, th.num { text-align: right; }
tbody tr:hover { background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }
.up { color: var(--red); }
.down { color: var(--green); }
.pct-cell { border-radius: 3px; color: var(--text); font-weight: 500; }
.amt-cell { position: relative; text-align: right; }
.amt-bg { position: absolute; top: 3px; bottom: 3px; left: 0; background: #eef2fa; z-index: 0; }
.amt-val { position: relative; z-index: 1; }
.rank { color: var(--faint); font-family: var(--mono); font-size: 11px; }
.rank.top { color: var(--text); font-weight: 700; }

/* ---------- 页脚 ---------- */
footer.foot {
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--faint); line-height: 1.9;
}
footer.foot .disclaimer { color: var(--muted); }

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
  body { padding: 0 12px 32px; }
  .topbar { margin: 0 -12px 14px; padding: 0 12px; }
  .topbar-in { height: 52px; gap: 12px; }
  .brand .name { display: none; }
  .page-head h1 { font-size: 18px; }
  .chart, #chart, #chartCum, #chartAmt, #chartNf, #chartDAmt, #chartDNf, #chartBroad { height: 280px; }
  .card { padding: 12px 12px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
