/* ==========================================================================
   ClinAxis AI — Global Reset & Base Styles
   简约科技风：抗锯齿字体、统一 box-sizing、精致 selection

   【应用语义层的唯一定义点】spec:theme-unification@v1
   本文件是 Q 仓应用语义色（文字 / 底色 / 边框 / 品牌与状态色）的**唯一定义点**：
     - 原始色层（--color-* 原始值）= web/src/styles/token.css
     - 应用语义层（本文件）        = --text-* / --border-* / --bg-* / --brand-color 等
   runtime（stores/themeStore.ts）不再持有第二份色表，也不再往 <html> 内联注入颜色，
   因此这里写下的值就是页面上真正生效的值。
   门禁：tests/theme_styles_contract.test.ts（同名语义变量只允许在本文件声明）。
   ========================================================================== */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.65;
  color: var(--text-primary, #1a2332);
  background: var(--bg-page, #f7f8fa);
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* 【亮暗切换修复】body 背景按主题显式钉死：
   实测暗色下存在来源不明的规则把 body 压回亮色 #f7f8fa。此前靠 runtime 往 <body>
   内联 !important 兜底（那已经是第二份色表 + 内联注入，spec:theme-unification@v1
   已删除），现在改由本文件用同等 !important + 主题属性作用域稳定胜出。 */
html[data-theme="light"] body {
  background: var(--bg-page, #f7f8fa) !important;
}
html[data-theme="dark"] body {
  background: var(--bg-page, #0f0f11) !important;
}

/* 【Step 4 isDark 收口】背景/边框类变量提升到 :root（挂 documentElement），
   Modal/Drawer 等 portal 到 body 的组件也能消费。
   这里是应用语义层的唯一定义点：runtime 不再内联注入颜色，写下的值就是生效的值。 */
:root {
  /* 【亮暗统一治理】原生控件（滚动条、表单控件、日期选择器等）随主题走：
     浏览器只认根元素的 color-scheme，此前全局未声明 ⇒ 暗色下原生件仍是亮色。
     暗档见下方 [data-theme="dark"] 块（同文件后序胜出，取值唯一）。 */
  color-scheme: light;

  /* 文字灰阶（批4-⑥）：判据 = 该档在本主题**全部** --bg* 底色上最低对比度 ≥4.5（由
     tests/theme_tokens.test.ts 复算）。改前实测 tertiary #8c939d 只有 2.92:1、
     quaternary #bfbfbf 只有 1.73:1，而说明文字与 GxP 提示正落在这两档上。
     代价：AA 下限把三档压进 6.58/5.46/4.61 的窄带，层级差要靠字号/字重继续区分。 */
  --text-primary: #1a2332;
  --text-secondary: #4b5563;
  --text-tertiary: #61666b;
  --text-quaternary: #666c74;
  --text-label-weak: #61666b;
  /* 反白文字（浅底上的深字/深底上的浅字），与原始层的 --color-text-inverse 同源 */
  --text-inverse: var(--color-text-inverse, #ffffff);
  /* 品牌蓝做文字用时必须 ≥4.5：改前 #60a5fa 在白底只有 2.54:1。取 #1d4ed8 = 本主题 --link 的同一个蓝。 */
  --brand-color: #1d4ed8;
  --brand-tint-border: rgba(37, 99, 235, 0.2);
  --link: #1d4ed8;
  --status-info: #1d4ed8; /* 批4-⑦：本变量在 deviation 相位标签里当文字色，#60a5fa 白底 2.54:1 */
  --bg-page: #f7f8fa;
  --bg-sidebar: #ffffff;
  --bg-header: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f5ff;
  --bg-elevated: #ffffff;
  --bg-spotlight: #e6f0ff;
  --bg-input: #ffffff;
  --bg-hover-row: rgba(0, 0, 0, 0.04);
  /* 容器级底色别名（vendor ui-kit 的 settings/PDF 面板在消费）：
     语义层的别名也归本文件管，原始值仍来自 token.css 的 --color-* 层；
     因为引用的是原始层变量，亮暗切换自动跟随，不需要在这里再写一份。 */
  --bg-primary: var(--color-bg-container, #ffffff);
  --bg-secondary: var(--color-bg-layout, #f0f2f5);
  --bg-tertiary: var(--color-bg-elevated, #ffffff);
  --bg-mask: var(--color-bg-mask, rgba(0, 0, 0, 0.45));
  --border-color: #e8ecf0;
  --border-secondary: #f2f4f6;
  --border-color-secondary: var(--color-border-secondary, #f0f0f0);
  --accent-glow: rgba(96, 165, 250, 0.06);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.12);
  --scrollbar-color: #d0d7de;
  --diff-added-bg: #f6ffed;
  --diff-added-color: #389e0d;
  --diff-removed-bg: #fff2f0;
  --diff-removed-color: #cf1322;
  --warn-bg-solid: #fffbe6;
}

[data-theme="dark"] {
  /* 【亮暗统一治理】暗色档的原生控件配色（与 :root 的 color-scheme: light 配对）。 */
  color-scheme: dark;

  /* 暗色灰阶（批4-⑥）：同一判据，最差底色是 #2a2a2a 的选中面。
     改前实测 tertiary #71717a = 3.17:1、quaternary #52525b = 1.98:1；
     三档落点 5.60 / 5.08 / 4.70，间距被 AA 下限压窄是已知代价。 */
  --text-primary: #e5e5e5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #959aa3;
  --text-quaternary: #909498;
  --text-label-weak: #909498;
  --brand-color: #70b0ff;
  --brand-tint-border: rgba(22, 119, 255, 0.3);
  --link: #93C5FD;
  --status-info: #60a5fa;
  --bg-page: #0f0f11;
  --bg-sidebar: #1A1A1A;
  --bg-header: #1A1A1A;
  --bg-card: #1F1F1F;
  --bg-hover: #252526;
  --bg-elevated: #252526;
  --bg-spotlight: #2A2A2A;
  --bg-input: #252526;
  --bg-hover-row: rgba(255, 255, 255, 0.04);
  --border-color: #2E2E30;
  --border-secondary: #252526;
  --accent-glow: rgba(112, 176, 255, 0.12);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-overlay: 0 8px 24px rgba(0, 0, 0, 0.5);
  --scrollbar-color: #3F3F46;
  --diff-added-bg: #0d2818;
  --diff-added-color: #4ade80;
  --diff-removed-bg: #2d1215;
  --diff-removed-color: #f87171;
  --warn-bg-solid: #2d2200;
}

/* Selection — 品牌色高亮 */
::selection {
  background: rgba(96, 165, 250, 0.2);
  color: inherit;
}

[data-theme="dark"] ::selection {
  background: rgba(96, 165, 250, 0.25);
}

/* Scrollbar — 极简细滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Focus ring — 统一聚焦样式 */
:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.4);
  outline-offset: 2px;
}

[data-theme="dark"] :focus-visible {
  outline-color: rgba(96, 165, 250, 0.4);
}

/* 主题切换过渡 —— 【亮暗统一治理 · 收窄】
   旧形态是 `.theme-transition *` + `!important` 的通配过渡：对**所有**后代强制覆盖
   transition，既盖掉组件自己的过渡语义，又在切主题那一瞬强制整树重绘。
   现在只过渡"主题表面"这一小组容器，且不加 !important（组件自己的过渡优先）。
   组件内部的文字/边框过渡由各组件样式自行负责。 */
.theme-transition,
.theme-transition body,
.theme-transition .ant-layout,
.theme-transition .ant-layout-header,
.theme-transition .ant-layout-sider,
.theme-transition .ant-card,
.theme-transition .ant-modal-content,
.theme-transition .ant-drawer-content,
.theme-transition .ant-popover-inner,
.theme-transition .ant-dropdown-menu,
.theme-transition .ant-input,
.theme-transition .ant-input-affix-wrapper,
.theme-transition .ant-select-selector,
.theme-transition .ant-table,
.theme-transition .ant-table-tbody > tr > td {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* 【亮暗统一治理】尊重 prefers-reduced-motion：系统要求减少动效时，
   主题切换不再做颜色过渡，平滑滚动也退回瞬时滚动。
   刻意**不做**全局 `* { transition-duration: 0.01ms }` 的"一键掐死"：
   那会连加载指示、展开收起等有信息量的动效一起砍掉（WCAG 2.3.3 只要求非必要动效可关）。 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .theme-transition,
  .theme-transition body,
  .theme-transition .ant-layout,
  .theme-transition .ant-layout-header,
  .theme-transition .ant-layout-sider,
  .theme-transition .ant-card,
  .theme-transition .ant-modal-content,
  .theme-transition .ant-drawer-content,
  .theme-transition .ant-popover-inner,
  .theme-transition .ant-dropdown-menu,
  .theme-transition .ant-input,
  .theme-transition .ant-input-affix-wrapper,
  .theme-transition .ant-select-selector,
  .theme-transition .ant-table,
  .theme-transition .ant-table-tbody > tr > td {
    transition: none !important;
  }
}

/* Ant Design Tooltip/Popover 增强：长文本自动换行，不截断 */
.ant-tooltip-inner,
.ant-popover-inner {
  white-space: normal !important;
  word-break: break-word !important;
  max-width: 480px !important;
}
.ant-tooltip-arrow {
  /* antd 4.x 箭头偏移修正 */
}

/* Tooltip 主题适配 */
[data-theme="light"] .ant-tooltip-inner {
  background-color: #ffffff !important;
  color: #1a2332 !important;
  border: 1px solid #e8ecf0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}
[data-theme="dark"] .ant-tooltip-inner {
  background-color: #2c2c2e !important;
  color: #f5f5f7 !important;
  border: 1px solid #3a3a3c !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* 图片默认不拖拽 */
img {
  user-select: none;
  -webkit-user-drag: none;
}

/* 【批4-⑥ 撤除】曾经的"防主题初始化前闪烁"规则
   [data-theme]:not([data-theme="dark"]) *, [data-theme="light"] * { color: inherit; }
   特异度 (0,2,0)，压过 antd 运行时注入的 .ant-btn-primary / .ant-tag / Menu 选中色等
   (0,1,0) 规则，于是**亮色下所有元件文字被强制回继承值**：实测「新建对话」主按钮
   = rgb(26,35,50) 字压 rgb(29,78,216) 底 = 2.36:1（应为白字 6.70:1），同一机制也是
   react-pdf 文本层"字上叠字"残影的成因。真正的闪烁窗口是 <html> 还没有 data-theme
   的时刻，已由本文件后面的 `html:not([data-theme])` 规则单独兜住，这条纯破坏，删除。 */

/* 暗色模式下 antd 图标默认色太暗，强制使用主题主文字色 */
[data-theme="dark"] .anticon,
[data-theme="dark"] .ant-menu-item .anticon,
[data-theme="dark"] .ant-menu-submenu-title .anticon,
[data-theme="dark"] .ant-tabs-tab .anticon,
[data-theme="dark"] .ant-input-prefix .anticon,
[data-theme="dark"] .ant-input-suffix .anticon,
[data-theme="dark"] .ant-select-suffix .anticon,
[data-theme="dark"] .ant-form-item-label .anticon,
[data-theme="dark"] .ant-pagination-item .anticon {
  color: var(--text-secondary, #a1a1aa) !important;
}

[data-theme="dark"] .ant-menu-item-selected .anticon,
[data-theme="dark"] .ant-menu-submenu-selected .anticon,
[data-theme="dark"] .ant-tabs-tab-active .anticon {
  color: var(--brand-color, #70b0ff) !important;
}

/* 输入框/选择框中的 placeholder 文字。
   原来是 var(--text-tertiary, #71717a)：在输入底 #252526 上只有 3.17:1（A 仓同形实测），
   12–14px 文字不达 AA(4.5)。placeholder 是「这格能填什么」的唯一提示，不可读等于功能缺失，
   所以提到 --text-secondary(#a1a1aa)；亮色侧走 themeConfig 的 colorTextPlaceholder。 */
[data-theme="dark"] .ant-input::placeholder,
[data-theme="dark"] .ant-input-affix-wrapper input::placeholder,
[data-theme="dark"] .ant-select-selection-placeholder {
  color: var(--text-secondary, #a1a1aa) !important;
}

/* 暗色下的预设色 Tag：antd 给的预设文字色在自家深色底上不够（A 仓实测 geekblue 4.16:1、
   purple 3.39:1，都是 12px 常规字，AA 要 4.5:1）。只补这两个实测不达标的预设——
   本仓确实用到（inspection 清单/详情、SOP 问答、产品手册），其余预设双主题都 ≥4.5，别顺手一起改。 */
[data-theme="dark"] .ant-tag-geekblue {
  color: #b6c8ff;
}

[data-theme="dark"] .ant-tag-purple {
  color: #d3adf7;
}
/* 亮色下的预设色 Tag（批4-⑥）—— 同时更正上一批写下的"其余预设双主题均已 ≥4.5"那句：
   本轮在 /dashboard、/regulatory-change 实测 ant-tag-orange 的文字 rgb(212,107,8) 压在自己的
   #fff7e6 底上只有 **3.34:1**、ant-tag-gold **2.76:1**；按 @ant-design/colors 复算 green(-7 3.37)
   与 cyan(-7 3.39) 同样不达标，只有 blue/red/geekblue/purple/magenta 的 -7 档过线。
   取各色的 -8 档（同色系加深一档）钉文字色，底与描边仍由 antd 给。 */
[data-theme="light"] .ant-tag-orange {
  color: #ad4e00; /* #fff7e6 底 5.09:1 */
}

[data-theme="light"] .ant-tag-gold {
  color: #874d00; /* #fffbe6 底 6.53:1 */
}

[data-theme="light"] .ant-tag-green {
  color: #237804; /* #f6ffed 底 5.44:1 */
}

[data-theme="light"] .ant-tag-cyan {
  color: #006d75; /* #e6fffb 底 5.82:1 */
}

/* 语义状态 Tag（color="warning|success|error"）—— 文字取主题的 colorWarning/colorSuccess/
   colorError，亮色即 #f59e0b/#16a34a/#ef4444：本轮 /qms 实测「不可得」徽章 8 处 **2.05:1**。
   只改非实心档；filled 档是白字压色底，规则用 :not(.ant-tag-filled) 排除，
   否则会把"深字压深底"换成"深字压同色底"。暗色侧同角色实测达标，不动。 */
[data-theme="light"] .ant-tag-warning:not(.ant-tag-filled) {
  color: #92400e;
}

[data-theme="light"] .ant-tag-success:not(.ant-tag-filled) {
  color: #166534;
}

[data-theme="light"] .ant-tag-error:not(.ant-tag-filled) {
  color: #b91c1c;
}

/* 输入框/选择框在暗色模式下的明确对比 */
[data-theme="dark"] .ant-input,
[data-theme="dark"] .ant-input-affix-wrapper,
[data-theme="dark"] .ant-input-number,
[data-theme="dark"] .ant-select-selector,
[data-theme="dark"] .ant-picker {
  background-color: var(--bg-input, #252526) !important;
  border-color: var(--border-color, #2e2e30) !important;
  color: var(--text-primary, #e5e5e5) !important;
}

[data-theme="dark"] .ant-input:hover,
[data-theme="dark"] .ant-input-affix-wrapper:hover,
[data-theme="dark"] .ant-select:hover .ant-select-selector {
  border-color: var(--brand-color, #70b0ff) !important;
}

/* 卡片背景色确保暗色模式正确 */
[data-theme="dark"] .ant-card,
[data-theme="dark"] .ant-modal-content,
[data-theme="dark"] .ant-modal-header,
[data-theme="dark"] .ant-popover-inner,
[data-theme="dark"] .ant-dropdown-menu {
  background-color: var(--bg-card, #1f1f1f) !important;
  border-color: var(--border-color, #2e2e30) !important;
}

/* 亮色模式下 Dropdown/Popover/Modal 样式适配 */
[data-theme="light"] .ant-dropdown-menu {
  background-color: #ffffff !important;
  border-color: #e8ecf0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}
[data-theme="light"] .ant-popover-inner {
  background-color: #ffffff !important;
  border-color: #e8ecf0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}
[data-theme="light"] .ant-modal-content,
[data-theme="light"] .ant-modal-header {
  background-color: #ffffff !important;
  border-color: #e8ecf0 !important;
}
[data-theme="light"] .ant-modal-footer {
  border-top-color: #e8ecf0 !important;
}

/* 亮色模式下 Dropdown 菜单项悬停 */
[data-theme="light"] .ant-dropdown-menu-item:hover,
[data-theme="light"] .ant-dropdown-menu-submenu-title:hover {
  background-color: #f0f5ff !important;
}

/* 暗色模式下 Dropdown 菜单项悬停 */
[data-theme="dark"] .ant-dropdown-menu-item:hover,
[data-theme="dark"] .ant-dropdown-menu-submenu-title:hover {
  background-color: var(--bg-hover, #252526) !important;
}

/* 关键修复：为所有文本元素设置默认可见颜色，防止主题未加载时文本不可见 */
html:not([data-theme]) body,
html:not([data-theme]) * {
  color: #1a2332 !important;
  background: #f7f8fa !important;
}

/* ==========================================================================
   Markdown 渲染样式 — ChatPage / ChatDrawer 共用
   色值/字体一律走 dsw-tokens.css 语义 Token（--dsw-alias-*），
   亮暗切换由 :root[data-theme] 覆盖 Token 实现，本区块不再出现硬编码色。
   ========================================================================== */

.markdown-body {
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: var(--dsw-markdown-font-size);
  line-height: var(--dsw-markdown-line-height);
  color: var(--dsw-alias-label-primary);
}

.markdown-body h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--dsw-alias-border-l2);
  color: var(--dsw-alias-label-primary);
}

.markdown-body h2 {
  font-size: var(--dsw-markdown-font-size-h2);
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--dsw-alias-label-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--dsw-alias-border-l1);
}

.markdown-body h3 {
  font-size: var(--dsw-markdown-font-size-h3);
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--dsw-alias-label-primary);
  padding-left: 10px;
  border-left: 3px solid var(--dsw-alias-link);
}

.markdown-body h4 {
  font-size: var(--dsw-markdown-font-size-h4);
  font-weight: 600;
  margin: 10px 0 4px;
  color: var(--dsw-alias-label-secondary);
}

.markdown-body p {
  margin: 6px 0;
  line-height: 1.7;
}

.markdown-body ol,
.markdown-body ul {
  margin: 8px 0;
  padding-left: 24px;
  line-height: 1.7;
}

.markdown-body li {
  margin-bottom: 4px;
  line-height: 1.7;
}

.markdown-body li::marker {
  color: var(--dsw-alias-label-secondary);
}

.markdown-body blockquote {
  margin: 8px 0;
  padding: 6px 14px;
  border-left: 3px solid var(--dsw-alias-link);
  background: var(--dsw-alias-markdown-blockquote-bg);
  color: var(--dsw-alias-label-secondary);
  border-radius: 0 var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) 0;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--dsw-alias-border-l2);
  margin: 12px 0;
}

.markdown-body code {
  font-family: var(--ds-font-family-code);
  font-size: var(--dsw-markdown-font-size-code);
}

.markdown-body :not(pre) > code {
  background: var(--dsw-alias-markdown-inline-code);
  border-radius: 3px;
  padding: 1px 5px;
}

.markdown-body pre {
  margin: 8px 0;
  background: var(--dsw-alias-markdown-code-block);
  border: 1px solid var(--dsw-alias-border-l2);
  border-radius: var(--border-radius-sm, 6px);
  overflow: auto;
}

.markdown-body pre code {
  font-size: var(--dsw-markdown-font-size-code);
  line-height: 1.5;
  background: transparent;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--dsw-markdown-font-size-code);
  margin: 8px 0;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--dsw-alias-border-l3);
  padding: 6px 10px;
  text-align: left;
}

.markdown-body th {
  background: var(--dsw-alias-markdown-code-block);
  font-weight: 600;
  white-space: nowrap;
}

.markdown-body td {
  vertical-align: top;
}

.markdown-body a {
  color: var(--dsw-alias-link);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--ds-transition-duration) var(--ds-ease-in-out);
}

.markdown-body a:hover,
.markdown-body a:focus {
  outline: none;
  border-bottom-color: var(--dsw-alias-link);
}

.markdown-body strong {
  color: var(--dsw-alias-label-primary);
  font-weight: 600;
}

/* 引用角标 — 状态色收敛自 MarkdownRenderer 原内联 isDark 双写 */
.citation-badge {
  display: inline-block;
  margin: 0 1px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  border-radius: var(--border-radius-sm, 4px);
  background: var(--dsw-alias-markdown-citation-bg);
  color: var(--dsw-alias-link);
  border: 1px solid var(--dsw-alias-markdown-citation-border);
  cursor: pointer;
  vertical-align: super;
  transition: background var(--ds-transition-duration) var(--ds-ease-in-out),
    transform var(--ds-transition-duration) var(--ds-ease-in-out);
  user-select: none;
}

.citation-badge:hover {
  background: var(--dsw-alias-markdown-citation-bg-hover);
  transform: scale(1.1);
}

.citation-badge:active {
  transform: scale(0.95);
}

/* 消息气泡层语义类 — ChatMessageList 消费 */
/* 用户气泡反白文字（品牌底色上，亮暗同白） */
.user-bubble-text {
  color: var(--dsw-alias-label-primary-inverted);
}

/* Skill 路由标签（AI 消息顶部装饰行） */
.skill-route-tag {
  margin-bottom: 8px;
  padding: 2px 10px;
  border-left: 3px solid var(--dsw-alias-link);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--dsw-alias-link);
  background: var(--dsw-alias-state-warn-tertiary);
  border-radius: 0 var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) 0;
}

/* 消息级警示条（编码损坏 / 低置信度 / 未标注引用核查共用 warning/error 两态） */
.msg-alert {
  padding: 6px 10px;
  border-radius: var(--border-radius-sm, 4px);
  font-size: 12px;
  line-height: 1.6;
}

.msg-alert--warn {
  background: var(--dsw-alias-state-warn-bg);
  color: var(--dsw-alias-state-warn-label);
  border: 1px solid var(--dsw-alias-state-warn-border);
}

.msg-alert--error {
  background: var(--dsw-alias-state-error-bg);
  color: var(--dsw-alias-state-error-primary);
  border: 1px solid var(--dsw-alias-state-error-border);
}

/* 来源卡片高亮动画 */
@keyframes sourceHighlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 119, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.15);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(22, 119, 255, 0);
  }
}

.source-highlight {
  animation: sourceHighlightPulse 1.5s ease-out;
}

[data-theme="dark"] .source-highlight {
  animation-name: sourceHighlightPulse;
}

/* ==========================================================================
   Ant Design 组件主题适配 — 亮色模式支持
   ========================================================================== */

/* Tabs — 标签页 */
[data-theme="light"] .ant-tabs-tab-active .ant-tabs-tab-btn,
[data-theme="light"] .ant-tabs-tab-active .ant-tabs-ink-bar {
  color: var(--brand-color, #60a5fa) !important;
}
[data-theme="light"] .ant-tabs-tab:hover {
  color: var(--brand-color, #60a5fa) !important;
}
[data-theme="dark"] .ant-tabs-tab:hover {
  color: #70b0ff !important;
}
[data-theme="dark"] .ant-tabs-tab-active .ant-tabs-tab-btn,
[data-theme="dark"] .ant-tabs-tab-active .ant-tabs-ink-bar {
  color: #70b0ff !important;
}

/* Drawer — 抽屉 */
[data-theme="light"] .ant-drawer-content-wrapper {
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1) !important;
}
[data-theme="dark"] .ant-drawer-content-wrapper {
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4) !important;
}

/* Collapse — 折叠面板 */
[data-theme="light"] .ant-collapse > .ant-collapse-item {
  border-color: #e8ecf0 !important;
}
[data-theme="light"] .ant-collapse-header {
  background-color: #fafbfc !important;
}
[data-theme="dark"] .ant-collapse > .ant-collapse-item {
  border-color: #2e2e30 !important;
}
[data-theme="dark"] .ant-collapse-header {
  background-color: #1f1f1f !important;
}

/* Alert — 警告提示 */
[data-theme="light"] .ant-alert {
  background-color: #f6f8fa !important;
  border-color: #e8ecf0 !important;
}
[data-theme="dark"] .ant-alert {
  background-color: #1f1f1f !important;
  border-color: #2e2e30 !important;
}

/* Progress — 进度条 */
[data-theme="light"] .ant-progress-bg,
[data-theme="light"] .ant-progress-circle-path {
  background-color: var(--brand-color, #60a5fa) !important;
}
[data-theme="dark"] .ant-progress-bg,
[data-theme="dark"] .ant-progress-circle-path {
  background-color: #70b0ff !important;
}

/* Steps — 步骤条 */
[data-theme="light"] .ant-steps-item-finish .ant-steps-item-icon,
[data-theme="light"] .ant-steps-item-process .ant-steps-item-icon {
  background-color: var(--brand-color, #60a5fa) !important;
  border-color: var(--brand-color, #60a5fa) !important;
}
[data-theme="dark"] .ant-steps-item-finish .ant-steps-item-icon,
[data-theme="dark"] .ant-steps-item-process .ant-steps-item-icon {
  background-color: #70b0ff !important;
  border-color: #70b0ff !important;
}

/* Timeline — 时间轴 */
[data-theme="light"] .ant-timeline-item-tail {
  border-left-color: #e8ecf0 !important;
}
[data-theme="light"] .ant-timeline-item-head {
  border-color: #e8ecf0 !important;
}
[data-theme="dark"] .ant-timeline-item-tail {
  border-left-color: #2e2e30 !important;
}
[data-theme="dark"] .ant-timeline-item-head {
  border-color: #2e2e30 !important;
}

/* ==========================================================================
   MessageBoard — 视频流风格留言墙样式
   ========================================================================== */

/* 新消息入场动效 */
.message-item-new {
  animation: messageSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              messageNewPulse 1.2s ease-out 0.1s;
}

/* 留言卡片基础样式 */
.message-item {
  will-change: transform, opacity;
}

/* 浮动新消息按钮动效 */
@keyframes floatBtnSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

button[class*="bottom-4"][class*="rounded-full"] {
  animation: floatBtnSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   React PDF (wojtekmaj) — 自定义工具栏/侧边栏样式
   react-pdf v10 使用 .react-pdf-* 类名，与旧 @react-pdf-viewer 的 .rpv-* 不同
   ========================================================================== */

/* 【残影修复 · 根因】亮色模式下正文出现"加粗/重影/拖影"类残影的实锤原因：
   本文件前面的防闪烁规则
     [data-theme]:not([data-theme="dark"]) * { color: inherit; }
   特异度为 (0,2,0)，压过了 react-pdf TextLayer.css 中
     .textLayer :is(span, br) { color: transparent; }   —— 特异度 (0,1,1)
   导致文本选择层的 span 不再是透明的，渲染出一层与 canvas 正文错位叠加的
   可见文字（canvas 用 PDF 内嵌字体绘制，span 用 CSS 字体度量定位），
   视觉上即"字上叠字"的残影。暗色模式不匹配该选择器，故暗色下无此现象。
   此处以更高特异度显式还原文本层的透明机制（置于文件末尾，确保稳定生效）。 */
[data-theme]:not([data-theme="dark"]) .textLayer :is(span, br),
[data-theme="light"] .textLayer :is(span, br) {
  color: transparent;
}

/* 同理兜底：批注层的隐藏文本容器依赖 color: transparent，
   容器自身 opacity: 0 不受影响，但恢复显式值以防同类覆盖 */
[data-theme]:not([data-theme="dark"]) .annotationLayer .annotationTextContent,
[data-theme="light"] .annotationLayer .annotationTextContent {
  color: transparent;
}
/**
 * Design Token CSS 变量映射 —— **原始层（--color-* 原始值）**
 * 将 Ant Design 5.0+ Design Tokens 映射为语义化 CSS 变量
 * 用于 CSS Modules 中消除硬编码颜色/间距/圆角
 *
 * 【分层边界 · spec:theme-unification@v1】
 * 本文件 = 原始色层；应用语义层（--text-* / --border-* / --bg-*）的唯一真源是
 * web/src/styles/global.css。本文件不再声明任何应用语义变量，避免同一个名字在两处
 * 定义、且靠 CSS 加载顺序决出胜负。门禁见 tests/theme_styles_contract.test.ts。
 *
 * 使用方式：
 * 1. 在 main.tsx 或 App.tsx 中 import './styles/token.css'
 * 2. 在 CSS Modules 中使用 var(--token-name)
 * 3. 或在组件中使用 Ant Design useToken() hook 获取完整 token 对象
 */

:root {
  /* ===== Color - Primary ===== */
  --color-primary: #1677ff;
  --color-primary-hover: #4096ff;
  --color-primary-active: #0958d9;
  --color-primary-text: #ffffff;

  /* ===== Color - Semantic ===== */
  --color-success: #52c41a;
  --color-success-hover: #73d13d;
  --color-success-active: #389e0d;
  --color-warning: #faad14;
  --color-warning-hover: #ffc53d;
  --color-warning-active: #d48806;
  --color-error: #ff4d4f;
  --color-error-hover: #ff7875;
  --color-error-active: #d9363e;

  /* ===== Color - Neutral / Background ===== */
  --color-bg-base: #ffffff;
  --color-bg-container: #ffffff;
  --color-bg-layout: #f0f2f5;
  --color-bg-elevated: #ffffff;
  --color-bg-mask: rgba(0, 0, 0, 0.45);

  /* ===== Color - Text ===== */
  --color-text: rgba(0, 0, 0, 0.88);
  --color-text-secondary: rgba(0, 0, 0, 0.45);
  --color-text-tertiary: rgba(0, 0, 0, 0.25);
  --color-text-quaternary: rgba(0, 0, 0, 0.15);
  --color-text-inverse: #ffffff;

  /* ===== Color - Border / Divider ===== */
  --color-border: #d9d9d9;
  --color-border-secondary: #f0f0f0;

  /* ===== Color - Control ===== */
  --color-fill: rgba(0, 0, 0, 0.04);
  --color-fill-secondary: rgba(0, 0, 0, 0.06);
  --color-fill-tertiary: rgba(0, 0, 0, 0.08);
  --color-fill-quaternary: rgba(0, 0, 0, 0.12);

  /* ===== Border Radius ===== */
  --border-radius: 6px;
  --border-radius-sm: 4px;
  --border-radius-lg: 8px;
  --border-radius-xl: 12px;

  /* ===== Spacing ===== */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;

  /* ===== Font ===== */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  --font-size: 14px;
  --font-size-sm: 12px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-weight-strong: 600;

  /* ===== Line Height ===== */
  --line-height: 1.5715;
  --line-height-sm: 1.6667;
  --line-height-lg: 1.5;

  /* ===== Shadow ===== */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-2: 0 4px 8px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-3: 0 8px 16px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.04);

  /* ===== Motion ===== */
  --motion-duration-fast: 0.1s;
  --motion-duration-mid: 0.2s;
  --motion-duration-slow: 0.3s;
  --motion-ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
  --motion-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --motion-ease-in: cubic-bezier(0.55, 0.055, 0.675, 0.19);

  /* ===== Z-Index ===== */
  --z-index-popover: 1070;
  --z-index-modal: 1050;
  --z-index-drawer: 1040;
}

/* ===== Dark Theme Override ===== */
[data-theme="dark"] {
  --color-bg-base: #141414;
  --color-bg-container: #1f1f1f;
  --color-bg-layout: #141414;
  --color-bg-elevated: #1f1f1f;
  --color-text: rgba(255, 255, 255, 0.88);
  --color-text-secondary: rgba(255, 255, 255, 0.45);
  --color-text-tertiary: rgba(255, 255, 255, 0.25);
  --color-text-quaternary: rgba(255, 255, 255, 0.15);
  --color-border: #434343;
  --color-border-secondary: #303030;
  --color-fill: rgba(255, 255, 255, 0.06);
  --color-fill-secondary: rgba(255, 255, 255, 0.1);
  --color-fill-tertiary: rgba(255, 255, 255, 0.12);
  --color-fill-quaternary: rgba(255, 255, 255, 0.16);
}

/* ===== 语义化别名 =====
   【边界 · spec:theme-unification@v1】
   本文件只提供 **原始层**（--color-* 原始值）与**不冲突的别名**。
   应用语义层的变量（文字 / 底色 / 边框 / 品牌与状态色）由
   web/src/styles/global.css **唯一定义**，本文件不再重复声明同名变量。

   旧版本在这里写过 --text-primary: var(--color-text)、--border-color: var(--color-border)
   等同名别名，而 token.css 在 main.tsx 里排在 global.css 之后 ⇒ 同特异性下 token.css
   胜出，语义层的实际解析值与 global.css 不同源（code review C1）。
   删除这些别名后，语义变量的解析值只由 global.css 一处决定。

   容器级底色别名（--bg-primary / --bg-secondary / --bg-tertiary / --bg-mask）也一并
   迁到 global.css —— 它们是应用语义层（--bg-*），同样只允许在权威层声明。
   （A 仓 kernel/ui-kit 的同名副本由 sync 脚本产生，属后续同步项，见提交说明。） */
:root {
  /* Interactive */
  --primary-color: var(--color-primary);
  --primary-hover: var(--color-primary-hover);
  --primary-active: var(--color-primary-active);
  --success-color: var(--color-success);
  --warning-color: var(--color-warning);
  --error-color: var(--color-error);

  /* Control */
  --fill-color: var(--color-fill);
  --fill-color-secondary: var(--color-fill-secondary);
  --fill-color-tertiary: var(--color-fill-tertiary);

  /* Radius */
  --radius-sm: var(--border-radius-sm);
  --radius: var(--border-radius);
  --radius-lg: var(--border-radius-lg);
  --radius-xl: var(--border-radius-xl);

  /* Spacing Aliases */
  --space-1: var(--spacing-xs);
  --space-2: var(--spacing-sm);
  --space-3: var(--spacing-md);
  --space-4: var(--spacing-lg);
  --space-5: var(--spacing-xl);
  --space-6: var(--spacing-xxl);
}/**
 * dsw-tokens.css — AI 对话渲染层 Design Token（移植自 deepseek-harness
 * packages/client/ui-theme/src/styles/design-platform.css 的两层架构）
 *
 * 架构（与 harness 一致）：
 *   static（原始色值，仅本文件允许出现 hex/rgba）
 *     → alias（语义 Token，组件与样式表只允许消费这一层）
 *   亮色挂在 :root，暗色由 html[data-theme='dark'] 覆盖（cro-ai 的主题切换
 *   机制与 harness 的 body[data-ds-dark-theme] 同构，见 stores/store.ts）。
 *
 * 值对齐本项目 config/colors.ts 与 global.css 既有亮暗主题，避免视觉跳变。
 * 组件内的 isDark 三元取色一律替换为 var(--dsw-alias-*)。
 */

:root {
  /* ===== static：原始色板（本文件是唯一允许硬编码色值的位置） ===== */
  --dsw-static-brand-light: #60a5fa;
  --dsw-static-brand-dark: #70b0ff;
  --dsw-static-ink-900: #1a2332;
  --dsw-static-ink-600: #5a6a7a;
  --dsw-static-ink-500: #8c939d;
  --dsw-static-ink-400: #bfbfbf;
  --dsw-static-border-l1: #f2f4f6;
  --dsw-static-border-l2: #e8ecf0;
  --dsw-static-border-l3: #d0d7de;
  --dsw-static-bg-code: #f6f8fa;
  --dsw-static-bg-inline-code: #f0f5ff;
  --dsw-static-bg-elevated: #fafbfc;

  /* ===== 公共入口组 / Landing（对齐 ClinAxis AI 官网 A 站；暗色见 [data-theme='dark']） ===== */
  --dsw-static-brand-strong: #3b82f6;
  --dsw-static-brand-dim: rgba(96, 165, 250, 0.06);
  --dsw-static-teal: #0d9488;
  --dsw-static-ink-on-brand: #0b1220;
  --dsw-static-ink-300: #d4d4d4;
  --dsw-static-bg-layout: #f7f8fa;
  --dsw-static-bg-sider: #ffffff;
  --dsw-static-bg-container: #ffffff;
  --dsw-static-bg-hover: #f0f5ff;
  --dsw-static-bg-spotlight: #e6f0ff;
  --dsw-static-bg-input-legacy: #ffffff;
  --dsw-static-menu-selected: #f0f5ff;
  --dsw-static-avatar: #d9d9d9;
  --dsw-static-shadow-window: 0 16px 44px rgba(15, 23, 42, 0.1);
  --dsw-static-header-bg: rgba(255, 255, 255, 0.94);
  --dsw-static-overlay-bg: rgba(15, 23, 42, 0.45);
  --dsw-static-shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  --dsw-static-shadow-modal: 0 24px 70px rgba(0, 0, 0, 0.25);
  --dsw-static-pulse-ring: rgba(96, 165, 250, 0.5);
  --dsw-static-pulse-ring-off: rgba(96, 165, 250, 0);
  --dsw-static-pdf-bg: #ffffff;
  --dsw-static-pdf-ink: #1a1a1a;

  /* 法域实色（与 shared/jurisdictionColors.ts JURISDICTION_COLORS 真源对齐，亮暗同值） */
  --dsw-static-jur-fda-solid: #0958d9;
  --dsw-static-jur-ema-solid: #389e0d;
  --dsw-static-jur-ich-solid: #722ed1;
  --dsw-static-jur-nmpa-solid: #cf1322;
  --dsw-static-jur-who-solid: #d4380d;
  --dsw-static-jur-pics-solid: #08979c;

  /* 法域 chip 三色组（亮值对齐 JURISDICTION_TAG_STYLES，暗值对齐 ..._DARK / 官网 A 站） */
  --dsw-static-jur-fda-bg: #e6f4ff;   --dsw-static-jur-fda-fg: #0958d9;  --dsw-static-jur-fda-bd: #91caff;
  --dsw-static-jur-ema-bg: #f6ffed;   --dsw-static-jur-ema-fg: #389e0d;  --dsw-static-jur-ema-bd: #b7eb8f;
  --dsw-static-jur-ich-bg: #f9f0ff;   --dsw-static-jur-ich-fg: #722ed1;  --dsw-static-jur-ich-bd: #d3adf7;
  --dsw-static-jur-nmpa-bg: #fff1f0;  --dsw-static-jur-nmpa-fg: #cf1322; --dsw-static-jur-nmpa-bd: #ffa39e;
  --dsw-static-jur-who-bg: #fff7e6;   --dsw-static-jur-who-fg: #d4380d;  --dsw-static-jur-who-bd: #ffd591;
  --dsw-static-jur-iso-bg: #e6fffb;   --dsw-static-jur-iso-fg: #08979c;  --dsw-static-jur-iso-bd: #87e8de;
  --dsw-static-jur-multi-bg: #f5f5f5; --dsw-static-jur-multi-fg: #5a6a7a; --dsw-static-jur-multi-bd: #d9d9d9;

  /* Landing 六卡卖点强调色 */
  --dsw-static-accent-magenta: #eb2f96;
  --dsw-static-accent-purple: #722ed1;
  --dsw-static-accent-green: #52c41a;
  --dsw-static-accent-cyan: #13c2c2;

  /* ===== 字体 / 动效（harness base.css 原样移植） ===== */
  --ds-font-family-code: 'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas,
    'Liberation Mono', Menlo, Courier, 'PingFang SC', 'Microsoft YaHei';
  --ds-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ds-transition-duration: 0.15s;

  /* ===== Markdown 字号阶梯 ===== */
  --dsw-markdown-font-size: 14px;
  --dsw-markdown-line-height: 1.8;
  --dsw-markdown-font-size-h2: 16px;
  --dsw-markdown-font-size-h3: 15px;
  --dsw-markdown-font-size-h4: 14px;
  --dsw-markdown-font-size-code: 13px;

  /* ===== alias：语义 Token（组件/样式表唯一入口） ===== */
  /* 文字 */
  --dsw-alias-label-primary: var(--dsw-static-ink-900);
  /* 【批4-⑥】label 三档引用 --text-*（应用的 styles/global.css + stores/themeStore.ts 的
     同一张灰阶表）。原先指 --dsw-static-ink-500/400（#8c939d / #bfbfbf）实测只有
     2.92–1.73:1；static 调色板不动（它还背着 overlay/fill 等非文字角色），
     只把**文字语义 alias** 收到单一真源上。 */
  --dsw-alias-label-secondary: var(--text-secondary);
  --dsw-alias-label-tertiary: var(--text-tertiary);
  --dsw-alias-label-caption: var(--text-quaternary);
  --dsw-alias-label-primary-inverted: #ffffff;

  /* 链接 / 品牌 */
  /* 【批4-⑥】状态色/品牌色在本仓既当文字色也用当实心填充（对比度公式对称，
     一条判据同时管住两种用法），故亮色一律取"在白底/浅带上 ≥4.5"的深档：
     link/business → var(--brand-color)=#1d4ed8 6.31、error #b91c1c 5.63、success #166534 6.20、
     warn #92400e 6.17、brand-secondary #0f766e 4.76。改前实测 #60a5fa 2.21、#ef4444 3.27、
     #16a34a 2.87、#f59e0b 1.87、#0d9488 3.26。暗色侧（#70b0ff/#f87171/#4ade80/#fbbf24/
     #00d4aa）实测 5.19–8.6 达标，保持不动。 */
  --dsw-alias-link: var(--brand-color);
  --dsw-alias-state-business-primary: var(--brand-color);

  /* 边框 */
  --dsw-alias-border-l1: var(--dsw-static-border-l1);
  --dsw-alias-border-l2: var(--dsw-static-border-l2);
  --dsw-alias-border-l3: var(--dsw-static-border-l3);

  /* 背景 */
  --dsw-alias-bg-elevated: var(--dsw-static-bg-elevated);
  /* 消息气泡底色（DSH 扫光动画与之融合；antd v5 暗色算法自动翻转该变量） */
  --dsw-alias-bg-base: var(--ant-color-bg-layout, #f5f5f5);
  /* 面板 / 卡片底色（亮暗双档，组件零 isDark） */
  --dsw-alias-bg-panel: var(--dsw-static-bg-elevated);
  /* 无权限等遮罩层底色（亮暗双档） */
  --dsw-alias-overlay-mask: rgba(255, 255, 255, 0.7);
  /* 输入框底色 */
  --dsw-alias-bg-input: var(--dsw-static-bg-inline-code);
  --dsw-alias-markdown-code-block: var(--dsw-static-bg-code);
  --dsw-alias-markdown-inline-code: var(--dsw-static-bg-inline-code);
  --dsw-alias-markdown-blockquote-bg: rgba(96, 165, 250, 0.05);
  /* 用户气泡品牌底色（A 站方案：纯色品牌蓝 + 深色墨字，亮暗各自翻转） */
  --dsw-alias-bubble-user-bg: var(--dsw-alias-state-business-primary);

  /* 状态色 bg（完整双档，供行高亮/徽标等使用） */
  --dsw-alias-state-success-bg: rgba(82, 196, 26, 0.1);
  --dsw-alias-state-error-bg: rgba(239, 68, 68, 0.05);
  --dsw-alias-state-warn-bg: rgba(250, 173, 20, 0.1);
  /* 选中/激活态底色（手风琴 header 等，淡品牌蓝） */
  --dsw-alias-state-active-bg: #f0f5ff;
  /* 图谱 Canvas 节点标签底色（亮暗双档，供 useThemeColors 读取） */
  --dsw-alias-canvas-label-bg: rgba(255, 255, 255, 0.85);

  /* 引用角标 */
  --dsw-alias-markdown-citation-bg: rgba(96, 165, 250, 0.1);
  --dsw-alias-markdown-citation-bg-hover: rgba(96, 165, 250, 0.22);
  --dsw-alias-markdown-citation-border: rgba(96, 165, 250, 0.4);

  /* 状态色（error / warning / success） */
  --dsw-alias-state-error-primary: #b91c1c;
  --dsw-alias-state-error-bg: rgba(239, 68, 68, 0.05);
  --dsw-alias-state-error-border: rgba(239, 68, 68, 0.18);
  --dsw-alias-state-warn-label: #92400e;
  --dsw-alias-state-warn-bg: rgba(250, 173, 20, 0.1);
  --dsw-alias-state-warn-border: rgba(250, 173, 20, 0.3);
  --dsw-alias-state-success-primary: #166534;
  --dsw-alias-state-warn-tertiary: rgba(96, 165, 250, 0.05);

  /* ===== 思考过程流（ThinkingPanel/ProcessTimeline 专用，值对齐 colors.ts 既有亮暗） ===== */
  --dsw-static-thinking-fill: #f0f0f0;
  --dsw-static-thinking-surface: #ffffff;
  --dsw-static-thinking-surface-lifted: #ffffff;
  --dsw-static-reasoning-primary: #9333ea;
  --dsw-static-reasoning-collapse-end: #faf5ff;

  --dsw-alias-thinking-fill: var(--dsw-static-thinking-fill);
  --dsw-alias-thinking-surface: var(--dsw-static-thinking-surface);
  --dsw-alias-thinking-surface-lifted: var(--dsw-static-thinking-surface-lifted);
  --dsw-alias-reasoning-primary: var(--dsw-static-reasoning-primary);
  --dsw-alias-reasoning-soft: rgba(147, 51, 234, 0.12);
  --dsw-alias-reasoning-hover: rgba(147, 51, 234, 0.08);
  --dsw-alias-reasoning-bg: linear-gradient(135deg, #faf5ff 0%, #f5f0ff 100%);
  --dsw-alias-reasoning-shadow: 0 2px 8px rgba(147, 51, 234, 0.08);
  --dsw-alias-reasoning-collapse-bg: linear-gradient(
    180deg, rgba(250, 245, 255, 0) 0%, var(--dsw-static-reasoning-collapse-end) 100%
  );

  /* ===== 公共入口组 / Landing 别名（暗色经 static 覆盖自动生效；
     例外见下方暗档 —— brand-secondary 是字面量，必须各自标定） ===== */
  --dsw-alias-brand-hover: var(--dsw-static-brand-strong);
  --dsw-alias-brand-dim: var(--dsw-static-brand-dim);
  --dsw-alias-brand-secondary: #0f766e;
  --dsw-alias-label-on-brand: var(--dsw-static-ink-on-brand);
  --dsw-alias-label-disabled: var(--dsw-static-ink-300);
  --dsw-alias-bg-layout: var(--dsw-static-bg-layout);
  --dsw-alias-bg-sider: var(--dsw-static-bg-sider);
  --dsw-alias-bg-container: var(--dsw-static-bg-container);
  --dsw-alias-bg-hover: var(--dsw-static-bg-hover);
  --dsw-alias-bg-spotlight: var(--dsw-static-bg-spotlight);
  --dsw-alias-bg-input-legacy: var(--dsw-static-bg-input-legacy);
  --dsw-alias-menu-selected-bg: var(--dsw-static-menu-selected);
  --dsw-alias-bg-avatar: var(--dsw-static-avatar);
  --dsw-alias-shadow-window: var(--dsw-static-shadow-window);
  --dsw-alias-bg-header: var(--dsw-static-header-bg);
  --dsw-alias-bg-overlay: var(--dsw-static-overlay-bg);
  --dsw-alias-shadow-card: var(--dsw-static-shadow-card);
  --dsw-alias-shadow-modal: var(--dsw-static-shadow-modal);
  --dsw-alias-pulse-ring: var(--dsw-static-pulse-ring);
  --dsw-alias-pulse-ring-off: var(--dsw-static-pulse-ring-off);
  --dsw-alias-pdf-preview-bg: var(--dsw-static-pdf-bg);
  --dsw-alias-pdf-preview-text: var(--dsw-static-pdf-ink);

  --dsw-alias-jur-fda-solid: var(--dsw-static-jur-fda-solid);
  --dsw-alias-jur-ema-solid: var(--dsw-static-jur-ema-solid);
  --dsw-alias-jur-ich-solid: var(--dsw-static-jur-ich-solid);
  --dsw-alias-jur-nmpa-solid: var(--dsw-static-jur-nmpa-solid);
  --dsw-alias-jur-who-solid: var(--dsw-static-jur-who-solid);
  --dsw-alias-jur-pics-solid: var(--dsw-static-jur-pics-solid);

  --dsw-alias-jur-fda-bg: var(--dsw-static-jur-fda-bg);     --dsw-alias-jur-fda-fg: var(--dsw-static-jur-fda-fg);     --dsw-alias-jur-fda-bd: var(--dsw-static-jur-fda-bd);
  --dsw-alias-jur-ema-bg: var(--dsw-static-jur-ema-bg);     --dsw-alias-jur-ema-fg: var(--dsw-static-jur-ema-fg);     --dsw-alias-jur-ema-bd: var(--dsw-static-jur-ema-bd);
  --dsw-alias-jur-ich-bg: var(--dsw-static-jur-ich-bg);     --dsw-alias-jur-ich-fg: var(--dsw-static-jur-ich-fg);     --dsw-alias-jur-ich-bd: var(--dsw-static-jur-ich-bd);
  --dsw-alias-jur-nmpa-bg: var(--dsw-static-jur-nmpa-bg);   --dsw-alias-jur-nmpa-fg: var(--dsw-static-jur-nmpa-fg);   --dsw-alias-jur-nmpa-bd: var(--dsw-static-jur-nmpa-bd);
  --dsw-alias-jur-who-bg: var(--dsw-static-jur-who-bg);     --dsw-alias-jur-who-fg: var(--dsw-static-jur-who-fg);     --dsw-alias-jur-who-bd: var(--dsw-static-jur-who-bd);
  --dsw-alias-jur-iso-bg: var(--dsw-static-jur-iso-bg);     --dsw-alias-jur-iso-fg: var(--dsw-static-jur-iso-fg);     --dsw-alias-jur-iso-bd: var(--dsw-static-jur-iso-bd);
  --dsw-alias-jur-multi-bg: var(--dsw-static-jur-multi-bg); --dsw-alias-jur-multi-fg: var(--dsw-static-jur-multi-fg); --dsw-alias-jur-multi-bd: var(--dsw-static-jur-multi-bd);

  --dsw-alias-accent-magenta: var(--dsw-static-accent-magenta);
  --dsw-alias-accent-purple: var(--dsw-static-accent-purple);
  --dsw-alias-accent-green: var(--dsw-static-accent-green);
  --dsw-alias-accent-cyan: var(--dsw-static-accent-cyan);
}

:root[data-theme='dark'] {
  --dsw-static-ink-900: #e5e5e5;
  --dsw-static-ink-600: #a1a1aa;
  --dsw-static-ink-500: #71717a;
  --dsw-static-ink-400: #52525b;
  --dsw-static-border-l1: #252526;
  --dsw-static-border-l2: #2e2e30;
  --dsw-static-border-l3: #3a3a3e;
  --dsw-static-bg-code: #16161c;
  --dsw-static-bg-inline-code: #252526;
  --dsw-static-bg-elevated: #252526;

  /* ===== 公共入口组 / Landing 暗档（对齐官网 A 站已验证渲染值） ===== */
  --dsw-static-brand-strong: #8ec1ff;
  --dsw-static-brand-dim: rgba(112, 176, 255, 0.12);
  --dsw-static-teal: #00d4aa;
  --dsw-static-ink-300: #3f3f46;
  --dsw-static-bg-layout: #0f0f11;
  --dsw-static-bg-sider: #1a1a1a;
  --dsw-static-bg-container: #1f1f1f;
  --dsw-static-bg-hover: #252526;
  --dsw-static-bg-spotlight: #2a2a2a;
  --dsw-static-bg-input-legacy: #252526;
  --dsw-static-menu-selected: #2a2a3a;
  --dsw-static-avatar: #3a3d42;
  --dsw-static-shadow-window: 0 16px 44px rgba(0, 0, 0, 0.45);
  --dsw-static-header-bg: rgba(26, 26, 26, 0.94);
  --dsw-static-overlay-bg: rgba(0, 0, 0, 0.68);
  --dsw-static-shadow-modal: 0 24px 70px rgba(0, 0, 0, 0.6);
  --dsw-static-pulse-ring: rgba(112, 176, 255, 0.5);
  --dsw-static-pulse-ring-off: rgba(112, 176, 255, 0);

  --dsw-static-jur-fda-bg: #111d33;  --dsw-static-jur-fda-fg: #60a5fa;  --dsw-static-jur-fda-bd: #1e3a5f;
  --dsw-static-jur-ema-bg: #0f1f0f;  --dsw-static-jur-ema-fg: #4ade80;  --dsw-static-jur-ema-bd: #1a3a1a;
  --dsw-static-jur-ich-bg: #1a0f2e;  --dsw-static-jur-ich-fg: #c084fc;  --dsw-static-jur-ich-bd: #2e1a4f;
  --dsw-static-jur-nmpa-bg: #2a0f0f; --dsw-static-jur-nmpa-fg: #f87171; --dsw-static-jur-nmpa-bd: #4a1a1a;
  --dsw-static-jur-who-bg: #2a1a0f;  --dsw-static-jur-who-fg: #fb923c;  --dsw-static-jur-who-bd: #4a2a1a;
  --dsw-static-jur-iso-bg: #0f2a28;  --dsw-static-jur-iso-fg: #2dd4bf;  --dsw-static-jur-iso-bd: #1a3a38;
  --dsw-static-jur-multi-bg: #262626; --dsw-static-jur-multi-fg: #a1a1aa; --dsw-static-jur-multi-bd: #3f3f46;

  --dsw-static-accent-magenta: #f759ab;
  --dsw-static-accent-purple: #b37feb;
  --dsw-static-accent-green: #52c41a;
  --dsw-static-accent-cyan: #36cfc9;

  --dsw-alias-label-primary: var(--dsw-static-ink-900);
  /* 【批4-⑥】label 三档引用 --text-*（应用的 styles/global.css + stores/themeStore.ts 的
     同一张灰阶表）。原先指 --dsw-static-ink-500/400（#8c939d / #bfbfbf）实测只有
     2.92–1.73:1；static 调色板不动（它还背着 overlay/fill 等非文字角色），
     只把**文字语义 alias** 收到单一真源上。 */
  --dsw-alias-label-secondary: var(--text-secondary);
  --dsw-alias-label-tertiary: var(--text-tertiary);
  --dsw-alias-label-caption: var(--text-quaternary);
  /* 反白文字在品牌蓝气泡上亮暗同为白色 */

  --dsw-alias-link: var(--dsw-static-brand-dark);
  --dsw-alias-state-business-primary: var(--dsw-static-brand-dark);
  /* 【批4-⑥】bare :root 的 brand-secondary 是十六进制字面量（为亮色白底标定的深档），
     不像其余几项走 static，所以暗色下不会“自动翻转”——实测 #0f766e 压在 #2a2a2a 上 2.21:1。指回暗档 teal。 */
  --dsw-alias-brand-secondary: var(--dsw-static-teal);

  --dsw-alias-border-l1: var(--dsw-static-border-l1);
  --dsw-alias-border-l2: var(--dsw-static-border-l2);
  --dsw-alias-border-l3: var(--dsw-static-border-l3);

  --dsw-alias-bg-elevated: var(--dsw-static-bg-elevated);
  --dsw-alias-bg-base: var(--ant-color-bg-layout, #141414);
  /* 面板 / 卡片底色（暗档） */
  --dsw-alias-bg-panel: var(--dsw-static-bg-elevated);
  /* 无权限等遮罩层底色（暗档） */
  --dsw-alias-overlay-mask: rgba(31, 31, 31, 0.7);
  /* 输入框底色（暗档） */
  --dsw-alias-bg-input: var(--dsw-static-bg-inline-code);
  --dsw-alias-markdown-code-block: var(--dsw-static-bg-code);
  --dsw-alias-markdown-inline-code: var(--dsw-static-bg-inline-code);
  --dsw-alias-markdown-blockquote-bg: rgba(112, 176, 255, 0.06);

  --dsw-alias-markdown-citation-bg: rgba(112, 176, 255, 0.14);
  --dsw-alias-markdown-citation-bg-hover: rgba(112, 176, 255, 0.28);
  --dsw-alias-markdown-citation-border: rgba(112, 176, 255, 0.35);

  --dsw-alias-state-success-bg: rgba(74, 222, 128, 0.12);
  --dsw-alias-state-error-bg: rgba(248, 113, 113, 0.08);
  --dsw-alias-state-error-primary: #f87171;
  --dsw-alias-state-error-border: rgba(239, 68, 68, 0.25);
  --dsw-alias-state-warn-label: #fbbf24;
  --dsw-alias-state-warn-bg: rgba(250, 173, 20, 0.12);
  --dsw-alias-state-warn-border: rgba(250, 173, 20, 0.35);
  --dsw-alias-state-success-primary: #4ade80;
  --dsw-alias-state-warn-tertiary: rgba(96, 165, 250, 0.08);
  /* 选中/激活态底色（暗档） */
  --dsw-alias-state-active-bg: #252526;
  /* 图谱 Canvas 节点标签底色（暗档） */
  --dsw-alias-canvas-label-bg: rgba(37, 37, 38, 0.85);

  /* ===== 思考过程流（亮暗双档，组件零 isDark 感知） ===== */
  --dsw-static-thinking-fill: #2a2a2e;
  --dsw-static-thinking-surface: #1c1c1e;
  --dsw-static-thinking-surface-lifted: #3a3a3e;
  --dsw-static-reasoning-primary: #9333ea;
  --dsw-static-reasoning-collapse-end: #1e1e22;

  --dsw-alias-thinking-fill: var(--dsw-static-thinking-fill);
  --dsw-alias-thinking-surface: var(--dsw-static-thinking-surface);
  --dsw-alias-thinking-surface-lifted: var(--dsw-static-thinking-surface-lifted);
  --dsw-alias-reasoning-primary: var(--dsw-static-reasoning-primary);
  --dsw-alias-reasoning-soft: rgba(147, 51, 234, 0.12);
  --dsw-alias-reasoning-hover: rgba(147, 51, 234, 0.12);
  --dsw-alias-reasoning-bg: linear-gradient(135deg, rgba(147, 51, 234, 0.08) 0%, rgba(46, 46, 58, 0.6) 100%);
  --dsw-alias-reasoning-shadow: 0 2px 8px rgba(147, 51, 234, 0.15);
  --dsw-alias-reasoning-collapse-bg: linear-gradient(
    180deg, rgba(30, 30, 34, 0) 0%, var(--dsw-static-reasoning-collapse-end) 100%
  );
}
/* ================================================================
   ThinkingPanel 流式 UI 动画 & 样式（v2）
   参考：Vercel AI / LangSmith / Cursor Composer / Claude.ai
   ================================================================ */

/* 与 styles/global.css 的 :root / [data-theme="dark"] 两套灰阶**必须逐字一致**
   （由 tests/theme_tokens.test.ts 钉住）：本文件在 main.tsx 里晚于 global.css 导入，
   同特异性下后者胜，写歪一处就会静默改掉全站底色。 */
:root {
  --text-primary: #1a2332;
  --text-secondary: #4b5563;
  --text-tertiary: #61666b;
  --text-quaternary: #666c74;
  --brand-color: #1d4ed8;
  --status-info: #1d4ed8; /* 批4-⑦：本变量在 deviation 相位标签里当文字色，#60a5fa 白底 2.54:1 */
}

[data-theme="dark"] {
  --text-primary: #e5e5e5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #959aa3;
  --text-quaternary: #909498;
  --brand-color: #70b0ff;
  --status-info: #60a5fa;
}

/* ================= 面板容器 ================= */

/* v5：对齐 DSH turn-process 范式，过程区无卡片外壳（透明/无边框/无阴影），
   直接渲染在消息气泡面上；.dark 类仅保留给审计 Tab 的子选择器挂钩。 */
.thinking-panel {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.thinking-panel.dark {
  border-color: transparent;
  background: transparent;
}
.thinking-panel:hover {
  box-shadow: none;
}
.thinking-panel.dark:hover {
  box-shadow: none;
}

/* ================= 顶栏：三段式布局 ================= */

.thinking-header {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  min-height: 34px;
  gap: 12px;
  border-bottom: 1px solid #F0F0F0;
  transition: background 0.15s ease;
}
.thinking-panel.dark .thinking-header {
  border-color: #2A2A2E;
}
.thinking-header:hover {
  background: #FAFAFA;
}
.thinking-panel.dark .thinking-header:hover {
  background: #222224;
}

/* 左：品牌 */
.thinking-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 110px;
}
.thinking-brand-name {
  font-size: 12px;
  font-weight: 600;
  color: #1a2332;
  letter-spacing: 0.3px;
}
.thinking-panel.dark .thinking-brand-name {
  color: #E5E5E5;
}

/* 中：步骤轨道 */
.thinking-phase-track {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.thinking-phase-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #D4D4D8;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
.thinking-phase-dot.done {
  background: var(--dot-color, var(--brand-color, #70b0ff));
  transform: scale(1);
}
.thinking-phase-dot.active {
  background: var(--dot-color, var(--brand-color, #70b0ff));
  animation: pulse-ring-dot 1.2s ease-in-out infinite;
}
.thinking-phase-dot.pending {
  background: #D4D4D8;
}
.thinking-panel.dark .thinking-phase-dot.pending {
  background: #52525C;
}

@keyframes pulse-ring-dot {
  0%   { box-shadow: 0 0 0 0 var(--dot-color, var(--brand-color, #70b0ff)); }
  70%  { box-shadow: 0 0 0 4px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.thinking-phase-label {
  font-size: 11px;
  color: var(--brand-color);
  font-weight: 500;
  margin-left: 4px;
  white-space: nowrap;
  animation: fade-in-right 0.3s ease;
}
.thinking-panel.dark .thinking-phase-label {
  color: #70b0ff;
}

@keyframes fade-in-right {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* 右：秒表 + Tab + 折叠 */
.thinking-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 秒表 */
.thinking-stopwatch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  color: #737373;
}
.thinking-panel.dark .thinking-stopwatch {
  color: #A3A3A3;
}
.thinking-stopwatch-text {
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Tab 切换样式已随 实时/审计 GxP 双视图 Tab 删除（审计统一走轨迹 tab TrajectoryPanel）；
   折叠按钮 .thinking-chevron 仍被 v5 过程流使用，保留。 */

/* 折叠按钮 */
.thinking-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #737373;
  transition: background 0.15s ease;
}
.thinking-panel.dark .thinking-chevron {
  color: #A3A3A3;
}
.thinking-chevron:hover {
  background: #F0F0F0;
}
.thinking-panel.dark .thinking-chevron:hover {
  background: #2A2A2E;
}

/* ================= 步骤行 ================= */

.timeline-step {
  display: flex;
  gap: 10px;
  position: relative;
  padding-left: 0;
}

.timeline-step + .timeline-step {
  margin-top: 2px;
}

/* 时间线竖线：从第一个点底部到最后一个点顶部 */
.timeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 10px;          /* dot center = dot 左边距(4px) + dot半宽(7px) ≈ 11px */
  top: 22px;           /* dot 底部 */
  bottom: -10px;        /* 延伸到下一个卡片上半区 */
  width: 1px;
  background: #E5E5E5;
  z-index: 0;
}
.thinking-panel.dark .timeline-step:not(:last-child)::after {
  background: #3A3A3E;
}

/* 状态点 */
.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  position: relative;
  z-index: 1;
  background: #D4D4D8;
  border: 2px solid #E5E5E5;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.timeline-dot.completed {
  background: var(--phase-color, #16A34A);
  border-color: var(--phase-color, #16A34A);
  transform: scale(1);
}
.timeline-dot.active {
  background: var(--phase-color, var(--brand-color));
  border-color: var(--phase-color, var(--brand-color));
}

/* active dot pulse-ring */
.timeline-dot.active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--phase-color, var(--brand-color));
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0;   }
}

/* ================= 步骤卡片 ================= */

.step-card {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}
/* completed: 使用阶段底色 */
.timeline-step.completed .step-card {
  background: var(--phase-bg, #F5F5F5);
}
/* active: 更高亮 */
.timeline-step.active .step-card {
  background: var(--phase-bg, #F5F5F5);
  border-color: var(--phase-color, var(--brand-color));
}

/* 标题行 */
.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.step-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #1a2332;
}
.thinking-panel.dark .step-title {
  color: #E5E5E5;
}

/* 耗时标签 */
.step-duration-badge {
  font-size: 10px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  color: var(--text-tertiary);
  background: #F5F5F5;
  padding: 1px 7px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.thinking-panel.dark .step-duration-badge {
  color: #A3A3A3;
  background: #2A2A2E;
}
.step-duration-badge.active {
  color: var(--brand-color);
  background: #F0F7FF;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.thinking-panel.dark .step-duration-badge.active {
  color: #70b0ff;
  background: #1A2A3E;
}

/* 正文 */
.step-content {
  font-size: 11px;
  line-height: 1.55;
  color: #52525B;
  position: relative;
}
.thinking-panel.dark .step-content {
  color: #A3A3A3;
}

/* mask-image 折叠 */
.step-content.masked {
  max-height: 72px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
  cursor: pointer;
}
.step-content.masked:hover {
  -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 75%, transparent 100%);
}

.step-content-line {
  word-break: break-word;
}

/* 进度文本行 */
.step-content-progress {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--brand-color);
  font-size: 11px;
  font-style: italic;
}
.thinking-panel.dark .step-content-progress {
  color: #70b0ff;
}

/* 展开/收起按钮 */
.toggle-expand {
  font-size: 10px;
  color: var(--brand-color);
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 0;
  margin-top: 2px;
  transition: color 0.15s ease;
}
.thinking-panel.dark .toggle-expand {
  color: #70b0ff;
}
.toggle-expand:hover {
  color: #0958D9;
}
.thinking-panel.dark .toggle-expand:hover {
  color: #69B1FF;
}

/* ================= 流式光标（呼吸版） ================= */

.streaming-cursor {
  display: inline-block;
  width: 1ch;
  height: 1.1em;
  vertical-align: text-bottom;
  border-radius: 1px;
  background: linear-gradient(135deg, var(--brand-color), #70b0ff);
  animation: cursor-breathe 1.2s ease-in-out infinite;
}
.streaming-cursor.breath {
  animation: cursor-breathe 1.2s ease-in-out infinite;
}
.thinking-panel.dark .streaming-cursor {
  background: linear-gradient(135deg, #70b0ff, #69B1FF);
}

@keyframes cursor-breathe {
  0%   { opacity: 0.3; transform: scaleX(0.5); }
  50%  { opacity: 1;   transform: scaleX(1);   }
  100% { opacity: 0.3; transform: scaleX(0.5); }
}

/* ================= 思考内容 / 思考行动 实时流 ================= */

.stream-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #737373;
  margin-bottom: 6px;
}
.thinking-panel.dark .stream-section-title {
  color: #A3A3A3;
}

.thinking-text-stream {
  font-size: 13px;
  line-height: 1.7;
  color: #3f3f46;
  background: #FAFAFA;
  border: 1px solid #F0F0F0;
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.thinking-panel.dark .thinking-text-stream {
  color: #D4D4D8;
  background: #1F1F23;
  border-color: #3A3A3E;
}

.action-stream {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-item {
  border: 1px solid #EDEDED;
  border-left: 3px solid var(--brand-color);
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.thinking-panel.dark .action-item {
  background: #25252A;
  border-color: #3A3A3E;
  border-left-color: #70b0ff;
}
.action-item.live {
  border-left-color: #16A34A;
  background: #F7FFF9;
}
.thinking-panel.dark .action-item.live {
  border-left-color: #4ADE80;
  background: #1A241C;
}

.action-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 11px;
}
.action-seq {
  font-weight: 700;
  color: var(--brand-color);
  font-family: monospace;
  min-width: 18px;
}
.thinking-panel.dark .action-seq {
  color: #69B1FF;
}
.action-module {
  font-weight: 600;
  color: #52525B;
}
.thinking-panel.dark .action-module {
  color: #D4D4D8;
}
.action-time {
  margin-left: auto;
  color: #A3A3A3;
  font-family: monospace;
}
.thinking-panel.dark .action-time {
  color: #71717A;
}
.action-content {
  font-size: 13px;
  line-height: 1.6;
  color: #3f3f46;
  white-space: pre-wrap;
  word-break: break-word;
}
.thinking-panel.dark .action-content {
  color: #D4D4D8;
}

/* ================= 合并摘要栏 ================= */

.summary-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  padding: 4px 14px;
  border-radius: 6px;
  background: #F5F5F5;
}
.thinking-panel.dark .summary-bar {
  background: #2A2A2E;
}

.summary-bar-item {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}
.summary-bar-value {
  font-size: 13px;
  font-weight: 700;
  color: #1a2332;
  font-variant-numeric: tabular-nums;
}
.thinking-panel.dark .summary-bar-value {
  color: #E5E5E5;
}
.summary-bar-label {
  font-size: 10px;
  color: #A3A3A3;
  margin-left: 1px;
}
.thinking-panel.dark .summary-bar-label {
  color: #71717A;
}

.summary-bar-divider {
  width: 1px;
  height: 14px;
  background: #E5E5E5;
  flex-shrink: 0;
}
.thinking-panel.dark .summary-bar-divider {
  background: #3A3A3E;
}

/* ================= 进度条 ================= */

.thinking-progress {
  height: 2px;
  margin-top: 8px;
  border-radius: 1px;
  background: #F0F0F0;
  overflow: hidden;
}
.thinking-panel.dark .thinking-progress {
  background: #2A2A2E;
}

.thinking-progress-bar {
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--brand-color), #70b0ff, var(--brand-color));
  background-size: 200% 100%;
  animation: progress-shimmer 1.5s linear infinite;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.thinking-progress-bar.complete {
  background: #16A34A;
  animation: none;
}

@keyframes progress-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ================= 审计视图辅助 ================= */

.stats-panel {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid #F0F0F0;
  background: #FAFAFA;
}
.thinking-panel.dark .stats-panel {
  border-color: #2A2A2E;
  background: #222224;
}

.stats-title {
  font-size: 11px;
  font-weight: 600;
  color: #737373;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.thinking-panel.dark .stats-title {
  color: #A3A3A3;
}

.audit-log-table-wrapper {
  max-height: 200px;
  overflow-y: auto;
  border-radius: 4px;
}

/* ================= prefers-reduced-motion ================= */

@media (prefers-reduced-motion: reduce) {
  .thinking-phase-dot.active,
  .timeline-dot.active::after {
    animation: none;
  }
  .streaming-cursor {
    animation: none;
    opacity: 0.8;
  }
  .thinking-progress-bar:not(.complete) {
    animation: none;
  }
  .thinking-phase-label {
    animation: none;
  }
  .timeline-dot,
  .step-card,
  .thinking-progress-bar {
    transition: none;
  }
}

/* ================= Tp-prefix 工具类（仅用于 ThinkingPanel 内部） ================= */

.tp-flex           { display: flex; }
.tp-flex-col       { flex-direction: column; }
.tp-items-center   { align-items: center; }
.tp-justify-between{ justify-content: space-between; }
.tp-gap-2          { gap: 8px; }
.tp-text-xs        { font-size: 12px; }
.tp-text-sm        { font-size: 14px; }
.tp-mt-2           { margin-top: 8px; }
.tp-mb-2           { margin-bottom: 8px; }
.tp-py-2           { padding-top: 8px; padding-bottom: 8px; }
.tp-px-2           { padding-left: 8px; padding-right: 8px; }
.tp-py-1           { padding-top: 4px; padding-bottom: 4px; }
.tp-font-mono      { font-family: 'SF Mono', 'Fira Code', monospace; }
.tp-font-medium    { font-weight: 500; }
.tp-text-left      { text-align: left; }
.tp-truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-max-w-200      { max-width: 200px; }
.tp-max-h-32       { max-height: 128px; }
.tp-overflow-y-auto{ overflow-y: auto; }
.tp-relative       { position: relative; }
.tp-grid           { display: grid; }
.tp-grid-cols-2    { grid-template-columns: repeat(2, 1fr); }
.tp-w-full         { width: 100%; }
.tp-rounded        { border-radius: 4px; }
.tp-border         { border: 1px solid; }
.tp-transition     { transition: all 0.2s ease; }
.tp-transition-colors { transition: color 0.2s ease; }
.tp-inline-flex    { display: inline-flex; }

/* ================= 🆕 v2.2 动态思考步骤（ThinkingSteps）工具类 ================= */

/* 标准旋转动画（此前 spin-icon 未定义，旋转图标实为静止；此处补标准类） */
@keyframes tpSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.tp-spin { animation: tpSpin 0.9s linear infinite; }

.tp-step-card {
  border: 1px solid;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.tp-step-card.running { border-left-width: 3px; }
.tp-step-card.error   { border-left-width: 3px; }
.tp-step-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tp-step-round {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
}
.tp-step-label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tp-step-status {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tp-step-content {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.tp-step-meta {
  margin-top: 4px;
}
.tp-step-meta summary {
  cursor: pointer;
  font-size: 11px;
  user-select: none;
  outline: none;
}
.tp-step-meta pre {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}

/* ==========================================================================
   DSH 流式过程行（v5，移植自 deepseek-harness 实际源码）
   上游：
   - ui-chat/.../TurnProcessNodeView.module.css  折叠头
   - ui-chat/.../ReasoningRow.module.css         思考行
   - ui-chat/.../GenericCommandCard.module.css   工具行
   - ui-primitives/.../DisclosureRow.module.css  行 chrome
   组件零内联取色：全部走 --dsw-alias-* Token，亮暗由 :root[data-theme] 覆盖。
   ========================================================================== */

/* 过程区容器 */
.dsh-process {
  min-width: 0;
  margin-bottom: 8px;
}

.dsh-flow {
  display: flex;
  flex-direction: column;
}

/* 行节奏：密集行 6px，呼应 DSH 16px flow gap */
.dsh-flow > * + * {
  margin-top: 6px;
}

/* 状态/消息行圆点图标（neutral=caption；warn/error 用语义色） */
.dsh-note-glyph {
  display: inline-block;
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dsw-alias-label-caption);
}
.dsh-note-glyph[data-tone='warn'] {
  background: var(--dsw-alias-state-warn-label);
}
.dsh-note-glyph[data-tone='error'] {
  background: var(--dsw-alias-state-error-primary);
}

/* 生成中占位 */
.dsh-flow-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--dsw-alias-label-tertiary);
}

/* ===== TurnProcessNodeView：折叠头 ===== */
.dsh-toggle {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 33px;
  padding: 0 0 8px;
  border: none;
  border-bottom: 0.5px solid var(--dsw-alias-border-l2);
  background: none;
  color: var(--dsw-alias-label-secondary);
  cursor: pointer;
  text-align: left;
}
.dsh-toggle:not([data-open]) {
  margin-bottom: 8px;
}
.dsh-toggle-label {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dsh-toggle-chevron {
  flex: none;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  color: var(--dsw-alias-label-tertiary);
  transform: rotate(-90deg);
  transition: transform 100ms ease;
}
.dsh-toggle[data-open] .dsh-toggle-chevron {
  transform: rotate(0deg);
}

/* ===== DisclosureRow chrome（思考行/工具行共用） ===== */
.dsh-drow {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
/* 收起态锁死单行高度（同上游 contain: size layout） */
.dsh-drow:not([data-open]) {
  contain: size layout;
  height: 24px;
}
.dsh-drow-row {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  height: 24px;
  min-width: 0;
}
.dsh-drow-row[data-expandable] {
  cursor: pointer;
}
.dsh-drow-leading {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  color: var(--dsw-alias-label-tertiary);
}
.dsh-drow-leading svg {
  width: 14px;
  height: 14px;
}
.dsh-drow-icon-idle {
  display: inline-flex;
  transition: opacity 100ms ease;
}
.dsh-drow-chevron-hover {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  opacity: 0;
  color: var(--dsw-alias-label-secondary);
  transition: opacity 100ms ease;
}
.dsh-drow-row:hover .dsh-drow-icon-idle {
  opacity: 0;
}
.dsh-drow-row:hover .dsh-drow-chevron-hover {
  opacity: 1;
}
.dsh-drow-chevron {
  color: var(--dsw-alias-label-secondary);
}
.dsh-drow-title {
  flex: none;
  font-size: 13px;
  font-weight: 400;
  line-height: 24px;
  color: var(--dsw-alias-label-secondary);
}

/* 运行中行扫光（思考行与工具行共用，动画 2.6s） */
.dsh-drow[data-state='running'] .dsh-drow-row::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 300px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%,
    transparent 100%
  );
  animation: dsh-flow-row-sweep 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes dsh-flow-row-sweep {
  0% { left: -300px; }
  90%, 100% { left: 100%; }
}

/* 标题与摘要之间的 2px 圆点分隔 */
.dsh-sep {
  flex: none;
  width: 2px;
  height: 2px;
  margin: 0 8px;
  border-radius: 1px;
  background: var(--dsw-alias-label-caption);
}

/* 单行摘要（tertiary 层级，超长省略） */
.dsh-summary {
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
  color: var(--dsw-alias-label-tertiary);
  font-size: 13px;
  white-space: nowrap;
}
.dsh-summary-think {
  line-height: 20px;
}
.dsh-summary-tool {
  line-height: 24px;
  text-overflow: ellipsis;
}
.dsh-summary-note {
  line-height: 24px;
  text-overflow: ellipsis;
}
.dsh-summary-note[data-tone='warn'] {
  color: var(--dsw-alias-state-warn-label);
}
.dsh-summary-note[data-tone='error'] {
  color: var(--dsw-alias-state-error-primary);
}
.dsh-summary-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 运行中摘要贴右跟随流式尾部（DSH follow-end：展示最新一行） */
.dsh-summary[data-follow-end] {
  display: flex;
  justify-content: flex-end;
}
.dsh-summary[data-follow-end] .dsh-summary-text {
  flex: 0 0 auto;
  width: max-content;
  min-width: 100%;
  overflow: visible;
  text-align: start;
  text-overflow: clip;
}

/* 错误态摘要/正文 */
.dsh-summary[data-error],
.dsh-cmd-body[data-error] {
  color: var(--dsw-alias-state-error-primary);
}

/* 错误状态圆点（移植 StateDot error：halo + 实心内核） */
.dsh-state-dot {
  position: relative;
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
}
.dsh-state-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.1;
}
.dsh-state-dot::after {
  content: '';
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: currentColor;
}
.dsh-state-dot-error {
  color: var(--dsw-alias-state-error-primary);
}
/* 中断态（dsh stopped/interrupted）：内核收成方块＝停止，弱化 tertiary 色，不扫光 */
.dsh-state-dot-stopped {
  color: var(--dsw-alias-label-tertiary);
}
.dsh-state-dot-stopped::after {
  inset: 25%;
  border-radius: 1px;
}
.dsh-drow[data-state='stopped'] .dsh-drow-title {
  color: var(--dsw-alias-label-tertiary);
}

/* ===== 思考行展开正文（缩进对齐标题，pre-wrap 原文，不用卡片） ===== */
.dsh-think-body {
  padding: 4px 0 4px 22px;
  color: var(--dsw-alias-label-tertiary);
  font-size: 13px;
  line-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== 工具行展开详情（命令结果代码块卡） ===== */
.dsh-cmd-body {
  max-height: 260px;
  margin: 4px 0 4px 4px;
  padding: 12px 16px;
  overflow: auto;
  border: 0.5px solid var(--dsw-alias-border-l1);
  border-radius: 8px;
  background: var(--dsw-alias-markdown-code-block);
  color: var(--dsw-alias-label-primary);
  font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (prefers-reduced-motion: reduce) {
  .dsh-toggle-chevron,
  .dsh-drow-icon-idle,
  .dsh-drow-chevron-hover {
    transition: none;
  }
  .dsh-drow[data-state='running'] .dsh-drow-row::after {
    animation: none;
  }
}
/**
 * AppRail — 合并栏（导航 + 会话历史同栏）样式
 * ============================================================
 * 纪律：只用 design token（--bg-sidebar / --border-color / --text-* /
 * --bg-hover-row / --brand-color / --dsw-alias-menu-selected-bg），
 * 禁止硬编码颜色/字体/圆角（RULE-034/035/036）。
 * 内置回落的 hover/选中值沿用 MainLayout 旧实现所引用的同一批 token，
 * 保证「无槽位注册时渲染结果与改造前等价」（B/C 零回归）。
 */

._rail_o2y3t_11 {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  /* 边框色由宿主注入（--rail-border），缺省走 token */
  border-right: 1px solid var(--rail-border, var(--border-color));
  overflow-y: auto;
  transition: width 0.2s, transform 0.2s;
}

/* ── 品牌段（sidebar.brand 单席；未注册时不渲染，与旧侧栏一致） ───────────── */
._brand_o2y3t_22 {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--rail-border, var(--border-color));
}

._brandCollapsed_o2y3t_33 {
  justify-content: center;
  padding: 10px 0;
}

/* 产品注册方（nav.plugin 的 sidebar.brand.name）用全局类名挂载品牌名 */
.appRailBrandName {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 主操作段（sidebar.action：新建对话，导航之上） ────────────────────────── */
._actions_o2y3t_49 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 4px;
  flex-shrink: 0;
}

._actionsCollapsed_o2y3t_57 {
  padding: 8px 0 4px;
  align-items: center;
}

/* ── 主体：导航（内置回落或 sidebar.nav 槽位）+ 会话段 ───────────────────── */
._body_o2y3t_63 {
  flex: 1;
  padding-top: 12px;
}

/* 有 sidebar.nav / sidebar.sessions 贡献时：导航固定、会话段独立滚动 */
._bodySlotted_o2y3t_69 {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 导航段可被压缩并自身滚动：B 面 12+ 项导航 + 底部四段在矮视口会超出可用高度，
 * 原 `0 0 auto` + bodySlotted 的 overflow:hidden 会把尾部导航项**直接裁掉**且整栏
 * 不出滚动条（.rail 的 overflow-y:auto 永不触发——内容被 .body 隐藏而非撑高）。
 * 改为可压缩 + min-height:0 + 自滚：导航超高时导航段内部滚，会话/底部分不受牵连。 */
._navSlotted_o2y3t_80 {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}

._sessions_o2y3t_68 {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

._footerSlot_o2y3t_94 {
  flex-shrink: 0;
  padding: 4px 8px;
}

/* ── 栏位切换按钮已移到壳层顶栏（MainLayout + RailToggleIcon），本文件不再有 chrome ── */

/* ── 导航项（RailNavItem：内置回落与 sidebar.nav 槽位共用同一视觉） ──────── */
._navItem_o2y3t_102 {
  display: flex;
  align-items: center;
  margin: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

._navItemExpanded_o2y3t_112 {
  /* 行高 32px = 验收规格 ops/shots/plugin-tree-v2/ui-preview.html 板 2 的 .navitem；
   * 合并栏要在 790px 里同时装下 7 项导航与 5 行会话，45px 行高会把会话段挤成内滚条。
   * 只影响槽位模式（RailNavItem）；内置回落导航走 MainLayout 自带行内样式，零回归。 */
  height: 32px;
  padding: 0 12px;
  gap: 10px;
  font-size: 13px;
  justify-content: flex-start;
}

._navItemCollapsed_o2y3t_123 {
  padding: 12px 0;
  gap: 0;
  justify-content: center;
}

._navItemActive_o2y3t_129 {
  background: var(--dsw-alias-menu-selected-bg);
  color: var(--brand-color);
  font-weight: 600;
}

._navItemIdle_o2y3t_135 {
  background: transparent;
  color: var(--text-secondary);
  font-weight: 400;
}

._navItemIdle_o2y3t_135:hover {
  background: var(--bg-hover-row);
}

._navItemDisabled_o2y3t_145 {
  opacity: 0.4;
  cursor: not-allowed;
}

._navIcon_o2y3t_150 {
  font-size: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

._navLabel_o2y3t_157 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

._navDivider_o2y3t_163 {
  margin: 12px 20px;
  height: 1px;
  background: var(--rail-border, var(--border-color));
}
/* FilePanel —— 右侧停靠面板（push/fullscreen 两态），样式取全局 design token */

._panel_q86qh_3 {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 0 0 auto;
  width: min(33vw, 630px); /* 兜底值；实际宽度由 viewStore.rightWidth 内联覆盖 */
  min-width: 320px;
  border-left: 1px solid var(--border-color);
  background: var(--bg-page);
  overflow: hidden;
  transition: width 0.2s ease;
}

/* 拖拽分隔条期间禁用宽度缓动，保证跟手 */
body[data-triview-resizing='1'] ._panel_q86qh_3 {
  transition: none;
}

._panelFullscreen_q86qh_21 {
  position: absolute;
  inset: 0;
  z-index: 30;
  width: 100%;
  min-width: 0;
  border-left: none;
}

/* ===== Tab 条 = 面板整条上边 ===== */
._tabBar_q86qh_31 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  min-width: 0;
}

._chip_q86qh_42 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 180px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

._chip_q86qh_42:hover {
  background: var(--bg-hover);
}

._chipActive_q86qh_66 {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-color);
}

._chipClose_q86qh_72 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

._chipClose_q86qh_72:hover {
  background: var(--bg-spotlight);
  color: var(--text-primary);
}

._spacer_q86qh_88 {
  flex: 1 1 auto;
}

._ctlGroup_q86qh_92 {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* ===== pane 宿主 ===== */
._paneHost_q86qh_100 {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

._scrollPane_q86qh_108 {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-color) transparent;
}

/* ===== 引导页（打开视图） ===== */
._guide_q86qh_117 {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
}

._guideInner_q86qh_127 {
  width: 100%;
  max-width: 560px;
}

._guideTitle_q86qh_132 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

._guideSub_q86qh_139 {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 0 18px;
}

._guideGrid_q86qh_145 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

._card_q86qh_151 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

._card_q86qh_151:hover {
  background: var(--bg-hover);
  border-color: var(--brand-tint-border);
}

._cardDisabled_q86qh_169 {
  opacity: 0.45;
  cursor: not-allowed;
}

._cardDisabled_q86qh_169:hover {
  background: var(--bg-card);
  border-color: var(--border-color);
}

._cardIcon_q86qh_179 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
  font-size: 14px;
  background: var(--accent-glow);
  color: var(--brand-color);
}

._cardBody_q86qh_192 {
  min-width: 0;
}

._cardTitle_q86qh_196 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

._cardDesc_q86qh_205 {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ===== 知识库浏览 ===== */
._kbToolbar_q86qh_212 {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-secondary);
  flex-shrink: 0;
}

._kbList_q86qh_220 {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

._kbItem_q86qh_227 {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
}

._kbItem_q86qh_227:hover {
  background: var(--bg-hover);
}

._kbItemTitle_q86qh_242 {
  font-size: 13px;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

._kbMeta_q86qh_252 {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ===== 会话附件 ===== */
._attToolbar_q86qh_259 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-secondary);
  flex-shrink: 0;
}

/* ===== DOCX 渲染 ===== */
._docxWrap_q86qh_269 {
  padding: 20px 24px;
  max-width: 860px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-primary);
}

._docxWrap_q86qh_269 table {
  border-collapse: collapse;
  width: 100%;
}

._docxWrap_q86qh_269 td,
._docxWrap_q86qh_269 th {
  border: 1px solid var(--border-color);
  padding: 6px 8px;
}
/* Copyright 2014 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:root {
  --react-pdf-annotation-layer: 1;
  --annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>");
  --input-focus-border-color: Highlight;
  --input-focus-outline: 1px solid Canvas;
  --input-unfocused-border-color: transparent;
  --input-disabled-border-color: transparent;
  --input-hover-border-color: black;
  --link-outline: none;
}

@media screen and (forced-colors: active) {
  :root {
    --input-focus-border-color: CanvasText;
    --input-unfocused-border-color: ActiveText;
    --input-disabled-border-color: GrayText;
    --input-hover-border-color: Highlight;
    --link-outline: 1.5px solid LinkText;
  }
  .annotationLayer .textWidgetAnnotation :is(input, textarea):required,
  .annotationLayer .choiceWidgetAnnotation select:required,
  .annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:required {
    outline: 1.5px solid selectedItem;
  }

  .annotationLayer .linkAnnotation:hover {
    backdrop-filter: invert(100%);
  }
}

.annotationLayer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  transform-origin: 0 0;
  z-index: 3;
}

.annotationLayer[data-main-rotation='90'] .norotate {
  transform: rotate(270deg) translateX(-100%);
}
.annotationLayer[data-main-rotation='180'] .norotate {
  transform: rotate(180deg) translate(-100%, -100%);
}
.annotationLayer[data-main-rotation='270'] .norotate {
  transform: rotate(90deg) translateY(-100%);
}

.annotationLayer canvas {
  position: absolute;
  width: 100%;
  height: 100%;
}

.annotationLayer section {
  position: absolute;
  text-align: initial;
  pointer-events: auto;
  box-sizing: border-box;
  margin: 0;
  transform-origin: 0 0;
}

.annotationLayer .linkAnnotation {
  outline: var(--link-outline);
}

.textLayer.selecting ~ .annotationLayer section {
  pointer-events: none;
}

.annotationLayer :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton) > a {
  position: absolute;
  font-size: 1em;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.annotationLayer :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton) > a:hover {
  opacity: 0.2;
  background: rgba(255, 255, 0, 1);
  box-shadow: 0 2px 10px rgba(255, 255, 0, 1);
}

.annotationLayer .textAnnotation img {
  position: absolute;
  cursor: pointer;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.annotationLayer .textWidgetAnnotation :is(input, textarea),
.annotationLayer .choiceWidgetAnnotation select,
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
  background-image: var(--annotation-unfocused-field-background);
  border: 2px solid var(--input-unfocused-border-color);
  box-sizing: border-box;
  font: calc(9px * var(--total-scale-factor)) sans-serif;
  height: 100%;
  margin: 0;
  vertical-align: top;
  width: 100%;
}

.annotationLayer .textWidgetAnnotation :is(input, textarea):required,
.annotationLayer .choiceWidgetAnnotation select:required,
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:required {
  outline: 1.5px solid red;
}

.annotationLayer .choiceWidgetAnnotation select option {
  padding: 0;
}

.annotationLayer .buttonWidgetAnnotation.radioButton input {
  border-radius: 50%;
}

.annotationLayer .textWidgetAnnotation textarea {
  resize: none;
}

.annotationLayer .textWidgetAnnotation :is(input, textarea)[disabled],
.annotationLayer .choiceWidgetAnnotation select[disabled],
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input[disabled] {
  background: none;
  border: 2px solid var(--input-disabled-border-color);
  cursor: not-allowed;
}

.annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
.annotationLayer .choiceWidgetAnnotation select:hover,
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input:hover {
  border: 2px solid var(--input-hover-border-color);
}
.annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
.annotationLayer .choiceWidgetAnnotation select:hover,
.annotationLayer .buttonWidgetAnnotation.checkBox input:hover {
  border-radius: 2px;
}

.annotationLayer .textWidgetAnnotation :is(input, textarea):focus,
.annotationLayer .choiceWidgetAnnotation select:focus {
  background: none;
  border: 2px solid var(--input-focus-border-color);
  border-radius: 2px;
  outline: var(--input-focus-outline);
}

.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) :focus {
  background-image: none;
  background-color: transparent;
}

.annotationLayer .buttonWidgetAnnotation.checkBox :focus {
  border: 2px solid var(--input-focus-border-color);
  border-radius: 2px;
  outline: var(--input-focus-outline);
}

.annotationLayer .buttonWidgetAnnotation.radioButton :focus {
  border: 2px solid var(--input-focus-border-color);
  outline: var(--input-focus-outline);
}

.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after,
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before {
  background-color: CanvasText;
  content: '';
  display: block;
  position: absolute;
}

.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
  height: 80%;
  left: 45%;
  width: 1px;
}

.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before {
  transform: rotate(45deg);
}

.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
  transform: rotate(-45deg);
}

.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before {
  border-radius: 50%;
  height: 50%;
  left: 30%;
  top: 20%;
  width: 50%;
}

.annotationLayer .textWidgetAnnotation input.comb {
  font-family: monospace;
  padding-left: 2px;
  padding-right: 0;
}

.annotationLayer .textWidgetAnnotation input.comb:focus {
  /*
   * Letter spacing is placed on the right side of each character. Hence, the
   * letter spacing of the last character may be placed outside the visible
   * area, causing horizontal scrolling. We avoid this by extending the width
   * when the element has focus and revert this when it loses focus.
   */
  width: 103%;
}

.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
  appearance: none;
}

.annotationLayer .popupTriggerArea {
  height: 100%;
  width: 100%;
}

.annotationLayer .fileAttachmentAnnotation .popupTriggerArea {
  position: absolute;
}

.annotationLayer .popupWrapper {
  position: absolute;
  font-size: calc(9px * var(--total-scale-factor));
  width: 100%;
  min-width: calc(180px * var(--total-scale-factor));
  pointer-events: none;
}

.annotationLayer .popup {
  position: absolute;
  max-width: calc(180px * var(--total-scale-factor));
  background-color: rgba(255, 255, 153, 1);
  box-shadow: 0 calc(2px * var(--total-scale-factor)) calc(5px * var(--total-scale-factor))
    rgba(136, 136, 136, 1);
  border-radius: calc(2px * var(--total-scale-factor));
  padding: calc(6px * var(--total-scale-factor));
  margin-left: calc(5px * var(--total-scale-factor));
  cursor: pointer;
  font: message-box;
  white-space: normal;
  word-wrap: break-word;
  pointer-events: auto;
}

.annotationLayer .popup > * {
  font-size: calc(9px * var(--total-scale-factor));
}

.annotationLayer .popup h1 {
  display: inline-block;
}

.annotationLayer .popupDate {
  display: inline-block;
  margin-left: calc(5px * var(--total-scale-factor));
}

.annotationLayer .popupContent {
  border-top: 1px solid rgba(51, 51, 51, 1);
  margin-top: calc(2px * var(--total-scale-factor));
  padding-top: calc(2px * var(--total-scale-factor));
}

.annotationLayer .richText > * {
  white-space: pre-wrap;
  font-size: calc(9px * var(--total-scale-factor));
}

.annotationLayer .highlightAnnotation,
.annotationLayer .underlineAnnotation,
.annotationLayer .squigglyAnnotation,
.annotationLayer .strikeoutAnnotation,
.annotationLayer .freeTextAnnotation,
.annotationLayer .lineAnnotation svg line,
.annotationLayer .squareAnnotation svg rect,
.annotationLayer .circleAnnotation svg ellipse,
.annotationLayer .polylineAnnotation svg polyline,
.annotationLayer .polygonAnnotation svg polygon,
.annotationLayer .caretAnnotation,
.annotationLayer .inkAnnotation svg polyline,
.annotationLayer .stampAnnotation,
.annotationLayer .fileAttachmentAnnotation {
  cursor: pointer;
}

.annotationLayer section svg {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.annotationLayer .annotationTextContent {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  color: transparent;
  user-select: none;
  pointer-events: none;
}

.annotationLayer .annotationTextContent span {
  width: 100%;
  display: inline-block;
}
/* Copyright 2014 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:root {
  --react-pdf-text-layer: 1;
}

[data-main-rotation='90'] {
  transform: rotate(90deg) translateY(-100%);
}
[data-main-rotation='180'] {
  transform: rotate(180deg) translate(-100%, -100%);
}
[data-main-rotation='270'] {
  transform: rotate(270deg) translateX(-100%);
}

.textLayer {
  color-scheme: only light;

  position: absolute;
  text-align: initial;
  inset: 0;
  overflow: clip;
  opacity: 1;
  line-height: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  caret-color: CanvasText;
  z-index: 0;

  /* We multiply the font size by --min-font-size, and then scale the text
   * elements by 1/--min-font-size. This allows us to effectively ignore the
   * minimum font size enforced by the browser, so that the text layer <span>s
   * can always match the size of the text in the canvas. */
  --min-font-size: 1;
  --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
  --min-font-size-inv: calc(1 / var(--min-font-size));
}

.textLayer :is(span, br) {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  margin: 0;
  transform-origin: 0 0;
}

.textLayer > :not(.markedContent),
.textLayer .markedContent span:not(.markedContent) {
  z-index: 1;

  --font-height: 0; /* set by text_layer.js */
  font-size: calc(var(--text-scale-factor) * var(--font-height));

  --scale-x: 1;
  --rotate: 0deg;
  transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
}

.textLayer .markedContent {
  display: contents;
}

.textLayer span[role='img'] {
  user-select: none;
  cursor: default;
}

.textLayer .highlight {
  --highlight-bg-color: rgb(180 0 170 / 0.25);
  --highlight-selected-bg-color: rgb(0 100 0 / 0.25);
  --highlight-backdrop-filter: none;
  --highlight-selected-backdrop-filter: none;

  margin: -1px;
  padding: 1px;
  background-color: var(--highlight-bg-color);
  backdrop-filter: var(--highlight-backdrop-filter);
  border-radius: 4px;
}

@media screen and (forced-colors: active) {
  .textLayer .highlight {
    --highlight-bg-color: Highlight;
    --highlight-selected-bg-color: ButtonText;
  }
}

.textLayer .highlight.appended {
  position: initial;
}

.textLayer .highlight.begin {
  border-radius: 4px 0 0 4px;
}

.textLayer .highlight.end {
  border-radius: 0 4px 4px 0;
}

.textLayer .highlight.middle {
  border-radius: 0;
}

.textLayer .highlight.selected {
  background-color: var(--highlight-selected-bg-color);
  backdrop-filter: var(--highlight-selected-backdrop-filter);
}

.textLayer ::selection {
  background: rgba(0 0 255 / 0.25);
}

@supports (background: color-mix(in srgb, AccentColor, transparent 75%)) {
  .textLayer ::selection {
    background: color-mix(in srgb, AccentColor, transparent 75%);
  }
}

/* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
.textLayer br::selection {
  background: transparent;
}

.textLayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: 0;
  cursor: default;
  user-select: none;
}

.textLayer.selecting .endOfContent {
  top: 0;
}

.hiddenCanvasElement {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  display: none;
}
