/* A股投研专业版 — 4 栏暗色界面 (1:1 复刻截图布局)
   配色规则: 红涨绿跌, 暗色调主题, 圆角面板, 蓝色 accent
*/
:root, body.pro {
  --bg:         #0a0b10;     /* 最暗背景 */
  --pane:       #14151b;     /* 面板暗色 */
  --pane-2:     #1a1b22;     /* 次面板 */
  --hover:      #22232b;
  --border:     #22232b;
  --border-strong: #2e2f37;
  --text:       #ececec;
  --text-2:     #b5b7bd;
  --dim:        #6a6d75;
  --accent:     #4f6cff;
  --accent-2:   #3d56e0;
  --up:         #ef5350;     /* 红 — 涨 (A股) */
  --down:       #26a69a;     /* 绿 — 跌 (A股) */
  --warn:       #f0b045;
  --pro-gold:   #d9a55c;
}

/* 亮色主题 — A 股惯例: 红涨绿跌的色不变, 只换背景/字色 */
body.pro.light {
  --bg:         #f5f7fa;     /* 最浅背景 */
  --pane:       #ffffff;     /* 卡片白 */
  --pane-2:     #f0f2f6;     /* 次浅, 用于行 hover / 输入框等 */
  --hover:      #e8ecf2;
  --border:     #e1e4ea;
  --border-strong: #c8ccd4;
  --text:       #1a1d24;
  --text-2:     #4a525c;
  --dim:        #8a8f99;
  --accent:     #4263eb;
  --accent-2:   #3651cf;
}
body.pro.light { background: var(--bg); color: var(--text); }
/* 亮色下需要重写的几个半透明色 (rgba 不走变量, 单独覆盖) */
body.pro.light .ai-msg.report-link,
body.pro.light #pro-app.sidebar-collapsed { background: var(--bg); }
body.pro.light .sw-item.active {
  background: rgba(66, 99, 235, 0.08);
}
body.pro.light .watchlist-list .sw-item.active {
  background: rgba(66, 99, 235, 0.08);
}
body.pro.light .news-sub.active {
  background: rgba(66, 99, 235, 0.1);
}
body.pro.light .new-chat-btn kbd {
  background: rgba(255, 255, 255, 0.22);
}
body.pro.light .sidebar-toggle:hover { background: var(--hover); }
/* 亮色下滚动条更柔 */
body.pro.light ::-webkit-scrollbar-thumb { background: #c8ccd4; }
body.pro.light ::-webkit-scrollbar-thumb:hover { background: #a0a6b0; }

/* 主题切换按钮内的 sun/moon icon — 默认暗色显月亮, 亮色显太阳 */
.th-icon { display: none; }
body.pro:not(.light) .th-moon { display: block; }
body.pro.light .th-sun { display: block; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; overflow: hidden;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px;
}
.hidden { display: none !important; }

/* ===== 登录遮罩 (跟简易版同款, 简单复用) ===== */
#login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-box {
  width: 340px; padding: 32px;
  background: var(--pane); border: 1px solid var(--border);
  border-radius: 12px; text-align: center;
}
.login-box h2 { font-size: 20px; margin-bottom: 4px; }
.login-sub { color: var(--dim); font-size: 14.5px; margin-bottom: 20px; }
.login-box input {
  width: 100%; padding: 10px 12px; margin-bottom: 10px;
  background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 15.5px;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.code-row { display: flex; gap: 8px; margin-bottom: 10px; }
.code-row input { flex: 1; margin-bottom: 0; }
.code-row button {
  white-space: nowrap; padding: 0 14px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--pane-2); color: var(--text);
  font-size: 13.5px; cursor: pointer;
}
.code-row button:disabled { opacity: .55; cursor: not-allowed; }
.login-actions { display: flex; gap: 8px; margin-top: 6px; }
.login-actions button {
  flex: 1; padding: 9px 14px; border: none; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 14.5px; cursor: pointer;
}
.login-actions button.secondary { background: var(--pane-2); color: var(--text); }
.login-error { color: var(--up); font-size: 13.5px; margin-top: 10px; min-height: 16px; }

/* ============================================================
   主布局 — 4 列 (左侧两栏可整体折叠)
   ============================================================ */
#pro-app {
  display: grid;
  grid-template-columns: 248px 1fr 660px;
  height: 100vh; width: 100vw;
}
/* 显式定列, 防止 display:none 后后面元素跑位 (grid 隐式 placement 会让后续 item 顶到前面的空列) */
.sessions-watchlist { grid-column: 1; }
.chart-area        { grid-column: 2; min-width: 0; }
.ai-pane           { grid-column: 3; min-width: 0; }

#pro-app.sidebar-collapsed {
  grid-template-columns: 0 1fr 660px;
}
#pro-app.sidebar-collapsed .sessions-watchlist {
  display: none;
}
/* 折叠按钮 (放在 stock-header 最左侧) */
.sidebar-toggle {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--pane); color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer; font-size: 15.5px;
  margin-right: 10px;
  transition: background .15s, color .15s, transform .2s;
}
.sidebar-toggle:hover {
  background: var(--hover); color: var(--text);
}
#pro-app.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

/* 登录页大号 Z 标识 */
.login-logo {
  width: 60px; height: 60px; border-radius: 14px; margin: 0 auto 14px;
  background: linear-gradient(135deg, #06d6e0 0%, #4f6cff 52%, #9b5cf6 100%);
  color: #fff; font-weight: 800; font-size: 34px; font-style: italic;
  letter-spacing: -1px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(79, 108, 255, 0.5);
}

/* ============================================================
   Col 1: 会话历史 + 自选
   ============================================================ */
.sessions-watchlist {
  background: var(--pane);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.new-chat-btn {
  margin: 12px 12px 8px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 500;
  transition: background .15s;
}
.new-chat-btn:hover { background: var(--accent-2); }
.new-chat-btn kbd {
  margin-left: auto; padding: 1px 5px; font-size: 11.5px;
  background: rgba(255,255,255,0.18); border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace;
}

.sw-section {
  display: flex; flex-direction: column;
  flex: 0 0 auto;
  padding: 8px 0 4px;
  border-top: 1px solid var(--border);
}
.sw-section:nth-of-type(2) { flex: 1 1 auto; overflow: hidden; }
.sw-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 10px;
  font-size: 14px; font-weight: 600;
  color: var(--text-2); letter-spacing: 0.3px;
}
.sw-head-icons { display: flex; gap: 4px; }
.icon-btn {
  background: transparent; border: none; color: var(--dim);
  padding: 3px 6px; cursor: pointer; font-size: 14.5px; border-radius: 4px;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.balance-pill {
  font-size: 12px; color: var(--text); background: var(--hover);
  padding: 3px 9px; border-radius: 11px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border, rgba(128,128,128,.25));
}
.balance-pill:hover { background: var(--accent, #5b8def); color: #fff; }
.balance-pill.low { color: #ef5350; border-color: #ef5350; font-weight: 600; }

/* ===== 充值弹窗 ===== */
#recharge-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; }
#recharge-overlay.hidden { display: none; }
.rc-modal { position: relative; width: min(460px, 92vw); max-height: 90vh; overflow-y: auto;
  background: var(--pane, #fff); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.rc-close { position: absolute; top: 14px; right: 16px; border: none; background: transparent;
  color: var(--dim); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px; border-radius: 6px; }
.rc-close:hover { background: var(--hover); color: var(--text); }
.rc-title { margin: 0 0 18px; font-size: 24px; font-weight: 800; }
.rc-tabs { display: inline-flex; gap: 4px; background: var(--hover); border-radius: 10px; padding: 4px; margin-bottom: 6px; }
.rc-tab { border: none; background: transparent; color: var(--dim); font-size: 14px; font-weight: 600;
  padding: 7px 16px; border-radius: 8px; cursor: pointer; }
.rc-tab.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.rc-section-label { font-size: 13px; color: var(--dim); margin: 18px 0 10px; }
.rc-amounts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rc-amt { min-width: 76px; padding: 12px 8px; border: 1px solid var(--border); background: var(--hover);
  color: var(--text); border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; }
.rc-amt:hover { border-color: var(--accent, #5b8def); }
.rc-amt.active { background: var(--accent, #5b8def); border-color: var(--accent, #5b8def); color: #fff; }
.rc-pricing { color: var(--dim); font-size: 13.5px; cursor: pointer; margin-left: 2px; text-decoration: none; }
.rc-pricing:hover { color: var(--accent, #5b8def); text-decoration: underline; }
.rc-custom-input, .rc-redeem-input { width: 100%; box-sizing: border-box; margin-top: 10px; padding: 11px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; }
.rc-custom-input:focus, .rc-redeem-input:focus { outline: none; border-color: var(--accent, #5b8def); }
.rc-methods { display: flex; flex-direction: column; gap: 10px; }
.rc-method { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px;
  border: 1.5px solid var(--border); background: var(--bg); border-radius: 12px; cursor: pointer; color: var(--text); }
.rc-method:hover { border-color: var(--accent, #5b8def); }
.rc-method.active { border-color: var(--text); }
.rc-mi { width: 30px; height: 30px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px; flex: none; }
.rc-mi-alipay { background: #1677ff; }
.rc-mi-wechat { background: #07c160; }
.rc-mname { flex: 1; text-align: left; font-size: 15px; font-weight: 600; }
.rc-mcheck { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--border); color: transparent; font-size: 13px; flex: none; }
.rc-method.active .rc-mcheck { background: var(--text); color: var(--bg); }
.rc-pay-btn { width: 100%; margin-top: 22px; padding: 14px; border: none; border-radius: 12px;
  background: var(--accent, #5b8def); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; }
.rc-pay-btn:hover { filter: brightness(1.08); }
.rc-pay-btn:disabled { opacity: .55; cursor: not-allowed; }
.rc-foot { text-align: center; color: var(--dim); font-size: 12.5px; margin-top: 14px; }
.rc-bank-box { background: var(--hover); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.rc-bank-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 5px 0; }
.rc-bank-row span { color: var(--dim); }
.rc-bank-tip { color: var(--dim); font-size: 12.5px; margin-top: 8px; line-height: 1.5; }
.rc-redeem { display: flex; gap: 10px; }
.rc-redeem-input { margin-top: 0; flex: 1; }
.rc-redeem-btn { padding: 0 18px; border: none; border-radius: 10px; background: var(--accent, #5b8def); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; }
.rc-qr { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0; }
.rc-qr-amt { font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.rc-qr-imgwrap { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 8px; display: flex; align-items: center; justify-content: center; }
.rc-qr-img { width: 100%; height: 100%; object-fit: contain; }
.rc-qr-tip { margin-top: 14px; font-size: 14px; color: var(--text); }
.rc-qr-status { margin-top: 8px; font-size: 13px; color: var(--dim); }
.rc-qr-status.paid { color: #26a69a; font-weight: 700; }
.rc-qr-status.err { color: #ef5350; }
.rc-qr-back { margin-top: 16px; border: none; background: transparent; color: var(--dim); cursor: pointer; font-size: 13px; }
.rc-qr-back:hover { color: var(--text); }

.sw-list { flex: 1; overflow-y: auto; padding: 0 6px; }
.sw-empty { color: var(--dim); font-size: 13.5px; padding: 12px; text-align: center; }
.sw-item {
  padding: 8px 10px; margin: 2px 0; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.sw-item:hover { background: var(--hover); }
.sw-item.active { background: var(--pane-2); }
.sw-item-left { min-width: 0; flex: 1; }
.sw-item-del {
  background: transparent; border: none; color: var(--dim);
  padding: 2px 6px; cursor: pointer; font-size: 12.5px;
  opacity: 0; transition: opacity .15s, color .15s;
  border-radius: 4px;
}
.sw-item:hover .sw-item-del { opacity: 1; }
.sw-item-del:hover { color: var(--up); background: var(--hover); }
/* #13 重命名按钮 (✎) — 与删除同款, hover 用主题色 */
.sw-item-ren {
  background: transparent; border: none; color: var(--dim);
  padding: 2px 5px; cursor: pointer; font-size: 12.5px;
  opacity: 0; transition: opacity .15s, color .15s; border-radius: 4px;
}
.sw-item:hover .sw-item-ren { opacity: 1; }
.sw-item-ren:hover { color: var(--accent); background: var(--hover); }

/* 吐司 (轻量提示, 自选添加成功 / 失败用) */
.pro-flash {
  position: fixed; left: 50%; bottom: 32px;
  transform: translate(-50%, 30px); opacity: 0;
  background: var(--pane); color: var(--text);
  padding: 9px 18px; border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-size: 14.5px; z-index: 9999;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.pro-flash.show { opacity: 1; transform: translate(-50%, 0); }
.sw-item-title {
  font-size: 14.5px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sw-item-meta { color: var(--dim); font-size: 12.5px; margin-top: 2px; }

/* 自选列表 — 个股行 (专业版样式: 左大名右大价 + 涨跌胶囊) */
.watchlist-list .sw-item {
  padding: 9px 10px;
  margin: 1px 0;
  border-radius: 6px;
  position: relative;
  border-left: 2px solid transparent;
  transition: background .12s, border-left-color .12s;
}
.watchlist-list .sw-item:hover {
  background: var(--hover);
}
.watchlist-list .sw-item.active {
  background: rgba(79, 108, 255, 0.08);
  border-left-color: var(--accent);
}
.watchlist-list .sw-item-left {
  min-width: 0;
}
.watchlist-list .sw-item-title {
  font-size: 15.5px; font-weight: 500;
  color: var(--text);
  line-height: 1.25;
}
.watchlist-list .sw-item-meta {
  color: var(--dim); font-size: 13px;
  margin-top: 3px;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.2px;
}
.watchlist-list .sw-item-right {
  text-align: right;
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 3px;
  margin-right: 6px;
}
.watchlist-list .wl-price {
  color: var(--text);
  font-size: 16px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Consolas, monospace;
  line-height: 1.1;
}
.watchlist-list .wl-change {
  font-size: 13.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, Consolas, monospace;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(106, 109, 117, 0.15);
  color: var(--dim);
  min-width: 58px; text-align: center;
}
.watchlist-list .wl-change.up {
  color: #ff7a76;
  background: rgba(239, 83, 80, 0.14);
}
.watchlist-list .wl-change.down {
  color: #4ecabb;
  background: rgba(38, 166, 154, 0.14);
}
.watchlist-list .sw-item-del {
  position: absolute; top: 4px; right: 4px;
  font-size: 12.5px; padding: 2px 5px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}
.watchlist-list .sw-item:hover .sw-item-del {
  background: rgba(239, 83, 80, 0.18);
  color: #ff7a76;
}

.view-all, .manage-watchlist {
  background: transparent; border: none;
  color: var(--dim); font-size: 14px; padding: 9px 14px;
  text-align: left; cursor: pointer; text-decoration: none;
  border-top: 1px solid var(--border);
}
.view-all:hover, .manage-watchlist:hover { color: var(--text-2); }
.manage-watchlist {
  margin-top: auto; text-align: center;
  padding: 10px; font-weight: 500;
}

/* ============================================================
   Col 3: 行情主区
   ============================================================ */
.chart-area {
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden; min-width: 0;
  container-type: inline-size;   /* 让头部能按主区实际宽度(随侧栏伸缩)动态自适应 */
}

/* 头部信息条 */
.stock-header {
  flex: 0 0 auto;   /* 钉死, 不被下面内容挤压/盖住 */
  padding: 12px 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: grid;
  /* 左列可收缩(长描述靠省略号截断, 不撑乱); 右列指标=固定 3 列网格的自然宽 → 每只股布局一致 */
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 4px 20px;
  align-items: center;
}
.sh-left {
  grid-column: 1 / 2; grid-row: 1;
  display: flex; align-items: center; gap: 8px;
}
.sh-left .sh-name, .sh-left .sh-code, .sh-left .sh-tags {
  align-self: baseline;
}
.sh-name { font-size: 20px; font-weight: 700; color: var(--text); }
.sh-code { font-size: 14.5px; color: var(--text-2);
           font-family: ui-monospace, Consolas, monospace; }
.sh-tags { display: inline-flex; gap: 4px; margin-left: 4px; }
.sh-tag {
  font-size: 12.5px; padding: 2px 8px; border-radius: 4px;
  background: var(--pane-2); color: var(--text-2);
  border: 1px solid var(--border);
}
/* 今日信号徽章 — 颜色由 JS 按 买红/卖绿/持琥珀 内联设置 (A股红涨绿跌). 克制的淡底胶囊+圆点 */
.sh-signal { margin: 0 10px; display: inline-flex; align-items: center; }
.sh-sig-chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 2.5px 9px 2.5px 7px; border-radius: 999px;
}
.sh-sig-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: none; }
.sh-sig-str { font-size: 10.5px; font-weight: 700; opacity: .8; margin-left: 1px; }
.sh-price-row {
  grid-column: 1 / 2; grid-row: 2;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px;
}
.sh-price {
  font-size: 30px; font-weight: 700;
  font-family: ui-monospace, Consolas, monospace;
}
.sh-change {
  font-size: 16.5px; font-weight: 600;
  font-family: ui-monospace, Consolas, monospace;
}
/* 红涨绿跌 — 三个元素都跟着 stock-header 的 up/down/flat class 走 */
.stock-header.up   .sh-price,
.stock-header.up   .sh-change   { color: var(--up); }
.stock-header.down .sh-price,
.stock-header.down .sh-change   { color: var(--down); }
.stock-header.flat .sh-price,
.stock-header.flat .sh-change   { color: var(--text); }

.sh-status-bar {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto; color: var(--dim); font-size: 13.5px;
}
.sh-status-icon { color: var(--down); font-size: 10.5px; }
.stock-header.is-trading .sh-status-icon { color: var(--up); animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.sh-time { font-family: ui-monospace, Consolas, monospace; }
.sh-zone { color: var(--dim); }

.sh-metrics {
  grid-column: 2 / 3; grid-row: 1 / 3;
  /* ★ 固定 3 列 Grid: 15 个指标恒为 3×5, 每只股布局完全一致 (不再随描述长短/值宽乱跳) */
  display: grid;
  grid-template-columns: repeat(3, 158px);
  column-gap: 22px; row-gap: 5px;
  align-content: center;
}
.m-cell {
  /* 标签左 / 数值右 — 同列数值整齐对齐 */
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  white-space: nowrap; min-width: 0;
}
.m-cell .k { color: var(--dim); font-size: 13px; flex: 0 0 auto; }
.m-cell .v {
  color: var(--text); font-size: 14.5px; font-weight: 500;
  font-family: ui-monospace, Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis;   /* 极长值(市值)也不破列 */
}
.m-cell .v.up   { color: var(--up); }
.m-cell .v.down { color: var(--down); }

/* 主区变窄 (展开侧栏 / 小屏): 指标掉到价格下方, 仍是固定列数(降为2列), 不退回内容驱动的乱布局 */
@container (max-width: 920px) {
  .stock-header { grid-template-columns: 1fr; }
  .sh-left      { grid-column: 1; grid-row: 1; }
  .sh-price-row { grid-column: 1; grid-row: 2; }
  .sh-metrics {
    grid-column: 1; grid-row: 3;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    justify-content: start; margin-top: 4px;
  }
}

/* Tab 切换 */
.ca-tabs {
  flex: 0 0 auto;   /* 钉死, 切到长内容的子tab时不被盖住 */
  display: flex; gap: 0; padding: 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.ca-tab {
  position: relative;
  padding: 11px 18px; background: transparent; border: none;
  color: var(--dim); font-size: 15.5px; cursor: pointer; white-space: nowrap;
}
.ca-tab:hover { color: var(--text-2); }
.ca-tab.active { color: var(--text); font-weight: 600; }
.ca-tab.active::after {
  content: ''; position: absolute; left: 16px; right: 16px; bottom: 0;
  height: 2px; background: var(--accent);
}
.ca-pane { flex: 1 1 auto; min-height: 0; overflow: hidden; display: none; }
.ca-pane.active { display: flex; flex-direction: column; }

/* ===== K线 tab 内的多图网格 (最多 6 窗). 2~3 窗全宽上下排; 4 窗 2×2; 5~6 窗 2 列 3 行 ===== */
#chart-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  gap: 2px;
  background: var(--border);   /* gap 透出来当分隔线 */
}
#chart-grid[data-count="2"] { grid-template-columns: 1fr;     grid-template-rows: 1fr 1fr; }
#chart-grid[data-count="3"] { grid-template-columns: 1fr;     grid-template-rows: 1fr 1fr 1fr; }
#chart-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
#chart-grid[data-count="5"],
#chart-grid[data-count="6"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; }
.chart-cell { position: relative; min-width: 0; min-height: 0; background: var(--bg); }
.chart-cell > div { width: 100%; height: 100%; }   /* TradingView 注入的容器撑满 */
/* 焦点高亮: 多窗 (非单图) 时给焦点格描蓝边 */
#chart-grid:not([data-count="1"]) .chart-cell.focused { box-shadow: inset 0 0 0 2px var(--accent); }
.ca-todo, .ca-loading {
  color: var(--dim); padding: 40px; text-align: center;
}

/* ===== 情景预测工具条 (K线 tab 顶部) ===== */
.fc-toolbar {
  flex: 0 0 auto; position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px; min-height: 34px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.fc-title { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.fc-modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.fc-mode {
  padding: 4px 13px; background: transparent; border: none; border-right: 1px solid var(--border);
  color: var(--dim); font-size: 13px; cursor: pointer;
}
.fc-mode:last-child { border-right: none; }
.fc-mode:hover { color: var(--text); background: rgba(127,127,127,0.10); }
.fc-mode.active { color: #fff; background: var(--accent); }
.fc-caption { color: var(--text-2); display: inline-flex; align-items: center; gap: 7px; flex-wrap: nowrap; overflow: hidden; }
.fc-caption .fc-act-buy  { color: #ef5350; font-weight: 700; }   /* 买入=红 (A股涨) */
.fc-caption .fc-act-sell { color: #26a69a; font-weight: 700; }   /* 卖出=绿 (A股跌) */
.fc-caption .fc-act-hold { color: var(--warn); font-weight: 700; }
/* AI预测结果小标签 (紧凑彩色, 替代旧的长串截断文字) */
.fc-pill {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; line-height: 1.5;
  background: var(--pane-2); border: 1px solid var(--border); color: var(--text-2);
}
.fc-pill b { font-weight: 700; font-variant-numeric: tabular-nums; }
.fc-pill.up   { background: rgba(239,83,80,.10);  border-color: rgba(239,83,80,.35);  color: #ef5350; }
.fc-pill.down { background: rgba(38,166,154,.10); border-color: rgba(38,166,154,.35); color: #26a69a; }
.fc-note { color: var(--dim); font-size: 11px; white-space: nowrap; }
/* #18 今日信号可展开看依据 (独立一行, 置于 fc-toolbar 之下) */
#fc-sig-detail:not(:empty) { padding: 5px 14px; background: var(--bg); border-bottom: 1px solid var(--border); }
.fc-basis { margin: 0; }
.fc-basis > summary { cursor: pointer; font-size: 11.5px; color: var(--dim); list-style: none; user-select: none; }
.fc-basis > summary::-webkit-details-marker { display: none; }
.fc-basis[open] > summary { color: var(--text-2); }
.fc-basis ul { margin: 5px 0 2px; padding-left: 16px; }
.fc-basis li { font-size: 11.5px; line-height: 1.6; color: var(--text-2); }
.fc-basis-note { font-size: 10.5px; color: var(--dim); opacity: .85; margin-top: 2px; }
.fc-switch-day { color: var(--accent); cursor: pointer; font-weight: 600; }
.fc-switch-day:hover { text-decoration: underline; }
.fc-disclaimer { margin-left: auto; color: var(--dim); font-size: 11.5px; white-space: nowrap; }

/* ===== 群体推演 按钮 + 全屏 overlay ===== */
.fc-swarm-btn { margin-left: 10px; padding: 4px 11px; border: 1px solid var(--accent); border-radius: 6px;
  background: rgba(79,108,255,0.12); color: var(--accent); font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fc-swarm-btn:hover { background: rgba(79,108,255,0.22); }
/* 一键画线 — 按钮 + 目的卡弹层 */
.fc-drawkit-btn { margin-left: 8px; padding: 4px 11px; border: 1px solid var(--border-strong, var(--border));
  border-radius: 6px; background: var(--pane-2); color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap; }
.fc-drawkit-btn:hover { border-color: var(--accent); color: var(--accent); }
.fc-drawkit-btn.active { background: rgba(79,108,255,0.16); border-color: var(--accent); color: var(--accent); }
.dk-pop { position: absolute; top: 38px; right: 14px; z-index: 60; width: 340px;
  max-height: 78vh; overflow-y: auto;
  background: var(--pane); border: 1px solid var(--border-strong, var(--border)); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.45); padding: 8px; }
.dk-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-size: 12.5px; color: var(--dim); }
.dk-head-btns { display: flex; align-items: center; gap: 6px; }
.dk-clear { background: transparent; border: 1px solid var(--border); color: var(--text-2); border-radius: 6px;
  padding: 3px 9px; font-size: 12px; cursor: pointer; }
.dk-clear:hover { border-color: #ef5350; color: #ef5350; }
.dk-close { background: transparent; border: none; color: var(--dim); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 4px; border-radius: 6px; }
.dk-close:hover { color: var(--text); background: var(--hover); }
.dk-card { display: block; width: 100%; text-align: left; background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; margin: 5px 0; cursor: pointer; transition: border-color .12s, background .12s; }
.dk-card:hover { border-color: var(--accent); background: rgba(79,108,255,0.10); }
.dk-card.active { border-color: var(--accent); background: rgba(79,108,255,0.16); }
.dk-card-name { font-size: 13.5px; color: var(--text); font-weight: 600; }
.dk-card-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.dk-cap { font-size: 12.5px; color: var(--text-2); line-height: 1.5; padding: 8px 6px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.dk-cap:empty { display: none; }
.prem-tag { font-size: 10px; font-weight: 700; background: linear-gradient(135deg,#d9a55c,#f0c75e);
  color: #1a1a1a; border-radius: 4px; padding: 1px 5px; }
#swarm-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; }
.sw-modal { width: 94vw; height: 92vh; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.sw-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.sw-title { font-size: 18px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw-sub { color: var(--dim); font-size: 12.5px; flex: 1; }
.sw-close { background: var(--pane-2); border: none; color: var(--text-2); width: 30px; height: 30px;
  border-radius: 6px; cursor: pointer; font-size: 15px; }
.sw-launch { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.sw-stock { font-weight: 700; font-size: 15px; white-space: nowrap; }
.sw-param { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.sw-param input { width: 52px; padding: 7px 8px; background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; text-align: center; }
.sw-param input:focus { outline: none; border-color: var(--accent); }
#sw-event { flex: 1; padding: 9px 12px; background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 14px; }
#sw-event:focus { outline: none; border-color: var(--accent); }
#sw-go { padding: 9px 20px; background: var(--accent); color: #fff; border: none; border-radius: 7px;
  cursor: pointer; font-size: 14px; white-space: nowrap; }
#sw-go:disabled { opacity: .5; cursor: not-allowed; }
.sw-status { color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.sw-ground { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 8px 18px;
  border-bottom: 1px solid var(--border); background: var(--pane); font-size: 12px; color: var(--text-2); }
.sw-ground .sg-tag { color: #ffca28; font-weight: 700; }
.sw-ground .sg-anchor { padding: 2px 8px; border-radius: 5px; background: var(--pane-2); border: 1px solid var(--border); }
.sw-ground .sg-up { color: #ef5350; } .sw-ground .sg-down { color: #26a69a; }
.sw-ground b { color: var(--text); font-family: ui-monospace, Consolas; }
.sw-param select { padding: 7px 6px; background: var(--pane-2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; }
/* 持仓诊断卡 — 结论先行, 这是产品主角 */
.sw-diag { padding: 12px 18px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(91,141,239,0.08), transparent); }
.sw-diag.kind-act { background: linear-gradient(180deg, rgba(255,179,0,0.12), transparent); }
.sd-row1 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.sd-title { font-size: 14px; font-weight: 700; }
.sd-pnl { font-family: ui-monospace, Consolas; font-size: 13px; }
.sd-pnl.up { color: #ef5350; } .sd-pnl.down { color: #26a69a; }
.sd-verdict { font-size: 19px; font-weight: 800; margin: 2px 0 4px; }
.sd-verdict.act { color: #ffb300; } .sd-verdict.hold { color: #5b8def; }
.sd-verdict .sd-str { font-size: 12px; font-weight: 600; color: var(--dim); }
.sd-reasons { font-size: 12.5px; color: var(--text-2); margin-bottom: 7px; }
.sd-sc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.sd-sc span { font-size: 12.5px; background: var(--pane-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; }
.sd-safety { font-size: 12.5px; color: var(--text-2); }
.sd-disc { font-size: 11px; color: var(--dim); margin-top: 6px; }
.sw-body { flex: 1; display: grid; grid-template-columns: 1fr 380px; grid-template-rows: minmax(0, 1fr); min-height: 0; }
.sw-left { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#sw-net { flex: 1; min-height: 0; background: radial-gradient(circle at 50% 40%, #1b1f2a, #12141b); transition: background .3s; }
body.pro.light #sw-net { background: radial-gradient(circle at 50% 40%, #eef1f6, #e2e7f0); }   /* #14 浅色主题下不再突兀黑底 */
.sw-netbar { display: flex; align-items: center; gap: 14px; padding: 6px 14px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--dim); flex-wrap: wrap; }
.sw-round { color: var(--text-2); font-weight: 600; }
.sw-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }
.sw-right { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sw-stats { display: flex; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sw-stats b { font-size: 18px; font-family: ui-monospace, Consolas; } .sw-stats i { font-size: 12px; color: var(--dim); font-style: normal; }
.sw-tabs { display: flex; border-bottom: 1px solid var(--border); }
.sw-tab { flex: 1; padding: 9px; background: transparent; border: none; color: var(--dim); cursor: pointer; font-size: 13.5px; }
.sw-tab.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.sw-feed, .sw-report { flex: 1; overflow: auto; padding: 12px 14px; }
.sw-feed { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.sw-fl { background: var(--pane); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; line-height: 1.45; animation: swin .32s cubic-bezier(.22,1,.36,1); }
@keyframes swin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
/* #2 思考中转圈 */
.reason-spin { display: inline-block; width: 11px; height: 11px; border: 2px solid rgba(127,127,127,.25); border-top-color: var(--accent, #2962ff); border-radius: 50%; animation: proSpin .8s linear infinite; margin-right: 6px; vertical-align: -1px; }
@keyframes proSpin { to { transform: rotate(360deg); } }
.sw-fl .who { color: #ffca28; }
.sw-fl .sg-up { color: #ef5350; font-weight: 600; } .sw-fl .sg-down { color: #26a69a; font-weight: 600; } .sw-fl .sw-act-n { color: var(--dim); }
.sw-rd { margin-top: 6px; padding-top: 6px; font-size: 11px; color: var(--dim); text-align: center; border-top: 1px dashed var(--border); }
.sw-rd:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.sw-rd b.sg-up { color: #ef5350; } .sw-rd b.sg-down { color: #26a69a; }
.sw-report { font-size: 13.5px; line-height: 1.7; }
.sw-regen-bar { background: rgba(239,83,80,0.12); border: 1px solid rgba(239,83,80,0.4); border-radius: 7px;
  padding: 9px 11px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.sw-regen-bar button { margin-left: 4px; padding: 5px 12px; background: var(--accent); color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.sw-regen-bar button:disabled { opacity: .55; cursor: not-allowed; }
.sw-report h2 { font-size: 16px; margin: 14px 0 6px; color: var(--accent); }
.sw-hint { color: var(--dim); font-size: 12.5px; padding: 20px; text-align: center; }
.sw-foot { padding: 8px 18px; border-top: 1px solid var(--border); color: var(--dim); font-size: 11.5px; text-align: center; }

/* ===== Tab 面板内容通用样式 (财务/研报/股东/资金/资料/公告) ===== */
.ca-pane.active { overflow-y: auto; }
/* 资讯区例外: 它内部已是 subtabs(钉顶) + news-list(自己滚) 的两段结构,
   若让整个 pane 再 overflow 滚动, 切到行业/板块/大盘 内容长时会把 subtabs 顶出视野(挡住tab)。
   所以资讯 pane 自身不滚, 只让 news-list 内部滚, subtabs 永远在顶。 */
.ca-pane[data-pane="news"].active { overflow: hidden; }
.tab-table-wrap {
  padding: 16px 20px; color: var(--text);
}
.tab-h3 {
  font-size: 15.5px; font-weight: 600; color: var(--text);
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.tab-table {
  width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px;
}
.tab-table th, .tab-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px; text-align: left;
  font-family: ui-monospace, Consolas, monospace;
}
.tab-table th {
  background: var(--pane); color: var(--text-2);
  font-weight: 600; font-size: 13.5px;
  position: sticky; top: 0; z-index: 1;
}
.tab-table tr:hover td { background: var(--hover); }
.tab-table td.up   { color: var(--up); }
.tab-table td.down { color: var(--down); }
.tab-source {
  color: var(--dim); font-size: 12.5px; margin-top: 6px; font-style: italic;
}

/* 研报 tab — 评级 pill 配色 */
.reports-summary { color: var(--text-2); font-size: 13.5px; margin-bottom: 8px; }
.rating-dist { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.rating-pill {
  padding: 3px 9px; border-radius: 10px; font-size: 13px;
  background: var(--pane-2); border: 1px solid var(--border); color: var(--text-2);
}
.rating-pill b { color: var(--text); font-weight: 600; margin-left: 2px; }
.tab-table td.rating-buy    { color: var(--up);   font-weight: 600; }
.tab-table td.rating-add    { color: #ff9800;     font-weight: 600; }
.tab-table td.rating-hold   { color: var(--text-2); }
.tab-table td.rating-reduce { color: var(--down); font-weight: 600; }
.tab-table td.rating-sell   { color: var(--down); font-weight: 700; }
.report-title { font-family: inherit; max-width: 480px; }

/* 资料 tab — 板块 tag */
.info-table .info-k { color: var(--text-2); width: 120px; }
.info-table .info-v { color: var(--text); font-weight: 500; }
.info-boards { display: flex; flex-wrap: wrap; gap: 6px; }
.info-tag {
  padding: 3px 10px; border-radius: 12px;
  background: var(--pane-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13px;
}

/* 分时 tab — canvas 容器 */
.intraday-wrap canvas {
  width: 100%; max-width: 1200px; height: 380px; display: block;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  margin-bottom: 8px;
}

/* 资讯 list (个股 / 行业 / 板块 / 大盘 共用) */
.news-list {
  flex: 1; overflow-y: auto; padding: 8px 16px 12px;
}
.news-item {
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.news-item:hover { background: var(--pane); }
.news-title { color: var(--text); font-size: 15px; margin-bottom: 4px; font-weight: 500; }
.news-title a { color: var(--text); text-decoration: none; }
.news-title a:hover { color: var(--accent); }
.news-summary {
  color: var(--text-2); font-size: 13px;
  line-height: 1.55; margin-bottom: 4px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.news-meta { color: var(--dim); font-size: 12px; }
.news-meta .kw { color: var(--accent); }

/* 资讯 sub-tab (个股 / 行业 / 板块 / 大盘) */
.news-subtabs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  flex: 0 0 auto;                 /* 钉在顶, 不被下面的列表挤压/顶掉 */
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.news-sub {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2);
  padding: 5px 14px; border-radius: 14px;
  cursor: pointer; font-size: 13px;
  transition: background .12s, color .12s, border-color .12s;
}
.news-sub:hover { color: var(--text); border-color: var(--border-strong); }
.news-sub.active {
  background: rgba(79, 108, 255, 0.14);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.news-sub-meta {
  margin-left: auto; color: var(--dim); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================
   Col 4: AI 投研助手面板
   ============================================================ */
.ai-pane {
  background: var(--pane);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ai-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ai-title {
  flex: 1; font-size: 15.5px; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.ai-icon { font-size: 15.5px; }

.ai-tabs {
  display: flex; padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.ai-tab {
  position: relative; padding: 8px 14px;
  background: transparent; border: none;
  color: var(--dim); font-size: 14.5px; cursor: pointer;
}
.ai-tab:hover { color: var(--text-2); }
.ai-tab.active { color: var(--text); }
.ai-tab.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 2px; background: var(--accent);
}

.ai-content {
  flex: 1; overflow-y: auto; padding: 12px 14px 6px;
}

/* ===== AI 对话视图 (输入后覆盖摘要面板) ===== */
.ai-chat-view {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}
.ai-chat-view.hidden { display: none; }
.ai-chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--pane);
}
.back-summary-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); padding: 4px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13.5px;
}
.back-summary-btn:hover { background: var(--hover); color: var(--text); }
.ai-chat-title { color: var(--text); font-size: 14.5px; font-weight: 600; }

/* ===== 长任务进度卡片 (生成报告时显示, 在对话视图头部下方) ===== */
.task-progress {
  flex: 0 0 auto; padding: 10px 14px;
  background: var(--pane); border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.task-progress .tp-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; cursor: pointer; user-select: none;
}
.task-progress.collapsed .tp-header { margin-bottom: 0; }
.task-progress.collapsed .tp-stages,
.task-progress.collapsed .tp-current { display: none; }
.task-progress .tp-toggle {
  background: none; border: none; padding: 2px; margin-left: 2px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--dim); cursor: pointer;
}
.task-progress .tp-toggle:hover { color: var(--text); }
.task-progress .tp-chevron { transition: transform .2s ease; }
.task-progress.collapsed .tp-chevron { transform: rotate(-90deg); }
.task-progress svg,
.task-progress svg polyline { stroke: currentColor !important; fill: none !important; }
.task-progress .tp-spinner {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); animation: tp-pulse 1.2s ease-in-out infinite;
}
@keyframes tp-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .4; } }
.task-progress .tp-title { flex: 1; font-weight: 600; color: var(--text); }
.task-progress .tp-pct {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--accent); font-size: 11px; font-weight: 600;
  min-width: 30px; text-align: right;
}
.task-progress .tp-elapsed {
  font-family: ui-monospace, Consolas, monospace; color: var(--dim); font-size: 11px;
}
.task-progress .tp-bar {
  position: relative; height: 4px; border-radius: 3px;
  background: var(--border); overflow: hidden; margin: 2px 0 4px;
}
.task-progress .tp-fill {
  display: block; height: 100%; width: 0%;
  background: var(--accent); border-radius: 3px; transition: width .35s ease;
}
.task-progress.done .tp-fill { background: var(--down); }
.task-progress.indeterminate .tp-fill {
  width: 35% !important; transition: none; animation: tp-indet 1.1s ease-in-out infinite;
}
.task-progress.indeterminate .tp-pct { display: none; }
@keyframes tp-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.task-progress .tp-stages {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 12px; margin-bottom: 6px;
}
.task-progress .tp-stage {
  display: flex; align-items: center; gap: 5px;
  color: var(--dim); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-progress .tp-stage.done { color: var(--down); }
.task-progress .tp-stage.active { color: var(--accent); font-weight: 600; }
.task-progress .tp-stage .tp-mark { display: inline-block; width: 12px; text-align: center; font-size: 10px; }
.task-progress .tp-current {
  color: var(--text); font-size: 11.5px;
  border-top: 1px dashed var(--border); padding-top: 5px; margin-top: 2px; min-height: 16px;
}
.task-progress.done .tp-spinner { animation: none; background: var(--down); }
.task-progress.done .tp-current { color: var(--down); }
/* 失败/中断态 — 用琥珀(既非涨红也非跌绿, 避免误读为涨跌), 明确告知"出错了"而非永远转圈 */
.task-progress.failed .tp-spinner { animation: none; background: #e0922e; }
.task-progress.failed .tp-fill { background: #e0922e; }
.task-progress.failed .tp-current { color: #e0922e; font-weight: 600; }
/* 卡死提示 — 长时间无新进展时 tp-current 变琥珀, 提示后端繁忙/可刷新 */
.task-progress .tp-current.stuck { color: #e0922e; }

.ai-msg-list {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-msg { font-size: 14.5px; line-height: 1.7; word-break: break-word; }
.ai-msg.user {
  align-self: flex-end; max-width: 88%;
  background: var(--pane-2); border: 1px solid var(--border);
  padding: 7px 11px; border-radius: 10px;
  white-space: pre-wrap;
}
.ai-msg.assistant {
  align-self: flex-start; max-width: 96%;
}
.ai-msg.assistant .role {
  color: var(--accent); font-size: 12.5px; margin-bottom: 3px;
}
.ai-msg.assistant .content { color: var(--text); }
/* 标题分级 — 拉开 h1/h2/h3 字号与间距, 一眼看出结构层次 (原来 h1~h3 统一 15.5px, 几乎与正文同号) */
.ai-msg.assistant .content.markdown h1,
.ai-msg.assistant .content.markdown h2,
.ai-msg.assistant .content.markdown h3,
.rp-md.markdown h1, .rp-md.markdown h2, .rp-md.markdown h3 {
  color: var(--text); font-weight: 700; line-height: 1.35;
}
.ai-msg.assistant .content.markdown h1, .rp-md.markdown h1 {
  font-size: 18px; margin: 15px 0 9px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.ai-msg.assistant .content.markdown h2, .rp-md.markdown h2 {
  font-size: 16px; margin: 14px 0 7px;
  border-left: 3px solid var(--accent); padding-left: 8px;
}
.ai-msg.assistant .content.markdown h3, .rp-md.markdown h3 {
  font-size: 14.5px; margin: 11px 0 5px; font-weight: 600; color: var(--text-2);
}
/* 首个块不要顶部留白 (否则消息一上来一道空隙) */
.ai-msg.assistant .content.markdown > *:first-child,
.rp-md.markdown > *:first-child { margin-top: 0; }
/* 正文呼吸感 — 段距/列表缩进放宽, 中文密排不挤 */
.ai-msg.assistant .content.markdown p,
.rp-md.markdown p { margin: 7px 0; }
.ai-msg.assistant .content.markdown ul,
.ai-msg.assistant .content.markdown ol,
.rp-md.markdown ul, .rp-md.markdown ol { margin: 7px 0; padding-left: 22px; }
.ai-msg.assistant .content.markdown li,
.rp-md.markdown li { margin: 3px 0; }
.ai-msg.assistant .content.markdown li > ul,
.ai-msg.assistant .content.markdown li > ol,
.rp-md.markdown li > ul, .rp-md.markdown li > ol { margin: 3px 0; }
.ai-msg.assistant .content.markdown strong,
.rp-md.markdown strong { color: var(--text); font-weight: 600; }
.ai-msg.assistant .content.markdown table,
.rp-md.markdown table {
  border-collapse: collapse; margin: 6px 0; font-size: 13px;
  display: block; overflow-x: auto; max-width: 100%;
  border: 1px solid var(--border-strong); border-radius: 4px;
}
.ai-msg.assistant .content.markdown th,
.ai-msg.assistant .content.markdown td,
.rp-md.markdown th, .rp-md.markdown td {
  border: 1px solid var(--border-strong); padding: 4px 7px; white-space: nowrap;
}
.ai-msg.assistant .content.markdown th,
.rp-md.markdown th { background: var(--pane-2); color: var(--text); font-weight: 600; }
.ai-msg.assistant .content.markdown code,
.rp-md.markdown code {
  background: var(--pane-2); padding: 1px 4px; border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
}
.ai-msg.assistant .content.markdown blockquote,
.rp-md.markdown blockquote {
  border-left: 3px solid var(--accent); padding: 2px 10px;
  margin: 6px 0; color: var(--text-2);
  background: rgba(79, 108, 255, 0.05); border-radius: 0 4px 4px 0;
}
/* 多行代码块 — 独立底色/内边距/横向滚动, 不再与正文糊在一起 (原来只有 inline code 有底色) */
.ai-msg.assistant .content.markdown pre,
.rp-md.markdown pre {
  background: var(--pane-2); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 6px; margin: 8px 0;
  overflow-x: auto; font-size: 13px; line-height: 1.5;
}
.ai-msg.assistant .content.markdown pre code,
.rp-md.markdown pre code { background: none; padding: 0; font-size: 13px; }
/* 引用溯源角标 [value](claim:N) → 小上标 [N] (renderMd 里转换), 替代原来指向 claim:N 的死链 */
.ai-msg.assistant .content.markdown sup.cite,
.rp-md.markdown sup.cite {
  color: var(--accent); font-size: 0.72em; font-weight: 600;
  cursor: help; padding: 0 1px; vertical-align: super;
}
/* 生成中占位光标 — 空 assistant 节点到首 token 之间显示, 缓解"卡住"观感 */
.ai-msg.assistant .content.streaming-pending::after {
  content: '▋'; color: var(--accent); margin-left: 1px;
  animation: ai-caret-blink 1s step-start infinite;
}
@keyframes ai-caret-blink { 50% { opacity: 0; } }

.ai-msg.reasoning {
  align-self: flex-start; max-width: 96%;
  background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px;
}
.ai-msg.reasoning > summary {
  cursor: pointer; color: var(--dim); font-size: 13px;
  user-select: none; list-style: none;
}
.ai-msg.reasoning > summary::-webkit-details-marker { display: none; }
.ai-msg.reasoning > summary::before { content: '▸ '; }
.ai-msg.reasoning[open] > summary::before { content: '▾ '; }
.ai-msg.reasoning .reasoning-body {
  margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--border-strong);
  color: var(--dim); font-size: 13px;
  white-space: pre-wrap; max-height: 240px; overflow-y: auto;
}

.ai-msg.tool {
  align-self: flex-start; max-width: 96%;
  background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 9px; font-size: 13px;
}
.ai-msg.tool .tool-name { color: var(--accent); font-weight: 600; }
.ai-msg.tool .tool-args {
  color: var(--dim); margin-top: 2px;
  white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
}
.ai-msg.tool .tool-result {
  color: var(--dim); margin-top: 4px;
  border-top: 1px solid var(--border-strong); padding-top: 4px;
  white-space: pre-wrap; word-break: break-all;
  max-height: 100px; overflow-y: auto;
}

.ai-msg.system {
  align-self: center; color: var(--dim); font-size: 12.5px;
}
.ai-msg.report-link {
  align-self: center; padding: 7px 14px;
  background: rgba(79, 108, 255, 0.1);
  border: 1px solid var(--accent); border-radius: 8px;
}
.ai-msg.report-link a {
  color: var(--accent); text-decoration: none; font-size: 14.5px; font-weight: 600;
}
.ai-msg.report-link a:hover { text-decoration: underline; }

.ai-sec {
  background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  margin-bottom: 10px;
}
.ai-sec-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 8px;
}
.ai-sec-meta {
  margin-left: auto; color: var(--dim); font-size: 12.5px; font-weight: normal;
  font-family: ui-monospace, Consolas, monospace;
}
.ai-help { color: var(--dim); font-size: 12.5px; cursor: help; }

/* 盘中速览 */
.ai-narrative {
  color: var(--text-2); font-size: 15px; line-height: 1.6;
  margin-bottom: 10px;
}
.ai-quick-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
}
.qg-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 0;
}
.qg-cell .v {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600; font-size: 15.5px; color: var(--text);
}
.qg-cell .v.up   { color: var(--up); }
.qg-cell .v.down { color: var(--down); }
.qg-cell .k { color: var(--dim); font-size: 12.5px; }

/* 关键价位 */
#key-levels-list .kl-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  font-size: 15px;
}
.kl-label { color: var(--dim); width: 50px; }
.kl-label.res { color: var(--up); }
.kl-label.sup { color: var(--down); }
.kl-price {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text); font-weight: 600; min-width: 60px;
}
.kl-note { color: var(--dim); font-size: 12.5px; margin-left: auto; }

/* 资金流向 */
.flow-top {
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
}
.flow-net { flex: 1; }
.flow-net .k { display: block; color: var(--dim); font-size: 12.5px; margin-bottom: 2px; }
.flow-net .v {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 19.5px; font-weight: 700;
}
.flow-net .v.up   { color: var(--up); }
.flow-net .v.down { color: var(--down); }
#flow-donut { flex-shrink: 0; }

.flow-breakdown {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px;
  font-size: 13px;
}
.fb { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.fb .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.fb .v {
  margin-left: auto; font-family: ui-monospace, Consolas, monospace;
  font-weight: 500;
}
.fb .v.up   { color: var(--up); }
.fb .v.down { color: var(--down); }

/* 情绪指标 */
.senti-row {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px;
}
.senti-label-k { color: var(--dim); font-size: 13.5px; }
.senti-score {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 20px; font-weight: 700; color: var(--text);
}
.senti-label-v {
  margin-left: auto; padding: 2px 8px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
  background: rgba(239, 83, 80, 0.15); color: var(--up);
}
.senti-label-v.bear { background: rgba(38, 166, 154, 0.15); color: var(--down); }
.senti-label-v.neutral { background: rgba(125, 125, 125, 0.18); color: var(--text-2); }

.senti-bar {
  height: 6px; background: var(--bg); border-radius: 3px;
  margin-bottom: 6px; overflow: hidden;
}
.senti-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--down) 0%, var(--warn) 50%, var(--up) 100%);
  transition: width .4s ease;
}
.senti-bull-bear {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--dim);
}
.senti-bull-bear b {
  color: var(--text); font-family: ui-monospace, Consolas, monospace; margin-left: 4px;
}
/* #16 情绪驱动因子: 解释当前情绪分的来由 */
.senti-drivers { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.senti-dr-head { width: 100%; font-size: 11px; color: var(--dim); margin-bottom: 1px; }
.senti-dr {
  font-size: 11.5px; line-height: 1.5; padding: 2px 8px; border-radius: 10px;
  background: var(--pane-2); border: 1px solid var(--border); color: var(--text-2);
}

/* 技术信号 */
.tech-list .ts-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 15px;
}
.ts-name { flex: 1; color: var(--text); }
.ts-value { color: var(--text-2); font-size: 13px; }
.ts-strength {
  padding: 1px 8px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.ts-strength.strong  { background: rgba(239, 83, 80, 0.18); color: var(--up); }
.ts-strength.medium  { background: rgba(240, 176, 69, 0.18); color: var(--warn); }
.ts-strength.weak    { background: rgba(125, 125, 125, 0.18); color: var(--text-2); }
.ts-strength.neutral { background: rgba(125, 125, 125, 0.12); color: var(--dim); }
.ts-row.bearish .ts-strength.strong { background: rgba(38, 166, 154, 0.18); color: var(--down); }
.ts-row.bearish .ts-strength.medium { background: rgba(38, 166, 154, 0.12); color: var(--down); }

/* AI 观点 + 操作建议 */
.opinion-tag {
  margin-left: auto; padding: 2px 8px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
  background: rgba(239, 83, 80, 0.15); color: var(--up);
}
.opinion-tag.bear { background: rgba(38, 166, 154, 0.15); color: var(--down); }
.opinion-tag.neutral { background: rgba(125, 125, 125, 0.18); color: var(--text-2); }
.opinion-text, .suggestion-text {
  color: var(--text-2); font-size: 15px; line-height: 1.65;
}

.more-analysis {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); padding: 9px;
  border-radius: 8px; cursor: pointer;
  width: 100%; font-size: 14px;
  margin: 4px 0 10px;
}
.more-analysis:hover {
  background: var(--hover); color: var(--text); border-color: var(--border-strong);
}

/* AI 输入栏 */
.ai-input {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: var(--pane);
}
.ai-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px;
  transition: border-color .15s;
}
.ai-input-row:focus-within { border-color: var(--accent); }
#ai-input-text {
  flex: 1; resize: none;
  background: transparent; border: none;
  color: var(--text); font-size: 14.5px; font-family: inherit;
  outline: none; line-height: 1.5; max-height: 100px;
}
#ai-input-text::placeholder { color: var(--dim); }
.ai-send {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ai-send:hover { background: var(--accent-2); }
/* 运行中: 箭头圆点 → 停止方块, 点击中断当前轮 (仿 Claude). 用中性灰, 不与A股涨红跌绿冲突 */
.ai-send .ic-stop { display: none; }
.ai-send.stop { background: #6b7280; animation: ai-stop-pulse 1.4s ease-in-out infinite; }
.ai-send.stop:hover { background: #545b66; }
.ai-send.stop .ic-send { display: none; }
.ai-send.stop .ic-stop { display: inline-block; }
@keyframes ai-stop-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(107,114,128,.5); } 50% { box-shadow: 0 0 0 4px rgba(107,114,128,0); } }
.ai-input-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px;
  font-size: 12px; color: var(--dim);
}
.model-tag {
  background: var(--pane-2); padding: 2px 8px; border-radius: 8px;
  color: var(--text-2); cursor: pointer;
}
.model-tag:hover { background: var(--hover); }
.disclaimer { font-size: 11.5px; }
/* 高级模式 💎 切换 (从 chat 版移植: Bull/Bear/Risk/RM/Coordinator 升档 Opus) */
.meta-left { display: flex; align-items: center; gap: 8px; }
.premium-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; font-size: 11px; line-height: 1;
  background: var(--pane-2); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.premium-btn:hover { border-color: var(--dim); color: var(--text); }
.premium-btn.active {
  background: linear-gradient(135deg, #c89b3c 0%, #f0c75e 100%);
  color: #1a1a1a; border-color: #c89b3c; font-weight: 600;
}
.premium-btn.active:hover { filter: brightness(1.08); }
.premium-btn .premium-icon { font-size: 12px; }

/* 滚动条美化 */
.sw-list::-webkit-scrollbar, .ai-content::-webkit-scrollbar,
.news-list::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* AI 投研栏 — 相关新闻区块 */
.ai-news-list { display: flex; flex-direction: column; gap: 7px; }
.ai-news-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.ai-news-item:last-child { border-bottom: none; }
.ai-news-tag {
  flex-shrink: 0;
  font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px;
  line-height: 1.4;
}
.ai-news-tag.stock {
  background: rgba(239, 83, 80, 0.16);
  color: #ff7a76;
}
.ai-news-tag.industry {
  background: rgba(79, 108, 255, 0.16);
  color: #92a3ff;
}
.ai-news-title {
  flex: 1; min-width: 0;
  color: var(--text); font-size: 13px;
  line-height: 1.5; text-decoration: none;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
a.ai-news-title:hover { color: var(--accent); }

/* ============================================================
   通用模态框 — 查看全部对话 / 管理自选 用同一套样式
   ============================================================ */
.pro-modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
  animation: pmFadeIn .12s ease-out;
}
@keyframes pmFadeIn { from { opacity: 0; } to { opacity: 1; } }
.pro-modal {
  width: 560px; max-width: 92vw;
  max-height: 80vh;
  background: var(--pane);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--pane-2);
}
.pm-title {
  font-size: 15.5px; font-weight: 600; color: var(--text);
}
.pm-close {
  width: 24px; height: 24px;
  border: none; background: transparent;
  color: var(--dim);
  font-size: 15.5px; cursor: pointer;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.pm-close:hover { background: var(--hover); color: var(--text); }
.pm-body {
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 100px;
}
.pm-loading {
  padding: 28px 12px; text-align: center;
  color: var(--dim); font-size: 14px;
}
.pm-row {
  display: flex; gap: 8px;
  margin-bottom: 10px;
}
.pm-search {
  width: 100%;
  padding: 7px 10px;
  background: var(--pane-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.pm-row .pm-search { margin-bottom: 0; }
.pm-search:focus { outline: none; border-color: var(--accent); }
.pm-list {
  display: flex; flex-direction: column;
  gap: 4px;
  max-height: 52vh;
  overflow-y: auto;
}
.pm-item {
  display: flex; align-items: center;
  padding: 8px 10px;
  background: var(--pane-2);
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background .12s, border-color .12s;
}
.pm-item:hover {
  background: var(--hover);
  border-color: var(--border);
}
.pm-item-main {
  flex: 1; min-width: 0;
  cursor: pointer;
}
.pm-item-title {
  font-size: 14.5px; color: var(--text);
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-item-meta {
  font-size: 12px; color: var(--dim);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-item-actions {
  display: flex; gap: 4px;
  margin-left: 10px;
  flex-shrink: 0;
}
.pm-btn {
  padding: 4px 10px;
  background: var(--pane);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.pm-btn:hover {
  background: var(--hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.pm-btn.danger { color: #ef5350; }
.pm-btn.danger:hover {
  background: rgba(239, 83, 80, 0.12);
  border-color: rgba(239, 83, 80, 0.4);
  color: #ff7470;
}
.pm-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.pm-btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}
.pm-added {
  font-size: 12.5px; color: var(--text-2);
  padding: 5px 8px; white-space: nowrap;
}
.pm-list::-webkit-scrollbar { width: 6px; }

/* ===== 精简推送: 订阅设置 + 要点卡 ===== */
.sub-manage-btn {
  margin-left: auto; background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-2); font-size: 12px; padding: 3px 9px; border-radius: 6px; cursor: pointer;
}
.sub-manage-btn:hover { background: var(--hover); color: var(--text); }
.sub-sec { margin: 10px 0; }
.sub-h { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.sub-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-chip {
  border: 1px solid var(--border-strong); background: var(--pane-2); color: var(--text-2);
  font-size: 12.5px; padding: 4px 10px; border-radius: 14px; cursor: pointer; transition: all .12s;
}
.sub-chip:hover { border-color: var(--accent); color: var(--text); }
.sub-chip.on { background: rgba(79,108,255,.14); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.sub-kws { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sub-kw {
  display: inline-flex; align-items: center; gap: 5px; background: var(--pane-2);
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 3px 9px; font-size: 12.5px;
}
.sub-kw b { cursor: pointer; color: var(--dim); font-weight: 400; }
.sub-kw b:hover { color: #ef5350; }
.digest-meta { font-size: 11px; color: var(--dim); padding: 4px 2px 8px; }
.digest-card {
  background: var(--pane-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px;
}
.dg-head { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.dg-sum { font-weight: 400; color: var(--text-2); font-size: 13px; }
.dg-points { margin: 4px 0 0; padding-left: 4px; list-style: none; }
.dg-points li { margin: 5px 0; font-size: 13px; line-height: 1.5; }
.dg-text { color: var(--text); }
.dg-impact { color: var(--accent); margin-left: 6px; font-size: 12px; }
.dg-rawbox { margin-top: 8px; }
.dg-rawbox summary { cursor: pointer; color: var(--dim); font-size: 12px; }
.dg-raw { display: block; color: var(--text-2); font-size: 12px; padding: 3px 0; text-decoration: none; }
.dg-raw:hover { color: var(--accent); }

/* 报告查看弹窗 — 比默认宽, 容纳 markdown 正文 */
.pro-modal.pm-wide { width: 820px; }
.rp-actions {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.rp-meta { color: var(--dim); font-size: 12.5px; margin-left: auto; }
.rp-md {
  font-size: 14px; line-height: 1.7; color: var(--text);
  border-top: 1px solid var(--border); padding-top: 12px;
}

/* 左栏"我的报告"列表 — 限高, 不挤占自选区 */
.reports-list { max-height: 24vh; flex: none; }
.sw-item-badge { font-size: 14px; opacity: .65; flex-shrink: 0; }
.rp-tag { font-size: 10.5px; color: #ffca28; background: rgba(255,202,40,.12); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }
/* 我的报告: 每行的删除小叉 — 默认半透明, hover 时变红, 防止误触 (点击事件 stopPropagation) */
.sw-item .rp-del {
  background: transparent; border: none; color: var(--dim); cursor: pointer;
  font-size: 14px; padding: 4px 7px; border-radius: 5px; opacity: .55;
  margin-right: 2px; line-height: 1; flex-shrink: 0;
}
.sw-item .rp-del:hover { opacity: 1; color: #ef5350; background: rgba(239,83,80,.10); }
/* 猜你想问 — 可点击的预判问题 chip (pro 页对话输入框上方) */
.ai-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; }
.ai-suggestions:empty { display: none; }
.sg-chip { font-size: 12.5px; padding: 6px 10px; background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 14px; color: var(--text-2); cursor: pointer; line-height: 1.3; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color .12s, color .12s; animation: sgin .2s; }
.sg-chip:hover { border-color: var(--accent); color: var(--text); }
@keyframes sgin { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }
/* AI 对我的了解 — 画像 modal 内容 (复用 .pro-modal/.pm-body) */
.pf-sub { color: var(--dim); font-size: 12.5px; margin-bottom: 12px; line-height: 1.5; }
.pf-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.pf-row b { flex: 0 0 72px; color: var(--text-2); font-weight: 600; }
.pf-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.pf-meta { color: var(--dim); font-size: 12px; }

/* ===== 移植自 chat: 底盘 agent 完成卡 / 牛熊辩论气泡 / 性能剖析卡 / 模型切换 ===== */
.ai-msg.agent-step {
  align-self: stretch; max-width: 100%;
  background: var(--pane-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 7px 11px; font-size: 13px;
}
.ai-msg.agent-step.decision { border-left-color: #c792ea; }
.ai-msg.agent-step .as-head { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ai-msg.agent-step .as-icon { font-size: 14px; }
.ai-msg.agent-step .as-label { flex: 1; }
.ai-msg.agent-step .as-check { color: var(--down); font-size: 12px; }
.ai-msg.agent-step .as-summary { color: var(--dim); margin-top: 4px; line-height: 1.5; }
.ai-msg.agent-step .as-process { margin-top: 6px; font-size: 12px; }
.ai-msg.agent-step .as-process > summary { cursor: pointer; color: var(--accent); user-select: none; outline: none; }
.ai-msg.agent-step .as-process > summary:hover { text-decoration: underline; }
.ai-msg.agent-step .as-tool { margin-top: 5px; padding-left: 8px; border-left: 2px solid var(--border); }
.ai-msg.agent-step .as-tline { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ai-msg.agent-step .as-tname { color: var(--accent); font-family: monospace; }
.ai-msg.agent-step .as-targs { color: var(--dim); font-family: monospace; word-break: break-all; }
.ai-msg.agent-step .as-tres { color: var(--dim); margin-top: 1px; white-space: pre-wrap; word-break: break-word; }

/* 牛熊辩论气泡 — A股口径: 看多🐂=红(涨)靠左, 看空🐻=绿(跌)靠右 */
.ai-msg.debate-turn {
  max-width: 88%; border-radius: 12px; padding: 9px 13px;
  border: 1px solid var(--border); font-size: 13px; line-height: 1.6;
}
.ai-msg.debate-turn.bull {
  align-self: flex-start;
  background: rgba(239, 83, 80, 0.10); border-color: rgba(239, 83, 80, 0.35);
  border-bottom-left-radius: 3px;
}
.ai-msg.debate-turn.bear {
  align-self: flex-end;
  background: rgba(38, 166, 154, 0.10); border-color: rgba(38, 166, 154, 0.35);
  border-bottom-right-radius: 3px;
}
.ai-msg.debate-turn .dt-head { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.ai-msg.debate-turn.bull .dt-head { color: var(--up); }
.ai-msg.debate-turn.bear .dt-head { color: var(--down); }
.ai-msg.debate-turn .dt-body p { margin: 4px 0; }
.ai-msg.debate-turn .dt-body ul,
.ai-msg.debate-turn .dt-body ol { margin: 4px 0; padding-left: 18px; }

/* 性能剖析卡 */
.ai-msg.perf-report {
  align-self: stretch; background: var(--pane-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: 12px;
}
.ai-msg.perf-report .perf-details > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
.ai-msg.perf-report .perf-details > summary::-webkit-details-marker { display: none; }
.ai-msg.perf-report .perf-pre {
  margin: 8px 0 0; padding: 8px; border-radius: 6px;
  background: var(--bg); color: var(--dim);
  white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, Consolas, monospace; font-size: 11px;
}

/* 模型切换芯片 + 弹出菜单 */
.model-chip-wrap { position: relative; }
.model-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--pane-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 12px; padding: 3px 9px; border-radius: 14px; cursor: pointer;
}
.model-chip:hover { border-color: var(--dim); color: var(--text); }
.model-chip[aria-expanded="true"] { border-color: var(--accent); color: var(--text); }
.model-chip-arrow { font-size: 9px; opacity: .7; }
.model-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 50;
  min-width: 240px; max-height: 320px; overflow-y: auto;
  background: var(--pane); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 5px; box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.model-menu.hidden { display: none; }
.model-menu-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; color: var(--text); padding: 7px 9px; border-radius: 7px;
}
.model-menu-item:hover { background: var(--hover); }
.model-menu-item.selected { background: rgba(79, 108, 255, .15); }
.model-menu-item-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.model-menu-item-tier { font-size: 10px; padding: 1px 7px; border-radius: 8px; }
.model-menu-item-tier.cheap   { color: #26a69a; background: rgba(38, 166, 154, .12); }
.model-menu-item-tier.mid     { color: #ffb74d; background: rgba(255, 183, 77, .12); }
.model-menu-item-tier.premium { color: #ef5350; background: rgba(239, 83, 80, .12); }
.model-menu-item-note { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* ===== 回测工作台 (回测 tab) ===== */
.bt-bar {
  flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 7px 14px; background: var(--bg); border-bottom: 1px solid var(--border); font-size: 13px;
}
.bt-title { font-weight: 600; color: var(--text); }
.bt-ctl { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; }
.bt-ctl select {
  background: var(--pane-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 3px 6px; font-size: 12px;
}
.bt-run, .bt-pdf {
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 12px;
  font-size: 12px; cursor: pointer; color: var(--text); background: var(--pane-2);
}
.bt-run { background: var(--accent); border-color: var(--accent); color: #fff; }
.bt-run:hover { background: var(--accent-2); }
.bt-pdf:not(:disabled):hover { background: var(--hover); }
.bt-run:disabled, .bt-pdf:disabled { opacity: .5; cursor: default; }
.bt-status { color: var(--text-2); font-size: 12px; }
.bt-disclaimer { margin-left: auto; color: var(--dim); font-size: 11px; }

.bt-result { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px 26px; }
.bt-head { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.bt-period { color: var(--dim); font-size: 12px; font-weight: 400; margin-left: 6px; }
.bt-sec-t {
  font-size: 13px; color: var(--text-2); font-weight: 600; margin: 18px 0 9px;
  padding-left: 8px; border-left: 3px solid var(--accent);
}
.bt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.bt-kpi { background: var(--pane-2); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.bt-klab { color: var(--dim); font-size: 11px; }
.bt-kval { font-size: 18px; font-weight: 650; margin-top: 2px; color: var(--text); }
.bt-ksub { color: var(--dim); font-size: 10px; margin-top: 2px; }
.bt-chart { width: 100%; height: auto; display: block; }
.bt-ax { fill: var(--dim); font-size: 10px; }
.bt-lg { fill: var(--text-2); font-size: 11px; }
.bt-muted { color: var(--dim); font-size: 13px; padding: 10px 0; }
.bt-heat { border-collapse: collapse; width: 100%; font-size: 11px; margin-top: 4px; }
.bt-heat td, .bt-heat th { text-align: center; padding: 5px 3px; border: 1px solid var(--bg); }
.bt-heat td { color: #fff; font-weight: 600; }
.bt-heat .bt-na { background: var(--pane-2); }
.bt-heat thead th, .bt-heat .bt-yr { background: var(--pane-2); color: var(--dim); font-weight: 600; }
.bt-heat .bt-yt { background: var(--pane-2); font-weight: 700; }
.bt-tl { border-collapse: collapse; width: 100%; font-size: 12px; margin-top: 4px; }
.bt-tl th { background: var(--pane-2); color: var(--text-2); text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.bt-tl td { padding: 5px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.bt-dis {
  margin-top: 22px; padding: 11px 13px; background: rgba(240, 176, 69, .08);
  border: 1px solid rgba(240, 176, 69, .25); border-radius: 8px;
  color: var(--warn); font-size: 12px; line-height: 1.6;
}
.bt-screen, .bt-best {
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 12px;
  font-size: 12px; cursor: pointer; color: var(--text); background: var(--pane-2);
}
.bt-screen:hover, .bt-best:hover { background: var(--hover); }
.fc-ai-btn {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  background: var(--pane-2); color: var(--accent); border: 1px solid var(--accent);
  border-radius: 6px; padding: 3px 10px; font-size: 12px;
}
.fc-ai-btn:hover { background: var(--hover); }
.bt-best { border-color: var(--pro-gold); color: var(--pro-gold); }
.bt-best:disabled { opacity: .5; cursor: default; }
.bt-best-card {
  background: var(--pane-2); border: 1px solid var(--pro-gold); border-radius: 9px; padding: 12px 14px;
}
.bbc-title { font-size: 15px; font-weight: 650; color: var(--text); }
.bbc-verdict { color: var(--text-2); font-size: 12px; margin-top: 3px; }
.bbc-action { margin-top: 7px; padding: 7px 10px; background: var(--pane); border-radius: 7px;
  color: var(--text); font-size: 12.5px; border: 1px solid var(--border); }
.bt-regime { margin: 10px 0; padding: 8px 12px; background: var(--pane-2); border-radius: 8px;
  border: 1px solid var(--border); font-size: 12.5px; color: var(--text); }
.bt-regime-m { color: var(--text-2); font-size: 11.5px; margin-left: 4px; }

/* ===== 全市场选股 弹窗 ===== */
#screen-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
}
#screen-overlay.hidden { display: none; }
.scr-modal {
  width: min(880px, 94vw); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--pane); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5); overflow: hidden;
}
.scr-head {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--border); background: var(--pane-2);
}
.scr-title { font-size: 15px; font-weight: 650; }
.scr-sub { color: var(--dim); font-size: 12px; flex: 1; }
.scr-close { background: none; border: none; color: var(--dim); font-size: 16px; cursor: pointer; }
.scr-close:hover { color: var(--text); }
.scr-launch {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.scr-param { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 12px; }
.scr-param select {
  background: var(--pane-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 4px 7px; font-size: 12px; max-width: 260px;
}
.scr-desc { color: var(--dim); font-size: 11px; flex: 1 1 100%; order: 9; }
.scr-go, .scr-bt {
  border-radius: 6px; padding: 5px 14px; font-size: 12px; cursor: pointer; color: #fff; border: none;
}
.scr-go { background: var(--accent); }
.scr-go:hover { background: var(--accent-2); }
.scr-bt { background: var(--pane-2); color: var(--text); border: 1px solid var(--border-strong); }
.scr-bt:hover { background: var(--hover); }
.scr-go:disabled, .scr-bt:disabled { opacity: .5; cursor: default; }
.scr-status { color: var(--text-2); font-size: 12px; }
.scr-body { overflow-y: auto; padding: 14px 18px 18px; }
.scr-picks-head { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.scr-hint-inline { color: var(--dim); font-size: 11px; margin-left: 6px; }
.scr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.scr-pick {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer;
  background: var(--pane-2); border: 1px solid var(--border); border-radius: 7px;
}
.scr-pick:hover { border-color: var(--accent); background: var(--hover); }
.scr-rank { color: var(--dim); font-size: 11px; min-width: 18px; }
.scr-code { font-weight: 600; color: var(--text); flex: 1; }
.scr-score { color: var(--up); font-size: 12px; }
.scr-bt-result {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border);
}
.scr-bt-head { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.scr-bt-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.scr-bt-kpi { background: var(--pane-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 9px; text-align: center; }
.scr-bt-kpi .k { display: block; color: var(--dim); font-size: 11px; }
.scr-bt-kpi .v { display: block; font-size: 16px; font-weight: 650; margin-top: 2px; }
.scr-bt-dis { margin-top: 10px; color: var(--dim); font-size: 11px; line-height: 1.6; }
.scr-foot { padding: 10px 18px; border-top: 1px solid var(--border); color: var(--dim); font-size: 11px; }
