:root {
  --bg: #f2f4f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e5e9f0;
  --line-soft: #eef1f6;
  --text: #1b2434;
  --text-2: #5a657a;
  --text-3: #8b95a8;
  --up: #e03131;
  --up-soft: #fdecec;
  --down: #12a150;
  --down-soft: #e8f7ee;
  --flat: #7b8698;
  --accent: #2f6bff;
  --accent-soft: #eaf1ff;
  --nav-line: #7c4dff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 39, 75, .05), 0 6px 18px rgba(24, 39, 75, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 26px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff8a3d, #e03131);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(224, 49, 49, .28);
}

.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.brand-text p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }

.statusbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.stat { display: flex; flex-direction: column; line-height: 1.35; }
.stat .label { font-size: 11px; color: var(--text-3); }
.stat strong { font-size: 14px; font-variant-numeric: tabular-nums; }

select, .btn {
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
}
.btn:hover, select:hover { border-color: #cdd6e4; background: #fbfcff; }
.btn:active { transform: translateY(1px); }

.conn { font-size: 12px; color: var(--text-3); }
.conn.ok { color: var(--down); }
.conn.err { color: var(--up); }

/* ------------------------------------------------------------ market strip */

.market-strip {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 10px 26px 0;
}

.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.tag.live { background: var(--down-soft); border-color: #c8ecd7; color: #0d7a3d; }
.tag.closed { background: #f1f3f7; color: var(--text-3); }
.tag.ghost { background: transparent; border-style: dashed; color: var(--text-3); }

/* ------------------------------------------------------------------ layout */

.section { padding: 20px 26px 4px; }

.section-head { margin-bottom: 12px; }
.section-head h2 {
  margin: 0 0 6px;
  font-size: 15.5px;
  display: flex; align-items: center; gap: 8px;
}
.section-head h2::before {
  content: "";
  width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, #ff8a3d, #e03131);
}
.hint { margin: 0; font-size: 12.5px; color: var(--text-3); line-height: 1.7; max-width: 1100px; }
.hint b { color: var(--text-2); }
.hint b.up { color: var(--up); }
.hint b.down { color: var(--down); }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

b.up, b.down { font-weight: 600; }

/* ------------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--flat);
}
.card.is-up::after { background: var(--up); }
.card.is-down::after { background: var(--down); }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
}

.card-title { font-size: 15px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; font-variant-numeric: tabular-nums; }

.badge {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.high { background: var(--up-soft); color: #b32020; border-color: #f6d3d3; }
.badge.up { background: #fff4e8; color: #b4600c; border-color: #ffe0c2; }
.badge.flat { background: #f1f3f7; color: var(--text-2); border-color: var(--line); }
.badge.down { background: var(--down-soft); color: #0d7a3d; border-color: #c8ecd7; }

/* 主视觉：估算溢价率 */
.hero {
  position: relative;
  border-radius: 12px;
  padding: 13px 16px 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #f1f5ff 0%, #fbfcff 100%);
  border: 1px solid #dfe7fb;
}
.hero.up { background: linear-gradient(135deg, #fdf0f0 0%, #fffbfb 100%); border-color: #f6d9d9; }
.hero.down { background: linear-gradient(135deg, #edfaf2 0%, #fafffc 100%); border-color: #d1ebdd; }

.hero-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.hero-flag {
  font-size: 10.5px; font-weight: 500;
  color: #b4600c; background: #fff4e8; border: 1px solid #ffe0c2;
  border-radius: 999px; padding: 1px 7px;
}
.hero-value {
  font-size: 46px;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -1.6px;
  font-variant-numeric: tabular-nums;
  margin: 5px 0 3px;
}
.hero-formula { font-size: 12px; color: var(--text-3); }
.hero-note { font-size: 12px; color: #5a718f; line-height: 1.65; margin-top: 6px; }
.hero-note b { color: #2b4a8f; font-weight: 600; }
.hero-note.gap-warn { color: #854f0b; background: #faeeda; border: 1px solid #f0dcbb; border-radius: 6px; padding: 5px 8px; margin-top: 7px; cursor: help; }
/* 基准日取价口径（结算价 / 收盘价），悬停显示口径说明 */
.basis-word { border-bottom: 1px dashed #a8bcd8; cursor: help; }

/* 对照：滞后净值口径的名义溢价率 */
.sub-metric {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 2px;
}
.sub-metric .sm-label { color: var(--text-3); }
.sub-metric .sm-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-metric .sm-formula { font-size: 11.5px; color: var(--text-3); }

/* 历史分位条 */
.pct-block { flex-direction: column; align-items: stretch; gap: 8px; }
.pct-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pct-val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pct-bar {
  position: relative; height: 10px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(90deg, #e8f7ee 0%, #eef3ff 50%, #fdecec 100%);
}
.pct-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; opacity: .85; }
.pct-fill.up { background: var(--up); }
.pct-fill.down { background: var(--down); }
.pct-fill.flat { background: var(--accent); }
.pct-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pct-note { font-size: 11.5px; color: #5a718f; line-height: 1.6; margin-top: 2px; }
.pct-note b { color: #2b4a8f; font-weight: 600; }

.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.kv .item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv .item.wide { grid-column: 1 / -1; }
.kv .k { font-size: 11.5px; color: var(--text-3); }
.kv .v { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 500; }
.kv .v small { font-size: 11px; color: var(--text-3); font-weight: 400; margin-left: 3px; }
/* 场内价格涨跌幅：突出显示（实色块，涨红跌绿白字） */
.kv .v small.chg {
  margin-left: 7px;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  vertical-align: 1px;
}
.kv .v small.chg.up { color: #fff; background: var(--up); }
.kv .v small.chg.down { color: #fff; background: var(--down); }
.kv .v small.chg.flat { color: var(--flat); background: #eef1f6; }
.kv .v.bench-v {
  font-size: 12.5px;
  font-weight: 500;
  color: #2b4a8f;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 5px 10px;
  display: inline-block;
  align-self: flex-start;
}

/* ------------------------------------------------------------------- table */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-align: right;
  padding: 12px 14px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th.tl { text-align: left; }
thead th.w2 { white-space: normal; max-width: 96px; line-height: 1.4; }
tbody td {
  font-size: 13.5px;
  text-align: right;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfe; }
tbody td.tl { text-align: left; }

.name-cell { display: flex; flex-direction: column; gap: 2px; }
.name-cell .n { font-weight: 600; }
.name-cell .s { font-size: 11.5px; color: var(--text-3); }
.name-cell .b { font-size: 11px; color: #2b4a8f; }
.row-sep td { border-top: 1px solid var(--line); }

/* 表格涨跌幅列：突出显示（实色块，涨红跌绿白字） */
td .chg {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  padding: 2.5px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
td .chg.up { color: #fff; background: var(--up); }
td .chg.down { color: #fff; background: var(--down); }
td .chg.flat { color: var(--flat); background: #eef1f6; }

/* ------------------------------------------------------------------ footer */

.footer {
  margin-top: 26px;
  padding: 20px 26px 34px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.85;
  max-width: 1280px;
}
.footer b { color: var(--text-2); }
.footer-note { margin-top: 8px; }

@media (max-width: 900px) {
  .topbar { padding: 14px 16px; }
  .section { padding: 16px 16px 2px; }
  .market-strip { padding: 10px 16px 0; }
  .cards { grid-template-columns: 1fr; }
  .footer { padding: 18px 16px 30px; }
  .hero-value { font-size: 38px; }
}
