/* ============ 设计令牌（浅色 / 深色自动切换） ============ */
:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --card: #ffffff;
  --fill: #f2f2f7;
  --fill-2: #e8e8ed;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --sep: rgba(60, 60, 67, .12);
  --blue: #0071e3;
  --blue-tint: rgba(0, 113, 227, .10);
  --up: #248a3d;
  --down: #d70015;
  --warn-bg: #fff7e0;
  --warn-text: #7a5200;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .05);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, .18);
  --nav: rgba(245, 245, 247, .72);
  --overlay: rgba(0, 0, 0, .25);
  /* 标签：已通过 dataviz 校验的分类色前 5 位 + 中性灰（弱疑似） */
  --tag-0: #2a78d6; --tag-1: #eb6834; --tag-2: #1baf7a; --tag-3: #eda100; --tag-4: #e87ba4; --tag-5: #8e8e93;
  --tag-ink-3: #0b0b0b;
  /* 图表 */
  --viz-1: #2a78d6;
  --viz-wash: rgba(42, 120, 214, .10);
  --viz-grid: #e8e8ed;
  --viz-axis: #c7c7cc;
  --viz-muted: #8e8e93;
  --radius: 18px;
  --radius-sm: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --card: #1c1c1e;
    --fill: #2c2c2e;
    --fill-2: #3a3a3c;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --sep: rgba(84, 84, 88, .55);
    --blue: #2997ff;
    --blue-tint: rgba(41, 151, 255, .16);
    --up: #30d158;
    --down: #ff453a;
    --warn-bg: #2b2410;
    --warn-text: #ffd60a;
    --shadow: none;
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, .6);
    --nav: rgba(22, 22, 23, .72);
    --overlay: rgba(0, 0, 0, .5);
    --tag-0: #3987e5; --tag-1: #d95926; --tag-2: #199e70; --tag-3: #c98500; --tag-4: #d55181; --tag-5: #8e8e93;
    --tag-ink-3: #ffffff;
    --viz-1: #3987e5;
    --viz-wash: rgba(57, 135, 229, .14);
    --viz-grid: #2c2c2e;
    --viz-axis: #3a3a3c;
  }
}

/* ============ 基础 ============ */
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.up { color: var(--up); }
.down { color: var(--down); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 22px 64px; }
.is-loading { opacity: .55; transition: opacity .2s; pointer-events: none; }

/* ============ 顶部导航（毛玻璃） ============ */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: var(--nav);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 22px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #ff9f0a, #ff375f);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.brand-title { font-weight: 600; font-size: 17px; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.nav-right { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.next-scan { font-size: 12px; color: var(--text-2); text-align: right; line-height: 1.3; }

/* ============ 分段控件 ============ */
.seg {
  display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill-2);
  position: relative; gap: 0;
}
.seg button {
  position: relative; z-index: 1;
  padding: 5px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text);
  transition: background .2s, box-shadow .2s;
  white-space: nowrap;
}
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
.seg button:disabled { color: var(--text-3); cursor: default; }
.seg.lg button { padding: 7px 18px; font-size: 14px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 980px; font-size: 14px; font-weight: 500;
  transition: background .2s, opacity .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost { color: var(--blue); }
.btn-ghost:hover { background: var(--blue-tint); }
.btn-fill { background: var(--fill); }
.btn-fill:hover { background: var(--fill-2); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  color: var(--blue); font-size: 18px; transition: background .15s;
}
.icon-btn:hover { background: var(--blue-tint); }
.icon-btn:disabled { color: var(--text-3); background: none; cursor: default; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 页面标题 / 日期导航 ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 0 14px; flex-wrap: wrap; }
.page-title { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 0; }
.page-eyebrow { font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.date-nav { display: flex; align-items: center; gap: 4px; }
.date-picker { position: relative; }
.date-picker input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}

.day-strip { display: flex; gap: 6px; overflow-x: auto; padding: 3px 3px 14px; margin: 0 -3px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex: none; width: 54px; padding: 8px 0 7px; border-radius: 14px; text-align: center;
  background: var(--card); box-shadow: var(--shadow); transition: background .15s, color .15s;
}
.day-chip .wd { font-size: 11px; color: var(--text-2); }
.day-chip .d { font-size: 19px; font-weight: 600; line-height: 1.25; }
.day-chip .dots { display: flex; gap: 3px; justify-content: center; margin-top: 3px; height: 5px; }
.day-chip .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--fill-2); }
.day-chip .dots i.on { background: var(--viz-1); }
.day-chip.on { background: var(--blue); color: #fff; }
.day-chip.on .wd { color: rgba(255, 255, 255, .8); }
.day-chip.on .dots i { background: rgba(255, 255, 255, .35); }
.day-chip.on .dots i.on { background: #fff; }
.day-chip:disabled { opacity: .4; cursor: default; }

/* ============ 卡片 ============ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-size: 17px; font-weight: 600; margin: 0; }
.card-sub { font-size: 13px; color: var(--text-2); }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-top: 0 !important; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* 统计卡 */
.stat { padding: 16px 18px; }
.stat .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat .value { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.stat .hint { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.stat { text-align: left; width: 100%; transition: transform .15s; }
button.stat:hover { transform: translateY(-1px); }
button.stat.on { box-shadow: 0 0 0 2px var(--blue), var(--shadow); }

/* 总结卡 */
.summary-card { background: linear-gradient(135deg, var(--card), var(--card)); }
.summary-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.summary-list li { display: flex; gap: 10px; font-size: 15px; line-height: 1.55; }
.summary-list li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--viz-1); margin-top: 9px; }

.banner { border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.banner-warn { background: var(--warn-bg); color: var(--warn-text); }

/* ============ 时段选择 ============ */
.slot-bar { display: flex; gap: 10px; overflow-x: auto; padding: 3px; margin: -3px; scrollbar-width: none; }
.slot-bar::-webkit-scrollbar { display: none; }
.slot {
  flex: 1 0 120px; text-align: left; padding: 12px 14px; border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s;
}
.slot:hover:not(:disabled) { transform: translateY(-1px); }
.slot .t { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.slot .s { font-size: 12px; color: var(--text-2); }
.slot.on { box-shadow: 0 0 0 2px var(--blue), var(--shadow); }
.slot:disabled { cursor: default; background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
.slot:disabled .t { color: var(--text-3); }

/* ============ 筛选栏 ============ */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.search {
  display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px;
  padding: 0 10px; height: 34px; min-width: 200px; flex: 0 1 260px;
}
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; }
.search svg { flex: none; color: var(--text-3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 980px; background: var(--fill); font-size: 13px; transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.chip:hover { background: var(--fill-2); }
.chip.on { background: var(--blue-tint); box-shadow: inset 0 0 0 1.5px var(--blue); }
.chip .count { color: var(--text-3); font-size: 12px; }

/* 标签 */
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.tag-pill { padding: 3px 10px 3px 8px; border-radius: 980px; background: var(--fill); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.t0 { background: var(--tag-0); } .t1 { background: var(--tag-1); } .t2 { background: var(--tag-2); }
.t3 { background: var(--tag-3); } .t4 { background: var(--tag-4); } .t5 { background: var(--tag-5); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2);
  padding: 8px 10px; border-bottom: 1px solid var(--sep); white-space: nowrap; user-select: none;
}
table.list th.sortable { cursor: pointer; }
table.list th.sortable:hover { color: var(--text); }
table.list th.r, table.list td.r { text-align: right; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--sep); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list tbody tr { cursor: pointer; transition: background .12s; }
table.list tbody tr:hover { background: var(--fill); }
table.list tbody tr:last-child td { border-bottom: 0; }
.sym { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.sym-sub { font-size: 11px; color: var(--text-3); }
.badge-new {
  display: inline-block; font-size: 10px; font-weight: 600; color: var(--blue); background: var(--blue-tint);
  padding: 1px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 2px;
}
.score {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font-weight: 600; font-size: 14px; background: var(--fill);
}
.score.s4 { background: var(--blue-tint); color: var(--blue); }
.score.s5 { background: var(--blue); color: #fff; }

/* 五维迷你条（单一色相表示数值大小） */
.dims { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; vertical-align: middle; }
.dims i { width: 6px; border-radius: 2px 2px 0 0; background: var(--fill-2); height: 100%; position: relative; overflow: hidden; }
.dims i b { position: absolute; left: 0; right: 0; bottom: 0; background: var(--viz-1); border-radius: 2px 2px 0 0; }

/* 移动端卡片列表 */
.mlist { display: none; }
.mitem { padding: 14px 0; border-bottom: 1px solid var(--sep); display: grid; gap: 6px; cursor: pointer; }
.mitem:last-child { border-bottom: 0; }
.mrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }

/* 变化（新上榜 / 掉榜） */
.delta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.delta-row + .delta-row { margin-top: 8px; }
.delta-label { width: 56px; flex: none; color: var(--text-2); }
.sym-chip {
  height: 26px; padding: 0 10px; border-radius: 8px; background: var(--fill); font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.sym-chip:hover { background: var(--fill-2); }
.sym-chip.out { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }

/* 排行榜 */
.board { padding: 18px 20px 10px; }
.board ol { margin: 0; padding: 0; list-style: none; }
.board li {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--sep); cursor: pointer;
}
.board li:first-child { border-top: 0; }
.board li:hover .sym { color: var(--blue); }
.board .rank { color: var(--text-3); font-size: 13px; font-weight: 600; text-align: center; }
.board .meta { font-size: 12px; color: var(--text-3); }
.board .val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.board .more { width: 100%; padding: 10px 0 6px; font-size: 13px; color: var(--blue); border-top: 1px solid var(--sep); }
.empty { padding: 36px 0; text-align: center; color: var(--text-3); font-size: 14px; }
.empty-big { padding: 72px 0; }
.empty-big .em { font-size: 40px; margin-bottom: 8px; }

/* 时段概览（日报） */
.slot-row {
  display: grid; grid-template-columns: 76px 90px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--sep); cursor: pointer;
}
.slot-row:first-child { border-top: 0; }
.slot-row:hover .slot-time { color: var(--blue); }
.slot-time { font-size: 20px; font-weight: 600; }
.chev { color: var(--text-3); font-size: 18px; }

/* ============ 图表 ============ */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: inherit; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px;
  background: var(--card); color: var(--text); border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .14), 0 0 0 .5px var(--sep); transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}
.tip b { font-weight: 600; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.tip .row span:first-child { color: var(--text-2); }

/* 高分段条（标签占比） */
.segbar { display: flex; gap: 2px; height: 28px; position: relative; }
.segbar .part {
  height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 8px;
  font-size: 12px; font-weight: 600; color: #fff; overflow: visible; min-width: 2px; cursor: default;
  transition: opacity .15s;
}
.segbar .part.p3 { color: var(--tag-ink-3); }
.segbar.hovering .part:not(.hl) { opacity: .45; }
.legend { display: grid; gap: 0; margin-top: 14px; }
.legend-row {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 16px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--sep); font-size: 13px; font-variant-numeric: tabular-nums;
}
.legend-row:first-child { border-top: 0; }
.legend-row .c { color: var(--text-2); text-align: right; min-width: 52px; }

/* ============ 详情面板（右侧 / 移动端底部） ============ */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; }
.sheet {
  position: fixed; z-index: 41; top: 12px; right: 12px; bottom: 12px; width: 460px; max-width: calc(100vw - 24px);
  background: var(--bg); border-radius: 22px; box-shadow: var(--shadow-lg); overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; padding: 18px 20px 14px;
  background: var(--nav); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.sheet-body { padding: 4px 16px 24px; display: grid; gap: 14px; }
.sheet-body .card { padding: 16px 18px; margin: 0; }
.close-btn {
  width: 30px; height: 30px; border-radius: 50%; background: var(--fill-2); color: var(--text-2);
  display: grid; place-items: center; font-size: 15px; flex: none;
}
.big-price { font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.kv > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--sep); font-size: 13px; }
.kv > div:nth-child(-n+2) { border-top: 0; }
.kv span:first-child { color: var(--text-2); }
.kv span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.meter-row { display: grid; grid-template-columns: 72px 1fr 18px; gap: 10px; align-items: center; font-size: 13px; padding: 5px 0; }
.meter { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; height: 8px; }
.meter i { border-radius: 4px; background: var(--fill-2); }
.meter i.on { background: var(--viz-1); }
.appear { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 8px 0; border-top: 1px solid var(--sep); font-size: 13px; cursor: pointer; align-items: center; }
.appear:first-child { border-top: 0; }
.appear:hover { color: var(--blue); }

/* ============ Toast / 模态 ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: rgba(30, 30, 32, .92); color: #fff; padding: 10px 18px; border-radius: 980px; font-size: 14px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
}
.toast.err { background: rgba(215, 0, 21, .95); }
.modal {
  position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 340px; max-width: calc(100vw - 32px); background: var(--card); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 14px; font-size: 13px; color: var(--text-2); }
.modal input {
  width: 100%; height: 40px; border-radius: 10px; border: 0; background: var(--fill); padding: 0 12px; outline: 0;
  box-shadow: inset 0 0 0 1.5px transparent;
}
.modal input:focus { box-shadow: inset 0 0 0 1.5px var(--blue); }
.modal .actions { display: flex; gap: 10px; margin-top: 16px; }
.modal .actions .btn { flex: 1; justify-content: center; padding: 9px 0; }

/* 过渡 */
.fade-enter, .fade-leave { transition: opacity .2s ease; }
.fade-from, .fade-to-out { opacity: 0; }
.slide-enter, .slide-leave { transition: transform .32s cubic-bezier(.32, .72, 0, 1), opacity .25s; }
.slide-from, .slide-to-out { transform: translateX(40px); opacity: 0; }

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .nav-inner { grid-template-columns: 1fr auto; }
  .nav-inner .seg-wrap { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .nav-inner .seg-wrap .seg { width: 100%; }
  .nav-inner .seg-wrap .seg button { flex: 1; }
  .brand-sub, .next-scan { display: none; }
  .page-title { font-size: 28px; }
  .container { padding: 0 16px 48px; }
  .card { padding: 16px; }
  .table-wrap { display: none; }
  .mlist { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .slot-row { grid-template-columns: 64px 70px 1fr auto; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; max-height: 88vh; border-radius: 22px 22px 0 0; }
  .slide-from, .slide-to-out { transform: translateY(40px); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
