@import url("tokens.css"); /* 语义色 token 唯一来源（涨跌/中性/警示/品牌一律 var()，见 tokens.css） */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* 裸 <a> 兜底：全站从来没有全局链接色，凡没被具名规则盖到的锚点（每日研判指标表的「美元指数 ↗」等）全部吃浏览器默认 #0000EE —— 亮色白底 8.6:1 勉强可读
   所以长期没暴露，暗底 #181b1f 只有 1.71:1（基本看不见）。特异性 (0,0,1)，任何类规则都能压过，
   等于只补洞不改既有样式；顺带把 :visited 的紫底也一并接管。 */
a { color: var(--accent-ink); }

/* ── theme variables ────────────────────────────────────── */
/* 结构性 tokens（底色/文字/描边）；涨跌等语义色见 tokens.css */
/* 调色板（2026-09 偷脸，ADR-0003 后首次换肤）：暗色 = Grafana themes（分层骨架 +
 * 白透明描边 + Linear 四档文字阶梯）；亮色 = Stripe Dashboard 光谱（冷蓝白底 + 蓝灰文字）。
 * 涨跌 TradingView 对保持不动。来源：grafana themes.md / open-design Linear tokens / stripe docs。 */
:root {
  --bg: #f6f9fc; --surface: #fff; --surface-hover: #eef3f8;
  --surface-alt: #f0f4f9; --border: #e6ebf1; --border-light: #edf1f6;
  --text: #1a2b42; --text-secondary: #425466; --text-dim: #5c6d84;
  --accent-light: #e8f0fe; /* --accent 由 --color-brand 派生，见 tokens.css 的 :root, body.dark 段 */
  /* accent 作正文色时的可读档：#1a73e8 在白卡 4.51/页面底 4.26/accent-light 底 3.93/16% brand 徽章底 4.38，
   * 后三处不达 AA；#155ecb 同色相再压深一档 → 白卡 6.01 / 页面底 5.69 / accent-light 底 5.24 /
   * 徽章底 4.87 全过（上一档 #1665d8 在徽章底上差 0.12，不够）。
   * 边框/焦点环/实底仍用 --accent（非文本，无需 4.5:1）。 */
  --accent-ink: #155ecb;
  --btn-border: #d9e2ec;
}
body.dark {
  --bg: #111217; --surface: #181b1f; --surface-hover: #22252b;
  /* 亮暗四层背景纵深（timsun）：页面 bg → 卡片 surface → elevated 浮层（alt，弹层/表头）
     → tooltip 再经 --tooltip-bg 半透明化；hover 保持交互反馈层不参与高度序列 */
  --surface-alt: #22252b; --border: rgba(204,204,220,.2); --border-light: rgba(204,204,220,.12);
  /* Linear 四档文字阶梯（f7f8f8 → d0d6e0 → 8a8f98 → 62666d，dim 即 tertiary 档） */
  --text: #f7f8f8; --text-secondary: #d0d6e0; --text-dim: #8a8f98;
  --accent-light: #1f2a3d;
  /* 暗色文字档不别名回图形档：#58a6ff 对比虽过 AA（卡面 6.84 / 页面底 7.40 / accent-light 底 5.71），
     但它是 HSL(212,100%,67%) 的满饱和蓝，短波长纯蓝在暗底小字号下边缘发颤。同色相提到
     #a5d3ff（GitHub / GitLab 暗色链接同款，卡面 10.99 / 页面底 11.90 / accent-light 底 9.17）。
     图形档 --accent 仍 = #58a6ff（填充 / 边框 / 图表线不参与文字可读性）。 */
  --accent-ink: #a5d3ff;
  --btn-border: rgba(204,204,220,.2);
}

/* hover 透明叠加统一层(Grafana:不换色相);边框强档;亮色卡片阴影分层(Open Props shadow-1 量级) */
:root { --hover-tint: rgba(11, 26, 47, .05); --border-strong: #c8d4e0; --card-shadow: 0 1px 2px rgba(16,35,61,.05), 0 1px 6px rgba(16,35,61,.04); }
body.dark { --hover-tint: rgba(204, 204, 220, .08); --border-strong: rgba(204, 204, 220, .32); --card-shadow: none; --shadow-float: 0 2px 10px rgba(0,0,0,.5); }
/* 浮层阴影着色（亮=与蓝灰底同调，暗=纯黑加深）：不用通用 rgba(0,0,0,.12) */
:root { --shadow-float: 0 1px 3px rgba(16,35,61,.10), 0 4px 12px rgba(16,35,61,.08); }
/* 弹层阴影（tooltip / 钻取面板）：比浮层按钮重一档，同样跟背景着色 */
:root { --shadow-pop: 0 4px 16px rgba(16,35,61,.14), 0 1px 3px rgba(16,35,61,.10); }
body.dark { --shadow-pop: 0 4px 16px rgba(0,0,0,.6); }

/* 全站基准（专题页与 SPA 共用）：
 * - 锚点平滑滚动（special.css 的 scroll-padding-top 才真正用得上）
 * - 全局 focus-visible 焦点环：导航链接/标的行/Tab/胶囊等所有可交互元素统一可见；
 *   只响应键盘焦点，不影响鼠标点击
 * - prefers-reduced-motion 全局关闭动效
 * - .skip-link 跳过导航：平时隐藏在视口外，Tab 聚焦时滑入左上角 */
html { scroll-behavior: smooth; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: var(--z-float);
  padding: 8px 14px; border-radius: 6px; background: var(--accent); color: var(--text-on-accent);
  font-size: 13px; text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* ── tab bar ────────────────────────────────────────────── */
.tab-bar {
  height: 40px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: stretch; padding: 0 8px; flex-shrink: 0; gap: 2px;
}
.tab-btn {
  padding: 0 16px; border: none; background: none; cursor: pointer;
  font-size: 13px; color: var(--text-secondary); border-bottom: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s, transform .1s; display: flex; align-items: center;
}
.tab-btn:hover { color: var(--accent-ink); background: var(--surface-hover); }
.tab-btn:active { transform: translateY(1px); }
.tab-btn.active { color: var(--accent-ink); font-weight: 600; border-bottom-color: var(--accent-ink); }

/* ── layout ─────────────────────────────────────────────── */
.app { display: flex; flex: 1; min-height: 0; margin-left: 240px; }
@media (max-width: 1024px) { .app { margin-left: 0; } }
.sidebar { width: 140px; background: var(--surface); border-right: 1px solid var(--border); display: none; flex-direction: column; flex-shrink: 0; }
.center { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; gap: 8px; overflow-y: auto; }
.status-bar { height: 28px; background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; font-size: 12px; color: var(--text-secondary); gap: 16px; flex-shrink: 0; margin-left: 240px; }
@media (max-width: 1024px) { .status-bar { margin-left: 0; } }
.status-bar #status-refresh { margin-left: auto; }
/* 免责声明：SPA 唯一的免责行（专题页在页脚，SPA 没有页脚）。比状态栏正文再弱一档，
   不抢右侧刷新时间的视线；窄屏跟着 status-bar 横向滑动。 */
.status-bar .status-legal { color: var(--text-dim); }
/* 状态栏窄屏：span 禁折行（28px 高度容不下两行，实测 402 下四项全部拦腰断词：
 * 关/联、2026-10-/10）；藏视图名（与顶部 Tab 冗余）+ 字号收一档后 402 恰好单行，
 * 更窄（320）放不下时横向滑动兕底（隐藏滚动条，触屏可滑）。 */
@media (max-width: 600px) {
  .status-bar { font-size: 11px; gap: 10px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
  .status-bar span { white-space: nowrap; }
  .status-bar #status-symbol { display: none; }
}

/* ── view switching ─────────────────────────────────────── */
.tech-view, .dashboard-view, .correlation-view { display: none; }
[data-view="dashboard"] .dashboard-view { display: flex; }
[data-view="tech"] .tech-view { display: flex; }
[data-view="tech"] .sidebar { display: flex; }
.sidebar-collapse-btn { width: 14px; background: var(--surface); border: none; border-right: 1px solid var(--border); cursor: pointer; color: var(--text-dim); font-size: 10px; display: none; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; }
[data-view="tech"] .sidebar-collapse-btn { display: flex; }
.sidebar-collapse-btn:hover { background: var(--surface-hover); color: var(--accent-ink); }
.app.sidebar-hidden .sidebar { display: none; }
[data-view="correlation"] .correlation-view { display: flex; min-height: 0; }

/* ── KPI 卡行单源（R.cards 的产物；从 special.css 搬来：SPA 只加载 app.css，
   仪表盘波动率 hero 要用同一套卡就必须放这份两边都加载的文件里。
   专题页加载顺序 app.css → special.css，特殊覆盖仍写在 special.css 后面即可。 */
/* KPI 卡行单源（页面只选档，不写内联 grid-template-columns）：
 * 用 flex 而非 grid：grid 的 auto-fit 列数按轨道上限算，封顶 275px 会把 6 卡行压成 3 列；
 * flex 的「先平分增长、到 275px 停」正好是想要的形状：≥4 卡行铺满整行，2-3 卡行左对齐留白
 * （与 /liquidity/reserves/ 同一处理），卡片宽度全站收敛到 ≤275px = .re-root 4 列档。
 * 两档：默认 basis 130（数字卡）/ .re-cards-wide basis 250（带长文本、百分位条或内嵌框的卡）。 */
.re-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.re-cards > .re-card { flex: 1 1 130px; min-width: 0; max-width: 275px; }
.re-cards-wide > .re-card { flex-basis: 250px; }
.re-card { padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; container-type: inline-size; }
/* 流式字号：视口变窄字体同步收缩（斜率标在注释里），≥1100px 恢复满档 */
.re-corridor-label { font-size: clamp(10px, 9.5px + 0.2vw, 11px); text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
/* 卡片值是卡内字号，随卡片宽度收缩（12cqi = 卡片内容宽的 12%）：269px 卡 22px 满档，
 * 手机上两列 155px 卡 ~15px；个别更长的值（日期区间、路径串）由 R.cards 的 fit 再缩一档。 */
.re-corridor-value { font-size: clamp(12px, 12cqi, 22px); font-weight: 700; margin-top: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* sub 行可能含语义 chip（R.chgSpan / chgSub）：容器不透明度会把 chip 自身色一起压淡，
   降一档交给 color token，chip 保持满档 */
.re-card-sub { font-size: clamp(10px, 9.5px + 0.2vw, 11px); color: var(--text-dim); margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 长文本卡：value / sub 换行不截断（默认 nowrap + ellipsis 是给纯数字卡的） */
.re-card-wrap .re-corridor-value, .re-card-wrap .re-card-sub {
  white-space: normal; overflow: visible; text-overflow: clip;
}
/* 密集卡（带百分位条等附加内容）：比标准卡更紧一档 */
.re-card-dense { padding: 12px 14px; }
.re-card-dense .re-corridor-value { font-size: 17px; margin: 2px 0; }
/* ≤768 收两列：calc(50%-6px) 与 12px gap 正好一行两卡（border-box 下含 padding 精确铺满，
 * flex-grow 补齐余量），避免「4 平铺 → 直接 1 列」的硬跳（#33：中间宽度段信息密度过低、
 * 竖向翻页变长）；≤480 手机再收单列。三档：>768 单行多卡 / 481-768 两列 / ≤480 单列铺满。
 * 同时收 padding（流式字号只管字体，盒子密度这里补） */
@media (max-width: 768px) {
  .re-cards > .re-card { flex-basis: calc(50% - 6px); max-width: none; }
  .re-card { padding: 12px 14px; }
}
@media (max-width: 480px) {
  .re-cards > .re-card { flex-basis: 100%; }
}
/* 双列窄档（.re-cards-2col）：短卡（label + 数值 + 短 sub）在手机上单列太空——
 * 402 单列一张卡 370px 宽只装三行字；压两列后单卡 ~179px 仍容得下（实测）。
 * 只给声明了本类的卡行生效，必须跟在上方全局 ≤480 单列规则之后（同优先级靠源序取胜）；
 * 长 sub 卡（ellipsis 会截字）不要用这个旋钮。 */
@media (max-width: 480px) {
  .re-cards-2col > .re-card { flex-basis: calc(50% - 6px); }
}
.re-card-accent { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.re-card-accent .re-corridor-label { color: var(--text-secondary); }

/* 键值行网格单源（R.kvRows 的产物）：「一项一个数」的段用它，不写 2-4 列键值表。
 * 为什么不用表：表被拉到卡片全宽（1118px）时，两列表的数值列甩到最右、中间一大片空白；
 * 也不用 R.cards：卡片在 ≤768 强制单列，一张 ~117px，7 项就 800px+，比表格还长。
 * 这里 grid auto-fit 宽屏自动铺 3-4 列（铺满不留白），窄屏 min(100%,260px) 退回单列，
 * 每行只有 ~28px。行内复用 .diag-row 的「名称 ←→ 读数」两端对齐，不另造一套行样式。 */
.re-kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); column-gap: 28px; }
.re-kv-grid .kv-v { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; }
/* 列间分隔线：一列的读数与右邻列的名称只隔 28px 间隙，三列并排时会读成一行
 * （「5.99%  HY 有效收益率」粘连）。线画在 gap 正中（column-gap 28 → 左移 14），
 * 上下各收 2px 不压住首末行的视觉边界。由 R.kvRows 标 .kv-cont（非每列首行）。 */
.re-kv-grid .diag-row { position: relative; }
.re-kv-grid .diag-row.kv-cont::before {
  content: ''; position: absolute; left: -14px; top: 2px; bottom: 2px;
  width: 1px; background: var(--border-light);
}
/* 口径注跟在名称后：11px 弱色，与名称同一条左线（数字那侧永远只有一条右线）。
 * .diag-label 是 flex 两端对齐的左项，宽度不够时让注换行到第二行 ——
 * 省略号会吃掉判断依据本身（「10Y 分位 95%」被截成「10…」），而读数永远只占右端一条线，
 * 左项多占一行不影响读数对齐。min-width: 0 保留：它允许 flex 收缩，否则长名称把读数挤出卡外。
 * 注用 inline-block 整体换行：允许拆行的话，「NY Fed / Equifax · 10Y」会在中间的「10Y」后
 * 断开，第二行只剩「分位 95%」，读者无法把分位与它的数归位。 */
.re-kv-grid .diag-label { min-width: 0; }
.re-kv-grid .diag-label em { display: inline-block; font-style: normal; font-size: 11px; font-weight: 400; color: var(--text-dim); }
/* 窄屏一行只有 245px，注会把名称挤成三行 → 收掉，口径由段底注脚兜底。 */
@media (max-width: 768px) { .re-kv-grid .diag-label em { display: none; } }
/* 段内注脚（R.secNote）：口径/读法说明一律沉到卡片底部，不作卡片首段正文 ——
 * 首段 <p> 与下面的数据只差 8px 间距、1px 字号，读起来像列表的第一项。 */
.re-sec-note { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border-light); font-size: 12px; line-height: 1.65; color: var(--text-dim); }
/* 长口径折叠（R.secNote 的 fold）：summary 就是原来那行注脚，三角提示可展开；
 * 展开后正文同字号同字色，位置仍在本卡底部（不弹层）。
 * padding 2px 把点击行拉到 24px（WCAG 2.5.8），不动正文节奏。 */
.re-sec-note > summary { cursor: pointer; user-select: none; padding: 2px 0; }
.re-sec-note[open] > summary { color: var(--text-secondary); margin-bottom: 4px; }
/* 折叠正文逐行排版（pre-line）：备注里带换行的条目（成员判据列表）不能挤成一陀 */
.re-sec-note > div { white-space: pre-line; }

/* ── dashboard ────────────────────────────────────────────── */
.dashboard-view {
  display: none; flex-direction: column; gap: 12px;
  overflow-y: auto; max-height: calc(100dvh - 80px); padding: 4px;
}
.dash-stat {
  background: var(--surface); border-radius: 8px; border: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s;
}
.dash-stat:hover { border-color: var(--accent-ink); box-shadow: 0 1px 4px color-mix(in srgb, var(--color-brand) 10%, transparent); }
.dash-stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--text); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dash-stat-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; }
.dash-stat-desc  { font-size: 12px; color: var(--text-dim); }
.dash-stat-change { font-size: 12px; margin-top: 4px; }

/* ── dash-*：仅关联分析状态卡（.dash-stat*）存活，其余随 ADR-0005 仪表盘视图删除清零 ── */

/* ── sidebar ────────────────────────────────────────────── */
.sidebar-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 0; scrollbar-width: none; }
.sidebar-content::-webkit-scrollbar { display: none; }
.symbol-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; cursor: pointer; transition: background .15s; font-size: 14px; }
.symbol-item:hover { background: var(--surface-hover); }
.symbol-item.active { background: var(--accent-light); color: var(--accent-ink); font-weight: 600; }

/* ── controls ───────────────────────────────────────────── */
.controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.controls label { font-size: 12px; display: flex; align-items: center; gap: 3px; cursor: pointer; padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); transition: background .15s; user-select: none; }
.controls label:hover { background: var(--hover-tint); }
.controls input[type="checkbox"] { accent-color: var(--accent-ink); }

/* ── range controls (tech view) ────────────────────────── */
.range-controls { display: flex; gap: 4px; margin-left: auto; }
/* 范围/预设按钮全站单类 .range-btn；预设条/叙事对按钮不折行不收缩 */
.correlation-presets .range-btn, .narr-pairs .range-btn { white-space: nowrap; flex: 0 0 auto; }
.range-btn {
  padding: 4px 10px; border: 1px solid var(--btn-border); border-radius: 4px;
  background: var(--surface); font-size: 12px; cursor: pointer; color: var(--text-secondary);
}
/* 偷脸质感(Grafana):hover 统一透明叠加不换色相;focus-visible 焦点环;弹性过渡曲线 */
.range-btn:hover { background: var(--hover-tint); border-color: var(--border-strong); }
.range-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.range-btn.active { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
/* 按下反馈（物理感）：全站主要按钮类共用这一交互语言 */
.range-btn:active, .controls label:active, .ai-btn:active, .ai-send:active { transform: translateY(1px) scale(.985); }
/* 按钮类过渡单源（含 transform，供下方 :active 按下反馈生效）：新增按钮类往这里加 */
.range-btn, .controls label, .ai-btn, .ai-send {
  transition: background .15s cubic-bezier(.4,0,.2,1), border-color .15s, box-shadow .15s, color .15s, transform .1s;
}

/* ── chart containers ───────────────────────────────────── */
/* NOTE: .chart-card 故意无 padding —— SPA 技术视图 K 线三卡（lightweight-charts）与
   关联分析热力图 canvas 直接 init 在卡上，createChart/echarts 按 clientWidth（含 padding）
   取宽，这里加 padding 会让画布右侧溢出 2×padding。全幅贴边是交易图惯例，已知代价：
   K 线时间轴标签被左卡边微裁、热力图行标签 8px 贴边（已在 grid.left=16 缓解）。
   以后要给留白：垫内层 div 再 init（参照 rates-common.js mkChart 的 .re-chart-pad 做法）。 */
.chart-card { background: var(--surface); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--card-shadow); }
/* Linear 内高光：暗色卡片 1px 边缘受光，亮色无感（rgba 白在浅底不可见） */
body.dark .chart-card { box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
/* tech charts: distribute remaining vertical space 5:3:3 */
.tech-view .chart-card { display: flex; flex-direction: column; }
.tech-view .chart-card:has(#main-chart)   { flex: 5; }
.tech-view .chart-card:has(#rsi-chart)    { flex: 3; }
.tech-view .chart-card:has(#macd-chart)   { flex: 3; }
#main-chart   { width: 100%; height: 100%; min-height: 200px; }
#rsi-chart    { width: 100%; height: 100%; min-height: 100px; }
#macd-chart   { width: 100%; height: 100%; min-height: 100px; }

/* ── diagnosis panel ────────────────────────────────────── */
.panel { width: 320px; background: var(--surface); border-left: 1px solid var(--border); flex-shrink: 0; padding: 16px; transition: width .3s ease; overflow-y: auto; overflow-x: hidden; position: relative; display: none; }
[data-view="tech"] .panel { display: block; }
.panel.collapsed { width: 36px; padding: 16px 8px; overflow-y: hidden; }
.panel-header { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; overflow: hidden; }
.panel-header .toggle-icon { font-size: 14px; color: var(--text-dim); transition: transform .3s; display: inline-block; }
.panel.collapsed .toggle-icon { transform: rotate(180deg); }
.panel.collapsed .panel-header { border-bottom: none; margin-bottom: 0; writing-mode: vertical-rl; text-orientation: mixed; font-size: 13px; padding-bottom: 0; display: flex; align-items: center; gap: 6px; }
.panel.collapsed #diag-content { display: none; }
.diag-section { margin-bottom: 16px; }
.diag-section h4 { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.score-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.score-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.score-text { font-size: 24px; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.diag-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.diag-label { color: var(--text-secondary); }
.diag-value { font-weight: 500; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.up { color: var(--color-up-text); }
.down { color: var(--color-down-text); }
.neutral { color: var(--text-secondary); }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; line-height: 18px; margin: 2px; }
.tag-bull { background: var(--color-up-bg); color: var(--color-up-text); }
.tag-bear { background: var(--color-down-bg); color: var(--color-down-text); }
.cdl-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ── loading ────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-dim); font-size: 14px; }

/* ── 骨架屏（CSS-only shimmer）：数据到位前的占位扫光。挂载/摘除由 JS 集成点负责——
   专题页走 rates-common.js 的 R.mkChart（建图挂载、首次 setOption 后摘除），
   SPA 仪表盘加载占位（.loading）同挂。定义放 app.css 而非 special.css：SPA 不加载
   special.css，单一定义两侧覆盖。扫光色由 --text-dim 派生，亮暗主题自动适配。 */
.skeleton { position: relative; }
.skeleton::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 30%,
    color-mix(in srgb, var(--text-dim) 16%, transparent) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* ── 全局左侧导航（timsun 风格）── */
.macro-nav {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; z-index: var(--z-nav);
}
.macro-nav-brand { padding: 16px 16px 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.macro-nav-brand-name { font-size: 16px; font-weight: 700; letter-spacing: .08em; color: var(--text); }
.macro-nav-brand-sub { font-size: 10px; color: var(--text-dim); letter-spacing: .12em; margin-top: 2px; }
.macro-nav-caption {
  padding: 10px 16px 4px; font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .16em;
}
.macro-nav-sep { margin: 10px 16px 2px; border-top: 1px solid var(--border); }
.macro-nav-item {
  display: block; padding: 6px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; text-decoration: none;
  position: relative; transition: background .12s, color .12s;
  user-select: none;
}
.macro-nav-item:hover { background: var(--surface-hover); color: var(--text); }
.macro-nav-item.active {
  background: var(--accent-light); color: var(--accent-ink);
}
.macro-nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent);
}
.macro-nav-item.child { padding-left: 32px; font-size: 12px; }
.macro-nav-item.child.sub { padding-left: 46px; font-size: 11px; color: var(--text-dim); }
.macro-nav-group-head { display: flex; align-items: stretch; }
.macro-nav-group-head > .macro-nav-item { flex: 1; }
.macro-nav-toggle {
  border: none; background: none; color: var(--text-dim); cursor: pointer;
  padding: 0 14px 0 6px; font-size: 14px; line-height: 1;
  transition: transform .15s, color .12s;
}
.macro-nav-toggle:hover { color: var(--text); }
.macro-nav-group.open .macro-nav-toggle { transform: rotate(90deg); }
.macro-nav-sub { display: none; }
.macro-nav-group.open .macro-nav-sub { display: block; }
.macro-nav-foot {
  margin-top: auto; padding: 10px 16px; font-size: 10px; color: var(--text-dim);
  display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border);
}
.macro-nav-foot-row { display: flex; justify-content: space-between; }
.macro-nav-foot-note { line-height: 1.5; }
#macro-nav-toggle, .macro-nav-backdrop { display: none; } /* 仅窄屏显示 */
/* 专题页（TopicLayout）也挂同一棵左侧树：桌面常驻→正文让位 240px（.re-root 仍是
   margin:auto 居中，在剩下的宽度里居中）；窄屏整棵移出视口，由 TopicLayout 渲染的
   #macro-nav-toggle（☰）唤出抽屉 —— 与 SPA 同一套机制，专题页顶栏胶囊 Tab 已删
   （同屏两套导航是重复，窄屏下还会撑成 2-4 排胶囊压住 .page-toc）；
   被外部页内嵌时树与 ☰ 都不出现（没树可唤）。 */
@media (min-width: 1025px) {
  body.re-has-side { padding-left: 240px; }
}
body.embedded.re-has-side { padding-left: 0; }
body.embedded .macro-nav, body.embedded #macro-nav-toggle { display: none; }
@media (max-width: 1024px) {
  .macro-nav {
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,.15);
    padding-top: 40px; /* 避开左上角 ☰ 按钮 */
  }
  body.side-open .macro-nav { transform: none; }
  #macro-nav-toggle {
    display: flex; position: fixed; top: 8px; left: 8px; z-index: var(--z-nav-toggle);
    align-items: center; justify-content: center; width: 30px; height: 30px;
    border: 1px solid var(--btn-border); border-radius: 6px;
    background: var(--surface); color: var(--text-secondary); cursor: pointer;
    font-size: 14px;
  }
  /* ☰ 是 fixed 到视口左上角（底边 38px），SPA 主区没让位 → 窄屏下正好压在「市场仪表盘」
     页头与六板块卡标题上。给 .center 加 padding-top 而不是给 .dashboard-view：
     后者自己滚动，内容会从按钮下面滚过去；让位到滚动容器外才在任何滚动位置都不遮。 */
  .center { padding-top: 46px; }
  body.side-open .macro-nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: var(--z-backdrop);
    background: rgba(0,0,0,.35);
  }
}
/* 手机档浮钮同步收一档（30→26，≥24 触控下限）：special.css 窄屏页留白收缩后，
   ☰ 30px 底边 38 压住专题页 .re-back 首行；放 app.css（☰ 单源在这）让 SPA 与
   专题页按钮同尺寸，.center 让位同步 46→40（按钮 bottom 32 + 8 呼吸）。 */
@media (max-width: 768px) {
  #macro-nav-toggle { top: 6px; left: 6px; width: 26px; height: 26px; font-size: 12px; }
  .center { padding-top: 40px; }
}

/* ── correlation view（关联分析面板：双模式）────── */
.correlation-controls { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.correlation-custom { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex: 1; }
.correlation-select { padding: 4px 8px; border: 1px solid var(--btn-border); border-radius: 4px; font-size: 12px; background: var(--surface); min-width: 120px; color: var(--text); }
.correlation-indicator-chip { display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 12px; border: 1px solid var(--btn-border); background: var(--surface-alt); }
.correlation-chip-remove { cursor: pointer; color: var(--text-dim); font-size: 14px; line-height: 1; }
.correlation-chip-remove:hover { color: var(--chart-pink-text); }
.correlation-add-btn { padding: 4px 8px; border: 1px dashed var(--btn-border); border-radius: 4px; background: var(--surface); font-size: 12px; cursor: pointer; color: var(--text-secondary); }
.correlation-add-btn:hover { background: var(--surface-hover); border-color: var(--accent-ink); color: var(--accent-ink); }
#correlation-chart { flex: 1; min-height: 400px; position: relative; }

/* 面板骨架（资产相关模式：结构层 + 数据层 + 洞察层） */
/* 工具栏单排：预设组占满剩余宽度，溢出横向滚动不折行 */
.corr-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 40px 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: nowrap; }
@media (max-width: 1024px) { .corr-toolbar { padding-right: 12px; } }
.correlation-presets { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: thin; }
.corr-mode-title { font-size: 12px; color: var(--text-dim); }
.corr-asset-wrap { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; overflow-y: auto; min-height: 0; }
.corr-status-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.corr-status-card { padding: 12px; cursor: pointer; }
.corr-status-card .dash-stat-value { font-size: 22px; }
@media (max-width: 1024px) { .corr-status-row { grid-template-columns: repeat(2, 1fr); } }
.corr-main { display: grid; grid-template-columns: 5fr 4fr; gap: 10px; min-height: 560px; flex: 1; }
/* 堆叠规则必须在 .corr-main 基础规则之后：同特异性靠源码顺序取胜（曾放在前面
 * 被基线 5fr/4fr 盖回，手机上双栏从未堆叠过，矩阵被压到 190px 宽）；
 * 热力图方形：高度改由 aspect-ratio 跟宽度走（1/1.15 的余量 = 顶部旋转标签带
 * + 底部图例 - 左侧轴名），否则固定 min-height 460 把 22 行拉成竖条。 */
@media (max-width: 1024px) {
  /* 堆叠后退出 flex 分配（flex:0 0 auto = 内容高度）：.corr-main 原是 flex:1（basis 0）
   * 子项，被 flex 压成确定高度后 grid 会把两行对半劈（275/275），面板 overflow:hidden
   * 裁掉矩阵下半段且滚动容器看不到溢出（实测两个坑：滚动条消失 + 矩阵截断）。
   * 内容高度回归后由外层 .corr-asset-wrap 自然滚动；min-height 560 仍作下限。 */
  .corr-main { display: grid; grid-template-columns: 1fr; flex: 0 0 auto; }
  /* 面板头同款 CJK 压缩问题：标题被长副标挤到竖排（跨资产/相关性/矩阵 三行），
   * 同 Section 组件的解法 —— 标题原子化 + head 可换行，放不下副标整体掉行 */
  .corr-pane-head { flex-wrap: wrap; row-gap: 2px; }
  .corr-pane-title { white-space: nowrap; }
}
.corr-matrix-pane, .corr-side-pane { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.corr-pane-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px 6px; border-bottom: 1px solid var(--border-light); gap: 8px; }
.corr-pane-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.corr-pane-sub { font-size: 11px; color: var(--text-dim); }
.corr-heatmap { flex: 1; min-height: 460px; }
/* 热力图方形：堆叠后高度改由 aspect-ratio 跟宽度走（1/1.15 的余量 = 顶部旋转标签带
 * + 底部图例 - 左侧轴名），否则固定 min-height 460 把 22 行拉成竖条。
 * 必须在基础规则之后：同特异性靠源码顺序取胜（corr-main 的堆叠规则曾栽在同一个坑）。 */
@media (max-width: 1024px) { .corr-heatmap { flex: 0 0 auto; min-height: 0; height: auto; aspect-ratio: 1 / 1.15; } }
.corr-group-legend { display: flex; gap: 12px; padding: 6px 14px 2px; font-size: 11px; color: var(--text-secondary); flex-wrap: wrap; }
.corr-group-item i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.corr-side-pane { overflow-y: auto; }
#corr-insights { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.corr-insight-card { border: 1px solid var(--border-light); border-radius: 6px; padding: 8px 10px; background: var(--surface-alt); }
.corr-insight-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 2px; }
.corr-insight-val i { font-style: normal; font-size: 10px; }
.corr-insight-title { font-size: 12px; font-weight: 600; }
.corr-insight-text { font-size: 11px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.corr-spark { margin-top: 10px; }
.corr-spark-cap { font-size: 10px; color: var(--text-dim); margin-top: 6px; }
.corr-drill-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: var(--z-overlay); display: flex; align-items: center; justify-content: center; }
.corr-drill-panel { width: min(880px, 92vw); max-height: 86vh; overflow-y: auto; padding-bottom: 10px; }
.corr-drill-charts { display: flex; gap: 12px; padding: 8px 14px; flex-direction: column; }
.corr-drill-note { font-size: 11px; color: var(--text-dim); padding: 4px 14px; }
.corr-drill-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--text-dim); line-height: 1; }
.corr-drill-close:hover { color: var(--chart-pink-text); }
.corr-macro-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* 宏观联动重设计：复用资产模式卡片骨架的配套样式 */
.corr-macro-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 14px 0; }
.corr-macro-chart { flex: 1; min-height: 360px; }
.corr-pane-foot { font-size: 11px; color: var(--text-dim); padding: 6px 14px 10px; border-top: 1px solid var(--border-light); }

/* 宏观联动右栏：规则引擎叙事（当前状态 + 三段解读） */
.corr-macro-narr { padding: 12px 14px; flex: 1; }
.narr-now { padding: 2px 0 12px; border-bottom: 1px solid var(--border-light); margin-bottom: 12px; }
.narr-big { font-size: 26px; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); }
.narr-big.up { color: var(--color-up-text); }
.narr-big.down { color: var(--color-down-text); }
.narr-arrow { font-style: normal; font-size: 14px; color: var(--text-dim); margin-left: 4px; }
.narr-tag { padding: 2px 8px; border-radius: 4px; font-size: 12px; margin-left: 8px; font-family: -apple-system, sans-serif; font-weight: 400; vertical-align: middle; }
.narr-tag.up { background: var(--color-up-bg); color: var(--color-up-text); }
.narr-tag.down { background: var(--color-down-bg); color: var(--color-down-text); }
.narr-tag.neutral { background: var(--color-neutral-bg); color: var(--text-secondary); }
.narr-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.narr-pairs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.narr-block { margin-bottom: 14px; }
.narr-block b { font-size: 13px; color: var(--text); }
.narr-block p { font-size: 12px; color: var(--text-secondary); line-height: 1.7; margin: 4px 0 0; }

/* ── tech info bar & subview (overview / kline) ────────── */
.tech-top-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 40px 6px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; flex-shrink: 0; flex-wrap: wrap;
}
@media (max-width: 1024px) { .tech-top-bar { padding-right: 12px; } }
.tech-sym-select {
  padding: 4px 8px; border: 1px solid var(--btn-border); border-radius: 4px;
  font-size: 12px; font-weight: 600; background: var(--surface); color: var(--text);
  font-family: var(--font-mono); cursor: pointer;
}
.tech-sym-select:hover { border-color: var(--border-strong); background: var(--hover-tint); }
/* 原生 select 的固有宽度按最长选项撑开（池里最长 SKHYNIX 7 字），实测 118px 里约 30px
   是空白；窄屏收到 96px 仍能完整显示最长代码且箭头不裁，省下的宽度留给报价。 */
@media (max-width: 600px) { .tech-sym-select { max-width: 96px; } }
.tech-info-bar {
  display: flex; align-items: baseline; gap: 16px;
  /* min-width 兼作折行开关：装不下时整条掉下一行并撑满（窄屏曾被压成斜条，
     内容没处换行只逐字堆高）；装得下就与左侧控件同排。 */
  flex: 1 1 400px; min-width: min(100%, 400px);
  /* space-between 而不是给 OHLC 写 margin-left:auto：一行时报价靠左、OHLC 贴右；
     OHLC 单独掉到第二行时 space-between 把它放到行首 → 自动全条左对齐，无需断点。 */
  justify-content: space-between;
  font-size: 13px; font-family: -apple-system, sans-serif;
}
.tech-quote { display: flex; align-items: baseline; gap: inherit; flex-wrap: wrap; }
.tech-price { font-size: 18px; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tech-change { font-size: 13px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tech-change.up { color: var(--color-up-text); }
.tech-change.down { color: var(--color-down-text); }
.tech-ohlc { color: var(--text-dim); font-size: 12px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* K 线周期：只读方胶囊（本页 K 线/指标/评分全部日线口径，见 /api/kline 默认 interval=1d）。
   标的名不在本行重复（左侧下拉框已有），胶囊直接作行首标签。 */
.tech-tf {
  flex: none; white-space: nowrap;
  font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 4px;
  border: 1px solid var(--border); color: var(--text-dim);
  font-family: -apple-system, sans-serif;
}

.tech-kline-pane {
  display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0;
}
/* K 线按需加载的过渡提示：只占一行，数据到达即隐藏 */
.tech-kline-loading { padding: 6px 12px; font-size: 12px; color: var(--text-dim); }
.tech-ov-pane {
  display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; overflow-y: auto;
}
#tech-ov-current {
  display: flex; flex-direction: column; gap: 12px;
}
.tech-ov-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px 20px; box-shadow: var(--card-shadow);
  display: flex; flex-direction: column; gap: 14px;
}
body.dark .tech-ov-card { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 60%, transparent); }
.tech-ov-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.tech-ov-title-wrap {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.tech-ov-sym { font-size: 20px; font-weight: 700; color: var(--text); }
.tech-ov-price { font-size: 20px; font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); }
.tech-ov-date { font-size: 12px; color: var(--text-dim); font-weight: 400; }
.tech-ov-tag-neutral { background: var(--color-neutral-bg); color: var(--color-neutral-text); }
.tech-ov-tag-setup { background: var(--color-brand-bg); color: var(--accent-ink); }
.tech-ov-tag-warn { background: var(--color-warn-bg); color: var(--color-warn-text); }

.tech-ov-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px 20px; padding: 10px 0 4px; border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light);
}
.tech-ov-summary-item {
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  padding-left: 12px;
}
.tech-ov-summary-label {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--accent-ink); margin-bottom: 4px;
}
.tech-ov-summary-text {
  margin: 0; font-size: 13px; line-height: 1.65; color: var(--text-secondary);
}

.tech-ov-dim-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px 24px; padding-top: 4px;
}
.tech-ov-dim-col {
  border-top: 1px solid var(--border-light); padding-top: 8px;
}
.tech-ov-dim-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px;
}

.tech-ov-scan-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.tech-ov-scan-title { font-size: 14px; font-weight: 700; color: var(--text); }
/* 结论变化卡：评分轨迹 + 状态变化带。两个 grid 共用一个 time 轴（tech-view.js 的 histOption），
   高度按 grid 布局实测定：30+118 评分 + 168~180 变化带 + 底部日期标签。 */
.tech-ov-hist-title { font-size: 16px; font-weight: 700; color: var(--text); }
.tech-ov-hist-chart { height: 210px; }
.tech-ov-hist-tip-hd { font-weight: 600; margin-bottom: 4px; }
.tech-ov-hist-tip-row { display: flex; justify-content: space-between; gap: 18px; }
.tech-ov-hist-tip-row b { font-weight: 600; }
/* 扫描表综合分下的窗口变化小字（不加列） */
.tech-ov-delta { display: block; font-size: 11px; line-height: 14px; color: var(--text-dim); }
.tech-ov-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.tech-ov-table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.tech-ov-table {
  width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums;
}
.tech-ov-table th {
  background: var(--surface-alt); padding: 8px 10px; text-align: left;
  font-size: 12px; color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tech-ov-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--border-light);
  color: var(--text); white-space: nowrap;
}
.tech-ov-table th.num, .tech-ov-table td.num { text-align: right; font-family: var(--font-mono); }
.tech-ov-table td.up { color: var(--color-up-text); }
.tech-ov-table td.down { color: var(--color-down-text); }
.tech-ov-row { cursor: pointer; transition: background .12s; }
.tech-ov-row:hover td { background: var(--surface-hover); }
.tech-ov-row.active td { background: var(--accent-light); }
.tech-ov-type { font-size: 11px; color: var(--text-dim); margin-left: 4px; }
.tech-ov-tri { font-size: 12px; color: var(--text-secondary); }
.tech-ov-kbtn { padding: 2px 8px; font-size: 11px; }
@media (max-width: 768px) {
  .tech-ov-card { padding: 12px 14px; }
  .tech-ov-table { font-size: 12px; }
  /* 11 列在窄屏必然横滑（实测 390 视口：内容 914px / 容器 336px）：首列标的冻结，
     否则滑到右侧就不知道在看哪只。sticky 层需自带不透明底，hover/active 要重给。 */
  .tech-ov-table th:first-child,
  .tech-ov-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .tech-ov-table th:first-child { background: var(--surface-alt); }
  .tech-ov-row:hover td:first-child { background: var(--surface-hover); }
  .tech-ov-row.active td:first-child { background: var(--accent-light); }
}

/* ── sidebar rows ───────────────────────────────────────── */
.sidebar-section-header { font-size: 11px; font-weight: 600; color: var(--text-dim); padding: 8px 8px 4px; text-transform: uppercase; letter-spacing: .06em; }
.sidebar-section-header:first-child { padding-top: 4px; }
.sidebar-row { padding: 3px 8px; cursor: pointer; font-size: 12px; font-weight: 500; transition: background .1s; display: flex; justify-content: space-between; align-items: baseline; }
.sidebar-row:hover { background: var(--surface-hover); }
.sidebar-row.active { background: var(--accent-light); color: var(--accent-ink); }
.sidebar-row-price { font-size: 11px; font-weight: 400; white-space: nowrap; }

/* ── 自选清单（ADR-0005 T3：家住技术侧栏；仪表盘自选卡过渡期共用）──
   带 ✕ 的行改 flex-start + margin-left:auto，避免三子元素 space-between 把价格挤到中间 */
.sidebar-row:has(.watch-del) { justify-content: flex-start; gap: 6px; }
.sidebar-row:has(.watch-del) .sidebar-row-price { margin-left: auto; }
.watch-del {
  flex: 0 0 auto; width: 24px; height: 24px; margin: -4px 0; align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-dim);
  font-size: 11px; line-height: 1; cursor: pointer; padding: 0;
}
.watch-del:hover { color: var(--color-down-text); border-color: var(--color-down); background: var(--color-down-bg); }
.sidebar-watch-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sidebar-watch-add {
  max-width: 76px; min-height: 24px; font-size: 11px; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.sidebar-watch-empty { font-size: 11px; color: var(--text-dim); padding: 4px 8px; }

/* ── stock view ────────────────────────────────────────── */
.stock-toolbar { flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.stock-btn-group { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.stock-indicator-label {
  font-size: 12px; display: flex; align-items: center; gap: 3px;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface); user-select: none;
}
.stock-indicator-label:hover { background: var(--surface-hover); }
.stock-indicator-label input[type="checkbox"] { accent-color: var(--accent-ink); }

/* ── corridor dashboard ─────────────────────────────────── */
.corridor-target-card {
  display: flex; gap: 24px; padding: 16px 20px; margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
}
.corridor-target-range, .corridor-next-meeting {
  display: flex; flex-direction: column; gap: 4px;
}
.corridor-target-label, .corridor-next-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim);
}
.corridor-target-value {
  font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; font-family: var(--font-mono);
}
.corridor-next-value {
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--font-mono);
}
.corridor-chart { margin-bottom: 8px; border-radius: 6px; overflow: hidden; }
.corridor-table-wrap { max-height: 460px; overflow-y: auto; border-radius: 6px; border: 1px solid var(--border); }
.corridor-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.corridor-table th {
  position: sticky; top: 0; background: var(--bg); color: var(--text-secondary);
  font-weight: 600; padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--border);
}
.corridor-table th:first-child { text-align: left; }
.corridor-table td {
  padding: 4px 10px; text-align: right; border-bottom: 1px solid var(--border-light);
}
.corridor-table td:first-child { text-align: left; color: var(--text-dim); white-space: nowrap; }
.corridor-table tbody tr:hover { background: var(--surface-hover); }

/* ── 窄屏（≤1024px）：技术分析三栏纵向堆叠 ──────────────── */
/* sidebar 变横向滚动条，诊断 panel 变全宽排到图表下方；桌面端样式不受影响 */
@media (max-width: 1024px) {
  .app[data-view="tech"] { flex-direction: column; }
  /* sidebar：横向滚动条（忽略桌面端 sidebar-hidden 状态，窄屏没有收起按钮） */
  .app[data-view="tech"] .sidebar,
  .app[data-view="tech"].sidebar-hidden .sidebar { display: flex; }
  .app[data-view="tech"] .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .app[data-view="tech"] .sidebar-content { overflow-x: auto; overflow-y: hidden; padding: 0 4px; }
  .app[data-view="tech"] .symbol-list { display: flex; align-items: center; }
  .app[data-view="tech"] .sidebar-section-header,
  .app[data-view="tech"] .sidebar-row { white-space: nowrap; flex-shrink: 0; }
  .app[data-view="tech"] .sidebar-collapse-btn { display: none; }
  /* 诊断面板：全宽排在图表下方，限高内部滚动；collapsed 态回退为横向标题栏 */
  .app[data-view="tech"] .panel {
    width: auto; max-height: 45vh; border-left: none;
    border-top: 1px solid var(--border);
  }
  .app[data-view="tech"] .panel.collapsed { width: auto; padding: 12px 16px; }
  .app[data-view="tech"] .panel.collapsed .panel-header { writing-mode: horizontal-tb; }
  /* 信息条窄屏：内部允许折行（整条掉行的判定看 .tech-info-bar 的 min-width）*/
  .tech-info-bar { flex-wrap: wrap; gap: 8px 12px; }
}

/* ── 多源共识状态卡（ADR-0004；/daily/ 头条区单源渲染，app.css 单源）──
   状态徽章文字用 --up/--down/--warning 文字档（亮色 AA），块左竖标用图形档。 */
.cons-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.cons-title { font-size: 13px; font-weight: 700; color: var(--text); }
.cons-note { font-size: 11px; color: var(--text-dim); }
.cons-intraday { font-size: 11px; color: var(--color-warn-text); border: 1px dashed color-mix(in srgb, var(--color-warn) 45%, transparent); border-radius: 999px; padding: 0 8px; }
.cons-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px 24px; }
.cons-block { border-left: 2px solid var(--color-neutral); border-radius: 0; padding-left: 12px; }
.cons-block--on { border-color: var(--color-up); }
.cons-block--off { border-color: var(--color-down); }
.cons-block--div { border-color: var(--color-warn); }
.cons-state { font-size: 15px; font-weight: 700; }
.cons-state--on { color: var(--up); }
.cons-state--off { color: var(--down); }
.cons-state--div { color: var(--warning); }
.cons-state--na { color: var(--text-dim); font-size: 13px; }
.cons-meta { margin-left: 8px; font-size: 11px; color: var(--text-dim); }
.cons-votes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cons-vote { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 5px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--color-neutral) 30%, transparent); color: var(--text-secondary); text-decoration: none; }
.cons-vote:hover { border-color: var(--accent); color: var(--accent-ink); }
.cons-vote i { font-style: normal; font-weight: 700; }
.cons-vote--on i { color: var(--up); }
.cons-vote--off i { color: var(--down); }
.cons-vote--abst i { color: var(--text-dim); }
.cons-vote--absent { color: var(--text-dim); border-color: var(--border); border-style: dashed; }

/* ── 伴读抽屉（ai-chat.js）：浮钮 / 划词气泡 / 抽屉 / 引用胶囊 ──
   单源在本文件：SPA 壳与全部 .astro 专题页都加载 app.css（special.css 只有专题页有），
   所以 ai-* 一律写这里，两边才能共用一份。颜色一律走文本档（品牌蓝写字用
   --accent-ink，--accent 只做边框/填充），徽章一律 4px 方胶囊。 */
/* 伴读浮钮：全站统一用「窄屏那档」——右下角 40px 圆胶囊（原桌面是 30px 直角钮贴
   右上角，会跟页头「数据截至」时效块抢位置）。40 在 375 宽上不抢眼、仍是 WCAG 2.2
   触控门槛（24px）的近两倍。SHELL 里带 data-scroll-hide，滚动时与返回顶部一起隐去。
   位置由 ai-chat.js 的 fabPlace 接管（贴边只露 24px），CSS 这里只是首屏默认位。
   SPA 底部另有 28px 状态栏，多让 32px；抽屉打开时被 .ai-drawer 整屏盖住，不用另收。
   SPA 用 body.app-shell 标记（别拿 .re-has-side 反推「有侧栏 = 专题页」）。 */
.ai-float { position: fixed; top: auto; right: 8px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: var(--z-float); width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--btn-border); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 17px; line-height: 1; padding: 0; box-shadow: var(--shadow-pop); display: inline-flex; align-items: center; justify-content: center; /* 吸附位偏移走 --fab-dx（拖拽用），:active 缩放走 --fab-scale（内联 transform 会盖掉 :active，所以都走变量） */ transform: translateX(var(--fab-dx, 0px)) scale(var(--fab-scale, 1)); transition: border-color .15s, transform .18s ease, opacity .2s ease; /* 浮钮全宽度都可拖：touch-action 只在手势起始时判定，拖拽开始后再设不生效，所以常驻 */ touch-action: none; }
body.app-shell .ai-float { bottom: calc(46px + env(safe-area-inset-bottom)); }
.ai-float:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.ai-float:active { --fab-scale: .94; }
/* 滚动中隐去：rates-common 的 watchScrollHide 挂 .scroll-away（伴读浮钮与「返回顶部」共用）。
   body 前缀是为了压过 .back-top.show 的同特异性规则。 */
body [data-scroll-hide].scroll-away { opacity: 0; pointer-events: none; }
/* 拖拽中禁用触屏滚动（touch-action 常驻） */
.ai-float.fab-dragging { cursor: grabbing; }

/* 划词「问这段」气泡：贴选区上沿，选中才显示 */
.ai-sel-pop { position: fixed; z-index: var(--z-float); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-ink); font-size: 12px; font-weight: 600; line-height: 18px; cursor: pointer; box-shadow: var(--shadow-pop); display: none; align-items: center; gap: 4px; user-select: none; }
.ai-sel-pop.show { display: inline-flex; }
.ai-sel-pop:hover { background: var(--accent-light); }
/* 触屏上要拿手指戳：把气泡抬到 34px 高（仍贴选区上沿，翻边逻辑在 JS） */
@media (pointer: coarse) { .ai-sel-pop { min-height: 34px; padding: 6px 12px; font-size: 13px; } }

/* 右侧抽屉：transform 滑入（不用 display，动画才连贯） */
.ai-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw; z-index: var(--z-float); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.ai-drawer.open { transform: translateX(0); }
.ai-drawer:focus { outline: none; } /* 程序化聚焦的容器，不该画焦点圈 */
@media (max-width: 768px) { .ai-drawer { width: 100vw; } }

/* ── 桌面分栏（宽度/断点数学单源在 js/ai-pane.js，ai-chat.js 在打开时挂 html.ai-pane）──
   宽屏打开时正文「让开」而不是被盖住：body 加 padding-right，抽屉本身仍 fixed 在右缘。
   不挪 DOM、不动滚动容器 —— 专题页（普通文档流 + body 的 padding-left）与 SPA（100dvh
   flex 壳 + 内部 .center 滚动）两种 body 都吃同一条规则，34 个专题页零改动。
   宽度只走 --ai-w 一个变量：拖拽 / 记忆 / 断点回落都改它。 */
html.ai-pane body { padding-right: var(--ai-w, 380px); }
html.ai-pane .ai-drawer { width: var(--ai-w, 380px); }
html.ai-pane .ai-float { display: none; } /* 分栏时浮钮会压在抽屉头上（头里有 ✕ 和 ⌘K） */
/* 左缘拖拽柄：1px 视觉线（hover 才上 accent，不跟正文抢注意力），命中区比线宽得多。
   z-index 压在抽屉自己的内容之上；::after 与抽屉的 border-left 重合，看起来就是那条边在亮。
   指针细（鼠标/触控板）11px 够；粗指针（iPad 横屏 1366 正好落进分栏档）按 AGENTS 的
   24px 触控门槛加宽 —— 11px 用手指根本捏不住。 */
.ai-grip { display: none; }
html.ai-pane .ai-grip { display: block; position: absolute; top: 0; bottom: 0; left: -5px; width: 11px; z-index: 2; cursor: col-resize; touch-action: none; }
html.ai-pane .ai-grip::after { content: ''; position: absolute; top: 0; bottom: 0; left: 5px; width: 1px; background: transparent; transition: background .15s; }
html.ai-pane .ai-grip:hover::after,
html.ai-pane .ai-grip:focus-visible::after,
html.ai-resizing .ai-grip::after { background: var(--accent); }
html.ai-pane .ai-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
@media (pointer: coarse) {
  html.ai-pane .ai-grip { left: -12px; width: 24px; }
  html.ai-pane .ai-grip::after { left: 12px; }
}
/* 拖拽中：全局 col-resize + 禁选中（否则拖到正文上会顺手选中一片字） */
html.ai-resizing, html.ai-resizing * { cursor: col-resize !important; user-select: none !important; }
/* 设置面板里的复选框行（分栏开关）：复用 .ai-row 的行距，样式只补「一行读完」。
   .ai-row 的两条通用规则要排除它，否则标题规则（0,1,1）压过 .ai-check（0,1,0）——
   实测字号/颜色根本不生效，输入框那套 padding+border 也会套到 checkbox 上。 */
.ai-check { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.6; color: var(--text-secondary); min-height: 24px; cursor: pointer; }
.ai-check input { flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }

/* 窄屏抽屉是整屏模态：背景页不能再滚（iOS 的 overflow:hidden 拦不住，JS 侧用
   body position:fixed 兜底），见 ai-chat.js 的 lockScroll/unlockScroll */
html.ai-lock, html.ai-lock body { overflow: hidden; }

/* 头部只留标题 + ✕：对话操作条挪到输入框上沿（见 .ai-tools） */
.ai-head { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; padding: 8px 10px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.ai-title { min-width: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--text); margin-right: auto; }
.ai-btn { padding: 3px 8px; border: 1px solid var(--btn-border); border-radius: 6px; background: var(--surface); color: var(--text-secondary); font-size: 12px; line-height: 18px; cursor: pointer; white-space: nowrap; }
/* 操作条：贴着输入框上沿的一行。宽屏分栏时抽屉有整屏高，同样几个按钮放头部
   会和输入框差出 800px 的视线跨度（用户反馈）。
   不要 overflow-x：绝对定位的「⋯」菜单要往上弹，滚动容器会把它裁掉。
   320px 宽实测 3 钮 + ⋯ 共 ~255px，放得下；真挤不下时 nowrap 让 ⋯ 留在行尾。 */
.ai-tools { position: relative; display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.ai-tools .ai-btn { padding: 4px 8px; }
/* 「⋯」收低频项（导出/设置）：压到行尾，与原先头部布局同一侧 */
.ai-tools .ai-more { display: inline-flex; margin-left: auto; font-size: 15px; }
/* 「⋯」菜单：在操作条上方弹出（操作条已在抽屉底部，往下会顶出屏幕外） */
.ai-menu { position: absolute; bottom: calc(100% + 4px); right: 0; z-index: 5; min-width: 140px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 2px; }
.ai-menu[hidden] { display: none; }
.ai-menu .ai-btn { display: flex; align-items: center; width: 100%; border-color: transparent; background: none; text-align: left; }
.ai-menu .ai-btn:hover { background: var(--hover-tint); }
.ai-btn:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.ai-btn.on { background: var(--accent-light); border-color: var(--accent); color: var(--accent-ink); }
.ai-btn[disabled] { opacity: .55; cursor: default; }
.ai-btn[disabled]:hover { border-color: var(--btn-border); color: var(--text-secondary); }

/* 保存/代理结果细条：一次性反馈，不混进对话流。挂在操作条上方（消息流底端），
   与「存笔记/复制」这些触发它的按钮同屏；底边不画线，交给 .ai-foot 的 border-top。 */
.ai-flash { padding: 6px 12px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; line-height: 1.55; word-break: break-word; background: var(--surface-alt); }
.ai-flash.err { color: var(--color-down-text); }

/* 设置面板 / 历史列表：抽屉内的次级面板，底色下沉一档（surface-alt）。
   两者都封顶可滚：设置面板在 320×568 上内容 433px，不封顶会把输入区顶出屏幕外
   （flex 不收缩，抽屉自身 overflow:visible）。 */
.ai-cfg, .ai-hist { padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-alt); flex: 0 1 auto; min-height: 0; }
.ai-cfg { max-height: 60vh; overflow-y: auto; padding-bottom: 0; }
/* 面板滚起来时「保存/收起」贴着面板底，别让它滚出可视区；底内距挪到按钮行，
   否则行下面会漏出一条滚动内容 */
.ai-cfg > .ai-acts { position: sticky; bottom: 0; padding: 6px 0 10px; background: var(--surface-alt); }
/* 抽屉被键盘压矮（<480px，ai-chat.js 打 .ai-kb）时不吸底：面板只剩几十 px，
   48px 的按钮行会把输入框盖掉，宁可让它跟着内容滚 */
.ai-drawer.ai-kb .ai-cfg > .ai-acts { position: static; }
/* 矮抽屉里打开次级面板时让出消息区：300px 高度下，面板能从 77px 长到 117px，
   多露一行输入框（面板本身就是这一刻的主体） */
.ai-drawer.ai-kb:has(> .ai-cfg:not([hidden])) > .ai-msgs,
.ai-drawer.ai-kb:has(> .ai-hist:not([hidden])) > .ai-msgs { display: none; }
.ai-drawer.ai-kb:has(> .ai-cfg:not([hidden])) > .ai-cfg { flex: 1 1 auto; max-height: none; }
.ai-hist { max-height: 40vh; overflow-y: auto; }
.ai-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.ai-row > label:not(.ai-check) { font-size: 11px; color: var(--text-dim); }
.ai-row input:not([type="checkbox"]) { padding: 5px 8px; border: 1px solid var(--btn-border); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 12px; font-family: var(--font-mono); }
/* 探测模型：下拉占满，按钮跟手在右 */
.ai-row select { padding: 5px 8px; border: 1px solid var(--btn-border); border-radius: 4px; background: var(--surface); color: var(--text); font-size: 12px; font-family: var(--font-mono); }
.ai-row select:disabled { color: var(--text-dim); }
.ai-cfg-pick { display: flex; gap: 6px; align-items: center; }
.ai-cfg-pick select { flex: 1 1 auto; min-width: 0; }
.ai-hint { font-size: 11px; line-height: 1.6; color: var(--text-dim); }
.ai-acts { display: flex; gap: 6px; align-items: center; }
.ai-hist-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.ai-hist-item:hover { background: var(--hover-tint); }
.ai-hist-item.on { background: var(--accent-light); }
.ai-hist-title { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-hist-meta { flex: 0 0 auto; font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.ai-hist-rm { flex: 0 0 auto; width: 24px; height: 24px; margin: -4px 0; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; padding: 0; color: var(--text-dim); font-size: 13px; line-height: 1; cursor: pointer; }
.ai-hist-rm:hover { color: var(--color-down-text); }
.ai-empty { padding: 8px 0; font-size: 12px; line-height: 1.7; color: var(--text-dim); }
.ai-empty p { margin: 0 0 4px; }

/* 消息流：贴底才自动跟随（往上翻读时流式输出不抢滚动），卡片圆角 6px（同卡面家族） */
.ai-msgs { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { border-radius: 6px; padding: 8px 10px; font-size: 13px; line-height: 1.65; color: var(--text); word-break: break-word; }
.ai-msg p { margin: 0 0 6px; }
.ai-msg p:last-child, .ai-msg ul:last-child, .ai-msg ol:last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: 0 0 6px; padding-left: 18px; }
.ai-msg li { margin: 0 0 2px; }
.ai-msg code { padding: 1px 4px; border-radius: 4px; background: var(--surface); font-family: var(--font-mono); font-size: 12px; }
/* markdown：标题两档 / 代码块 / 表格 / 引用 / 分隔线（ai-md.js 产出） */
.ai-msg .ai-h1 { margin: 10px 0 5px; font-size: 14px; font-weight: 700; color: var(--text); }
.ai-msg .ai-h2 { margin: 9px 0 4px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.ai-msg .ai-h1:first-child, .ai-msg .ai-h2:first-child { margin-top: 0; }
.ai-pre { margin: 0 0 6px; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); overflow-x: auto; }
.ai-pre code { padding: 0; background: none; font-size: 12px; line-height: 1.55; white-space: pre; }
.ai-table { width: 100%; margin: 0 0 6px; border-collapse: collapse; font-size: 12px; }
.ai-table th, .ai-table td { padding: 3px 6px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.ai-table th { background: var(--surface); font-weight: 600; color: var(--text-secondary); }
.ai-msg blockquote { margin: 0 0 6px; padding-left: 8px; border-left: 2px solid var(--border); color: var(--text-secondary); }
.ai-msg hr { margin: 8px 0; border: none; border-top: 1px solid var(--border); }
.ai-msg a { color: var(--accent-ink); }
.ai-msg-acts { margin-top: 6px; }
.ai-msg-user { background: var(--accent-light); }
.ai-msg-assistant { background: var(--surface-alt); }
.ai-msg-assistant code { background: var(--surface); }
.ai-msg-meta { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); margin-bottom: 4px; }
/* 思考过程：流式时展开并跟随滚动，正文一到收成一行；之后默认折叠，点开回看全文 */
.ai-think { margin: 0 0 6px; padding-left: 8px; border-left: 2px solid var(--border); }
.ai-think > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 11px; line-height: 18px; color: var(--text-dim); font-family: var(--font-mono); }
.ai-think > summary::-webkit-details-marker { display: none; }
.ai-think > summary::before { content: '▸'; flex: 0 0 auto; }
.ai-think[open] > summary::before { content: '▾'; }
.ai-think > summary:hover { color: var(--text-secondary); }
.ai-think-body { max-height: 180px; overflow-y: auto; margin-top: 4px; font-size: 12px; line-height: 1.6; color: var(--text-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-spin { flex: 0 0 auto; width: 10px; height: 10px; border: 1.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: ai-spin 0.8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spin { animation: none; } }
.ai-msg-quotes { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
/* 消息里的引用块：左竖标 + 换行缩进，同 .cons-block 语言 */
.ai-quote { padding-left: 8px; border-left: 2px solid var(--accent); font-size: 11px; line-height: 1.55; color: var(--text-secondary); }
.ai-quote b { color: var(--accent-ink); font-weight: 600; }

/* 输入区上方的引用胶囊条：空时整条不占位 */
.ai-quotes { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px; }
.ai-quotes:not(:empty) { padding: 8px 12px 0; }
.ai-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-alt); font-size: 11px; line-height: 16px; color: var(--text-secondary); }
.ai-chip-label { flex: 0 0 auto; color: var(--accent-ink); font-weight: 600; }
.ai-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ai-chip-rm { flex: 0 0 auto; width: 24px; height: 24px; margin: -4px -2px; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; padding: 0; color: var(--text-dim); font-size: 12px; line-height: 1; cursor: pointer; }
.ai-chip-rm:hover { color: var(--color-down-text); }

.ai-foot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px; border-top: 1px solid var(--border); }
.ai-input { width: 100%; min-height: 56px; max-height: 160px; resize: vertical; padding: 7px 9px; border: 1px solid var(--btn-border); border-radius: 6px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px; line-height: 1.6; }
.ai-input:focus { outline: none; border-color: var(--accent); }
.ai-foot-row { display: flex; align-items: center; gap: 8px; }
.ai-foot-row .ai-hint { margin-right: auto; }
.ai-send { padding: 5px 12px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--text-on-accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.ai-send:hover { opacity: .9; }

/* ── 伴读抽屉的窄屏档（≤768 全屏模态）────────────────────────────────────
   一段集中：头部只留 标题 + ✕，操作条贴着输入框上沿（拇指够得到）、
   输入框 16px（iOS 对 <16px 输入框聚焦会强制放大整页）、触控目标加到 32-44px、
   底部只留发送钮。断点与 .ai-drawer 整屏那档一致。 */
@media (max-width: 768px) {
  .ai-head .ai-btn { min-height: 32px; padding: 4px 8px; }
  .ai-head > [data-act="close"] { width: 36px; height: 36px; padding: 0; justify-content: center; font-size: 15px; }
  .ai-head .ai-title { max-width: 70%; }
  .ai-tools .ai-btn { min-height: 32px; padding: 5px 10px; }
  .ai-tools .ai-more { min-width: 32px; justify-content: center; }
  .ai-input, .ai-row input:not([type="checkbox"]), .ai-row select { font-size: 16px; }
  .ai-input { min-height: 64px; }
  .ai-foot-row { justify-content: flex-end; }
  .ai-foot-row .ai-hint { display: none; }
  .ai-send { min-height: 38px; padding: 8px 16px; font-size: 13px; }
  .ai-msg-acts .ai-btn, .ai-hist .ai-btn, .ai-cfg .ai-btn { min-height: 32px; padding: 5px 10px; }
  .ai-hist-rm, .ai-chip-rm { width: 32px; height: 32px; margin: -6px -4px; }
  .ai-hist-item { padding: 8px; }
}
@media (pointer: coarse) { .ai-input { resize: none; } }
