:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --bg-3: #1f262f;
  --fg: #d0d7de;
  --fg-dim: #8b949e;
  --fg-muted: #6e7681;
  --accent: #4fc3f7;
  --accent-2: #2f81f7;
  --green: #3fb950;
  --red: #f85149;
  --border: #30363d;
  --warn: #d29922;
  --sidebar-w: 200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 深色细滚动条（全站统一，浏览器默认滚动条在深色背景下突兀）*/
* { scrollbar-width: thin; scrollbar-color: #30363d transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d4651; }

.app {
  display: flex;
  min-height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-w);
  background: #0a0d12;
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.sidebar .brand {
  font-weight: 600;
  font-size: 16px;
  padding: 0 18px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
.sidebar .brand-sub {
  display: block;
  color: var(--fg-muted);
  font-weight: 400;
  font-size: 11px;
  margin-top: 2px;
}

.nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--fg-dim);
  cursor: pointer;
  text-decoration: none;
  border-left: 2px solid transparent;
  font-size: 13px;
}
.nav-item:hover { background: var(--bg-2); color: var(--fg); }
.nav-item.active {
  background: var(--bg-3);
  color: var(--accent);
  border-left-color: var(--accent);
}
.nav-icon {
  display: inline-block;
  width: 16px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 14px;
}
.nav-item.active .nav-icon { color: var(--accent); }

.sidebar-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--fg-muted);
}
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }

/* ============ Main ============ */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 18px 24px 40px;
  min-height: 100vh;
  overflow-x: auto;
}

.page { display: none; }
.page.active { display: block; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.page-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

/* ============ Subtabs ============ */
.subtabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.subtab {
  background: transparent;
  border: 0;
  color: var(--fg-dim);
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtab:hover { color: var(--fg); }
.subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 内层二级 tab（如涨停复盘内的 涨停全景/次日复盘/连板趋势）：字号收紧，与顶层 tab 区分层级 */
.subtabs-inner {
  margin-top: 4px;
  margin-bottom: 12px;
}
.subtabs-inner .subtab {
  padding: 5px 10px;
  font-size: 12px;
}

.subpane { display: none; }
.subpane.active { display: block; }

/* ============ Generic panel head ============ */
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 4px 0 14px;
  flex-wrap: wrap; gap: 8px;
}
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.page h3 { margin: 18px 0 8px; font-size: 13px; color: var(--fg-dim); font-weight: 500; }

.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions input, .actions select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 5px 8px;
  border-radius: 4px;
  font: inherit;
  width: 140px;
}
.actions input[type=number] { width: 70px; }

.btn {
  background: var(--accent-2);
  color: white;
  border: 0;
  padding: 5px 14px;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
.btn:hover { background: #1a6dd6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.muted { color: var(--fg-muted); font-size: 12px; }

/* ============ Stat / cards / bars ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 6px;
}
.stat-label { color: var(--fg-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 20px; font-weight: 600; margin-top: 4px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 760px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
}
.card-name { font-weight: 500; }
.card-code { color: var(--fg-muted); font-size: 11px; }

/* 可点击的 ts_code 链接：所有列表/卡片里的代码点一下跳到 K 线页 */
.ts-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.ts-link:hover {
  border-bottom-color: var(--accent);
  filter: brightness(1.15);
}
.card-price { font-size: 18px; margin-top: 4px; }
.card-change { font-size: 12px; }

.bar-list { display: flex; flex-direction: column; gap: 4px; }
.bar-row {
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  align-items: center;
  gap: 8px;
}
.bar { background: var(--bg-3); height: 10px; border-radius: 2px; overflow: hidden; }
.bar-fill { background: var(--red); height: 100%; }

.up { color: var(--red); }
.down { color: var(--green); }
.flat { color: var(--fg-dim); }

/* ============ Tables ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}
.data-table th, .data-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.data-table th {
  background: var(--bg-2);
  color: var(--fg-dim);
  font-weight: 500;
  position: sticky; top: 0;
}
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: var(--bg-2); }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
}
.kv { display: flex; justify-content: space-between; }
.kv-k { color: var(--fg-muted); }
.kv-v { font-variant-numeric: tabular-nums; }

.warnings {
  margin-top: 12px;
  color: var(--warn);
  font-size: 12px;
}
.warnings:empty { display: none; }

pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font: 12px/1.5 "SF Mono", "Menlo", monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 70vh;
  overflow: auto;
}

/* ============ Placeholder ============ */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: var(--bg-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 13px;
  padding: 24px;
  margin: 8px 0;
  text-align: center;
}

/* ============ Chart ============ */
.chart-box {
  width: 100%;
  height: 520px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 10px;
}

/* ============ Toast ============ */
.toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 12px;
  min-width: 180px;
  max-width: 360px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  animation: toast-in 0.18s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============ Loading overlay ============ */
.loading-veil {
  position: relative;
  pointer-events: none;
  opacity: 0.5;
}
.loading-veil::after {
  content: "加载中…";
  position: absolute;
  top: 8px; right: 12px;
  background: var(--bg-3);
  color: var(--fg-dim);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
}

/* ============ Markdown ============ */
.md-body { font-size: 13px; line-height: 1.7; }
.md-body h1, .md-body h2, .md-body h3 { color: var(--fg); margin: 14px 0 6px; }
.md-body p { margin: 6px 0; }
.md-body code {
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 12px;
}
.md-body pre code { display: block; padding: 10px; }
.md-body table { border-collapse: collapse; margin: 8px 0; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 4px 8px; }

/* ============ Modal ============ */
.modal-host {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-dialog {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  min-width: 360px; max-width: 600px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 14px; font-weight: 500; color: var(--fg); }
.modal-close { background: transparent; border: 0; color: var(--fg-muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--fg); }
.modal-body { padding: 18px; overflow: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-form-row { display: grid; grid-template-columns: 100px 1fr; gap: 8px; align-items: center; margin-bottom: 10px; }
.modal-form-row label { color: var(--fg-dim); font-size: 12px; }
.modal-form-row input,
.modal-form-row select,
.modal-form-row textarea {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--fg);
  padding: 5px 8px; border-radius: 4px; font: inherit; width: 100%;
}
.modal-form-row textarea { resize: vertical; min-height: 50px; font-family: inherit; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #d63a30; }
.btn-secondary { background: var(--bg-3); color: var(--fg); }
.btn-secondary:hover { background: #2a323d; }

/* ============ Screening panel ============ */
.scr-panel-head {
  display: flex; gap: 16px; align-items: flex-end; justify-content: space-between;
  padding: 4px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
  flex-wrap: wrap;
}
.scr-title-wrap { min-width: 0; }
.scr-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--fg); }
.scr-subtitle { color: var(--fg-muted); font-size: 12px; margin-top: 3px; }
.scr-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.scr-ctl { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.scr-ctl span {
  color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px;
  font-size: 10px;
}
.scr-ctl input {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--fg);
  border-radius: 4px; padding: 5px 8px; font: 13px/1.4 inherit;
  width: 150px; transition: border-color 0.15s;
}
.scr-ctl:nth-child(2) input, .scr-ctl:nth-child(3) input { width: 80px; }
.scr-ctl input:focus { outline: none; border-color: var(--accent-2); }
.scr-run-btn { padding: 6px 18px; align-self: flex-end; height: 30px; }
.scr-status { color: var(--fg-muted); font-size: 12px; margin: 6px 0 12px; min-height: 16px; }
.scr-status:empty { display: none; }
.scr-spinner {
  display: inline-block; width: 10px; height: 10px; margin-right: 6px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: scr-spin 0.8s linear infinite;
  vertical-align: -1px;
}
@keyframes scr-spin { to { transform: rotate(360deg); } }
.scr-output { display: block; }

/* KPI 紧凑横条（替代原 stat-grid） */
.scr-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  margin-bottom: 14px;
}
.scr-kpi-cell {
  background: var(--bg-2); padding: 8px 12px;
}
.scr-kpi-lbl {
  color: var(--fg-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.scr-kpi-val {
  font-size: 18px; font-weight: 600; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.scr-kpi-val.up { color: var(--red); }
.scr-kpi-val.down { color: var(--green); }
.scr-kpi-val.muted { color: var(--fg-muted); }

/* 工具条：排序 + 筛选 chip */
.scr-toolbar {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.scr-toolbar-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.scr-toolbar-lbl {
  color: var(--fg-muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px; margin-right: 2px;
}
.scr-toolbar-hint { color: var(--fg-muted); font-size: 11px; margin-left: 4px; }
.scr-chip {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--fg-dim);
  border-radius: 14px; padding: 3px 10px; font-size: 11px; cursor: pointer;
  transition: all 0.15s; line-height: 1.4;
}
.scr-chip em { font-style: normal; color: var(--fg-muted); margin-left: 2px; font-size: 10px; }
.scr-chip:hover { background: var(--bg-3); color: var(--fg); }
.scr-chip.active {
  background: var(--accent-2); border-color: var(--accent-2); color: #fff;
}
.scr-chip.active em { color: rgba(255,255,255,0.7); }
.scr-chip.scr-chip-dim { opacity: 0.45; }

/* 分段标题 */
.scr-section-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 18px 0 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.scr-section-head:first-child { margin-top: 0; }
.scr-section-name { font-size: 13px; font-weight: 600; color: var(--fg); }
.scr-section-count {
  color: var(--fg-muted); font-size: 11px;
  background: var(--bg-3); padding: 1px 7px; border-radius: 10px;
}

/* 完整大卡 */
.scr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.scr-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; transition: border-color 0.15s;
}
.scr-card:hover { border-color: #3d4651; }
.scr-card-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 10px;
}
.scr-card-id { min-width: 0; }
.scr-card-name {
  font-size: 14px; font-weight: 600; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scr-card-code { color: var(--fg-muted); font-size: 11px; margin-top: 1px; }
.scr-card-tagrow { display: flex; gap: 4px; flex-wrap: wrap; }
.scr-card-score {
  font-size: 24px; font-weight: 700; line-height: 1;
  min-width: 44px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.scr-score-hi { color: var(--red); }
.scr-score-md { color: #f6a957; }
.scr-score-lo { color: var(--warn); }
.scr-score-bot { color: var(--fg-muted); }

.scr-card-kvs {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}
.scr-kv { display: flex; gap: 5px; align-items: baseline; }
.scr-kv-k { color: var(--fg-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; }
.scr-kv-v { font-weight: 500; font-variant-numeric: tabular-nums; }

.scr-card-cols {
  display: grid; grid-template-columns: 1fr; gap: 8px;
}
@media (min-width: 1100px) {
  .scr-card-cols { grid-template-columns: 1fr 1fr; }
}
.scr-col { min-width: 0; }
.scr-section-title {
  font-size: 10px; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 3px;
}
.scr-list { margin: 0; padding-left: 0; font-size: 12px; line-height: 1.55; list-style: none; }
.scr-list-reasons { border-left: 2px solid var(--red); padding-left: 7px; }
.scr-list-risks { border-left: 2px solid var(--green); padding-left: 7px; }
.scr-list li { margin: 1px 0; color: var(--fg); }

/* verdict / phase tag */
.scr-tag {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 11px; font-weight: 500; line-height: 1.6;
}
.scr-tag-buy { background: rgba(248,81,73,0.18); color: var(--red); border-color: rgba(248,81,73,0.4); }
.scr-tag-strong-buy { background: rgba(248,81,73,0.3); color: var(--red); border-color: var(--red); }
.scr-tag-hold { background: rgba(139,148,158,0.18); color: var(--fg-dim); border-color: rgba(139,148,158,0.3); }
.scr-tag-sell { background: rgba(63,185,80,0.18); color: var(--green); border-color: rgba(63,185,80,0.4); }
.scr-phase {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 10px; line-height: 1.6;
  background: rgba(79,195,247,0.08); color: var(--accent);
  border: 1px solid rgba(79,195,247,0.25);
}
.scr-phase-accum { color: #79c0ff; background: rgba(121,192,255,0.1); border-color: rgba(121,192,255,0.3); }
.scr-phase-pump  { color: var(--red); background: rgba(248,81,73,0.12); border-color: rgba(248,81,73,0.3); }
.scr-phase-shake { color: var(--warn); background: rgba(210,153,34,0.12); border-color: rgba(210,153,34,0.3); }
.scr-phase-dist  { color: var(--green); background: rgba(63,185,80,0.12); border-color: rgba(63,185,80,0.3); }
.scr-phase-empty { background: transparent; border-color: transparent; color: var(--fg-muted); }

.scr-card-actions {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-top: auto;
}
.scr-card-btns { display: flex; gap: 6px; margin-left: auto; }
.scr-btn-sm { padding: 4px 10px; font-size: 12px; }

/* 紧凑 row：未复核召回 */
.scr-rows {
  display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden;
}
.scr-row {
  display: grid;
  grid-template-columns: 40px minmax(120px, 1fr) auto 60px auto;
  align-items: center; gap: 12px;
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.scr-row:last-child { border-bottom: none; }
.scr-row:hover { background: rgba(79,195,247,0.04); }
.scr-row-rank { color: var(--fg-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.scr-row-id { min-width: 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.scr-row-name { font-weight: 500; color: var(--fg); font-size: 13px; }
.scr-row-code { color: var(--fg-muted); font-size: 11px; }
.scr-row-score {
  text-align: right; font-weight: 600; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.scr-row-btns { display: flex; gap: 4px; }

/* 折叠 */
.scr-collapse {
  margin-top: 14px; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 6px;
}
.scr-collapse-tight { margin: 0; flex: 1; }
.scr-collapse > summary {
  padding: 6px 10px; cursor: pointer; color: var(--fg-dim); font-size: 11px;
  list-style: none;
}
.scr-collapse-tight > summary { padding: 3px 6px; font-size: 10px; }
.scr-collapse > summary::-webkit-details-marker { display: none; }
.scr-collapse > summary::before { content: "▸ "; color: var(--fg-muted); }
.scr-collapse[open] > summary::before { content: "▾ "; }
.scr-collapse > .scr-collapse-body { padding: 10px 12px; border-top: 1px solid var(--border); }

.scr-warnings { margin-top: 10px; }

/* ============ K线图侧栏（自选） ============ */
/* 自选浮层做成常驻全高侧栏：fixed 贴在全局导航右侧，整页滚动时原地不动、
   始终与右侧 K 线/分析等高，不再缩成一小坨、也不会滚走留空白。
   left = 全局 sidebar 宽(--sidebar-w) + .main 左 padding(24px)；
   .kline-main margin-left = 220(浮层) + 14(原 gap)。
   .page 非 active 时 display:none，fixed 子元素不渲染，不会泄漏到别的页。 */
.kline-layout { display: block; }
.kline-sidebar {
  position: fixed; top: 18px; bottom: 18px;
  left: calc(var(--sidebar-w) + 24px); width: 220px;
  overflow: hidden; z-index: 5;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  display: flex; flex-direction: column;
}
.kline-sidebar-head {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.kline-sidebar-head input {
  flex: 1; min-width: 0; background: var(--bg-1, #0d1117);
  border: 1px solid var(--border); color: var(--fg, #c9d1d9);
  border-radius: 4px; padding: 4px 8px; font-size: 12px;
}
.kline-sidebar-head .muted { font-size: 11px; flex: 0 0 auto; }
/* min-height:0：列在定高浮层内自身滚动，而非把浮层撑破 */
.kline-wl-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; min-height: 0; }
.kline-wl-list li {
  padding: 6px 10px; cursor: pointer; font-size: 12px;
  display: flex; flex-direction: column; gap: 1px;
  border-left: 3px solid transparent;
}
.kline-wl-list li:hover { background: rgba(79,195,247,0.08); }
.kline-wl-list li.active {
  background: rgba(79,195,247,0.16); border-left-color: var(--accent);
}
.kline-wl-name { color: var(--fg, #c9d1d9); font-weight: 500; }
.kline-wl-meta { color: var(--fg-muted); font-size: 10px; font-family: monospace; }
.kline-main { min-width: 0; margin-left: 234px; }

/* AI 综合分析做成卡片，与上方 K 线工具栏视觉一致，不再是裸文字浮层 */
#kline-ai-section {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
#kline-ai-section .panel-head { margin-top: 0; }
#kline-ai-section .panel-head h2 { margin: 0; font-size: 15px; }

/* ============ K 线工具栏（标题 + 表单 + 快捷区间） ============ */
.kline-toolbar {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kline-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.kline-title-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg, #c9d1d9);
}
.kline-title-code { font-size: 12px; font-family: monospace; }
.kline-title-price { font-size: 16px; font-weight: 500; }
.kline-title-pct { font-size: 13px; padding: 2px 8px; border-radius: 4px; }
.kline-title-pct.up { background: rgba(248,81,73,0.15); color: var(--red, #f85149); }
.kline-title-pct.down { background: rgba(63,185,80,0.15); color: var(--green, #3fb950); }
.kline-title-pct.flat { background: var(--bg-3); color: var(--fg-muted); }

.kline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kline-field {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-muted);
}
.kline-field span { white-space: nowrap; }
.kline-field input {
  background: var(--bg-1, #0d1117);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg, #c9d1d9);
  padding: 5px 8px;
  font-size: 13px;
  width: 130px;
  outline: none;
}
.kline-field input:focus { border-color: var(--accent, #4fc3f7); }
.kline-quick {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.btn-quick {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.btn-quick:last-child { border-right: none; }
.btn-quick:hover { background: var(--bg-3); color: var(--fg, #c9d1d9); }
.btn-quick.active {
  background: rgba(79,195,247,0.16);
  color: var(--accent, #4fc3f7);
}

/* ============ K 线摘要区（分组 kv + 近 N 日小表） ============ */
.kline-summary-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 10px;
  align-items: start;
}
/* 整个 section（标题+内容）必须作为单一 grid 项，否则标题/内容会跨栏 */
.kline-sum-section { min-width: 0; }
.kline-sum-section .kv-grid {
  margin-top: 6px;
  padding: 8px 12px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 4px 12px;
}
.kline-sum-section .kv {
  font-size: 12px;
  padding: 2px 0;
  align-items: baseline;
}
.kline-sum-section .kv-v { font-weight: 500; }
.kline-sum-h {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  margin: 0 0 0 2px;
  padding: 2px 0;
  letter-spacing: 0.5px;
}
.kline-sum-table {
  margin-top: 6px;
  font-size: 12px;
}
.kline-sum-table th,
.kline-sum-table td {
  padding: 3px 8px;
}

/* ============ 选股工作台（顶部横向召回条 / 下方全宽 K线+AI）============ */
.screener-top {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.screener-controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.screener-controls .scr-ctl { display: flex; flex-direction: column; gap: 2px; }
.screener-controls .scr-ctl span { font-size: 11px; color: var(--fg-muted); }
.screener-controls .scr-ctl input { width: 130px; }

.screener-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.screener-toolbar:empty { display: none; }
.screener-toolbar-lbl { font-size: 11px; color: var(--fg-muted); margin-right: 2px; }

/* 横向召回结果条：左右滚动的紧凑卡片，把竖向空间让给下方全宽 K 线 */
.screener-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px;
  scrollbar-width: thin;
}
.screener-strip:empty { display: none; }
.screener-strip-item {
  flex: 0 0 auto; width: 124px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.screener-strip-item:hover { background: var(--bg-3); }
.screener-strip-item.active { background: var(--bg-3); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.screener-strip-item .strip-top { display: flex; justify-content: space-between; align-items: center; }
.screener-strip-item .strip-rank { font-size: 11px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.screener-strip-item .strip-score { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.screener-strip-item .strip-name { font-size: 13px; font-weight: 600; color: var(--fg); margin: 3px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screener-strip-item .strip-bottom { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.screener-strip-item .strip-code { font-size: 11px; color: var(--fg-muted); font-family: monospace; }

.screener-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; text-align: center; padding: 24px;
  border: 1px dashed var(--border); border-radius: 8px;
}
.screener-detail-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 6px 2px 12px;
}
.screener-detail-name { font-size: 20px; font-weight: 700; color: var(--fg); }
.screener-detail-code { font-size: 13px; font-family: monospace; }
.screener-detail-price { font-size: 18px; font-weight: 600; color: var(--fg); }
.screener-detail-pct { font-size: 15px; font-weight: 600; }
.screener-detail-spacer { flex: 1 1 auto; }
.screener-ind { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--fg-dim); }
.screener-ind label { display: flex; align-items: center; gap: 3px; cursor: pointer; }
.screener-ind input { width: auto; }
.screener-chart { height: 480px; }

.screener-ai { margin-top: 24px; }
.screener-ai-analysis {
  background: var(--bg-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 10px 14px; margin-bottom: 12px;
}
.screener-ai-analysis h3 { margin: 0 0 6px; font-size: 14px; }
.screener-ai-analysis div { line-height: 1.7; font-size: 13px; }
.screener-ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.screener-ai-col {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 14px;
}
.screener-ai-col h3 { margin: 0 0 6px; font-size: 14px; }
.screener-ai-col ul { margin: 4px 0 0 18px; padding: 0; }
.screener-ai-col li { margin: 4px 0; font-size: 13px; line-height: 1.5; }
.screener-ai-col-bull { border-left: 3px solid var(--red); }
.screener-ai-col-bull h3 { color: var(--red); }
.screener-ai-col-bear { border-left: 3px solid var(--green); }
.screener-ai-col-bear h3 { color: var(--green); }
.scr-tag-recall { background: rgba(139,148,158,0.18); color: var(--fg-dim); border-color: rgba(139,148,158,0.3); }
.screener-strip-item .strip-score { color: var(--fg); }  /* 召回分默认中性，红绿只随 up/down 类 */
.screener-toolbar-count { margin-left: auto; font-size: 11px; color: var(--fg-muted); white-space: nowrap; }
.screener-ai-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 88px; padding: 16px; text-align: center;
  color: var(--fg-muted); font-size: 13px;
  border: 1px dashed var(--border); border-radius: 8px; background: var(--bg-2);
}

/* ===== 召回视角筛选：折叠分组面板 + 候选来源 tag ===== */
.scr-views-toggle {
  padding: 6px 12px; align-self: flex-end; height: 30px;
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
}
.scr-views-toggle.on { border-color: var(--accent-2); color: var(--fg); }
.scr-views-caret { font-size: 9px; color: var(--fg-muted); }
.recall-views-panel {
  flex-basis: 100%; margin-top: 8px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px;
}
.recall-views-panel[hidden] { display: none; }
.rv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.rv-exclusive { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg); cursor: pointer; }
.rv-exclusive input { width: auto; }
.rv-exclusive em { font-style: normal; color: var(--fg-muted); font-size: 11px; }
.rv-actions { display: inline-flex; gap: 6px; }
.rv-act {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--fg-dim);
  border-radius: 4px; padding: 3px 10px; font-size: 11px; cursor: pointer; transition: all 0.15s;
}
.rv-act:hover { color: var(--fg); border-color: var(--accent-2); }
.rv-groups { display: flex; flex-direction: column; gap: 9px; }
.rv-group { display: flex; align-items: baseline; gap: 10px; }
.rv-group-name {
  flex: 0 0 92px; font-size: 11px; color: var(--fg-muted);
  text-align: right; padding-top: 3px; white-space: nowrap;
}
.rv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rv-chip {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--fg-dim);
  border-radius: 14px; padding: 3px 11px; font-size: 12px; cursor: pointer;
  transition: all 0.13s; line-height: 1.5;
}
.rv-chip em { font-style: normal; color: var(--fg-muted); font-size: 9px; margin-left: 3px; }
.rv-chip:hover { color: var(--fg); border-color: var(--accent-2); }
.rv-chip.on { background: rgba(47,129,247,0.18); border-color: var(--accent-2); color: var(--fg); }
.rv-chip.on em { color: var(--accent); }
/* 候选卡片来源 tag：base 中性灰、战法暖橙高亮（避开红涨绿跌语义） */
.screener-strip-item .strip-srcs { display: flex; flex-wrap: wrap; gap: 3px; margin: 0 0 5px; overflow: hidden; max-height: 22px; }
.rv-src {
  font-size: 10px; line-height: 1.5; padding: 0 5px; border-radius: 3px;
  background: rgba(139,148,158,0.16); color: var(--fg-dim); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.rv-src-pat { background: rgba(246,169,87,0.18); color: #f6a957; }
.rv-src-more { background: transparent; color: var(--fg-muted); padding: 0 2px; }

/* 市场分析：涨停按行业聚合——每行带数据条(宽度=涨停数比例)，一眼看量级 */
.ind-row { display: block; background: var(--bg-2); border-radius: 6px; margin-bottom: 4px; }
.ind-row[open] { background: var(--bg-3); }
.ind-summary {
  cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; position: relative; overflow: hidden; border-radius: 6px; list-style: none;
}
.ind-summary::-webkit-details-marker { display: none; }
.ind-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(248,81,73,0.13); z-index: 0; }
.ind-name { position: relative; z-index: 1; }
.ind-count { position: relative; z-index: 1; font-weight: 600; }

/* 窄屏：K线略矮，横向召回条照常左右滚 */
@media (max-width: 900px) {
  .screener-chart { height: 360px; }
}

/* 盘中工作台：今日实时列轻微底色，与昨日收盘选股列视觉分组 */
#wb-table th.wb-live, #wb-table td.wb-live { background: rgba(79, 195, 247, 0.06); }
#wb-table th.wb-live:first-of-type, #wb-table td.wb-live:first-of-type { border-left: 1px solid var(--border); }
/* 可排序表头 */
#wb-table th.wb-sort { cursor: pointer; user-select: none; white-space: nowrap; }
#wb-table th.wb-sort:hover { color: var(--fg); }

/* ============ 涨跌停时间线 ============ */
.tl-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.tl-table th, .tl-table td { padding: 3px 8px; border-bottom: 1px solid var(--border, #30363d); text-align: left; }
.tl-table th { background: var(--bg-2); color: var(--fg-muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; }
.tl-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tl-table tbody tr:hover { background: var(--bg-2); }
/* 封板/再封 → 红（涨/利好） */
.tl-table tr.ev-seal td:nth-child(2) { color: var(--red); font-weight: 600; }
/* 炸板/触板回落 → 橙警示 */
.tl-table tr.ev-bust td:nth-child(2) { color: #d98300; font-weight: 600; }
/* 跌停 → 绿（跌/利空） */
.tl-table tr.ev-down td:nth-child(2) { color: var(--green); font-weight: 600; }
.tl-sum { font-size: 13px; line-height: 2; }
.tl-sum b { font-size: 15px; font-weight: 700; }
.tl-bust-cnt { color: #d98300; font-weight: 600; }
.tl-ebb { font-size: 12px; font-weight: 600; }
.tl-leaders { margin-top: 2px; font-size: 12px; line-height: 1.6; }
.tl-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-chip-lbl { white-space: nowrap; }
.prec-5m { font-size: 11px; color: #999; border: 1px solid var(--border, #ddd); border-radius: 3px; padding: 0 3px; }
/* 时间线 tab 全量事件折叠 */
#tl-full-wrap > summary { font-size: 12px; color: var(--fg-muted); user-select: none; padding: 4px 0; }
#tl-full-wrap > summary:hover { color: var(--fg); }
#tl-swimlane .placeholder { min-height: 100px; font-size: 13px; }
#wb-table th.wb-sort .wb-arrow { color: var(--accent); font-size: 10px; margin-left: 2px; }

/* ── 股性卡片 ── */
.personality-card { margin-top: 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-2); padding: 12px 14px; }
.personality-card-inner { display: flex; gap: 16px; align-items: center; }
.personality-info { flex: 1 1 auto; min-width: 0; }
#scr2-personality-radar { flex: 0 0 280px; width: 280px; height: 220px; }
.personality-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pl-title { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.pl-label { font-size: 17px; font-weight: 700; color: var(--fg); }
.pl-score { font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  background: rgba(139,148,158,0.15); color: var(--fg-dim); }
.pl-score.up { background: rgba(248,81,73,0.18); color: var(--red); }
.pl-score.down { background: rgba(63,185,80,0.18); color: var(--green); }
.pl-habit { margin-top: 6px; }
.personality-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ptag { font-size: 12px; padding: 2px 9px; border-radius: 11px; border: 1px solid; }
.ptag.pos { background: rgba(248,81,73,0.12); color: var(--red); border-color: rgba(248,81,73,0.35); }
.ptag.neg { background: rgba(63,185,80,0.12); color: var(--green); border-color: rgba(63,185,80,0.35); }
@media (max-width: 720px) { .personality-card-inner { flex-direction: column; align-items: stretch; }
  #scr2-personality-radar { flex-basis: 200px; width: 100%; } }

/* ── 股性卡片 · 富版(行情图表页) + 标题行融合字段 ── */
.pl-habit-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pl-habit-name { font-weight: 600; color: var(--fg); }
.pl-habit-bar {
  display: flex; flex: 1 1 160px; min-width: 120px; height: 10px;
  border-radius: 5px; overflow: hidden; background: rgba(139, 148, 158, 0.12);
}
.pl-habit-seg { background: rgba(139, 148, 158, 0.45); }
.pl-habit-seg.primary { background: var(--red); }

.pl-explain-grid { display: flex; gap: 16px; align-items: center; margin-top: 10px; }
.pl-explain-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pl-dim-row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.pl-dim-name { flex: 0 0 64px; color: var(--fg-muted); }
.pl-dim-score { flex: 0 0 28px; font-weight: 700; text-align: right; color: var(--fg-dim); }
.pl-dim-score.up { color: var(--red); }
.pl-dim-score.down { color: var(--green); }
.pl-dim-explain { flex: 1 1 auto; color: var(--fg-dim); }
.pl-radar { flex: 0 0 240px; width: 240px; height: 200px; }
.pl-confidence { margin-top: 10px; font-size: 11px; color: var(--fg-muted); }

.kline-title-extra { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: 8px; }
.kline-title-extra .kt-x {
  font-size: 12px; color: var(--fg-dim); padding: 1px 7px;
  border-radius: 10px; background: rgba(139, 148, 158, 0.14);
}
.kline-title-extra .kt-bull.up { color: var(--red); background: rgba(248, 81, 73, 0.15); }
.kline-title-extra .kt-x.up { color: var(--red); background: rgba(248, 81, 73, 0.15); }
.kline-title-extra .kt-x.down { color: var(--green); background: rgba(63, 185, 80, 0.15); }

@media (max-width: 760px) {
  .pl-explain-grid { flex-direction: column; align-items: stretch; }
  .pl-radar { flex: 0 0 auto; width: 100%; }
}

/* 爆发模式:爆发分用红(A股涨色/利好) */
.strip-score.scr-burst { color: var(--red); }
