/* A股短线智囊 控制台 — 深色金融风设计系统
   配色约定: A股惯例 红涨(.up) 绿跌(.down)。零外部资源。 */
:root {
  --bg: #0b0e14;
  --surface: #121723;
  --surface-2: #171d2b;
  --surface-3: #1d2435;
  --border: #242c3e;
  --border-light: #2e3850;
  --text: #e9edf5;
  --text-2: #aab3c5;
  --text-3: #6b7488;
  --accent: #4f7cff;
  --accent-soft: rgba(79, 124, 255, .12);
  --up: #f0453e;        /* 涨=红 */
  --up-soft: rgba(240, 69, 62, .12);
  --down: #2eb872;      /* 跌=绿 */
  --down-soft: rgba(46, 184, 114, .12);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --font-num: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; height: 56px;
  background: rgba(11, 14, 20, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.brand .sub { font-size: 11px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.topbar .spacer { flex: 1; }
.clock { font-family: var(--font-num); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.pill.ok .dot { background: var(--down); box-shadow: 0 0 6px var(--down); }
.pill.live .dot { background: var(--up); box-shadow: 0 0 6px var(--up); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ===== 导航 ===== */
.nav {
  display: flex; gap: 2px; padding: 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 56px; z-index: 40;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 11px 16px; color: var(--text-2); font-size: 14px;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color .15s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ===== 布局 ===== */
.page { max-width: 1280px; margin: 0 auto; padding: 20px 20px 80px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-6 { grid-template-columns: repeat(6, 1fr); }
.span-2 { grid-column: span 2; }
@media (max-width: 1080px) { .cols-6 { grid-template-columns: repeat(3, 1fr); } .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) {
  .page { padding: 14px 12px 80px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .cols-6 { grid-template-columns: repeat(2, 1fr); }
  .span-2 { grid-column: span 1; }
  .clock { display: none; }
}

/* ===== 卡片 ===== */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card h3 {
  font-size: 13px; color: var(--text-2); font-weight: 600;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.card h3 .right { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--text-3); }

/* 指数卡 */
.idx-card { padding: 14px 16px; }
.idx-card .nm { font-size: 12px; color: var(--text-2); }
.idx-card .px { font-family: var(--font-num); font-size: 22px; font-weight: 700; margin: 2px 0; letter-spacing: -.5px; }
.idx-card .chg { font-family: var(--font-num); font-size: 13px; font-weight: 600; }

/* 数值颜色 */
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* 统计大数卡 */
.stat-card .lbl { font-size: 12px; color: var(--text-3); }
.stat-card .val { font-family: var(--font-num); font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* 涨跌宽度条 */
.breadth-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-3); margin: 10px 0 6px; }
.breadth-bar .u { background: var(--up); }
.breadth-bar .d { background: var(--down); }
.breadth-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--border);
}
.chip b { font-family: var(--font-num); font-weight: 600; margin-left: 4px; }

/* ===== 候选卡 ===== */
.cand { margin-bottom: 14px; }
.cand-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cand-rank {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-family: var(--font-num);
}
.cand-name { font-size: 16px; font-weight: 700; }
.cand-code { color: var(--text-3); font-family: var(--font-num); font-size: 12px; }
.badge {
  padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.badge.buy { background: var(--up-soft); color: var(--up); border: 1px solid rgba(240,69,62,.3); }
.badge.hold { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-light); }
.badge.score { background: var(--accent-soft); color: var(--accent); }
.cand-price { margin-left: auto; text-align: right; }
.cand-price .px { font-family: var(--font-num); font-size: 18px; font-weight: 700; }
.dims { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.dim { flex: 1; min-width: 76px; }
.dim .t { font-size: 11px; color: var(--text-3); display: flex; justify-content: space-between; }
.dim .bar { height: 5px; border-radius: 3px; background: var(--surface-3); margin-top: 4px; overflow: hidden; }
.dim .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), #7ea2ff); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.tag.good { color: #7ea2ff; border-color: rgba(79,124,255,.35); background: var(--accent-soft); }
.tag.warn { color: var(--warn); border-color: rgba(245,165,36,.35); background: var(--warn-soft); }
.verdict {
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
}
.verdict .params { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; font-size: 12px; color: var(--text-2); }
.verdict .params b { color: var(--text); font-family: var(--font-num); }
details.debate { margin-top: 10px; }
details.debate summary {
  cursor: pointer; font-size: 12px; color: var(--text-3); user-select: none;
  list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
details.debate summary::before { content: "▸"; transition: transform .15s; }
details.debate[open] summary::before { transform: rotate(90deg); }
.debate-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 720px) { .debate-cols { grid-template-columns: 1fr; } }
.debate-box { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.debate-box.bull { background: var(--up-soft); border: 1px solid rgba(240,69,62,.22); }
.debate-box.bear { background: var(--down-soft); border: 1px solid rgba(46,184,114,.22); }
.debate-box b { color: var(--text); }

/* ===== 表格 ===== */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; white-space: nowrap; }
th { background: var(--surface-3); color: var(--text-3); font-weight: 600; font-size: 12px; position: sticky; top: 0; }
tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: rgba(79,124,255,.05); }
td.r, th.r { text-align: right; }

/* ===== 按钮/输入 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .05s;
}
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-light); }
.btn.sm { padding: 5px 12px; font-size: 12px; }
select, textarea, input[type=password], input[type=text] {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; font-family: inherit; outline: none;
}
select:focus, textarea:focus, input:focus { border-color: var(--accent); }
textarea { width: 100%; min-height: 180px; font-family: var(--font-num); line-height: 1.8; resize: vertical; }

/* ===== 图表 ===== */
.chart-wrap { width: 100%; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.donut-row { display: flex; align-items: center; gap: 14px; }
.donut { width: 76px; height: 76px; border-radius: 50%; flex: none; position: relative; }
.donut::after {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  background: var(--surface);
}
.donut .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-num); font-weight: 700; font-size: 15px; z-index: 1; }

/* ===== 报告 ===== */
.report-layout { display: grid; grid-template-columns: 300px 1fr; gap: 14px; }
@media (max-width: 900px) { .report-layout { grid-template-columns: 1fr; } }
.report-list { max-height: 70vh; overflow-y: auto; }
.report-item {
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border: 1px solid transparent;
}
.report-item:hover { background: var(--surface-3); }
.report-item.active { background: var(--accent-soft); border-color: rgba(79,124,255,.3); }
.report-item .d { font-family: var(--font-num); font-size: 12px; color: var(--text-3); }
.rp-date {
  font-family: var(--font-num); font-size: 11px; color: var(--text-3);
  padding: 10px 12px 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
  position: sticky; top: 0; background: var(--surface-2); z-index: 1;
}
.article { max-height: 75vh; overflow-y: auto; padding-right: 6px; }
.article table { display: block; overflow-x: auto; max-width: 100%; }
.article h1 { font-size: 20px; margin: 14px 0 10px; }
.article h2 { font-size: 16px; margin: 22px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.article h3 { font-size: 14px; margin: 16px 0 8px; color: #c7d2ea; }
.article p, .article li { color: var(--text-2); font-size: 13.5px; }
.article ul { padding-left: 20px; }
.article blockquote { border-left: 3px solid var(--warn); background: var(--warn-soft); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: 13px; }
.article table { font-size: 12.5px; margin: 10px 0; }
.article code { background: var(--surface-3); padding: 1px 6px; border-radius: 4px; font-size: 12px; font-family: var(--font-num); }
.article em { color: var(--text-3); }
.article hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ===== 时间线/运行记录 ===== */
.run-ok { color: var(--down); }
.run-fail { color: var(--up); }
.run-going { color: var(--warn); }
.timeline { display: flex; gap: 10px; }
.tl-item { flex: 1; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.tl-item .t { font-size: 12px; color: var(--text-3); }
.tl-item .s { font-weight: 600; margin-top: 3px; font-size: 13px; }
@media (max-width: 720px) { .timeline { flex-direction: column; } }

/* ===== 空态/骨架/吐司 ===== */
.empty { text-align: center; padding: 44px 16px; color: var(--text-3); }
.empty .ico { font-size: 34px; margin-bottom: 10px; }
.skel { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); border: 1px solid var(--border-light);
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; box-shadow: var(--shadow);
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.muted { color: var(--text-3); font-size: 12px; }
.section-title { font-size: 15px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-title .right { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--text-3); }

/* 分段筛选按钮 */
.seg { display: inline-flex; border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden; }
.seg button {
  background: var(--surface-2); color: var(--text-2); border: none;
  padding: 4px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.seg button + button { border-left: 1px solid var(--border-light); }
.seg button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* 日志框 */
.logbox {
  font-family: var(--font-num); font-size: 11.5px; line-height: 1.7;
  color: var(--text-2); white-space: pre-wrap; word-break: break-all;
  max-height: 320px; overflow-y: auto; margin: 0;
}

/* 登录页 */
.login-box {
  max-width: 360px; margin: 18vh auto 0; padding: 30px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-box h1 { font-size: 18px; margin-bottom: 6px; }
.login-box .muted { margin-bottom: 18px; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box .btn { width: 100%; justify-content: center; }
