/* Director —— Codex 式工作台布局 v3（极简三段）
 *
 * 参照 Codex App 官方：
 *   1. 顶栏：收展按钮 + 品牌 + 线程上下文（项目 · 设备）+ 详情/设置两动作
 *   2. 任务栏两态：56px 图标 ⇄ 240px 列表（Ctrl+B / ☰ 切换）
 *   3. 中央：无框对话主线（居中阅读宽度）+ 图标化底部输入器
 *   4. 右侧：overlay 抽屉（视口/运行/提案/高级 四 tab），不挤压对话
 * 保留全部旧类名（app.js 动态渲染依赖 .kv/.badge/.events/.check-card 等）。
 */

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-deep: #0a0e13;
  --panel: #141922;
  --panel-2: #10151d;
  --border: #232b36;
  --border-soft: #1c232d;
  --text: #d3dae2;
  --text-strong: #ecf1f6;
  --muted: #8a94a0;
  /* 元信息小字（11px）：原 #646e7a 对 --surface-0/--panel 只有 3.4–3.6:1，低于正文级 4.5:1
     （2026-09-17 对比度走查实测）。提亮到 4.8–5.1:1，与 --muted 仍差 1.19 倍可见层级 */
  --muted-2: #7d8794;
  --accent: #6ca9e0;
  --accent-dim: #38506b;
  --ok: #3fa76b;
  --warn: #d9a441;
  --err: #e06666;
  --rail-w: 240px;
  --rail-w-collapsed: 56px;
  /* 等宽字族（主题无关，只活在 :root）：原先 `var(--mono)` 未定义，等于继承正文字体 */
  --mono: Consolas, monospace;
  /* UI-007：对话内容定宽与画布抽屉宽度。
     抽屉宽度 = 上限 900，但必须给对话列留住阅读宽度（100% - 任务栏 240 - 阅读 520） */
  --chat-content-w: 788px;
  --canvas-w: min(900px, max(380px, calc(100% - 760px)));

  /* 语义面/按钮/徽章/代码/发送键（浅色主题切换点；值为暗色现状） */
  --surface-0: #0f141b;
  --surface-1: #131924;
  --surface-hover: #171f2b;
  --surface-selected: #1d2836;
  --btn-bg: #1e2631;
  --btn-border: #2d3743;
  --btn-hover: #2b3a4d;
  --btn-primary-bg: #2b6cb0;
  --btn-primary-border: #3b7fc4;
  --btn-primary-hover: #3178c6;
  --btn-primary-text: #eaf2fa;
  --code-bg: #1a2330;
  --code-border: #27313f;
  --code-text: #cfe3f5;
  --pre-bg: #11161f;
  --pre-border: #1f2836;
  --send-bg: #d8dfe7;
  --send-text: #141a21;
  --send-hover: #e4eaf0;
  --send-disabled: #343d47;
  --badge-ok-bg: #1c3d2c;
  --badge-ok-fg: #63c98c;
  --badge-err-bg: #40222a;
  --badge-err-fg: #e5738f;
  --badge-warn-bg: #3a3520;
  --badge-warn-fg: #d9c56a;
  --badge-other-bg: #262d37;
  --badge-other-fg: #9aa5b1;
  --ok-strong: #7fd08a;
  --err-strong: #d97f7f;
  --warn-strong: #e6b422;
  --ok-border: #2c5a35;
  --err-border: #5a2c2c;
  --warn-border: #7a5b1e;
  --ok-tint: #131a15;
  --err-tint: #1a1313;
  --warn-tint: #1d1a12;
  --err-soft: #3c2c28;
  --ok-soft: #8fc9a5;
  --warn-soft: #d9a05a;
  --text-2: #b6c2ce;
  --text-3: #97a4b0;
  --dot-off: #4a5361;
  --focus-ring: #4d5f75;
  --focus-ring-shadow: #4d5f7514;
  --pay-bg: #6e4d17;
  --pay-border: #a3762a;
  --pay-text: #f4dcae;
  --pay-hover: #8a5f1f;
  --warn-border-hover: #a67c2a;
  /* UI-006：强边框层级（输入器内芯 / 附件 chip / 缩略图）——浅色块原本独有，
     暗色缺定义会让整条 border 声明在计算值阶段失效（可见后果=暗色无框） */
  --border-strong: #333d4b;
  /* UI-012：输入器投影（两主题各自赋值，不与弹层投影混用） */
  --composer-shadow: 0 2px 12px #0000004d;
  --composer-shadow-focus: 0 0 0 3px var(--focus-ring-shadow), 0 2px 12px #0000004d;

  /* UI-006：两主题各自赋值的语义色（共享规则里不再出现暗色专用字面量） */
  --overlay-bg: rgba(16, 19, 26, 0.84);   /* 视口浮层（始终浮在 3D 画面上） */
  --overlay-fg: #9aa5b1;
  --overlay-fg-strong: #cfe3f5;
  --overlay-accent: #8fd8ff;
  --overlay-cam: #9ecbff;
  --overlay-light: #ffd79e;
  --row-hover-bg: rgba(255, 255, 255, 0.06);
  --row-active-bg: rgba(90, 209, 255, 0.16);
  --row-active-cell-bg: rgba(90, 209, 255, 0.14);
  --glow-ok: #3fa76b66;
  --shadow-pop: 0 10px 28px rgba(0, 0, 0, .28);
  --shadow-menu: 0 14px 34px #000a;
  --shadow-modal: 0 24px 60px #000b;
  --shadow-float: 0 8px 22px #0007;
  --shadow-panel: 0 16px 40px #000a;
  --scrim: #00000073;
  --brand-gradient: linear-gradient(135deg, #6ca9e0, #8d7ec9);
  --accent-alt: #8d7ec9;   /* 第二强调色（云生成 / Seed3D 卡左边条） */
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.65 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
[hidden] { display: none !important; }
button, select, input, textarea { transition: border-color .15s, background .15s; font: inherit; }
button {
  background: var(--btn-bg);
  color: var(--text);
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  padding: 5px 13px;
  cursor: pointer;
}
button:hover { background: var(--btn-hover); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.mini { padding: 2px 9px; font-size: 12px; border-radius: 6px; }
button.mini.active { background: var(--btn-hover); border-color: var(--accent-dim); color: var(--text-strong); }
button.primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-border); color: var(--btn-primary-text); }
button.primary:hover { background: var(--btn-primary-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); padding: 4px 9px; border-radius: 7px; min-width: 0; }
/* UI-011：次级文字下限提到 11.5px（MiniMax 次级为 12px；原先 11px 偏小） */
.hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.hint.warn { color: var(--warn-soft); margin-bottom: 6px; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
summary { cursor: pointer; color: var(--text-2); }

/* ==================== 顶栏：收展 · 品牌 · 线程上下文 · 两动作 ==================== */
#topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-soft);
}
#rail-toggle {
  flex: 0 0 auto;
  width: 34px;
  padding: 4px 0;
  font-size: 14px;
  line-height: 1;
  text-align: center;
}
.brand { font-weight: 650; font-size: 15px; color: var(--text-strong); letter-spacing: -.2px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--brand-gradient); flex: 0 0 auto; }
/* 线程上下文：项目名 + 设备选择（设备状态并入下拉选项文案） */
.thread-context {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.thread-context strong { font-size: 14px; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.thread-context select { font-size: 12.5px; max-width: 240px; }
/* 离线设备清理入口：仅存在离线项时出现（host 空时不占位；flex 下 [hidden] 须显式覆盖） */
#device-cleanup-host { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
#device-cleanup-host[hidden] { display: none; }
.cleanup-q { font-size: 12px; color: var(--warn-soft); white-space: nowrap; }
/* 状态消息：空时不占位（Codex 式零噪音） */
#workbench-message { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26%; }
#workbench-message:empty { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#canvas-toggle { white-space: nowrap; }
#canvas-toggle.active, #canvas-toggle[aria-pressed="true"] { background: var(--btn-hover); border-color: var(--accent-dim); color: var(--text-strong); }
body.canvas-hidden #canvas-toggle { background: transparent; border-color: var(--border); color: var(--muted); }

/* ---- UI-007 ⋯ 菜单：结果 / 执行记录 / 高级 / 连接 / 主题 / 紧凑（顶栏只留核心） ---- */
.more-menu { position: relative; }
.more-menu > summary { list-style: none; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); }
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu[open] > summary { background: var(--btn-hover); color: var(--text-strong); }
.mm-panel {
  position: absolute; right: 0; top: 38px; z-index: 70;
  min-width: 206px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-panel);
  display: flex; flex-direction: column; gap: 2px;
}
.mm-panel button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--text);
}
.mm-panel button:hover { background: var(--surface-hover); }
.mm-panel button.active::after { content: '✓'; margin-left: auto; color: var(--accent); font-size: 12px; }
.mm-panel .mm-ic { flex: none; width: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.mm-sep { height: 1px; background: var(--border-soft); margin: 5px 4px; }
.connection-settings { position: relative; font-size: 13px; white-space: nowrap; }
.connection-settings > summary {
  list-style: none; padding: 4px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--btn-bg); text-align: center; min-width: 34px; box-sizing: border-box;
}
.connection-settings[open] > summary { background: var(--btn-hover); }
.connection-settings .conn {
  position: absolute; right: 0; top: 38px; z-index: 60;
  padding: 14px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-panel);
  display: flex; flex-wrap: wrap; gap: 8px; width: 320px;
}
.conn input {
  flex: 1 1 130px;
  padding: 5px 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.conn input:focus { outline: 1px solid var(--accent-dim); }
.conn button { flex: 1 1 100%; }
.conn-help { flex: 1 1 100%; border-top: 1px solid var(--border-soft); padding-top: 8px; }
.conn-help > summary { font-size: 11.5px; color: var(--muted); }
.conn-help p { margin: 4px 0 0; }

/* ==================== 主布局：任务栏 | 对话列(独占整屏) | 产物画布(右侧抽屉) ==================== */
#layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  position: relative; /* UI-007：画布为绝对定位抽屉的参考框 */
}
#navigation { flex: 0 0 var(--rail-w); }
body.rail-collapsed #navigation { flex-basis: var(--rail-w-collapsed); }

/* ---- 中：对话列（UI-007：独占整屏，内容居中阅读宽度；画布抽屉浮在上层不挤压本列） ---- */
#chat-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
/* 对话内容统一定宽居中（标题/消息/输入器同一竖线） */
#ai-log > *, .ai-form, #ai-hint { max-width: var(--chat-content-w); margin-inline: auto; }
/* 抽屉打开时把内容让到左侧可视区，避免被抽屉压住 */
#chat-col { transition: padding .18s ease; }
body:not(.canvas-hidden) #chat-col { padding-right: var(--canvas-w); }

/* ---- 右：产物画布（UI-007 右侧抽屉：默认收起，点产物 / ⋯ 菜单滑出） ---- */
#canvas {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 30;
  width: var(--canvas-w);
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  /* UI-009：去掉抽屉投影（用户反馈"有阴影看着不自然"）——保留 1px 边框做分界 */
  border-left: 1px solid var(--border);
  transition: transform .18s ease, visibility 0s linear 0s;
}
/* 拖拽把手：贴抽屉内边缘，默认只显 1px 分界线，悬停/拖拽时高亮 */
#canvas-resize {
  position: absolute; top: 0; bottom: 0; left: -3px; width: 7px; z-index: 3;
  cursor: col-resize; touch-action: none;
}
#canvas-resize::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: transparent;
}
#canvas-resize:hover::after, body.canvas-resizing #canvas-resize::after { background: var(--accent); }
#canvas-resize:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.canvas-resizing { cursor: col-resize; user-select: none; }
/* 拖拽期间关掉宽度/padding 过渡：否则抽屉与对话列各慢 180ms，手感发飘 */
body.canvas-resizing #canvas, body.canvas-resizing #chat-col { transition: none; }
body.canvas-hidden #canvas {
  transform: translateX(101%);
  visibility: hidden;
  pointer-events: none;
  transition: transform .18s ease, visibility 0s linear .18s;
}
.canvas-empty { flex: 1; display: grid; place-items: center; color: var(--muted-2); }
.canvas-empty .ce-box { text-align: center; }
.canvas-empty .ce-ic { font-size: 34px; margin-bottom: 10px; }
.canvas-empty b { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.canvas-empty p { font-size: 12px; margin: 0; }
.canvas-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* tab 条 */
.tab-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 10px 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.tab-btn {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-soft); border-bottom: none;
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 9px 9px 0 0;
  padding: 7px 10px 8px;
  font-size: 12.5px;
  cursor: pointer;
  max-width: 190px;
  white-space: nowrap;
  flex: none;
}
.tab-btn .tb-t { overflow: hidden; text-overflow: ellipsis; }
.tab-btn:hover { color: var(--text); }
.tab-btn.on { background: var(--bg); color: var(--text-strong); font-weight: 600; position: relative; z-index: 2; }
.tab-btn.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--bg); }
.tab-btn .tb-x { border: none; background: none; color: var(--muted-2); cursor: pointer; font-size: 13px; border-radius: 4px; width: 17px; height: 17px; display: grid; place-items: center; flex: none; }
.tab-btn .tb-x:hover { background: var(--err-soft); color: var(--err); }
.tab-btn .tb-new { flex: none; color: var(--accent); font-size: 10px; }
.canvas-body { flex: 1; min-height: 0; overflow-y: auto; }
.tab-pane { display: none; padding-bottom: 16px; }
.tab-pane.active { display: block; }

/* ==================== UI-003 结果作品化主卡（作品 / 状态 / 下一步动作） ==================== */
.work-card {
  margin: 12px 14px 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-0);
}
.work-card[data-state="unknown"] { border-color: var(--warn-border); background: var(--warn-tint); }
.work-card[data-state="failed"] { border-color: var(--err-border); background: var(--err-tint); }
.work-card[data-state="ok"] { border-color: var(--ok-border); background: var(--ok-tint); }
.work-head { display: flex; align-items: flex-start; gap: 10px; }
.work-head .work-ic { font-size: 22px; line-height: 1.2; flex: none; }
.work-head .work-title { flex: 1 1 auto; min-width: 0; }
.work-head .work-title b { display: block; font-size: 14px; color: var(--text-strong); overflow-wrap: anywhere; }
.work-head .work-title p { margin: 3px 0 0; }
.work-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.work-tech { margin: 4px 14px 0; }
.pane-fold { margin: 10px 14px; }

/* ==================== 任务栏：两态（56px 图标 ⇄ 240px 列表） ==================== */
#navigation {
  display: flex;
  flex-direction: column;
  min-height: 0; min-width: 0;
  background: var(--bg-deep);
  border-right: 1px solid var(--border-soft);
  padding: 10px 8px 8px;
  gap: 8px;
  overflow: hidden;
}
/* UI-011：一级入口对齐 MiniMax 实测（条目高约 36px、正文字号 13px） */
.new-task {
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  font-weight: 600;
  background: var(--btn-bg);
  border-color: var(--btn-border);
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}
.new-task:hover { background: var(--btn-hover); }
.new-task-icon { font-size: 15px; flex: 0 0 auto; }
.new-task-text { font-size: 13.5px; }
/* 一级入口（项目库 / 技能·连接器）：与「开始创作」同列同高，语义上都是"去某个地方" */
.rail-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.rail-nav-item {
  width: 100%; min-height: 36px; padding: 7px 12px;
  display: flex; align-items: center; gap: 9px;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--text-2); text-align: left;
}
.rail-nav-item:hover { background: var(--surface-hover); color: var(--text-strong); }
.rail-nav-item.active { background: var(--surface-selected); border-color: var(--accent-dim); color: var(--text-strong); }
.rail-nav-ic { font-size: 15px; flex: 0 0 auto; width: 18px; text-align: center; }
.rail-nav-t { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.rail-collapsed .rail-nav-item { justify-content: center; padding: 7px 0; }
body.rail-collapsed .rail-nav-t { display: none; }
.rail-scroll { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.rail-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
/* UI-020：节标题（.rail-head h2 + .rail-head-add）已撤——「项目」这个名字改由分组标题承担
   （用户对照 MiniMax 拍板：那一行就该是「项目」两个字），两个同名标题叠着反而更乱 */
#project-list { flex: 1 1 auto; min-height: 0; }
#navigation .list { padding: 0; }
/* 项目行：紧凑单行（Codex 式：图标 + 名称 ellipsis + hover 重命名） */
#navigation .list li { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; margin-bottom: 1px; cursor: pointer; overflow: hidden; }
#navigation .list li .row-title { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#navigation .list li:hover { background: var(--surface-hover); }
#navigation .list li.selected { background: var(--surface-selected); border-color: var(--accent-dim); }
#navigation .list li[hidden] { display: none; }
/* UI-019 层级图标：项目 = 文件夹、任务 = 对话气泡。线性 currentColor（不是彩色 emoji），双主题自动跟随，
   两层的"容器 / 内容"关系一眼可辨——用户对照 MiniMax 图3 指出的核心缺口 */
#navigation .list li .row-ic { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 15px; height: 15px; color: var(--muted-2); }
#navigation .list li .row-ic svg { display: block; width: 15px; height: 15px; }
#navigation .list li.selected .row-ic { color: var(--text-2); }
/* UI-018/UI-019：左栏分组标题（用户自建分组名 + 未分组）——现在就是列表的**顶层**（原「项目」节标题已撤）。
   对齐 MiniMax 图4：左边距与项目行的层级图标对齐（同为 8px 内容起点 + 1px 透明边框）、字重 500 不抢眼；
   右侧「⋯ ＋」平时隐藏、hover（或键盘聚焦）才浮出；标题与箭头点哪都能收展，未分组与命名分组规则一致 */
#navigation .list li.row-folder {
  display: flex; align-items: center; gap: 4px;
  margin: 8px 0 2px; padding: 6px 8px;
  font-size: 12px; font-weight: 500; color: var(--muted-2);
  cursor: pointer;
}
#navigation .row-folder:hover { color: var(--text); }
#navigation .row-folder-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* UI-019：折叠箭头用「﹀」（用户指定，比实心 ▾ 直观）。展开态朝下、折叠态转 -90° 变「›」；
   要 inline-block 才吃 transform，宽度固定则旋转时不挤动标题 */
#navigation .row-folder-gt {
  flex: 0 0 auto; display: inline-block; width: 12px;
  font-size: 12px; line-height: 1; text-align: center; color: var(--muted);
  transition: transform .12s;
}
#navigation .row-folder.folded .row-folder-gt { transform: rotate(-90deg); }
/* hover 才浮出：用 opacity 而非 display，占位不变 → 鼠标移入不会把「组名 ⌄」挤动；
   margin-left:auto 把「⋯ ＋」顶到行尾，中间留白（分组标题上没有计数） */
#navigation .row-folder-menu, #navigation .row-folder-add { flex: 0 0 auto; opacity: 0; transition: opacity .12s; }
#navigation .row-folder-menu { margin-left: auto; }
#navigation .row-folder:hover .row-folder-menu, #navigation .row-folder:focus-within .row-folder-menu,
#navigation .row-folder:hover .row-folder-add, #navigation .row-folder:focus-within .row-folder-add { opacity: 1; }
#navigation .row-folder-menu > summary { padding: 1px 4px; font-size: 12px; line-height: 1.2; color: var(--muted-2); }
#navigation .row-folder-menu > summary:hover { color: var(--text-strong); }
#navigation .row-folder-add {
  padding: 1px 5px; font-size: 12px; line-height: 1.2;
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--muted-2);
}
#navigation .row-folder-add:hover { background: var(--surface-hover); color: var(--text-strong); }
#navigation .row-folder-inline, #navigation .row-inline, .sub-head .proj-create-inline { display: flex; flex: 1 1 auto; min-width: 0; }
#navigation .row-inline input, #navigation .row-folder-inline input, .sub-head .proj-create-inline input, .rm-folder-new {
  width: 100%; min-width: 0; font-size: 12.5px; padding: 2px 6px; border-radius: 6px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--accent-dim);
}
/* ⋯ 菜单里的「分组」行：标签 + 下拉同排 */
.rm-folder { display: flex; align-items: center; gap: 6px; padding: 5px 9px; font-size: 12px; color: var(--muted); }
.rm-folder select, .rm-folder .rm-folder-new { flex: 1 1 auto; font-size: 12px; padding: 2px 6px; }
body.rail-collapsed #navigation li.row-folder { display: none; }
/* 项目首字图标：折叠态显示 */
#navigation .list li .row-initial { display: none; }
/* 重命名小按钮：默认低调，hover 才浮现（Codex 式 hover-reveal） */
.rail-rename, .rail-del { flex: 0 0 auto; padding: 1px 7px; font-size: 11px; opacity: 0; transition: opacity .12s; }
#navigation .list li:hover .rail-rename, .rail-rename:focus-visible,
#navigation .list li:hover .rail-del, .rail-del:focus-visible { opacity: .85; }
.rail-del:hover { color: var(--err-strong); } /* UI-006：原先引用的 --danger 从未定义（回落写死暗红），改为语义 token */
/* UI-019：项目行的「＋」= 在该项目下新建任务（与分组标题的 ＋ 同款、hover 才浮出），不抢项目名 */
#navigation .list li .row-add {
  flex: 0 0 auto; opacity: 0; transition: opacity .12s;
  padding: 1px 6px; font-size: 12.5px; line-height: 1.2;
  background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--muted-2);
}
#navigation .list li:hover .row-add, #navigation .list li:focus-within .row-add { opacity: 1; }
#navigation .list li .row-add:hover { background: var(--surface-hover); color: var(--text-strong); }
#navigation[aria-busy="true"] #project-list { opacity: .5; pointer-events: none; }

/* ---- 折叠态（56px 图标栏）：首字图标 + 新任务图标化 ---- */
body.rail-collapsed #navigation { padding: 10px 8px 8px; align-items: center; }
body.rail-collapsed .new-task { width: 40px; padding: 8px 0; justify-content: center; background: transparent; border-color: transparent; color: var(--muted); }
body.rail-collapsed .new-task:hover { background: var(--surface-hover); color: var(--text-strong); }
body.rail-collapsed .new-task-text, body.rail-collapsed .list li .row-title,
body.rail-collapsed .list li .row-meta,
body.rail-collapsed .rail-rename, body.rail-collapsed .rail-del, body.rail-collapsed .row-add,
body.rail-collapsed .rail-status .hint, body.rail-collapsed .rail-status .mini { display: none; }
/* 折叠态只留首字徽：层级图标必须带 #navigation 才盖得过 `#navigation .list li .row-ic{display:flex}` */
body.rail-collapsed #navigation .list li .row-ic { display: none; }

body.rail-collapsed .list { padding: 0; }
body.rail-collapsed .list li { flex-wrap: nowrap; justify-content: center; padding: 0; }
body.rail-collapsed #navigation .list li .row-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--surface-hover);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
}
body.rail-collapsed #navigation .list li:hover .row-initial { background: var(--surface-selected); }
body.rail-collapsed #navigation .list li.selected .row-initial { background: var(--surface-selected); border: 1px solid var(--accent-dim); color: var(--text-strong); }
body.rail-collapsed .rail-status { justify-content: center; }

/* 底部连接状态 */
.rail-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  border-top: 1px solid var(--border-soft);
  padding: 9px 8px 2px;
}
.rail-status .hint { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.on { background: var(--ok); box-shadow: 0 0 5px var(--glow-ok); }
.dot.off { background: var(--dot-off); }

/* ==================== 通用面板/列表 ==================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  flex: 0 0 auto;
}
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.panel-head h2 .hint { font-weight: 400; }
.sub-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px 4px; border-top: 1px solid var(--border-soft); margin-top: 10px; }
.sub-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); flex: 1 1 auto; }
.list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1 1 auto; }
.list li {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 3px;
  border: 1px solid transparent;
}
.list li:hover { background: var(--surface-hover); }
.list li.selected { background: var(--surface-selected); border-color: var(--accent-dim); }
.list .row-title { font-weight: 500; color: var(--text-strong); word-break: break-word; }
.list .row-meta { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-all; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.hidden { display: none; }
.badge.succeeded, .badge.check_passed { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
.badge.failed, .badge.conflicted, .badge.check_failed { background: var(--badge-err-bg); color: var(--badge-err-fg); }
.badge.queued, .badge.dispatching, .badge.running, .badge.validating_result, .badge.reconciling, .badge.uploading { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.badge.other { background: var(--badge-other-bg); color: var(--badge-other-fg); }

/* ---- UI-004 项目首页：单项目工作区总览（卡片网格；内容全部来真源查询，无封面假图） ---- */
#home-body, #capability-body { padding: 10px 14px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 10px; align-items: start; }
/* 技能·连接器页的子元素全是整幅块（说明 / 计数 / 技能列表 / 内层卡片网格），必须跨满全部列：
   否则窄窗（≤950px 抽屉整屏）时只占第一列（≈273px），技能行的「挂载 + 编辑 + 删除确认」会把
   技能名压成 0 宽、行高撑到 800px+（2026-09-17 真机窄窗走查发现）。 */
#capability-body > * { grid-column: 1 / -1; }
#home-body > .empty, #capability-body > .empty { grid-column: 1 / -1; padding: 12px 0; color: var(--muted); font-size: 12.5px; }
/* ---- UI-011 项目库：卡片网格（无封面字段 → 不画占位图，只排真实字段） ---- */
#projects-body { padding: 10px 14px 18px; }
#projects-body > .empty { padding: 12px 0; color: var(--muted); font-size: 13px; }
#projects-body > .home-note { margin: 12px 0 0; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.proj-card {
  display: flex; flex-direction: column;
  padding: 4px 4px 8px; min-height: 118px;
  background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 10px;
}
.proj-card:hover { border-color: var(--border); }
.proj-card.on { border-color: var(--accent-dim); background: var(--surface-selected); }
/* 「切换项目」是卡片内的按钮；分组控件是它的兄弟节点（不能把 select 嵌进 button） */
.proj-open {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left;
  width: 100%; flex: 1 1 auto;
  padding: 8px 9px; background: transparent; border: 1px solid transparent; border-radius: 8px;
}
.proj-open:hover { background: var(--surface-hover); }
.proj-folder-row { display: flex; align-items: center; gap: 6px; padding: 0 9px; }
.proj-folder-label { font-size: 11px; color: var(--muted-2); }
.proj-folder-pick, .proj-folder-new input { font-size: 11.5px; padding: 2px 6px; border-radius: 6px; max-width: 100%; }
.proj-folder-pick { flex: 1 1 auto; }
.proj-folder-new { display: flex; padding: 0 9px; }
.proj-folder-new input { flex: 1 1 auto; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.proj-name { font-size: 14px; font-weight: 600; color: var(--text-strong); word-break: break-word; }
.proj-id { font-size: 11px; color: var(--muted-2); word-break: break-all; }
.proj-meta { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.proj-head { font-size: 11px; color: var(--text-3); }
.proj-badge { margin-top: auto; font-size: 11px; font-weight: 600; color: var(--accent); }
#projects-search { flex: 0 1 190px; }
.home-card { border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-0); padding: 10px 12px; min-width: 0; }
.home-card > h3 { margin: 0 0 2px; font-size: 12.5px; font-weight: 600; color: var(--text-strong); }
.home-card > .hint { display: block; margin: 0 0 6px; }
.home-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.home-list > .row-meta { font-size: 11.5px; color: var(--muted); padding: 3px 0; }
.home-item { width: 100%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 5px 7px; cursor: pointer; }
.home-item:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border); }
.home-item:disabled { cursor: default; opacity: 1; }
.home-item .badge { flex: 0 0 auto; }
.home-primary { font-size: 12.5px; color: var(--text-strong); word-break: break-all; }
.home-meta { font-size: 11px; color: var(--muted); word-break: break-all; }
.home-kv { display: flex; gap: 8px; font-size: 12px; }
.home-k { flex: 0 0 66px; color: var(--muted); }
.home-v { flex: 1 1 auto; color: var(--text-2); word-break: break-all; }
.home-note { grid-column: 1 / -1; margin: 0; }
/* ---- UI-005 能力与连接：族/能力分组小标题 + 设备行动作条 ---- */
.cap-group { font-size: 11px; font-weight: 600; color: var(--muted); margin: 7px 0 1px; }
.cap-group:first-child { margin-top: 0; }
.cap-device { display: flex; align-items: center; gap: 6px; }
.cap-device > .home-item { flex: 1 1 auto; cursor: default; } /* 设备行是只读信息条（div），不装成可点按钮 */
/* ---- UI-020 技能面板（对照 MiniMax 的 Skill 面板重排）：搜索 + 来源分档 + 紧凑列表 + 底部动作栏。
   原来那段 AGENT_PRODUCTS_JSON 长说明占了面板近一半高度，已移进 ⓘ 的 tooltip ---- */
#skill-pop { width: 360px; padding: 10px; }
.sp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sp-search {
  flex: 1 1 auto; min-width: 0; font-size: 12.5px; padding: 6px 10px;
  border-radius: 8px; border: 1px solid var(--border-soft); background: var(--panel-2); color: var(--text);
}
.sp-search:focus { outline: none; border-color: var(--accent-dim); }
.sp-info {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; cursor: help;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; font-style: italic; color: var(--muted-2); border: 1px solid var(--border-soft);
}
.sp-tabs { display: flex; gap: 4px; margin-bottom: 8px; overflow-x: auto; }
.sp-tab {
  flex: 0 0 auto; padding: 3px 10px; font-size: 12px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--muted);
}
.sp-tab:hover { color: var(--text); background: var(--surface-hover); }
.sp-tab.on { background: var(--panel-2); border-color: var(--accent-dim); color: var(--text-strong); font-weight: 600; }
#skill-menu { max-height: 300px; overflow-y: auto; }
/* 行内两行式：第一行 勾选位 + 名称 + 版本 + 来源，第二行 说明单行截断（悬停看全文）。
   display: flex 必须显式给——.mp-item 是 <button>，UA 默认 inline-block，只写 flex-direction
   是不生效的（说明文字会以 inline 溢出面板，实测宽度 695px > 面板 360px）。
   white-space 同理必须给 normal，否则整行被 nowrap 撑出横向滚动条 */
#skill-menu .mp-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left;
  flex: 0 0 auto; /* 列表容器（.mp-list）也是 flex，不写这条项会被压扁——实测说明行高度被压成 0 */
  padding: 7px 9px; white-space: normal; overflow-wrap: anywhere;
}
#skill-menu .skill-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
#skill-menu .skill-check { flex: 0 0 auto; width: 10px; font-size: 11px; color: var(--accent); }
#skill-menu .skill-name { flex: 0 1 auto; min-width: 0; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#skill-menu .mp-item.on .skill-name { color: var(--text-strong); }
#skill-menu .skill-ver { flex: 0 0 auto; font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); }
#skill-menu .skill-desc { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#skill-menu .skill-bad { flex: 0 0 auto; font-size: 10.5px; color: var(--badge-err-fg); }
/* UI-017：来源标签（官方不标，用户技能显式标出，避免"这技能哪来的"） */
#skill-menu .skill-src { flex: 0 0 auto; font-size: 10.5px; font-weight: 600; padding: 0 6px; border-radius: 8px; background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
#skill-menu .skill-src-team { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
#skill-menu .skill-src-unknown { background: var(--badge-err-bg); color: var(--badge-err-fg); }
.sp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.sp-note { font-size: 11px; color: var(--muted-2); }
.cap-revoke { flex: 0 0 auto; }
/* ---- UI-013 技能编辑器：技能行操作 + 全文编辑区 ---- */
.skill-row { display: flex; align-items: center; gap: 6px; }
.skill-row > .home-item { flex: 1 1 auto; cursor: default; }
.skill-edit { flex: 0 0 auto; }
.card-actions { margin: 4px 0 6px; }
#skill-editor-name { flex: 0 1 220px; }
#skill-editor-save:disabled { opacity: .5; cursor: not-allowed; }
.skill-editor-body {
  display: block; width: calc(100% - 28px); margin: 0 14px 18px; min-height: 420px;
  padding: 10px 12px; border-radius: 8px; resize: vertical;
  background: var(--pre-bg); border: 1px solid var(--pre-border); color: var(--code-text);
  font: 12.5px/1.6 Consolas, monospace;
}
#skill-editor-dirty { color: var(--warn-soft); margin-left: auto; }
/* ---- UI-015 技能·连接器：MiniMax 式能力面（一级 tab / 技能行 / 连接器卡 / 未接入区 / 挂载开关） ----
   字号对齐 MiniMax 实测：一级 tab 14px、条目标题 15px、描述 12px；连接器卡自适应多列、单卡高 ~140px */
.cap-head { border-top: 0; padding-bottom: 4px; }
.cap-tabs { display: flex; gap: 2px; flex: 1 1 auto; }
.cap-tab {
  font-size: 14px; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: 6px 10px; cursor: pointer;
}
.cap-tab:hover { color: var(--text-2); }
.cap-tab.on { color: var(--text-strong); border-bottom-color: var(--accent); }
.cap-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 14px 8px; }
.cap-note { margin: 8px 14px; }
.cap-hero { padding: 2px 14px 8px; }
.cap-hero h3 { margin: 0 0 3px; font-size: 20px; font-weight: 600; color: var(--text-strong); }
.cap-hero .hint { margin: 0; font-size: 12px; }
.cap-list { list-style: none; margin: 0; padding: 0 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.cap-skill {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  /* 放不下就整块换行：抽屉默认宽 424px 时「挂载 + 编辑 + 删除确认」与技能名挤在一行，
     技能名会被压成 0 宽、行高撑到 800px+（2026-09-17 真机走查发现） */
  flex-wrap: wrap;
  border: 1px solid var(--border-soft); border-radius: 9px; background: var(--surface-0);
}
.cap-skill-main { flex: 1 1 auto; min-width: 0; }
.cap-skill-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 来源标签（官方 / 我的 / 团队）：三层共用一套视觉，只换色调 */
.cap-src { flex: 0 0 auto; font-size: 10.5px; font-weight: 600; padding: 0 6px; border-radius: 8px; background: var(--badge-other-bg); color: var(--badge-other-fg); }
.cap-src-personal { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
.cap-src-team { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.cap-counts { margin: 0 14px 4px; }
/* 删除的行内二次确认（不用 confirm()：无头/自动化环境不支持模态，用户也看不到上下文） */
/* 允许收缩 + 允许换行：技能名长度不受控（最长 32 字符 kebab），固定不缩会把行顶破 */
.cap-del-box { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; }
.cap-del-box > button { flex: 0 0 auto; }
.cap-del-q { font-size: 11.5px; color: var(--warn-soft); overflow-wrap: anywhere; }
button.danger { border-color: var(--badge-err-fg); color: var(--badge-err-fg); }
#cap-source { flex: 0 0 auto; }
#skill-editor-scope { flex: 0 0 auto; }
.cap-skill-name { display: block; font-size: 15px; font-weight: 600; color: var(--text-strong); font-family: var(--mono); word-break: break-all; }
.cap-skill-desc { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.cap-skill-meta { margin: 2px 0 0; font-size: 11px; color: var(--muted-2); }
.cap-skill-bad { margin: 2px 0 0; font-size: 11px; color: var(--badge-err-fg); }
.cap-switch {
  flex: 0 0 auto; width: 40px; height: 22px; padding: 0; border-radius: 11px; position: relative;
  border: 1px solid var(--border); background: var(--panel-2); cursor: pointer;
}
.cap-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted-2); transition: left .15s ease, background .15s ease;
}
.cap-switch.on { background: var(--accent-dim); border-color: var(--accent-dim); }
.cap-switch.on::after { left: 20px; background: var(--text-strong); }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 2px 14px 0; }
.cap-card {
  display: flex; flex-direction: column; gap: 6px; min-height: 140px; padding: 11px 12px;
  border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface-0);
}
.cap-card-head { display: flex; align-items: flex-start; gap: 8px; }
.cap-card-ic { font-size: 18px; line-height: 1.2; }
.cap-card-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cap-card-name { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.cap-card-kind { font-size: 11.5px; color: var(--muted-2); }
.cap-card-desc { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.cap-card-meta { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.cap-card-acts { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cap-dev { display: flex; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.cap-dev-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cap-dev-name { font-size: 12.5px; color: var(--text-2); }
.cap-dev-id { font-family: var(--mono); font-size: 11px; color: var(--muted-2); word-break: break-all; }
.cap-dev-meta { font-size: 11px; color: var(--muted); word-break: break-all; }
.cap-na-head { grid-column: 1 / -1; margin: 10px 0 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
/* 折叠区：开发环境会攒几十台历史注册设备，默认收起，撤销入口展开即可达 */
.cap-dev-more > summary { font-size: 11.5px; color: var(--muted-2); cursor: pointer; padding: 4px 0 2px; }
.cap-dev-more > summary:hover { color: var(--text-2); }
.cap-dev-more > .cap-dev { margin-top: 4px; }
.cap-card.na { min-height: 120px; opacity: .6; border-style: dashed; background: transparent; }
.cap-foot { margin: 12px 14px 16px; }
#capability-search { flex: 0 1 200px; }
#context-project { cursor: pointer; }
#context-project:hover { color: var(--accent); }

/* ==================== 中央：紧凑对话列（对话主线） ==================== */
#ai-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
}
#ai-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  scroll-behavior: smooth;
}
/* 对话列：内容宽度由上方统一规则给定（max-width + 居中） */
#ai-log > * { width: 100%; }
.ai-empty { margin: auto; max-width: 460px; padding: 26px 0 12px; font-size: 14px; line-height: 1.8; color: var(--text-3); text-align: center; }
#ai-log > .ai-empty { max-width: 460px; } /* 覆盖统一内容宽度：空态文案保持窄栏居中 */
.ai-empty h2 { color: var(--text-strong); font-weight: 500; margin: 0 0 6px; font-size: 22px; }
.ai-empty .wl-sub { margin: 0 0 16px; }
/* 欢迎态建议 chips（Minimax 式：胶囊行，不再占满整行） */
.wl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rec-chip { border: 1px solid var(--border-soft); background: var(--surface-0); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--text-2); }
.rec-chip:hover { border-color: var(--accent-dim); color: var(--text-strong); background: var(--surface-hover); }
/* 创作模板行（UI-007：由输入区折叠条迁到空态） */
.wl-templates { margin-top: 14px; align-items: center; }
.wl-label { font-size: 11px; color: var(--muted-2); }

/* ==================== UI-002 创作状态链（默认创作语言，技术枚举留在详情） ==================== */
.stage-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 9px 14px 8px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-0);
  font-size: 11.5px;
}
.stage-bar .stage-step { display: inline-flex; align-items: center; gap: 5px; color: var(--muted-2); }
.stage-bar .stage-step .stage-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dot-off); flex: 0 0 auto;
}
.stage-bar .stage-step.done { color: var(--text-3); }
.stage-bar .stage-step.done .stage-dot { background: var(--ok); }
.stage-bar .stage-step.current { color: var(--text-strong); font-weight: 600; }
.stage-bar .stage-step.current .stage-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring-shadow); }
.stage-bar .stage-step.unknown .stage-dot { background: var(--warn); }
.stage-bar .stage-step.unknown { color: var(--warn-strong); font-weight: 600; }
.stage-bar .stage-sep { color: var(--muted-2); }
.stage-bar .stage-next { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.stage-bar .stage-next button { font-size: 11px; }

/* ==================== 模型 chip + 弹出面板（一级可见入口，Minimax 式） ====================
   UI-012：chip 不再做成描边胶囊（三个并排会把动作行塞满、与发送键几何不一致），
   改为「纯文字 + ▾」的轻量按钮：前缀小字灰色、值加粗，hover / 展开时才浮出浅底。 */
.model-picker { position: relative; display: inline-flex; align-items: center; }
.model-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; background: transparent; color: var(--text-2);
  border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; font-size: 12.5px; line-height: 1.4; }
.model-chip:hover, .model-chip[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.model-chip:disabled { opacity: .5; cursor: not-allowed; }
.model-chip .chip-label { color: var(--muted-2); font-size: 11.5px; flex: 0 0 auto; }
.model-chip b { color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chip:hover b, .model-chip[aria-expanded="true"] b { color: var(--text-strong); }
.model-chip .chip-effort { color: var(--muted-2); font-size: 11px; flex: 0 0 auto; }
.model-chip .chip-caret { color: var(--muted-2); font-size: 9px; line-height: 1; flex: 0 0 auto; }
/* 面板锚点：chip 在动作行右组，弹出层右对齐才不会溢出输入器右沿 */
.model-pop { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 40; width: 236px; padding: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); }
.model-pop .mp-title { margin: 0 0 6px; font-size: 11px; color: var(--muted); }
.model-pop .mp-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.model-pop .mp-list.mp-row { flex-direction: row; }
.model-pop .mp-item { background: transparent; border: 1px solid transparent; color: var(--text-2); border-radius: 7px;
  padding: 5px 8px; font-size: 12px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pop .mp-row .mp-item { flex: 1; text-align: center; }
.model-pop .mp-item:hover { background: var(--panel-2); color: var(--text); }
.model-pop .mp-item.on { background: var(--panel-2); border-color: var(--accent); color: var(--text); font-weight: 600; }
.model-pop .hint { display: block; margin: 0; }
.ai-system { color: var(--muted-2); font-size: 11px; }
.ai-system.error { color: var(--err); }
/* 用户消息（Codex 终端式）：❯ 前缀平铺无气泡——对话流即终端会话，非聊天窗 */
.ai-msg { border-radius: 12px; padding: 10px 14px; max-width: 90%; line-height: 1.65; }
.ai-msg.user {
  align-self: stretch;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 3px 2px 3px 0;
  max-width: 100%;
  color: var(--text-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-msg.user::before { content: '❯ '; color: var(--accent); font-weight: 600; }
.ai-msg.user.queued { opacity: .55; }
.ai-msg.user.queued::after { content: ' · 排队中'; color: var(--muted); font-size: 11px; }
.ai-msg.assistant { align-self: stretch; background: transparent; border: 0; width: auto; }

/* ---- Markdown 正文（Codex 式 14px 阅读字号） ---- */
.ai-text { font-size: 14px; line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
.ai-text p { margin: 0 0 9px; }
.ai-text p:last-child { margin-bottom: 0; }
.ai-text h3, .ai-text h4, .ai-text h5, .ai-text h6 { margin: 13px 0 6px; font-weight: 600; color: var(--text-strong); }
.ai-text h3 { font-size: 15.5px; }
.ai-text h4 { font-size: 14.5px; }
.ai-text h5, .ai-text h6 { font-size: 13.5px; }
.ai-text ul, .ai-text ol { margin: 0 0 9px; padding-left: 21px; }
.ai-text li { margin: 2px 0; }
.ai-text code { background: var(--code-bg); border: 1px solid var(--code-border); border-radius: 4px; padding: 1px 5px; font: 12px Consolas, monospace; color: var(--code-text); }
.ai-text .md-code {
  margin: 7px 0 9px;
  padding: 10px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font: 12.5px/1.55 Consolas, monospace;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-text a { color: var(--accent); }
.ai-text strong { color: var(--text-strong); font-weight: 600; }

/* ---- 执行过程合并折叠组（finance execution-details 式：连续工具步 → 单卡） ---- */
.exec-group {
  align-self: stretch;
  background: var(--pre-bg);
  border: 1px solid var(--pre-border);
  border-radius: 10px;
  font-size: 12px;
  overflow: hidden;
}
.exec-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--muted);
}
.exec-group > summary::-webkit-details-marker { display: none; }
.exec-group > summary:hover { color: var(--text); }
.exec-gt { color: var(--muted-2); font-size: 10px; transition: transform .12s; }
details[open].exec-group > .exec-gt { transform: rotate(90deg); }
.exec-group-title { font-weight: 500; color: var(--text-3); }
.exec-group-status { margin-left: auto; font-size: 11px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-group-status.running { color: var(--warn); }
.exec-group-status.group-fail { color: var(--err); }
.exec-group-status.running::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  border: 1.5px solid var(--warn);
  border-top-color: transparent;
  animation: step-spin .9s linear infinite;
  vertical-align: 0;
}
.exec-steps { border-top: 1px solid var(--border-soft); padding: 4px 2px; }
/* 步骤行：✓/✻ 工具名 + 摘要（收起一行，点击展开完整 args/result） */
.exec-row { font-size: 12px; border-radius: 6px; }
.exec-row > summary {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 9px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--muted);
  min-width: 0;
  flex-wrap: wrap;
}
.exec-row > summary::-webkit-details-marker { display: none; }
.exec-row > summary:hover { background: var(--surface-hover); color: var(--text); }
.exec-ok { color: var(--ok); flex: 0 0 auto; font-size: 11px; }
.exec-ok.fail { color: var(--err); }
.exec-ok.think { color: var(--muted); }
.exec-name { color: var(--text-2); font-weight: 500; flex: 0 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.exec-row.think .exec-name { color: var(--muted); font-weight: 400; }
.exec-args { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-2); font: 11px Consolas, monospace; min-width: 0; }
.exec-row > pre {
  margin: 2px 9px 7px;
  padding: 7px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-3);
  font: 11px/1.5 Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}
.exec-row .think-args { color: var(--muted); }

/* B-4 方案 B：MCP 写工具审批卡（对齐 exec-row 密度；待决策醒目、终态收敛） */
.approval-card {
  margin: 4px 0;
  padding: 8px 10px;
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn-strong);
  border-radius: 6px;
  background: var(--warn-tint);
  font-size: 12px;
}
.approval-card.approved { border-color: var(--ok-border); border-left-color: var(--ok); background: var(--ok-tint); }
.approval-card.denied { border-color: var(--err-border); border-left-color: var(--err); background: var(--err-tint); }
.approval-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.approval-flag { color: var(--warn-strong); flex: 0 0 auto; }
.approval-name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.approval-args { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--warn-strong); font: 11px Consolas, monospace; }
.approval-card.approved .approval-args, .approval-card.denied .approval-args { color: var(--muted-2); }
.approval-body {
  margin: 6px 0 0;
  padding: 7px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-3);
  font: 11px/1.5 Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}
.approval-actions { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.approval-actions button {
  cursor: pointer;
  border: 1px solid var(--btn-border);
  border-radius: 5px;
  background: var(--surface-1);
  color: var(--text);
  padding: 4px 12px;
  font-size: 12px;
}
.approval-actions button:hover { border-color: var(--ok-border); }
.approval-allow { border-color: var(--ok-border) !important; color: var(--ok-strong) !important; }
.approval-deny { border-color: var(--err-border) !important; color: var(--err-strong) !important; }
.approval-state { color: var(--muted-2); font-size: 11px; margin-left: auto; }

/* A-2 常驻状态行：busy 时 accent 色常驻「▌ Working… …」 */
#ai-hint.working { color: var(--accent); font-weight: 500; }
#ai-hint.working::before { content: ''; display: inline-block; width: 6px; height: 10px; margin-right: 5px; border-radius: 1px; background: var(--accent); animation: hint-pulse 1.2s ease-in-out infinite; vertical-align: -1px; }
@keyframes hint-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* A-4 语义 diff：apply_patch ops 着色（+绿/−红/~黄）与结果分隔行 */
.exec-row > pre .diff-head { color: var(--muted); }
.exec-row > pre .diff-add { color: var(--ok-strong); }
.exec-row > pre .diff-del { color: var(--err-strong); text-decoration: line-through; text-decoration-color: var(--err-border); }
.exec-row > pre .diff-mod { color: var(--warn-strong); }
.exec-row > pre .diff-result { color: var(--ok); margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--border-soft); }

/* 会话行（Codex 式：嵌套在所选项目行下）：× 删除按钮对齐项目重命名样式（悬停显形）。
   UI-019：缩进 26→32px，任务图标正好落在项目名文字的左边缘（x=41）——"任务收在项目里"的嵌套关系靠这一档缩进表达 */
.rail-session { padding-left: 32px !important; }
.rail-session .row-title { font-size: 12.5px; color: var(--text-2); }
.rail-session .session-del { font-size: 12px; line-height: 1; padding: 2px 7px; }
/* 折叠态：只留当前会话图标入口（文档要求「折叠后保留当前项目和当前会话的可识别入口」） */
body.rail-collapsed .rail-session:not(.selected) { display: none; }

/* 待决审批提醒条（B-4 补强）：输入区顶部常驻，点击滚动到审批卡 */
#approval-bar {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 7px 12px;
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--warn-strong);
  border-radius: 6px;
  background: var(--warn-tint);
  color: var(--warn-strong);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#approval-bar:hover { border-color: var(--warn-border-hover); background: var(--warn-tint); }

/* 兼容旧独立卡（会话恢复旧格式渲染） */
.ai-tool, .ai-reasoning {
  align-self: stretch;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 12.5px;
  overflow: hidden;
}
.ai-tool > summary, .ai-reasoning > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  min-width: 0;
}
.ai-tool > summary::-webkit-details-marker, .ai-reasoning > summary::-webkit-details-marker { display: none; }
.step-icon { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.step-name { color: var(--accent); font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-reasoning { background: transparent; border-color: var(--border-soft); }
.ai-reasoning .step-name { color: var(--muted); font-weight: 500; }
.ai-tool-status {
  font-size: 11.5px;
  color: var(--muted);
  margin-left: auto;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 62%;
}
.ai-tool-status.running { color: var(--warn); }
.ai-tool-status.running::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  border: 1.5px solid var(--warn);
  border-top-color: transparent;
  animation: step-spin 0.9s linear infinite;
  vertical-align: -1px;
}
@keyframes step-spin { to { transform: rotate(360deg); } }
.ai-tool-status.done { color: var(--ok-soft); }
.ai-tool-status.fail { color: var(--err); }
.ai-tool-args {
  margin: 0;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-deep);
  color: var(--text-3);
  font: 11px/1.5 Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow-y: auto;
}
.ai-reasoning .ai-tool-args { color: var(--muted); }

/* ---- 内联卡（提案 / 执行 / 云生成，随消息流推进） ---- */
.ai-inline-card {
  align-self: stretch;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
  border-radius: 10px;
  padding: 11px 14px;
}
.ai-inline-card.proposal { border-left-color: var(--warn); }
.ai-inline-card.run { border-left-color: var(--accent); }
.ai-inline-card.seed3d { border-left-color: var(--accent-alt); }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-icon { font-size: 13.5px; }
.card-title { font-weight: 600; color: var(--text-strong); font-size: 13.5px; flex: 0 0 auto; }
.card-status { margin-left: auto; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.card-steps { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.card-steps li { display: inline; }
.card-steps li + li::before { content: " · "; color: var(--muted-2); }
.card-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
/* 付费确认按钮（pending_confirmation 专属）：支付色系与普通动作区分 */
.ai-inline-card.seed3d .card-actions button.pay-confirm:not([hidden]) { background: var(--pay-bg); border-color: var(--pay-border); color: var(--pay-text); }
.ai-inline-card.seed3d .card-actions button.pay-confirm:not([hidden]):hover { background: var(--pay-hover); }

/* ---- 输入器（Codex 式：大号贴底圆角容器 + 图标化动作行 + 自动增高） ---- */
#ai-hint { flex: 0 0 auto; margin: 0 auto; padding: 0 24px 8px; font-size: 11.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 15px; }
.ai-form {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 0 24px;
  margin: 0 auto 12px;
  border: 0;
  background: transparent;
  position: relative; /* UI-008：「回到最新」锚在输入器上沿 */
}
#template-hint:empty { display: none; }
/* 输入器内芯：圆角容器（UI-012：底色比页面亮一档 + 轻投影，做出 Minimax 式悬浮感） */
#ai-form .composer-box {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--composer-shadow);
  transition: border-color .15s, box-shadow .15s;
}
.ai-form:focus-within .composer-box { border-color: var(--focus-ring); box-shadow: var(--composer-shadow-focus); }
.ai-form textarea {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text-strong);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  width: 100%;
  min-height: 54px;
  max-height: 220px;
  resize: none;
  overflow-y: auto;
  padding: 14px 16px 2px;
}
.ai-form textarea::placeholder { color: var(--muted-2); }
/* 动作行：单行不换行（画布抽屉打开时对话列会窄到 ~470px，换成两行会把发送键甩下去）；
   宽度不够时按「模型名先省略 → 再隐去前缀小字」的顺序让位，发送键永远留在右端 */
.composer-actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; padding: 6px 12px 10px; container-type: inline-size; }
.composer-actions > button { flex: 0 0 auto; }
.composer-actions .model-picker { min-width: 0; }
.composer-actions .model-chip { min-width: 0; }
.composer-actions .model-chip b { min-width: 0; }
@container (max-width: 620px) {
  .composer-actions .model-chip .chip-label { display: none; }
}
/* 附件键（左组唯一控件）：无底无框的圆形图标钮，与右侧文字 chip 形成「图标 / 文字」两分组 */
.composer-actions .attach-btn {
  flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border: 1px solid transparent; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); font-size: 19px; line-height: 1;
}
.composer-actions .attach-btn:hover { background: var(--surface-hover); color: var(--text-strong); }
/* B 阶段多模态：附件 chips（输入器顶部）与用户消息缩略图 */
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 0; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 220px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-1); border: 1px solid var(--border-strong); font-size: 12px; color: var(--text-2);
}
.attach-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 1px;
}
.attach-chip button:hover { color: var(--err-strong); }
.ai-msg-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-msg-thumbs img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-0);
}
#ai-model { max-width: 170px; font-size: 12px; }
#ai-effort { font-size: 12px; }
.icon-btn { width: 30px; padding: 4px 0; text-align: center; font-size: 14px; }
.composer-spacer { flex: 1 1 auto; }
/* 发送键：与 chip 同高的胶囊，几何上收在同一条基线；放在右组末尾 */
.ai-form #ai-send {
  background: var(--send-bg);
  color: var(--send-text);
  border-color: var(--send-bg);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 18px;
  border-radius: 999px;
  margin-left: 4px;
  white-space: nowrap;
}
.ai-form #ai-send:hover { background: var(--send-hover); }
.ai-form #ai-send:disabled { background: var(--send-disabled); border-color: var(--send-disabled); color: var(--muted-2); }
.ai-form #ai-stop { background: var(--err-soft); border-color: var(--err-border); font-size: 12.5px; border-radius: 999px; }
.ai-form #ai-reconnect { background: var(--btn-bg); font-size: 12.5px; border-radius: 999px; }

/* ==================== 画布 pane 通用 ==================== */
.pane-hint { margin: 6px 14px; }
.pane-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.pane-head h2 { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text-strong); }
.pane-actions { margin-left: auto; display: flex; gap: 6px; }
#run-list { flex: none; max-height: 200px; margin: 4px 14px 0; }
.viewport-pane { border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; }
.viewport-panel { position: relative; height: 265px; min-height: 265px; }
#viewport-container { position: relative; flex: 1 1 auto; min-height: 0; }
#viewport-container canvas { display: block; width: 100%; height: 100%; }
#viewport-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12.5px;
  background: radial-gradient(ellipse at center, var(--panel), var(--bg-deep));
}
.viewport-actions { display: flex; gap: 6px; }

/* 视口浮层：视角预设（左上）/ 选中条（左下）/ 对象树（右侧）——悬浮不占版式高度 */
.vp-overlay { position: absolute; z-index: 2; display: flex; gap: 4px; align-items: center; }
.vp-views { top: 8px; left: 8px; }
.vp-select { left: 8px; bottom: 8px; max-width: calc(100% - 200px); padding: 3px 6px; border-radius: 6px; background: var(--overlay-bg); border: 1px solid var(--border-soft); }
.vp-select-id { font-family: Consolas, monospace; font-size: 11.5px; color: var(--overlay-accent); max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-tree {
  position: absolute; top: 8px; right: 8px; bottom: 8px; z-index: 2;
  width: 178px; display: flex; flex-direction: column;
  background: var(--overlay-bg); border: 1px solid var(--border-soft); border-radius: 8px;
  color: var(--overlay-fg-strong); /* 浮层自带底色，文字不能沿用 --text（浅色主题下会深底深字） */
}
.vp-tree-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; font-size: 11.5px; color: var(--overlay-fg); border-bottom: 1px solid var(--border-soft); }
.vp-tree-empty { padding: 8px; font-size: 11.5px; color: var(--overlay-fg); }
.vp-tree-list { overflow-y: auto; padding: 2px; }
.vp-tree-row { display: flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 4px; cursor: pointer; font-size: 11.5px; }
.vp-tree-row:hover { background: var(--row-hover-bg); }
.vp-tree-row.active { background: var(--row-active-bg); }
.vp-tree-row input { margin: 0; width: 12px; height: 12px; flex: none; }
.vp-tree-kind { flex: none; font-size: 10px; padding: 0 3px; border-radius: 3px; color: var(--overlay-fg); border: 1px solid var(--border-soft); }
.vp-tree-kind.cam { color: var(--overlay-cam); }
.vp-tree-kind.light { color: var(--overlay-light); }
.vp-tree-name { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#canvas .sub-head { border-top: 0; }
/* 渲染图 tab：图片检查器（finance ArtTab 式：产物大图居中） */
.render-frame { display: flex; align-items: center; justify-content: center; min-height: 320px; padding: 16px; background: var(--bg-deep); margin: 10px 14px; border: 1px solid var(--border-soft); border-radius: 10px; }
.render-frame img { max-width: 100%; max-height: 72vh; border-radius: 4px; display: block; }
.render-frame .empty { color: var(--muted-2); font-size: 12.5px; }
.render-frame .row-meta { color: var(--muted-2); font-size: 12px; }

/* 预演序列播放器（render pane 内，随 frames 制品出现）：帧图 + 播放条 */
.seq-player { margin: 0 14px 12px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-deep); overflow: hidden; }
.seq-player img { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; }
.seq-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.seq-bar input[type="range"] { flex: 1 1 160px; min-width: 120px; accent-color: var(--accent); }
.seq-bar .hint { flex: none; font-variant-numeric: tabular-nums; }
.seq-player > .hint { margin: 0; padding: 0 10px 8px; }
/* mp4 预览视频：与帧播放器等宽同容器（同一次序列渲染的两种看法） */
.seq-player video { display: block; width: 100%; max-height: 62vh; background: #000; }
/* 制品表格里的名称即操作入口（直链 401 → 改为鉴权读取按钮，外观保持链接感） */
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--muted-2); cursor: default; text-decoration: none; }

/* ==================== 画布 pane 详情区（run / proposal / advanced 共用） ==================== */
.detail-body { padding: 10px 14px; overflow-wrap: anywhere; overflow-x: auto; }
.detail-body .empty { color: var(--muted-2); }
#canvas .tab-pane > .cmd-message { margin: 0 14px; }
.kv { margin: 0 0 6px; word-break: break-all; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); font-family: Consolas, monospace; font-size: 12px; }
pre.cam { background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 5px; padding: 6px 8px; font-size: 11px; overflow-x: auto; margin: 4px 0 0; }

/* 折叠区（技术细节默认收起） */
.fold { border-top: 1px solid var(--border-soft); margin-top: 10px; }
.fold > summary { padding: 10px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-2); list-style-position: outside; }
.fold > summary .hint { font-weight: 400; }
.fold[open] > summary { color: var(--text-strong); }
#events-fold .events { border-top: 1px solid var(--border-soft); }
.tech-fold { margin-top: 0; border-top: 0; }
.tech-fold .kv { padding: 0 14px 0 28px; }
.tech-fold pre.cam { margin: 4px 14px 8px 28px; }
#advanced-controls { border-top: 1px solid var(--border-soft); margin-top: 14px; }
#advanced-controls > summary { padding: 12px 14px; color: var(--text-2); }
#advanced-controls[open] > summary { color: var(--text-strong); }

/* Seed3D 工具区（收进折叠卡，不占首屏） */
.tool-section { border-top: 1px solid var(--border-soft); margin-top: 14px; }
.tool-section > summary { padding: 12px 14px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tool-section[open] > summary { color: var(--text-strong); }
.tool-body { padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.tool-row { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.tool-body form { display: flex; flex-direction: column; gap: 8px; background: var(--surface-0); border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px; }
.tool-body label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--badge-other-fg); }
.tool-body form label:last-of-type { flex-direction: row; align-items: center; gap: 6px; }
.tool-body form > button { align-self: flex-start; }
#seed3d-list { flex: none; max-height: 260px; border-top: 1px solid var(--border-soft); }
#seed3d-list li { border: 1px solid var(--border-soft); background: var(--surface-0); display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; cursor: default; }
#seed3d-list li button { align-self: flex-start; }
#seed3d-list li p { margin: 0; word-break: break-all; font-size: 12px; color: var(--text-2); }

/* ==================== 事件流 / 检查卡 / 制品表 ==================== */
.events { list-style: none; margin: 0; padding: 6px 14px 10px; max-height: 220px; overflow-y: auto; }
.events li {
  font-family: Consolas, monospace;
  font-size: 11px;
  padding: 3px 6px;
  border-left: 2px solid var(--border);
  margin-bottom: 3px;
  background: var(--pre-bg);
  border-radius: 0 3px 3px 0;
  word-break: break-all;
}
.events li .seq { color: var(--muted-2); margin-right: 6px; }
.events li.pass { border-left-color: var(--ok); }
.events li.fail { border-left-color: var(--badge-err-fg); }
.events li.done { color: var(--muted); font-style: italic; }

.check-card { margin: 4px 14px 10px; padding: 8px 10px; border-radius: 6px; font-size: 12px; }
.check-card.empty-check { color: var(--muted-2); background: var(--pre-bg); border: 1px dashed var(--border-soft); }
.check-card.pass { background: var(--ok-tint); border: 1px solid var(--ok-border); color: var(--ok-strong); }
.check-card.fail { background: var(--err-tint); border: 1px solid var(--err-border); color: var(--badge-err-fg); }
.check-card .issues { margin: 6px 0 0; padding-left: 16px; }
.check-card .issues li { margin-bottom: 2px; }

.artifacts { margin: 4px 0 8px; border-collapse: collapse; width: 100%; font-size: 11px; }
.artifacts th, .artifacts td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--border-soft); }
.artifacts th { color: var(--muted); font-weight: 500; }
.artifacts td.mono { font-family: Consolas, monospace; color: var(--text-3); }
/* 视口选中 ↔ 表联动：高亮命中行（相机/对象/快照表共用） */
tr.row-active > td { background: var(--row-active-cell-bg); }
.artifacts a { color: var(--accent); text-decoration: none; }
.artifacts a:hover { text-decoration: underline; }
.state-chip { padding: 0 6px; border-radius: 8px; font-size: 10px; }
.state-chip.staged { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.state-chip.referenced { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }

.inspect-card { margin: 4px 0 8px; max-height: 320px; overflow-y: auto; }
.inspect-card .sub-head h3 { margin: 4px 0 6px; font-size: 12px; color: var(--badge-other-fg); }

/* ==================== 高级参数表单 ==================== */
.command-form { padding: 8px 4px 12px; }
.command-form label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--badge-other-fg); flex: 1 1 140px; }
.command-form input, .command-form select {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 4px 6px;
  font: inherit;
  width: 100%;
}
.form-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.triple { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.quad { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 4px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
#cmd-submit { flex: 0 0 auto; }
.cmd-message { margin-top: 6px; font-size: 11px; color: var(--badge-warn-fg); min-height: 16px; word-break: break-all; }
.cmd-message.error { color: var(--badge-err-fg); }

.cameras { margin: 4px 0 2px; border-collapse: collapse; width: 100%; font-size: 11px; }
.cameras th, .cameras td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--border-soft); }
.cameras th { color: var(--muted); font-weight: 500; }
.cameras td.mono { font-family: Consolas, monospace; color: var(--text-3); }
.cameras td:last-child { white-space: nowrap; }

/* 动态行（scene.setup / camera.set_path / scene.apply_patch） */
.dyn-block { margin-bottom: 8px; }
.dyn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 11px; color: var(--badge-other-fg); }
.dyn-head .hint { flex: 1 1 auto; }
.dyn-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr 30px;
  gap: 4px;
  margin-bottom: 4px;
  align-items: center;
}
.dyn-row.shot-row { grid-template-columns: 1fr 1fr 1fr 30px; }
.dyn-row .triple, .dyn-row .quad { grid-column: 1 / -1; }
.dyn-row input, .dyn-row select {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 3px 6px;
  font: inherit;
  min-width: 0;
}
.row-del { padding: 2px 0; text-align: center; }

/* ==================== 提案区 ==================== */
#proposal-list { max-height: 200px; flex: none; margin: 4px 14px; }
#proposal-list button { width: 100%; text-align: left; overflow-wrap: anywhere; }
#proposal-detail { padding: 10px 14px; }
#proposal-detail h4 { margin: 10px 0 4px; font-size: 12.5px; color: var(--text-2); }
#proposal-detail p { margin: 4px 0; }
#proposal-detail ol { padding-left: 22px; }
#proposal-detail li { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
#proposal-detail pre { padding: 12px; background: var(--bg-deep); border-radius: 7px; font-size: 12px; }
#proposal-detail .form-actions { flex-wrap: wrap; }
#proposal-confirm { background: var(--btn-primary-bg); border-color: var(--btn-primary-border); color: var(--btn-primary-text); }
#proposal-detail .fold { margin-top: 6px; border-top: 0; }
#proposal-detail .fold > summary { padding: 4px 0; font-size: 11.5px; font-weight: 400; color: var(--muted); }

/* ==================== 响应式 ==================== */
@media (max-width: 1150px) {
  .thread-context strong { max-width: 30%; }
}
@media (max-width: 950px) {
  /* UI-006：窄屏要纵向滚动（height:auto），但**必须裁横向**——收起的抽屉用
     translateX(101%) 停在屏外，`overflow: auto` 会把这段 833px 偏移算进 scrollWidth，
     实测 `scrollTo(900,0)` 能真的横移 833px（露出空白并可横拖）。 */
  body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  #layout { flex-direction: column; }
  #navigation { border-right: 0; border-bottom: 1px solid var(--border-soft); flex: 0 0 auto; }
  body.rail-collapsed #navigation { flex-direction: row; align-items: center; }
  body.rail-collapsed .rail-scroll { display: none; }
  .rail-section { min-height: 200px; }
  #project-list { max-height: 200px; }
  #chat-col { flex: 1 1 auto; min-height: 78dvh; border-right: 0; }
  /* 窄屏抽屉改为整屏浮层，不让对话列让位（否则内容会被挤成一条）；
     整屏下没有可拖的余地 → 把手隐藏，且 JS 会摘掉自定义宽度 */
  :root { --canvas-w: 100%; }
  #canvas-resize { display: none; }
  body:not(.canvas-hidden) #chat-col { padding-right: 0; }
  .thread-context select { max-width: 160px; }
  #ai-model { max-width: 150px; }
}
@media (max-width: 620px) {
  #topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .thread-context { order: 3; flex-basis: 100%; }
  .thread-context strong { max-width: 100%; }
  #workbench-message { display: none; }
  .composer-spacer { flex-basis: 100%; height: 0; }
  .composer-actions #ai-send { flex: 1 1 100%; }
  #ai-model { max-width: 100%; flex: 1 1 130px; }
  #ai-hint { padding: 0 4px 4px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ==================== 浅色主题（html[data-theme=light]） ==================== */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fa;
  --bg-deep: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f0f3f7;
  --border: #d0d7de;
  --border-soft: #e1e7ed;
  --border-strong: #b9c2cd;
  --composer-shadow: 0 2px 10px #00000014;
  --composer-shadow-focus: 0 0 0 3px var(--focus-ring-shadow), 0 2px 10px #00000014;
  --text: #1f2430;
  --text-strong: #0d1117;
  --muted: #57606a;
  /* 元信息小字（11px）：原 #8b949e 对白底只有 3.08:1（对比度走查实测），调深到 4.6–5.3:1 */
  --muted-2: #646d78;
  --accent: #0969da;
  --accent-dim: #a8c9e8;
  --ok: #1a7f37;
  --warn: #9a6700;
  --err: #cf222e;
  --surface-0: #ffffff;
  --surface-1: #f0f3f7;
  --surface-hover: #e7ecf2;
  --surface-selected: #d7e5f4;
  --btn-bg: #f0f3f6;
  --btn-border: #c8d1da;
  --btn-hover: #e4e9ef;
  --btn-primary-bg: #1f6feb;
  --btn-primary-border: #2f7ef7;
  --btn-primary-hover: #3b82f6;
  --btn-primary-text: #ffffff;
  --code-bg: #eef1f5;
  --code-border: #d8dee5;
  --code-text: #0550ae;
  --pre-bg: #f3f6f9;
  --pre-border: #e1e7ed;
  --send-bg: #1f2430;
  --send-text: #ffffff;
  --send-hover: #343c48;
  --send-disabled: #c5ccd4;
  --badge-ok-bg: #daf5e3;
  --badge-ok-fg: #116731;
  --badge-err-bg: #ffe1e5;
  --badge-err-fg: #b6363f;
  --badge-warn-bg: #fff3d1;
  --badge-warn-fg: #8a6100;
  --badge-other-bg: #e9edf2;
  --badge-other-fg: #5b6672;
  --ok-strong: #1a7f37;
  --err-strong: #cf222e;
  --warn-strong: #9a6700;
  --ok-border: #9cd2b2;
  --err-border: #f0b7bb;
  --warn-border: #e3c063;
  --ok-tint: #eaf7ef;
  --err-tint: #fdeff0;
  --warn-tint: #fdf6e3;
  --err-soft: #f7e5e7;
  --ok-soft: #1a7f37;
  --warn-soft: #9a6700;
  --text-2: #414a56;
  --text-3: #6a7581;
  --dot-off: #c3cbd4;
  --focus-ring: #6fa8dc;
  --focus-ring-shadow: #0969da22;
  --pay-bg: #fff0d4;
  --pay-border: #d4a72c;
  --pay-text: #6b4d00;
  --pay-hover: #ffe7b0;
  --warn-border-hover: #d4a72c;

  /* UI-006：浅色侧的语义色（与暗色块同名同义，浮层/选中/投影随主题走，
     不再用「暗色专用字面量 + 逐条 light 覆盖」的方式打补丁） */
  --overlay-bg: rgba(255, 255, 255, 0.88);
  --overlay-fg: #57606a;
  --overlay-fg-strong: #1f2430;
  --overlay-accent: #0969da;
  --overlay-cam: #0550ae;
  --overlay-light: #9a6700;
  --row-hover-bg: rgba(0, 0, 0, 0.045);
  --row-active-bg: rgba(9, 105, 218, 0.14);
  --row-active-cell-bg: rgba(9, 105, 218, 0.12);
  --glow-ok: #1a7f3766;
  --shadow-pop: 0 10px 28px #0002;
  --shadow-menu: 0 14px 34px #0002;
  --shadow-modal: 0 24px 60px #0003;
  --shadow-float: 0 8px 22px #0002;
  --shadow-panel: 0 16px 40px #0002;
  --scrim: #00000040;
  --brand-gradient: linear-gradient(135deg, #0969da, #8d7ec9);
  --accent-alt: #6f42c1;
}

/* ==================== 紧凑模式（body.compact / Alt+X） ==================== */
/* Codex 紧凑对话：字号与密度收紧——执行行更矮、pre 限高、卡片瘦身 */
#compact-toggle.active { background: var(--btn-hover); border-color: var(--accent-dim); color: var(--text-strong); }
body.compact { font-size: 13px; }
body.compact .ai-msg { line-height: 1.5; padding: 2px 2px 2px 0; }
body.compact .ai-text { font-size: 13px; line-height: 1.55; }
body.compact .ai-text h3, body.compact .ai-text h4, body.compact .ai-text h5, body.compact .ai-text h6 { margin: 9px 0 4px; }
body.compact .ai-empty { padding: 18px 0 8px; font-size: 13px; }
body.compact .ai-empty h2 { font-size: 19px; }
body.compact .rec-chip { padding: 7px 11px; font-size: 12.5px; }
body.compact .exec-row { margin: 1px 0; }
body.compact .exec-row > summary { padding: 2px 8px; font-size: 12px; }
body.compact .exec-group > summary { padding: 3px 8px; }
body.compact .exec-row > pre { font-size: 11px; max-height: 150px; padding: 5px 9px; }
body.compact .approval-card { padding: 6px 9px; }
body.compact .approval-body { max-height: 130px; }
body.compact .ai-inline-card { padding: 8px 10px; }
body.compact .ai-system { font-size: 10.5px; }
body.compact .ai-form textarea { font-size: 13px; min-height: 44px; padding: 10px 13px 2px; }
body.compact .composer-actions { padding: 6px 10px 8px; }
body.compact #ai-hint { font-size: 11px; padding-bottom: 6px; }
body.compact .ai-form { margin: 0 auto 8px; }

/* ==========================================================================
   UI-008：对照 MiniMax 客户端补齐的对话体验与操作面
   （回到最新 / 消息操作条 / 选项确认卡 / 项目行菜单 / Ctrl+K 搜索 / 布局切换）
   ========================================================================== */

/* ---- 回到最新消息：锚在输入器上沿，仅脱离自动跟随时出现 ---- */
.jump-latest {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  z-index: 20; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-size: 12px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text-2);
  box-shadow: var(--shadow-float);
}
.jump-latest:hover { background: var(--surface-hover); color: var(--text-strong); border-color: var(--accent-dim); }

/* ---- 消息操作条：默认淡显，悬停 / 聚焦时实显（不喧哗，但与消息一一对应） ---- */
.msg-actions { display: flex; align-items: center; gap: 4px; margin-top: 6px; opacity: .38; transition: opacity .12s; }
.ai-msg:hover .msg-actions, .ai-msg:focus-within .msg-actions { opacity: 1; }
.msg-act {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 1px 7px; font-size: 11px; line-height: 1.6; color: var(--muted);
}
.msg-act:hover { background: var(--surface-hover); color: var(--text); }
.msg-act.on { background: var(--surface-selected); border-color: var(--accent-dim); color: var(--text-strong); }
.msg-fold { color: var(--accent); }
/* 长文本折叠：超过阈值才加 .msg-collapsed（阈值判定在 aiMsgActions） */
.ai-msg.msg-collapsed > .ai-text { max-height: 420px; overflow: hidden; position: relative; }
.ai-msg.msg-collapsed > .ai-text::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: linear-gradient(transparent, var(--bg));
}
/* Ctrl+K 命中消息：短时高亮定位 */
.ai-msg.msg-hit { animation: msg-hit 1.6s ease-out; }
@keyframes msg-hit { 0% { background: var(--surface-selected); } 100% { background: transparent; } }

/* ---- ```options 选项确认卡（提示词约定 + 前端渲染；不是审批） ---- */
.confirm-card {
  border: 1px solid var(--accent-dim); border-radius: 10px;
  background: var(--surface-1); padding: 10px 12px; margin: 8px 0;
}
.confirm-card[data-done="1"] { border-color: var(--border); opacity: .75; }
.cc-title { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.cc-opts { display: flex; flex-direction: column; gap: 6px; }
.cc-opt {
  text-align: left; background: var(--btn-bg); border: 1px solid var(--btn-border);
  border-radius: 8px; padding: 7px 11px; font-size: 13px; color: var(--text);
}
.cc-opt:hover { background: var(--btn-hover); border-color: var(--accent); }
.cc-opt.rec { border-color: var(--accent-dim); }
.cc-opt.chosen { background: var(--surface-selected); border-color: var(--accent); color: var(--text-strong); font-weight: 600; }
.confirm-card[data-done="1"] .cc-opt:not(.chosen) { opacity: .5; }

/* ---- 项目行 ⋯ 菜单（原 ✎ / ✕ 收进来） ---- */
.row-menu { position: relative; flex: 0 0 auto; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { opacity: 1; }
.rm-panel {
  position: absolute; right: 0; top: 26px; z-index: 60; min-width: 168px;
  display: flex; flex-direction: column; gap: 2px; padding: 5px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-menu);
}
.rm-panel button {
  width: 100%; text-align: left; font-size: 12.5px; padding: 6px 9px;
  background: transparent; border: 1px solid transparent; border-radius: 7px; color: var(--text);
}
.rm-panel button:hover { background: var(--surface-hover); }
body.rail-collapsed .row-menu { display: none; }
/* 行自身 `overflow: hidden`（.list li 的省略号裁剪）会把绝对定位的 .rm-panel
 * 整块裁掉——面板从行底伸出去，命中测试点落到下一个分组头，菜单项点不动。
 * 展开时让该行不再裁剪并抬升，压过后续行与分组头（弹层本就该在最上层）。 */
#navigation .list li:has(> details.row-menu[open]) { overflow: visible; position: relative; z-index: 40; }

/* ---- Ctrl+K 搜索面板 ---- */
.search-panel {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh; background: var(--scrim); backdrop-filter: blur(2px);
}
.sp-box {
  width: min(640px, 92vw); max-height: 68vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-modal); overflow: hidden;
}
.sp-box input {
  width: 100%; padding: 13px 16px; font-size: 14px;
  background: var(--panel-2); border: 0; border-bottom: 1px solid var(--border);
  color: var(--text-strong); outline: none; /* 焦点可见性由 .sp-box:focus-within 的环提供 */
}
/* UI-006：搜索框原本 outline:none 且无替代指示——键盘用户看不到焦点在哪 */
.sp-box:focus-within { border-color: var(--focus-ring); box-shadow: var(--shadow-modal), 0 0 0 3px var(--focus-ring-shadow); }
.sp-results { flex: 1 1 auto; overflow-y: auto; padding: 6px; }
.sp-hit {
  display: flex; align-items: baseline; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 7px 10px; font-size: 13px; color: var(--text);
}
.sp-hit.on, .sp-hit:hover { background: var(--surface-selected); border-color: var(--accent-dim); }
.sp-kind { flex: 0 0 auto; font-size: 10.5px; color: var(--muted-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.sp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-none { margin: 0; padding: 14px 12px; font-size: 12.5px; color: var(--muted-2); }
.sp-hint { margin: 0; padding: 7px 14px; font-size: 11px; color: var(--muted-2); border-top: 1px solid var(--border-soft); }
.mm-hint { margin-left: auto; font-size: 11px; color: var(--muted-2); }

/* ---- 布局切换（Ctrl+\ / ⋯ 菜单）：html[data-layout] 驱动，不改 canvas.open 语义 ---- */
[data-layout="chat"] #canvas { transform: translateX(101%); visibility: hidden; pointer-events: none; }
/* 对话列的 padding 必须带 html 前缀：body:not(.canvas-hidden) #chat-col 的
 * 优先级 (0,1,1,1) 高于裸 [data-layout="x"] #chat-col 的 (0,1,1,0)，
 * 否则「仅对话 / 画布在左」仍会被右抽屉的让位 padding 挤窄。 */
html[data-layout="chat"] #chat-col { padding-right: 0; }
[data-layout="chat"] #canvas-toggle { display: none; }
[data-layout="canvas"] #chat-col { display: none; }
/* 同因：body.canvas-hidden #canvas（抽屉无 tab 时收起）会把它推出屏幕，
 * 必须带 html 前缀与之同优先级、靠后覆盖——「仅画布」下抽屉开合无意义。 */
html[data-layout="canvas"] #canvas {
  position: static; flex: 1 1 auto; width: auto; min-width: 0;
  transform: none; visibility: visible; pointer-events: auto;
  border-left: 0; box-shadow: none;
}
html[data-layout="canvas"] #canvas-toggle { display: none; }
/* 画布在左：把手换到抽屉右边缘（拖右变宽） */
[data-layout="chat-right"] #canvas-resize { left: auto; right: -3px; }
[data-layout="chat"] #canvas-resize, [data-layout="canvas"] #canvas-resize { display: none; }
[data-layout="chat-right"] #canvas {
  left: 0; right: auto;
  border-left: 0; border-right: 1px solid var(--border);
}
html[data-layout="chat-right"] #chat-col { padding-right: 0; padding-left: var(--canvas-w); }
[data-layout="chat-right"] body.canvas-hidden #chat-col { padding-left: 0; }
[data-layout="chat-right"] body.canvas-hidden #canvas { transform: translateX(-101%); }
