/* ══════════════════════════════════════════════════════════════════
   设计令牌（双主题）：浅色「精致版」为默认；<html data-theme="dark"> 切深色「科技版」。
   两套主题必须定义同名变量全集（tests/ui.test.ts 双主题契约测试守护）。
   ══════════════════════════════════════════════════════════════════ */
:root, [data-theme="light"] {
  /* 布局：对话内容与输入区共用同一宽度，保证左右边缘对齐。 */
  --chat-width: 860px;
  /* 字阶（8 停，系统栈）与圆角阶（6 停）：两主题共用同一组尺寸 token，尺寸不随主题漂移。 */
  --fs-caption: 11px;
  --fs-small: 12px;
  --fs-body: 13px;
  --fs-lead: 14px;
  --fs-strong: 15px;
  --fs-title: 18px;
  --fs-display: 22px;
  --fs-hero: 34px;
  --radius-xs: 4px;
  --radius-s: 6px;
  --radius-m: 8px;
  --radius-l: 10px;
  --radius-xl: 14px;
  --radius-full: 999px;
  /* 表面 */
  --bg: #f1f4f8;
  --body-bg: linear-gradient(180deg, #e9f0fa 0%, #dfe6f2 100%);
  /* 背景光晕层：body::before/::after 双层反向漂移的渐变，勿用于组件。 */
  --body-aurora-a: radial-gradient(46vw 42vh at 22% 18%, rgba(80, 126, 220, 0.44), rgba(80, 126, 220, 0) 100%),
    radial-gradient(40vw 36vh at 80% 16%, rgba(34, 184, 207, 0.38), rgba(34, 184, 207, 0) 100%);
  --body-aurora-b: radial-gradient(48vw 42vh at 50% 90%, rgba(156, 122, 224, 0.3), rgba(156, 122, 224, 0) 100%),
    radial-gradient(30vw 28vh at 66% 56%, rgba(240, 178, 122, 0.14), rgba(240, 178, 122, 0) 100%);
  --workbench-bg: transparent;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --panel-3: #eef2f7;
  --border: #dde2ea;
  --border-soft: #e9edf3;
  --border-strong: #cfd6e0;
  --overlay: rgba(20, 28, 42, 0.44);
  /* 文字（次级三档在全部表面上按 WCAG 校准：text-3≈6.0、muted≥4.5、faint≈4.0@panel） */
  --text: #1a2433;
  --text-2: #41505f;
  --text-3: #566473;
  --muted: #5f6d83;
  --faint: #75808e;
  --on-accent: #ffffff;
  /* 主色 */
  --accent: #2457c5;
  --accent-2: #2457c5;
  --accent-deep: #174a9d;
  --accent-hover: #1d469e;
  --accent-soft: #e9f0fc;
  --accent-soft-border: #8ba8de;
  --accent-soft-hover: #dce7f9;
  --accent-gradient: linear-gradient(90deg, #2457c5 0%, #3d85f8 100%);
  --focus-ring: #b9cdf8;
  --focus-border: #507edc;
  /* 语义色 */
  --ok: #1d7a4a;
  --ok-deep: #12643b;
  --ok-border: #9fceb5;
  --ok-bg: #edf8f1;
  --ok-accent: #2a8253;
  --ok-text: #245d40;
  --warn: #e0a53d;
  --warn-text: #8a5a00;
  --warn-border: #e0bb6d;
  --warn-bg: #fff8e5;
  --warn-note: #7b5a14;
  --danger: #c73b3b;
  --danger-btn: #c64b45;
  --danger-btn-hover: #b13f39;
  --danger-btn-border: #a93a35;
  --error-text: #952e2a;
  --error-border: #e5b5b0;
  --error-bg: #fff0f0;
  --error-bg-2: #fff7f6;
  --risk-high-text: #a62929;
  --risk-high-border: #e1aaaa;
  --badge-approved: #6ea8ff;
  /* 批注调色板（v0.4.4，案例批注模式）：RGB 逗号分隔（rgba(var(--anno-cN), α) 的合法前提——
     空格分量配逗号透明度是非法混合语法，整条声明会被丢弃），同一批注的文档高亮/图片标记/卡片色条/连线共用一色。 */
  --anno-c1: 176, 116, 4;    /* 琥珀 */
  --anno-c2: 36, 100, 205;   /* 蓝 */
  --anno-c3: 190, 52, 168;   /* 品红 */
  --anno-c4: 13, 128, 86;    /* 绿 */
  --anno-c5: 116, 74, 205;   /* 紫 */
  /* 侧栏（单轨外壳）/ 导航：顶栏已撤，侧栏是唯一 chrome */
  --rail-width: 56px;
  --brand-mark: linear-gradient(135deg, #4f8cff, #22d3ee);
  --sidebar-bg: rgba(245, 247, 250, 0.45);
  --sidebar-border: #e2e7ee;
  /* 右侧审批栏：半透明实底，配合外壳毛玻璃透出背景光晕。 */
  --records-bg: rgba(247, 249, 252, 0.55);
  --nav-text: #3b4757;
  --nav-hover-bg: #e9edf3;
  --nav-active-bg: #ffffff;
  --nav-active-text: #183f91;
  --nav-active-bar: #2457c5;
  --nav-count: #b4362e;
  --sessions-border: #e2e7ee;
  --settings-text: #4f5a67;
  /* 表格 */
  --th-bg: #f3f5f8;
  --th-text: #5f6d83;
  --row-hover: #f6f9fd;
  /* 聊天 */
  --user: #e4ecff;
  /* 业务杂项 */
  --draft-locked-bg: #fdf8ee;
  --draft-locked-border: #e5c99b;
  --draft-locked-text: #8a7440;
  --timeline-rail: #d0d7e0;
  --mark-text: #4c5866;
  --source-crm: #27589f;
  --source-crm-border: #6f9cdd;
  --source-ones: #246440;
  --source-ones-border: #77b18f;
  --source-hemory: #76501f;
  --source-hemory-border: #c49b63;
  --empty-bg: #fafbfc;
  --gray-btn: #e6eaf0;
  --gray-btn-hover: #d7dde6;
  /* sticky 操作条（毛玻璃底） */
  --bar-bg: rgba(255, 255, 255, 0.88);
  /* 阴影与滚动条 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-s: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px rgba(16, 24, 40, 0.06);
  --shadow-m: 0 2px 6px rgba(16, 24, 40, 0.06), 0 10px 26px rgba(16, 24, 40, 0.09);
  --shadow-l: 0 16px 48px rgba(16, 24, 40, 0.18);
  --scrollbar: #c3cad5;
}

[data-theme="dark"] {
  /* 布局：对话内容与输入区共用同一宽度，保证左右边缘对齐。 */
  --chat-width: 860px;
  /* 字阶与圆角阶：与浅色主题同值（尺寸不随主题漂移，双主题契约要求同名全集）。 */
  --fs-caption: 11px;
  --fs-small: 12px;
  --fs-body: 13px;
  --fs-lead: 14px;
  --fs-strong: 15px;
  --fs-title: 18px;
  --fs-display: 22px;
  --fs-hero: 34px;
  --radius-xs: 4px;
  --radius-s: 6px;
  --radius-m: 8px;
  --radius-l: 10px;
  --radius-xl: 14px;
  --radius-full: 999px;
  /* 表面 */
  --bg: #0a1120;
  --body-bg: linear-gradient(180deg, #0a1120 0%, #101a3a 100%);
  /* 背景光晕层：body::before/::after 双层反向漂移的渐变（原静态霓虹晕迁入 + 居中紫晕），勿用于组件。 */
  --body-aurora-a: radial-gradient(46vw 44vh at 74% 10%, rgba(34, 211, 238, 0.48), rgba(34, 211, 238, 0) 100%),
    radial-gradient(44vw 42vh at 16% 88%, rgba(79, 140, 255, 0.52), rgba(79, 140, 255, 0) 100%);
  --body-aurora-b: radial-gradient(48vw 42vh at 50% 48%, rgba(139, 92, 246, 0.4), rgba(139, 92, 246, 0) 100%),
    radial-gradient(34vw 32vh at 24% 52%, rgba(34, 211, 238, 0.22), rgba(34, 211, 238, 0) 100%);
  --workbench-bg: transparent;
  --panel: #101a2e;
  --panel-2: #15213a;
  --panel-3: #1a2742;
  --border: rgba(148, 163, 184, 0.24);
  --border-soft: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.34);
  --overlay: rgba(3, 7, 16, 0.62);
  /* 文字 */
  --text: #e7edf7;
  --text-2: #bcc8da;
  --text-3: #97a4ba;
  --muted: #8d99af;
  --faint: #7e8ba3;
  --on-accent: #ffffff;
  /* 主色：青→蓝霓虹 */
  --accent: #4f8cff;
  --accent-2: #22d3ee;
  --accent-deep: #93bdff;
  --accent-hover: #3d78f0;
  --accent-soft: rgba(79, 140, 255, 0.16);
  --accent-soft-border: rgba(99, 156, 255, 0.5);
  --accent-soft-hover: rgba(79, 140, 255, 0.26);
  --accent-gradient: linear-gradient(90deg, #22d3ee 0%, #4f8cff 100%);
  --focus-ring: rgba(99, 156, 255, 0.45);
  --focus-border: #4f8cff;
  /* 语义色（暗色变体） */
  --ok: #34c47c;
  --ok-deep: #6fd3a2;
  --ok-border: rgba(52, 196, 124, 0.4);
  --ok-bg: rgba(52, 196, 124, 0.12);
  --ok-accent: #3fce8d;
  --ok-text: #7fd8ab;
  --warn: #e0a53d;
  --warn-text: #efc26a;
  --warn-border: rgba(224, 165, 61, 0.42);
  --warn-bg: rgba(224, 165, 61, 0.12);
  --warn-note: #efc26a;
  --danger: #e5534b;
  --danger-btn: #d5493f;
  --danger-btn-hover: #b93a32;
  --danger-btn-border: #e5534b;
  --error-text: #ff9d94;
  --error-border: rgba(229, 83, 75, 0.42);
  --error-bg: rgba(229, 83, 75, 0.12);
  --error-bg-2: rgba(229, 83, 75, 0.17);
  --risk-high-text: #ff8a80;
  --risk-high-border: rgba(229, 83, 75, 0.5);
  --badge-approved: #7fb2ff;
  /* 批注调色板（暗色更亮变体）：RGB 逗号分隔（同浅色主题注释）。 */
  --anno-c1: 240, 170, 48;   /* 琥珀 */
  --anno-c2: 96, 156, 250;   /* 蓝 */
  --anno-c3: 232, 106, 212;  /* 品红 */
  --anno-c4: 70, 200, 140;   /* 绿 */
  --anno-c5: 172, 128, 250;  /* 紫 */
  /* 侧栏（单轨外壳）/ 导航：顶栏已撤，侧栏是唯一 chrome */
  --rail-width: 56px;
  --brand-mark: linear-gradient(135deg, #22d3ee, #4f8cff);
  --sidebar-bg: rgba(11, 18, 34, 0.45);
  --sidebar-border: rgba(148, 163, 184, 0.16);
  /* 右侧审批栏：半透明实底，配合外壳毛玻璃透出背景光晕。 */
  --records-bg: rgba(21, 33, 58, 0.55);
  --nav-text: #a9b6cb;
  --nav-hover-bg: rgba(148, 163, 184, 0.12);
  --nav-active-bg: rgba(79, 140, 255, 0.18);
  --nav-active-text: #cfe1ff;
  --nav-active-bar: #22d3ee;
  --nav-count: #ff9d94;
  --sessions-border: rgba(148, 163, 184, 0.16);
  --settings-text: #a9b6cb;
  /* 表格 */
  --th-bg: #14203a;
  --th-text: #97a4ba;
  --row-hover: rgba(79, 140, 255, 0.08);
  /* 聊天 */
  --user: #1d2f52;
  /* 业务杂项 */
  --draft-locked-bg: rgba(224, 165, 61, 0.1);
  --draft-locked-border: rgba(224, 165, 61, 0.38);
  --draft-locked-text: #efc26a;
  --timeline-rail: rgba(148, 163, 184, 0.28);
  --mark-text: #97a4ba;
  --source-crm: #86b1f5;
  --source-crm-border: rgba(111, 156, 221, 0.55);
  --source-ones: #7cc79c;
  --source-ones-border: rgba(119, 177, 143, 0.55);
  --source-hemory: #d3a86e;
  --source-hemory-border: rgba(196, 155, 99, 0.55);
  --empty-bg: rgba(148, 163, 184, 0.05);
  --gray-btn: rgba(148, 163, 184, 0.16);
  --gray-btn-hover: rgba(148, 163, 184, 0.26);
  /* sticky 操作条（毛玻璃底） */
  --bar-bg: rgba(13, 21, 38, 0.82);
  /* 阴影与滚动条 */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.26);
  --shadow-m: 0 2px 8px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.34);
  --shadow-l: 0 20px 56px rgba(0, 0, 0, 0.5);
  --scrollbar: rgba(148, 163, 184, 0.32);
}

* { box-sizing: border-box; }

/* 滚动条：全局细化、按主题着色（纯装饰，不改变滚动行为）。 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: var(--radius-s); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--body-bg);
  background-attachment: fixed;
  color: var(--text);
  font: var(--fs-strong)/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* 背景光晕层：::before/::after 双层反向漂移+错相呼吸——刚性平移柔和色洗人眼无法察觉，
   双层相对运动让固定点的色相随时间持续变化，才是可感知的流动；
   inset 过扫保证漂移/旋转不露底；只动 transform/opacity，合成器合成不触发重绘；
   reduced-motion 下由文末全局降级规则收敛为静态。 */
body::before, body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background: var(--body-aurora-a);
  animation: bg-aurora-drift 14s ease-in-out infinite alternate, bg-aurora-breathe 8s ease-in-out infinite alternate;
}
body::after {
  background: var(--body-aurora-b);
  animation: bg-aurora-drift-b 19s ease-in-out infinite alternate, bg-aurora-breathe-b 11s ease-in-out infinite alternate;
}
@keyframes bg-aurora-drift {
  from { transform: translate3d(-12%, -7%, 0) rotate(-2.5deg) scale(1); }
  to { transform: translate3d(12%, 7%, 0) rotate(2.5deg) scale(1.08); }
}
@keyframes bg-aurora-drift-b {
  from { transform: translate3d(5%, -9%, 0) rotate(2deg) scale(1.06); }
  to { transform: translate3d(-5%, 9%, 0) rotate(-2deg) scale(1); }
}
@keyframes bg-aurora-breathe {
  from { opacity: 0.5; }
  to { opacity: 1; }
}
@keyframes bg-aurora-breathe-b {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

/* 微动效：视图/面板入场（.hidden 移除时触发一次），180–220ms，绝不遮挡交互。 */
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.workbench-view:not(.hidden), .agent-mode-panel:not(.hidden), .modal-box { animation: view-in 0.22s ease; }

/* 旧进程横幅：页面（磁盘实时）比服务进程（内存定格）新时置顶常亮，恢复一致自动消隐。 */
.build-stale-banner { padding: 9px 18px; background: var(--error-bg); border-bottom: 1px solid var(--risk-high-border); color: var(--error-text); font-size: var(--fs-body); overflow-wrap: anywhere; }

/* 密码管理器吸收位：离屏但保持渲染态（display:none/visibility:hidden 会被浏览器自动填充跳过），
   位置/尺寸/透明度三重压缩保证不可见且不可聚焦（tabindex=-1 兜底）。 */
.autofill-decoy { position: absolute; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* ── 单轨外壳：顶栏已撤，品牌冠成为侧栏第一行；折叠后仅留渐变方标，冠行纵排。 ── */
.sidebar-crown { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 12px; }

.brand { font-weight: 650; font-size: var(--fs-strong); display: flex; align-items: center; gap: 9px; min-width: 0; white-space: nowrap; }
.brand::before { content: ''; flex: none; width: 9px; height: 9px; border-radius: var(--radius-xs); background: var(--brand-mark); }

.sidebar-toggle {
  flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-s); background: transparent; color: var(--muted); cursor: pointer; padding: 0;
  transition: background 0.16s ease, color 0.16s ease;
}
.sidebar-toggle:hover { background: var(--nav-hover-bg); color: var(--text); }
.sidebar-toggle svg { transition: transform 0.22s ease; }
#sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.icon-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-m);
  padding: 5px 10px;
  cursor: pointer;
  font-size: var(--fs-strong);
}
.icon-btn:hover { border-color: var(--accent); }

.status { display: flex; align-items: center; gap: 7px; color: var(--nav-text); font-size: var(--fs-body); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.status.warn .dot { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

main { flex: 1; overflow-y: auto; padding: 14px 18px; min-width: 0; }
/* Agent 对话中栏：tab 条 + 内容滚动区 + 钉底输入条，三块竖向区域各自延伸到窗口底部。 */
#chat { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
#chat .agent-mode-tabs { flex: 0 0 auto; }
/* 面板自己承担内容内边距（#chat 已清零 padding，让 tabs 与输入条铺满中栏）。 */
#chat .agent-mode-panel { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 14px 18px; }

.layout { flex: 1; display: flex; min-height: 0; }

#sidebar {
  width: 220px;
  flex: 0 0 220px;
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 12px;
  min-height: 0;
  transition: width 0.22s ease, flex-basis 0.22s ease;
}

/* 折叠态：图标窄轨。文字标签用视觉隐藏（非 display:none）保住按钮可访问名；
   count 角标绝对定位到图标右上成小圆徽；会话列表/头像文字/齿轮让位给纯导航。 */
#sidebar.collapsed { width: var(--rail-width); flex-basis: var(--rail-width); padding: 12px 6px; }
#sidebar.collapsed .sidebar-crown { flex-direction: column; justify-content: center; gap: 10px; padding: 2px 0 12px; }
#sidebar.collapsed .brand { justify-content: center; }
#sidebar.collapsed .brand-name,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .status .text,
#sidebar.collapsed .sync-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
#sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
#sidebar.collapsed .nav-count {
  position: absolute; top: 3px; right: 3px; margin: 0; min-width: 15px; height: 15px;
  line-height: 15px; padding: 0 4px; border-radius: var(--radius-full);
  background: var(--accent-soft); color: var(--accent-deep); font-size: var(--fs-caption);
}
#sidebar.collapsed .agent-sessions { display: none; }
#sidebar.collapsed .avatar-text, #sidebar.collapsed .avatar-gear { display: none; }
#sidebar.collapsed .avatar-entry { justify-content: center; }
#sidebar.collapsed .sidebar-foot { align-items: center; padding-left: 0; padding-right: 0; }
#sidebar.collapsed .sidebar-foot .sync-command { justify-content: center; padding: 0 6px; }

/* 底部状态条：原顶栏「同步数据」+ 连接状态迁入侧栏脚（VS Code 状态栏式），头像区之上。 */
.sidebar-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 4px 2px; border-top: 1px solid var(--sessions-border); }
.sidebar-foot .sync-command {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 8px;
  font-size: var(--fs-small); color: var(--nav-text); white-space: nowrap;
}
.sidebar-foot .sync-command:hover { color: var(--text); }
.sidebar-foot .sync-command svg { flex: none; }

/* 侧栏滚槽位常态隐藏（width:none），悬浮时才出现；hover 时滚动条被限定到
   #sidebar 右侧 8px 垫区内，内容永不被遮挡。垫区挂 .sidebar-top 自身（不被移动端
   720px 断点的 #sidebar { padding: 6px } 覆盖）。 */
.sidebar-top { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: none; padding-right: 8px; }
.sidebar-top:hover { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }

#records {
  width: 280px;
  flex: 0 0 280px;
  border-left: 1px solid var(--border);
  background: var(--records-bg);
  padding: 12px;
  overflow-y: auto;
}

.panel-head { font-weight: 650; font-size: var(--fs-strong); margin-bottom: 10px; }
.panel-head .count { color: var(--muted); font-weight: 400; margin-left: 6px; }

.new-session {
  width: 100%;
  padding: 9px;
  border-radius: var(--radius-m);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-lead);
  margin-bottom: 10px;
}
.new-session:hover { border-color: var(--accent); color: var(--accent); }

.session-item {
  padding: 8px 10px;
  border-radius: var(--radius-m);
  cursor: pointer;
  font-size: var(--fs-body);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}
.session-item:hover { background: var(--panel-2); }
.session-item.active { background: var(--panel-2); border: 1px solid var(--accent); }
.session-item .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .ops { display: none; gap: 4px; }
.session-item:hover .ops { display: flex; }
.session-item .ops button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-small);
  padding: 1px 4px;
}
.session-item .ops button:hover { color: var(--text); }
.session-item .ops .del:hover { color: var(--danger); }
.session-item .ops .arc:hover { color: var(--accent); }
.session-item .ops .sh:hover { color: var(--accent); }

/* archived sessions fold */
.archived-toggle {
  width: 100%;
  margin-top: 8px;
  padding: 6px 10px;
  border: none;
  border-top: 1px dashed var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-body);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.archived-toggle:hover { color: var(--text); }
.archived-list { display: flex; flex-direction: column; }
.session-item.archived .t { color: var(--muted); }

/* conversation toolbar (share) */
#conversationOps { display: flex; justify-content: flex-end; gap: 8px; margin: -4px auto 10px; max-width: var(--chat-width); padding: 0 4px; }
#conversationOps button { font-size: var(--fs-small); }

.hidden { display: none !important; }

.record-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--panel);
  cursor: pointer;
}
.record-item:hover { border-color: var(--accent); }
.record-item .r-title { font-size: var(--fs-body); font-weight: 600; margin-bottom: 2px; }
.record-item .r-meta { font-size: var(--fs-small); color: var(--muted); }
.record-item .badges { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.badge { font-size: var(--fs-caption); padding: 1px 7px; border-radius: var(--radius-full); border: 1px solid var(--border); color: var(--muted); }
.badge.type { color: var(--accent); }
.badge.status-draft { color: var(--warn); }
.badge.status-approved { color: var(--badge-approved); }
.badge.status-written { color: var(--ok); }
.badge.status-rejected { color: var(--danger); }
.empty { color: var(--muted); font-size: var(--fs-body); text-align: center; margin-top: 18px; }

#recordFields {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 12px;
  overflow: auto;
  max-height: 60vh;
  font-size: var(--fs-body);
  white-space: pre-wrap;
  word-break: break-word;
}
.record-meta { color: var(--muted); font-size: var(--fs-body); margin-bottom: 10px; }

#messages { max-width: var(--chat-width); margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }

.msg { max-width: 78%; padding: 9px 13px; border-radius: var(--radius-l); white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border-bottom-left-radius: 4px; border: 1px solid var(--border-soft); }
.msg.system { align-self: center; font-size: var(--fs-body); color: var(--muted); max-width: 90%; }

/* 助手消息 markdown（.msg-md）：覆盖 .msg 的 pre-wrap 恢复常规排版，代码块内恢复 pre；
   字号/圆角全走 token（显示契约禁组件层裸 px 字号/圆角）。 */
.msg .msg-md { white-space: normal; min-width: 0; }
.msg .msg-md > :first-child { margin-top: 0; }
.msg .msg-md > :last-child { margin-bottom: 0; }
.msg-md p { margin: 0 0 8px; }
/* 标题降噪（Codex 同款「不放大只强调」）：聊天里标题仅加粗，不做文档级大字。 */
.msg-md h1, .msg-md h2, .msg-md h3, .msg-md h4, .msg-md h5, .msg-md h6 { margin: 10px 0 6px; font-weight: 600; line-height: 1.4; color: var(--text); font-size: var(--fs-body); }
.msg-md h1 { font-size: var(--fs-strong); }
.msg-md ul, .msg-md ol { margin: 0 0 8px; padding-left: 20px; }
.msg-md li { margin: 2px 0; }
.msg-md li > ul, .msg-md li > ol { margin: 2px 0; }
/* GFM 任务列表项：去圆点，行内勾选框标记（禁用交互样式，纯展示）。 */
.msg-md li.md-task { list-style: none; }
.msg-md .md-check {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--panel);
  color: var(--ok);
  font-size: var(--fs-caption);
  line-height: 12px;
  text-align: center;
  vertical-align: 1px;
}
.msg-md blockquote { margin: 0 0 8px; padding: 2px 0 2px 10px; border-left: 3px solid var(--border-strong); color: var(--text-3); }
.msg-md blockquote > :last-child { margin-bottom: 0; }
.msg-md hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.msg-md a { color: var(--accent); }
.msg-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--fs-small);
  background: var(--panel-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  padding: 0 4px;
}
.msg-md pre {
  margin: 0 0 8px;
  padding: 8px 10px;
  background: var(--panel-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-m);
  overflow-x: auto;
  white-space: pre;
}
.msg-md pre code { background: none; border: none; padding: 0; }
/* md/markdown 围栏解包后的格式化文档卡（Codex 保守解包同款）：带边框的独立格式区。 */
.msg-md .msg-md-doc {
  position: relative;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--panel-2);
}
.msg-md .msg-md-doc > :first-child { margin-top: 0; }
.msg-md .msg-md-doc > :last-child { margin-bottom: 0; }
/* 代码块外层容器：承载右上角复制按钮（按钮不随 pre 横向滚动）。 */
.msg-md .md-code { position: relative; margin: 0 0 8px; }
.msg-md .md-code > pre { margin: 0; }
/* 渲染区块右上角复制按钮（图标态）：常态纯图标无边框，悬停浮底+「复制」提示胶囊，
   复制成功切 ✓ 图标+「已复制」（提示在反馈窗口内常显，鼠标移开也不丢）。 */
.md-copy {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.75;
  z-index: 1;
}
.md-copy svg { width: 14px; height: 14px; display: none; }
.md-copy .ic-copy { display: block; }
.md-copy.copied .ic-copy { display: none; }
.md-copy.copied .ic-check { display: block; }
.md-copy:hover, .md-copy:focus-visible { opacity: 1; background: var(--panel-3); }
.md-copy.copied { opacity: 1; color: var(--ok); }
.md-copy-tip {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--panel);
  color: var(--text);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.md-copy:hover .md-copy-tip,
.md-copy:focus-visible .md-copy-tip,
.md-copy.copied .md-copy-tip { display: block; }

/* 会话底部操作栏（复制/赞/踩/分叉，ZCode 形态）：与区块复制按钮同一图标语言；
   负 margin 抵掉 #messages 的 10px 条目间距，让操作栏贴近上方消息气泡（用户拍板「往上移一点」）。 */
.turn-actions { display: flex; gap: 4px; padding: 2px 0 4px; margin-top: -6px; align-self: flex-start; }
.md-act {
  position: relative;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.md-act svg { width: 15px; height: 15px; }
.md-act:hover, .md-act:focus-visible { background: var(--panel-3); color: var(--text); }
.md-act.up.active { color: var(--ok); }
.md-act.down.active { color: var(--danger); }
.md-act.copied { color: var(--ok); }
.md-act:hover .md-copy-tip,
.md-act:focus-visible .md-copy-tip,
.md-act.copied .md-copy-tip { display: block; }
.msg-md table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 8px; max-width: 100%; }
.msg-md th, .msg-md td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.msg-md th { background: var(--panel-2); font-weight: 600; }

.tool { align-self: flex-start; font-size: var(--fs-body); color: var(--muted); padding: 2px 8px; max-width: 92%; }
.tool b { color: var(--accent); font-weight: 600; }

/* confirm card */
.card {
  align-self: stretch;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-l);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}
.card h3 { margin: 0 0 4px; font-size: var(--fs-strong); }
.card .meta { color: var(--muted); font-size: var(--fs-body); margin-bottom: 8px; }
.card .summary { margin-bottom: 10px; }
.card pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 10px;
  overflow-x: auto;
  font-size: var(--fs-body);
  max-height: 260px;
  overflow-y: auto;
  margin: 0 0 12px;
}
.card .actions { display: flex; gap: 10px; }
.card .actions button {
  padding: 7px 16px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-lead);
}
.card .actions .approve { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.card .actions .reject { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
.card .decided { color: var(--muted); font-size: var(--fs-body); }
/* 配置计划卡（confirm_config_plan）：步骤只读清单，mono 参数块与 json-editor 同字面量族 */
.card .summary-line { color: var(--muted); font-size: var(--fs-body); margin: 0 0 10px; white-space: pre-wrap; }
.card ol.plan-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 10px; }
.card li.plan-step { border: 1px solid var(--border); border-radius: var(--radius-m); padding: 8px 10px; background: var(--panel-2); }
.card .plan-step-head { font-size: var(--fs-small); color: var(--text-2); word-break: break-all; margin-bottom: 6px; }
.card pre.plan-step-args {
  margin: 0; max-height: 180px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-small);
}

/* 输入条在 #chat 中栏内部钉底：宽度天然受中栏约束，与对话列同参照系恒对齐；
   背景=主背景色的面板底（--panel），带顶边框作为对话区与输入区的分界。 */
footer {
  flex: 0 0 auto;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

#composer { width: 100%; max-width: var(--chat-width); margin: 0 auto; display: flex; gap: 10px; }
/* 输入框壳：承载嵌入在框内的「＋」附件按钮（ZCode/Codex 式内嵌入口）。 */
.input-shell { position: relative; flex: 1; display: flex; }
#attach {
  position: absolute;
  left: 8px;
  top: 7px;
  z-index: 1;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-title);
  line-height: 1;
  cursor: pointer;
}
#attach:hover { background: var(--panel-2); color: var(--text); }
#attach:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
#input {
  flex: 1;
  width: 100%;
  padding: 10px 14px 10px 42px;
  border-radius: var(--radius-l);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: var(--fs-strong);
  /* 多行输入：高度由 JS 随内容增高（封顶 max-height 后内部滚动）；textarea 默认等宽字体须显式继承。 */
  resize: none;
  overflow-y: auto;
  max-height: 160px;
  line-height: 1.5;
  font-family: inherit;
}
/* 拖拽文件进入输入区时输入框高亮，指示可释放。 */
.input-shell.dragover #input { outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: var(--radius-l); }

/* 待发附件条：composer 上方的可移除 chip 列表，与 #composer 同宽对齐。 */
#attachmentChips {
  width: 100%;
  max-width: var(--chat-width);
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--fs-small);
  max-width: 260px;
}
.attach-chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .x {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-body);
  padding: 0 2px;
}
.attach-chip .x:hover { color: var(--text); }

/* 消息气泡内的附件：图片直接预览，其余展示文件 chip。 */
.msg .attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.msg img.attach-image { max-width: 320px; max-height: 240px; border-radius: var(--radius-l); border: 1px solid var(--border); display: block; }
.msg .attach-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--panel-2);
  font-size: var(--fs-small);
  align-self: flex-start;
}
#input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
#send {
  padding: 10px 20px;
  border-radius: var(--radius-l);
  border: none;
  background: var(--accent-gradient);
  color: var(--on-accent);
  font-size: var(--fs-strong);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
#send:hover { filter: brightness(1.07); }
#send:disabled { opacity: 0.38; filter: grayscale(0.55); cursor: not-allowed; }
/* 对话进行中发送按钮变红色停止态（与空闲态同尺寸：border 用透明占位防跳动）。 */
#send { border: 1px solid transparent; }
#send.stopping { background: var(--danger-btn); border-color: var(--danger-btn-border); }
#send.stopping:hover { background: var(--danger-btn-hover); filter: none; }

/* composer 快捷键提示：Enter 发送 / Shift+Enter 换行的可发现性说明。 */
.composer-hint {
  width: 100%;
  max-width: var(--chat-width);
  margin: 6px auto 0;
  text-align: right;
  font-size: var(--fs-small);
  color: var(--muted);
}

.thinking { align-self: flex-start; color: var(--muted); font-size: var(--fs-body); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* 回到底部：上滑暂停跟随后浮现，sticky 钉在对话面板（滚动容器）可视底部；贴底时由 hidden 收起 */
.scroll-bottom-btn {
  position: sticky;
  bottom: 12px;
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-top: 8px;
  z-index: 5;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--panel);
  color: var(--text-2);
  font-size: var(--fs-body);
  box-shadow: var(--shadow-m);
  cursor: pointer;
}
.scroll-bottom-btn:hover { border-color: var(--accent); color: var(--text); }

/* ── Agent 悬浮球 + 悬浮对话面板 ──
   悬浮球全局常驻右下角（完整 Agent 视图或悬浮面板打开时由 JS 加 hidden 收起——球与面板同为 fixed 18px 锚点，面板打开时球必须让位，否则压住面板发送按钮）；
   悬浮面板复用 #chat 本体（加 .floating 变 fixed 弹层），SSE/渲染/滚动逻辑零改动。
   z-index 30：压过内容条（8/9）与下拉菜单（12），低于模态（50）与光标涟漪画布（60）。 */
.chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-soft-border);
  border-radius: 50%;
  background: var(--accent-gradient);
  color: var(--on-accent);
  cursor: pointer;
  box-shadow: var(--shadow-m);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); }
.chat-fab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring), var(--shadow-m); }
/* 对话进行中：球角呼吸点提示后台有输出（面板收起也能看出仍在跑）；入口动画只动 transform/opacity。 */
.chat-fab.busy::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 6px var(--warn);
  animation: pulse 1.2s infinite;
}

/* 悬浮面板 = #chat 本体换宿主：fixed 弹层、毛玻璃面板底（与 #records 同底透出背景光晕）。 */
#chat.floating {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: auto;
  top: auto;
  z-index: 30;
  width: min(420px, calc(100vw - 36px));
  height: min(620px, calc(100vh - 96px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  /* 面板主体提高实底不透明度（--bar-bg）：低透明玻璃会让背后徽标透影进正文区（vision 评审）。 */
  background: var(--bar-bg);
  box-shadow: var(--shadow-l);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  animation: chat-dock-in 0.2s ease;
}
@keyframes chat-dock-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* 精简面板：不露 Hemory/草稿箱二级 tab（打开悬浮时 JS 强制回对话 tab），换成悬浮面板头。 */
#chat.floating .agent-mode-tabs { display: none; }
.chat-floating-bar { display: none; }
#chat.floating .chat-floating-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bar-bg);
}
#chat.floating .chat-floating-bar strong { font-size: var(--fs-lead); color: var(--text); }

/* 思考过程折叠面板（流式 delta 实时填充，完成后折叠成一行摘要） */
.think-block {
  align-self: stretch;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-l);
  background: var(--panel);
  overflow: hidden;
}
.think-head {
  padding: 7px 12px;
  font-size: var(--fs-body);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.think-head::before { content: '▸ '; }
.think-block.open .think-head::before { content: '▾ '; }
.think-body {
  display: none;
  padding: 0 12px 10px;
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  border-top: 1px dashed var(--border-soft);
}
.think-block.open .think-body { display: block; }
.msg.streaming { opacity: 0.92; }

/* settings modal */
.modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal.hidden { display: none; }

.modal-box {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 18px 20px;
  box-shadow: var(--shadow-l);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: var(--fs-title); }
.hint { color: var(--muted); font-size: var(--fs-body); margin: 4px 0 14px; }
.hint code { background: var(--panel-2); padding: 1px 5px; border-radius: var(--radius-xs); }

.settings-section { margin-bottom: 18px; }
.section-title { font-weight: 650; font-size: var(--fs-lead); margin-bottom: 10px; }
.section-title .hint-inline { font-weight: 400; color: var(--muted); font-size: var(--fs-body); margin-left: 8px; }

/* ── 设置中心（v0.11）：左导航 + 右内容页；分页面板为 panel 卡片，管理页仅管理员可见（JS 门控）。 ── */
.settings-layout { display: flex; align-items: flex-start; gap: 22px; }
.settings-nav {
  flex: none; width: 208px; position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px; border-radius: var(--radius-l);
  background: var(--panel); border: 1px solid var(--border);
}
.settings-nav-group {
  margin: 8px 4px 4px; font-size: var(--fs-caption); color: var(--text-3);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.settings-nav-group:first-child { margin-top: 0; }
.settings-nav-item {
  width: 100%; height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-m);
  background: transparent; color: var(--nav-text); text-align: left; cursor: pointer; font: inherit;
  display: flex; align-items: center;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.settings-nav-item:hover { background: var(--nav-hover-bg); }
.settings-nav-item.active {
  background: var(--nav-active-bg); color: var(--nav-active-text);
  box-shadow: inset 3px 0 0 0 var(--nav-active-bar), var(--shadow-xs); font-weight: 650;
}
.settings-body { flex: 1 1 0; min-width: 0; }
/* 宽度跟随内容（v0.42.14）：表单页标准宽 1160（字段 flex-wrap 排两列，宽屏右侧留白是有意构图）；
   表格/卡片列表页（澄清经验/成员/连接/ONES 环境）占满可用宽度。 */
.settings-pane {
  max-width: 1160px; padding: 20px 22px 24px;
  border-radius: var(--radius-l); background: var(--panel); border: 1px solid var(--border);
}
.settings-pane[data-settings-pane="clarify-lessons"],
.settings-pane[data-settings-pane="members"],
.settings-pane[data-settings-pane="roles"],
.settings-pane[data-settings-pane="audit"],
.settings-pane[data-settings-pane="connections"],
.settings-pane[data-settings-pane="ones-envs"] { max-width: none; }
.settings-page-actions { display: flex; gap: 8px; margin-top: 16px; }
.settings-page-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }
.settings-result { margin-top: 10px; font-size: var(--fs-body); min-height: 0; }
.settings-result.ok { color: var(--ok); }
.settings-result.err { color: var(--danger); }
.appearance-row { display: flex; gap: 10px; }
/* 角色能力矩阵表（v0.45）：能力名列主导，角色勾选列等宽居中；分组行跨列。
   选择器带 .customer-table 前缀提升 specificity——通用 .customer-table th 列宽规则更靠后，同权重会覆盖本表。 */
.customer-table.role-matrix-table th, .customer-table.role-matrix-table td { vertical-align: middle; }
.customer-table.role-matrix-table { min-width: 900px; }
.customer-table.role-matrix-table th:nth-child(1) { width: 18%; }
.customer-table.role-matrix-table th:nth-child(2) { width: 34%; }
.customer-table.role-matrix-table th:nth-child(n+3) { width: 8%; text-align: center; }
.customer-table.role-matrix-table td:nth-child(n+3) { text-align: center; }
.customer-table.role-matrix-table input[type="checkbox"] { accent-color: var(--nav-active-bar); width: 15px; height: 15px; cursor: pointer; }
.customer-table.role-matrix-table input[type="checkbox"]:disabled { cursor: not-allowed; }
.role-matrix-cap { font-weight: 650; }
.role-matrix-group td {
  font-weight: 650; font-size: var(--fs-small); color: var(--muted);
  letter-spacing: 0.04em; padding-top: 14px; background: var(--panel-2);
}
/* 审计日志表（v0.45）：明细列截断防长 JSON 撑表（同样带前缀压过通用列宽）。 */
.customer-table.audit-table th:nth-child(1) { width: 12%; }
.customer-table.audit-table th:nth-child(2) { width: 11%; }
.customer-table.audit-table th:nth-child(3) { width: 17%; }
.customer-table.audit-table th:nth-child(4) { width: 15%; }
.customer-table.audit-table th:nth-child(5) { width: 12%; }
.customer-table.audit-table th:nth-child(6) { width: 33%; }
.audit-detail { max-width: 420px; overflow-wrap: anywhere; }
.llm-editor { border: 1px solid var(--border); border-radius: var(--radius-l); padding: 12px 14px; background: var(--panel-2); }
.llm-editor .row { display: flex; gap: 10px; flex-wrap: wrap; }
.llm-editor .field { flex: 1 1 200px; min-width: 160px; margin-bottom: 8px; }
.llm-editor label { font-size: var(--fs-body); color: var(--muted); display: block; margin-bottom: 3px; }
.llm-editor input, .llm-editor select {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
}
.llm-editor input:focus, .llm-editor select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
/* 视觉开关：checkbox 行内跟随文字，覆盖 .llm-editor label 的 block 布局与通用 input 100% 宽。 */
.vision-toggle { display: flex !important; align-items: center; gap: 8px; cursor: pointer; color: var(--text) !important; font-size: var(--fs-body) !important; }
.vision-toggle input { width: auto !important; margin: 0; }
.vision-toggle.disabled { opacity: 0.6; cursor: not-allowed; }

.server-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--panel-2);
}
.server-editor .row { display: flex; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.server-editor label { font-size: var(--fs-body); color: var(--muted); display: block; margin-bottom: 3px; }
.server-editor .field { flex: 1 1 180px; min-width: 160px; }
.server-editor input, .server-editor select, .server-editor textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
}
.server-editor input:focus, .server-editor select:focus, .server-editor textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.server-editor textarea { min-height: 52px; resize: vertical; font-family: inherit; }
.server-editor .ed-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.server-editor .ed-head .title { font-weight: 600; font-size: var(--fs-lead); }
/* 删除：成型的危险描边钮（曾是裸红字无尺寸，与相邻「停用」基线/高度都不齐）。 */
.server-editor .remove {
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid var(--error-border);
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-small);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.server-editor .remove:hover { background: var(--error-bg); border-color: var(--danger); }
.server-editor .status-line { font-size: var(--fs-small); color: var(--muted); }
.server-editor .status-line.ok { color: var(--ok); }
.server-editor .status-line.fail { color: var(--danger); }
.oauth-hint { font-size: var(--fs-small); color: var(--muted); margin-bottom: 8px; }
/* 「＋ 添加连接」展开的类型选择行：MCP 服务器 / 授权码直连（隐藏态由全局 .hidden !important 兜底）。 */
.connection-chooser { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 12px 12px; }
/* 连接类型切换 chips：胶囊形态与动作按钮刻意区分（导航不是操作，外形不应同形）。 */
.conn-chip {
  min-height: 28px;
  padding: 3px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-small);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.conn-chip:hover { border-color: var(--border-strong); background: var(--panel-2); color: var(--text); }
/* 授权码直连卡：操作按钮行底对齐字段控件（label 高度天然把按钮压到控件行底，不再用魔法数补偿——
   9px 补偿曾让「保存员工ID」相对输入框上浮 7px，vision 像素实测）。 */
.server-editor.oauth-direct .ones-env-actions { align-self: flex-end; }

/* ONES 多环境连接（设置页）：环境卡内按通道分行，凭据表单默认收起 */
.ones-env-card .ed-head { flex-wrap: wrap; gap: 6px; }
.ones-env-card .ed-head .title { margin-right: auto; }
.ones-env-headbtns { display: flex; gap: 8px; }
.ones-env-channel {
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg);
}
.ones-env-channel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.ones-env-channel-head .ch-name { font-size: var(--fs-body); font-weight: 600; }
.ones-env-channel-head .ch-config { flex: 1 1 240px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ones-env-channel-head .ch-cred { margin-left: auto; text-align: right; }
.ones-env-cred-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 6px; }
.ones-env-cred-form .field { flex: 1 1 170px; min-width: 150px; margin: 0; }
.ones-env-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ones-env-addchannel { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ones-env-addchannel .field { flex: 1 1 200px; margin: 0; }
.ones-env-addchannel .field.ch-type { flex: 0 1 220px; }


.adv-toggle {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-body);
  padding: 2px 0;
  margin-bottom: 6px;
}
.adv-toggle:hover { color: var(--accent); }
.adv-body { border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 2px; }
.adv-body .field { margin-bottom: 8px; }

.modal-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.modal-actions .primary {
  background: var(--accent-gradient);
  border: none;
  color: var(--on-accent);
  padding: 9px 18px;
  border-radius: var(--radius-m);
  cursor: pointer;
  font-size: var(--fs-lead);
  box-shadow: var(--shadow-xs);
}
.modal-actions .primary:hover { filter: brightness(1.07); }
.modal-actions .ghost {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 9px 16px;
  border-radius: var(--radius-m);
  cursor: pointer;
  font-size: var(--fs-lead);
}

/* ══════════════════════════════════════════════════════════════════
   Customer operating workbench（工作台主界面）
   ══════════════════════════════════════════════════════════════════ */

body { color: var(--text); font-size: var(--fs-lead); line-height: 1.5; }
.quiet-command, .primary-command, .back-command {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, filter 0.16s ease;
}
.quiet-command:hover, .back-command:hover { border-color: var(--border-strong); background: var(--panel-2); transform: translateY(-1px); }
.primary-command { color: var(--on-accent); background: var(--accent-gradient); border-color: transparent; box-shadow: var(--shadow-xs); }
.primary-command:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow-s); }
.quiet-command.small, .primary-command.small { min-height: 28px; padding: 3px 9px; font-size: var(--fs-small); }
/* ghost / primary 全局定义（设置页存量按钮曾挂这两个无定义类 → 浏览器默认深黑粗描边、高度随内容漂移）：
   ghost=行级次要钮（28px 描边），primary=主动作（accent 渐变），与 quiet/primary-command 三件套同语言；
   弹窗内 .modal-actions .ghost/.primary 为作用域覆盖，不受影响。 */
.ghost {
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-small);
  transition: background 0.16s ease, border-color 0.16s ease;
}
.ghost:hover { border-color: var(--border-strong); background: var(--panel-2); }
.ghost.danger { color: var(--danger); border-color: var(--error-border); }
.ghost.danger:hover { background: var(--error-bg); border-color: var(--danger); }
.primary {
  min-height: 34px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  background: var(--accent-gradient);
  color: var(--on-accent);
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow-xs);
  transition: filter 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow-s); }
.primary.small { min-height: 28px; padding: 3px 10px; font-size: var(--fs-small); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:disabled:hover { transform: none; }
/* 键盘可达性统一底线：按钮类控件获得统一 focus ring（文本输入已有各自的 focus 契约）。 */
button:focus-visible, .nav-item:focus-visible, .customer-tab:focus-visible, .agent-mode-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* 开关类按钮的「当前生效态」（个人中心 深色/动效）：accent 软底描边，与静止态一眼可辨。 */
.quiet-command.is-on { background: var(--accent-soft); border-color: var(--accent-soft-border); color: var(--accent-deep); }
.quiet-command.is-on:hover { background: var(--accent-soft-hover); border-color: var(--focus-border); }
/* 状态条单行契约：同步钮不折行，状态文本可收缩并按 ellipsis 截断（原顶栏契约随迁侧栏脚）——
   长状态文案（生成中摘要）不允许把窄侧栏挤到内部折行错位。 */
.status { min-width: 0; }
.status .dot { flex: none; }
.status .text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#sidebar { width: 194px; flex-basis: 194px; padding: 12px 10px; }
.product-nav { display: grid; gap: 3px; }
.nav-item {
  width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: var(--radius-m);
  background: transparent; color: var(--nav-text); text-align: left; cursor: pointer; font: inherit;
  display: flex; align-items: center; justify-content: flex-start; gap: 10px; position: relative;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.nav-icon { flex: none; }
.nav-item:hover { background: var(--nav-hover-bg); }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-text); box-shadow: inset 3px 0 0 0 var(--nav-active-bar), var(--shadow-xs); font-weight: 650; }
.nav-count { min-width: 20px; margin-left: auto; text-align: center; font-weight: 650; font-size: var(--fs-small); color: var(--nav-count); }
/* 空计数不渲染：折叠态角标是绝对定位的实心小圆徽，空 span 会留下空徽阴影。 */
.nav-count:empty { display: none; }
.agent-sessions { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--sessions-border); }

.workbench-main { padding: 0; overflow: auto; min-width: 0; background: var(--workbench-bg); }
.workbench-view { width: 100%; min-height: 100%; padding: 24px 28px 40px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.view-head h1, .customer-detail-head h1 { margin: 0; font-size: var(--fs-display); line-height: 1.25; letter-spacing: 0.01em; }
.view-head p, .customer-detail-head p { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-body); }
.toolbar { display: flex; gap: 8px; }
.toolbar input {
  width: min(320px, 38vw); height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); color: var(--text); font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.toolbar input:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }

.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; background: var(--panel); box-shadow: var(--shadow-xs); margin-bottom: 16px; }
.metric-item { min-height: 72px; padding: 12px 14px; border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; justify-content: center; }
.metric-item:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: var(--fs-small); }
.metric-item strong { margin-top: 2px; font-size: var(--fs-display); line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tone-danger { color: var(--danger); }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel); box-shadow: var(--shadow-xs); }
.customer-table { width: 100%; min-width: 1020px; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.sort-control { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-body); }
.sort-control select { min-height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel-2); color: var(--text); font: inherit; }
/* 案例模板选择（v21）：与排序控件同款单行 select 形态，随「生成案例」按钮并排。 */
.case-template-select { min-height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel-2); color: var(--text); font: inherit; max-width: 220px; }
.customer-table th { height: 38px; padding: 0 12px; background: var(--th-bg); color: var(--th-text); font-size: var(--fs-small); text-align: left; font-weight: 600; letter-spacing: 0.02em; border-bottom: 1px solid var(--border); }
.customer-table td { height: 64px; padding: 8px 12px; vertical-align: middle; border-bottom: 1px solid var(--border-soft); overflow: hidden; }
.customer-table tr:last-child td { border-bottom: 0; }
.customer-table tbody tr { transition: background 0.12s ease; }
.customer-table tbody tr:hover { background: var(--row-hover); }
.customer-table th:nth-child(1) { width: 20%; }
.customer-table th:nth-child(2) { width: 11%; }
.customer-table th:nth-child(3) { width: 10%; }
.customer-table th:nth-child(4) { width: 12%; }
.customer-table th:nth-child(5) { width: 10%; }
.customer-table th:nth-child(6) { width: 8%; }
.customer-table th:nth-child(7) { width: 21%; }
.customer-table th:nth-child(8) { width: 8%; }
.customer-link { border: 0; background: transparent; padding: 0; color: var(--accent-deep); cursor: pointer; font: inherit; font-weight: 650; text-align: left; }
.customer-link:hover { text-decoration: underline; }
.cell-sub, .cell-muted { margin-top: 3px; color: var(--muted); font-size: var(--fs-caption); }
.next-action-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.business-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); color: var(--text-3); background: var(--panel-3); font-size: var(--fs-caption); margin: 2px 4px 2px 0; white-space: nowrap; }
.business-badge.warning { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-bg); }
.business-badge.accent { color: var(--accent-deep); border-color: var(--accent-soft-border); background: var(--accent-soft); }
.business-badge.success { color: var(--ok-deep); border-color: var(--ok-border); background: var(--ok-bg); }
.business-badge.risk-high { color: var(--risk-high-text); border-color: var(--risk-high-border); background: var(--error-bg); }
.business-badge.risk-medium { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-bg); }
.business-badge.risk-low { color: var(--ok-deep); border-color: var(--ok-border); background: var(--ok-bg); }
.business-badge.risk-unknown { color: var(--text-3); background: var(--panel-3); }

/* 空态：虚线框 + 柔和圆点图形 + 更大留白（纯 CSS，不动 DOM）。 */
.workspace-empty { padding: 40px 16px; text-align: center; color: var(--text-3); font-size: var(--fs-lead); border: 1px dashed var(--border-strong); border-radius: var(--radius-l); background: var(--empty-bg); }
.workspace-empty::before { content: ''; display: block; margin: 0 auto 12px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); box-shadow: inset 0 0 0 7px var(--panel); }

.customer-detail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 12px 0 18px; }
/* 客户别名行：全称下的 chips + 编辑入口（Agent 按全称/简称/别名精确或唯一子串解析客户）。 */
.alias-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.alias-row-label, .alias-row-empty { color: var(--muted); font-size: var(--fs-small); }
.alias-chip { display: inline-flex; align-items: center; padding: 3px 9px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--panel-2); color: var(--text); font-size: var(--fs-small); }
.alias-row .alias-edit { min-height: 24px; padding: 2px 8px; font-size: var(--fs-small); flex: none; }
.back-command { border: 0; background: transparent; color: var(--accent-deep); padding-left: 0; }
.back-command:hover { transform: translateY(-1px); }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
/* 下拉命令菜单（客户页头部「刷新数据 ▾」）：浮层右对齐挂在触发按钮下沿，z-index 12 压过内容条（8/9）、低于移动端侧栏（15）与弹窗（50）。 */
.command-menu { position: relative; display: inline-flex; }
.command-menu > button::after { content: '▾'; margin-left: 6px; font-size: var(--fs-caption); color: var(--muted); }
.command-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 12; min-width: 224px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel);
  box-shadow: var(--shadow-m);
}
.command-menu-item {
  min-height: 34px; padding: 7px 10px; border: 0; border-radius: var(--radius-s); background: transparent;
  color: var(--text); text-align: left; cursor: pointer; font: inherit; white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}
.command-menu-item:hover { background: var(--panel-2); color: var(--accent-deep); }
.definition-grid { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; background: var(--panel); box-shadow: var(--shadow-xs); }
.definition { min-height: 72px; padding: 12px; border-right: 1px solid var(--border-soft); }
.definition:last-child { border-right: 0; }
.definition span { display: block; color: var(--muted); font-size: var(--fs-caption); }
.definition strong { display: block; margin-top: 5px; font-size: var(--fs-lead); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-section { margin-top: 20px; }
.detail-section > h2 { margin: 0 0 9px; font-size: var(--fs-strong); }
/* 客户详情冻结布局：头部（客户名/预警横幅/摘要格/tab 栏）钉住，仅 tab 内容区滚动。
   #customerView 占满中栏视口（main#workbench 是唯一滚动口且 padding 0，height: 100% 可解析），
   #chat 同款 flex 列范式；tab-body 负 margin 出血让滚动条贴中栏右缘（.hemory-assign-bar 同款），
   底 padding 移入 tab-body 随内容滚走。≤720px 滚动口交还 window（.workbench-main overflow
   visible、height 解析为 auto），自然退化为整页滚动，移动端行为不变。 */
#workbench #customerView { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 24px 28px 0; overflow: hidden; }
#customerView > .back-command { flex: 0 0 auto; align-self: flex-start; }
#customerView #customerOverview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* 冻结块一律禁止收缩：tab-body 的 basis 必须为 0（basis:auto 会让超长 tab 内容把假设主尺寸
   撑爆，overflow:hidden 的摘要格自动最小尺寸为 0、独吞全部收缩量而被压成一条线）。 */
#customerOverview > .customer-detail-head, #customerOverview > .alert-banner, #customerOverview > .definition-grid { flex: 0 0 auto; }
.customer-tabs { display: flex; gap: 2px; margin-top: 20px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; flex: 0 0 auto; }
.customer-tabs::-webkit-scrollbar { display: none; }
.customer-tab { flex: 0 0 auto; min-height: 38px; padding: 0 12px; border: 0; border-bottom: 3px solid transparent; border-radius: var(--radius-s) var(--radius-s) 0 0; background: transparent; color: var(--text-3); cursor: pointer; font: inherit; transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease; }
.customer-tab:hover { background: var(--panel-2); color: var(--text); }
.customer-tab.active { border-bottom-color: var(--accent); color: var(--accent-deep); font-weight: 650; }
.customer-tab-body { flex: 1 1 0; min-height: 0; overflow-y: auto; margin: 0 -28px; padding: 2px 28px 40px; }
.customer-tab-panel { min-height: 260px; padding-top: 12px; }
.tab-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }

.risk-panel { border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel); padding: 14px; box-shadow: var(--shadow-xs); }
.risk-top { display: flex; align-items: center; gap: 8px; }
.risk-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.risk-dimension { min-height: 88px; padding: 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); background: var(--empty-bg); display: flex; flex-direction: column; }
.risk-dimension span { color: var(--muted); font-size: var(--fs-caption); }
.risk-dimension strong { margin-top: 2px; font-size: var(--fs-title); font-variant-numeric: tabular-nums; }
.risk-dimension small { margin-top: auto; color: var(--text-3); overflow-wrap: anywhere; }
.risk-dimension.unknown { background: var(--panel-3); }
.unknown-line { margin-top: 10px; color: var(--warn-note); font-size: var(--fs-small); }

/* 风险预警：全局名单（待处理/已消除）+ 客户详情置顶横幅；双主题全走 token。 */
.alert-board { display: flex; flex-direction: column; gap: 10px; }
.alert-banner { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--warn-border); background: var(--warn-bg); border-radius: var(--radius-l); padding: 12px 14px; }
.alert-banner > strong { color: var(--warn-text); font-size: var(--fs-body); }
.alert-card { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius-l); padding: 12px 14px; box-shadow: var(--shadow-xs); }
.alert-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-head .quiet-command { margin-left: auto; }
.alert-reasons { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-body); max-width: 48em; display: flex; flex-direction: column; gap: 3px; }
.alert-reasons li { overflow-wrap: anywhere; }
.alert-resolution { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.alert-resolution-note { color: var(--text-2); font-size: var(--fs-body); overflow-wrap: anywhere; }

/* 增购机会：有序列表（一句话简述 + 来源行），按可信度取前 5；条目不设 display 防 ol 序号被吞。 */
.opportunity-list { margin: 0; padding-left: 24px; font-size: var(--fs-body); }
/* 列表套卡：正文不直接落在极光光晕上（vision 评审：浅色主题中部透紫、右侧失衡），序号缩进同步收进卡内。 */
.opportunity-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 12px 18px 14px 28px; box-shadow: var(--shadow-xs); }
.opportunity-item + .opportunity-item { margin-top: 9px; }
.opportunity-item-text { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.opportunity-evidence { margin-top: 3px; color: var(--faint); font-size: var(--fs-small); overflow-wrap: anywhere; }
.action-card, .case-card-item, .demo-card-item { border: 1px solid var(--border); background: var(--panel); padding: 13px; border-radius: var(--radius-l); box-shadow: var(--shadow-xs); transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease; }
.action-card:hover, .case-card-item:hover, .demo-card-item:hover { box-shadow: var(--shadow-m); transform: translateY(-1px); }
/* 案例生成中：旧稿整卡置灰（操作按钮逐个 disabled 复用全局 button:disabled），案例全文保持只读，hover 不再上浮。 */
.case-card-item.case-generating { opacity: .62; }
.case-card-item.case-generating:hover { box-shadow: var(--shadow-xs); transform: none; }
/* 客户 Demo 生成中：占位卡与置灰旧卡同一视觉契约（demo-generating 类名与案例分离，互不干扰）。 */
.demo-card-item.demo-generating { opacity: .62; }
.demo-card-item.demo-generating:hover { box-shadow: var(--shadow-xs); transform: none; }
/* Demo 配置清单摘要（只读 details）：卡内顶部留白与案例全文折叠区同节奏。 */
.demo-blueprint { margin-top: 8px; }
/* 成员管理（v0.9，管理员）：复用 customer-table 骨架（表头/行距/数字对齐），列宽按 7 列覆写。 */
.member-table { min-width: 880px; }
.member-table td { height: 48px; }
.member-table th:nth-child(1) { width: 16%; }
.member-table th:nth-child(2) { width: 14%; }
.member-table th:nth-child(3) { width: 9%; }
.member-table th:nth-child(4) { width: 9%; }
.member-table th:nth-child(5) { width: 16%; }
.member-table th:nth-child(6) { width: 11%; }
.member-table th:nth-child(7) { width: 25%; }
/* 澄清经验表（v0.42.14）：经验列为主导列；操作列 14% 在 1920 屏全宽下容纳三钮一行，窄窗口经 .row-actions 换行降级（绝不裁切）。 */
.clarify-lesson-table th:nth-child(1) { width: 7%; }
.clarify-lesson-table th:nth-child(2) { width: 10%; }
.clarify-lesson-table th:nth-child(3) { width: 30%; }
.clarify-lesson-table th:nth-child(4) { width: 5%; }
.clarify-lesson-table th:nth-child(5) { width: 7%; }
.clarify-lesson-table th:nth-child(6) { width: 16%; }
.clarify-lesson-table th:nth-child(7) { width: 11%; }
.clarify-lesson-table th:nth-child(8) { width: 14%; }
.member-row-disabled td { opacity: 0.6; }
/* 新建/编辑成员表单：settings 弹层同款输入规格（label 上置、focus 环、只读字段降调）。 */
.member-form label { font-size: var(--fs-body); color: var(--muted); display: block; margin-bottom: 3px; }
.member-form .field { margin-bottom: 8px; }
.member-form input, .member-form select {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
}
.member-form input:focus, .member-form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.member-form input[readonly] { color: var(--text-3); background: var(--panel-2); }
/* 一次性密码展示：大号等宽字符（杜绝 0/O、l/1 转写歧义）、整块点选即全选，复制走 copyText（Clipboard API + execCommand 兜底）。 */
.member-password-value { margin: 0 0 10px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-m); background: var(--panel-2); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-title); letter-spacing: 0.06em; text-align: center; user-select: all; }
/* 个人中心「修改密码」：三框纵排 + 提交按钮，错误提示排最后。 */
.profile-password-form { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; max-width: 460px; }
.profile-password-form input {
  padding: 7px 10px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
}
.profile-password-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.profile-password-form .login-error { order: 9; }
.action-card p { margin: 6px 0; color: var(--text-2); }
/* 案例配图：SVG 落库前经服务端消毒，这里按 viewBox 自适应限宽渲染。 */
.case-figure { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel-2); padding: 10px; }
.case-figure svg { display: block; max-width: 100%; height: auto; }
.case-figure-caption { margin-top: 6px; color: var(--muted); font-size: var(--fs-small); text-align: center; }
/* 案例全文只读视图：配图按章节嵌入 .case-doc 内（复用 .case-figure），客户详情默认展开、案例库折叠。 */
.case-fulltext { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.case-fulltext-summary { cursor: pointer; color: var(--muted); font-size: var(--fs-body); user-select: none; }
/* 统一阅读列 44em（容器字号 14px → 616px ≈ Word 版心 620px，对齐 case-docx.ts DOCX_IMAGE_WIDTH）：
   图/文/表/图注同宽，对齐导出 Word 的查看观感；em 跟随字号，整页缩放时随文字等比缩小（px 封顶同效）。 */
.case-doc { margin-top: 8px; margin-inline: auto; max-width: 44em; font-size: var(--fs-lead); display: grid; gap: 8px; }
/* 案例全文阅读档位整体上调一档（正文 14px、行距 1.8）；Word 导出字号在 case-docx.ts 服务端常量，与这里无关。 */
.case-doc-title { font-size: var(--fs-title); font-weight: 650; overflow-wrap: anywhere; }
/* 阅读列宽度由 .case-doc 容器单一管（≈44 个中文字符/行，元素级不再各自限宽——多把尺随各自字号折算会漂移不齐）。 */
.case-doc-h2 { margin-top: 6px; font-size: var(--fs-strong); font-weight: 650; }
.case-doc-h3 { font-size: var(--fs-lead); font-weight: 600; }
.case-doc-h4 { color: var(--text-3); font-size: var(--fs-lead); font-weight: 600; }
.case-doc-p { margin: 0; font-size: var(--fs-lead); line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
/* ol 保持默认块级排版（grid/block 会吞 ::marker 序号，见周报序号教训）。 */
.case-doc-list { margin: 0; padding-left: 22px; font-size: var(--fs-lead); line-height: 1.8; }
.case-doc-list li { margin: 2px 0; overflow-wrap: anywhere; }
.case-doc-table { border-collapse: collapse; font-size: var(--fs-body); font-variant-numeric: tabular-nums; }
.case-doc-table th, .case-doc-table td { border: 1px solid var(--border); padding: 4px 9px; text-align: left; }
.case-doc-table th { background: var(--panel-2); font-weight: 600; }
.case-doc .case-figure { margin-top: 2px; }
.action-board, .case-list, .demo-list { display: grid; gap: 9px; }
.action-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
/* 批量完成操作条：复用 Hemory 归属栏的 34px 单行居中契约（select-all/计数沿用同款类），sticky 冻结在滚动容器顶。 */
.action-bulk-bar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--bar-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-s); }
/* 勾选框入卡片头：标题占据剩余宽度，徽标靠右不位移。 */
.action-head input[type="checkbox"] { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.action-head strong { flex: 1; }
/* 点卡片本体即可选中：selectable 提示可点，selected 给整卡描边反馈。 */
.action-card.selectable { cursor: pointer; }
.action-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.action-meta { margin: 7px 0 10px; color: var(--muted); font-size: var(--fs-small); }
.business-badge.status-new { color: var(--warn-text); }
.business-badge.status-completed { color: var(--ok-deep); }
.customer-group-body .action-card + .action-card { margin-top: 8px; }

/* ── 数据概览统计卡：6 卡同节奏（大数字 + 副指标 + 细进度条），只给数量口径，明细去各自 tab ── */
.stat-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-card { min-width: 0; min-height: 96px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--muted); font-size: var(--fs-small); }
.stat-value { font-size: var(--fs-display); line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat-sub { margin-top: auto; color: var(--text-3); font-size: var(--fs-small); line-height: 1.5; }
.stat-sub.ok { color: var(--ok-deep); font-weight: 650; }
.stat-flag { color: var(--risk-high-text); font-weight: 650; }
.stat-bar { margin-top: 4px; height: 4px; border-radius: var(--radius-full); background: var(--panel-3); overflow: hidden; }
.stat-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.3s ease; }
.stat-bar.full i { background: var(--ok); }
.business-record-list { display: grid; gap: 8px; }
.business-record { min-width: 0; padding: 12px 13px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); box-shadow: var(--shadow-xs); }
.business-record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.business-record-head a, .business-record-head strong { min-width: 0; color: var(--text-2); font-size: var(--fs-body); font-weight: 650; overflow-wrap: anywhere; }
.business-record-head a:hover { color: var(--accent); }
.business-record p { margin: 7px 0; color: var(--text-2); }
.web-intel-finding { margin-top: 5px; }
.web-intel-new { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-caption); font-weight: 650; }
.web-intel-sentiment { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: var(--radius-full); font-size: var(--fs-caption); font-weight: 650; border: 1px solid transparent; }
.web-intel-sentiment.positive { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.web-intel-sentiment.negative { color: var(--danger); background: var(--warn-bg); border-color: var(--danger); }
.web-intel-sentiment.neutral { color: var(--text-2); background: transparent; border-color: var(--border-strong); }
.web-intel-finding a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-strong); overflow-wrap: anywhere; }
.web-intel-finding a:hover { color: var(--accent); }
.record-facts { margin-top: 8px; color: var(--ok-text); font-size: var(--fs-small); }
.evidence-id { margin-top: 6px; color: var(--faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-caption); overflow-wrap: anywhere; }
.workhour-panel { display: grid; gap: 12px; }
.workhour-summary { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 8px; }
.workhour-summary .definition { padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); }
.workhour-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel); box-shadow: var(--shadow-xs); }
.workhour-table { width: 100%; min-width: 680px; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.workhour-table th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--th-bg); color: var(--th-text); font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.02em; text-align: left; }
.workhour-table td { min-width: 0; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-2); font-size: var(--fs-body); vertical-align: top; overflow-wrap: anywhere; }
.workhour-table tbody tr:last-child td { border-bottom: 0; }
.workhour-table tbody tr { transition: background 0.12s ease; }
.workhour-table tbody tr:hover { background: var(--row-hover); }
.workhour-table th:nth-child(1) { width: 18%; }
.workhour-table th:nth-child(2) { width: 22%; }
.workhour-table th:nth-child(3) { width: 15%; }
.workhour-table th:nth-child(4) { width: 45%; }
.workhour-hours { color: var(--ok-text) !important; font-weight: 650; white-space: nowrap; }
.workhour-description { white-space: pre-wrap; }
.ones-work-item-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel); box-shadow: var(--shadow-xs); }
.ones-work-item-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.ones-work-item-table th { height: 36px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--th-bg); color: var(--th-text); font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.02em; text-align: left; }
.ones-work-item-table td { min-width: 0; height: 52px; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-2); vertical-align: middle; overflow-wrap: anywhere; }
.ones-work-item-table tbody tr:last-child td { border-bottom: 0; }
.ones-work-item-table tbody tr { transition: background 0.12s ease; }
.ones-work-item-table tbody tr:hover { background: var(--row-hover); }
.ones-work-item-table th:nth-child(1) { width: 22%; }
.ones-work-item-table th:nth-child(2) { width: 46%; }
.ones-work-item-table th:nth-child(3) { width: 14%; }
.ones-work-item-table th:nth-child(4) { width: 18%; }
.ones-work-item-table a, .ones-work-item-table td:nth-child(2) span { color: var(--text-2); font-weight: 600; }
.ones-work-item-table a:hover { color: var(--accent); }
.ones-work-item-id { color: var(--faint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-caption); }

.timeline-list { border-left: 1px solid var(--timeline-rail); margin-left: 24px; }
.timeline-item { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; margin: 0 0 12px -25px; }
.source-mark { width: 50px; height: 24px; border: 1px solid var(--border-strong); border-radius: var(--radius-s); background: var(--panel); display: flex; align-items: center; justify-content: center; color: var(--mark-text); font-size: var(--fs-caption); font-weight: 700; }
.source-crm { border-color: var(--source-crm-border); color: var(--source-crm); }
.source-ones { border-color: var(--source-ones-border); color: var(--source-ones); }
.source-hemory { border-color: var(--source-hemory-border); color: var(--source-hemory); }
.timeline-body { min-width: 0; padding-top: 1px; }
.timeline-body strong { overflow-wrap: anywhere; }
.source-link { display: inline-block; margin-top: 4px; color: var(--accent); font-size: var(--fs-small); }

.workbench-modal-box { width: min(820px, 100%); }
.app-dialog-box { width: min(460px, 100%); }
#appDialogMessage { margin: 0 0 14px; max-height: 50vh; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--text); }
.app-dialog-input { width: 100%; min-height: 36px; margin: 0 0 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; }
.app-dialog-input:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }
.app-dialog-input.hidden { display: none; }
.app-dialog-box .modal-actions { justify-content: flex-end; }
.form-field { display: block; margin-bottom: 12px; }
.form-field > span { display: block; margin-bottom: 4px; color: var(--text-3); font-size: var(--fs-small); }
.form-field input, .form-field textarea { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; }
.form-field textarea { min-height: 88px; resize: vertical; }
.form-field textarea.json-editor { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-small); }
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }

/* 草稿结构化编辑表单：下拉与其他控件同宽；锁定/只读区块为浅底信息卡。 */
.form-field select.draft-edit-select { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; }
.form-field select.draft-edit-select:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }
.draft-edit-hint { display: block; margin-top: 3px; color: var(--muted); font-size: var(--fs-small); }
.draft-edit-locked, .draft-edit-readonly { margin: 4px 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel-2); }
.draft-edit-locked { border-color: var(--draft-locked-border); background: var(--draft-locked-bg); }
.draft-edit-section-title { margin-bottom: 6px; color: var(--text-3); font-size: var(--fs-small); font-weight: 650; }
.draft-edit-row { color: var(--text); font-size: var(--fs-body); line-height: 1.7; overflow-wrap: anywhere; }
.draft-edit-locked-reason { color: var(--draft-locked-text); font-size: var(--fs-small); line-height: 1.5; }

.agent-mode-tabs { position: sticky; top: -14px; z-index: 8; display: flex; gap: 2px; margin: 0; padding: 8px 18px 0; border-bottom: 1px solid var(--border); background: var(--bar-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.agent-mode-tab { min-height: 40px; padding: 0 13px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-3); cursor: pointer; font: inherit; transition: color 0.16s ease, border-color 0.16s ease; }
.agent-mode-tab:hover { color: var(--text); }
.agent-mode-tab.active { border-bottom-color: var(--accent); color: var(--accent-deep); font-weight: 650; }
.agent-mode-panel { min-width: 0; }
.agent-work-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.agent-work-head h1 { margin: 0; font-size: var(--fs-display); }
.agent-work-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-body); }
.agent-work-head input { min-height: 34px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; }
.agent-work-head input:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }
/* 「已归属」一键切换：激活（处于已归属视图）时高亮提示当前态，再点切回待归属。 */
.agent-work-head .quiet-command.active { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); font-weight: 650; }
/* 归属栏：单行操作条，全部控件垂直居中、统一 34px 高度；sticky 钉在面板滚动口顶（z-index 低于 tab 条）。
   贴死滚动口顶两要素缺一不可：① top: 0（任何更大偏移都会留出滚动内容可见的空隙）；
   ② 滚动容器自身 padding-top: 0——scroller 的 padding 会把 sticky 停靠点压到 content-box 顶
   （CSSWG #3352），归属栏将永远差 14px 贴不到顶、露出滚过的文字；初始顶距改由首个子元素的
   margin 承担（会随内容滚走，不影响钉住态）。 */
#chat #hemoryInbox { padding-top: 0; }
#hemoryInbox > :first-child { margin-top: 14px; }
.hemory-assign-bar { position: sticky; top: 0; z-index: 7; display: flex; align-items: center; gap: 8px; margin: 0 -18px 12px; padding: 10px 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bar-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
/* 已选客户一键清除：容器承载 flex 尺寸，✕ 浮在输入框右侧（有值才显示）。 */
.hemory-customer-box { position: relative; flex: 1 1 220px; min-width: 160px; }
.hemory-assign-bar input[list] { width: 100%; min-height: 34px; padding: 6px 30px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; }
.hemory-assign-bar input[list]:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }
.hemory-customer-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: var(--gray-btn); color: var(--text-3); font-size: var(--fs-small); line-height: 1; cursor: pointer; }
.hemory-customer-clear:hover { background: var(--gray-btn-hover); color: var(--text); }
.hemory-select-all { display: flex; align-items: center; gap: 5px; min-height: 34px; white-space: nowrap; font-size: var(--fs-body); cursor: pointer; }
.hemory-select-all input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.hemory-selected-count { min-height: 34px; display: flex; align-items: center; color: var(--muted); font-size: var(--fs-body); white-space: nowrap; }
.hemory-filter-chip { display: flex; align-items: center; min-height: 34px; padding: 6px 12px; border: 1px solid var(--accent-soft-border); border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent-deep); font-size: var(--fs-body); white-space: nowrap; cursor: pointer; transition: background 0.16s ease; }
.hemory-filter-chip:hover { background: var(--accent-soft-hover); }
/* 筛选面板：默认收起，展开为白底卡片；条件为草稿，点「筛选」才应用。 */
.hemory-filter-panel { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); box-shadow: var(--shadow-xs); }
.hemory-filter-panel label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hemory-filter-panel label span { color: var(--muted); font-size: var(--fs-caption); }
.hemory-filter-panel input, .hemory-filter-panel select { min-height: 34px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; }
.hemory-filter-panel input:focus, .hemory-filter-panel select:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }
.hemory-filter-panel input[type="date"], .hemory-filter-panel input[type="time"] { width: 150px; }
.hemory-filter-panel input[list] { flex: 1 1 220px; }
/* 客户详情片段 tab 的纯展示行：无勾选列，去掉 label 的点选手势。 */
.hemory-fragment.readonly { grid-template-columns: minmax(0, 1fr); cursor: default; }
.hemory-fragment-list, .draft-batch-list { display: grid; gap: 8px; }
.fragment-group-title { margin-top: 6px; padding: 6px 0 2px; color: var(--text-3); font-size: var(--fs-caption); font-weight: 700; }
/* 已归属视图的客户分组：details 原生折叠，summary 是客户名 + 条数，层级高于组内录音分节。 */
.customer-group { border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); box-shadow: var(--shadow-xs); }
.customer-group + .customer-group { margin-top: 8px; }
.customer-group-title { display: flex; align-items: center; gap: 6px; padding: 9px 12px; color: var(--text-2); font-size: var(--fs-small); font-weight: 700; cursor: pointer; list-style: none; user-select: none; }
.customer-group-title::-webkit-details-marker { display: none; }
.customer-group-title::before { content: '▸'; color: var(--muted); font-size: var(--fs-caption); transition: transform 0.12s ease; }
.customer-group[open] > .customer-group-title::before { transform: rotate(90deg); }
.customer-group-title:hover { color: var(--accent-deep); }
.customer-group-body { padding: 2px 10px 10px; }
.hemory-fragment { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); cursor: pointer; transition: border-color 0.16s ease, box-shadow 0.16s ease; }
.hemory-fragment:hover { border-color: var(--accent-soft-border); box-shadow: var(--shadow-s); }
.hemory-fragment input { width: 16px; height: 16px; margin-top: 5px; accent-color: var(--accent); }
.fragment-body, .draft-item-body { min-width: 0; }
.fragment-body p, .draft-item-body p { margin: 5px 0; color: var(--text-2); overflow-wrap: anywhere; }
.fragment-evidence { margin: 7px 0; color: var(--muted); font-size: var(--fs-small); }
.fragment-evidence summary { cursor: pointer; }
.fragment-evidence pre { max-height: 220px; margin: 6px 0 0; padding: 8px; overflow: auto; white-space: pre-wrap; border-left: 2px solid var(--border); color: var(--text-2); font: inherit; }
.fragment-head, .draft-item-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.fragment-head { justify-content: space-between; }
.fragment-topic-part { font-size: var(--fs-caption); padding: 1px 7px; border-radius: var(--radius-full); border: 1px dashed var(--border); color: var(--accent); white-space: nowrap; }
.draft-batch { border-top: 1px solid var(--border); padding-top: 12px; }
.draft-batch:first-child { border-top: 0; padding-top: 0; }
/* 重新生成中角标：该批次客户×上海日有进行中生成任务；期间全部操作禁用，失败后自动恢复。 */
.draft-regenerating { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: var(--fs-body); color: var(--accent-deep); }
.draft-regenerating::before { content: ''; flex: none; width: 11px; height: 11px; border: 2px solid var(--accent-soft-border); border-top-color: transparent; border-radius: 50%; animation: draft-spin 0.8s linear infinite; }
.draft-batch-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.draft-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); cursor: pointer; transition: border-color 0.16s ease, box-shadow 0.16s ease; }
.draft-item:not(.draft-item-disabled):hover { border-color: var(--accent-soft-border); box-shadow: var(--shadow-s); }
/* 禁用卡片明显灰化：已作废/已忽略/已写入不再是「看起来能点但点不动」。 */
.draft-item-disabled { cursor: default; background: var(--panel-2); opacity: 0.62; }
.draft-item-disabled .draft-item-body strong { color: var(--muted); }
.business-badge.muted { color: var(--text-3); border-color: var(--border-strong); background: var(--panel-3); }
.draft-item > input { width: 16px; height: 16px; margin-top: 5px; accent-color: var(--accent); }
.draft-errors { margin: 7px 0; padding: 7px 9px; border-left: 3px solid var(--danger-btn); border-radius: 0 var(--radius-s) var(--radius-s) 0; background: var(--error-bg); color: var(--error-text); font-size: var(--fs-small); overflow-wrap: anywhere; }
.draft-fields { margin: 7px 0; display: grid; gap: 3px; }
.draft-field-row { font-size: var(--fs-body); color: var(--text-2); overflow-wrap: anywhere; }
/* 草稿箱二级 tab：待处理与纯已作废/已忽略批次分列，风格对齐一级 tab、尺寸小一号。 */
.draft-subtabs, .action-subtabs, .customer-subtabs { display: flex; gap: 2px; margin: 0 0 10px; border-bottom: 1px solid var(--border); }
.draft-subtab, .action-subtab, .customer-subtab { min-height: 32px; padding: 0 10px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-3); cursor: pointer; font: inherit; font-size: var(--fs-body); transition: color 0.16s ease, border-color 0.16s ease; }
.draft-subtab:hover, .action-subtab:hover, .customer-subtab:hover { color: var(--text); }
.draft-subtab.active, .action-subtab.active, .customer-subtab.active { border-bottom-color: var(--accent); color: var(--accent-deep); font-weight: 650; }
/* 失败生成任务卡片：失败任务不建批次，这里是失败明细与重试的持久入口。 */
.draft-failed-jobs { display: grid; gap: 8px; margin-bottom: 12px; }
.draft-failed-head { font-size: var(--fs-body); font-weight: 600; color: var(--error-text); }
.draft-failed-card { background: var(--error-bg-2); border: 1px solid var(--error-border); border-radius: var(--radius-l); padding: 11px 13px; display: grid; gap: 7px; }
.draft-failed-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.draft-failed-fragments { display: grid; gap: 4px; }
.draft-failed-fragment-row { font-size: var(--fs-body); color: var(--text-2); overflow-wrap: anywhere; border-left: 2px solid var(--error-border); padding-left: 8px; }
/* 生成中横幅：归属/重生成提交后轮询任务状态，spinner + 文案让「正在生成草稿」对用户可见。 */
.draft-generation-notice { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid var(--accent-soft-border); border-radius: var(--radius-m); background: var(--accent-soft); color: var(--accent-deep); font-size: var(--fs-body); }
.draft-generation-notice .spinner { flex: none; width: 14px; height: 14px; border: 2px solid var(--accent-soft-border); border-top-color: transparent; border-radius: 50%; animation: draft-spin 0.8s linear infinite; }
@keyframes draft-spin { to { transform: rotate(360deg); } }
/* 底部浮动操作条：勾选草稿后钉在滚动区底部，长列表不必滚回批次头部；配色对齐生成横幅。
   默认批量确认；忽略与确认不平级，须先点一次「批量忽略…」切换，主按钮才变红。 */
.draft-selection-bar { position: sticky; bottom: 0; z-index: 9; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding: 9px 12px; border: 1px solid var(--accent-soft-border); border-radius: var(--radius-m); background: var(--accent-soft); color: var(--accent-deep); box-shadow: var(--shadow-s); }
.draft-selection-bar #draftSelectedCount { font-size: var(--fs-body); font-weight: 600; }
/* 忽略模式主按钮：红色警示态，对齐 draft-errors 的错误色系。 */
.primary-command.danger { background: var(--danger-btn); border-color: var(--danger-btn-border); }
.primary-command.danger:hover { background: var(--danger-btn-hover); }

/* ── 实施周报 tab ── */
.weekly-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
/* 客户 Demo tab 工具条：与周报工具条同版式（独立类名，组件互不牵连）。 */
.demo-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ── 客户 Demo 统一搭建流程（v0.13）：素材区 / 待澄清表单 / 蓝图树视图 / 执行步骤 / 编辑弹窗 ── */
.demo-materials { margin-bottom: 10px; }
/* summary 必须是 details 直接子元素（HTML 规范）；上传按钮放 summary 内同行右对齐（同 .wiki-tree-node 模式）。
   display:flex 会吃掉默认折叠三角，补显式方向标记（▸ 展开时旋转 90°）；::before 也是 flex 子项，
   故不用 space-between（会把文字挤到行中），改用按钮 margin-left:auto 右推。 */
.demo-materials > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.demo-materials > summary::before { content: '▸'; color: var(--text-3); flex: none; transition: transform 0.15s ease; }
.demo-materials[open] > summary::before { transform: rotate(90deg); }
.demo-materials > summary .quiet-command { flex: none; margin-left: auto; }
.demo-document-list { display: grid; gap: 6px; margin-top: 6px; }
.demo-document-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel-2); font-size: var(--fs-small); color: var(--text-2); }
.demo-document-upload { font-size: var(--fs-small); color: var(--text-3); max-width: 100%; }
.demo-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-upload-hint { font-size: var(--fs-caption); color: var(--text-3); }
.demo-clarify { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--accent-soft-border); border-radius: var(--radius-m); background: var(--accent-soft); }
.demo-clarify-title { font-size: var(--fs-body); color: var(--accent-deep); margin-bottom: 8px; }
.demo-clarify-row { display: grid; gap: 4px; margin-bottom: 8px; }
.demo-clarify-row label { font-size: var(--fs-body); color: var(--text-2); }
.demo-clarify-row textarea { padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font-size: var(--fs-body); resize: vertical; }
.demo-sub-title { margin-top: 6px; font-size: var(--fs-small); font-weight: 600; color: var(--text-3); }
.demo-sub-note { margin-top: 4px; font-size: var(--fs-small); color: var(--faint); }
.demo-run { margin-top: 10px; }
.demo-run-error { margin: 4px 0; font-size: var(--fs-small); color: var(--danger); }
.demo-run-summary { margin: 8px 0 4px; font-size: var(--fs-body); color: var(--text-2); }
.demo-verify { font-size: var(--fs-small); color: var(--text-3); }
.demo-verify.is-bad { color: var(--danger); }
.demo-step-list { display: grid; gap: 4px; margin: 8px 0; }
.demo-step { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px; border-radius: var(--radius-s); background: var(--panel-2); font-size: var(--fs-small); }
.demo-step-mark { flex: none; width: 18px; text-align: center; color: var(--text-3); }
.demo-step.is-written .demo-step-mark, .demo-step.kind-create .demo-step-mark { color: var(--ok); }
.demo-step.is-failed .demo-step-mark { color: var(--danger); }
.demo-step.is-failed { background: color-mix(in srgb, var(--danger) 8%, var(--panel-2)); }
.demo-step-label { color: var(--text-2); }
.demo-step-error, .demo-step-note { color: var(--faint); overflow-wrap: anywhere; }
.demo-step-error { color: var(--danger); }
.demo-env-row { display: flex; align-items: center; gap: 8px; margin-bottom:  10px; font-size: var(--fs-body); color: var(--text-2); }
.demo-env-select { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font-size: var(--fs-body); }
.demo-build-area { display: grid; gap: 8px; }
.demo-ack-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-body); color: var(--text-2); }
.demo-editor-hint { margin-bottom: 10px; font-size: var(--fs-small); color: var(--text-3); }
.demo-editor-result { margin: 8px 0; display: grid; gap: 4px; }
.demo-editor-error { font-size: var(--fs-small); color: var(--danger); overflow-wrap: anywhere; }
/* v0.43 旧格式蓝图只读横幅（v1–v5 冻结——引导重新生成） */
.demo-legacy-banner { margin: 4px 0 8px; padding: 6px 10px; border: 1px solid var(--warn-border); border-radius: var(--radius-m); background: var(--warn-bg); color: var(--warn-text); font-size: var(--fs-small); overflow-wrap: anywhere; }
/* v0.43.1 蓝图树层级字阶（项目 strong 15 > 分组 lead 14 > 内容 body 13 > 辅助 small 12——父级不再小于子级；
   独立类不受 .cell-sub(11px) 影响，不改全局 .cell-sub 本体） */
.demo-bp-project { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); }
.demo-bp-project > summary { font-size: var(--fs-strong); font-weight: 700; color: var(--text); cursor: pointer; }
.demo-bp-section { margin: 10px 0 2px; font-size: var(--fs-lead); font-weight: 600; color: var(--text-2); }
.demo-bp-content { margin: 2px 0; font-size: var(--fs-body); color: var(--text-2); overflow-wrap: anywhere; }
.demo-bp-content.demo-bp-group { margin-top: 6px; font-weight: 600; color: var(--text-2); }
.demo-bp-meta { margin: 2px 0; font-size: var(--fs-small); color: var(--faint); overflow-wrap: anywhere; }
.demo-bp-type { margin: 6px 0 2px 4px; padding-left: 10px; border-left: 2px solid var(--border-soft); }
.demo-bp-type > summary { font-size: var(--fs-body); font-weight: 600; color: var(--text); cursor: pointer; }
.demo-bp-globalblock { margin: 8px 0; }
.demo-bp-globalblock > summary { font-size: var(--fs-lead); font-weight: 600; color: var(--text-2); cursor: pointer; }
/* v0.43.2 澄清表单 critical 必填标记 */
.demo-clarify-required { color: var(--danger); font-size: var(--fs-small); }
.demo-json-editor { width: 100%; min-height: 160px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--panel); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-small); line-height: 1.55; resize: vertical; }
/* ── v0.48 蓝图结构化编辑器：分节表单（每行一条/属性行/状态行/键值行/条目卡），JSON 降为高级模式兜底 ── */
.demo-edit-toolbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.demo-edit-form { display: grid; gap: 10px; }
.demo-edit-section { border: 1px solid var(--border-soft); border-radius: var(--radius-m); padding: 8px 12px; }
.demo-edit-section > summary { font-size: var(--fs-lead); font-weight: 600; color: var(--text); cursor: pointer; }
.demo-edit-field { display: block; margin: 8px 0 4px; }
.demo-edit-label { display: block; margin-bottom: 3px; color: var(--text-3); font-size: var(--fs-small); }
.demo-edit-field input, .demo-edit-field textarea { width: 100%; min-height: 32px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-body); }
.demo-edit-field textarea { min-height: 56px; resize: vertical; }
.demo-edit-field input:focus, .demo-edit-field textarea:focus, .demo-edit-row input:focus, .demo-edit-row select:focus { outline: 2px solid var(--focus-ring); border-color: var(--focus-border); }
.demo-edit-grouptitle { margin: 10px 0 4px; font-size: var(--fs-small); font-weight: 600; color: var(--text-3); }
.demo-edit-rows { margin: 4px 0; }
.demo-edit-rows-list { display: grid; gap: 6px; }
.demo-edit-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.demo-edit-row input[type="text"] { flex: 1 1 130px; min-width: 0; min-height: 30px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-body); }
.demo-edit-rowhead { color: var(--text-3); font-size: var(--fs-caption); }
.demo-edit-rowhead span { flex: 1 1 130px; }
.demo-edit-select { min-height: 30px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-body); max-width: 100%; }
.demo-edit-card { margin: 6px 0; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); }
.demo-edit-card > summary { font-size: var(--fs-body); font-weight: 600; color: var(--text); cursor: pointer; }
/* 卡内直属 textarea（澄清回答等）撑满卡片，与 .demo-edit-field 输入同款视觉 */
.demo-edit-card > textarea { width: 100%; margin-top: 6px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-body); resize: vertical; }
.demo-edit-minor { border-left: 2px solid var(--border-soft); }
.demo-edit-block { margin: 8px 0; padding: 4px 0 8px; border-bottom: 1px dashed var(--border-soft); }
.demo-edit-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0; }
.demo-edit-check { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-body); color: var(--text-2); }
.demo-edit-kvkey { flex: 0 0 auto; min-width: 64px; font-size: var(--fs-small); color: var(--text-3); }
.demo-edit-kvstatic { flex: 1 1 130px; font-size: var(--fs-small); color: var(--faint); overflow-wrap: anywhere; }
.demo-edit-arrow { flex: none; color: var(--text-3); }
.demo-edit-hint { display: block; margin: 2px 0; font-size: var(--fs-caption); color: var(--faint); }
.demo-edit-readonly-line { margin: 2px 0; font-size: var(--fs-small); color: var(--text-3); overflow-wrap: anywhere; }
.demo-edit-q { flex: 1 1 200px; font-size: var(--fs-body); color: var(--text-2); }
.demo-version-row { margin-bottom: 6px; }

/* ── 节点与版本（v0.22 第 2 轮）：七节点状态卡 + 产物版本行（采用旧版=恢复为新版本）── */
.demo-node-states { display: grid; gap: 10px; margin: 10px 0 14px; }
.demo-node-state { border: 1px solid var(--border-soft); border-radius: var(--radius-m); padding: 10px 12px; display: grid; gap: 4px; }
.demo-node-artifact { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; flex-wrap: wrap; }

/* ── v0.28：N7 验收清单（run 视图内嵌）与节点运行记录（输入快照摘要）── */
.demo-n7-block { margin-top: 8px; }
/* v0.30 版本与实验隔离：区间运行条的模式/快照重放入口。 */
.demo-node-runbar { display: flex; flex-wrap: wrap; gap: var(--space-2, 8px); align-items: center; }
.demo-snapshot-input { flex: 1 1 220px; min-width: 180px; }
.demo-n7-item { display: grid; gap: 2px; padding: 4px 0; border-bottom: 1px dashed var(--border-soft); }
.demo-n7-item.is-fail .cell-sub { color: var(--danger); }
.demo-node-runs { margin-top: 4px; }
.demo-node-run-row { padding: 3px 0; font-size: var(--fs-caption); color: var(--text-3); overflow-wrap: anywhere; }

/* ── Demo 统一搭建流程图「?」帮助（真实 SVG 流程图：悬停即看，点击固定展开滚动阅读）── */
.demo-flow-widget { position: relative; display: inline-flex; vertical-align: middle; }
.demo-flow-help { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--panel-2); color: var(--text-3); font-size: var(--fs-caption); line-height: 1; cursor: help; }
.demo-flow-help:hover, .demo-flow-widget:focus-within .demo-flow-help { border-color: var(--accent); color: var(--accent); }
/* 浮层：z-index 12 与下拉菜单同级（压过内容条、低于弹窗）；图表自适应宽度，窄屏等比缩放不横向滚动。 */
.demo-flow-panel { display: none; position: fixed; left: 0; top: calc(100% + 8px); z-index: 45; width: min(760px, 94vw); max-height: 72vh; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--shadow-l); }
.demo-flow-widget:hover .demo-flow-panel, .demo-flow-widget:focus-within .demo-flow-panel, .demo-flow-widget.is-open .demo-flow-panel { display: block; }
.demo-flow-title { margin-bottom: 8px; font-size: var(--fs-small); font-weight: 600; color: var(--text-2); }
.demo-flow-svg { width: 100%; overflow-x: auto; }
.demo-flow-svg svg { display: block; width: 100%; min-width: 700px; height: auto; }
.weekly-week-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-body); color: var(--text-2); }
.weekly-week-label input[type="date"] { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font-size: var(--fs-body); }
.weekly-week-select { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.weekly-week-select select { max-width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); color: var(--text); font-size: var(--fs-body); }
.weekly-notice, .generation-notice { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--accent-soft-border); border-radius: var(--radius-m); background: var(--accent-soft); color: var(--accent-deep); font-size: var(--fs-body); }
.generation-notice { margin: 0 0 12px; }
.weekly-report-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 16px; box-shadow: var(--shadow-xs); }
.weekly-report-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.weekly-stats { margin: 6px 0 12px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--panel-2); color: var(--text-2); font-size: var(--fs-body); }
.weekly-section { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* 有序列表序号约束：grid/block 显示模式会吞掉 ::marker 序号框，编号必须渲染。 */
.weekly-list { margin: 4px 0; padding-left: 24px; font-size: var(--fs-body); }
.weekly-item { display: list-item; }
.weekly-item + .weekly-item { margin-top: 5px; }
/* 空占位（（无条目）li 无 .weekly-item 类）不编号。 */
.weekly-list > li:not(.weekly-item) { display: block; color: var(--faint); }
.weekly-item-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.weekly-evidence { color: var(--faint); font-size: var(--fs-small); overflow-wrap: anywhere; }
.weekly-failure { background: var(--error-bg-2); border: 1px solid var(--error-border); border-radius: var(--radius-l); padding: 14px; display: grid; gap: 8px; }
.weekly-failure p { margin: 0; color: var(--error-text); font-size: var(--fs-body); overflow-wrap: anywhere; }

/* ── ONES Wiki 发布位置选择器（案例/周报发布共用） ── */
.wiki-picker { display: grid; gap: 10px; }
.wiki-space-select { padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-s); font-size: var(--fs-body); background: var(--panel); color: var(--text); }
.wiki-tree-host { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-m); padding: 8px; }
.wiki-tree { display: grid; gap: 3px; }
.wiki-tree-node { padding-left: 0; }
.wiki-tree-node .wiki-tree-node { margin-left: 16px; }
/* summary 必须是 details 直接子元素（HTML 规范）；按钮放 summary 内同行右对齐。 */
.wiki-tree-node > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; font-size: var(--fs-body); padding: 3px 2px; border-radius: var(--radius-s); overflow-wrap: anywhere; }
.wiki-tree-node > summary:hover { background: var(--panel-2); }
.wiki-tree-node > summary .quiet-command { flex: none; }
.wiki-tree-leaf > .wiki-tree-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wiki-tree-leaf > .wiki-tree-head .wiki-tree-title { flex: 1; font-size: var(--fs-body); padding: 3px 2px; overflow-wrap: anywhere; }
.wiki-tree-children { margin-left: 16px; display: grid; gap: 3px; }

/* ═══ 外壳玻璃轨（双主题一致）：半透明底下透出漂移的背景光晕（顶栏撤除后仅剩侧栏与审批栏） ═══ */
#sidebar, #records { -webkit-backdrop-filter: blur(14px) saturate(1.25); backdrop-filter: blur(14px) saturate(1.25); }

/* ═══ 深色科技版：玻璃拟态与霓虹光效补充（结构不变，仅叠加光感） ═══ */
[data-theme="dark"] .brand::before { box-shadow: 0 0 10px rgba(34, 211, 238, 0.9); }
[data-theme="dark"] .primary-command { box-shadow: 0 2px 14px rgba(34, 211, 238, 0.25); }
[data-theme="dark"] .primary-command:hover { box-shadow: 0 4px 22px rgba(34, 211, 238, 0.4); }
[data-theme="dark"] .nav-item.active { box-shadow: inset 3px 0 0 0 var(--nav-active-bar), 0 0 14px rgba(34, 211, 238, 0.22); }
[data-theme="dark"] .customer-tab.active, [data-theme="dark"] .agent-mode-tab.active { text-shadow: 0 0 14px rgba(99, 156, 255, 0.55); }
[data-theme="dark"] .metric-item strong { text-shadow: 0 0 18px rgba(99, 156, 255, 0.25); }
[data-theme="dark"] .card pre, [data-theme="dark"] #recordFields { border-color: var(--border-soft); box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.06); }

/* ═══ 微动效降级：用户系统开启减弱动态效果时全部收敛 ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 980px) {
  #sidebar { width: 156px; flex-basis: 156px; }
  .workbench-view { padding: 18px; }
  #workbench #customerView { padding: 18px 18px 0; }
  #customerView .customer-tab-body { margin: 0 -18px; padding: 2px 18px 18px; }
  .settings-layout { gap: 14px; }
  .settings-nav { width: 168px; padding: 8px; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric-item { border-bottom: 1px solid var(--border); }
  .definition-grid { grid-template-columns: repeat(2, 1fr); }
  .definition:nth-child(2n) { border-right: 0; }
  .risk-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  body { height: auto; min-height: 100vh; }
  .layout { display: block; }
  /* 顶栏撤除后侧栏成为唯一 sticky 外壳：品牌冠一行（右侧绝对定位头像圆）+ 6 列图标导航一行 + 状态条一行。
     高度约 108px（旧形态：54px 顶栏 + 双行文字导航 + 头像行 ≈ 190px）。 */
  #sidebar { width: 100%; flex-basis: auto; height: auto; position: sticky; top: 0; z-index: 15; padding: 8px 10px 4px; border-right: 0; border-bottom: 1px solid var(--border); transition: none; }
  #sidebar.collapsed { width: 100%; flex-basis: auto; padding: 8px 10px 4px; }
  .sidebar-crown { min-height: 44px; align-items: center; padding: 0 46px 6px 2px; }
  .sidebar-crown .sidebar-toggle { display: none; }
  .brand { font-size: var(--fs-body); }
  /* 头像圆绝对定位进品牌冠右端（设置经头像菜单进入，齿轮与姓名让位）；冠行 min-height 保证头像完全退出导航图标行。
     #sidebar 前缀提权：本媒体块在 .avatar-entry 基础规则之前，同特异性会被其 padding/margin 反杀。 */
  #sidebar .avatar-entry { position: absolute; top: 7px; right: 0; margin: 0; padding: 3px; }
  #sidebar .avatar-text, #sidebar .avatar-gear { display: none; }
  .sidebar-top { overflow: visible; flex: none; }
  .product-nav { grid-template-columns: repeat(6, 1fr); gap: 2px; }
  .nav-item { justify-content: center; padding: 0; gap: 0; }
  .nav-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .nav-count { position: absolute; left: calc(50% + 5px); top: 2px; margin: 0; min-width: 15px; height: 15px; line-height: 15px; padding: 0 4px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent-deep); font-size: var(--fs-caption); }
  .nav-item.active { box-shadow: inset 0 -3px var(--nav-active-bar); }
  .agent-sessions { display: none; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 2px 4px; }
  /* 状态（环境信息）居左、同步（动作）居右。 */
  .sidebar-foot .status { order: 1; }
  .sidebar-foot .sync-command { order: 2; min-height: 28px; padding: 0 9px; }
  /* 工具栏窄屏允许换行：搜索框独占一行，排序与刷新同行——竖排折字曾是挤压变形主因。 */
  .toolbar { flex-wrap: wrap; }
  .toolbar .quiet-command, .sort-control { flex: none; white-space: nowrap; }
  .toolbar input { flex: 1 1 140px; }
  .workbench-main { overflow: visible; }
  .workbench-view { padding: 14px 10px 28px; }
  /* 设置中心窄屏纵排：分页导航变横向滚动 chips，面板全宽。 */
  .settings-layout { flex-direction: column; }
  .settings-nav {
    position: static; width: 100%; flex-direction: row; align-items: center;
    gap: 4px; overflow-x: auto; padding: 8px;
  }
  .settings-nav-group { margin: 0 4px 0 0; white-space: nowrap; }
  .settings-nav-item { flex: none; white-space: nowrap; }
  .settings-pane { padding: 16px 14px 20px; }
  .role-matrix-table th:nth-child(2), .role-matrix-table td:nth-child(2) { display: none; }
  .audit-detail { max-width: 220px; }
  #workbench #customerView { padding: 14px 10px 0; }
  #customerView .customer-tab-body { margin: 0 -10px; padding: 2px 10px 28px; }
  /* 移动端滚动容器变为 window：批量栏冻在 sticky 侧栏外壳（实测 134px = 冠行44+导航38+状态行38+内边距）之下，低于侧栏层级防重叠。 */
  .action-bulk-bar { top: 134px; z-index: 14; }
  .view-head, .customer-detail-head { align-items: flex-start; flex-direction: column; }
  .toolbar, .toolbar input { width: 100%; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-item:nth-child(2n) { border-right: 0; }
  .definition-grid { grid-template-columns: repeat(2, 1fr); }
  .definition:nth-child(2n) { border-right: 0; }
  .risk-grid, .stat-strip { grid-template-columns: 1fr; }
  #chat { min-height: calc(100vh - 158px); }
  #records { display: none !important; }
  /* 移动端侧栏 sticky 通栏、记录面板隐藏：footer 不再让位，恢复常规内边距。 */
  footer { position: sticky; bottom: 0; }
  .agent-mode-tabs { padding-left: 10px; padding-right: 10px; overflow-x: auto; }
  .agent-mode-tab { flex: 0 0 auto; }
  .agent-work-head { align-items: flex-start; flex-direction: column; }
  .agent-work-head .row-actions { flex-wrap: wrap; }
  .hemory-assign-bar { flex-wrap: wrap; margin: 0 -10px 12px; padding: 10px; }
  .hemory-customer-box { flex: 1 1 100%; }
  .draft-batch-head { align-items: flex-start; flex-direction: column; }
  /* 页脚在移动端 sticky 钉底，浮动条上移避让，不遮住页脚内容。 */
  .draft-selection-bar { bottom: 46px; }
}

/* ── 登录门与用户菜单（多人共用：401 全屏遮罩；全部走主题 token，双主题零硬编码） ── */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.login-card {
  width: min(360px, calc(100vw - 48px));
  padding: 28px 28px 24px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(15, 23, 38, 0.28);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { margin: 0; font-size: var(--fs-title); color: var(--text); }
.login-sub { margin: 0; font-size: var(--fs-body); color: var(--text-3); line-height: 1.6; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-body); color: var(--text-2); }
.login-field input {
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-m);
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font-size: var(--fs-lead);
}
.login-field input:focus { outline: none; border-color: var(--focus-border); box-shadow: 0 0 0 3px var(--focus-ring); }
.login-error { font-size: var(--fs-body); color: var(--error-text); background: var(--error-bg); border: 1px solid var(--error-border); border-radius: var(--radius-m); padding: 8px 10px; }
.login-card .primary-command:disabled { opacity: 0.6; cursor: wait; }

.wecom-login-btn { margin-top: 2px; }

/* ── 个人中心（左下角头像，Zode 模式）：悬浮菜单 + 个人中心弹窗，全部走主题 token ── */
/* 侧栏贴底用户区：无边框无底色的一行（头像 + 姓名上/角色下 + 齿轮设置），悬停给柔和底色提示可点。 */
.avatar-entry {
  flex: none;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 8px 8px 9px;
  border-radius: var(--radius-l);
  min-width: 0;
}
.avatar-entry:hover { background: var(--nav-hover-bg); }
.user-avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--accent-soft-border);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-body);
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}
.user-avatar:hover { background: var(--accent-soft-hover); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.avatar-name {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.avatar-role { font-size: var(--fs-caption); color: var(--text-3); text-align: left; }
.avatar-gear {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-m);
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.avatar-gear:hover { background: var(--nav-hover-bg); color: var(--text); }
/* 设置视图激活时齿轮随导航高亮（v0.11 设置中心入口）。 */
.avatar-gear.active { background: var(--nav-active-bg); color: var(--nav-active-text); box-shadow: inset 0 0 0 1px var(--border); }
.avatar-menu {
  position: fixed;
  z-index: 110;
  min-width: 168px;
  padding: 6px;
  border-radius: var(--radius-l);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(15, 23, 38, 0.24);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.avatar-menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-body);
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-m);
  cursor: pointer;
}
.avatar-menu-item:hover { background: var(--panel-3); }
.avatar-menu-danger { color: var(--danger); }
.profile-body { display: grid; grid-template-columns: 150px 1fr; gap: 22px; padding: 6px 4px 2px; }
.profile-avatar-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: var(--fs-hero);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-info-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.profile-field { display: flex; align-items: baseline; gap: 12px; font-size: var(--fs-body); color: var(--text-2); }
/* 标签列 min-width 兼容四字标签（系统版本），nowrap 防「系统版/本」折行（vision 评审计为 bug 级）。 */
.profile-field span { flex: none; min-width: 56px; white-space: nowrap; color: var(--text-3); }
.profile-field b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-section-title { margin-top: 6px; font-size: var(--fs-small); color: var(--text-3); letter-spacing: 0.08em; }
.profile-info-col .quiet-command { align-self: flex-start; }
.profile-hint { margin: 4px 0 0; font-size: var(--fs-small); color: var(--text-3); line-height: 1.6; }
@media (max-width: 720px) {
  .avatar-text { display: none; }
  .profile-body { grid-template-columns: 1fr; }
}

/* ── 案例批注式局部修改（v0.4）────────────────────────────
   主区域案例全文 + 右侧批注/修订面板；窄屏（≤960px）折叠为底部面板。
   文字块 pre-wrap 精确呈现字段文本（选区偏移 = 服务端 UTF-16 码元区间）。 */
.anno-overlay {
  /* z-index 45：盖住全部内容层（≤30），但低于模态（50）与涟漪画布（60）——
     批注模式内的批注输入/确认弹窗（.modal）必须浮在本层之上，曾因 60>50 被整层盖住。
     批注 5 色调色板 --anno-c1..c5 定义在双主题 token 块（深浅各一套）。 */
  position: fixed; inset: 0; z-index: 45;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}
.anno-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  background: var(--panel); color: var(--text);
}
/* 批注模式头部按钮：按面板底色显式配色（自包含写法，不依赖全局 quiet-command 的面板底）。 */
.anno-head .quiet-command { background: transparent; border-color: var(--border); color: var(--text); min-height: 30px; flex: none; white-space: nowrap; }
.anno-head .quiet-command:hover { border-color: var(--border-strong); background: var(--panel-2); }
.anno-head-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.anno-head-title strong { font-size: var(--fs-strong); }
.anno-body { flex: 1; display: flex; min-height: 0; position: relative; }
.anno-doc {
  flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 20px 28px 80px;
  background: var(--workbench-bg); position: relative;
}
.anno-doc-inner { max-width: 860px; margin: 0 auto; }
.anno-side {
  width: 400px; flex: 0 0 400px; overflow-y: auto; padding: 14px 16px 40px;
  border-left: 1px solid var(--border); background: var(--panel-2);
  display: flex; flex-direction: column; gap: 12px;
}
.anno-heading { font-weight: 600; color: var(--text-2); margin: 18px 0 8px; font-size: var(--fs-lead); }
.anno-block {
  white-space: pre-wrap; word-break: break-word; border-radius: var(--radius-s);
  padding: 6px 8px; margin: 4px 0; border: 1px dashed transparent;
  font-size: var(--fs-lead); line-height: 1.75; cursor: text; position: relative;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.anno-block:hover { background: var(--panel-2); border-color: var(--border-soft); }
.anno-block.anno-flash { background: var(--accent-soft); border-color: var(--accent-soft-border); }
.anno-block-title { font-weight: 600; font-size: var(--fs-strong); }
/* 批注选区高亮（v0.4.3，Office/WPS 式）：行内着色底 + 实色下缘线；负 margin 抵消 1px padding，
   零布局位移；定位一律 left/top（禁 transform，v0.4.1 悬停弹跳教训）。span 不改变 textContent，
   选区偏移（服务端 UTF-16 码元区间）契约不受影响。修订中（submitted）批注无卡片，仅弱化虚线提示。 */
.anno-mark {
  border-radius: var(--radius-xs); padding: 0 1px; margin: 0 -1px; cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}
.anno-mark.anno-c1 { background: rgba(var(--anno-c1), 0.26); box-shadow: inset 0 -2px 0 rgba(var(--anno-c1), 0.85); }
.anno-mark.anno-c2 { background: rgba(var(--anno-c2), 0.26); box-shadow: inset 0 -2px 0 rgba(var(--anno-c2), 0.85); }
.anno-mark.anno-c3 { background: rgba(var(--anno-c3), 0.26); box-shadow: inset 0 -2px 0 rgba(var(--anno-c3), 0.85); }
.anno-mark.anno-c4 { background: rgba(var(--anno-c4), 0.26); box-shadow: inset 0 -2px 0 rgba(var(--anno-c4), 0.85); }
.anno-mark.anno-c5 { background: rgba(var(--anno-c5), 0.26); box-shadow: inset 0 -2px 0 rgba(var(--anno-c5), 0.85); }
.anno-mark.anno-c1.anno-mark-active { background: rgba(var(--anno-c1), 0.45); box-shadow: inset 0 -3px 0 rgba(var(--anno-c1), 1); }
.anno-mark.anno-c2.anno-mark-active { background: rgba(var(--anno-c2), 0.45); box-shadow: inset 0 -3px 0 rgba(var(--anno-c2), 1); }
.anno-mark.anno-c3.anno-mark-active { background: rgba(var(--anno-c3), 0.45); box-shadow: inset 0 -3px 0 rgba(var(--anno-c3), 1); }
.anno-mark.anno-c4.anno-mark-active { background: rgba(var(--anno-c4), 0.45); box-shadow: inset 0 -3px 0 rgba(var(--anno-c4), 1); }
.anno-mark.anno-c5.anno-mark-active { background: rgba(var(--anno-c5), 0.45); box-shadow: inset 0 -3px 0 rgba(var(--anno-c5), 1); }
.anno-mark.anno-mark-submitted { background: var(--panel-3); box-shadow: inset 0 -2px 0 var(--border-strong); cursor: default; }
.anno-practice {
  white-space: pre-wrap; color: var(--text-3); background: var(--panel-3);
  border-radius: var(--radius-s); padding: 8px 10px; margin: 4px 0; font-size: var(--fs-body); line-height: 1.7;
}
.anno-practice::before { content: '通用实践（只读）'; display: block; font-size: var(--fs-caption); color: var(--faint); margin-bottom: 4px; }
.anno-figure-wrap { margin: 14px 0; }
.anno-figure-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.anno-figure-holder { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-m); overflow: hidden; }
.anno-figure-holder svg { display: block; width: 100%; height: auto; }
.anno-figure-holder.anno-boxing { cursor: crosshair; }
.anno-box-select {
  position: absolute; border: 2px dashed var(--accent); background: var(--accent-soft);
  pointer-events: none; opacity: 0.65;
}
/* 图片批注标记（v0.4.3）：整图批注给图容器描彩边；框选批注按内容坐标换算回图上的半透明彩框。
   两者都 pointer-events:none，不挡图片工具与框选手势。 */
.anno-figure-wrap.anno-figure-mark .anno-figure-holder { outline: 2px dashed var(--border-strong); outline-offset: 2px; }
.anno-figure-wrap.anno-figure-mark.anno-c1 .anno-figure-holder { outline: 2px solid rgba(var(--anno-c1), 0.8); }
.anno-figure-wrap.anno-figure-mark.anno-c2 .anno-figure-holder { outline: 2px solid rgba(var(--anno-c2), 0.8); }
.anno-figure-wrap.anno-figure-mark.anno-c3 .anno-figure-holder { outline: 2px solid rgba(var(--anno-c3), 0.8); }
.anno-figure-wrap.anno-figure-mark.anno-c4 .anno-figure-holder { outline: 2px solid rgba(var(--anno-c4), 0.8); }
.anno-figure-wrap.anno-figure-mark.anno-c5 .anno-figure-holder { outline: 2px solid rgba(var(--anno-c5), 0.8); }
.anno-region-mark {
  position: absolute; pointer-events: none; border-radius: var(--radius-xs);
  border: 2px dashed var(--border-strong); background: transparent;
}
.anno-region-mark.anno-c1 { border-color: rgba(var(--anno-c1), 0.9); background: rgba(var(--anno-c1), 0.12); }
.anno-region-mark.anno-c2 { border-color: rgba(var(--anno-c2), 0.9); background: rgba(var(--anno-c2), 0.12); }
.anno-region-mark.anno-c3 { border-color: rgba(var(--anno-c3), 0.9); background: rgba(var(--anno-c3), 0.12); }
.anno-region-mark.anno-c4 { border-color: rgba(var(--anno-c4), 0.9); background: rgba(var(--anno-c4), 0.12); }
.anno-region-mark.anno-c5 { border-color: rgba(var(--anno-c5), 0.9); background: rgba(var(--anno-c5), 0.12); }
/* 选区末端的行内气泡按钮（紧跟选区结束点右侧、近黑底白字小圆角块）。
   反色配色双主题自适应：浅色=深底浅字、深色=浅底深字。
   禁止用 transform 参与定位——全局 .primary-command:hover 的 translateY 会覆盖它，
   悬停时按钮整块坠出光标再弹回，曾在光标下无限弹跳（v0.4.1 事故）。 */
.anno-select-button {
  position: absolute; z-index: 5;
  min-height: 24px; padding: 2px 10px; font-size: var(--fs-small); white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--radius-xs);
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-s);
}
.anno-select-button:hover { filter: brightness(1.18); }
/* 连线层（v0.4.3）：横跨文档与批注面板的整层 SVG，从选区高亮末行右端画水平切线贝塞尔到卡片左缘。
   pointer-events:none 保证不挡文字选择、图片框选与气泡按钮；z-index 4 低于气泡(5)、高于两侧内容。 */
.anno-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.anno-link { fill: none; stroke-width: 1.5; opacity: 0.7; }
.anno-link.anno-c1 { stroke: rgb(var(--anno-c1)); }
.anno-link.anno-c2 { stroke: rgb(var(--anno-c2)); }
.anno-link.anno-c3 { stroke: rgb(var(--anno-c3)); }
.anno-link.anno-c4 { stroke: rgb(var(--anno-c4)); }
.anno-link.anno-c5 { stroke: rgb(var(--anno-c5)); }
.anno-link.anno-link-active { stroke-width: 2.5; opacity: 1; }
.anno-link.anno-link-offscreen { opacity: 0.35; } /* 卡片滚出面板：线只作方向提示 */
.anno-dot { stroke: none; }
.anno-dot.anno-c1 { fill: rgb(var(--anno-c1)); }
.anno-dot.anno-c2 { fill: rgb(var(--anno-c2)); }
.anno-dot.anno-c3 { fill: rgb(var(--anno-c3)); }
.anno-dot.anno-c4 { fill: rgb(var(--anno-c4)); }
.anno-dot.anno-c5 { fill: rgb(var(--anno-c5)); }
.anno-composer { border-color: var(--accent-soft-border); }
.anno-card {
  border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--panel);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
/* 卡片色条（v0.4.3）：与文档高亮/连线同色的左缘 3px inset 阴影条（不动 border 体系、零布局位移）。 */
.anno-card.anno-c1 { box-shadow: inset 3px 0 0 0 rgb(var(--anno-c1)); }
.anno-card.anno-c2 { box-shadow: inset 3px 0 0 0 rgb(var(--anno-c2)); }
.anno-card.anno-c3 { box-shadow: inset 3px 0 0 0 rgb(var(--anno-c3)); }
.anno-card.anno-c4 { box-shadow: inset 3px 0 0 0 rgb(var(--anno-c4)); }
.anno-card.anno-c5 { box-shadow: inset 3px 0 0 0 rgb(var(--anno-c5)); }
/* 悬停联动：悬停文档高亮/卡片时对方高亮 + 连线加粗；卡片描边用该批注自己的颜色（与连线/色条同色语言）。 */
.anno-card.anno-card-active { outline: 2px solid var(--accent-soft-border); outline-offset: 1px; }
.anno-card.anno-c1.anno-card-active { outline-color: rgb(var(--anno-c1)); }
.anno-card.anno-c2.anno-card-active { outline-color: rgb(var(--anno-c2)); }
.anno-card.anno-c3.anno-card-active { outline-color: rgb(var(--anno-c3)); }
.anno-card.anno-c4.anno-card-active { outline-color: rgb(var(--anno-c4)); }
.anno-card.anno-c5.anno-card-active { outline-color: rgb(var(--anno-c5)); }
.anno-card.anno-card-submitted { border-color: var(--accent-soft-border); background: var(--panel-2); }
.anno-card.anno-card-applied { border-color: var(--ok-border); }
.anno-card-kind { font-size: var(--fs-small); color: var(--faint); }
.anno-card-excerpt {
  white-space: pre-wrap; word-break: break-word; font-size: var(--fs-body); color: var(--text-2);
  background: var(--panel-3); border-left: 3px solid var(--accent-soft-border);
  border-radius: var(--radius-xs); padding: 6px 8px; max-height: 110px; overflow-y: auto;
}
.anno-card textarea {
  width: 100%; min-height: 56px; resize: vertical; font: inherit; font-size: var(--fs-body);
  border: 1px solid var(--border); border-radius: var(--radius-s); padding: 6px 8px;
  background: var(--panel); color: var(--text);
}
.anno-card-status { font-size: var(--fs-small); color: var(--muted); }
.anno-mini-svg { border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; background: var(--panel); }
.anno-mini-svg svg { display: block; width: 100%; height: auto; }
.anno-diff { font-size: var(--fs-body); line-height: 1.7; }
.anno-diff .anno-del { text-decoration: line-through; color: var(--danger); background: var(--panel-3); border-radius: var(--radius-xs); padding: 0 3px; }
.anno-diff .anno-ins { color: var(--ok); background: var(--accent-soft); border-radius: var(--radius-xs); padding: 0 3px; }
.anno-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.anno-compare figure { margin: 0; min-width: 0; }
.anno-compare svg { display: block; width: 100%; height: auto; }
.anno-compare figcaption { font-size: var(--fs-caption); color: var(--faint); text-align: center; margin-top: 2px; }
.anno-submit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.anno-progress { font-size: var(--fs-small); color: var(--text-3); white-space: pre-wrap; }
.anno-section-title { font-weight: 600; font-size: var(--fs-body); color: var(--text-2); margin: 4px 0 -4px; }
@media (max-width: 960px) {
  .anno-body { flex-direction: column; }
  .anno-side { width: auto; flex: 0 0 46%; border-left: none; border-top: 1px solid var(--border); }
  /* 底部面板布局下连线横穿正文无意义：只保留着色高亮，不画线。 */
  .anno-links { display: none; }
}
