/* 观澜智研 · A股研判台 — 深色交易台风格 */
:root {
  --bg: #0a0e16;
  --panel: #111827;
  --panel2: #161f31;
  --line: #22304a;
  --txt: #dbe4f3;
  --txt2: #7d8ca8;
  --up: #ef4444;      /* A股红涨 */
  --down: #22c55e;    /* 绿跌 */
  --accent: #3b82f6;
  --accent2: #8b5cf6;
  --gold: #f59e0b;
  --ok: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 13px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-width: 1180px;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
[hidden] { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 10px 18px; background: linear-gradient(180deg, #0d1424, #0a0e16);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
}
.brand-name { font-size: 15px; font-weight: 700; }
.brand-name em { font-style: normal; color: var(--accent); margin-left: 4px; }
.brand-sub { font-size: 11px; color: var(--txt2); }
.mode-tabs { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 10px; }
.mode-tab {
  border: 0; background: transparent; color: var(--txt2);
  padding: 7px 18px; border-radius: 8px; font-size: 13px;
}
.mode-tab.active { background: var(--accent); color: #fff; font-weight: 600; }
.index-strip { margin-left: auto; display: flex; gap: 18px; }
.idx { display: flex; flex-direction: column; line-height: 1.35; min-width: 84px; }
.idx i { font-style: normal; font-size: 11px; color: var(--txt2); }
.idx b { font-size: 14px; font-variant-numeric: tabular-nums; }
.idx em { font-style: normal; font-size: 11px; font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--txt2); }

main { padding: 14px 18px 40px; }

/* ===== 工具条 ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.search-wrap { position: relative; }
#stockInput {
  width: 380px; padding: 9px 12px; border-radius: 9px; font-size: 13px;
  border: 1px solid var(--line); background: var(--panel); color: var(--txt); outline: none;
}
#stockInput:focus { border-color: var(--accent); }
.suggest-box {
  position: absolute; top: 40px; left: 0; width: 380px; z-index: 60;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px;
  overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.suggest-item { padding: 8px 12px; cursor: pointer; display: flex; gap: 10px; }
.suggest-item:hover { background: var(--accent); color: #fff; }
.suggest-item .sc { color: var(--gold); font-variant-numeric: tabular-nums; }
.suggest-item:hover .sc { color: #ffe9c2; }
.btn-primary {
  padding: 9px 22px; border: 0; border-radius: 9px; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.toolbar-note { color: var(--txt2); font-size: 12px; }
.quick-codes { margin-left: auto; color: var(--txt2); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--txt2);
  border-radius: 20px; padding: 3px 10px; font-size: 12px;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.seg { display: flex; background: var(--panel); border-radius: 9px; padding: 3px; border: 1px solid var(--line); }
.seg-btn { border: 0; background: transparent; color: var(--txt2); padding: 6px 16px; border-radius: 7px; font-size: 13px; }
.seg-btn.active { background: var(--accent); color: #fff; }

/* ===== 布局 ===== */
.stock-layout { display: grid; grid-template-columns: 295px 1fr; gap: 14px; align-items: start; }
.panel-title {
  font-size: 12px; color: var(--txt2); font-weight: 600; letter-spacing: .08em;
  margin: 4px 2px 8px; display: flex; align-items: center; gap: 8px;
}
.panel-title::before { content: ""; width: 3px; height: 12px; background: var(--accent); border-radius: 2px; }
.runlog-title { margin-top: 14px; }
.mini-btn {
  border: 1px solid var(--line); background: transparent; color: var(--txt2);
  font-size: 11px; border-radius: 6px; padding: 1px 8px;
}

/* ===== 流水线 ===== */
.pipeline-col { position: sticky; top: 72px; }
.pipeline {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.stage-label { font-size: 10px; color: var(--txt2); letter-spacing: .12em; margin: 8px 0 4px; text-align: center; }
.flow-row { display: flex; gap: 6px; justify-content: center; }
.flow-node {
  flex: 1; min-width: 0; text-align: center; padding: 7px 4px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line); cursor: pointer;
  transition: all .25s; position: relative;
}
.flow-node .fn-ic { font-size: 15px; display: block; filter: grayscale(1); opacity: .5; }
.flow-node .fn-name { font-size: 11px; color: var(--txt2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-node .fn-status { font-size: 10px; color: var(--txt2); display: block; height: 14px; }
.flow-node.idle {}
.flow-node.running { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(59,130,246,.35); animation: pulse 1.1s infinite; }
.flow-node.running .fn-ic, .flow-node.running .fn-name { filter: none; opacity: 1; color: #fff; }
.flow-node.running .fn-status { color: var(--accent); }
.flow-node.done { border-color: rgba(16,185,129,.55); }
.flow-node.done .fn-ic { filter: none; opacity: 1; }
.flow-node.done .fn-status { color: var(--ok); }
.flow-node.bullish { border-color: rgba(239,68,68,.6); }
.flow-node.bearish { border-color: rgba(34,197,94,.6); }
.flow-connector { width: 2px; height: 12px; background: var(--line); margin: 2px auto; border-radius: 2px; }
.flow-connector.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .72; } }

.run-log {
  background: #070b12; border: 1px solid var(--line); border-radius: 12px;
  height: 300px; overflow-y: auto; padding: 10px 12px; font-size: 11px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.run-log p { margin: 1px 0; color: var(--txt2); white-space: nowrap; }
.run-log p .t { color: #3d4a63; margin-right: 6px; }
.run-log p.ok { color: #34d399; }
.run-log p.err { color: #f87171; }
.run-log p.info { color: #93c5fd; }

/* ===== 内容区 ===== */
.stock-header {
  background: linear-gradient(90deg, var(--panel), var(--panel2));
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.sh-name { font-size: 20px; font-weight: 700; }
.sh-code { color: var(--txt2); font-size: 13px; margin-left: 6px; }
.sh-price { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sh-chg { font-size: 13px; font-variant-numeric: tabular-nums; }
.sh-meta { display: flex; gap: 14px; color: var(--txt2); font-size: 12px; flex-wrap: wrap; }
.sh-meta b { color: var(--txt); font-variant-numeric: tabular-nums; font-weight: 600; }

.subtabs { display: flex; gap: 4px; margin-bottom: 12px; background: var(--panel); border-radius: 10px; padding: 4px; width: fit-content; border: 1px solid var(--line); }
.subtab { border: 0; background: transparent; color: var(--txt2); padding: 7px 16px; border-radius: 8px; font-size: 13px; }
.subtab.active { background: var(--panel2); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.subtab .badge { font-size: 10px; margin-left: 4px; padding: 0 5px; border-radius: 8px; background: var(--accent); color: #fff; }

.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.chart-card-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--txt2); margin-bottom: 6px; }
.chart-tools { display: flex; gap: 12px; }
.chart-tools label { display: flex; gap: 4px; align-items: center; cursor: pointer; }
.chart-lg { height: 430px; }
.chart-md { height: 320px; }
.chart-sm { height: 210px; }

/* KPI */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.kpi .k { font-size: 11px; color: var(--txt2); }
.kpi .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 10px; color: var(--txt2); }

/* 分析师卡片 */
.analyst-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.analyst-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.ac-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ac-ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; background: var(--panel2); }
.ac-name { font-weight: 700; font-size: 14px; }
.ac-role { font-size: 11px; color: var(--txt2); }
.ac-score { margin-left: auto; text-align: right; }
.ac-score b { font-size: 18px; }
.ac-verdict { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.verdict-strongbuy { background: rgba(239,68,68,.16); color: var(--up); }
.verdict-buy { background: rgba(239,68,68,.10); color: #f87171; }
.verdict-hold { background: rgba(125,140,168,.14); color: var(--txt2); }
.verdict-sell { background: rgba(34,197,94,.10); color: #4ade80; }
.verdict-strongsell { background: rgba(34,197,94,.16); color: var(--down); }
.ac-chart { height: 200px; margin: 6px 0 8px; }
.ac-bullets { font-size: 12px; color: var(--txt); }
.ac-bullets li { margin: 4px 0 4px 16px; }
.ac-bullets .pos { color: #f87171; } .ac-bullets .neg { color: #4ade80; } .ac-bullets .neu { color: var(--txt2); }

/* 辩论 */
.debate-box { max-height: 72vh; overflow-y: auto; padding-right: 6px; }
.debate-round { margin-bottom: 10px; }
.debate-round-title { font-size: 11px; color: var(--txt2); text-align: center; margin: 10px 0; letter-spacing: .1em; }
.debate-msg { display: flex; gap: 10px; margin-bottom: 10px; }
.dm-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.dm-avatar.bull { background: rgba(239,68,68,.18); }
.dm-avatar.bear { background: rgba(34,197,94,.18); }
.dm-avatar.mgr { background: rgba(139,92,246,.2); }
.dm-body { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.dm-who { font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.dm-who.bull { color: var(--up); } .dm-who.bear { color: var(--down); } .dm-who.mgr { color: var(--accent2); }
.dm-text { font-size: 12.5px; color: var(--txt); }
.dm-text ul { margin: 4px 0 2px 16px; }
.dm-text li { margin: 2px 0; }

/* 风险 */
.risk-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.risk-cards { display: flex; flex-direction: column; gap: 10px; }
.risk-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.rc-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.rc-level { margin-left: auto; font-size: 11px; padding: 1px 9px; border-radius: 9px; }
.risk-low { background: rgba(16,185,129,.14); color: var(--ok); }
.risk-mid { background: rgba(245,158,11,.14); color: var(--gold); }
.risk-high { background: rgba(239,68,68,.16); color: var(--up); }
.rc-text { font-size: 12px; color: var(--txt); }
.rc-suggest { margin-top: 4px; font-size: 12px; color: var(--gold); }
.risk-events table, .drawer table { width: 100%; border-collapse: collapse; font-size: 12px; }
.risk-events th, .risk-events td, .drawer th, .drawer td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
.risk-events th, .drawer th { color: var(--txt2); font-weight: 500; font-size: 11px; }
.tag { display: inline-block; padding: 0 7px; border-radius: 8px; font-size: 11px; }
.tag-danger { background: rgba(239,68,68,.15); color: var(--up); }
.tag-warn { background: rgba(245,158,11,.14); color: var(--gold); }
.tag-ok { background: rgba(16,185,129,.13); color: var(--ok); }
.tag-info { background: rgba(59,130,246,.14); color: #93c5fd; }

/* 决策 */
.decision-box { display: grid; grid-template-columns: 300px 1fr; gap: 12px; }
.decision-left { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
#decisionGauge { height: 220px; }
.decision-action { font-size: 26px; font-weight: 800; margin: 2px 0 6px; }
.decision-conf { color: var(--txt2); font-size: 12px; }
.decision-right { display: flex; flex-direction: column; gap: 12px; }
.dec-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.dec-card h4 { font-size: 13px; margin-bottom: 8px; color: var(--txt2); }
.dec-card ul { margin-left: 16px; font-size: 12.5px; }
.dec-card li { margin: 3px 0; }
.dec-card li.pos { color: #f87171; }
.dec-card li.neg { color: #4ade80; }
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.plan-item { background: var(--panel2); border-radius: 9px; padding: 8px 10px; }
.plan-item .k { font-size: 11px; color: var(--txt2); }
.plan-item .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

.empty-hint { color: var(--txt2); text-align: center; padding: 60px 0; }

/* ===== 板块 ===== */
.sector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-heat { grid-column: 1 / 3; }
.span-scat { grid-column: 1 / 3; }
.sector-heat { display: flex; flex-wrap: wrap; gap: 6px; min-height: 260px; }
.heat-cell {
  width: 122px; min-height: 60px; border-radius: 8px; padding: 6px 9px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .12s;
}
.heat-cell:hover { transform: scale(1.06); z-index: 2; }
.heat-cell .hn { font-size: 11px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-cell .hv { font-size: 15px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.heat-cell .hl { font-size: 10px; line-height: 1.2; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-strip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 8px; }
.lg.dn3 { background: #065f46; } .lg.dn2 { background: #10b98166; } .lg.flat { background: #334155; }
.lg.up1 { background: #ef444466; } .lg.up2 { background: #ef4444aa; } .lg.up3 { background: #ef4444; }
.rank-list { min-height: 250px; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.rank-row:hover { background: var(--panel2); }
.rank-row .rk { width: 20px; color: var(--txt2); font-variant-numeric: tabular-nums; }
.rank-row .rn { width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .rbar-wrap { flex: 1; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.rank-row .rbar { height: 100%; border-radius: 4px; }
.rank-row .rv { width: 74px; text-align: right; font-variant-numeric: tabular-nums; }

/* 抽屉 */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer-mask { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.drawer-body {
  position: absolute; right: 0; top: 0; bottom: 0; width: 720px; max-width: 92vw;
  background: var(--bg); border-left: 1px solid var(--line); padding: 16px 18px;
  overflow-y: auto; animation: slidein .22s ease;
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 16px; }
.drawer-sub { color: var(--txt2); font-size: 12px; margin-left: 8px; }
.drawer-sec-title { font-size: 12px; color: var(--txt2); margin: 12px 0 6px; font-weight: 600; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.member-row:hover { background: var(--panel2); }
.member-row .mc { color: var(--txt2); width: 62px; font-variant-numeric: tabular-nums; }
.member-row .mn { width: 110px; }
.member-row .mp { width: 74px; text-align: right; font-variant-numeric: tabular-nums; }
.member-row .mg { flex: 1; color: var(--txt2); font-size: 11px; }

/* toast */
.toast {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 120;
  background: #1e293b; border: 1px solid var(--line); color: var(--txt);
  padding: 9px 18px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.err { border-color: rgba(239,68,68,.5); color: #fca5a5; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #243050; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
