/* ============================================================
   TRADING WORKBENCH — 牛市红设计系统
   纯黑终端 · 牛市红 · 方角面板+角标括号 · 等宽数字 · 红涨绿跌
   ============================================================ */

/* —— 非颜色 token（主题无关）—— */
:root {
  /* 4px 基线间距：页面和组件只从这组 token 取值，避免各页自定节奏。 */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-8: 48px;
  /* 全站字号层级：正文不低于 14px，12px 只用于辅助状态。 */
  --font-xs: 12px; --font-sm: 14px; --font-md: 16px;
  --font-lg: 20px; --font-xl: 24px; --font-display: 32px;
  --radius: 8px; --radius-sm: 5px; --radius-xs: 3px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Roboto Mono", monospace;
  --topbar-h: 60px; --ticker-h: 38px; --statusbar-h: 30px;
  --sidebar-w: 234px; --sidebar-wc: 68px; --gap: var(--space-4);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 0.13s var(--ease); --t: 0.2s var(--ease); --t-slow: 0.32s var(--ease);
  /* 客户扩展的兼容别名：统一回正式设计 token，不再各自硬编颜色。 */
  --fg: var(--text); --muted: var(--text-3);
  --accent: var(--brand1); --accent-weak: var(--amber-dim);
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg0: #07080a; --bg1: #0b0d11;
  --panel: #0e1014; --panel-2: #14161b; --panel-3: #1c1f26;
  --border: #22252d; --border-strong: #31353f; --hairline: var(--line);
  --text: #f1f3f7; --text-2: #bac1cc; --text-3: #98a2b2;
  --amber: #ff4055; --amber-2: #d91936;
  --amber-dim: rgba(255,64,85,0.15); --amber-line: rgba(255,64,85,0.36);
  --brand1: var(--amber); --brand2: var(--amber-2);
  --brand-grad: linear-gradient(135deg, #ff6678, #d70f2f);
  --cyan: #46c9ff;
  --up: #ff4d5e; --down: #11cc8e; --flat: #767d8c;
  --up-bg: rgba(255,77,94,0.14); --down-bg: rgba(17,204,142,0.13);
  --up-flash: rgba(255,77,94,0.34); --down-flash: rgba(17,204,142,0.30);
  --up-line: rgba(255,77,94,0.45); --down-line: rgba(17,204,142,0.45);
  --purple: #c77dff; --purple-line: rgba(199,125,255,0.4); --purple-bg: rgba(199,125,255,0.08);
  --warn: #ffb020; --warn-bg: rgba(255,176,32,0.13); --info: var(--cyan);
  --line: rgba(255,255,255,0.055); --line-soft: rgba(255,255,255,0.032);
  --hover: rgba(255,255,255,0.05); --track: rgba(255,255,255,0.07);
  --zebra: rgba(255,255,255,0.022); --grid-line: rgba(255,255,255,0.014);
  --skel-1: rgba(255,255,255,0.035); --skel-2: rgba(255,255,255,0.09);
  --inset: #08090b; --topbar-bg: rgba(9,11,14,0.82); --bar-bg: #060708;
  --modal-bg: #101319; --toast-bg: rgba(16,19,25,0.97); --tooltip-bg: #161a23;
  --scrim: rgba(2,3,5,0.66); --scrollbar: #2a2e38; --scrollbar-hover: #393e4a;
  --row-hover: rgba(255,64,85,0.065); --glow: rgba(255,64,85,0.06);
  --shadow: 0 14px 40px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.42);
  --shadow-soft: 0 1px 3px rgba(0,0,0,0.4), 0 5px 18px rgba(0,0,0,0.22);
  --shadow-pop: 0 18px 52px rgba(0,0,0,0.62);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg0: #eef1f5; --bg1: #e6eaf0;
  --panel: #ffffff; --panel-2: #f6f8fb; --panel-3: #eef1f6;
  --border: #e4e7ee; --border-strong: #cfd5df; --hairline: var(--line);
  --text: #10141c; --text-2: #3f4859; --text-3: #596375;
  --amber: #c91f37; --amber-2: #a81229;
  --amber-dim: rgba(201,31,55,0.10); --amber-line: rgba(201,31,55,0.30);
  --brand1: var(--amber); --brand2: var(--amber-2);
  --brand-grad: linear-gradient(135deg, #e43d52, #b8122b);
  --cyan: #0a82c4;
  --up: #e02d3c; --down: #0a9b68; --flat: #79818f;
  --up-bg: rgba(224,45,60,0.10); --down-bg: rgba(10,155,104,0.11);
  --up-flash: rgba(224,45,60,0.22); --down-flash: rgba(10,155,104,0.22);
  --up-line: rgba(224,45,60,0.38); --down-line: rgba(10,155,104,0.42);
  --purple: #7d2fc4; --purple-line: rgba(125,47,196,0.4); --purple-bg: rgba(125,47,196,0.08);
  --warn: #b5740a; --warn-bg: rgba(184,106,0,0.12); --info: var(--cyan);
  --line: rgba(18,26,45,0.09); --line-soft: rgba(18,26,45,0.055);
  --hover: rgba(18,26,45,0.045); --track: rgba(18,26,45,0.075);
  --zebra: rgba(18,26,45,0.024); --grid-line: rgba(18,26,45,0.022);
  --skel-1: rgba(18,26,45,0.05); --skel-2: rgba(18,26,45,0.11);
  --inset: #f1f4f8; --topbar-bg: rgba(255,255,255,0.85); --bar-bg: #ffffff;
  --modal-bg: #ffffff; --toast-bg: rgba(255,255,255,0.98); --tooltip-bg: #ffffff;
  --scrim: rgba(22,30,48,0.34); --scrollbar: #c9cfd9; --scrollbar-hover: #aeb6c2;
  --row-hover: rgba(201,31,55,0.07); --glow: rgba(201,31,55,0.05);
  --shadow: 0 12px 34px rgba(22,32,58,0.13), 0 2px 8px rgba(22,32,58,0.08);
  --shadow-soft: 0 1px 2px rgba(22,32,58,0.07), 0 4px 14px rgba(22,32,58,0.07);
  --shadow-pop: 0 20px 54px rgba(22,32,58,0.22);
}


* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 50% -200px, var(--glow), transparent 65%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 细网格质感层 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(1200px 800px at 50% 0%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(1200px 800px at 50% 0%, #000 30%, transparent 100%);
}

/* ::selection 规则统一在 v3 精致化层按主题分色定义（此处不再重复声明） */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

a { color: var(--cyan); text-decoration: none; }
button { font-family: inherit; }

/* Phosphor 图标：统一以字体图标渲染，继承现有按钮与导航颜色。 */
.ph { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; font-size:1.15em; line-height:1; vertical-align:-0.08em; }
.logo-mark .ph { font-size:18px; color:#000; }
.nav-item .ph { width:20px; height:20px; font-size:20px; }
.btn .ph, .icon-btn .ph, .collapse-btn .ph, .send-btn .ph { width:1em; height:1em; font-size:1.1em; }
.nav-item.active .ph { color:var(--amber); }
.collapse-btn .ph { font-size:14px; transition:transform .2s; }
.app-shell.nav-collapsed .collapse-btn .ph { transform:rotate(180deg); }
.tb-today .ph, .icon-btn .ph, .theme-toggle .ph, #update-prompt .ph { font-size:15px; }
.export-menu button .ph { font-size:15px; }
.msg-pdf .ph { font-size:12px; }
.relay-banner .ph { font-size:16px; }
.btn .ph { font-size:17px; }
.empty-state .ph { font-size:44px; opacity:.35; }
.toast .ph { font-size:15px; }
.toast.success .ph { color:var(--down); }.toast.error .ph { color:var(--up); }.toast.info .ph { color:var(--info); }
.send-btn .ph { font-size:18px; }
:root[data-theme="light"] .logo-mark .ph { color:#fff; }

.num, .mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.2px;
}

/* ---------------- 布局骨架 ---------------- */

.app-shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: var(--statusbar-h); }

.view {
  flex: 1;
  padding: var(--space-5);
  max-width: 2100px;
  width: 100%;
  margin: 0 auto;
  outline: none;
  animation: viewFade 0.25s ease both;
}

@keyframes viewFade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 侧边导航 ---------------- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg0);
  border-right: 1px solid var(--border);
  z-index: 50;
  transition: width 0.2s ease;
  overflow: hidden;
}

.app-shell.nav-collapsed .sidebar { width: var(--sidebar-wc); }

.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  height: var(--topbar-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.side-logo:focus-visible { outline: 2px solid var(--amber); outline-offset: -3px; }

.logo-mark {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 2px;
  background: var(--amber);
  display: grid; place-items: center;
  box-shadow: 0 0 16px rgba(255, 64, 85, 0.35);
}
.logo-mark svg { width: 16px; height: 16px; color: #fff; }
.logo-mark img { width: 28px; height: 28px; display:block; border-radius:2px; }

.logo-text { white-space: nowrap; overflow: hidden; }
.logo-text .t1 { font-size: 15px; font-weight: 800; letter-spacing: 0.5px; color: var(--text); }
.logo-text .t2 { font-size: 12px; color: var(--amber); letter-spacing: 2.5px; font-family: var(--mono); }

.app-shell.nav-collapsed .logo-text { display: none; }

.side-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; margin: 2px 0;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
  user-select: none;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--line); color: var(--text); }
.nav-item.active {
  color: var(--amber);
  background: linear-gradient(90deg, rgba(255, 64, 85, 0.1), transparent 80%);
  border-left-color: var(--amber);
}
.nav-item.active svg { color: var(--amber); }
.app-shell.nav-collapsed .nav-item { justify-content: center; padding: 13px 0; }
.app-shell.nav-collapsed .nav-item .nav-label { display: none; }

/* 工作台子目录统一放进侧栏：一级入口负责阶段，二级入口负责具体能力。 */
.nav-workspace { min-width: 0; }
.nav-parent .nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-group-toggle {
  width: 28px; height: 28px; flex: 0 0 28px; margin-left: auto;
  display: grid; place-items: center; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-3); cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-group-toggle:hover { color: var(--amber); background: var(--amber-dim); }
.nav-group-toggle svg { width: 13px; height: 13px; transition: transform var(--t); }
.nav-workspace.open .nav-group-toggle svg { transform: rotate(90deg); }
.nav-children { padding: 2px 10px 7px 42px; }
.nav-child {
  width: 100%; min-height: 32px; display: flex; align-items: center;
  padding: 6px 10px; border: 0; border-left: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent; color: var(--text-3); cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1.35; text-align: left;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.nav-child:hover { color: var(--text); background: var(--hover); }
.nav-child.active { color: var(--amber); border-left-color: var(--amber); background: var(--amber-dim); font-weight: 700; }
.nav-child-label {
  padding: 8px 10px 4px; color: var(--text-3); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase;
}
.app-shell.nav-collapsed .nav-group-toggle,
.app-shell.nav-collapsed .nav-children { display: none; }

/* 导航分组（对齐 ashare 分组样板）：组名小字标签 + 组间分隔 */
.nav-group { padding: 2px 0; }
.nav-group + .nav-group { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 6px; }
.nav-group-label {
  padding: 6px 18px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3); user-select: none;
}
/* 折叠态：隐藏组名文字，仅保留一道细分隔线（用 padding 占位避免图标贴死） */
.app-shell.nav-collapsed .nav-group-label { height: 0; padding: 0; overflow: hidden; }
.app-shell.nav-collapsed .nav-group + .nav-group { padding-top: 4px; }

.side-foot { padding: 0 8px 8px; flex-shrink: 0; border-top: 1px solid var(--border); }
.side-utility { padding: 6px 0; margin: 0 -8px 6px; border-bottom: 1px solid var(--border); }
.side-fixed-risk { max-height: 46vh; overflow-y: auto; overflow-x: hidden; }
.collapse-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-3); cursor: pointer; font-size: 13px;
  transition: all 0.13s;
}
.collapse-btn:hover { color: var(--amber); border-color: var(--amber-line); }
.collapse-btn svg { width: 14px; height: 14px; transition: transform 0.2s; }
.app-shell.nav-collapsed .collapse-btn svg { transform: rotate(180deg); }
.app-shell.nav-collapsed .collapse-btn .c-label { display: none; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--gap);
  position: sticky; top: 0; z-index: 40;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-title { font-size: 16px; font-weight: 800; white-space: nowrap; letter-spacing: 0.5px; }
.tb-title::before { content: "▮ "; color: var(--amber); font-size: 13px; }

.client-badge {
  font-size: 13px; padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--amber-dim);
  border: 1px solid var(--amber-line);
  color: var(--amber); white-space: nowrap;
  font-family: var(--mono); letter-spacing: 1px;
}

.tb-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 14px; min-width: 0; overflow: hidden; }

.tb-clock {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap;
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 64, 85, 0.35);
}
.tb-clock-date { color: var(--text); font-family: var(--font); font-weight: 750; }
.tb-clock-meta { display: inline-flex; align-items: center; gap: 8px; }
.tb-clock-time { font-size: 17px; color: var(--amber); }
.tb-market-state {
  display: inline-flex; align-items: center; min-height: 22px; padding: 1px 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-2); background: var(--panel-2); font-size: 11px; font-family: var(--font);
  font-weight: 650; letter-spacing: 0; text-shadow: none;
}
.tb-market-state.open { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 42%, var(--border)); }
.tb-market-state.closed { color: var(--amber); border-color: var(--amber-line); background: var(--amber-dim); }

.trade-badge {
  font-size: 13px; padding: 3px 9px; border-radius: var(--radius-sm); white-space: nowrap;
  border: 1px solid var(--border-strong); color: var(--text-2);
  font-family: var(--mono); letter-spacing: 1.5px;
}
.trade-badge.open { color: var(--up); border-color: rgba(255, 71, 87, 0.5); background: var(--up-bg); }
.trade-badge.open::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--up); margin-right: 5px; vertical-align: 1px; animation: pulse 1.4s infinite; }

.mini-indexes { display: flex; gap: 14px; overflow: hidden; }
.mini-idx { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; font-size: 14px; }
.mini-idx .n { color: var(--text-3); font-size: 13px; }
.mini-idx .p { font-weight: 600; font-family: var(--mono); }
.mini-idx .c { font-size: 13px; font-family: var(--mono); }

.tb-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }

.tb-today {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 30px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--amber-line); background: var(--amber-dim); color: var(--amber);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.tb-today:hover { border-color: var(--amber); color: var(--text); }
.tb-today svg { width: 15px; height: 15px; }
.tb-today:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.status-dot { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); cursor: default; font-family: var(--mono); letter-spacing: 1px; }
.status-dot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-dot.on .dot { background: var(--down); box-shadow: 0 0 8px rgba(0, 201, 138, 0.9); animation: pulse 2.2s infinite; }
.status-dot.on { color: var(--text-2); }
.status-dot.off .dot { background: var(--up); box-shadow: 0 0 6px rgba(255, 71, 87, 0.7); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.icon-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-2); cursor: pointer;
  transition: all 0.13s;
}
.icon-btn:hover { color: var(--amber); border-color: var(--amber-line); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }

/* 导出 PDF 下拉 */
.tb-export { position: relative; }
.export-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 5px; min-width: 152px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.export-menu[hidden] { display: none; }
.export-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; border-radius: 6px; text-align: left;
}
.export-menu button:hover { background: var(--panel-3); color: var(--amber); }
.export-menu button svg { width: 15px; height: 15px; }

/* 问股 AI 回答的「导出 PDF」小按钮（在消息时间戳行内） */
.msg-pdf {
  margin-left: 10px; padding: 2px 8px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-3); cursor: pointer; vertical-align: middle;
  border-radius: 5px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}
.msg-pdf:hover { color: var(--amber); border-color: var(--amber-line); }
.msg-pdf svg { width: 12px; height: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 滚动行情带 ---------------- */

.ticker-bar {
  height: var(--ticker-h);
  flex-shrink: 0;
  overflow: hidden;
  position: sticky; top: var(--topbar-h); z-index: 39;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.ticker-track {
  display: flex; gap: 0; white-space: nowrap;
  animation: tickerScroll 60s linear infinite;
  will-change: transform;
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.tick-item {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 0 18px; font-size: 13px;
  border-right: 1px solid var(--track);
  font-family: var(--mono);
}
.tick-item .tk-n { color: var(--text-3); font-family: var(--font); }
.tick-item .tk-p { font-weight: 600; }
.tick-item .tk-c { font-size: 13px; }
.tick-item .tk-tag { font-size: 12px; color: var(--amber); border: 1px solid var(--amber-line); padding: 0 4px; border-radius: 2px; }

/* #3 数据隧道全局告警条：常驻于 ticker 之下、正文之上；warn 色系，双主题可读，不遮挡内容 */
.relay-banner {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  color: var(--warn); background: var(--warn-bg);
  border-bottom: 1px solid var(--warn);
}
.relay-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------------- 底部状态条 ---------------- */

.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--statusbar-h);
  display: flex; align-items: center; gap: 0;
  background: var(--bar-bg);
  border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 13px; color: var(--text-3);
  padding: 0 10px;
  letter-spacing: 0.5px;
  overflow: hidden;
}
.sb-item { padding: 0 12px; border-right: 1px solid var(--line); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.sb-item b { color: var(--text-2); font-weight: 600; }
.sb-item .sb-amber { color: var(--amber); }
.sb-spacer { flex: 1; }
.sb-item.right { border-right: none; border-left: 1px solid var(--line); }

/* ---------------- 面板（卡片） ---------------- */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.16s;
}
/* 卡片保持干净边界，不再绘制左上/右下角标。 */
.card::before, .card::after { content: none; display: none; }
.card.hoverable:hover { border-color: var(--border-strong); }
.card.hoverable:hover::before, .card.hoverable:hover::after { border-color: var(--amber); }

.card-head {
  display: flex; align-items: center; gap: 11px;
  padding: var(--space-4) var(--space-4) 0;
}
.card-title {
  font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: var(--space-2);
  color: var(--text-2); letter-spacing: 1.2px;
}
.card-title::before {
  content: ""; width: 7px; height: 7px; flex-shrink: 0;
  background: var(--amber);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.card-extra { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.card-body { padding: var(--space-4); }

.data-stamp {
  display: inline-flex; align-items: center; gap: 6px; min-height: 22px;
  padding: 1px 7px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text-3);
  font-family: var(--mono); font-size: var(--font-xs); line-height: 1.45; white-space: nowrap;
}
.data-stamp .ds-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.data-stamp .ds-label { font-family: var(--font); font-weight: 650; }
.data-stamp[data-state="live"] { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 36%, var(--border)); }
.data-stamp[data-state="complete"] { color: var(--up); border-color: color-mix(in srgb, var(--up) 34%, var(--border)); background: color-mix(in srgb, var(--up) 7%, transparent); }
.data-stamp[data-state="degraded"] { color: var(--warn); border-color: var(--amber-line); background: var(--warn-bg); }
.data-stamp[data-state="accumulating"] { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 34%, var(--border)); background: color-mix(in srgb, var(--cyan) 7%, transparent); }
.data-stamp[data-state="delayed"] { color: var(--text-2); }
.data-stamp[data-state="stale"] { color: var(--warn); border-color: var(--amber-line); background: var(--warn-bg); }
.data-stamp[data-state="fallback"] { color: var(--purple); border-color: var(--purple-line); background: var(--purple-bg); }
.data-stamp[data-state="missing"] { color: var(--warn); border-style: dashed; border-color: var(--amber-line); background: var(--warn-bg); }
.data-stamp[data-state="asof"] .ds-dot { opacity: 0.65; }
.missing-tag {
  font-size: 12px; padding: 1px 6px; border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--amber-line);
  cursor: help; letter-spacing: 1px;
}

/* ---------------- 通用栅格 ---------------- */

.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); }
.sp-3 { grid-column: span 3; } .sp-4 { grid-column: span 4; }
.sp-5 { grid-column: span 5; } .sp-6 { grid-column: span 6; }
.sp-7 { grid-column: span 7; } .sp-8 { grid-column: span 8; }
.sp-9 { grid-column: span 9; } .sp-12 { grid-column: span 12; }

/* ---------------- 颜色语义 ---------------- */

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

.chg-pill {
  display: inline-block; min-width: 62px; text-align: right;
  padding: 1px 7px; border-radius: var(--radius-sm);
  font-family: var(--mono); font-weight: 600; font-size: 14px;
}
.chg-pill.up { background: var(--up-bg); }
.chg-pill.down { background: var(--down-bg); }
.chg-pill.flat { background: rgba(115, 121, 138, 0.12); }

@keyframes flashUp { 0% { background: rgba(255, 71, 87, 0.32); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(0, 201, 138, 0.3); } 100% { background: transparent; } }
.flash-up { animation: flashUp 0.9s ease; }
.flash-down { animation: flashDown 0.9s ease; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text);
  transition: all 0.14s; user-select: none; white-space: nowrap;
}
.btn:hover { border-color: var(--amber-line); color: var(--amber); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }

.btn-primary {
  background: var(--amber); border-color: var(--amber); color: #0a0a0a;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(255, 64, 85, 0.22);
}
.btn-primary:hover { box-shadow: 0 0 26px rgba(255, 64, 85, 0.38); }

.btn-danger { color: var(--up); border-color: rgba(255, 71, 87, 0.4); background: rgba(255, 71, 87, 0.07); }
.btn-danger:hover { background: rgba(255, 71, 87, 0.15); color: var(--up); border-color: var(--up); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--amber); background: var(--hover); }

.btn-sm { padding: 7px 14px; font-size: 15px; }
.btn-lg { padding: 14px 30px; font-size: 18px; }

.btn .btn-spin { width: 12px; height: 12px; border: 2px solid rgba(0,0,0,0.25); border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ---------------- 表单 ---------------- */

.input, .select, .textarea {
  width: 100%;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--inset);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.14s, box-shadow 0.14s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(255, 64, 85, 0.14);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.select option { background: var(--panel); color: var(--text); }
input[type="date"], input[type="time"] { color-scheme: inherit; font-family: var(--mono); }

.field { margin-bottom: 13px; }
.field-label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 5px; letter-spacing: 0.5px; }
.field-hint { font-size: 14px; color: var(--text-3); margin-top: 4px; line-height: 1.55; }

/* switch */
.switch { position: relative; display: inline-block; width: 36px; height: 19px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 2px;
  /* 用 --inset 双主题自洽（原硬编码 #1d2026 在浅色下关闭态近黑、与开启态强弱倒置） */
  background: var(--inset); border: 1px solid var(--border-strong);
  transition: background 0.18s, border-color 0.18s;
}
/* 深色主题保留原轨道观感（比 --inset 略亮一档） */
:root[data-theme="dark"] .switch .track { background: #1d2026; }
.switch .track::after {
  content: ""; position: absolute; width: 11px; height: 11px; border-radius: 1px;
  background: var(--text-3); top: 3px; left: 3px; transition: transform 0.18s, background 0.18s;
}
.switch input:checked + .track { background: var(--amber-dim); border-color: var(--amber); }
.switch input:checked + .track::after { transform: translateX(17px); background: var(--amber); }

/* segmented control */
.segmented {
  display: inline-flex; padding: 2px; gap: 1px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.segmented .seg {
  padding: 5px 13px; font-size: 14px; border-radius: 2px; border: none;
  background: transparent; color: var(--text-3); cursor: pointer;
  transition: all 0.15s; white-space: nowrap; letter-spacing: 0.5px;
}
.segmented .seg:hover { color: var(--text); }
.segmented .seg.active {
  background: var(--amber-dim); color: var(--amber); font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--amber-line);
}

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 8px 15px; font-size: 14px; color: var(--text-3); cursor: pointer;
  border: none; background: transparent; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.13s; letter-spacing: 0.5px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); font-weight: 700; }

/* Phase 1 组合工作台：只复用现有 tabs/token，内层仍是原 view。 */
.workspace-view { min-width: 0; }
.workspace-nav { display: flex; align-items: stretch; gap: 6px; min-width: 0; margin: 0 0 var(--gap); }
.workspace-nav-spacer { flex: 1 1 auto; min-width: 0; }
.workspace-tabs {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.workspace-more { position: relative; flex: 0 0 auto; }
.workspace-more-trigger {
  height: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--panel); color: var(--text-2); cursor: pointer;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.workspace-more-trigger::after { content: '⌄'; margin-left: 6px; color: var(--text-3); }
.workspace-more-trigger:hover, .workspace-more-trigger.active { border-color: var(--amber-line); color: var(--amber); }
.workspace-more-menu {
  position: absolute; z-index: 25; right: 0; top: calc(100% + 6px); min-width: 156px;
  padding: 5px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); box-shadow: var(--shadow); display: grid; gap: 2px;
}
.workspace-more-menu[hidden] { display: none; }
.workspace-more-item { border: 0; border-radius: 4px; background: transparent; color: var(--text-2); cursor: pointer; text-align: left; padding: 8px 10px; font-size: 13px; white-space: nowrap; }
.workspace-more-item:hover, .workspace-more-item.active { background: var(--amber-dim); color: var(--amber); }
.workspace-panel { min-width: 0; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--radius-sm); font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--border-strong);
  color: var(--text-2); white-space: nowrap;
}
.chip.clickable { cursor: pointer; transition: all 0.13s; }
.chip.clickable:hover { color: var(--amber); border-color: var(--amber-line); }

[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: var(--tooltip-bg); border: 1px solid var(--amber-line);
  color: var(--text); font-size: 13px; line-height: 1.62;
  padding: 6px 10px; border-radius: var(--radius); white-space: pre-line;
  min-width: 120px; max-width: 280px; width: max-content; text-align: left;
  z-index: 100; box-shadow: var(--shadow); pointer-events: none;
}

/* ---------------- 表格 ---------------- */

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: right; font-weight: 500; color: var(--text-3); font-size: 13px;
  letter-spacing: 1px;
  padding: 11px 13px; border-bottom: 1px solid var(--border-strong);
  white-space: nowrap; position: sticky; top: 0; background: var(--panel); z-index: 1;
}
.tbl td {
  padding: 11px 13px; text-align: right;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 14px; white-space: nowrap;
}
.tbl td.l, .tbl th.l, .tbl td:first-child, .tbl th:first-child { text-align: left; }
.tbl td.cn { font-family: var(--font); }
.tbl tbody tr { transition: background 0.1s; }
.tbl tbody tr:hover { background: var(--row-hover); }
.tbl .code-link { color: var(--cyan); cursor: pointer; font-family: var(--mono); font-size: 14px; }
.tbl .code-link:hover { color: var(--amber); text-decoration: underline; }
.tbl tfoot td { border-top: 1px solid var(--border-strong); border-bottom: none; font-weight: 700; }

/* ---------------- 骨架屏 ---------------- */

@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel {
  border-radius: 2px;
  background: linear-gradient(90deg, var(--line) 25%, var(--skel-2) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  min-height: 13px;
}
.skel-group { display: flex; flex-direction: column; gap: 9px; padding: 4px 0; }

/* ---------------- 空状态 ---------------- */

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2); padding: var(--space-6) var(--space-5); text-align: center; color: var(--text-3);
}
.empty-state svg { width: 44px; height: 44px; opacity: 0.35; }
.empty-state .es-title { font-size: var(--font-md); color: var(--text-2); font-weight: 650; letter-spacing: 0.4px; }
.empty-state .es-sub { font-size: var(--font-sm); line-height: 1.65; max-width: 420px; }

/* ---------------- Toast ---------------- */

.toast-root {
  position: fixed; top: 64px; right: 14px; z-index: 1000;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  min-width: 220px; max-width: 380px;
  padding: 10px 14px; border-radius: var(--radius);
  background: var(--toast-bg);
  border: 1px solid var(--border-strong);
  border-left: 2px solid var(--info);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toastIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  pointer-events: auto;
}
.toast.out { animation: toastOut 0.22s ease both; }
.toast.success { border-left-color: var(--down); }
.toast.error { border-left-color: var(--up); }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast.success svg { color: var(--down); }
.toast.error svg { color: var(--up); }
.toast.info svg { color: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(50px); } }

/* ---------------- Modal ---------------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  animation: fadeIn 0.18s ease;
  padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
  background: var(--modal-bg);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--amber);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 17px 0; font-size: 16px; font-weight: 700; letter-spacing: 1px;
}
.modal-body { padding: 13px 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 0 17px 16px; }

/* ============================================================
   页面专属
   ============================================================ */

/* ---------- Dashboard：指数主图 ---------- */

.hero-idx { display: flex; flex-direction: column; min-height: 0; }
/* 7 指数(对齐 ashare)：flex-wrap 让指数条放不下时折成第二行的网格，避免 7 个 tab 挤成一行不可读。 */
.hero-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.idx-tab {
  flex: 1 1 130px; min-width: 130px; padding: 9px 13px; cursor: pointer;
  border: none; background: transparent; text-align: left;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  transition: background 0.13s;
}
.idx-tab:hover { background: var(--hover); }
.idx-tab.active { background: rgba(255, 64, 85, 0.05); border-bottom-color: var(--amber); }
.idx-tab .it-name { font-size: 13px; color: var(--text-3); letter-spacing: 1px; display: flex; justify-content: space-between; }
.idx-tab .it-code { font-size: 12px; font-family: var(--mono); color: var(--text-3); opacity: 0.7; }
.idx-tab .it-px { font-size: 19px; font-weight: 700; font-family: var(--mono); margin-top: 1px; line-height: 1.25; }
.idx-tab .it-chg { font-size: 13px; font-family: var(--mono); font-weight: 600; }
.idx-tab .it-amt { font-size: 12px; color: var(--text-3); font-family: var(--mono); margin-left: 7px; }

/* 大盘卡统计条：涨停 / 最高连板 / 两市成交（对齐 ashare 的 .stat 行，挂在 7 指数下方）。 */
.hero-mktstat { display: flex; gap: 22px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.hero-mktstat:empty { display: none; }
.hero-mktstat .ms-cell { display: flex; align-items: baseline; gap: 7px; }
.hero-mktstat .ms-k { font-size: 12px; color: var(--text-3); letter-spacing: .5px; }
.hero-mktstat .ms-v { font-size: 15px; font-weight: 700; font-family: var(--mono); }

.hero-toolbar { display: flex; align-items: center; gap: 9px; padding: 8px 12px; }
.hero-toolbar .ohlc { display: flex; gap: 13px; font-size: 13px; font-family: var(--mono); color: var(--text-3); flex-wrap: wrap; }
.hero-toolbar .ohlc b { color: var(--text-2); font-weight: 600; }
.hero-chart { width: 100%; height: 380px; }

.mode-tabs { display: inline-flex; gap: 1px; background: var(--inset); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; margin-left: auto; }
.mode-tabs button {
  border: none; background: transparent; color: var(--text-3); font-size: 13px;
  padding: 3px 11px; cursor: pointer; border-radius: 2px; letter-spacing: 1px;
  transition: all 0.13s; font-family: var(--mono);
}
.mode-tabs button:hover { color: var(--text); }
.mode-tabs button.active { background: var(--amber-dim); color: var(--amber); font-weight: 700; box-shadow: inset 0 0 0 1px var(--amber-line); }

/* ---------- Dashboard：情绪面板 ---------- */

.senti-panel .sp-score-row { display: flex; align-items: center; gap: 14px; }
.senti-panel .sp-score {
  font-size: 52px; font-weight: 800; font-family: var(--mono); line-height: 1;
  text-shadow: 0 0 30px currentColor;
}
.senti-panel .sp-side { flex: 1; min-width: 0; }
.phase-badge {
  display: inline-block; padding: 2px 11px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; margin-bottom: 5px;
  border: 1px solid; letter-spacing: 2px;
}
.senti-panel .desc { font-size: 13px; color: var(--text-2); line-height: 1.6; }

.therm { display: flex; gap: 2px; height: 7px; margin: 12px 0 4px; }
.therm i { flex: 1; border-radius: 1px; background: var(--panel-3); position: relative; }
.therm i.lit { box-shadow: 0 0 8px currentColor; }
.therm-labels { display: flex; gap: 2px; font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.therm-labels span { flex: 1; text-align: center; letter-spacing: 1px; }

.senti-panel .advice {
  font-size: 14px; padding: 8px 11px; border-radius: var(--radius-sm); line-height: 1.6;
  background: var(--amber-dim);
  border: 1px solid var(--amber-line);
  border-left: 2px solid var(--amber);
  color: var(--text); margin-top: 10px;
}
.senti-panel .advice b { color: var(--amber); }

.breadth-bar { display: flex; height: 16px; border-radius: 2px; overflow: hidden; font-size: 13px; color: #fff; margin: 10px 0 4px; font-family: var(--mono); }
.breadth-bar > div { display: flex; align-items: center; justify-content: center; min-width: 30px; font-weight: 700; transition: width 0.5s ease; }
.breadth-bar .b-up { background: linear-gradient(90deg, #c2293c, var(--up)); }
.breadth-bar .b-flat { background: var(--panel-3); color: var(--text-3); }
.breadth-bar .b-down { background: linear-gradient(90deg, var(--down), #00935f); }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }
.kpi {
  padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-strong);
}
.kpi.hi { border-left-color: var(--amber); }
.kpi .k-label { font-size: 12px; color: var(--text-3); letter-spacing: 1px; }
.kpi .k-val { font-size: 18px; font-weight: 700; font-family: var(--mono); margin-top: 1px; line-height: 1.3; }
.kpi .k-sub { font-size: 12px; color: var(--text-3); font-family: var(--mono); }

/* ---------- Dashboard：涨停梯队 ---------- */

.ladder-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ladder-row:last-child { border-bottom: none; }
.ladder-tag {
  flex-shrink: 0; width: 52px; text-align: center;
  font-size: 13px; font-weight: 800; padding: 3px 0; border-radius: var(--radius-sm);
  background: var(--up-bg); color: var(--up); border: 1px solid rgba(255, 71, 87, 0.3);
  font-family: var(--mono); letter-spacing: 1px;
}
.ladder-tag.hot {
  background: var(--up); color: #fff; border-color: var(--up);
  box-shadow: 0 0 14px rgba(255, 71, 87, 0.5);
}
.ladder-tag .lt-cnt { display: block; font-size: 12px; font-weight: 500; opacity: 0.86; }
.ladder-stocks { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.stock-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer;
  background: rgba(255, 71, 87, 0.06); border: 1px solid rgba(255, 71, 87, 0.2);
  transition: all 0.13s;
}
.stock-chip:hover { background: rgba(255, 71, 87, 0.16); border-color: var(--up); }
.stock-chip .sc-name { font-weight: 600; }
.stock-chip .sc-info { color: var(--text-3); font-size: 13px; font-family: var(--mono); }
.stock-chip .sc-reason { color: var(--amber); font-size: 13px; }

/* ---------- Dashboard：板块热力 ---------- */

.heat-chart { width: 100%; height: 348px; }
.sector-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sector-col h4 { font-size: 13px; color: var(--text-3); font-weight: 600; margin-bottom: 7px; letter-spacing: 1.5px; }
.sector-row {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; margin-bottom: 3px; border-radius: var(--radius-sm);
  font-size: 14px; overflow: hidden; cursor: default;
}
.sector-row .bar { position: absolute; inset: 0; opacity: 0.14; border-radius: var(--radius-sm); transform-origin: left; }
.sector-row > span { position: relative; z-index: 1; }
.sector-row .s-name { font-weight: 600; width: 72px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sector-row .s-chg { width: 56px; font-family: var(--mono); font-weight: 600; flex-shrink: 0; }
.sector-row .s-leader { flex: 1; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-size: 13px; }
.sector-row .s-flow { font-family: var(--mono); color: var(--text-3); flex-shrink: 0; font-size: 13px; }

.flow-chart { width: 100%; height: 320px; }

/* ---------- Dashboard：多市场异动 ---------- */

.mkt-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--gap); }
@media (max-width: 1100px) { .mkt-grid { grid-template-columns: 1fr; } }
.mkt-sub { font-size: 13px; letter-spacing: 0.5px; color: var(--text-3); font-family: var(--mono); margin: 12px 0 7px; display: flex; align-items: center; gap: 8px; }
.mkt-sub:first-child { margin-top: 0; }
.mkt-cnt { font-size: 12px; color: var(--amber); border: 1px solid var(--amber-line); border-radius: 999px; padding: 0 7px; }
.mkt-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.mkt-pill {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  background: var(--panel-3); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); font-family: var(--mono);
}
.mkt-pill b { font-size: 14px; }
/* 边框改用专用描边 token（原 --up-bg/--down-bg 与底色相同等于无边框）；对齐 .trade-badge.open 的强边框+淡底模式 */
.mkt-pill.up { color: var(--up); border-color: var(--up-line); background: var(--up-bg); }
.mkt-pill.down { color: var(--down); border-color: var(--down-line); background: var(--down-bg); }
.mkt-pill.flat { color: var(--text-2); }
.mkt-empty { font-size: 13px; color: var(--text-3); font-family: var(--mono); }
.mkt-news { border-left: 1px solid var(--line); padding-left: var(--gap); }
@media (max-width: 1100px) { .mkt-news { border-left: none; padding-left: 0; } }
.flash-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.flash-item { display: flex; align-items: baseline; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.flash-item:last-child { border-bottom: none; }
.flash-time { color: var(--amber); flex-shrink: 0; font-size: 13px; }
.flash-src { color: var(--text-3); flex-shrink: 0; font-size: 12px; min-width: 44px; }
.flash-title { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Dashboard：任务时间线 ---------- */

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(180deg, var(--amber-line), var(--track));
}
.tl-item { position: relative; padding: 6px 0 6px 6px; display: flex; align-items: center; gap: 8px; }
.tl-item::before {
  content: ""; position: absolute; left: -17px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 1px;
  background: var(--scrollbar); border: 1px solid var(--border-strong);
}
.tl-item.done::before { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 7px rgba(255, 64, 85, 0.6); }
.tl-item.active::before { background: var(--up); border-color: var(--up); box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.25); animation: pulse 1.3s infinite; }
.tl-item .tl-time { font-size: 13px; font-weight: 700; font-family: var(--mono); width: 40px; flex-shrink: 0; color: var(--text-3); }
.tl-item.done .tl-time { color: var(--amber); }
.tl-item.active .tl-time { color: var(--up); }
.tl-item .tl-name { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-item.done .tl-name { color: var(--text-2); }
.tl-item .tl-state { font-size: 12px; color: var(--text-3); flex-shrink: 0; font-family: var(--mono); letter-spacing: 1px; }
.tl-item.active .tl-state { color: var(--up); font-weight: 700; }
/* 推送/生成失败：醒目红（不脉动，区别于 active 的脉动红） */
.tl-item.fail::before { background: #ff4757; border-color: #ff4757; box-shadow: 0 0 7px rgba(255, 71, 87, 0.55); }
.tl-item.fail .tl-time, .tl-item.fail .tl-state { color: #ff4757; font-weight: 700; }
.tl-item.fail .tl-name { color: var(--text-2); }

/* 旧指数卡（兼容保留） */
.idx-card { padding: 13px 15px; cursor: default; overflow: hidden; }
.idx-card .idx-name { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; letter-spacing: 1px; }
.idx-card .idx-price { font-size: 26px; font-weight: 700; font-family: var(--mono); margin: 2px 0 1px; }
.idx-card .idx-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-3); font-family: var(--mono); }
.gauge-wrap { display: flex; align-items: center; gap: 6px; }
.gauge-chart { width: 185px; height: 165px; flex-shrink: 0; }
.gauge-side { flex: 1; min-width: 0; }
.gauge-side .desc { font-size: 14px; color: var(--text-2); margin-bottom: 8px; line-height: 1.6; }
.gauge-side .advice {
  font-size: 14px; padding: 8px 11px; border-radius: var(--radius-sm); line-height: 1.6;
  background: var(--amber-dim); border: 1px solid var(--amber-line); color: var(--text);
}
.gauge-side .advice b { color: var(--amber); }

/* ---------- Chat ---------- */

.chat-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: var(--gap);
  height: calc(100vh - var(--topbar-h) - var(--ticker-h) - var(--statusbar-h) - var(--gap) * 2);
  min-height: 540px;
}
.chat-layout.no-side { grid-template-columns: minmax(0, 1fr); }

.chat-main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.chat-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}

.chat-context { padding: 9px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.chat-context .ctx-hint { font-size: 14px; color: var(--text-3); }
.chat-context .input { width: 170px; font-family: var(--mono); }

.chat-stream { flex: 1; overflow-y: auto; padding: 16px 16px 8px; scroll-behavior: smooth; }

.msg { display: flex; gap: 10px; margin-bottom: 16px; animation: msgIn 0.22s ease both; }
/* AI/系统气泡的内容列必须 flex:1 + min-width:0：否则含 width:100% 的 markdown 表格时，
   该 flex 项会触发"百分比子元素→0 宽"塌缩，正文按 1 字/行折行、气泡高达数万 px。
   用户气泡不含表格、保持内容自适应宽度，故不波及。 */
.msg.ai > div:not(.msg-avatar), .msg.system > div:not(.msg-avatar) { flex: 1; min-width: 0; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 2px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.msg.ai .msg-avatar { background: var(--amber); color: #fff; box-shadow: 0 0 12px rgba(255, 64, 85, 0.3); }
.msg.user .msg-avatar { background: var(--panel-3); color: var(--text-2); border: 1px solid var(--border-strong); }
.msg-bubble {
  max-width: min(740px, 84%); padding: 9px 13px; border-radius: var(--radius);
  font-size: 15px; line-height: 1.7; overflow-wrap: break-word; min-width: 0;
}
.msg.ai .msg-bubble { background: var(--panel-2); border: 1px solid var(--border); border-left: 2px solid var(--amber-line); }
.msg.user .msg-bubble {
  background: rgba(65, 199, 255, 0.06);
  border: 1px solid rgba(65, 199, 255, 0.22);
  white-space: pre-wrap;
}
.msg.system .msg-bubble { background: var(--up-bg); border: 1px solid rgba(255, 71, 87, 0.35); color: var(--up); font-size: 14px; }
.msg-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; font-family: var(--mono); }
.msg.user .msg-meta { text-align: right; }

/* 错误气泡「重试」按钮（#4） */
.error-actions { margin-top: 6px; }
.error-actions .error-retry { color: var(--up); border-color: rgba(255, 71, 87, 0.45); }
.error-actions .error-retry:hover { color: #fff; background: var(--up); border-color: var(--up); }
.error-actions .error-retry svg { width: 14px; height: 14px; }

/* 分阶段等待提示（#7）：流式占位气泡收到首个 delta 前显示阶段文案 + 已等待秒数 */
.stage-wait { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 14px; }
.stage-wait .stage-secs { color: var(--text-3); font-size: 13px; }

.typing-cursor { display: inline-block; width: 7px; height: 14px; background: var(--amber); vertical-align: -2px; margin-left: 2px; animation: pulse 0.7s infinite; }

.chat-presets { display: flex; gap: 6px; padding: 8px 14px 0; flex-wrap: wrap; flex-shrink: 0; }

.chat-inputbar { display: flex; gap: 9px; padding: 11px 14px 13px; align-items: flex-end; flex-shrink: 0; }
.chat-inputbar .textarea { min-height: 42px; max-height: 140px; flex: 1; }
.send-btn {
  width: 42px; height: 42px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  background: var(--amber); color: #000; display: grid; place-items: center;
  box-shadow: 0 0 16px rgba(255, 64, 85, 0.25); transition: all 0.14s; flex-shrink: 0;
}
.send-btn:hover { filter: brightness(1.08); box-shadow: 0 0 24px rgba(255, 64, 85, 0.4); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.send-btn.stop { background: var(--up); color: #fff; box-shadow: 0 0 16px rgba(255, 71, 87, 0.4); }
.send-btn svg { width: 18px; height: 18px; }

.chat-side { display: flex; flex-direction: column; gap: var(--gap); overflow-y: auto; min-height: 0; padding-bottom: 2px; }

.quote-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.quote-head .q-name { font-size: 18px; font-weight: 800; }
.quote-head .q-code { font-size: 13px; color: var(--amber); font-family: var(--mono); letter-spacing: 1px; }
.quote-price { display: flex; align-items: baseline; gap: 11px; margin: 4px 0 9px; }
.quote-price .q-px { font-size: 36px; font-weight: 800; font-family: var(--mono); line-height: 1.05; text-shadow: 0 0 22px currentColor; }
.quote-price .q-chg { font-size: 16px; font-weight: 700; font-family: var(--mono); }
.quote-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px 10px; font-size: 14px; }
.quote-grid .qg { display: flex; justify-content: space-between; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--hover); }
.quote-grid .qg b { font-weight: 600; font-family: var(--mono); }
.quote-grid .qg span { color: var(--text-3); }

.flow-rows { margin-top: 4px; }
.flow-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.flow-row .f-label { width: 42px; color: var(--text-3); flex-shrink: 0; }
.flow-row .f-track { flex: 1; height: 6px; border-radius: 1px; background: var(--track); position: relative; overflow: hidden; }
.flow-row .f-bar { position: absolute; top: 0; bottom: 0; border-radius: 1px; transition: width 0.5s; }
.flow-row .f-val { width: 62px; text-align: right; font-family: var(--mono); flex-shrink: 0; }

.mini-chart { width: 100%; height: 190px; }
.mini-chart.tall { height: 210px; }

/* ---------- Markdown 正文 ---------- */

.md-body { font-size: 15px; line-height: 1.75; }
.md-body > :first-child { margin-top: 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 1.1em 0 0.5em; line-height: 1.4; font-weight: 700; }
.md-body h1 { font-size: 1.35em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border-strong); }
.md-body h1::before, .md-body h2::before { content: "▮ "; color: var(--amber); font-size: 0.8em; }
.md-body h2 { font-size: 1.15em; }
.md-body h3 { font-size: 1.04em; color: var(--amber); }
.md-body p { margin: 0.55em 0; }
.md-body ul, .md-body ol { margin: 0.5em 0; padding-left: 1.5em; }
.md-body li { margin: 0.25em 0; }
.md-body blockquote {
  margin: 0.7em 0; padding: 8px 13px;
  border-left: 2px solid var(--amber);
  background: var(--amber-dim); color: var(--text-2);
}
.md-body code { font-family: var(--mono); font-size: 0.88em; background: var(--line); padding: 1px 5px; border-radius: 2px; }
.md-body pre { background: var(--bar-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; overflow-x: auto; margin: 0.7em 0; }
.md-body pre code { background: none; padding: 0; }
.md-body table { width: 100%; border-collapse: collapse; margin: 0.8em 0; font-size: 0.93em; }
.md-body th { background: var(--panel-3); font-weight: 600; color: var(--text-2); }
.md-body th, .md-body td { padding: 5px 10px; border: 1px solid var(--border-strong); text-align: left; }
.md-body tbody tr:nth-child(even) { background: var(--zebra); }
.md-body hr { border: none; border-top: 1px dashed var(--border-strong); margin: 1em 0; }
.md-body strong { color: var(--text); font-weight: 700; }
.md-body a { color: var(--cyan); }
.md-body img { max-width: 100%; border-radius: var(--radius); }

.report-body { font-size: 15px; max-width: 880px; }

/* ---------- Reports ---------- */

.report-toolbar { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: var(--gap); }
.report-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); font-family: var(--mono); }
.pushed-badge {
  font-size: 13px; padding: 1px 8px; border-radius: var(--radius-sm);
  background: var(--down-bg); color: var(--down); border: 1px solid rgba(0, 201, 138, 0.35);
  letter-spacing: 1px;
}
.gen-indicator { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--amber); font-family: var(--mono); }
.gen-indicator .gdot { width: 7px; height: 7px; border-radius: 1px; background: var(--amber); animation: pulse 0.9s infinite; }
/* 报告生成的分阶段等待秒数（#7）：阶段文案沿用指示器的 amber/mono，秒数稍弱化 */
.gen-indicator .gen-secs { color: var(--text-3); }

/* ---------- Sentiment ---------- */

.big-chart { width: 100%; height: 380px; }
.sub-chart { width: 100%; height: 200px; }

.phase-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.phase-card { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel-2); border-top: 2px solid var(--border-strong); transition: all 0.16s; }
.phase-card:hover { border-color: var(--border-strong); }
.phase-card.current { border-color: var(--amber); border-top-color: var(--amber); box-shadow: 0 0 22px rgba(255, 64, 85, 0.12); }
.phase-card h4 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.phase-card h4 .pdot { width: 8px; height: 8px; border-radius: 1px; flex-shrink: 0; }
.phase-card .pc-feat { font-size: 13px; color: var(--text-3); margin-bottom: 5px; }
.phase-card .pc-op { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.phase-card .pc-op b { color: var(--text); }

/* ---------- Holdings ---------- */

.hold-input { background: transparent; border: 1px solid transparent; border-radius: 2px; color: var(--text); font: inherit; font-family: var(--mono); padding: 3px 6px; width: 100%; min-width: 70px; outline: none; transition: all 0.13s; }
.hold-input:hover { border-color: var(--border-strong); }
.hold-input:focus { border-color: var(--amber); background: var(--inset); }
.row-del { opacity: 0; transition: opacity 0.13s; }
.tbl tr:hover .row-del { opacity: 1; }
/* 知识卡不是表格行，.tbl tr:hover 揭示规则对它不生效 → 删除按钮会永久 opacity:0 隐形。
   卡片场景下删除按钮常显（客户#13"找不到删除"根因；touch 端也无 hover 可依赖）。 */
.kn-card .row-del { opacity: 1; }
.kn-card:hover .row-del { opacity: 1; }
/* 触屏设备（手机/微信内置浏览器）没有 hover、窄屏也难悬停 → 表格里靠 hover 揭示的删除按钮
   永远不显。触屏(hover:none)或窄屏(≤640px)一律常显（客户#12 持仓删除在手机上看不到的根因）。
   桌面宽屏仍保持 hover 揭示、不显得杂乱。 */
@media (hover: none), (max-width: 640px) {
  .row-del { opacity: 1; }
}

/* ---------- Chain ---------- */

.chain-hero { text-align: center; padding: 28px 16px 22px; }
.chain-hero h2 { font-size: 21px; margin-bottom: 6px; color: var(--amber); letter-spacing: 2px; }
.chain-hero p { color: var(--text-3); font-size: 14px; max-width: 460px; margin: 0 auto 16px; }
.chain-form { display: flex; gap: 9px; justify-content: center; max-width: 480px; margin: 0 auto; }
.chain-form .input { font-size: 15px; padding: 10px 14px; }
.history-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.12s; font-size: 14px; }
.history-item svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--amber); }
.history-item:hover { background: var(--hover); }
.history-item.active { background: var(--amber-dim); border: 1px solid var(--amber-line); }
.history-item .hi-time { margin-left: auto; font-size: 12px; color: var(--text-3); flex-shrink: 0; font-family: var(--mono); }

/* ---------- Knowledge ---------- */

.kn-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--gap); }
.kn-cat {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px; margin-bottom: 2px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--text-2);
  transition: all 0.12s; border-left: 2px solid transparent;
}
.kn-cat:hover { background: var(--hover); color: var(--text); }
.kn-cat.active { color: var(--amber); background: var(--amber-dim); border-left-color: var(--amber); }
.kn-cat .cnt { margin-left: auto; font-size: 13px; color: var(--text-3); background: var(--track); padding: 0 6px; border-radius: 2px; font-family: var(--mono); }
.kn-cat .cdot { width: 7px; height: 7px; border-radius: 1px; flex-shrink: 0; }

.kn-masonry { columns: 3 260px; column-gap: var(--gap); }
.kn-card { break-inside: avoid; margin-bottom: var(--gap); padding: 13px 15px; }
.kn-card h4 { font-size: 15px; margin: 6px 0 5px; }
.kn-card .kn-content { font-size: 14px; color: var(--text-2); line-height: 1.65; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.kn-card .kn-content.short { -webkit-mask-image: none; mask-image: none; }
.kn-card .kn-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--text-3); font-family: var(--mono); }
.cat-tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: var(--radius-sm); border: 1px solid; letter-spacing: 1px; }

/* ---------- Archive ---------- */

.ar-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.ar-date {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px; margin-bottom: 2px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; font-family: var(--mono);
  color: var(--text-2); transition: all 0.12s; border-left: 2px solid transparent;
}
.ar-date:hover { background: var(--hover); color: var(--text); }
.ar-date.active { color: var(--amber); background: var(--amber-dim); border-left-color: var(--amber); }
.ar-date .today-tag { font-size: 12px; color: var(--amber); }

.acc-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 9px; overflow: hidden; background: var(--panel-2); }
.acc-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; font-size: 15px; font-weight: 600; user-select: none;
  transition: background 0.12s;
}
.acc-head:hover { background: var(--line-soft); }
.acc-head .acc-arrow { margin-left: auto; transition: transform 0.18s; color: var(--text-3); width: 15px; height: 15px; }
.acc-item.open .acc-arrow { transform: rotate(90deg); }
.acc-body { display: none; padding: 4px 16px 14px; border-top: 1px solid var(--border); }
.acc-item.open .acc-body { display: block; }

/* ---------- Settings ---------- */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: var(--gap); max-width: 1100px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hover); font-size: 14px; }
.set-row:last-child { border-bottom: none; }
.set-row .sr-label { color: var(--text-2); flex-shrink: 0; }
.set-row .sr-val { font-family: var(--mono); text-align: right; word-break: break-all; }
.sched-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 页面标题 ---------- */
.page-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-title { font-size: var(--font-xl); line-height: 1.3; font-weight: 800; letter-spacing: 0.6px; }
.page-sub { font-size: var(--font-sm); color: var(--text-3); line-height: 1.55; }
.page-head .ph-extra { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 1439px) {
  .sp-3 { grid-column: span 6; }
  .sp-4 { grid-column: span 6; }
  .sp-5 { grid-column: span 12; }
  .sp-7 { grid-column: span 12; }
  .sp-8 { grid-column: span 12; }
  .sp-9 { grid-column: span 12; }
  .chat-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .mini-indexes .mini-idx:nth-child(n+3) { display: none; }
  .kn-masonry { columns: 2 240px; }
}

/* ============================================================
   Features / Institutional / DIY（v2 新增页）
   ============================================================ */

/* 主线深研改为一个工作台，左右列各自连续排版，避免被邻列高度拉出大片空白。 */
.ft-workbench-card { overflow: hidden; }
.ft-workbench-body { padding-top: var(--space-3); }
.ft-workbench {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(360px, 5fr);
  gap: var(--gap); align-items: start;
}
.ft-workbench-col { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.ft-module-wide { margin-top: var(--gap); }
.ft-module {
  min-width: 0; overflow: hidden; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--panel);
}
.ft-module-head {
  min-height: 42px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 13px; border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.ft-module-title { min-width: 0; color: var(--text); font-size: 13px; font-weight: 750; letter-spacing: .7px; }
.ft-module-body { min-width: 0; padding: 13px; }

/* ---- 共用：题材名 / kind 徽章 / 小标题 / 排名 ---- */
.ft-theme { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-theme.clickable { cursor: help; }
.ft-sub-title { font-size: 13px; color: var(--text-3); letter-spacing: 1.5px; text-transform: uppercase; margin: 4px 0 7px; }
.ft-rank { width: 18px; flex-shrink: 0; text-align: center; font-size: 13px; color: var(--text-3); font-weight: 700; }

.ft-kind { font-size: 12px; padding: 0 5px; border-radius: 2px; flex-shrink: 0; letter-spacing: 1px; font-family: var(--mono); border: 1px solid; }
.ft-kind.ind { color: var(--cyan); border-color: rgba(65, 199, 255, 0.4); background: rgba(65, 199, 255, 0.08); }
/* 紫色徽章改走 --purple token（浅色主题加深至 #7d2fc4 ≈7:1，原 #c77dff 白底仅 2.69:1） */
.ft-kind.con { color: var(--purple); border-color: var(--purple-line); background: var(--purple-bg); }

/* ---- 1 赚钱效应榜 ---- */
.ft-me-chart { width: 100%; height: 210px; margin-bottom: 8px; }
.ft-me-list { display: flex; flex-direction: column; }
.ft-me-row {
  display: grid;
  grid-template-columns: minmax(64px, 1.4fr) auto 56px 48px 64px minmax(70px, 1.4fr) 64px;
  align-items: center; gap: 7px;
  padding: 5px 4px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.ft-me-row:last-child { border-bottom: none; }
.ft-me-chg { text-align: right; font-weight: 600; }
.ft-me-score { text-align: right; font-weight: 700; }
.ft-me-cell { text-align: right; color: var(--text-2); }
.ft-me-cell .u { color: var(--text-3); font-size: 12px; }
.ft-me-leader { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help; }
.ft-me-flow { text-align: right; }
.ft-losers { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); line-height: 1.7; }
.ft-losers .down { font-family: var(--mono); }

/* ---- 2 交易拥挤度 ---- */
.ft-crowd-list { display: flex; flex-direction: column; gap: 9px; }
.ft-crowd-row { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ft-crowd-row:last-child { border-bottom: none; padding-bottom: 0; }
.ft-crowd-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ft-crowd-top .ft-theme { flex: 1; min-width: 0; }
.ft-crowd-chg { font-size: 13px; font-weight: 600; flex-shrink: 0; }
.ft-crowd-lvl { font-size: 12px; padding: 1px 7px; border-radius: 2px; flex-shrink: 0; letter-spacing: 1px; border: 1px solid var(--border-strong); color: var(--text-3); font-family: var(--mono); }
.ft-crowd-lvl.hot { color: var(--up); border-color: rgba(255, 71, 87, 0.5); background: var(--up-bg); }
.ft-crowd-lvl.warm { color: var(--amber); border-color: var(--amber-line); background: var(--amber-dim); }
.ft-crowd-lvl.cold { color: var(--cyan); border-color: rgba(65, 199, 255, 0.4); background: rgba(65, 199, 255, 0.08); }
.ft-crowd-track {
  position: relative; height: 14px; border-radius: 2px; overflow: hidden;
  background: var(--track); cursor: help;
}
.ft-crowd-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; opacity: 0.85; transition: width 0.5s ease; }
.ft-crowd-num { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text); font-weight: 700; z-index: 1; }
.ft-crowd-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---- 3 市场主线 ---- */
.ft-switch {
  font-size: 13px; padding: 7px 11px; margin-bottom: 9px; border-radius: var(--radius-sm);
  background: var(--amber-dim); border: 1px solid var(--amber-line); border-left: 2px solid var(--amber);
  color: var(--amber); line-height: 1.6;
}
.ft-note { font-size: 14px; color: var(--text-2); line-height: 1.65; padding: 8px 11px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--border); margin-bottom: 9px; }
.ft-mainline-list { display: flex; flex-direction: column; gap: 9px; }
.ft-ml-row { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ft-ml-row:last-child { border-bottom: none; padding-bottom: 0; }
.ft-ml-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ft-ml-top .ft-theme { flex: 1; min-width: 0; }
.ft-ml-days { font-size: 13px; color: var(--amber); flex-shrink: 0; cursor: help; }
.ft-ml-strength { position: relative; height: 12px; border-radius: 2px; overflow: hidden; background: var(--track); cursor: help; }
.ft-ml-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: linear-gradient(90deg, var(--amber-2), var(--amber)); transition: width 0.5s ease; }
.ft-ml-snum { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text); font-weight: 700; z-index: 1; }
.ft-ml-meta { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.ft-today-top, .ft-tt-row { font-size: 14px; }
.ft-tt-row { display: flex; align-items: center; gap: 7px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.ft-tt-row:last-child { border-bottom: none; }
.ft-tt-row .ft-theme { flex: 1; min-width: 0; }
.ft-tt-score { font-weight: 700; flex-shrink: 0; }

/* ---- 4 龙头梯队 ---- */
.ft-leaders-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; }
.ft-leaders-main { min-width: 0; }
.ft-leaders-side { border-left: 1px solid var(--border); padding-left: 14px; }
.ft-ladder { display: flex; flex-direction: column; }
.stock-chip.leader { background: rgba(255, 64, 85, 0.1); border-color: var(--amber-line); }
.stock-chip.leader:hover { background: var(--amber-dim); border-color: var(--amber); }
.stock-chip .sc-star { color: var(--amber); font-size: 13px; }
.ft-pop-row { display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.ft-pop-row:last-child { border-bottom: none; }
.ft-pop-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: color 0.13s; }
.ft-pop-name:hover { color: var(--amber); }
.ft-pop-lb { font-size: 12px; color: var(--up); margin-left: 5px; }
.ft-pop-seal { font-size: 13px; color: var(--text-3); flex-shrink: 0; cursor: help; }

/* ---- 机构容量票 ---- */
.inst-concept { color: var(--cyan); font-size: 13px; font-family: var(--font); }
.inst-trend { font-size: 13px; padding: 1px 7px; border-radius: 2px; letter-spacing: 1px; border: 1px solid var(--border-strong); font-family: var(--mono); }
.inst-trend.up { color: var(--up); border-color: rgba(255, 71, 87, 0.4); background: var(--up-bg); }
.inst-trend.down { color: var(--down); border-color: rgba(0, 201, 138, 0.4); background: var(--down-bg); }
.inst-trend.flat { color: var(--text-3); }
.inst-score { position: relative; height: 15px; width: 76px; margin-left: auto; border-radius: 2px; overflow: hidden; background: var(--track); cursor: help; }
.inst-score-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: linear-gradient(90deg, var(--amber-2), var(--amber)); transition: width 0.5s ease; }
.inst-score-num { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text); font-weight: 700; z-index: 1; }

/* ---- DIY ---- */
.diy-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.diy-left { display: flex; flex-direction: column; }
.diy-tpl {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 4px;
  border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--border);
  background: var(--panel-2); border-left: 2px solid transparent; transition: all 0.13s;
}
.diy-tpl:hover { border-color: var(--border-strong); }
.diy-tpl.active { border-left-color: var(--amber); background: var(--amber-dim); }
.diy-tpl-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; }
.diy-tpl-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diy-tpl-del { flex-shrink: 0; }
.diy-tt { font-size: 12px; padding: 0 5px; border-radius: 2px; flex-shrink: 0; letter-spacing: 1px; font-family: var(--mono); border: 1px solid; }
.diy-tt.stock { color: var(--up); border-color: rgba(255, 71, 87, 0.4); background: var(--up-bg); }
.diy-tt.theme { color: var(--purple); border-color: var(--purple-line); background: var(--purple-bg); }
.diy-tt.free { color: var(--cyan); border-color: rgba(65, 199, 255, 0.4); background: rgba(65, 199, 255, 0.08); }
.diy-samples { padding: 11px 14px 13px; border-top: 1px solid var(--border); }
.diy-sample {
  display: flex; align-items: center; gap: 7px; padding: 6px 9px; margin-bottom: 4px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; color: var(--text-2);
  border: 1px dashed var(--border-strong); transition: all 0.13s;
}
.diy-sample:hover { color: var(--amber); border-color: var(--amber-line); background: var(--hover); }
.diy-sample-name { flex: 1; min-width: 0; }
.diy-run-body { display: flex; flex-direction: column; }
.diy-run-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 13px; flex-wrap: wrap; }
.diy-target-field { flex: 1; min-width: 180px; margin-bottom: 0; }
.diy-target-field .ctx-hint { font-size: 14px; color: var(--text-3); }
.diy-run-btn { flex-shrink: 0; }
.diy-run-btn.stop { background: var(--up); border-color: var(--up); color: #fff; box-shadow: 0 0 16px rgba(255, 71, 87, 0.4); }
.diy-run-btn.stop:hover { background: #ff5e6b; border-color: #ff5e6b; }
.diy-output-wrap { border-top: 1px solid var(--border); padding-top: 12px; min-height: 240px; }
#diy-output .report-body { max-width: 100%; }

@media (max-width: 1023px) {
  .ft-workbench { display: flex; flex-direction: column; }
  .ft-workbench-col { display: contents; }
  #ft-money { order: 1; }
  #ft-crowd { order: 2; }
  #ft-mainline { order: 3; }
  #ft-leaders { order: 4; }
  .diy-layout { grid-template-columns: 1fr; }
  .ft-leaders-grid { grid-template-columns: 1fr; }
  .ft-leaders-side { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 11px; margin-top: 11px; }
}

@media (max-width: 1023px) {
  :root { --sidebar-w: 56px; }
  .sidebar .logo-text, .sidebar .nav-label, .collapse-btn .c-label { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-group-toggle, .nav-children { display: none; }
  .sp-3, .sp-4, .sp-5, .sp-6, .sp-7, .sp-8, .sp-9 { grid-column: span 12; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .chat-main { height: calc(100vh - var(--topbar-h) - 32px); min-height: 480px; }
  .chat-side { flex-direction: column; }
  .mini-indexes { display: none; }
  .tb-clock .sec { display: none; }
  .kn-layout, .ar-layout { grid-template-columns: 1fr; }
  .kn-masonry { columns: 1; }
  .sector-cols { grid-template-columns: 1fr; }
  .gauge-wrap { flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-chart { height: 300px; }
  .statusbar { display: none; }
  .main-wrap { padding-bottom: 0; }
}

/* ---------- 数据源健康面板 ---------- */
.ds-infra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ds-infra-item { padding: 11px 13px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--border); border-left: 2px solid var(--border-strong); }
.ds-infra-item .dii-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.ds-infra-item .dii-meta { font-size: 13px; color: var(--text-3); line-height: 1.7; word-break: break-all; }
.ds-infra-item .dii-meta b { color: var(--text); }
@media (max-width: 1023px) { .ds-infra-grid { grid-template-columns: 1fr; } }

/* ============================================================
   v3 精致化层（双主题通用，均走 CSS 变量）
   ============================================================ */

/* —— 主题切换平滑过渡（仅切换瞬间启用，避免数据刷新闪烁）—— */
html.theme-anim, html.theme-anim * {
  transition: background-color var(--t-slow), border-color var(--t-slow),
              color var(--t-slow), box-shadow var(--t-slow), fill var(--t-slow) !important;
}

/* —— 选中 / 焦点可达性 —— */
/* 浅色 --amber-line 叠白底合成浅杏色，白字仅 1.46:1 → 浅色主题改用深色文字（--text 12.26:1） */
:root[data-theme="dark"] ::selection { background: var(--amber-line); color: #fff; }
:root[data-theme="light"] ::selection { background: var(--amber-line); color: var(--text); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: var(--radius-xs); }
.btn:focus-visible, .input:focus-visible, .seg:focus-visible, .tab:focus-visible { outline-offset: 1px; }

/* —— 面板：更柔的质感 + hover 抬升 + 角标点亮 —— */
.card { transition: border-color var(--t), box-shadow var(--t), transform var(--t); }
.card.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-title { letter-spacing: 1px; }

/* —— 按钮：主按钮渐变质感 + 微光，次按钮更顺滑 —— */
.btn { transition: all var(--t-fast); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-grad); border: none; color: #1a1205; position: relative; overflow: hidden; }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 4px 18px var(--amber-dim); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent 45%); pointer-events: none; }

/* —— 顶栏：磨砂玻璃更精致 —— */
.topbar { backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.sidebar { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* —— 导航激活态：左侧光条 + 渐隐底色 + 轻发光 —— */
.nav-item { transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.nav-item.active { background: linear-gradient(90deg, var(--amber-dim), transparent 88%); box-shadow: inset 2px 0 0 var(--amber); }

/* —— 主题切换按钮 —— */
.theme-toggle {
  width: 30px; height: 30px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--border-strong); color: var(--text-2);
  transition: all var(--t-fast);
}
.theme-toggle:hover { color: var(--amber); border-color: var(--amber-line); }
.theme-toggle svg { width: 15px; height: 15px; }

/* —— 输入聚焦：琥珀光圈 —— */
.input:focus, .select:focus, .textarea:focus { box-shadow: 0 0 0 3px var(--amber-dim); border-color: var(--amber); }

/* —— 滚动条：圆润一点 —— */
::-webkit-scrollbar-thumb { border-radius: 4px; }

/* —— chip / 徽章：更顺滑 —— */
.chip, .chg-pill, .cat-tag, .phase-badge { transition: all var(--t-fast); }

/* —— 表格行 hover 更明确 —— */
.tbl tbody tr { transition: background var(--t-fast); }

/* —— 卡片标题左侧三角 → 改为更精致的竖条 —— */
.card-title::before { clip-path: none; width: 3px; height: 11px; border-radius: 1px; }

/* —— 空状态/骨架在浅色下更自然 —— */
.skel { background: linear-gradient(90deg, var(--line) 25%, var(--skel-2) 50%, var(--line) 75%); background-size: 200% 100%; }

/* —— 浅色主题专属微调：极淡网格、卡片描边更清晰 —— */
:root[data-theme="light"] body { background: radial-gradient(1100px 520px at 50% -220px, var(--glow), transparent 62%), linear-gradient(180deg, var(--bg0), var(--bg1)); }
:root[data-theme="light"] .card { box-shadow: var(--shadow-soft); }
:root[data-theme="light"] .ladder-tag.hot,
:root[data-theme="light"] .btn-primary { color: #fff; }
:root[data-theme="light"] .send-btn { color: #fff; }
:root[data-theme="light"] .msg.ai .msg-avatar { color: #fff; }
:root[data-theme="light"] .logo-mark svg { color: #fff; }

/* ============ 主力吸筹 mainforce（北向 / 龙虎榜机构 / 行业资金流） ============ */
.mf-note { font-size: 12px; color: var(--text-3); margin-bottom: 10px; line-height: 1.5; }
.mf-rank { color: var(--text-3); font-size: 12px; width: 22px; text-align: right; flex-shrink: 0; }
.mf-src { color: var(--text-3); font-size: 11px; }

/* 今日北/南向卡 */
.mf-north-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mf-nc { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.mf-nc-label { font-size: 13px; color: var(--text-2); display: flex; align-items: baseline; gap: 7px; }
.mf-nc-sub { font-size: 11px; color: var(--text-3); }
.mf-nc-val { font-size: 22px; font-weight: 700; margin: 6px 0 4px; }
.mf-nc-meta { font-size: 12px; color: var(--text-3); }

/* 近 N 日北向迷你柱（纯 DOM，零轴居中，上正下负） */
.mf-trend-title { font-size: 12px; color: var(--text-3); margin: 4px 0 8px; }
.mf-bars { position: relative; display: flex; align-items: stretch; gap: 3px; height: 120px; padding-bottom: 1px; }
.mf-bar-col { flex: 1; display: flex; flex-direction: column; min-width: 0; cursor: help; }
.mf-bar-pos, .mf-bar-neg { flex: 1; display: flex; }
.mf-bar-pos { align-items: flex-end; }
.mf-bar-neg { align-items: flex-start; }
.mf-bar { width: 100%; border-radius: 1px; opacity: 0.85; transition: height 0.4s ease; }
.mf-bar.up { background: var(--up); }
.mf-bar.down { background: var(--down); }
.mf-bars-axis { position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--border); }

/* 龙虎榜机构净买榜 */
.mf-inst-list, .mf-ind-list { display: flex; flex-direction: column; }
.mf-inst-row, .mf-ind-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.mf-inst-row:last-child, .mf-ind-row:last-child { border-bottom: none; }
.mf-inst-row.clickable { cursor: pointer; }
.mf-inst-row.clickable:hover { background: var(--line); }
.mf-inst-name, .mf-ind-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-inst-code { color: var(--text-3); font-size: 12px; margin-left: 6px; }
.mf-inst-seats { color: var(--text-2); font-size: 13px; flex-shrink: 0; }
.mf-inst-seats .u { color: var(--text-3); font-size: 11px; }
.mf-ind-name { cursor: help; flex: 0 1 6.5em; min-width: 4em; max-width: 6.5em; }
.mf-ind-chg { width: 60px; text-align: right; font-weight: 600; flex-shrink: 0; }

/* 净买/净额条（红进绿出，宽度=相对最大绝对值占比） */
.mf-inst-track, .mf-ind-track {
  position: relative; width: 90px; height: 13px; flex-shrink: 0;
  background: var(--track); border-radius: 2px; overflow: hidden;
}
.mf-inst-bar, .mf-ind-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; opacity: 0.85; transition: width 0.5s ease; }
.mf-inst-bar.up, .mf-ind-bar.up { background: var(--up); }
.mf-inst-bar.down, .mf-ind-bar.down { background: var(--down); }
.mf-inst-net, .mf-ind-net { width: 86px; text-align: right; font-weight: 700; flex-shrink: 0; }

@media (max-width: 640px) {
  .mf-north-cards { grid-template-columns: 1fr; }
  .mf-inst-track, .mf-ind-track { width: 56px; }
  .mf-inst-net, .mf-ind-net { width: 70px; }
}

/* 盘中数字跳动（live.js）：真实新值变化时闪一下，红涨绿跌，随主题自适应。 */
@keyframes lvUp { from { background-color: var(--up-flash); } to { background-color: transparent; } }
@keyframes lvDown { from { background-color: var(--down-flash); } to { background-color: transparent; } }
.lv-up { animation: lvUp 0.62s ease-out; border-radius: 3px; }
.lv-down { animation: lvDown 0.62s ease-out; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { .lv-up, .lv-down { animation-duration: 0.01ms; } }

/* 数据状态条「● 实时」的脉冲点：青色=活跃/在线，避开红涨绿跌的价格色歧义。 */
.live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan, #46c9ff); margin-right: 5px; vertical-align: 1px; animation: pulse 1.4s infinite; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* 版本更新温和提示胶囊（右下角，点了才刷新，绝不自动重载打断） */
#update-prompt { position: fixed; right: 18px; bottom: 18px; z-index: 9999; display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 22px; background: var(--modal-bg, var(--panel)); color: var(--amber); border: 1px solid var(--amber-line, var(--amber)); font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-soft); animation: upIn 0.35s ease-out; }
#update-prompt:hover { background: var(--panel-2); }
#update-prompt svg { width: 15px; height: 15px; }
@keyframes upIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 叶子工作台按需下载时的局部反馈：不锁住整个应用壳。 */
.lazy-view-loading .card-body {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
}

.lazy-view-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, var(--brand1) 24%, transparent);
  border-top-color: var(--brand1);
  border-radius: 50%;
  animation: lazy-view-spin .7s linear infinite;
}

@keyframes lazy-view-spin { to { transform: rotate(360deg); } }
