:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1f2329;
  --muted: #8a8f99;
  --line: #e6e8eb;
  --up: #e23b3b;     /* 红涨 */
  --down: #14a86b;   /* 绿跌 */
  --brand: #2f6fed;
  --brand-d: #1f57c9;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; }
.topbar h1 { font-size: 18px; margin: 0; }
.sub { color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 10px; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.status { color: var(--muted); font-size: 12px; }
.nav {
  display: flex; gap: 4px; padding: 8px 24px; background: var(--card);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.nav a { color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.nav a:hover { background: var(--bg); color: var(--brand); }
main { max-width: 1280px; margin: 18px auto; padding: 0 18px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 14px; font-size: 16px; }
.card h3 { font-size: 14px; margin: 0 0 10px; color: var(--ink); }
.sec-head { display: flex; align-items: center; justify-content: space-between; }
.hint { color: var(--muted); font-size: 12px; font-weight: normal; }

/* 大盘 */
.grid.indices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.idx { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.idx .nm { color: var(--muted); font-size: 12px; }
.idx .px { font-size: 20px; font-weight: 600; margin: 4px 0 2px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; position: sticky; top: 0; }
td:first-child, th:first-child, td:nth-child(2), th:nth-child(2) { text-align: left; }
tbody tr:hover { background: #f7f9ff; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* 连扳梯队 */
.limit-tiers { display: flex; gap: 12px; flex-wrap: wrap; }
.tier { flex: 1 1 150px; min-width: 140px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tier .head { background: linear-gradient(135deg,#e23b3b,#ff7a45); color: #fff; padding: 8px 12px; font-weight: 600; text-align: center; }
.tier .body { padding: 8px 10px; }
.tier .stk { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.tier .stk:last-child { border-bottom: none; }
.tier .stk .nm { color: var(--ink); }
.tier .stk .pc { font-size: 12px; }

/* 板块两列 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px){ .two-col { grid-template-columns: 1fr; } }

/* 均线控制 */
.ma-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ma-controls .custom { display: inline-flex; align-items: center; gap: 6px; }
.ma-controls input { width: 56px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; text-align: center; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 14px; padding: 22px; width: 460px; max-width: 92vw; box-shadow: var(--shadow); }
.modal-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.modal-actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* 连扳模式切换 */
.toggle { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.toggle label { cursor: pointer; display: flex; align-items: center; gap: 4px; }
.toggle input { accent-color: var(--brand); }

/* 连扳原因小标签 */
.reason-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; font-size: 11px;
  color: #7a5a12; background: #fff4d6; border-radius: 4px; vertical-align: middle;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 龙虎榜可展开行 */
.dt-row { cursor: pointer; }
.dt-row:hover { background: #f3f6ff; }
.dt-row .chev { color: var(--muted); width: 18px; text-align: center; }
.dt-detail-box { padding: 14px 18px; background: #fafbfd; }
.inst-summary { margin-bottom: 12px; font-size: 14px; }
.seat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.seat-cols h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.seat-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.seat-table th, .seat-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.seat-table th:first-child, .seat-table th:nth-child(2),
.seat-table td:first-child, .seat-table td:nth-child(2) { text-align: left; }
.seat-inst { background: #fff7e6; }
.seat-inst td:nth-child(2) { font-weight: 600; }
.seat-hk td:nth-child(2) { color: var(--brand); }
.badge { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 10.5px; border-radius: 3px; vertical-align: middle; }
.badge.inst { color: #fff; background: #e8951a; }
.badge.hk { color: #fff; background: var(--brand); }
@media (max-width: 720px) { .seat-cols { grid-template-columns: 1fr; } }

/* 涨停原因分类 */
.lr-themes { display: flex; gap: 8px; flex-wrap: wrap; }
.lr-chip { background: #f0f4ff; color: var(--brand); border: 1px solid #dbe6ff; border-radius: 999px; padding: 5px 12px; font-size: 12px; }
.lr-chip b { color: var(--brand-d); }
.tag { display: inline-block; background: #eef2f7; color: var(--ink); border-radius: 6px; padding: 2px 8px; font-size: 12px; }

/* 连扳题材聚合 - 可折叠 */
.limit-themes { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.lt-collapse { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lt-collapse-head { cursor: pointer; padding: 9px 12px; font-size: 13px; color: var(--ink); background: #fafbfc; user-select: none; display: flex; align-items: center; gap: 6px; }
.lt-collapse-head:hover { background: #f3f6ff; }
.lt-collapse-head .chev { color: var(--muted); width: 14px; text-align: center; }
.lt-collapse-body { padding: 10px 12px; }
.lt-group { margin-bottom: 10px; }
.lt-group-head { font-size: 13px; margin-bottom: 5px; }
.lt-group-head .tag { margin-right: 6px; }
.lt-stocks { display: flex; flex-wrap: wrap; gap: 6px; }
.stk-inline { display: inline-flex; align-items: baseline; gap: 4px; background: #f0f4ff; border: 1px solid #dbe6ff; border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.stk-inline b { color: var(--ink); font-weight: 600; }
.stk-inline small { color: var(--muted); }

/* 龙虎榜明细 - 上榜原因（按类型着色） */
.dt-reason { margin-bottom: 12px; font-size: 13px; border-radius: 8px; padding: 8px 12px; border: 1px solid var(--line); background: #fafbfd; }
.dt-reason b { color: var(--brand-d); }
.dt-reason .type-badge { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 4px; font-size: 11px; color: #fff; vertical-align: middle; }
.dt-reason.type-dev { border-color: #f3c2c2; background: #fdf0f0; }
.dt-reason.type-dev .type-badge { background: var(--up); }
.dt-reason.type-turn { border-color: #c2d4f3; background: #eef3fd; }
.dt-reason.type-turn .type-badge { background: var(--brand); }
.dt-reason.type-amp { border-color: #f3dcc2; background: #fdf6ec; }
.dt-reason.type-amp .type-badge { background: #e8951a; }
.dt-reason.type-other { border-color: #d8dde4; background: #f5f6f8; }
.dt-reason.type-other .type-badge { background: var(--muted); }

/* 北向资金 历史条 */
.nb-history { margin-top: 6px; }
.nb-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; overflow-x: auto; padding-top: 8px; }
.nb-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 22px; height: 110px; }
.nb-bar-fill { width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; }
.nb-bar-fill.up { background: var(--up); }
.nb-bar-fill.down { background: var(--down); }
.nb-bar-lab { font-size: 9px; color: var(--muted); margin-top: 2px; white-space: nowrap; }

/* 解禁/研报 表头间距 */
.card h3 { margin-top: 4px; }
