:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;
  --link: #58a6ff;
  --pos: #3fb950;
  --neg: #f85149;
  --warn: #d29922;
  --grid: #21262d;
  --hot: #56d364;
  --bn: #f0b90b;
  --hl: #50d2c1;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--link); text-decoration: none; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); }

/* ── header ── */
header { position: sticky; top: 0; z-index: 30; background: rgba(13,17,23,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.hwrap { max-width: 1560px; margin: 0 auto; padding: 9px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 19px; }
.title { font-weight: 700; font-size: 16px; }
.title .sub { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 4px; }
nav#tabs { display: flex; gap: 4px; }
nav#tabs a { color: var(--muted); padding: 5px 12px; border-radius: 6px; font-weight: 600; cursor: pointer; }
nav#tabs a.active { color: var(--text); background: var(--panel2); }
nav#tabs a:hover { color: var(--text); }
.hstatus { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.xlink { border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; color: var(--muted); font-size: 11.5px; }
.xlink:hover { color: var(--text); border-color: var(--faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); display: inline-block; animation: pulse 2s infinite; }
.dot.bad { background: var(--neg); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.stale { background: #3d1d1f; color: #ffb3ad; border-bottom: 1px solid #6e2c2f; text-align: center; padding: 6px; font-size: 13px; }

main { max-width: 1560px; margin: 0 auto; padding: 14px 16px 60px; }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }

/* ── summary strip ── */
.strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 9px 14px; min-width: 130px; }
.card .k { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.card .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 1px; }
.card .v small { font-size: 12px; font-weight: 500; color: var(--muted); }
.card.wide { flex: 1; min-width: 300px; }
.card.wide .v { font-size: 13.5px; font-weight: 600; line-height: 1.7; }

/* ── controls ── */
.controls { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; }
.cgrp { display: flex; align-items: center; gap: 5px; }
.cgrp > label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pills { display: flex; gap: 3px; }
.pill { border: 1px solid var(--border); background: var(--panel2); color: var(--muted); padding: 3px 10px;
  border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600; user-select: none; }
.pill:hover { color: var(--text); }
.pill.on { background: #1f3a5f; border-color: #2f5f9e; color: #cae2ff; }
input[type=text], input[type=number], select {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 3px 8px; font-size: 12.5px; outline: none; font-variant-numeric: tabular-nums; }
input[type=number] { width: 62px; }
input:focus { border-color: #2f5f9e; }
.chk { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.btn { border: 1px solid var(--border); background: var(--panel2); color: var(--muted); border-radius: 6px;
  padding: 3px 10px; font-size: 12px; cursor: pointer; font-weight: 600; }
.btn:hover { color: var(--text); }
.sep { width: 1px; height: 20px; background: var(--border); }

/* ── table ── */
.tw { background: var(--panel); border: 1px solid var(--border); border-radius: 9px; overflow: auto; }
.tw.grid { max-height: calc(100vh - 235px); }
table { border-collapse: collapse; width: 100%; min-width: 1314px; font-size: 13px; table-layout: fixed; }
/* 倒计时: 定宽右对齐 —— 2:55:37 → 59:59 位数变化时不许推动后面的列 */
.cdv { display: inline-block; min-width: 7.4ch; text-align: right; }
thead th { position: sticky; top: 0; background: var(--panel2); z-index: 10;
  text-align: right; padding: 7px 9px; font-size: 11.5px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none;
  overflow: hidden; text-overflow: ellipsis; }
thead th:first-child, thead th.l { text-align: left; }
thead th:hover { color: var(--text); }
thead th .ar { color: var(--link); font-size: 10px; }
tbody td { padding: 6px 9px; text-align: right; border-bottom: 1px solid var(--grid);
  white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
tbody td.l { text-align: left; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #1a2029; }
tbody tr.exp { background: #1a2029; }
.sym { font-weight: 700; }
.symsub { color: var(--faint); font-size: 11px; margin-left: 6px; font-weight: 400; }
.net { font-weight: 700; font-size: 14.5px; }
.net.t3 { color: var(--hot); }              /* ≥20bp 舒适区 */
.net.t2 { color: var(--pos); }              /* ≥地板 */
.net.t1 { color: var(--warn); }             /* 0~地板 */
.net.t0 { color: var(--faint); }            /* ≤0 */
.badge { display: inline-block; font-size: 10px; padding: 0 5px; border-radius: 4px; margin-left: 4px;
  border: 1px solid transparent; font-weight: 600; vertical-align: 1px; }
.b-stock { background: #1f2a3d; color: #8ab4f8; }
.b-coin  { background: #2b2438; color: #c9a7f0; }
.b-black { background: #3d1d1f; color: #ff9d95; }
.b-trap  { background: #3a2c10; color: #e3b341; }
.b-cap   { background: #3d1d1f; color: #ff9d95; }
.b-A     { background: #3a2c10; color: #e3b341; }
.b-B     { background: #17301f; color: #6fce8a; }
.b-full  { background: #33261a; color: #e0a373; }
.dirtag { font-size: 11.5px; color: var(--muted); }
.dirtag b { color: var(--text); font-weight: 600; }
.wk { color: var(--faint); }

/* ── expand ── */
tr.det > td { background: #12171e; padding: 0; border-bottom: 1px solid var(--border); overflow: visible; white-space: normal; }
.detwrap { padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.detbox h4 { margin: 0 0 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 2px 0; border-bottom: 1px dashed #232a33; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-variant-numeric: tabular-nums; }
.calc { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.9; color: var(--text); }
.calc .op { color: var(--faint); }
.note { font-size: 12px; color: var(--warn); margin-top: 6px; line-height: 1.55; }

/* ── timeline ── */
.slot { background: var(--panel); border: 1px solid var(--border); border-radius: 9px; margin-bottom: 12px; overflow: hidden; }
.slothead { padding: 8px 14px; background: var(--panel2); display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.slothead .t { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.slothead .cd { color: var(--warn); font-variant-numeric: tabular-nums; font-weight: 600; }
.slothead .n { color: var(--muted); font-size: 12px; }

/* ── docs ── */
.doc { background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 18px 22px; max-width: 980px; line-height: 1.75; }
.doc h3 { margin: 22px 0 8px; font-size: 15px; border-left: 3px solid var(--link); padding-left: 9px; }
.doc h3:first-child { margin-top: 0; }
.doc p, .doc li { font-size: 13.5px; color: #c9d1d9; }
.doc table { margin: 8px 0 4px; font-size: 12.5px; }
.doc table td, .doc table th { border-bottom: 1px solid var(--grid); padding: 5px 10px; text-align: left; }
.doc table th { color: var(--muted); font-weight: 600; }
.doc .fml { background: var(--panel2); border-radius: 7px; padding: 10px 14px; margin: 8px 0;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.85;
  white-space: pre-wrap; overflow-x: auto; }

footer { max-width: 1560px; margin: 0 auto; padding: 14px 16px 30px; color: var(--faint); font-size: 11.5px; line-height: 1.8; }
