/* =============================================================
   OpenClaw 操作台 · style.css（v2 完整版）
   延续 v1 体系：冷灰蓝浅底 + 单一靛蓝强调 + 等宽字体 = 命令语言
   零外部依赖；全部主题色经 CSS 变量组织；桌面优先（min-width 960px）
   ============================================================= */

/* ------------------------- 主题变量 ------------------------- */
:root {
  /* 基础色 */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f2f6;
  --fg: #17181c;
  --fg-2: #3d4350;
  --fg-3: #667085;
  --accent: #3e63dd;
  --accent-strong: #3353c4;
  --accent-soft: #eef2fe;
  --accent-line: #ccd9fb;
  --border: #e5e7ee;
  --border-strong: #d3d8e3;
  /* 语义色（对白底均达 WCAG AA） */
  --ok: #0e7a52;   --ok-soft: #e6f4ee;   --ok-line: #bfe3d2;
  --warn: #96590a; --warn-soft: #fdf3e2; --warn-line: #f0dcb3;
  --err: #c62828;  --err-soft: #fdecec;  --err-line: #f2c7c7;
  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;
  /* 形状与海拔 */
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --shadow-s: 0 1px 2px rgba(23, 24, 28, 0.05);
  --shadow-m: 0 4px 16px rgba(23, 24, 28, 0.10);
  /* 布局 */
  --topbar-h: 52px;
  --sidebar-w: 256px;
  --gutter: 40px;
  --focus-ring: 0 0 0 3px rgba(62, 99, 221, 0.16);
}

/* ------------------------- 基础 ------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; min-width: 960px; } /* 桌面优先：窄于此整体横向滚动 */

body {
  margin: 0;
  height: 100vh;
  font: 15px/1.7 var(--font);
  color: var(--fg);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
a { color: inherit; }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #d6dae4;
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #b9c0cf; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------- 顶栏 ------------------------- */
.topbar {
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark { display: block; flex: none; }

.brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-name em { font-style: normal; color: var(--fg-3); font-weight: 500; }

/* 登录即身份：当前身份 + 在线状态 */
.identity-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.identity-avatar {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}

.identity-name { font-size: 13px; font-weight: 600; color: var(--fg); }

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2.4s ease-in-out infinite;
}

.identity-state { font-size: 12px; color: var(--fg-3); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.model-badge {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
}

.conn-lamp {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
}
.conn-lamp--ok { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
.conn-lamp--warn { background: var(--warn); }

/* ------------------------- 骨架 ------------------------- */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - var(--topbar-h)); /* #4 · 显式高度，防止 grid 行被内容撑破导致侧栏滚动失效 */
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* ------------------------- 左栏 ------------------------- */
.sidebar {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 20px 14px;
  background: var(--bg);
  border-right: 1px solid var(--border);
}

.side-section { display: flex; flex-direction: column; }

.side-title {
  margin: 0 0 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.04em;
}

.session-list, .dir-tree, .dir-children { margin: 0; padding: 0; list-style: none; }

.session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}

.session-item + .session-item { margin-top: 2px; }

.session-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item:hover { background: rgba(23, 24, 28, 0.05); color: var(--fg); }

.session-item.is-active {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: inset 2px 0 0 var(--accent), var(--shadow-s);
  color: var(--fg);
}

/* #10 · 主会话显眼标识：accent 边框 + 淡底（选中态也保持可辨） */
.session-item.is-main {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--fg);
}
.session-item.is-main.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent), var(--shadow-s);
}
.session-item.is-main .session-name { font-weight: 600; }

.session-pin { flex: none; font-size: 13px; line-height: 1; }

/* #2 · 主会话 caret + 子会话列表收起 */
.session-caret { flex: none; width: 12px; text-align: center; font-size: 10px; color: var(--fg-3); }
.session-list.is-subs-collapsed .session-item--sub { display: none; }

/* #5 · 会话列表加载失败提示 */
.session-item--error { color: var(--err); font-style: normal; }
.session-item--error:hover { background: var(--err-soft); color: var(--err); }

.session-sync { font-size: 12px; color: var(--accent); flex: none; }

.session-item--placeholder:empty {
  min-height: 34px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-m);
}

/* 区块导航 */
.side-nav .nav-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: var(--radius-m);
  padding: 9px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s, color 0.12s;
}

.side-nav .nav-item + .nav-item { margin-top: 2px; }

.side-nav .nav-item svg { flex: none; width: 17px; height: 17px; color: var(--fg-3); }

.side-nav .nav-item:hover { background: rgba(23, 24, 28, 0.05); color: var(--fg); }
.side-nav .nav-item:hover svg { color: var(--fg-2); }

.side-nav .nav-item:active { background: var(--border); }

.side-nav .nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.side-nav .nav-item.is-active svg { color: var(--accent); }

/* P2 留位脚注 */
.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.foot-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-s);
  font-size: 12px;
  color: var(--fg-3);
  text-decoration: none;
  cursor: pointer;
}
.foot-link:hover { background: rgba(23, 24, 28, 0.05); color: var(--fg-2); }

.foot-text { flex: 1 1 auto; }

.foot-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0 4px;
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot--ok { background: var(--ok); }
.dot--off { background: var(--border-strong); }

/* ------------------------- 主区与视图切换 ------------------------- */
.stage { min-width: 0; min-height: 0; display: flex; } /* #4 · 消掉 grid 项自动最小尺寸，主区内容不再把行撑高 */

.view { display: none; min-width: 0; min-height: 0; flex: 1 1 auto; }
.view.is-visible { display: flex; flex-direction: column; }

.view--page.is-visible { overflow-y: auto; }

.view-inner {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px var(--gutter) 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.view-inner--wide { max-width: 1240px; }

/* 通用卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title { margin: 0; font-size: 14px; font-weight: 650; }

.card-note { margin-left: auto; font-size: 12px; color: var(--fg-3); }

/* “即将上线” 留壳标签 */
.soon-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ===================== ① 对话区 ===================== */
.view--chat { background: var(--surface); }

.chat-msg-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 32px var(--gutter) 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  list-style: none;
}

.chat-msg {
  max-width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-msg-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-msg-body { margin: 0; font-size: 15px; line-height: 1.75; text-wrap: pretty; }

/* 用户：右对齐淡靛气泡 */
.chat-msg--user { align-self: flex-end; align-items: flex-end; }

.chat-msg--user .chat-msg-body {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-l);
  border-bottom-right-radius: 4px;
  padding: 10px 14px;
}

/* 飞书侧：左对齐中性气泡 + ⟳ 同步符 */
.chat-msg--feishu { align-self: flex-start; align-items: flex-start; }

.chat-msg--feishu .chat-msg-sender::before { content: "⟳"; font-size: 11px; color: var(--accent); }

.chat-msg--feishu .chat-msg-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  border-top-left-radius: 4px;
  padding: 10px 14px;
}

/* Agent：无气泡整块 */
.chat-msg--agent { align-self: flex-start; align-items: flex-start; }

.chat-msg--agent .chat-msg-sender::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.chat-msg--agent .chat-msg-body { padding: 0; }

/* 代码块 */
.chat-msg-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.4em;
}

.chat-msg-code {
  margin: 4px 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 13px 16px;
  overflow-x: auto;
}
.chat-msg-code code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

/* --- 决策卡 --- */
.decision-card {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 16px 18px;
}

.decision-head { display: flex; align-items: center; gap: 10px; }

.decision-title { font-size: 14px; font-weight: 650; flex: 1 1 auto; }

.decision-desc { margin: 0; font-size: 13px; color: var(--fg-2); }

.decision-options { display: flex; flex-wrap: wrap; gap: 8px; }

.decision-option {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.decision-option:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.decision-option:active { transform: translateY(1px); }
.decision-option.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.decision-option:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.decision-other { display: flex; align-items: center; gap: 8px; }

.decision-other-label { font-size: 12px; color: var(--fg-3); flex: none; }

.decision-other-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.decision-other-input::placeholder { color: #8a93a3; }
.decision-other-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }

/* --- 任务卡 --- */
.task-card {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 14px 16px;
}

.task-head { display: flex; align-items: center; gap: 10px; }

.task-name { font-size: 13.5px; font-weight: 650; flex: 1 1 auto; }

.task-flow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.task-flow .is-done { color: var(--ok); }
.task-flow .is-now { color: var(--accent-strong); font-weight: 700; }
.task-flow .is-now.is-err { color: var(--err); }
.flow-sep { color: var(--border-strong); }

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--fg-3);
}

.task-id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.task-actions { display: flex; gap: 8px; margin-top: 2px; }

.task-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 4px 14px;
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.task-btn:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-strong); }
.task-btn:active { transform: translateY(1px); }
.task-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* --- 状态徽标（四态，贯穿全区） --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg-2);
  white-space: nowrap;
}
.status-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-badge--running, .status-badge[data-state="running"] {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong);
}
.status-badge--running::before, .status-badge[data-state="running"]::before {
  animation: pulse 1.4s ease-in-out infinite;
}
.status-badge--ok, .status-badge[data-state="ok"] {
  background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok);
}
.status-badge--err, .status-badge[data-state="err"] {
  background: var(--err-soft); border-color: var(--err-line); color: var(--err);
}
.status-badge--pending, .status-badge[data-state="pending"] {
  background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn);
}

/* --- 过程流面板（可折叠） --- */
.proc-stream {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: 170px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  transition: max-height 0.2s ease;
}

.proc-stream-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--gutter) 6px;
}

.proc-stream-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.proc-stream-title::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.follow-flag {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 6px;
}

.proc-stream-head .soon-tag { margin-left: auto; }

.proc-toggle {
  appearance: none;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--fg-3);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
}
.proc-toggle:hover { background: rgba(23, 24, 28, 0.06); color: var(--fg); }
.proc-toggle:active { background: var(--border); }

.proc-stream-lines {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0 var(--gutter) 10px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.proc-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--fg-3);
  padding: 1px 8px;
  margin-left: -8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.proc-line:hover { background: rgba(23, 24, 28, 0.05); color: var(--fg-2); }

.proc-time { flex: none; color: var(--fg-3); }
.proc-event { flex: none; color: var(--accent-strong); font-weight: 600; }
.proc-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* P1 · 行展开（点击切换） */
.proc-line.is-open .proc-text { white-space: normal; overflow: visible; }

/* 折叠态 */
.proc-stream.is-collapsed { max-height: 37px; overflow: hidden; }
.proc-stream.is-collapsed .proc-stream-lines { display: none; }

/* --- 指令按钮栏 --- */
.cmd-bar {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px var(--gutter);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.cmd-btn {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.cmd-btn:hover { border-color: var(--border-strong); background: var(--bg); color: var(--fg); }
.cmd-btn:active { background: var(--surface-2); transform: translateY(1px); }
.cmd-btn.is-on, .cmd-btn[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong);
}
.cmd-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.cmd-btn.is-loading { pointer-events: none; }
.cmd-btn.is-loading::before {
  content: "";
  display: inline-block;
  vertical-align: -2px;
  margin-right: 7px;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

/* P1 · 模型列表面板（/model 唤出） */
.model-popover {
  position: absolute;
  right: var(--gutter);
  bottom: calc(100% + 8px);
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-m);
  padding: 12px;
  z-index: 40;
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 650;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.model-list { margin: 0; padding: 0; list-style: none; }

.model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: background-color 0.12s;
}
.model-item:hover { background: var(--bg); }

.model-name { font-family: var(--mono); font-size: 12.5px; color: var(--fg-2); flex: 1 1 auto; }

.model-state { font-size: 11px; color: var(--fg-3); }

.model-item.is-current { background: var(--accent-soft); }
.model-item.is-current .model-name { color: var(--accent-strong); font-weight: 700; }
.model-item.is-current .model-state { color: var(--accent-strong); font-weight: 600; }

.popover-hint {
  margin: 8px 2px 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- 输入区（固定底部） --- */
.chat-input-area {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "bar bar"
    "chips chips"
    "input send";
  gap: 10px;
  padding: 12px var(--gutter) 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.attach-chips {
  grid-area: chips;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.attach-chips:empty { display: none; }

.attach-chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 6px 3px 12px;
  cursor: pointer;
  animation: chip-in 0.18s ease;
}
.attach-chips li::after {
  content: "✕";
  font-size: 11px;
  color: var(--fg-3);
  padding: 1px 6px;
  border-radius: 999px;
  transition: background-color 0.12s, color 0.12s;
}
.attach-chips li:hover { border-color: var(--border-strong); color: var(--fg); }
.attach-chips li:hover::after { background: var(--border); color: var(--fg); }

.chat-input {
  grid-area: input;
  width: 100%;
  min-height: 78px;
  resize: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  padding: 11px 14px;
  font: inherit;
  line-height: 1.6;
  color: var(--fg);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.chat-input::placeholder { color: #8a93a3; }
.chat-input:hover { border-color: #b9c0cf; }
.chat-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.chat-input:disabled { background: var(--surface-2); cursor: not-allowed; }

/* 回合进行中：输入区整体置灰 */
.view--chat.is-busy .chat-input-area { background: var(--bg); }
.view--chat.is-busy .chat-input { background: var(--surface-2); }

/* 发送按钮：小号 38px，勿做大 */
.btn-send {
  grid-area: send;
  appearance: none;
  align-self: end;
  height: 38px;
  min-width: 88px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s;
}
.btn-send:hover { background: var(--accent-strong); }
.btn-send:active { background: #2b45a3; transform: translateY(1px); }
.btn-send:disabled { background: #b9c6ee; cursor: not-allowed; transform: none; }

/* --- B6：输入区工具条（附件按钮 + 同步飞书开关，app.js 动态挂载） --- */
.chat-toolbar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-attach {
  appearance: none;
  height: 28px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.btn-attach:hover { border-color: var(--accent); color: var(--accent); }

.feishu-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-2);
  cursor: pointer;
  user-select: none;
}
.feishu-sync-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.feishu-sync-track {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background-color 0.15s;
}
.feishu-sync-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}
.feishu-sync-input:checked + .feishu-sync-track { background: var(--accent); }
.feishu-sync-input:checked + .feishu-sync-track::after { left: 16px; }
.feishu-sync-input:focus-visible + .feishu-sync-track { box-shadow: var(--focus-ring); }
.feishu-sync.is-disabled { cursor: not-allowed; opacity: 0.55; } /* K3：鉴权失效置灰 */
.feishu-sync-hint { font-size: 11px; color: var(--fg-3); } /* K3：初始 GET 失败提示「状态未同步」 */

/* 上传中的 chip：置灰 + 进度光标 */
.attach-chips li[data-pending="1"] {
  opacity: 0.65;
  cursor: progress;
  font-style: italic;
}
.btn-send.is-loading { pointer-events: none; opacity: 0.85; }
.btn-send.is-loading::before {
  content: "";
  display: inline-block;
  vertical-align: -2px;
  margin-right: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

/* ===================== ② 动态区 ===================== */
.feishu-now {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-l);
  padding: 16px 20px;
}

.now-glyph { font-size: 22px; color: var(--accent); flex: none; animation: spin-slow 6s linear infinite; }

.now-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.now-label { font-size: 12px; font-weight: 600; color: var(--accent-strong); letter-spacing: 0.04em; }

.now-text { margin: 0; font-size: 15px; color: var(--fg); text-wrap: pretty; }

/* 单据流转列表 */
.doc-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }

.doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 10px 8px;
  border-radius: var(--radius-s);
  transition: background-color 0.12s;
}
.doc-row:hover { background: var(--bg); }
.doc-row + .doc-row { border-top: 1px solid var(--border); }

/* #6+7 · 可展开条目 */
.doc-row, .backlog-row { cursor: pointer; }
.doc-row.is-open, .backlog-row.is-open {
  background: var(--accent-soft);
  border-radius: var(--radius-s) var(--radius-s) 0 0;
}

.doc-detail {
  background: var(--surface-2);
  border: 1px solid var(--accent-line);
  border-top: none;
  border-radius: 0 0 var(--radius-s) var(--radius-s);
  margin: 0 0 4px;
  padding: 10px 12px 12px;
  font-size: 12.5px;
  color: var(--fg-2);
}

.detail-grid {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0;
}
.detail-grid dt { color: var(--fg-3); }
.detail-grid dd { margin: 0; word-break: break-all; }
.detail-mono, .detail-fulltext { font-family: var(--mono); font-size: 11.5px; }
.detail-fulltext { font-family: var(--font); font-size: 12.5px; white-space: pre-wrap; }

.detail-proc { margin-top: 10px; }
.detail-proc-title { font-size: 11.5px; font-weight: 600; color: var(--fg-3); margin-bottom: 4px; }
.detail-proc-lines {
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--fg-2);
  max-height: 170px;
  overflow-y: auto;
  word-break: break-all;
}
.detail-proc-hint { color: var(--fg-3); font-family: var(--font); }

.detail-actions { margin-top: 10px; }

.doc-name {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-time, .doc-dur {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
}

.doc-kind {
  font-size: 11px;
  color: var(--fg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

.doc-row--output { grid-template-columns: minmax(0, 1fr) auto auto auto; }

.doc-list:not(.is-loading):empty::after {
  content: "今天暂无单据";
  display: block;
  padding: 18px 8px;
  font-size: 13px;
  color: var(--fg-3);
}

/* F16：今日产出空态单独文案 */
#todayOutputs:not(.is-loading):empty::after { content: "今日暂无产出"; }

/* ===================== ③ 看板区 ===================== */
.count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.count-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.count-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-m); }

.count-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.count-dot--running { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.count-dot--ok { background: var(--ok); }
.count-dot--err { background: var(--err); }
.count-dot--pending { background: var(--warn); }

.count-num { font-family: var(--mono); font-size: 30px; font-weight: 650; line-height: 1; color: var(--fg); }

.count-label { font-size: 13px; color: var(--fg-3); margin-left: auto; }

.board-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
}

.count-pill {
  font-family: var(--mono);
  font-size: 11.5px;
  border-radius: 999px;
  padding: 2px 10px;
}
.count-pill--warn { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn); }

.backlog-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px; /* #8 · 全量展示，超高内部滚动 */
  overflow-y: auto;
}

.backlog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--radius-s);
  transition: background-color 0.12s;
}
.backlog-row:hover { background: var(--bg); }

.backlog-row .doc-name { font-size: 13px; font-weight: 400; color: var(--fg-2); }

.backlog-list:not(.is-loading):empty::after {
  content: "无积压";
  display: block;
  padding: 14px 8px;
  font-size: 13px;
  color: var(--fg-3);
}

/* 台账直链卡 */
.ledger-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 16px 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ledger-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-m); }

.ledger-icon {
  width: 38px; height: 38px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-m);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ledger-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.ledger-title { font-size: 14px; font-weight: 650; }

.ledger-note { font-family: var(--mono); font-size: 11.5px; color: var(--fg-3); }

.ledger-link {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.ledger-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.ledger-link:active { transform: translateY(1px); }

/* ===================== ④ 文件区 ===================== */
.files-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.dir-tree { display: flex; flex-direction: column; gap: 2px; }

.dir-row {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: var(--radius-s);
  padding: 7px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s;
}
.dir-row:hover { background: var(--bg); }
.dir-row:active { background: var(--border); }

.dir-row--sub { font-weight: 500; color: var(--fg-2); margin-left: 14px; }

.dir-row--static { cursor: default; }
.dir-row--static:hover { background: transparent; }

.dir-caret { font-size: 10px; color: var(--fg-3); transition: transform 0.18s ease; }
.dir.is-open > .dir-row .dir-caret { transform: none; }
.dir:not(.is-open) > .dir-row .dir-caret { transform: rotate(-90deg); }

.dir-name { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dir-count { font-family: var(--mono); font-size: 11px; color: var(--fg-3); flex: none; }

.dir-children { display: none; flex-direction: column; gap: 2px; margin: 2px 0 4px; }
.dir.is-open > .dir-children { display: flex; }
.dir-children .dir-children { margin-left: 14px; border-left: 1px solid var(--border); padding-left: 8px; }

.dir-empty-hint { font-size: 12px; color: var(--fg-3); padding: 5px 8px; }

.dir-children:empty::after {
  content: "目录为空";
  display: block;
  font-size: 12px;
  color: var(--fg-3);
  padding: 5px 8px;
}

/* 文件条目 */
.file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-s);
  transition: background-color 0.12s;
}
.file-row:hover { background: var(--bg); }

.file-check { display: inline-flex; align-items: center; cursor: pointer; flex: none; }
.file-check input { position: absolute; opacity: 0; width: 16px; height: 16px; margin: 0; cursor: pointer; }

.file-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  transition: background-color 0.12s, border-color 0.12s;
}
.file-box:hover { border-color: var(--accent); }
.file-check input:checked + .file-box { background: var(--accent); border-color: var(--accent); }
.file-check input:checked + .file-box::after {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.file-check input:focus-visible + .file-box { outline: 2px solid var(--accent); outline-offset: 2px; }

.file-name {
  min-width: 0;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size { font-family: var(--mono); font-size: 11.5px; color: var(--fg-3); flex: none; }

.file-readonly {
  font-size: 10.5px;
  color: var(--fg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 5px;
  flex: none;
}

/* 勾选面板 */
.pick-pane { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; }

.pick-count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--fg-3); }

.attach-chips--panel { display: flex; }

.attach-chips--panel:empty::after {
  content: "尚未勾选文件";
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--fg-3);
  padding: 2px 0;
}

.pick-hint { margin: 0; font-size: 12px; line-height: 1.7; color: var(--fg-3); }
.pick-hint code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}

.btn-send-to-chat {
  appearance: none;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s;
}
.btn-send-to-chat:hover { background: var(--accent-strong); }
.btn-send-to-chat:active { background: #2b45a3; transform: translateY(1px); }
.btn-send-to-chat:disabled { background: #b9c6ee; cursor: not-allowed; transform: none; }

/* ===================== Toast 槽位（P1 留壳） ===================== */
.toast-dock {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-m);
  padding: 9px 12px;
  animation: toast-in 0.28s ease backwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.is-out { opacity: 0; transform: translateY(-6px); } /* #1 · 自动消失淡出 */
.toast:nth-child(2) { animation-delay: 0.08s; }
.toast:nth-child(3) { animation-delay: 0.16s; }

.toast-time { font-family: var(--mono); font-size: 11px; color: var(--fg-3); flex: none; }

.toast-text { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toast-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--fg-3);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  flex: none;
}
.toast-close:hover { background: var(--surface-2); color: var(--fg); }

/* 回合开始时输入区闪一下，给出视觉反馈 */
.chat-input-area.is-flash { animation: flash-ring 0.5s ease; }

/* ===================== 动画 ===================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes chip-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes flash-ring {
  0% { box-shadow: inset 0 0 0 2px var(--accent); }
  100% { box-shadow: inset 0 0 0 2px transparent; }
}

@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: 959px) {
  .view-inner { padding: 22px 20px 40px; }
  .chat-msg-list { padding: 22px 20px; }
  .proc-stream-head { padding: 9px 20px 6px; }
  .proc-stream-lines { padding: 0 20px 10px; }
  .cmd-bar { padding: 10px 20px; }
  .chat-input-area { padding: 12px 20px 14px; }
  .count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-lower { grid-template-columns: minmax(0, 1fr); }
  .files-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ===================== 嫁接第二版补钉（2026-09-20） ===================== */
/* 会话可点击 */
.session-item:not(.session-item--placeholder) { cursor: pointer; }

/* 历史轨迹回填行（sessions tail 近似，内容脱敏） */
.chat-msg--trace { align-self: stretch; }
.chat-msg--trace .chat-msg-sender { font-size: 11px; color: var(--fg-3); }
.chat-msg--trace .chat-msg-body {
  margin: 0;
  padding: 2px 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-2);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ================= 操作台 v3 新增 ================= */

/* C · 主会话条目允许两行：第一行 pin+名称+⟳+▾，第二行徽标（名称不再被挤成省略号） */
.session-item.is-main { flex-wrap: wrap; row-gap: 4px; }
.session-item.is-main .session-name { flex: 1 1 auto; }
.session-item.is-main .session-live { order: 9; margin-left: 21px; }

/* C · "当前对话"徽标：绿点 + 字样，仅出现在绑定主会话条目 */
.session-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  border-radius: 999px;
  padding: 3px 8px;
}
.session-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2.4s ease-in-out infinite;
}

/* A · 对话区状态行：加载中 / 空态 / 错误可重试（禁止纯白死寂） */
.chat-state { align-self: center; max-width: 100%; }
.chat-state-card {
  padding: 16px 26px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-l);
  background: var(--surface-2);
  color: var(--fg-3);
  font-size: 14px;
  text-align: center;
}
.chat-state--loading .chat-state-card { animation: pulse 1.6s ease-in-out infinite; }
.chat-state--error .chat-state-card {
  color: var(--err);
  background: var(--err-soft);
  border-color: var(--err-line);
  cursor: pointer;
}

/* D · 助手消息基本 markdown 元素 */
.chat-msg-body.md strong { font-weight: 650; }
.chat-msg-body.md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-msg-body.md pre.chat-msg-code { margin: 8px 0; }

/* ===================== v4 · A 顶栏模型切换器 ===================== */
.model-switch { position: relative; }

button.model-badge {
  cursor: pointer;
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button.model-badge:hover { border-color: var(--border-strong); color: var(--fg); }
button.model-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.model-badge.is-on { border-color: var(--accent); color: var(--accent-strong); }
button.model-badge:disabled { opacity: 0.55; cursor: default; }

.model-caret { font-size: 10px; color: var(--fg-3); }

.model-switch-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-m);
}
.model-switch-menu li {
  padding: 7px 10px;
  border-radius: var(--radius-s);
  cursor: pointer;
  font-size: 12.5px;
}
.model-switch-menu li:hover { background: var(--bg); }
.model-switch-menu li.is-reset {
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-s) var(--radius-s);
  margin-top: 4px;
  color: var(--fg-3);
}

/* ===================== v4 · B P2 角标友好化（视觉降权） ===================== */
.foot-link--todo,
.foot-link--todo:hover {
  opacity: 0.5;
  cursor: default;
  background: none;
  color: var(--fg-3);
}
.foot-link--todo .dot { filter: grayscale(1); }

/* ===================== v4 · C 任务台账 ===================== */
.task-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.task-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-3);
  cursor: pointer;
}
.task-chip:hover { border-color: var(--border-strong); }
.task-chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.task-refresh-btn {
  margin-left: 4px;
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  cursor: pointer;
}
.task-refresh-btn:hover { border-color: var(--border-strong); }

.chan-badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-2);
  white-space: nowrap;
}
.chan-badge--subagent { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.chan-badge--k3 { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chan-badge--codex { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.doc-row--static, .doc-row--static:hover { cursor: default; }
.doc-row--static:hover { background: none; }
.doc-row--error { color: var(--err); }

.task-empty { margin: 6px 2px 0; font-size: 12.5px; color: var(--fg-3); }

/* v4 · C：覆盖 .doc-list:empty 的默认文案（任务页空态由 #taskRunsEmpty 负责） */
#taskRunsList:empty::after { content: none; }
