/* =====================================================================
   A股智投 · 界面样式
   设计原则：屏幕上同一时间只放必要的东西；面板各自滚动，页面本身不滚；
   一种强调色，红涨绿跌；字号偏大、行距宽松，方便长时间看盘。
   ===================================================================== */

/* ---------- 主题变量 ---------- */
:root {
  --fs: 15px;
  --radius: 10px;
  /* 间距尺度：所有留白从这四个值里取，不再各处硬编码 */
  --s1: 6px;
  --s2: 10px;
  --s3: 14px;
  --s4: 18px;
  --bg: #eff1f4;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --border: #e2e5ea;
  --border-2: #eceef2;
  --text: #1b1f27;
  --muted: #66707f;
  --faint: #9aa4b1;
  --accent: #2a5db0;
  --accent-bg: #e9effb;
  --up: #d93a30;
  --down: #189a57;
  --flat: #66707f;
  --up-bg: #fdecea;
  --down-bg: #e5f5ec;
  --hold: #b06f08;
  --hold-bg: #fff2d9;
  --sel: #edf3fd;
  --hover: #f4f6f9;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 4px rgba(16, 24, 40, 0.05);
}
body.theme-dark {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1d2229;
  --border: #272d37;
  --border-2: #222831;
  --text: #e5e8ec;
  --muted: #98a2b3;
  --faint: #6b7583;
  --accent: #74a4ea;
  --accent-bg: #1f2d47;
  --up: #f0534e;
  --down: #31c072;
  --flat: #98a2b3;
  --up-bg: #3b2426;
  --down-bg: #1c3529;
  --hold: #e4ab4c;
  --hold-bg: #3a2f18;
  --sel: #22304a;
  --hover: #1f252d;
  --shadow: none;
}
body.font-large { --fs: 17px; }

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: var(--fs)/1.45 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; overflow: hidden;
  line-height: 1.6;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 600; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 0.86em; }

.btn {
  border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 5px 12px;
  cursor: pointer; line-height: 1.3; white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--hover); border-color: var(--faint); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.small { padding: 3px 10px; font-size: 0.88em; border-radius: 6px; }
.btn.danger { color: var(--up); }
.btn.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.input, .select {
  border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 5px 10px; outline: none;
  min-width: 0;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.input.num { width: 104px; text-align: right; }
.grow { flex: 1; min-width: 0; }

/* 信号胶囊：买入 / 持有 / 卖出 / 观望 */
.act { display: inline-block; padding: 2px 10px; border-radius: 6px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.act-buy { background: var(--up-bg); color: var(--up); }
.act-sell { background: var(--down-bg); color: var(--down); }
.act-hold { background: var(--hold-bg); color: var(--hold); }
.act-wait { background: var(--panel-2); color: var(--muted); }

/* ---------- 整体骨架 ---------- */
.app { display: flex; flex-direction: column; height: 100vh; min-height: 560px; }
.layout {
  flex: 1; min-height: 0; display: grid; gap: var(--s3); padding: var(--s3);
  grid-template-columns: 484px minmax(0, 1fr) 356px;
}
@media (max-width: 1700px) {
  .layout { grid-template-columns: 476px minmax(0, 1fr) 312px; gap: var(--s2); padding: var(--s2); }
  .ticker .idx:nth-child(n + 5) { display: none; }  /* 顶栏只留四大指数，科创50 / 北证50 在盘面页有 */
  .verdict .bt-sum { display: none; }               /* 回测摘要右栏策略说明里有，别让结论条折成两行 */
}
@media (max-width: 1320px) {
  .layout { grid-template-columns: 322px minmax(0, 1fr) 264px; gap: 8px; padding: 8px; }
  .brand .meta { display: none; }
  .panel-head .hint { display: none; }
  .strategy-tabs button small { display: none; }
  .mini { display: none; }             /* 行业、市值等在「概况」里都有 */
  .verdict .bt-sum { display: none; }  /* 回测摘要在右栏策略说明里有 */
  .periods { margin-left: 0; }
  .row2 { justify-content: space-between; }
}
@media (max-height: 760px) {
  .stock-head { padding: var(--s2) var(--s4) var(--s1); }
  .kp { padding: var(--s1) var(--s2); }
}
@media (max-width: 1000px) {
  body { overflow: auto; }
  .app { height: auto; }
  .layout { display: flex; flex-direction: column; }
  .panel.left { height: 540px; flex: none; }
  .panel.center { height: 700px; flex: none; }
  .panel.right { height: 540px; flex: none; }
}
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: var(--s2); padding: 12px var(--s4); border-bottom: 1px solid var(--border-2);
  min-height: 50px;
}
.panel-head b { font-size: 1.04em; }
.panel-foot { padding: 9px var(--s4); border-top: 1px solid var(--border-2); font-size: 0.82em; color: var(--muted); }
.scroll { overflow: auto; flex: 1; min-height: 0; }
.empty { color: var(--muted); padding: 28px 16px; text-align: center; line-height: 1.6; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 58px; flex: none; display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s4);
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.mark { width: 8px; height: 22px; border-radius: 3px; background: linear-gradient(180deg, var(--up) 0%, var(--accent) 100%); }
.logo { font-size: 1.15em; font-weight: 700; letter-spacing: 0.5px; }
.meta { font-size: 0.78em; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.ticker {
  flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.ticker::-webkit-scrollbar { display: none; }
.idx {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 11px; border-radius: 8px; cursor: pointer;
  white-space: nowrap; flex: none; line-height: 1.2;
}
.idx:hover { background: var(--hover); }
.idx .n { font-size: 0.8em; color: var(--muted); }
.idx .p { font-weight: 600; }
.idx .p small { font-weight: 500; margin-left: 4px; font-size: 0.85em; }
.tools { display: flex; align-items: center; gap: 4px; flex: none; }
.status { font-size: 0.82em; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-right: 6px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.status.live::before { background: var(--down); box-shadow: 0 0 0 3px var(--down-bg); }
.status.busy::before { background: var(--hold); }
.status.err::before { background: var(--up); }

/* ---------- 左栏：视图切换 ---------- */
.views { display: flex; padding: var(--s1) var(--s2) 0; border-bottom: 1px solid var(--border-2); flex: none; }
.views button {
  flex: 1; border: none; background: transparent; padding: 8px 4px 9px; cursor: pointer; color: var(--muted);
  font-weight: 600; font-size: 1em; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.views button:hover { color: var(--text); }
.views button.on { color: var(--accent); border-bottom-color: var(--accent); }
.views button small {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; font-size: 0.76em;
  background: var(--panel-2); color: var(--muted); font-weight: 600; line-height: 1.5;
}
.views button small:empty { display: none; }
.views button.on small { background: var(--accent-bg); color: var(--accent); }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.view.hidden { display: none; }
.hidden { display: none !important; }
.news.headlines .kd {
  flex: none; font-size: 0.76em; padding: 1px 6px; border-radius: 4px; font-weight: 600; align-self: flex-start;
  margin-top: 2px;
}
.news.headlines .kd.mk { background: var(--accent-bg); color: var(--accent); }
.news.headlines .kd.co { background: var(--hold-bg); color: var(--hold); }
.toolbar { display: flex; align-items: center; gap: var(--s1); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border-2); flex: none; }
.toolbar.hint { padding: 7px 12px; }
.fld { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 0.92em; }

/* ---------- 左栏：行情列表 ---------- */
.seg { display: flex; gap: 4px; padding: var(--s2) var(--s3) 4px; flex: none; }
.seg button {
  border: none; background: transparent; padding: 5px 13px; border-radius: 6px; cursor: pointer; font-size: 0.88em;
  color: var(--muted);
}
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.thead { display: flex; padding: 9px var(--s3) 7px; font-size: 0.84em; color: var(--muted); border-bottom: 1px solid var(--border-2); flex: none; }
.th { text-align: right; cursor: pointer; user-select: none; padding: 0 5px; flex: none; white-space: nowrap; }
.th.name { flex: 1; text-align: left; }
.th:hover, .th.sorted { color: var(--accent); }
.tbody { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; min-height: 0; }
.tspacer { width: 1px; }
.trows { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.tr {
  display: flex; align-items: center; padding: 0 var(--s3); border-bottom: 1px solid var(--border-2); cursor: pointer;
  font-size: 1em;
}
.tr:hover { background: var(--hover); }
.tr.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.tr.narrow { font-size: 1em; }
.thead.narrow { font-size: 0.88em; }
.td { text-align: right; padding: 0 5px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td.name { flex: 1; text-align: left; display: flex; align-items: center; gap: 5px; min-width: 0; }
.td.name .txt2 { display: flex; flex-direction: column; min-width: 0; }
.td.name .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.35; }
.td.name .cd { color: var(--faint); font-size: 0.8em; line-height: 1.35; }
.star { color: var(--border); cursor: pointer; font-size: 1em; line-height: 1; flex: none; transition: color 0.12s; }
.star:hover { color: var(--hold); }
.star.on { color: #e6a23c; }
.sc { display: inline-block; min-width: 30px; text-align: center; border-radius: 6px; padding: 1px 4px; font-size: 0.86em; font-weight: 600; }
.sc.hi { background: var(--up-bg); color: var(--up); }
.sc.mid { background: var(--hold-bg); color: var(--hold); }
.sc.lo { background: var(--panel-2); color: var(--muted); }

/* ---------- 左栏：卡片（自选 / 买入建议） ---------- */
.cards { padding: 6px 0; }
.card {
  margin: 6px 10px; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--panel);
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.card:hover { border-color: var(--border); background: var(--hover); }
.card.sel { border-color: var(--accent); background: var(--sel); }
.c-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.c-head b { font-size: 1.06em; white-space: nowrap; }
.c-head .code { color: var(--faint); font-size: 0.82em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-head .px { margin-left: auto; font-weight: 700; white-space: nowrap; }
.c-head .px small { font-weight: 600; margin-left: 5px; font-size: 0.85em; }
.c-line { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 0.9em; line-height: 1.4; }
.c-line .muted { flex: 1; min-width: 0; }
.c-kv { display: flex; flex-direction: column; gap: 2px; margin-top: 7px; font-size: 0.9em; }
.c-kv div { display: flex; justify-content: space-between; gap: 10px; white-space: nowrap; border-bottom: 1px dashed var(--border-2); padding: 2px 0; }
.c-kv div:last-child { border-bottom: none; }
.c-kv span { color: var(--muted); }
.c-kv b { font-weight: 600; }
.c-kv b span { color: var(--muted); font-weight: normal; font-size: 0.9em; }
.c-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.86em; color: var(--muted); flex-wrap: wrap; }
.c-foot b { color: var(--text); }
.c-foot .input { width: 84px; padding: 3px 8px; }
.alloc { gap: 12px; }
.alloc b { font-size: 1.05em; }
.rec-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 10px 2px; }
.rec-sum div { background: var(--panel-2); border-radius: 8px; padding: 6px 10px; }
.rec-sum span { display: block; font-size: 0.76em; color: var(--muted); }
.rec-sum b { font-size: 1.02em; }
.note { padding: 8px 14px 10px; color: var(--muted); font-size: 0.82em; line-height: 1.5; }

/* ---------- 中栏：股票头部 ---------- */
.stock-head { padding: var(--s3) var(--s4) var(--s2); border-bottom: 1px solid var(--border-2); flex: none; }
.row1 { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.row1 b { font-size: 1.3em; }
.row1 .code { color: var(--muted); }
.row1 .price { font-size: 1.45em; font-weight: 700; }
.row1 .pct { font-weight: 600; }
.row1 .btn { align-self: center; }
.row2 { display: flex; align-items: center; gap: var(--s1) var(--s3); flex-wrap: nowrap; margin-top: var(--s1); }
.mini { color: var(--muted); font-size: 0.86em; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.periods { display: flex; gap: 4px; margin-left: auto; flex: none; }
.periods button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.periods button:hover { background: var(--hover); color: var(--text); }
.periods button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 0.86em; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chk input { accent-color: var(--accent); }

/* ---------- 中栏：图表 ---------- */
.chart-wrap { flex: 1; min-height: 220px; position: relative; }
#chart { position: absolute; inset: 0; }
.legend {
  position: absolute; top: 8px; left: 10px; right: 76px; z-index: 3; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 0.78em; line-height: 1.5; color: var(--muted);
}
.legend .lg { background: color-mix(in srgb, var(--panel) 82%, transparent); padding: 0 5px; border-radius: 4px; white-space: nowrap; }
.legend .lg-t { color: var(--text); font-weight: 600; }
.legend b { font-weight: 600; }
.legend .ov i { width: 10px; height: 2px; display: inline-block; vertical-align: middle; margin-right: 4px; border-radius: 1px; }
.chart-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted);
  background: var(--panel); z-index: 4; pointer-events: none;
}
.chart-empty.hide { display: none; }

/* ---------- 中栏：结论条 ---------- */
.verdict {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); min-height: 52px; flex: none;
  border-top: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); background: var(--panel-2); flex-wrap: wrap;
}
.verdict .act { font-size: 1.02em; padding: 3px 13px; border-radius: 8px; }
.verdict .name { font-weight: 600; }
.verdict .since, .verdict .note { color: var(--muted); font-size: 0.9em; }
.verdict .bt-sum { margin-left: auto; color: var(--faint); font-size: 0.82em; white-space: nowrap; }

/* ---------- 中栏：买卖要点 ---------- */
.keypoints { flex: none; display: flex; flex-direction: column; }
.kp-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4) var(--s1); }
.kp-head b { font-size: 1.02em; }
.kp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); padding: var(--s1) var(--s4) var(--s3); }
.kp { background: var(--panel-2); border-radius: 8px; padding: var(--s2) var(--s3); min-width: 0; }
.kp > span { display: block; font-size: 0.82em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp > b { display: block; font-size: 1.12em; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp .act { font-size: 0.95em; }
.sc.big { font-size: 1.05em; min-width: 38px; padding: 1px 8px; }
.kp-pos { padding: 0 var(--s4) var(--s3); font-size: 0.9em; color: var(--muted); line-height: 1.5; }
.kp-pos b { color: var(--text); }
.kp-tiles .empty { grid-column: 1 / -1; padding: 12px; }

/* ---------- 资料页复用的信息块 ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 18px; }
.kv div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--border-2); padding: 3px 0; }
.kv span:first-child { color: var(--muted); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; align-items: center; }
.tag { padding: 1px 8px; border-radius: 6px; font-size: 0.85em; background: var(--accent-bg); color: var(--accent); }
.tag.risk { background: var(--up-bg); color: var(--up); }
.tag.grp { background: var(--panel-2); color: var(--muted); }
.score-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.total { font-size: 1.7em; font-weight: 700; }
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 10px; margin: 8px 0 10px; }
.bar .n { font-size: 0.8em; color: var(--muted); display: flex; justify-content: space-between; }
.bar .t { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.bar .t i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 10px; margin-top: 8px; }
.levels .lv { border: 1px solid var(--border-2); border-radius: 8px; padding: 6px 10px; background: var(--panel-2); }
.levels .lv span { display: block; font-size: 0.78em; color: var(--muted); }
.levels .lv b { font-size: 1.04em; }
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border-2); align-items: baseline; }
.news .t { color: var(--faint); font-size: 0.84em; white-space: nowrap; width: 120px; flex: none; }
.news .k { font-size: 0.78em; padding: 0 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); flex: none; }
.news .k.ann { background: var(--hold-bg); color: var(--hold); }
.tbl-wrap { overflow-x: auto; max-width: 100%; }
.tbl-wrap::-webkit-scrollbar { height: 8px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--border-2); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 0.84em; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.fees-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.fees-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 3px 18px; }
.fees-out div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border-2); padding: 3px 0; }

/* ---------- 右栏：策略 ---------- */
.strategy-tabs { display: flex; flex-wrap: wrap; gap: var(--s1); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border-2); flex: none; }
.strategy-tabs button {
  border: 1px solid transparent; background: var(--panel-2); border-radius: 14px; padding: 4px 12px; cursor: pointer;
  font-size: 0.86em; line-height: 1.5; color: var(--muted);
}
.strategy-tabs button small { margin-left: 3px; opacity: 0.75; font-size: 0.9em; }
.strategy-tabs button:hover { color: var(--text); }
.strategy-tabs button.on { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.strategy-list { overflow: auto; flex: 1 1 52%; min-height: 150px; border-bottom: 1px solid var(--border-2); }
.st {
  display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s2); padding: 12px var(--s3); cursor: pointer;
  border-bottom: 1px solid var(--border-2); align-items: center; user-select: none; transition: background 0.12s;
}
.st:hover { background: var(--hover); }
.st.on { background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.st.on .nm { color: var(--accent); }
.st .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .act { font-size: 0.88em; padding: 1px 8px; }
.st .sub { grid-column: 1 / -1; color: var(--muted); font-size: 0.84em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .sub b { color: var(--up); }
.strategy-detail { overflow: auto; padding: var(--s3) var(--s4); font-size: 0.92em; flex: 1 1 48%; min-height: 140px; }
.strategy-detail h4 { margin: 0 0 4px; font-size: 1.06em; display: flex; align-items: center; gap: 8px; }
.strategy-detail h4 .tag { font-weight: normal; }
.strategy-detail p { margin: 4px 0; line-height: 1.55; }
.bt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s3) 0; }
.bt-grid div { background: var(--panel-2); border-radius: 8px; padding: var(--s2) var(--s3); }
.bt-grid span { display: block; font-size: 0.78em; color: var(--muted); }
.picks { list-style: none; margin: 6px 0 0; padding: 0; }
.picks li { display: flex; justify-content: space-between; gap: var(--s1); padding: 8px 5px; border-bottom: 1px dashed var(--border-2); cursor: pointer; border-radius: 4px; }
.picks li:hover { background: var(--hover); }
.picks .c { color: var(--faint); font-size: 0.82em; margin-left: 6px; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 10px; transition: all 0.2s; z-index: 50;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); font-size: 0.95em;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #a4262c; }
.toast.ok { background: #1d7a48; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ---------- 个股资料页 ---------- */
body.page-stock { overflow: auto; }
body.page-stock .topbar { position: sticky; top: 0; z-index: 20; gap: 18px; }
body.page-stock .brand { color: inherit; text-decoration: none; }
body.page-stock .brand:hover { text-decoration: none; }
.search-wrap { position: relative; flex: 1; max-width: 560px; }
.search-wrap .input { width: 100%; padding: 7px 14px; font-size: 1.04em; border-radius: 10px; }
.sug {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; display: none; overflow: hidden; z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px rgba(16, 24, 40, 0.16);
}
.sug.show { display: block; }
.sug div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; cursor: pointer; }
.sug div:hover, .sug div.on { background: var(--hover); }
.sug .code { color: var(--faint); margin-left: 8px; font-size: 0.86em; }
.detail { max-width: 1480px; margin: 0 auto; padding: 14px 16px 48px; display: flex; flex-direction: column; gap: 12px; }
.detail > .empty { padding: 80px 16px; font-size: 1.1em; }
.card-s {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 0;
}
.card-s > h3 {
  margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--border-2); font-size: 1.02em; font-weight: 600;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-s > h3 .hint { font-weight: normal; }
.card-s > h3 .select { padding: 3px 8px; font-size: 0.9em; max-width: 180px; }
.card-s > .body { padding: 12px 16px; font-size: 0.95em; overflow-x: auto; }  /* 宽表格在窄屏下横向滚动，不撑破卡片 */
.d-head { padding: 14px 18px; gap: 8px; }
.d-head .row1 { gap: 12px; }
.d-head .row1 b { font-size: 1.5em; }
.d-head .row1 .price { font-size: 1.6em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 14px; background: var(--panel-2); font-size: 0.9em; }
.chip span { color: var(--muted); }
.chip.hi { background: var(--up-bg); color: var(--up); }
.chip.mid { background: var(--hold-bg); color: var(--hold); }
.chip.lo { background: var(--panel-2); color: var(--muted); }
.chip.act-buy { background: var(--up-bg); color: var(--up); }
.chip.act-sell { background: var(--down-bg); color: var(--down); }
.chip.act-hold { background: var(--hold-bg); color: var(--hold); }
.chip.act-buy span, .chip.act-sell span, .chip.act-hold span { color: inherit; opacity: 0.8; }
.d-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 12px; }
.d-grid.half { grid-template-columns: 1fr 1fr; }
.d-chart { height: 430px; flex: none; }
.d-grid .verdict { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
.sig-sum { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
.sig-h { margin: 10px 0 6px; font-size: 0.92em; color: var(--muted); font-weight: 600; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.sig {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer;
  border: 1px solid var(--border-2); border-radius: 8px; background: var(--panel-2);
}
.sig:hover { border-color: var(--accent); }
.sig span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig .act { font-size: 0.86em; padding: 1px 8px; }
.detail .kv { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 28px; }
.detail .levels { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.detail .news li { padding: 7px 0; }
.detail .tbl td, .detail .tbl th { padding: 6px 10px; }
/* 资金流明细表在窄布局下省略中单 / 小单两列（第 6、7 列），避免横向滚动 */
@media (max-width: 1320px) {
  .tbl.ff th:nth-child(6), .tbl.ff td:nth-child(6), .tbl.ff th:nth-child(7), .tbl.ff td:nth-child(7) { display: none; }
}
@media (max-width: 1100px) {
  .d-grid, .d-grid.half { grid-template-columns: 1fr; }
  .d-chart { height: 380px; }
  body.page-stock .topbar .meta { display: none; }
}
@media (max-width: 760px) {
  body.page-stock .topbar { gap: 8px; padding: 0 10px; }
  #lnk-market { display: none; }
  .detail { padding: 10px 8px 40px; }
}

/* ---------- 提醒：铃铛、弹出层、设置对话框 ---------- */
.bell { position: relative; font-size: 1.05em; padding: 3px 8px; }
.badge {
  position: absolute; top: -4px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--up); color: #fff; font-size: 0.68em; line-height: 16px; text-align: center; font-weight: 600;
}
.pop {
  position: absolute; top: 46px; right: 100px; width: 400px; max-height: 70vh; display: none; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18); z-index: 40;
}
.pop.show { display: flex; }
.pop-head { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border-2); }
.pop-body { overflow: auto; }
.al { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-2); cursor: pointer; }
.al:hover { background: var(--hover); }
.al.unread { background: var(--sel); }
.al .ic { flex: none; width: 18px; text-align: center; color: var(--muted); }
.al.warn .ic { color: var(--up); }
.al-b { min-width: 0; flex: 1; }
.al-t { display: flex; align-items: baseline; gap: 6px; }
.al-time { margin-left: auto; color: var(--faint); font-size: 0.8em; white-space: nowrap; }
.al-x { color: var(--muted); font-size: 0.88em; line-height: 1.45; }
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); display: none; align-items: center; justify-content: center; z-index: 60; }
.modal.show { display: flex; }
.modal-box { width: min(640px, 94vw); max-height: 90vh; background: var(--panel); border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-2); }
.modal-body { padding: 12px 16px; overflow: auto; }
.modal-body h4 { margin: 12px 0 6px; font-size: 0.95em; }
.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.nf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 8px 0; }
.nf-grid .chk { font-size: 0.95em; color: var(--text); }
.nf-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 8px; margin: 6px 0; font-size: 0.92em; }
.nf-row .input { width: 100%; }
@media (max-width: 700px) { .nf-grid { grid-template-columns: 1fr; } .nf-row { grid-template-columns: 1fr; } .pop { right: 8px; width: calc(100vw - 16px); } }

/* ---------- 持仓总览（自选页签顶部） ---------- */
.pf { margin: 8px 10px 4px; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--panel-2); }
.pf-head { display: flex; align-items: center; gap: 8px; }
.pf-form { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pf-form .input.num { width: 110px; }
.pf-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.pf-tiles .kp { background: var(--panel); }
.pf-tiles .kp small { display: block; color: var(--muted); font-size: 0.76em; margin-top: 1px; }
.pf-tips { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.86em; line-height: 1.5; }
.pf-tips li { padding: 3px 8px 3px 22px; position: relative; border-radius: 6px; margin-bottom: 3px; }
.pf-tips li::before { position: absolute; left: 8px; }
.pf-tips li.warn { background: var(--up-bg); color: var(--up); }
.pf-tips li.warn::before { content: "⚠"; }
.pf-tips li.info { background: var(--accent-bg); color: var(--accent); }
.pf-tips li.info::before { content: "•"; }
.pf-tips li.ok { background: var(--down-bg); color: var(--down); }
.pf-tips li.ok::before { content: "✓"; }
.pf-rows { margin-top: 8px; font-size: 0.9em; }
.pf-row { display: grid; grid-template-columns: 1fr 70px 80px; gap: 6px; padding: 4px 6px; border-radius: 6px; cursor: pointer; align-items: center; }
.pf-row span:not(:first-child) { text-align: right; }
.pf-row:hover { background: var(--hover); }
.pf-row.hd { color: var(--muted); font-size: 0.82em; cursor: default; }
.pf-row.hd:hover { background: none; }
.pf-row .nm small { color: var(--faint); }
.pf-ind { margin-top: 8px; display: grid; gap: 3px; font-size: 0.82em; }
.pf-ind div { display: grid; grid-template-columns: 76px 1fr 44px; align-items: center; gap: 6px; }
.pf-ind span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-ind i { display: block; height: 6px; border-radius: 3px; background: var(--accent); opacity: 0.7; }
.pf-ind b { text-align: right; font-weight: 500; }

/* ---------- 晨报页 ---------- */
.briefing .d-head .row1 { align-items: baseline; }
.regime { display: flex; gap: 14px; align-items: flex-start; }
.regime .act { font-size: 1.05em; padding: 4px 14px; flex: none; margin-top: 2px; }
.regime p { margin: 2px 0; line-height: 1.55; }
.regime .advice { font-weight: 600; }
.brief-rows { display: flex; flex-direction: column; gap: 6px; }
.brief-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.6fr) minmax(200px, 1.4fr); gap: 8px 14px; padding: 8px 12px; border-radius: 8px; background: var(--panel-2); align-items: center; }
.brief-row.urgent { box-shadow: inset 3px 0 0 var(--up); }
.br-l .sn { color: inherit; text-decoration: none; }
.br-l .sn:hover b { color: var(--accent); }
.br-l .code { color: var(--faint); font-size: 0.84em; margin-left: 5px; }
.br-m { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.92em; line-height: 1.4; }
.br-r { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.88em; color: var(--muted); }
.kp-tiles.four { grid-template-columns: repeat(4, 1fr); padding: 0; }
.risk-list { margin: 0; padding-left: 22px; line-height: 1.7; }
.risk-list li { color: var(--up); }
.risk-list.plain li { color: var(--text); }
.muted.ok { color: var(--down); }
.sectors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sectors h4 { margin: 0 0 4px; font-size: 0.9em; color: var(--muted); }
.sec-list { list-style: none; margin: 0; padding: 0; }
.sec-list li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--border-2); }
@media (max-width: 900px) { .brief-row { grid-template-columns: 1fr; gap: 4px; } .sectors { grid-template-columns: 1fr; } .kp-tiles.four { grid-template-columns: 1fr 1fr; } }

/* ---------- 盘面页 ---------- */
.subnav { display: flex; gap: 2px; margin-left: 6px; }
.subnav a { padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.subnav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.subnav a.on { background: var(--accent-bg); color: var(--accent); }
.market .sn { color: inherit; text-decoration: none; }
.market .sn:hover b { color: var(--accent); }
.market .sn .code { color: var(--faint); font-size: 0.84em; margin-left: 5px; }
.market .tbl td .star { margin-right: 4px; font-size: 0.9em; }
.market h4 { margin: 8px 0 6px; font-size: 0.95em; }
.market .tbl tr.click { cursor: pointer; }
.market .tbl tr.click:hover td { background: var(--hover); }
.market .tbl td.txt { white-space: normal; min-width: 160px; line-height: 1.35; text-align: left; }
.temp { display: flex; gap: 22px; align-items: center; }
.temp-gauge { flex: none; width: 150px; height: 150px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 8px solid var(--border); background: var(--panel-2); }
.temp-gauge.bull { border-color: var(--up); }
.temp-gauge.bear { border-color: var(--down); }
.temp-gauge.neutral { border-color: var(--hold); }
.temp-score { font-size: 2.4em; font-weight: 700; line-height: 1; }
.temp-label { font-size: 0.82em; color: var(--muted); margin-top: 6px; }
.temp-body { flex: 1; min-width: 0; }
.temp-body .advice { margin: 0 0 10px; font-size: 1.08em; font-weight: 600; }
.kp-tiles.six { grid-template-columns: repeat(4, 1fr); padding: 0; }
.kp-tiles.six .kp small, .kp-tiles.four .kp small { display: block; color: var(--muted); font-size: 0.76em; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.idx-card { display: flex; flex-direction: column; padding: 8px 12px; border-radius: 8px; background: var(--panel-2); color: inherit; text-decoration: none; }
.idx-card:hover { text-decoration: none; background: var(--hover); }
.idx-card span { font-size: 0.82em; color: var(--muted); }
.idx-card b { font-size: 1.15em; }
.idx-card small { font-size: 0.86em; }
.d-chart.short { height: 320px; }
.dist { display: flex; align-items: flex-end; gap: 4px; height: 300px; padding-top: 10px; }
.dist-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.dist-col .n { font-size: 0.78em; color: var(--muted); }
.dist-col .bar-v { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.dist-col .bar-v i { display: block; width: 70%; max-width: 34px; background: var(--up); border-radius: 3px 3px 0 0; opacity: 0.85; }
.dist-col .bar-v i.dn { background: var(--down); }
.dist-col .bar-v i.fl { background: var(--faint); }
.dist-col .lb { font-size: 0.7em; color: var(--muted); margin-top: 4px; white-space: nowrap; transform: scale(0.92); }
.ladder { margin-bottom: 12px; }
.ladder h4 { color: var(--accent); }
.toolbar-row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.seg.inline { padding: 0; }
.members { margin: 6px 0 12px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel-2); }
.members h4 { display: flex; align-items: center; margin: 0 0 6px; }
.headlines li { align-items: flex-start; }
.headlines .sum { color: var(--muted); font-size: 0.86em; line-height: 1.45; margin-top: 2px; }
details summary { cursor: pointer; }
@media (max-width: 1100px) {
  .temp { flex-direction: column; align-items: flex-start; }
  .kp-tiles.six { grid-template-columns: 1fr 1fr; }
  .subnav a { padding: 6px 9px; }
  body.page-market .topbar .meta { display: none; }
}
@media (max-width: 760px) { .subnav { overflow-x: auto; } .dist { height: 220px; } }

/* ---------- AI 助手页 ---------- */
body.page-agent { overflow: hidden; }
.agent-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s3); max-width: 1320px; margin: 0 auto;
  padding: var(--s3) var(--s4); height: calc(100vh - 58px); box-sizing: border-box;
}
.agent-main {
  display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.agent-log { flex: 1; overflow-y: auto; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.msg { max-width: 80%; padding: var(--s2) var(--s3); border-radius: 12px; line-height: 1.7; font-size: 1.02em; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-bg); color: var(--text); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }
.msg.bot p { margin: 0 0 8px; }
.msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul, .msg.bot ol { margin: 4px 0 8px; padding-left: 1.5em; }
.msg.bot li { margin: 3px 0; }
.msg.bot h4 { margin: 10px 0 4px; font-size: 1.02em; }
.msg.bot code { background: var(--panel); padding: 0 5px; border-radius: 4px; font-size: 0.92em; }
.msg.bot table { border-collapse: collapse; margin: 6px 0 8px; font-size: 0.94em; }
.msg.bot th, .msg.bot td { border: 1px solid var(--border); padding: 4px 9px; text-align: right; white-space: nowrap; }
.msg.bot th:first-child, .msg.bot td:first-child { text-align: left; }
.msg.bot th { background: var(--panel); font-weight: 600; }
.msg.bot a.sk { font-weight: 600; }
.msg.err { align-self: stretch; max-width: none; background: var(--up-bg); color: var(--up); font-size: 0.95em; }
.msg.setup { align-self: stretch; max-width: none; }
.msg.setup ol { margin: 6px 0 0; padding-left: 1.5em; }
.msg.setup li { margin: 4px 0; }
.msg.setup code { background: var(--panel); padding: 0 5px; border-radius: 4px; }
.steps { align-self: flex-start; font-size: 0.84em; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 0 4px; }
.steps span::before { content: "·"; margin-right: 5px; color: var(--faint); }
.steps span.busy { color: var(--accent); }
.steps span.busy::before { content: "…"; }
.agent-input { flex: none; border-top: 1px solid var(--border-2); padding: var(--s2) var(--s3); display: flex; gap: var(--s2); align-items: flex-end; }
.agent-input textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 160px; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
  font: inherit; line-height: 1.5; background: var(--panel); color: var(--text); outline: none;
}
.agent-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.agent-input .btn { padding: 11px 20px; }
.agent-foot { flex: none; padding: 4px var(--s3) var(--s2); font-size: 0.8em; color: var(--faint); display: flex; gap: var(--s3); flex-wrap: wrap; }
.agent-side { display: flex; flex-direction: column; gap: var(--s3); min-height: 0; overflow-y: auto; }
.agent-side .card-s > .body { padding: var(--s2) var(--s3) var(--s3); }
.qs { display: flex; flex-direction: column; gap: 6px; }
.qs button {
  text-align: left; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 9px 11px; cursor: pointer;
  line-height: 1.45; color: var(--text); transition: background 0.12s, border-color 0.12s;
}
.qs button:hover { background: var(--hover); border-color: var(--faint); }
.ctx-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-bg); color: var(--accent); border-radius: 8px; padding: 5px 11px; font-weight: 600; }
.ctx-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 1em; padding: 0 2px; line-height: 1; }
@media (max-width: 1000px) {
  body.page-agent { overflow: auto; }
  .agent-wrap { grid-template-columns: 1fr; height: auto; }
  .agent-main { height: 72vh; }
  .msg { max-width: 94%; }
}
