/* lianghua webapp — 设计系统
   暗色工具型;Restrained 配色;OKLCH 着色中性。
   色彩三域(iter-uiv3):红绿只进数值 / 玫红(--action)只进操作 /
   蓝紫(--info)只进信息;--hot 琥珀仅保留「重点标记」语义。
   见设计文档 §6 + docs/iter-uiv3-design.md。 */

:root {
  --bg:        oklch(0.185 0.010 256);
  --panel:     oklch(0.224 0.012 256);
  --panel-2:   oklch(0.262 0.013 256);
  --rail:      oklch(0.205 0.011 258);
  --line:      oklch(0.320 0.012 256);
  --line-soft: oklch(0.270 0.011 256);
  --text:      oklch(0.935 0.006 256);
  --text-dim:  oklch(0.690 0.009 256);
  --text-faint:oklch(0.520 0.009 256);
  /* 语义文本专用:--text-faint 在 panel-2 上对比度 ~2.8,低于 WCAG AA 4.5;
     此 token 把对比度抬到 ~4.2(贴 AA 边界,装饰文本仍可用 --text-faint) */
  --text-muted-aa: oklch(0.640 0.011 256);
  /* 数值域:市场/会计方向色,禁止用于按钮与交互态(美股语境:绿涨红跌) */
  --profit: oklch(0.760 0.140 150);   /* 盈利 / 上涨 */
  --loss:   oklch(0.670 0.175 25);    /* 亏损 / 下跌 */
  --danger: var(--loss);              /* 系统错误与 loss 共用,不造第三种红 */
  --danger-q: oklch(0.670 0.175 25 / 0.18);  /* H5 topbar alert 染色用 */
  /* 操作域:玫红 = primary action / 当前选中 / short 身份 / HTB 强调 */
  --action:    oklch(0.665 0.220 345);
  --action-q:  oklch(0.665 0.220 345 / 0.13);
  --action-q2: oklch(0.665 0.220 345 / 0.22);
  /* 实底按钮专用深玫红:白字(白 vs L0.665 仅~3:1 不过 AA)加深到 ~4.8:1 */
  --action-deep: oklch(0.550 0.215 350);
  /* 信息域:蓝紫 = 信息 / 次级链接 / AI 来源 / focus 辅助 */
  --info:   oklch(0.680 0.170 270);
  --info-q: oklch(0.680 0.170 270 / 0.14);
  /* --hot(琥珀)只留「重点标记」:session 徽章 / ⭐ dup-3 金底 / kp-ribbon */
  --hot:       oklch(0.760 0.150 64);
  --ok:        oklch(0.745 0.120 160);
  --warn:      oklch(0.800 0.130 88);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* WCAG 2.4.7 全站焦点环:键盘聚焦(:focus-visible)统一画 2px info ring
   - 鼠标点击不触发 :focus-visible,不打扰桌面交互
   - 与 .row.sel(inset 左 border + action-q 背景)语义不同,可叠加共存:
     选中是「这条是当前激活」,outline 是「焦点也在这」
   - .inp / .numbox input 的 :focus 仍保留 border-color 变化作为视觉反馈;
     此规则在键盘聚焦时额外加 outline,鼠标聚焦时不加(下面用 :not(:focus-visible) 兜底) */
:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
  border-radius: inherit;
}

/* sr-only:visually-hidden 工具类。视觉上完全不存在,但 a11y tree 中保留,
   屏读能读到。用在 <label class="sr-only" for="X"> 关联仅有 placeholder 的 input。 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  font-family: var(--sans); background: var(--bg); color: var(--text);
  font-size: 13px; -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; overflow: hidden;
}
a { color: inherit; text-decoration: none; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- top bar ---- */
.topbar {
  height: 46px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: var(--rail); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand b { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand span { color: var(--text-muted-aa); font-size: 11px; }
.topbar .spacer { flex: 1; }
.session {
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; color: var(--hot);
  padding: 3px 9px; background: oklch(0.760 0.150 64 / 0.13); border-radius: 5px;
}
.session.quiet { color: var(--text-muted-aa); background: var(--panel); }
/* 全站账户世界指示:现实账户类型(DU*=paper / U*=live),live 用 loss 红醒目 */
.mode-pill { font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 5px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mode-pill.paper { color: var(--ok); background: oklch(0.745 0.120 160 / 0.14); }
.mode-pill.live { color: var(--loss); background: oklch(0.670 0.175 25 / 0.16); }
.mode-pill.unknown { color: var(--text-muted-aa); background: var(--panel); }
.mode-mismatch-banner { flex: none; padding: 7px 16px; font-size: 12px; font-weight: 600;
  color: oklch(0.985 0.002 0); background: var(--loss); text-align: center; }
.stat { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.stat .num { color: var(--text); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.dot.bad { background: var(--danger); }
.dot.warn { background: var(--warn); }
.divider { width: 1px; height: 18px; background: var(--line); }
.toggle {
  display: flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12px; color: var(--text-dim);
  background: none; border: none; padding: 0; cursor: pointer;
}
.toggle:hover { color: var(--text); }
.reconnect-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 5px;
  border-radius: 50%; background: oklch(0.685 0.165 28 / 0.18); color: var(--danger);
  font-size: 12px; line-height: 1; font-weight: 700;
}
.reconnect-link:hover { background: var(--danger); color: var(--bg); }
.reconnect-link.spin { background: var(--info-q); color: var(--info);
  animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.switch { width: 30px; height: 17px; border-radius: 9px; background: var(--action); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--text); transition: all .15s; }
.switch.off { background: var(--line); }
.switch.off::after { right: auto; left: 2px; background: var(--text-faint); }

/* ---- shell + rail ---- */
.shell { flex: 1; display: flex; min-height: 0; }
/* landmark-one-main 包装的 <main>:行为等同原 viewport flex 容器,不破坏布局 */
#main { flex: 1; display: flex; min-width: 0; min-height: 0; }
.rail {
  width: 186px; flex: none; background: var(--rail);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px;
}
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-muted-aa); padding: 8px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-radius: 6px; color: var(--text-dim); font-size: 13px;
}
.nav-item .ic { width: 15px; text-align: center; opacity: 0.85;
  /* 防止部分字符(☆ ⚙ ⚡)在 macOS/iOS 被 Apple Color Emoji 渲染成彩色 emoji */
  font-family: var(--mono); font-variant-emoji: text; }
.nav-item .badge {
  margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-muted-aa);
  background: var(--panel); padding: 1px 6px; border-radius: 999px;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--action-q); color: var(--text); }
.nav-item.active .ic { opacity: 1; }
/* Sprint 6.5 regfill:active 高亮态 badge 升主色,axe color-contrast 达 AAA */
.nav-item.active .badge { color: var(--text); }
.rail .grow { flex: 1; }
.who { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-top: 1px solid var(--line-soft); color: var(--text-dim); font-size: 12px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--action); color: var(--bg); display: grid; place-items: center; font-size: 11px; font-weight: 700; }

/* ---- viewport / main ---- */
.viewport { flex: 1; display: flex; min-width: 0; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.main.scroll { overflow-y: auto; }
.head { display: flex; align-items: baseline; gap: 12px; padding: 13px 18px 11px; }
.head h1 { font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
.head .count { color: var(--text-muted-aa); font-size: 12px; }
.head .spacer { flex: 1; }
.filter { font-size: 12px; color: var(--text-dim); padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; }
.filter.on { color: var(--text); border-color: var(--action); background: var(--action-q); }
.scroll-y { flex: 1; overflow-y: auto; }
.scroll-y::-webkit-scrollbar, .main.scroll::-webkit-scrollbar, .detail::-webkit-scrollbar { width: 9px; }
.scroll-y::-webkit-scrollbar-thumb, .main.scroll::-webkit-scrollbar-thumb, .detail::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 9px; border: 2px solid var(--bg);
}

/* ---- generic rows ---- */
.row { display: grid; align-items: center; gap: 10px; padding: 0 18px; height: 40px; border-bottom: 1px solid var(--line-soft); }
.row.head {
  height: 30px; position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line);
  font-size: 10px; letter-spacing: 0.06em; color: var(--text-muted-aa); font-weight: 600;
}
.row.click:hover { background: var(--panel); cursor: pointer; }
.r { text-align: right; }
.tk { font-family: var(--mono); font-weight: 650; letter-spacing: 0.02em; }
.muted { color: var(--text-muted-aa); }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.pill.ok    { color: var(--ok);     background: oklch(0.745 0.120 160 / 0.14); }
.pill.htb   { color: var(--action); background: var(--action-q2);
  box-shadow: inset 0 0 0 1px var(--action); }  /* HTB 强调:玫红域(操作/工具身份) */
.pill.unk   { color: var(--text-muted-aa); background: var(--panel-2); }

/* ---- workbench ---- */
.wb-row { grid-template-columns: 78px 96px 120px 76px 70px 1fr 56px 92px 52px; }
.gain { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; color: var(--profit); }
.gain.x { color: oklch(0.840 0.160 150); font-weight: 700; }  /* 极端涨幅:更亮更重的 profit 绿 */
.gain.flat { color: var(--text-muted-aa); }
.row.sel { background: var(--action-q); box-shadow: inset 2px 0 0 var(--action); }
.seg { font-size: 11px; color: var(--text-dim); }
.vd { font-size: 11px; font-weight: 600; }
.vd .vdot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.vd.hi { color: var(--danger); }    .vd.hi .vdot { background: var(--danger); }
.vd.ob { color: var(--warn); }      .vd.ob .vdot { background: var(--warn); }
.vd.ig { color: var(--text-muted-aa); }.vd.ig .vdot { background: var(--text-faint); }
/* 参考:shuangxi [CONTEXT] 无 enum 结论,中性蓝表示「有研究但无定论」,跟待分析(faint 灰)区分 */
.vd.ref { color: var(--info); }     .vd.ref .vdot { background: var(--info); }
.vd.pending { color: var(--text-muted-aa); }
.when { font-family: var(--mono); font-size: 11px; color: var(--text-muted-aa); text-align: right; }

.detail { width: 408px; flex: none; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.d-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--line-soft); }
.d-top { display: flex; align-items: center; gap: 10px; }
.d-top .tk { font-size: 22px; }
.d-top .co { color: var(--text-muted-aa); font-size: 12px; }
.d-top .co .src-tag { color: var(--info); background: var(--info-q);
  font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.d-top .spacer { flex: 1; }
.vbig { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.vbig.hi { color: var(--danger); background: oklch(0.685 0.165 28 / 0.15); }
.vbig.ob { color: var(--warn); background: oklch(0.800 0.130 88 / 0.15); }
.vbig.ig { color: var(--text-muted-aa); background: var(--panel-2); }
.vbig.pending { color: var(--text-muted-aa); background: var(--panel-2); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 14px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.metric { background: var(--panel); padding: 9px 11px; }
.metric .k { font-size: 10px; letter-spacing: 0.05em; color: var(--text-muted-aa); }
.metric .v { font-family: var(--mono); font-size: 15px; margin-top: 3px; }
.metric .v.hot { color: var(--profit); }  /* 最高涨幅数值 → 数值域绿(类名沿用) */
.sect { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.sect-k { font-size: 10px; font-weight: 700; letter-spacing: 0.09em; color: var(--text-muted-aa); margin-bottom: 9px; display: flex; gap: 8px; }
.sect-k .by { margin-left: auto; font-weight: 500; letter-spacing: 0; }
.raw { font-family: var(--mono); font-size: 11.5px; line-height: 1.85; color: var(--text-dim); word-break: break-all; }
.raw b { color: var(--text); font-weight: 500; }
.oneline { color: var(--text); line-height: 1.5; }
.kv { margin: 9px 0 2px; }
.kv .lbl { color: var(--text-muted-aa); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.kv p { color: var(--text-dim); line-height: 1.6; margin-top: 3px; white-space: pre-wrap; }
.empty-panel { padding: 30px 18px; color: var(--text-muted-aa); text-align: center; line-height: 1.7; }

/* ---- AI 分析面板(慢任务 + 高亮结论 + 分段)---- */
.ana { padding: 14px 18px 22px; }
.ana .sect-k { margin-bottom: 0; }

.ana-state { margin-top: 12px; padding: 16px; border-radius: 10px; text-align: center; line-height: 1.6; }
.ana-state.queued  { background: var(--panel-2); color: var(--text-dim); }
.ana-state.running { background: var(--info-q); color: var(--info); }
.ana-state.failed  { background: oklch(0.685 0.165 28 / 0.10); color: var(--danger); }
.ana-sub { font-size: 11px; color: var(--text-muted-aa); }
.ana-err { font-family: var(--mono); font-size: 11px; color: var(--text-muted-aa);
  margin: 9px 0; word-break: break-all; text-align: left; }
.ana-state form { margin-top: 6px; }

/* 大结论卡 —— 整个面板的视觉重心 */
.verdict-card { margin-top: 12px; padding: 14px 16px; border-radius: 11px; border: 1px solid; }
.verdict-card.hi { background: oklch(0.685 0.165 28 / 0.13); border-color: oklch(0.685 0.165 28 / 0.5); }
.verdict-card.ob { background: oklch(0.800 0.130 88 / 0.12); border-color: oklch(0.800 0.130 88 / 0.42); }
.verdict-card.ig,
.verdict-card.pending { background: var(--panel-2); border-color: var(--line); }
.verdict-card.ref { background: var(--info-q); border-color: oklch(0.680 0.170 270 / 0.42); }
.vc-verdict { font-size: 21px; font-weight: 750; letter-spacing: -0.01em; line-height: 1.1; }
.verdict-card.hi .vc-verdict { color: var(--danger); }
.verdict-card.ob .vc-verdict { color: var(--warn); }
.verdict-card.ref .vc-verdict { color: var(--info); }
.verdict-card.ig .vc-verdict,
.verdict-card.pending .vc-verdict { color: var(--text-dim); }
.vc-oneline { margin-top: 7px; color: var(--text); line-height: 1.55; font-size: 13.5px; }

.ana-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: 11px 1px 2px; font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.ana-meta .spacer { flex: 1; }

.ana-sect { margin-top: 14px; }
.ana-k { font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-faint); margin-bottom: 4px; }
.ana-sect p { color: var(--text-dim); line-height: 1.62; white-space: pre-wrap; }

/* 原文兜底折叠块(shuangxi [CONTEXT] / 本地分析全文) */
.ana-raw { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.ana-raw > summary { cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-faint); list-style: revert; }
.ana-raw > summary:hover { color: var(--text-dim); }
.ana-raw .raw-text { margin-top: 10px; padding: 12px 13px; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 9px; font-family: var(--mono);
  font-size: 11.5px; line-height: 1.6; color: var(--text-dim); white-space: pre-wrap;
  word-break: break-word; max-height: 460px; overflow-y: auto; }

.btn.mini { padding: 4px 10px; font-size: 11px; }
.inline-form { display: inline-flex; margin: 0; }
.ana-actions { display: flex; gap: 9px; margin-top: 11px; }
.ana-actions .inline-form { flex: 1; }
.ana-actions .btn { flex: 1; width: 100%; }
.ana-redo { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line-soft); }

/* AI 分析 tab(claude -p / shuangxi),每个 tab 自带 verdict chip
   —— 即便没切过去也能一眼看到两边结论 */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 8px; }
.tab { display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; font-size: 12.5px; font-weight: 600;
  color: var(--text-faint); border-bottom: 2px solid transparent;
  margin-bottom: -1px; }
.tab:hover { color: var(--text-dim); }
.tab.on { color: var(--text); border-bottom-color: var(--action); }
.tab .tab-label { white-space: nowrap; }
.tab .vd { font-weight: 600; }  /* verdict chip 在 tab 上略小但可读 */

/* shuangxi 自动扫描说明等的灰底提示行 */
.ana-hint { margin-top: 10px; padding: 8px 10px;
  background: var(--panel-2); border-radius: 6px;
  color: var(--text-faint); font-size: 11.5px; line-height: 1.5; }

/* ---- 工作台扫描工具栏(全市场扫 + 单股快照)---- */
.scan-bar {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; border-bottom: 1px solid var(--line-soft);
  background: var(--rail);
}
.scan-bar .spacer { flex: 1; }
.scan-bar .scan-meta { color: var(--text-faint); font-size: 11px; font-family: var(--mono); }
.scan-bar .scan-single { display: flex; align-items: center; gap: 6px; }
.scan-bar .scan-single .inp.tkin { width: 90px; }
.scan-bar .btn:disabled { opacity: 0.7; cursor: default; color: var(--info); }  /* 扫描中 = 运行状态(信息域) */

/* ---- F2:工作台多日分区(近 3 个有信号的交易日)+ ⭐ 重点 ---- */
.day-section { margin-bottom: 4px; }
.day-section .day-head {
  padding: 9px 18px 7px; margin-top: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted-aa);
  border-left: 4px solid var(--line);  /* 默认色条 —— D2 用 */
  background: var(--rail);
  position: sticky; top: 0; z-index: 2;
}
.day-section .day-head .num { color: var(--text); font-family: var(--mono); }
.day-section.d0 .day-head { border-left-color: var(--info); color: var(--text); }
.day-section.d1 .day-head { border-left-color: var(--warn); }
.day-section.d2 .day-head { border-left-color: var(--text-faint); }
/* 分区内的表头本身已是 .row.head sticky;让它叠在 day-head 下面而不互遮 */
.day-section .row.head { top: 28px; z-index: 1; background: var(--bg); }

/* ⭐ 重点行:近 N 个交易日均触发 —— 浅金底 + 左侧 4px 金 border */
.kp { margin-right: 4px; font-family: var(--sans); color: var(--warn); }
.row.dup-3 {
  background: oklch(0.760 0.150 64 / 0.10);
  box-shadow: inset 4px 0 0 var(--hot);
}
.row.dup-3:hover { background: oklch(0.760 0.150 64 / 0.16); }
.row.dup-3.sel { background: var(--action-q); box-shadow: inset 4px 0 0 var(--hot), inset 0 0 0 1px var(--action); }

/* 详情面板顶部 keypoint ribbon */
.kp-ribbon {
  margin: 0 0 10px; padding: 8px 12px;
  background: oklch(0.760 0.150 64 / 0.14);
  border: 1px solid oklch(0.760 0.150 64 / 0.4);
  border-radius: 8px; color: var(--text);
  font-size: 12px; line-height: 1.5;
  display: flex; align-items: center; gap: 8px;
}
.kp-ribbon .kp { font-size: 14px; }

/* ---- 聚合:代码次数角标 + 触发历史 timeline + 来源标识 ---- */
.cnt { margin-left: 5px; font-size: 10px; font-weight: 600; color: var(--action);
  background: var(--action-q); padding: 1px 5px; border-radius: 999px;
  font-family: var(--mono); }
.src { margin-left: 5px; font-size: 10px; font-weight: 600; padding: 1px 5px;
  border-radius: 4px; font-family: var(--sans); letter-spacing: 0.02em; }
.src.manual { color: var(--warn); background: oklch(0.800 0.130 88 / 0.16); }
.tl { margin-top: 2px; }
.tl-row { display: grid; grid-template-columns: 54px 58px 62px 50px 1fr;
  align-items: center; gap: 8px; padding: 6px 2px;
  border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.tl-row:last-child { border-bottom: none; }
.tl-row:hover { background: var(--panel-2); }
.tl-row.on { background: var(--action-q); box-shadow: inset 2px 0 0 var(--action); }
.tl-row .gain { font-size: 12px; }
.tl-t { font-family: var(--mono); color: var(--text-muted-aa); }
.tl-b { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 分析任务页 ---- */
.task-row { grid-template-columns: 84px 74px 64px 84px 1fr 56px 48px 60px; }
.task-row .tk:hover { color: var(--info); }
.task-row form { margin: 0; }
.st { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st.q  { color: var(--text-faint); background: var(--panel-2); }
.st.rn { color: var(--info); background: var(--info-q); }
.st.dn { color: var(--ok); background: oklch(0.745 0.120 160 / 0.14); }
.st.fl { color: var(--danger); background: oklch(0.685 0.165 28 / 0.14); }

/* ---- watchlist ---- */
.flip { margin: 4px 18px 8px; padding: 11px 14px; border-radius: 9px;
  background: oklch(0.745 0.120 160 / 0.12); border: 1px solid oklch(0.745 0.120 160 / 0.4);
  display: flex; align-items: center; gap: 11px; }
.flip .big { color: var(--ok); font-weight: 700; }
.flip .spacer { flex: 1; }
/* F1:/watch 列对齐工作台 — 10 cells(代码/涨幅/价/量/借券/AI/时段/触发/加入·剩余/×)*/
.wl-row { grid-template-columns: 70px 80px 64px 52px 60px 64px 44px 48px 1fr 36px; }
.wl-add { display: flex; gap: 9px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); align-items: center; background: var(--rail); }
.inp { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 6px 9px; font-size: 12px; font-family: var(--sans); }
/* 鼠标聚焦只换 border 颜色,不画 outline;键盘聚焦走全局 :focus-visible 规则 */
.inp:focus { border-color: var(--info); }
.inp:focus:not(:focus-visible) { outline: none; }
.inp.tkin { width: 110px; font-family: var(--mono); text-transform: uppercase; }
.inp.grow { flex: 1; }
.x { color: var(--text-faint); text-align: center; cursor: pointer; background: none; border: none; font-size: 13px; }
.x:hover { color: var(--danger); }

/* ---- positions ---- */
.strip { display: flex; gap: 1px; margin: 6px 18px 4px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 9px; overflow: hidden; }
.strip .cell { flex: 1; background: var(--panel); padding: 11px 14px; }
.strip .k { font-size: 10px; letter-spacing: 0.05em; color: var(--text-faint); }
.strip .v { font-family: var(--mono); font-size: 17px; margin-top: 4px; }
/* 多币种浮动盈亏:并列展示,过宽自动缩一档 */
.upnl-totals { font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 4px; }
.upnl-totals .sep { color: var(--text-faint); }
.v.profit, .pnl.profit { color: var(--profit); }
.v.loss, .pnl.loss { color: var(--loss); }
.subhead { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-muted-aa); padding: 16px 18px 7px; display: flex; align-items: baseline; gap: 10px; }
.subhead .spacer { flex: 1; }
.pos-row { grid-template-columns: 74px 44px 64px 72px 72px 100px 72px 72px 84px 92px 1fr; }
.trd-row { grid-template-columns: 74px 70px 78px 78px 130px 1fr; }

/* iter-uiv3:交易记录按 symbol 平铺分组(details/summary,server 决定默认 open)
   组头一行:symbol+状态tag ｜ 三胶囊 ｜ N 笔·最近成交 ｜ 净额(全历史口径) */
.trd-group { border-bottom: 1px solid var(--line-soft); }
.trd-ghead {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; cursor: pointer; background: var(--rail);
  list-style: none;
}
.trd-ghead::-webkit-details-marker { display: none; }
.trd-ghead::before { content: "▸"; font-size: 10px; color: var(--text-faint); flex: none; }
.trd-group[open] > .trd-ghead::before { content: "▾"; }
.trd-ghead:hover { background: var(--panel); }
.trd-ghead .tk { font-size: 13px; }
.gsub { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.gpill { font-size: 11px; color: var(--text-muted-aa); background: var(--panel-2);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.gpill .num { font-size: 11px; }
.gmeta { color: var(--text-muted-aa); font-size: 11px; font-family: var(--mono); white-space: nowrap; }
.gnet { margin-left: auto; display: flex; align-items: baseline; gap: 6px; flex: none; }
.gnet .num { font-weight: 750; letter-spacing: -0.01em; }
.gnet .num.profit { color: var(--profit); }
.gnet .num.loss { color: var(--loss); }
.gpill .num.profit { color: var(--profit); }
.gpill .num.loss { color: var(--loss); }
/* 防误读的关键标注:语义文本,对比度要过 AA(review 清单 4) */
.gscope { font-size: 10px; color: var(--text-muted-aa); border: 1px solid var(--line);
  padding: 0 5px; border-radius: 4px; white-space: nowrap; cursor: help; }
/* 组内表头不再 sticky(每组都有,叠起来会互遮) */
.trd-group .row.head.trd-row { position: static; }
.pnl { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.tag-form { display: flex; align-items: center; }
.tag-sel { font-size: 11px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim); max-width: 100%; }
.pill.pending { color: var(--text-muted-aa); background: var(--panel-2); }
.link { color: var(--info); font-size: 11px; }
.note-cell { color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir { font-size: 11px; font-weight: 700; }
.dir.s { color: var(--action); }  /* short = 玫红工具身份色 */
.dir.b { color: var(--profit); }
.timectl { display: flex; gap: 6px; }
.timectl a { font-size: 12px; color: var(--text-dim); padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; }
.timectl a.on { color: var(--text); border-color: var(--action); background: var(--action-q); }

/* ---- config ---- */
.cfg { max-width: 720px; padding: 6px 22px 30px; }
.cfg-group { margin-top: 20px; }
.cfg-group > .gk { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; color: var(--text); padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.cfg-row { display: grid; grid-template-columns: 188px 170px 1fr; align-items: center; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.cfg-row .rk { color: var(--text); }
.cfg-row .help { color: var(--text-muted-aa); font-size: 11.5px; line-height: 1.5; }
.numbox { display: flex; align-items: center; }
.numbox input { width: 90px; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 6px 0 0 6px; padding: 6px 9px; font-family: var(--mono); font-size: 13px; }
.numbox input:focus { border-color: var(--info); }
.numbox input:focus:not(:focus-visible) { outline: none; }
.numbox input:only-child { border-radius: 6px; }
.numbox .unit { background: var(--panel-2); border: 1px solid var(--line); border-left: none; border-radius: 0 6px 6px 0; padding: 6px 9px; color: var(--text-muted-aa); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px 2px 4px; }
.chip { font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); color: var(--text-faint); user-select: none; }
.chip.on { background: var(--action-q); border-color: var(--action); color: var(--text); }
.chip.on::before { content: "✓ "; color: var(--action); }
/* visually-hidden:不进视觉但留在 a11y tree 内,Tab 能聚焦、SR 能读
   (display:none 会让浏览器从 a11y tree 移除,Tab/SR 跳过 chip) */
.chip input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
  margin: 0;
}
.chip:has(input:checked) { background: var(--action-q); border-color: var(--action); color: var(--text); }
.chip:has(input:checked)::before { content: "✓ "; color: var(--action); }
/* 键盘聚焦时,外层 chip 接焦点环(input 本身 opacity:0,outline 不可见) */
.chip:has(input:focus-visible) {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

/* 配置页的开关(checkbox 驱动,无 JS) */
label.swbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
/* 与 .chip input 同理:visually-hidden 保留 Tab/SR 可达 */
label.swbox input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
  margin: 0;
}
label.swbox .switch { background: var(--line); }
label.swbox .switch::after { right: auto; left: 2px; background: var(--text-faint); }
label.swbox:has(input:checked) .switch { background: var(--action); }
label.swbox:has(input:checked) .switch::after { right: 2px; left: auto; background: var(--text); }
/* 键盘聚焦时焦点环画在视觉化的 switch 上(input 本身 opacity:0) */
label.swbox:has(input:focus-visible) .switch {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}
.savebar { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.savebar .spacer { flex: 1; }
.savebar .saved { color: var(--text-faint); font-size: 12px; }
.flash { margin: 10px 22px 0; padding: 8px 12px; border-radius: 7px; font-size: 12px; }
.flash.ok { color: var(--ok); background: oklch(0.745 0.120 160 / 0.12); }
.flash.err { color: var(--danger); background: oklch(0.685 0.165 28 / 0.12); }

/* ---- buttons ---- */
.btn { padding: 8px 14px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; text-align: center; border: none; font-family: var(--sans); }
.btn.primary { background: var(--action-deep); color: oklch(0.985 0.002 0); font-weight: 700; }
.btn.ghost { border: 1px solid var(--line); color: var(--text-dim); background: none; }
.actions { padding: 14px 18px; display: flex; gap: 9px; }
.actions .btn { flex: 1; }

/* ---- system status ---- */
.wrap { max-width: 880px; padding: 16px 24px 36px; }
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.pagehead h1 { font-size: 16px; font-weight: 620; letter-spacing: -0.01em; }
.pagehead .spacer { flex: 1; }
.health { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: var(--ok); background: oklch(0.745 0.120 160 / 0.14); }
.health.warn { color: var(--warn); background: oklch(0.800 0.130 88 / 0.14); }
.health.bad { color: var(--danger); background: oklch(0.685 0.165 28 / 0.14); }
.refreshed { color: var(--text-muted-aa); font-size: 12px; }
.grp { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.grp-head { display: flex; align-items: center; gap: 9px; padding: 9px 14px; background: var(--rail); border-bottom: 1px solid var(--line); }
.grp-head .gk { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; color: var(--text); }
.srow { display: grid; grid-template-columns: 16px 168px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.srow:last-child { border-bottom: none; }
.sdot { width: 8px; height: 8px; border-radius: 50%; }
.sdot.ok   { background: var(--ok);     box-shadow: 0 0 0 3px oklch(0.745 0.120 160 / 0.16); }
.sdot.warn { background: var(--warn);   box-shadow: 0 0 0 3px oklch(0.800 0.130 88 / 0.16); }
.sdot.bad  { background: var(--danger); box-shadow: 0 0 0 3px oklch(0.685 0.165 28 / 0.16); }
.skey { color: var(--text-dim); }
.sval { color: var(--text); }
.sval .em-ok { color: var(--ok); font-weight: 600; }
.sval .em-warn { color: var(--warn); font-weight: 600; }
.sval .em-bad { color: var(--danger); font-weight: 600; }
.smeta { color: var(--text-muted-aa); font-size: 12px; font-family: var(--mono); }
.mini { display: flex; gap: 18px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.mini .mk { font-size: 10px; letter-spacing: 0.05em; color: var(--text-faint); }
.mini .mv { font-family: var(--mono); font-size: 17px; margin-top: 3px; }
.log { padding: 6px 14px 10px; }
.logline { display: flex; gap: 10px; padding: 5px 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.logline .t { color: var(--text-faint); }
.logline .lv-warn { color: var(--warn); font-weight: 600; }
.logline .lv-err { color: var(--danger); font-weight: 600; }
.logline .lv-info { color: var(--text-faint); font-weight: 600; }
.logline .msg { color: var(--text-dim); }
.quiet { padding: 9px 14px; color: var(--text-faint); font-size: 12px; }

/* ---- IBKR 重新登录块 ---- */
.login-block { padding: 12px 14px; border-top: 1px solid var(--line-soft); background: var(--rail); }
.login-row { display: flex; align-items: center; gap: 10px; }
.login-row .spacer { flex: 1; }
.login-msg { color: var(--text-dim); font-size: 12.5px; line-height: 1.45; }
.login-meta { color: var(--text-muted-aa); font-size: 11px; margin-top: 6px;
  font-family: var(--mono); }
.login-err { color: var(--danger); font-size: 11.5px; margin-top: 6px;
  font-family: var(--mono); word-break: break-all; }
.login-badge {
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; letter-spacing: 0.02em;
}
.login-badge.running   { color: var(--info); background: var(--info-q);
  animation: pulse 1.2s ease-in-out infinite; }
.login-badge.done      { color: var(--ok); background: oklch(0.745 0.120 160 / 0.16); }
.login-badge.failed    { color: var(--danger); background: oklch(0.685 0.165 28 / 0.16); }
.login-badge.cancelled { color: var(--text-faint); background: var(--panel-2); }
.login-badge.idle      { color: var(--text); background: var(--panel-2); }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---- empty / footnote ---- */
.empty { padding: 50px 20px; text-align: center; color: var(--text-muted-aa); line-height: 1.8; }
.empty .big { font-size: 15px; color: var(--text-dim); }
.note { flex: none; padding: 7px 16px; font-size: 11px; color: var(--text-muted-aa); background: var(--rail); border-top: 1px solid var(--line); text-align: center; }

/* ---- login ---- */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.login-card { width: 320px; padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.login-card h1 { font-size: 16px; margin-bottom: 4px; }
.login-card p { color: var(--text-faint); font-size: 12px; margin-bottom: 18px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card .btn { width: 100%; }

/* 详情页返回链接 / 观察列表标记(默认桌面态) */
.back-link { display: none; }
.wl-tag { font-size: 11px; color: var(--ok); white-space: nowrap; }
.days-left { margin-left: 6px; font-size: 11px; color: var(--text-muted-aa);
  padding: 1px 5px; border-radius: 4px; background: oklch(0.300 0.020 250 / 0.4); }
.days-left.soon { color: var(--warn); background: oklch(0.800 0.130 88 / 0.16); font-weight: 600; }

/* ---- 顶部 nav progress bar(任何内部跳转都触发)---- */
.nav-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--action); transform-origin: left;
  transform: scaleX(0); opacity: 0;
  z-index: 1000; pointer-events: none;
  transition: transform 0.4s cubic-bezier(.2,.7,.3,1), opacity 0.2s linear;
}
.nav-progress.on  { opacity: 1; transform: scaleX(0.25); }
.nav-progress.almost { opacity: 1; transform: scaleX(0.85); }
.nav-progress.done { opacity: 0; transform: scaleX(1); transition: opacity 0.25s linear; }

/* ---- toast(?msg= 反馈)---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 14px; font-size: 13px;
  opacity: 0; pointer-events: none; z-index: 1001;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 6px 22px oklch(0 0 0 / 0.35);
  max-width: min(86vw, 480px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: oklch(0.745 0.120 160 / 0.5); }
.toast.err { border-color: oklch(0.685 0.165 28 / 0.5); color: var(--danger); }

/* 按钮 loading 态(JS 在 submit 时加上)*/
.btn.is-loading, button.is-loading { opacity: 0.75; cursor: default; }

/* ---- 底部 tab bar(仅 H5 显示)---- */
.tabbar { display: none; }

/* ---- H5 响应式:左 rail → 底部 tab bar;宽表格 → 卡片堆叠 ---- */
@media (max-width: 820px) {
  /* 左 rail 收起,改 fixed 底部 tab bar(6 入口,图标 + 短文字) */
  .rail { display: none; }
  .shell { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--rail); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px 6px; color: var(--text-muted-aa); font-size: 10px; line-height: 1;
  }
  .tab-item .ic { font-size: 16px; opacity: 0.9;
    font-family: var(--mono); font-variant-emoji: text; }
  .tab-item.active { color: var(--action); }
  .tab-item.active .ic { opacity: 1; }

  /* P0i-4:H5 顶栏精简 — Gateway/keepalive 仅 dot,今日信号仅 num,
     stat-label 文字全 hide;Gateway/keepalive bad 时 .alert 整条染红,
     手机用户看一眼就知系统是否健康 */
  .topbar { gap: 8px; padding: 0 8px; }
  .topbar .session, .topbar .divider { display: none; }
  .topbar .stat { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; }
  .topbar .stat-label { display: none; }
  .topbar.alert { background: var(--danger-q); }
  /* Sprint 3 dovetail:alert 红底 + .brand > span 的 --text-muted-aa 在
     danger-q 上对比度退到 4.37(差 0.13 AA 4.5);切主色 --text 保证 AA */
  .topbar.alert .brand > span { color: var(--text); }

  /* P1-8 iOS Safari <16px input 聚焦自动 zoom 整页防侵入视野 — 破移动 UX。
     codex r2 校:只把移动端 form controls 升 16px,不全站 body(信息密度退化)*/
  .inp, .numbox input, textarea.inp, input[type="text"], input[type="password"],
  input[type="number"], select {
    font-size: 16px;
  }

  /* P1-9 触摸目标 ≥ 44pt(WCAG 2.5.5)— H5 强制 hit area 44px;字号 / padding 内
     保持原样,只把 min-height/width 提到 44 不影响视觉(填充透明区) */
  .btn.mini, .filter, .chip, .tab-item, .x, .timectl a, .tabs .tab {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* 两个 ✕(watchlist 删除 vs 翻转卡收起)位置 / 父容器已不同,色形通过
     aria-label + title 文案差异化已足够(P0a-4 完成);此处只确保触摸面 */

  /* tabbar 7→5+1 抽屉:5 个核心入口可见 + "更多" 收纳「规则 / 系统」 */
  .tab-more-input { /* visually-hidden,通过 label 触发 :checked */
    position: absolute; width: 1px; height: 1px; opacity: 0;
    pointer-events: none; clip-path: inset(50%); margin: 0;
  }
  .tab-more-input:checked ~ .tabbar-drawer { display: flex; }
  .tabbar-drawer {
    display: none;
    position: absolute; left: 0; right: 0;
    bottom: 100%;  /* 弹在 tabbar 上方 */
    background: var(--rail); border-top: 1px solid var(--line);
    flex-direction: row;
    padding-bottom: 0;
    z-index: 51;
  }
  .tabbar-drawer .tab-item { flex: 1; }
  .tab-item.tab-more { cursor: pointer; user-select: none; }

  /* 页头:允许换行,中文标题不再逐字竖排,筛选器组换到独立一行 */
  .head, .pagehead { flex-wrap: wrap; }
  .head h1, .pagehead h1 { white-space: nowrap; flex: none; }
  /* count 副标题(口径/来源说明,常含链接)整行换行显示,不再 nowrap 溢出截断 */
  .head .count { white-space: normal; flex: 1 1 100%; line-height: 1.5; }
  .head .spacer, .pagehead .spacer { flex-basis: 100%; height: 0; }
  .timectl { flex-wrap: wrap; }

  /* strip 指标条:2×2 换行 —— 4 格挤一行时每格 ~90px,金额/拆分数值折成
     三行不可读(positions 区间来源拆分实证);2×2 后每格 ~half 宽度自然容纳 */
  .strip { flex-wrap: wrap; }
  .strip .cell { flex: 1 1 42%; min-width: 42%; }

  /* topbar 推送开关文案单行,防「推送开」折成两行挤高顶栏 */
  .topbar .toggle { white-space: nowrap; }

  /* 工作台:列表与详情变成两个「页」,靠 URL 的 sel 切换 */
  .viewport .main { display: flex; }
  .viewport .detail { display: none; }
  .viewport.show-detail .main { display: none; }
  .viewport.show-detail .detail { display: block; width: 100%; border-left: none; }
  .back-link { display: inline-block; margin-bottom: 10px;
    color: var(--info); font-size: 13px; }

  /* 信号列表行精简:只留 代码 / 涨幅 / 借券 / AI 分级 */
  .wb-row { grid-template-columns: 1fr 76px 62px 88px; }
  .wb-row > :nth-child(3), .wb-row > :nth-child(4), .wb-row > :nth-child(5),
  .wb-row > :nth-child(7), .wb-row > :nth-child(9) { display: none; }

  /* 分析任务行精简:留 代码/状态/分级/一句话 */
  .task-row { grid-template-columns: 78px 68px 84px 1fr; }
  .task-row > :nth-child(3), .task-row > :nth-child(6),
  .task-row > :nth-child(7), .task-row > :nth-child(8) { display: none; }

  /* 配置:单列 */
  .cfg-row { grid-template-columns: 1fr; gap: 5px; }
  .cfg { padding: 6px 14px 30px; }

  /* 观察列表添加表单:单列,按钮整宽 */
  .wl-add { flex-direction: column; align-items: stretch; }
  .wl-add .inp, .wl-add .inp.tkin { width: 100%; }
  .wl-add .btn { width: 100%; white-space: nowrap; }

  /* ---- 宽表格卡片化:每条记录一张卡,隐藏表头 ---- */
  .row.head.wl-row, .row.head.pos-row, .row.head.trd-row { display: none; }

  .wl-row, .pos-row, .trd-row {
    display: grid; height: auto; gap: 6px 10px;
    padding: 12px 14px; margin: 8px 12px;
    background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px;
  }

  /* F1:观察列表卡(H5)10 cells 重排成 3 grid-area 行
     行 1:代码(2列) / AI 分级 / 借券 / ×
     行 2:涨幅 价 量 时段 触发  ─ 5 指标横排
     行 3:加入时间 + 剩余天数(满宽)
     reason 不再渲染独立单元格(已退到 row title 提示气泡) */
  .wl-row {
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
    grid-template-areas:
      "sym sym vd brw del"
      "gn pr vol seg cnt"
      "added added added added added";
    column-gap: 8px;
  }
  .wl-row > :nth-child(1) { grid-area: sym; font-size: 14px; }
  .wl-row > :nth-child(2) { grid-area: gn; }
  .wl-row > :nth-child(3) { grid-area: pr; text-align: left; }
  .wl-row > :nth-child(4) { grid-area: vol; text-align: left; }
  .wl-row > :nth-child(5) { grid-area: brw; }
  .wl-row > :nth-child(6) { grid-area: vd; }
  .wl-row > :nth-child(7) { grid-area: seg; }
  .wl-row > :nth-child(8) { grid-area: cnt; text-align: left; }
  .wl-row > :nth-child(9) { grid-area: added; font-size: 11px; }
  .wl-row > :nth-child(10) { grid-area: del; }

  /* 持仓卡(11 列):代码+方向+盈亏 一行;数量/均价/现价 与 费率/日费/累计
     两排 label-value;策略一行;备注一行 */
  .pos-row { grid-template-columns: repeat(3, 1fr); }
  .pos-row > :nth-child(1) { grid-area: 1 / 1; font-size: 14px; }
  .pos-row > :nth-child(2) { grid-area: 1 / 2; }
  .pos-row > :nth-child(6) { grid-area: 1 / 3; }
  .pos-row > :nth-child(3) { grid-area: 2 / 1; }
  .pos-row > :nth-child(4) { grid-area: 2 / 2; }
  .pos-row > :nth-child(5) { grid-area: 2 / 3; }
  .pos-row > :nth-child(7) { grid-area: 3 / 1; }
  .pos-row > :nth-child(8) { grid-area: 3 / 2; }
  .pos-row > :nth-child(9) { grid-area: 3 / 3; }
  .pos-row > :nth-child(10) { grid-area: 4 / 1 / 4 / -1; }
  .pos-row > :nth-child(11) { grid-area: 5 / 1 / 5 / -1; white-space: normal; }
  .pos-row > :nth-child(n+3):nth-child(-n+5),
  .pos-row > :nth-child(n+7):nth-child(-n+9) {
    display: flex; flex-direction: column; gap: 2px; text-align: left;
  }
  .pos-row > :nth-child(3)::before { content: "数量"; }
  .pos-row > :nth-child(4)::before { content: "均价"; }
  .pos-row > :nth-child(5)::before { content: "现价"; }
  .pos-row > :nth-child(7)::before { content: "做空费率"; }
  .pos-row > :nth-child(8)::before { content: "日费"; }
  .pos-row > :nth-child(9)::before { content: "累计借出费"; }
  .pos-row > :nth-child(n+3):nth-child(-n+5)::before,
  .pos-row > :nth-child(n+7):nth-child(-n+9)::before {
    font-size: 10px; letter-spacing: 0.05em; color: var(--text-faint);
  }

  /* 交易卡:代码 + 方向 + 时间 一行;数量/价格 label-value;备注表单一行 */
  .trd-row { grid-template-columns: repeat(3, 1fr); }
  .trd-row > :nth-child(1) { grid-area: 1 / 1; font-size: 14px; }
  .trd-row > :nth-child(2) { grid-area: 1 / 2; }
  .trd-row > :nth-child(5) { grid-area: 1 / 3; text-align: right; }
  .trd-row > :nth-child(3) { grid-area: 2 / 1; }
  .trd-row > :nth-child(4) { grid-area: 2 / 2; }
  .trd-row > form { grid-area: 3 / 1 / 3 / -1; }
  .trd-row > :nth-child(3), .trd-row > :nth-child(4) {
    display: flex; flex-direction: column; gap: 2px; text-align: left;
  }
  .trd-row > :nth-child(3)::before { content: "数量"; }
  .trd-row > :nth-child(4)::before { content: "价格"; }
  .trd-row > :nth-child(3)::before, .trd-row > :nth-child(4)::before {
    font-size: 10px; letter-spacing: 0.05em; color: var(--text-faint);
  }

  /* iter-uiv3 H5:组头卡片化两行 — 行1 symbol+状态+净额;行2 三胶囊+笔数时间 */
  .subhead { flex-wrap: wrap; row-gap: 6px; }
  .trd-group { border-bottom: none; margin: 8px 12px; }
  .trd-ghead {
    flex-wrap: wrap; row-gap: 8px; padding: 12px 14px;
    background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px;
  }
  .trd-group[open] > .trd-ghead { border-radius: 10px 10px 0 0; }
  .trd-ghead .gsub { flex-basis: 100%; order: 9; }
  /* 净额+口径徽章竖排靠右,防止行 1 超出卡片右缘 */
  .trd-ghead .gnet { flex-direction: column; align-items: flex-end; gap: 2px; }
  /* 组内明细卡嵌在 details 内,横向 margin 已由 .trd-group 提供 */
  .trd-group .trd-row { margin: 8px 0; }

  /* 系统状态行:点 + 键一行,值、附注各自换行不被挤压 */
  .srow { grid-template-columns: 18px 1fr; height: auto; gap: 4px 10px; }
  .srow > :nth-child(3), .srow > :nth-child(4) { grid-column: 1 / -1; }

  /* 工作台扫描工具栏 H5:挤不下时单股表单换行 */
  .scan-bar { flex-wrap: wrap; row-gap: 8px; padding: 8px 14px; }
  .scan-bar .scan-meta { display: none; }
  .scan-bar .scan-single { width: 100%; }
  .scan-bar .scan-single .inp.tkin { flex: 1; width: auto; }

  /* IBKR 重新登录块:H5 改竖排,按钮不被挤到逐字换行 */
  .login-row { flex-wrap: wrap; row-gap: 8px; }
  .login-row .login-badge { flex: none; white-space: nowrap; }
  .login-row .login-msg { flex-basis: 100%; order: 9; }
  .login-row .spacer { display: none; }
  .login-row > form { margin-left: auto; flex: none; }
  .login-row > form .btn { white-space: nowrap; }
}

/* prefers-reduced-motion(Sprint 3-D / review P1-6):前庭敏感 / 晕动症用户禁动效。
   spin / pulse 都是装饰性 loading,静止状态(.spin → .ok 色)依然能传达"正在跑"。
   nav-progress 是顶部进度条,reduced-motion 下不滑动,仍出现/消失只是无过渡动画。 */
@media (prefers-reduced-motion: reduce) {
  .reconnect-link.spin { animation: none; }
  .login-badge.running { animation: none; }
  .nav-progress { transition: none; }
  /* 全局兜底:任何加了 animation 的元素都禁(防新加的元素漏)*/
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- 可排序列头(Sprint 6 / P1-11)---- */
.sort-th a { color: inherit; text-decoration: none; }
.sort-th a:hover { color: var(--text); }
.sort-th.sort-active a { color: var(--text); font-weight: 700; }
.sort-arrow { font-size: 9px; color: var(--action); margin-left: 2px; }

/* ---- SSR markdown(Sprint 5 / P1-10)---- */
/* reuse OKLCH 设计语言;account.html AI 日报 + _detail.html shuangxi raw_text 共用 */
.markdown { color: var(--text); line-height: 1.6; font-size: 13px; }
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  margin: 14px 0 8px; font-weight: 650; letter-spacing: -0.01em; color: var(--text);
}
.markdown h1 { font-size: 17px; }
.markdown h2 { font-size: 15px; }
.markdown h3 { font-size: 14px; }
.markdown h4 { font-size: 13px; color: var(--text-dim); }
.markdown p { margin: 8px 0; color: var(--text-dim); }
.markdown strong { color: var(--text); font-weight: 650; }
.markdown em { color: var(--text-dim); }
.markdown ul, .markdown ol { margin: 8px 0; padding-left: 22px; color: var(--text-dim); }
.markdown li { margin: 3px 0; }
.markdown a { color: var(--info); text-decoration: underline; text-underline-offset: 2px; }
.markdown a:hover { color: var(--text); }
.markdown code {
  font-family: var(--mono); font-size: 12px;
  background: var(--panel-2); padding: 1px 5px; border-radius: 4px; color: var(--text);
}
.markdown pre {
  margin: 10px 0; padding: 11px 13px;
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 8px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: var(--text-dim); overflow-x: auto;
}
.markdown pre code { background: none; padding: 0; color: inherit; }
.markdown blockquote {
  margin: 9px 0; padding: 4px 11px;
  border-left: 3px solid var(--line); color: var(--text-muted-aa);
}
.markdown table {
  border-collapse: collapse; margin: 10px 0; font-size: 12px; background: var(--panel-2);
}
.markdown th, .markdown td {
  border: 1px solid var(--line-soft); padding: 5px 9px; text-align: left;
}
.markdown th {
  background: var(--rail); color: var(--text); font-weight: 650; letter-spacing: 0.02em;
}
.markdown td { color: var(--text-dim); }
.markdown hr { margin: 14px 0; border: none; border-top: 1px solid var(--line-soft); }

/* ---- F3:卖空累计盈亏 + 单股最终盈亏(代理算法)---- */
/* 双线区分:.short-panel 与上方 .strip 视觉强分离,提示"代理算法,与现状切片不同口径" */
.short-panel {
  border: 2px solid oklch(0.685 0.165 28 / 0.4);
  box-shadow: inset 0 0 0 1px var(--bg);
}
.short-panel .cell { background: oklch(0.224 0.012 256 / 0.85); }
.short-panel .v.net-hi { font-weight: 750; font-size: 19px; letter-spacing: -0.01em; }

/* 叙事段:贴在 short-panel 下方,SSR 写指标 */
.narrative { margin: 8px 18px 4px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 8px;
  color: var(--text-dim); font-size: 12.5px; line-height: 1.7; }
.narrative .narr-line { margin: 2px 0; }
.narrative b { color: var(--text); }

/* 单股最终盈亏:当前持仓表(7 列)+ 历史平仓表(4 列),桌面 + H5 重排 */
.held-pnl-row   { grid-template-columns: 76px 52px 1fr 1fr 1fr 1fr 1fr; }
.closed-pnl-row { grid-template-columns: 84px 1fr 1fr 1fr; }
.held-pnl-row .pnl.net-hi,
.closed-pnl-row .pnl.net-hi { font-weight: 750; letter-spacing: -0.01em; }
.dir-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
  white-space: nowrap; display: inline-block; }
.dir-short { color: var(--action); background: var(--action-q); }
.dir-long  { color: var(--profit); background: oklch(0.760 0.140 150 / 0.13); }
.dir-flat  { color: var(--text-muted-aa); background: var(--panel-2); }
.dir-unk   { color: var(--text-faint); background: var(--panel-2); }

/* 净额单独色 —— 复用 .profit / .loss 颜色,只是字号加粗(.net-hi 已用) */

/* 代理算法注脚 —— 强提示用户 UI 的边界 */
.proxy-note { margin: 16px 18px 22px; padding: 12px 14px;
  background: oklch(0.262 0.013 256 / 0.6); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--warn); border-radius: 8px;
  color: var(--text-muted-aa); font-size: 12px; line-height: 1.7; }
.proxy-note b { color: var(--text); }
.proxy-note code { font-family: var(--mono); background: var(--bg);
  padding: 1px 5px; border-radius: 4px; color: var(--text); font-size: 11.5px; }

/* H5:single-row 表 → 卡片堆叠(沿用 positions / trades 卡片化思路) */
@media (max-width: 820px) {
  .row.head.held-pnl-row, .row.head.closed-pnl-row { display: none; }
  .held-pnl-row, .closed-pnl-row {
    display: grid; grid-template-columns: 1fr 1fr;
    height: auto; padding: 12px 14px; margin: 8px 12px; gap: 6px 10px;
    background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px;
  }
  /* 当前持仓卡片:代码|方向 顶行;已实现/浮动/买回/借出费/净额 双列流式 */
  .held-pnl-row > :nth-child(1) { font-size: 14px; }
  .held-pnl-row > :nth-child(2) { justify-self: end; }
  .held-pnl-row > :nth-child(n+3) {
    display: flex; flex-direction: column; gap: 2px; text-align: left;
  }
  .held-pnl-row > :nth-child(3)::before { content: "已实现"; }
  .held-pnl-row > :nth-child(4)::before { content: "浮动"; }
  .held-pnl-row > :nth-child(5)::before { content: "买回所需"; }
  .held-pnl-row > :nth-child(6)::before { content: "借出费"; }
  .held-pnl-row > :nth-child(7)::before { content: "净额"; }
  .held-pnl-row > :nth-child(n+3)::before {
    font-size: 10px; letter-spacing: 0.05em; color: var(--text-faint);
  }
  /* 历史平仓卡片:代码 占满顶行;已实现/借出费/净额 双列流式 */
  .closed-pnl-row > :nth-child(1) { grid-column: 1 / -1; font-size: 14px; }
  .closed-pnl-row > :nth-child(n+2) {
    display: flex; flex-direction: column; gap: 2px; text-align: left;
  }
  .closed-pnl-row > :nth-child(2)::before { content: "已实现"; }
  .closed-pnl-row > :nth-child(3)::before { content: "借出费"; }
  .closed-pnl-row > :nth-child(4)::before { content: "净额"; }
  .closed-pnl-row > :nth-child(n+2)::before {
    font-size: 10px; letter-spacing: 0.05em; color: var(--text-faint);
  }
}

.report-card{background:var(--panel);border:1px solid rgba(255,255,255,.06);border-radius:10px;padding:14px 16px;margin:8px 18px}
.report-summary{font-size:16px;font-weight:600;margin-bottom:8px}
.report-body{white-space:pre-wrap;word-break:break-word;font-family:inherit;font-size:13px;line-height:1.6;margin:0}

/* ============ 技术快照(iter-technical-snapshot)============ */
/* 语义提示行:hot=风险红(对空头是警示) warn=信息蓝 ok=绿 mute=弱化。
   数值域色仅作文本色,不做按钮/交互态(遵守 :root 数值域纪律)。 */
.tech-sem { font-size: 13px; font-weight: 600; margin-bottom: 9px;
            display: flex; align-items: baseline; gap: 8px; }
.tech-sem .by { font-size: 11px; font-weight: 500; color: var(--text-muted-aa); }
.tech-sem.hot  { color: var(--loss); }
.tech-sem.warn { color: var(--info); }
.tech-sem.ok   { color: var(--profit); }
.tech-sem.mute { color: var(--text-muted-aa); }
.tech-note { font-size: 11px; color: var(--text-muted-aa); margin-top: 8px; }

/* ============ 账户周报/月报(iter-account-period-reports)============ */
.pr-layout { display: flex; gap: 14px; align-items: flex-start; }
.pr-list { flex: 0 0 300px; display: flex; flex-direction: column; gap: 4px; }
.pr-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
          border: 1px solid var(--line-soft); border-radius: 8px; font-size: 13px; }
.pr-row.on { border-color: var(--action); background: var(--action-q); }
.pr-link { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
           text-decoration: none; color: var(--text); }
.pr-key { font-weight: 700; font-variant-numeric: tabular-nums; }
.pr-st.done { color: var(--profit); } .pr-st.run { color: var(--text-muted-aa); }
.pr-st.fail { color: var(--loss); }
.pr-ck { color: var(--profit); font-weight: 700; }
.pr-sum { color: var(--text-dim); font-size: 12px; overflow: hidden;
          text-overflow: ellipsis; white-space: nowrap; }
.pr-detail { flex: 1; min-width: 0; }
.pr-actions { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.pr-actions .confirm-form { display: flex; gap: 8px; flex: 1; }
.pr-actions textarea { flex: 1; background: var(--panel-2);
                       border: 1px solid var(--line); border-radius: 8px;
                       color: var(--text); padding: 8px; font-size: 13px; }
.pr-facts pre { font-size: 11px; color: var(--text-dim); overflow-x: auto; }
@media (max-width: 960px) {
  .pr-layout { flex-direction: column; }
  .pr-list { flex: 1; width: 100%; }
  /* H5:detail_mode 才显示详情(同工作台 master-detail 既有模式;
     若 base 已有通用 .detail-mode 切换则复用,没有就保持上下堆叠即可) */
}

/* ws-realtime:实时 PnL 状态条 + 行情角标 + 详情强刷小按钮 */
.rt-pnl { padding: 4px 16px; font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--line); }
.rt-pnl .num.gain { color: var(--profit); }
.rt-pnl .num.loss { color: var(--loss); }
.q-ts { margin-left: 4px; font-size: 10px; color: var(--text-dim); }
/* 列表价格列/涨幅列的角标:独立一行小字挂主数字下方,不再挤换行 */
.wb-row .num[data-live-price] .q-ts,
.wb-row .gain .q-ts { display: block; margin-left: 0; line-height: 1.25; text-align: right; font-weight: 400; }
.tech-rf { display: inline; margin-left: 6px; }
.btn.sm { padding: 0 6px; font-size: 11px; line-height: 18px; }

/* codex 对抗审查 #2:已实现窗口不全标记 */
.fp-warn { margin-left: 3px; font-size: 10px; cursor: help; }

/* smd-live:SSE 跳动高亮 / 停更灰显 / 断线提示 */
.live-flash { background-color: var(--action-q); transition: background-color .35s ease-out; border-radius: 3px; }
.live-stale { opacity: .55; }
.rt-pnl.live-off::after { content: " · 实时断开"; color: var(--loss); }
.metric-gap { display: block; margin-left: 0; line-height: 1.3; font-weight: 400; }

/* 分时 spark:列表微缩图 + 详情大图 + 时段 tab */
.spark { display: flex; align-items: center; justify-content: flex-end; min-height: 32px; }
.spark svg { display: block; }
.spark-sect { padding: 10px 16px 4px; }
.spark-lg { min-height: 180px; }
.spark-lg svg { display: block; width: 100%; height: 180px; }
.spark-tabs { margin-left: 10px; display: inline-flex; gap: 4px; }
.spark-tab { font-size: 11px; padding: 1px 8px; border-radius: 5px; border: 1px solid var(--line);
  background: transparent; color: var(--text-dim); cursor: pointer; }
.spark-tab.on { color: var(--text); border-color: var(--action); }
.spark-tip { position: absolute; display: none; pointer-events: none; z-index: 5;
  font-size: 11px; font-family: var(--mono); white-space: nowrap;
  padding: 3px 8px; border-radius: 6px; background: oklch(0.22 0.01 260 / 0.95);
  border: 1px solid var(--line); color: var(--text); }
/* 拉取期间骨架:脉冲条复用全局 @keyframes pulse;成功/失败回调由 spark.js 移除 */
.spark.is-loading, .spark-lg.is-loading {
  background: oklch(0.5 0.02 250 / 0.10); border-radius: 6px;
  animation: pulse 1.2s ease-in-out infinite; }
/* 空数据/失败:消除静默留白,写明「无分时数据」 */
.spark.spark-empty, .spark-lg.spark-empty {
  font-size: 11px; color: var(--text-faint); justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .spark.is-loading, .spark-lg.is-loading { animation: none; }
}
