/*
 * 远程 Claude 控制台 —— 按 Claude Desktop(claude.ai 设计系统 CDS,fizzy-lake color 外观)复刻。
 * 颜色、尺寸取自 claude.ai 公开样式表里的设计令牌:
 *   侧栏 288px / 行高 26px / 行字号 13px / 分组字号 12px / 页眉 48px / 对话列 48rem
 *   浅色:正文区 #fff、侧栏 #fafafa、文字 #000 90%/60%/47%、主按钮 #191919
 *   深色:正文区 #191919、侧栏 #1f1f1f、浮层 #303030、文字 #fff 93%/57%/40%
 * Anthropic 的专有字体不随附,用系统字体回退。
 */
:root {
  color-scheme: light;
  --page: #ffffff;
  --sidebar: #fafafa;
  --surface-3: #ffffff;
  --popover: #ffffff;
  --seam: rgba(0, 0, 0, 0.1);
  --border: rgba(0, 0, 0, 0.08);
  --border-line: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.2);
  --text: rgba(0, 0, 0, 0.9);
  --text-2: rgba(0, 0, 0, 0.6);
  --text-3: rgba(0, 0, 0, 0.467);
  --ghost-hover: rgba(0, 0, 0, 0.05);
  --ghost-selected: rgba(0, 0, 0, 0.1);
  --selected-hover: rgba(0, 0, 0, 0.145);
  --fill-primary: #191919;
  --fill-primary-hover: #3c3c3c;
  --on-primary: #ffffff;
  --fill-secondary: rgba(0, 0, 0, 0.05);
  --fill-secondary-hover: rgba(0, 0, 0, 0.075);
  --alpha-1: rgba(0, 0, 0, 0.05);
  --alpha-2: rgba(0, 0, 0, 0.1);
  --composer-ring: rgba(0, 0, 0, 0.12);
  --user-bubble: rgba(0, 0, 0, 0.05);
  --code-bg: rgba(0, 0, 0, 0.03);
  --code-head: rgba(0, 0, 0, 0.04);
  --text-accent: #1757ac;
  --clay: #d97757;
  --clay-emph: #c6613f;
  --run-halo: rgba(217, 119, 87, 0.75);
  --run-text: #b5532f;
  --danger: #dc3c3d;
  --text-danger: #a42528;
  --bg-danger: rgba(220, 60, 61, 0.12);
  --text-success: #006c10;
  --bg-success: rgba(16, 161, 34, 0.14);
  --success: #10a122;
  --warning: #e2a113;
  --text-warning: #794c02;
  --bg-warning: rgba(251, 179, 21, 0.16);
  --new-circle: #e9e9e9;
  --seg-track: rgba(0, 0, 0, 0.05);
  --seg-thumb: #ffffff;
  --seg-thumb-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.06);
  --avatar: #3a3a3a;
  --shadow-popover: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
  --shadow-composer: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.035);
  --shadow-composer-focus: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.075);
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 4px 24px rgba(0, 0, 0, 0.06);
  --diff-del: rgba(220, 60, 61, 0.08);
  --diff-add: rgba(16, 161, 34, 0.08);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-response: var(--font-serif);

  --sidebar-w: 288px;
  --header-h: 44px;
  --row-h: 24px;
  --row-font: 12.5px;
  --group-font: 11.5px;
  /* 信息密度:默认紧凑;账户菜单里能切回「标准」(data-density="comfortable") */
  --fs-text: 13.5px;
  --lh-text: 1.45;
  --lh-text-serif: 1.5;
  --lh-input: 19px;
  --fs-small: 12.5px;
  --fs-code: 12px;
  --lh-code: 1.42;
  --step-h: 22px;
  --pop-row: 28px;
  --para-gap: 0.4em;
  --bubble-pad: 5px 11px;
  --msg-gap: 12px;
  --radius-pill: 6px;
  --column: calc(48rem + 1.5rem);
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
}
:root[data-font="sans"] { --font-response: var(--font-ui); }
:root[data-density="comfortable"] {
  --header-h: 48px; --row-h: 26px; --row-font: 13px; --group-font: 12px;
  --fs-text: 14.5px; --lh-text: 1.55; --lh-text-serif: 1.6; --lh-input: 20px;
  --fs-small: 13px; --fs-code: 12.5px; --lh-code: 1.55;
  --step-h: 26px; --pop-row: 32px; --para-gap: 0.55em; --bubble-pad: 7px 13px; --msg-gap: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    color-scheme: dark;
    --page: #191919;
    --sidebar: #1f1f1f;
    --surface-3: #1f1f1f;
    --popover: #303030;
    --seam: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.06);
    --border-line: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.2);
    --text: rgba(255, 255, 255, 0.93);
    --text-2: rgba(255, 255, 255, 0.57);
    --text-3: rgba(255, 255, 255, 0.4);
    --ghost-hover: rgba(255, 255, 255, 0.075);
    --ghost-selected: rgba(255, 255, 255, 0.15);
    --selected-hover: rgba(255, 255, 255, 0.216);
    --fill-primary: #efefef;
    --fill-primary-hover: #d7d7d7;
    --on-primary: #191919;
    --fill-secondary: rgba(255, 255, 255, 0.15);
    --fill-secondary-hover: rgba(255, 255, 255, 0.216);
    --alpha-1: rgba(255, 255, 255, 0.05);
    --alpha-2: rgba(255, 255, 255, 0.1);
    --composer-ring: rgba(255, 255, 255, 0.08);
    --user-bubble: rgba(255, 255, 255, 0.07);
    --code-bg: rgba(255, 255, 255, 0.035);
    --code-head: rgba(255, 255, 255, 0.05);
    --text-accent: #6aabf1;
    --run-halo: rgba(232, 135, 102, 0.85);
    --run-text: #ec9a7c;
    --text-danger: #f17778;
    --bg-danger: rgba(220, 60, 61, 0.14);
    --text-success: #53c556;
    --bg-success: rgba(16, 161, 34, 0.14);
    --text-warning: #e49c06;
    --bg-warning: rgba(251, 179, 21, 0.1);
    --new-circle: #2e2e2e;
    --seg-track: rgba(255, 255, 255, 0.06);
    --seg-thumb: rgba(255, 255, 255, 0.12);
    --seg-thumb-shadow: none;
    --avatar: #d9d9d9;
    --shadow-popover: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 8px 24px rgba(0, 0, 0, 0.32), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-composer: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.2);
    --shadow-composer-focus: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.3);
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 24px rgba(0, 0, 0, 0.3);
    --diff-del: rgba(220, 60, 61, 0.14);
    --diff-add: rgba(16, 161, 34, 0.14);
  }
}
:root[data-mode="dark"] {
  color-scheme: dark;
  --page: #191919;
  --sidebar: #1f1f1f;
  --surface-3: #1f1f1f;
  --popover: #303030;
  --seam: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.06);
  --border-line: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: rgba(255, 255, 255, 0.93);
  --text-2: rgba(255, 255, 255, 0.57);
  --text-3: rgba(255, 255, 255, 0.4);
  --ghost-hover: rgba(255, 255, 255, 0.075);
  --ghost-selected: rgba(255, 255, 255, 0.15);
  --selected-hover: rgba(255, 255, 255, 0.216);
  --fill-primary: #efefef;
  --fill-primary-hover: #d7d7d7;
  --on-primary: #191919;
  --fill-secondary: rgba(255, 255, 255, 0.15);
  --fill-secondary-hover: rgba(255, 255, 255, 0.216);
  --alpha-1: rgba(255, 255, 255, 0.05);
  --alpha-2: rgba(255, 255, 255, 0.1);
  --composer-ring: rgba(255, 255, 255, 0.08);
  --user-bubble: rgba(255, 255, 255, 0.07);
  --code-bg: rgba(255, 255, 255, 0.035);
  --code-head: rgba(255, 255, 255, 0.05);
  --text-accent: #6aabf1;
  --run-halo: rgba(232, 135, 102, 0.85);
  --run-text: #ec9a7c;
  --text-danger: #f17778;
  --bg-danger: rgba(220, 60, 61, 0.14);
  --text-success: #53c556;
  --bg-success: rgba(16, 161, 34, 0.14);
  --text-warning: #e49c06;
  --bg-warning: rgba(251, 179, 21, 0.1);
  --new-circle: #2e2e2e;
  --seg-track: rgba(255, 255, 255, 0.06);
  --seg-thumb: rgba(255, 255, 255, 0.12);
  --seg-thumb-shadow: none;
  --avatar: #d9d9d9;
  --shadow-popover: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 8px 24px rgba(0, 0, 0, 0.32), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-composer: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.2);
  --shadow-composer-focus: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.3);
  --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 24px rgba(0, 0, 0, 0.3);
  --diff-del: rgba(220, 60, 61, 0.14);
  --diff-add: rgba(16, 161, 34, 0.14);
}

/* ── 基础 ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
#root { height: 100%; }
button { font: inherit; color: inherit; background: none; border: none; padding: 0; margin: 0; cursor: default; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid color-mix(in srgb, #257de0 60%, transparent); outline-offset: 1px; }
a { color: var(--text-accent); }
.icon { flex: none; display: block; }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
::selection { background: color-mix(in srgb, #257de0 25%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--alpha-2) transparent; }

/* 输入框 */
.field {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--page);
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  width: 100%;
  box-shadow: inset 0 0 0 1px var(--border-line), 0 1px 2px rgba(0, 0, 0, 0.04);
  outline: none;
}
.field::placeholder { color: var(--text-3); }
.field:focus { box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px color-mix(in srgb, #257de0 18%, transparent); }
.field.lg { font-size: 15px; padding: 10px 12px; border-radius: 10px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.1s, opacity 0.1s;
}
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 40px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--fill-primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--fill-primary-hover); }
.btn.secondary { background: var(--fill-secondary); }
.btn.secondary:hover:not(:disabled) { background: var(--fill-secondary-hover); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--ghost-hover); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #c63637; }
.btn:disabled { opacity: 0.4; }
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex: none;
  transition: background-color 0.1s, color 0.1s;
}
.icon-btn:hover:not(:disabled), .icon-btn.open { background: var(--ghost-hover); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 6px; }
.text-btn { color: var(--text-accent); font-size: 12px; padding: 0 4px; }
.text-btn:hover { text-decoration: underline; }

/* ── 框架 ─────────────────────────────────────────────────────────────── */
.frame { position: relative; display: flex; height: 100vh; height: 100dvh; overflow: hidden; background: var(--page); }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 0.5px solid var(--seam);
  user-select: none;
  min-height: 0;
  z-index: 30;
  transition: margin-left 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.frame.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.scrim { display: none; }
.sidebar-open { display: none; }
.frame.collapsed .sidebar-open { display: inline-flex; }

/* 侧栏:标题行 */
.titlebar { height: var(--header-h); flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.wordmark { font-family: var(--font-serif); font-size: 20px; letter-spacing: -0.01em; color: var(--text); line-height: 1; }
.brand-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.sidebar-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 4px 8px 0; }
/* 分段切换 */
.pills {
  display: flex;
  height: 28px;
  padding: 1px;
  border-radius: 8px;
  background: var(--seg-track);
  margin: 0 0 10px;
  flex: none;
}
.pill {
  flex: 1 1 0;
  border-radius: 7px;
  font-size: var(--row-font);
  font-weight: 470;
  color: var(--text-3);
  transition: color 0.12s, background-color 0.2s var(--ease-out);
}
.pill:hover:not(.on) { color: var(--text); }
.pill.on { background: var(--seg-thumb); color: var(--text); box-shadow: var(--seg-thumb-shadow); }

/* 侧栏行 */
.nav-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: var(--row-h);
  padding: 0 8px;
  margin-bottom: 2px;
  border-radius: var(--radius-pill);
  font-size: var(--row-font);
  color: var(--text);
  text-align: left;
  transition: background-color 0.08s;
}
.nav-row:hover:not(:disabled) { background: var(--ghost-hover); }
.nav-row.on { background: var(--ghost-selected); }
.nav-row.on:hover { background: var(--selected-hover); }
.nav-row:disabled { opacity: 0.5; }
.nav-row .lead { width: 24px; height: 20px; flex: none; display: flex; align-items: center; justify-content: center; margin-left: -6px; color: var(--text-2); }
.nav-row:hover .lead, .nav-row.on .lead { color: var(--text); }
.row-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 12px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 12px), transparent); padding-right: 6px; }
.row-trail { flex: none; font-size: 12px; color: var(--text-3); }
.new-row { margin-bottom: 6px; }
.new-circle { width: 18px; height: 18px; border-radius: 9999px; background: var(--new-circle); display: inline-flex; align-items: center; justify-content: center; color: var(--text); transition: background-color 0.1s; }
.new-row:hover .new-circle { background: color-mix(in srgb, var(--text-3) 30%, transparent); }
.new-circle .icon { stroke-width: 2.2; }

.nav-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px 12px; }
.group { margin-top: 12px; }
.group:first-child { margin-top: 2px; }
.group-label { display: flex; align-items: center; height: var(--row-h); margin-bottom: 2px; padding: 0 2px 0 8px; position: relative; border-radius: var(--radius-pill); }
.group-toggle { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; height: 100%; text-align: left; font-size: var(--group-font); font-weight: 500; color: var(--text-2); }
.group-label.static { font-size: var(--group-font); font-weight: 500; color: var(--text-2); }
.group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-caret { opacity: 0; transition: opacity 0.1s; color: var(--text-3); }
.group-label:hover .group-caret { opacity: 1; }
.row-ctl { width: 20px; height: 20px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); opacity: 0; transition: opacity 0.1s; }
.group-label:hover .row-ctl { opacity: 1; }
.row-ctl:hover:not(:disabled) { background: var(--ghost-hover); color: var(--text); }
.side-empty { font-size: 12px; color: var(--text-3); padding: 8px; line-height: 1.6; }

/* 状态标记 */
/*
 * 运行中:实心橙点在 1 和 0.4 之间呼吸,外面一圈光晕往外扩散再淡掉(1.6 秒一次);
 * 等你确认:实心数字角标,不动;做完还没看:绿色对勾,不动;出错:红点。
 * 减少动态效果时,运行中改成静止的「橙点 + 一圈浅色描边」,和另外几种仍然分得开。
 */
.status-dot { position: relative; width: 8px; height: 8px; border-radius: 9999px; flex: none; background: var(--text-3); }
.status-dot.running { background: var(--clay); margin: 0 3px; animation: run-breathe 1.6s ease-in-out infinite; }
.status-dot.running::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--run-halo);
  animation: run-halo 1.6s ease-out infinite;
}
.status-dot.error { background: var(--danger); }
.status-done { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 9999px; color: var(--text-success); background: var(--bg-success); }
@keyframes run-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes run-halo {
  0% { box-shadow: 0 0 0 0 var(--run-halo); }
  80%, 100% { box-shadow: 0 0 0 7px transparent; }
}
.row-badge { flex: none; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9999px; background: var(--clay-emph); color: #fff; font-size: 10.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* 侧栏底部账户行 */
.sidebar-footer { flex: none; padding: 8px; border-top: 0.5px solid var(--seam); }
.dd.footer-dd { display: flex; width: 100%; }
.user-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px; border-radius: 8px; text-align: left; transition: background-color 0.08s; }
.user-btn:hover, .user-btn.open { background: var(--ghost-hover); }
.avatar { position: relative; width: 28px; height: 28px; border-radius: 9999px; background: var(--avatar); color: var(--page); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.conn-dot { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 9999px; border: 2px solid var(--sidebar); }
.conn-dot.ok { background: var(--success); }
.conn-dot.warn { background: var(--warning); }
.conn-dot.bad { background: var(--danger); }
.user-words { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-name { font-size: 13px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-sub { font-size: 12px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-caret { color: var(--text-3); }
.user-menu { width: 272px; }
.user-email { padding: 4px 8px 2px; }

/* ── 弹层 ─────────────────────────────────────────────────────────────── */
.dd { position: relative; display: inline-flex; min-width: 0; }
.pop {
  position: absolute;
  z-index: 60;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px;
  background: var(--popover);
  border-radius: 12px;
  box-shadow: var(--shadow-popover);
  color: var(--text);
  font-size: var(--fs-small);
  animation: pop-in 0.14s var(--ease-out);
  user-select: none;
  cursor: default;
}
.pop.up { bottom: calc(100% + 6px); }
.pop.down { top: calc(100% + 6px); }
.pop.left { left: 0; }
.pop.right { right: 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(var(--pop-from, 4px)) scale(0.98); } to { opacity: 1; transform: none; } }
.pop.down { --pop-from: -4px; }
.pop-section { padding: 8px 8px 4px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.pop-title { padding: 6px 8px 2px; font-size: 14px; font-weight: 600; }
.pop-desc { padding: 0 8px; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.pop-desc.tiny { font-size: 11.5px; color: var(--text-3); }
.pop-note { padding: 8px 8px 4px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.pop-sep { height: 0.5px; background: var(--border-line); margin: 6px -6px; }
.pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--pop-row);
  padding: 4px 8px;
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  transition: background-color 0.06s;
}
.pop-item:hover:not(:disabled) { background: var(--ghost-hover); }
.pop-item:disabled { opacity: 0.45; }
.pop-item.danger { color: var(--text-danger); }
.pop-item .icon { color: var(--text-2); }
.pop-item.danger .icon { color: currentColor; }
.pi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pi-title { font-size: var(--fs-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item.two-line .pi-title { font-weight: 500; }
.pi-desc { font-size: 12px; color: var(--text-3); line-height: 1.4; overflow-wrap: anywhere; }
.pop-item .pi-check { color: var(--text); margin-left: auto; }
.pop-scroll { max-height: 280px; overflow-y: auto; }
.pop-search { margin: 2px 0 4px; }
.rot90 { transform: rotate(90deg); }

/* 分段控件 */
.seg-control { display: flex; padding: 2px; margin: 2px 2px 4px; border-radius: 8px; background: var(--seg-track); }
.seg-control .seg { flex: 1 1 0; height: 28px; border-radius: 6px; font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; transition: background-color 0.15s, color 0.15s; }
.seg-control .seg:hover:not(.on) { color: var(--text); }
.seg-control .seg.on { background: var(--seg-thumb); color: var(--text); box-shadow: var(--seg-thumb-shadow); font-weight: 500; }
.serif-sample { font-family: var(--font-serif); }
.effort-block { padding-bottom: 2px; }

/* 开关 */
.switch { appearance: none; -webkit-appearance: none; width: 30px; height: 18px; border-radius: 9999px; background: var(--border-strong); position: relative; flex: none; margin: 0; transition: background-color 0.15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 9999px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s var(--ease-out); }
.switch:checked { background: var(--fill-primary); }
.switch:checked::after { transform: translateX(12px); background: var(--page); }

/* 用量表 */
.meter { display: block; height: 6px; margin: 6px 8px; border-radius: 9999px; background: var(--alpha-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--fill-primary); }
.meter i.warn { background: var(--warning); }
.meter i.bad { background: var(--danger); }
.usage-card { width: 300px; }
.usage-row { padding: 6px 0 2px; }
.usage-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 8px; font-size: 13px; }
.usage-line .pop-desc { padding: 0; }

/* 上下文弹层 */
.ctx-pop { width: 300px; }
.model-menu { width: 332px; }
/* 模型菜单:一行一个模型(名字 · 说明 · 标签 · 勾) */
.model-menu .pop-section { padding: 6px 8px 3px; }
.model-menu .pop-section.split { display: flex; justify-content: space-between; align-items: baseline; }
.effort-hint { font-size: 11px; font-weight: 400; }
.model-menu .seg-control .seg { height: 26px; }
.model-menu .pop-note { padding: 4px 8px 2px; font-size: 11px; }
.model-row { min-height: 28px; padding: 4px 8px; gap: 6px; }
.mr-name { flex: none; width: 76px; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-desc { flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 标签列定宽、靠左,各行的「1M」「快速」上下对齐 */
.mr-tags { flex: none; width: 78px; display: inline-flex; gap: 4px; }
.mr-tag { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; height: 17px; padding: 0 5px; border-radius: 5px; font-size: 10.5px; color: var(--text-2); background: var(--alpha-1); }
.mr-tag .icon { color: currentColor; }
.mr-check { flex: none; width: 15px; display: inline-flex; color: var(--text); }
.model-row.switch-row .switch { margin-left: 2px; }
.mode-menu { width: 300px; }
.ctx-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 8px 0; font-size: 13px; }
.ctx-status { font-size: 12px; padding: 1px 8px; border-radius: 9999px; background: var(--bg-success); color: var(--text-success); }
.ctx-status.warn { background: var(--bg-warning); color: var(--text-warning); }
.ctx-status.bad { background: var(--bg-danger); color: var(--text-danger); }
.ctx-status.none { background: var(--alpha-1); color: var(--text-3); }
.ctx-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 4px 8px 2px; }
.ctx-cat { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); gap: 6px; }
.ctx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-val { color: var(--text); font-variant-numeric: tabular-nums; }

/* ── 主区域 ───────────────────────────────────────────────────────────── */
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.pane-header { height: var(--header-h); flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px; position: relative; z-index: 5; }
.hdr-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding-left: 4px; }
.hdr-name { font-size: 13.5px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.hdr-path { font-size: 12px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; direction: rtl; text-align: left; }
.hdr-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.hdr-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding: 0 8px; height: 24px; border-radius: 9999px; background: var(--alpha-1); }
.hdr-status.running { background: color-mix(in srgb, var(--clay) 13%, transparent); color: var(--run-text); font-weight: 500; }
.hdr-status.waiting { background: var(--bg-warning); color: var(--text-warning); }
.hdr-status.error { background: var(--bg-danger); color: var(--text-danger); }

.top-banner { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 32px; padding: 6px 12px; font-size: 12.5px; color: var(--text-2); background: var(--alpha-1); border-bottom: 0.5px solid var(--border-line); }
.top-banner.warning { background: var(--bg-warning); color: var(--text-warning); }

.chat-column { width: 100%; max-width: var(--column); margin: 0 auto; padding: 0 12px; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; scrollbar-gutter: stable both-edges; }
.transcript .chat-column { padding-top: 8px; }
.transcript-end { height: 24px; }
/* 贴底垫片:内容变矮时临时补上的高度(见 app.tsx useStickToBottom),平时是 0 */
.scroll-spacer { height: 0; }

/* 消息 */
.msg-user { display: flex; flex-direction: column; align-items: flex-end; margin: var(--msg-gap) 0 4px; }
.msg-user:first-child { margin-top: 8px; }
.msg-user .bubble {
  max-width: min(85%, 36rem);
  padding: var(--bubble-pad);
  border-radius: 16px;
  background: var(--user-bubble);
  font-size: var(--fs-text);
  line-height: var(--lh-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-user.sending .bubble { opacity: 0.6; }
.msg-user.failed .bubble { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
.msg-status { font-size: 12px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 2px; }
.msg-user.failed .msg-status { color: var(--text-danger); }
.msg-actions { display: flex; align-items: center; gap: 2px; min-height: 22px; opacity: 0; transition: opacity 0.12s; }
.msg-user:hover .msg-actions, .msg-assistant:hover .msg-actions { opacity: 1; }
.msg-time { font-size: 12px; color: var(--text-3); padding: 0 6px; }
.msg-assistant { margin: 2px 0 0; padding-left: 4px; }
.msg-assistant .msg-actions { margin-left: -6px; }
.msg-assistant .msg-actions .icon-btn { color: var(--text-3); }

/* 正文排版(Claude 的回复用 --font-response:衬线西文 + 系统中文) */
.md { font-family: var(--font-response); font-size: var(--fs-text); line-height: var(--lh-text-serif); overflow-wrap: anywhere; }
:root[data-font="sans"] .md { line-height: var(--lh-text); }
.md.plain { white-space: pre-wrap; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 var(--para-gap); }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-response); font-weight: 600; line-height: 1.3; margin: 1.1em 0 0.45em; }
.md h1 { font-size: 1.4em; }
.md h2 { font-size: 1.22em; }
.md h3 { font-size: 1.08em; }
.md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 calc(var(--para-gap) + 0.15em); padding-left: 1.5em; }
.md li { margin: 0.12em 0; }
.md li > p { margin: 0.12em 0; }
.md blockquote { margin: 0 0 calc(var(--para-gap) + 0.15em); padding: 0 0 0 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md hr { border: none; border-top: 0.5px solid var(--border-line); margin: 1.1em 0; }
.md a { color: var(--text-accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: currentColor; }
.md strong { font-weight: 600; }
.md code { font-family: var(--font-mono); font-size: 0.86em; background: var(--alpha-1); border: 0.5px solid var(--border-line); border-radius: 5px; padding: 0.1em 0.35em; }
.md pre code { background: none; border: none; padding: 0; font-size: inherit; border-radius: 0; }
.md table { border-collapse: collapse; margin: 0 0 0.7em; font-family: var(--font-ui); font-size: var(--fs-small); display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border-bottom: 0.5px solid var(--border-line); padding: 4px 12px 4px 0; text-align: left; vertical-align: top; }
.md th { font-weight: 600; color: var(--text-2); border-bottom-color: var(--border-strong); }
.md img { max-width: 100%; border-radius: 8px; }
.code-wrap { margin: 0 0 0.7em; border-radius: 10px; background: var(--code-bg); box-shadow: inset 0 0 0 0.5px var(--border-line); overflow: hidden; font-family: var(--font-ui); }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 28px; padding: 0 6px 0 12px; font-size: 12px; color: var(--text-3); background: var(--code-head); }
.code-copy { font-size: 12px; color: var(--text-2); padding: 3px 8px; border-radius: 6px; }
.code-copy:hover { background: var(--ghost-hover); color: var(--text); }
.code-wrap pre { margin: 0; padding: 9px 12px; overflow-x: auto; font-family: var(--font-mono); font-size: var(--fs-code); line-height: var(--lh-code); }

/* 工具调用 / 思考(紧凑行,可展开) */
.step { margin: 1px 0; }
.step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--step-h);
  padding: 2px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  font-size: var(--fs-small);
  color: var(--text-2);
  list-style: none;
  cursor: default;
  user-select: none;
  transition: background-color 0.08s, color 0.08s;
}
.step-row::-webkit-details-marker { display: none; }
summary.step-row:hover { background: var(--ghost-hover); color: var(--text); }
.step-icon { width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.step-name { flex: none; font-weight: 500; color: var(--text); }
.step-sum { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-3); font-size: var(--fs-small); }
.step-flag { flex: none; font-size: 11.5px; color: var(--text-danger); background: var(--bg-danger); border-radius: 9999px; padding: 0 7px; }
.step-caret { color: var(--text-3); opacity: 0; transition: transform 0.15s var(--ease-out), opacity 0.1s; }
summary.step-row:hover .step-caret { opacity: 1; }
.step[open] > .step-row .step-caret { transform: rotate(90deg); opacity: 1; }
.step.error .step-icon { color: var(--text-danger); }
.step-body { margin: 2px 0 6px 26px; display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-small); }
.step-row.static { cursor: default; }
.thinking .step-name { font-weight: 450; color: var(--text-2); }
.thinking-text { white-space: pre-wrap; color: var(--text-2); font-size: var(--fs-small); line-height: var(--lh-text); padding-left: 12px; border-left: 2px solid var(--border-line); }
.perm-result { flex: none; font-size: 12px; color: var(--text-3); }
.perm-done.allow .perm-result, .perm-done.allow-always .perm-result { color: var(--text-success); }
.perm-done.deny .perm-result { color: var(--text-danger); }

pre.code {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--code-bg);
  box-shadow: inset 0 0 0 0.5px var(--border-line);
  font-family: var(--font-mono);
  font-size: calc(var(--fs-code) - 0.5px);
  line-height: var(--lh-code);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
  color: var(--text);
}
pre.code.result { color: var(--text-2); }
pre.code.err { color: var(--text-danger); }
.diff { display: flex; flex-direction: column; gap: 0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 0.5px var(--border-line); }
.diff pre.code { border-radius: 0; box-shadow: none; }
pre.code.del { background: var(--diff-del); }
pre.code.add { background: var(--diff-add); }
.kv { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.sub { display: flex; flex-direction: column; gap: 3px; padding-left: 10px; border-left: 2px solid var(--border-line); }
.sub-text { white-space: pre-wrap; color: var(--text-2); }
.sub-tool { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12.5px; }
.sub-tool b { color: var(--text-2); font-weight: 500; }
.todos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.todo { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.todo-box { width: 15px; height: 15px; margin-top: 2px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--border-strong); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.todo.completed { color: var(--text-3); text-decoration: line-through; }
.todo.completed .todo-box { background: var(--fill-primary); color: var(--on-primary); box-shadow: none; }
.todo.in_progress { font-weight: 500; }
.todo.in_progress .todo-box { box-shadow: inset 0 0 0 1.5px var(--clay); }

/* 轮次用量、提示 */
.turn-usage { margin: 0 0 2px; }
.turn-usage-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-3); padding: 2px 6px; margin-left: -6px; border-radius: 6px; }
.turn-usage-btn:hover { background: var(--ghost-hover); color: var(--text-2); }
.turn-usage.err .turn-usage-btn { color: var(--text-danger); }
.turn-detail { margin: 4px 0 6px; padding: 8px 12px; border-radius: 8px; background: var(--alpha-1); font-size: 12px; color: var(--text-2); line-height: 1.55; }
.warn-text { color: var(--text-warning); }
.notice-line { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 12px; color: var(--text-3); text-align: center; }
.notice-line::before, .notice-line::after { content: ""; flex: 1; height: 0.5px; background: var(--border-line); }
.banner { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; padding: 8px 12px; border-radius: 10px; font-size: var(--fs-small); line-height: 1.45; background: var(--alpha-1); color: var(--text-2); }
.banner .icon { margin-top: 2px; }
.banner.warning { background: var(--bg-warning); color: var(--text-warning); }
.banner.danger { background: var(--bg-danger); color: var(--text-danger); }
.load-more { display: block; margin: 4px auto 12px; font-size: 12px; color: var(--text-2); padding: 4px 12px; border-radius: 9999px; background: var(--alpha-1); }
.load-more:hover { background: var(--fill-secondary-hover); color: var(--text); }
.empty-chat { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 18vh 0 0; color: var(--text-2); font-size: 14px; }
.empty-chat .spark { color: var(--clay); margin-bottom: 6px; }
.empty-chat .muted { font-size: 12px; font-family: var(--font-mono); }

/* 正在工作 / 实时输出 */
/* 运行中和等确认是同一行、同样高度,只换图标、文字和颜色(切换时上面的内容不会动) */
.working { display: flex; align-items: center; gap: 8px; height: 24px; margin: 6px 0 2px; font-size: 13.5px; color: var(--text-2); }
.working-icon { width: 18px; height: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.working .spark { color: var(--clay); }
.spin-spark { animation: spark-spin 1.6s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
@keyframes spark-spin { 0% { transform: rotate(0) scale(0.9); } 50% { transform: rotate(90deg) scale(1.12); } 100% { transform: rotate(180deg) scale(0.9); } }
/* 「正在工作…」:一道亮光从左往右扫过文字,1.6 秒一次 */
.working.running .working-label {
  font-weight: 500;
  color: var(--run-text);
  background: linear-gradient(90deg, var(--run-text) 0%, var(--run-text) 38%, var(--text) 50%, var(--run-text) 62%, var(--run-text) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: label-sweep 1.6s linear infinite;
}
@keyframes label-sweep { from { background-position: 100% 0; } to { background-position: 0% 0; } }
.working.waiting { color: var(--text-warning); }
.working.waiting .working-label { font-weight: 500; }
.working-time { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-thinking { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; font-size: 13px; color: var(--text-3); white-space: pre-wrap; max-height: 4.8em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, transparent, #000 1.6em); mask-image: linear-gradient(180deg, transparent, #000 1.6em); }
.live-thinking .icon { margin-top: 3px; }
.spinner { width: 13px; height: 13px; border-radius: 9999px; border: 1.6px solid var(--alpha-2); border-top-color: var(--text-2); animation: spin 0.8s linear infinite; display: inline-block; }
.spinner.sm { width: 12px; height: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 输入框 ───────────────────────────────────────────────────────────── */
.composer-dock { flex: none; position: relative; padding: 0 0 10px; }
.composer-dock::before { content: ""; position: absolute; left: 0; right: 12px; bottom: 100%; height: 24px; background: linear-gradient(transparent, var(--page)); pointer-events: none; }
.composer-box {
  position: relative;
  background: var(--surface-3);
  border-radius: 20px;
  padding: 8px 8px 6px;
  box-shadow: var(--shadow-composer), inset 0 0 0 1px var(--composer-ring);
  transition: box-shadow 0.15s;
  cursor: text;
}
.composer-box:focus-within { box-shadow: var(--shadow-composer-focus), inset 0 0 0 1px var(--border-strong); }
.composer-input {
  display: block;
  width: 100%;
  min-height: 40px;
  max-height: 384px;
  resize: none;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-text);
  line-height: var(--lh-input);
  padding: 6px 6px 0 8px;
  overflow-y: auto;
}
.composer-input::placeholder { color: var(--text-3); }
.composer-chin { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; min-height: 32px; cursor: default; }
.chin-left, .chin-right { display: flex; align-items: center; gap: 2px; min-width: 0; }
.chin-right { flex: none; gap: 4px; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-2);
  white-space: nowrap;
  min-width: 0;
  transition: background-color 0.08s, color 0.08s;
}
.ghost-btn:hover, .ghost-btn.open { background: var(--ghost-hover); color: var(--text); }
.ghost-btn .caret { color: var(--text-3); }
.ghost-btn.icon-only { padding: 0; width: 32px; justify-content: center; }
.ghost-btn.danger { color: var(--text-danger); }
.model-btn .model-name { color: var(--text); }
.model-effort { color: var(--text-3); }
.fast-mark { color: var(--clay); }
.folder-btn .folder-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.mode-btn span { overflow: hidden; text-overflow: ellipsis; }
.send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--clay-emph);
  color: #fff;
  transition: background-color 0.1s, opacity 0.1s;
}
.send-btn .icon { stroke-width: 2; }
.send-btn:hover:not(:disabled) { background: var(--clay); }
.send-btn:disabled { opacity: 0.35; }
.send-btn.stop { background: var(--fill-primary); color: var(--on-primary); }
.send-btn.stop:hover { background: var(--fill-primary-hover); }
.stop-sq { width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.ring-btn { gap: 4px; }
.ring-btn.icon-only:has(.ring-text) { width: auto; padding: 0 8px 0 7px; }
.ring-text { color: var(--text-3); }
.ring-bg { fill: none; stroke: var(--border-line); stroke-width: 2.6; }
.ring-fg { fill: none; stroke: var(--text-2); stroke-width: 2.6; stroke-linecap: butt; transition: stroke-dasharray 0.4s var(--ease-out); }
.ring-fg.warn { stroke: var(--warning); }
.ring-fg.bad { stroke: var(--danger); }
.ring-text { font-size: 12px; font-variant-numeric: tabular-nums; }
.ring-text.warn { color: var(--text-warning); }
.ring-text.bad { color: var(--text-danger); }

.composer-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; padding: 4px 4px 0; min-height: 22px; }
.foot-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 7px; border-radius: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
button.foot-chip:hover { background: var(--ghost-hover); color: var(--text-2); }
.foot-chip.path { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.foot-chip.cache.warn { color: var(--text-warning); }
.usage-chip .sep { width: 0.5px; height: 12px; background: var(--border-strong); margin: 0 2px; }
.seg-usage.warn { color: var(--text-warning); }
.seg-usage.bad, .usage-chip.bad .seg-usage.bad { color: var(--text-danger); }

/* 输入框上方的确认卡片 */
.dock { margin-bottom: 10px; animation: dock-in 0.2s var(--ease-out); }
@keyframes dock-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dock > .dock-title { padding: 0 4px 8px; }
.dock-card { background: var(--surface-3); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-composer), inset 0 0 0 1px var(--composer-ring); display: flex; flex-direction: column; gap: 10px; }
.dock-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.dock-title .icon { color: var(--clay); }
.dock-body { max-height: 32vh; overflow: auto; }
.dock-body.plan { font-size: var(--fs-text); padding: 2px 4px; }
.dock-body pre.code { max-height: none; }
.dock-reason { font-size: 12.5px; color: var(--text-2); }
.dock-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.dock-deny { display: flex; flex-direction: column; gap: 8px; }
.dock-more { font-size: 12px; color: var(--text-3); padding: 6px 4px 0; }
.ask { gap: 14px; }
.ask-q { display: flex; flex-direction: column; gap: 6px; }
.ask-header { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.02em; }
.ask-title { font-size: 14px; font-weight: 500; }
.ask-opts { display: flex; flex-direction: column; gap: 4px; }
.ask-opt { display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border-line); transition: background-color 0.08s, box-shadow 0.08s; }
.ask-opt:hover { background: var(--ghost-hover); }
.ask-opt.on { box-shadow: inset 0 0 0 1.5px var(--fill-primary); background: var(--alpha-1); }
.ask-mark { width: 20px; height: 20px; flex: none; border-radius: 9999px; background: var(--alpha-1); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-2); margin-top: 1px; }
.ask-mark.square { border-radius: 5px; }
.ask-opt.on .ask-mark { background: var(--fill-primary); color: var(--on-primary); }
.ask-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ask-label { font-size: 13.5px; font-weight: 500; }
.ask-desc { font-size: 12.5px; color: var(--text-2); }

/* ── 新建会话页 ───────────────────────────────────────────────────────── */
.new-page { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px; }
.new-inner { max-width: 42rem; margin: 0 auto; padding: calc(16vh - 24px) 0 48px; }
.greeting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.875rem, 1.2rem + 2vw, 2.375rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}
.greeting-spark { color: var(--clay); flex: none; }
.new-page .composer-box { padding: 12px 12px 10px; }
.new-page .composer-input { min-height: 60px; }
.new-hint { text-align: center; font-size: 12px; color: var(--text-3); margin: 12px 0 0; overflow-wrap: anywhere; }
.new-hint b { font-weight: 500; color: var(--text-2); }
.folder-menu { width: 340px; }
.browser { display: flex; flex-direction: column; gap: 6px; }
.browser-roots { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 2px; }
.root-chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--alpha-1); color: var(--text-2); }
.root-chip:hover { background: var(--fill-secondary-hover); color: var(--text); }
.browser-cur { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); padding: 2px 8px; overflow-wrap: anywhere; }
.browser-list { max-height: 260px; overflow-y: auto; }

.history { margin-top: 40px; }
.history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 8px 8px; font-size: 13px; font-weight: 500; color: var(--text-2); border-bottom: 0.5px solid var(--border-line); margin-bottom: 4px; }
.history-head .muted { font-size: 12px; font-weight: 400; }
.history-note { font-size: 12.5px; color: var(--text-3); padding: 10px 8px; }
.history-list { display: flex; flex-direction: column; }
.history-item { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 8px; text-align: left; transition: background-color 0.08s; }
.history-item:hover:not(:disabled) { background: var(--ghost-hover); }
.history-item:disabled { opacity: 0.6; }
.hi-title { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hi-meta { flex: none; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.hi-branch { display: inline-flex; align-items: center; gap: 3px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-open { color: var(--text-2); background: var(--alpha-1); border-radius: 9999px; padding: 0 7px; }

/* ── 提示条 ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--popover);
  color: var(--text);
  box-shadow: var(--shadow-popover);
  font-size: 13px;
  animation: pop-in 0.18s var(--ease-out);
}
.toast.error .icon { color: var(--danger); }
.toast.info .icon { color: var(--success); }

/* ── 配对页 ───────────────────────────────────────────────────────────── */
.pair-page { min-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 10vh 16px 48px; }
.pair-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.pair-brand .spark { color: var(--clay); }
.pair-brand .wordmark { font-size: 24px; }
.pair-title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.25rem); letter-spacing: -0.01em; margin: 0 0 24px; text-align: center; }
.pair-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; padding: 24px; border-radius: 24px; background: var(--surface-3); box-shadow: var(--shadow-card); }
.pair-text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.pair-label { font-size: 13px; color: var(--text-2); }
.code-big { font-family: var(--font-mono); font-size: 30px; letter-spacing: 0.2em; text-align: center; padding: 12px; border-radius: 12px; background: var(--alpha-1); }

/* ── 署名(多人协作时看是谁发的) ─────────────────────────────────────── */
.byline { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin: 0 4px 4px 0; }
.by-avatar { width: 18px; height: 18px; border-radius: 9999px; background: var(--alpha-2); color: var(--text-2); font-size: 10.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.by-account { padding: 0 6px; border-radius: 9999px; background: var(--alpha-1); }

/* ── 消息里的附件 ───────────────────────────────────────────────────── */
.msg-attachments { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-bottom: 6px; max-width: min(85%, 36rem); }
.att-images { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.att-image { width: 132px; height: 132px; border-radius: 12px; overflow: hidden; background: var(--alpha-1); box-shadow: inset 0 0 0 0.5px var(--border-line); cursor: zoom-in; padding: 0; display: block; }
.att-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-image.pending, .att-loading { display: block; width: 100%; height: 100%; background: var(--alpha-2); animation: shimmer 1.2s ease-in-out infinite; }
.att-image.pending { width: 132px; height: 132px; border-radius: 12px; }
@keyframes shimmer { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.att-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 12px; border-radius: 12px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-line); font-size: 13px; }
.att-file .icon { color: var(--text-3); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.att-size { color: var(--text-3); font-size: 12px; flex: none; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.8); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: fade-in 0.15s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }

/* ── 输入框里的附件 ─────────────────────────────────────────────────── */
.draft-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 4px 6px; }
.draft-item { position: relative; border-radius: 10px; background: var(--alpha-1); box-shadow: inset 0 0 0 0.5px var(--border-line); overflow: hidden; }
.draft-item.image { width: 60px; height: 60px; }
.draft-item.image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.draft-item.err { box-shadow: inset 0 0 0 1.5px var(--danger); }
.draft-file { display: flex; flex-direction: column; justify-content: center; gap: 1px; width: 168px; height: 60px; padding: 6px 26px 6px 10px; font-size: 12px; }
.draft-file .icon { color: var(--text-3); }
.draft-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.draft-size { color: var(--text-3); font-size: 11px; }
.draft-remove { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 9999px; background: rgba(0, 0, 0, 0.6); color: #fff; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.1s; }
.draft-item:hover .draft-remove { opacity: 1; }
.draft-progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 3px; border-radius: 9999px; background: rgba(0, 0, 0, 0.25); overflow: hidden; }
.draft-progress i { display: block; height: 100%; background: var(--clay); }
.composer-box.dragging { box-shadow: var(--shadow-composer-focus), inset 0 0 0 1.5px var(--clay); }
.drop-hint { position: absolute; inset: 0; border-radius: inherit; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--surface-3) 88%, transparent); color: var(--text-2); font-size: 13px; pointer-events: none; }
.attach-btn .icon { stroke-width: 1.8; }
.spinner.light { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

.drop-overlay { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px; background: color-mix(in srgb, var(--page) 72%, transparent); backdrop-filter: blur(2px); pointer-events: none; animation: fade-in 0.12s; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 420px; padding: 28px 32px; border-radius: 18px; border: 2px dashed color-mix(in srgb, var(--clay) 70%, transparent); background: var(--popover); box-shadow: var(--shadow-popover); text-align: center; }
.drop-card .icon { color: var(--clay); }
.drop-title { font-size: 16px; font-weight: 600; }
.drop-sub { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }

/* ── 斜杠命令、顺便问 ───────────────────────────────────────────────── */
.slash-hint { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 20; padding: 4px; background: var(--popover); border-radius: 12px; box-shadow: var(--shadow-popover); animation: pop-in 0.12s var(--ease-out); }
.slash-item { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 6px 10px; border-radius: 8px; text-align: left; }
.slash-item:hover { background: var(--ghost-hover); }
.slash-cmd { font-family: var(--font-mono); font-size: 13px; color: var(--text); flex: none; }
.slash-desc { font-size: 12.5px; color: var(--text-3); }
.btw-mode { display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 4px; padding: 2px 8px; border-radius: 9999px; background: color-mix(in srgb, var(--clay) 12%, transparent); color: var(--clay-emph); font-size: 12px; }
.btw-mode .icon { color: var(--clay); }
.btw-card { margin: 8px 0; padding: 8px 12px; border-radius: 12px; background: var(--alpha-1); box-shadow: inset 2px 0 0 var(--clay); }
.btw-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.btw-head .icon { color: var(--clay); }
.btw-note { margin-left: auto; font-size: 11.5px; }
.btw-q { font-size: 13.5px; font-weight: 500; margin-bottom: 4px; white-space: pre-wrap; }
.btw-card .md { font-size: var(--fs-text); }
.btw-err { font-size: 13px; color: var(--text-danger); }
.btw-card.pending .btw-q { margin-bottom: 0; }

/* ── 分叉 ───────────────────────────────────────────────────────────── */
.turn-usage-line { display: flex; align-items: center; gap: 2px; }
.turn-fork { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); padding: 2px 6px; border-radius: 6px; opacity: 0; transition: opacity 0.12s; }
.turn-usage:hover .turn-fork, .turn-fork:focus-visible { opacity: 1; }
.turn-fork:hover { background: var(--ghost-hover); color: var(--text); }
.hdr-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-2); padding: 1px 7px; border-radius: 9999px; background: var(--alpha-1); }
.hdr-fork { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); padding: 1px 6px; border-radius: 6px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-fork:hover:not(:disabled) { background: var(--ghost-hover); color: var(--text); }

/* ── 管理员批准 ─────────────────────────────────────────────────────── */
.dock-card.waiting-admin { background: var(--alpha-1); box-shadow: inset 0 0 0 1px var(--border-line); }
.dock-card.waiting-admin .dock-title .icon { color: var(--text-3); }
.dock-card.admin { box-shadow: var(--shadow-composer), inset 0 0 0 1.5px color-mix(in srgb, var(--clay) 55%, transparent); }
.dock .banner { margin: 0; }

/* ── 弹窗(账号管理) ─────────────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, 0.35); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; animation: fade-in 0.15s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 640px; background: var(--popover); border-radius: 16px; box-shadow: var(--shadow-popover); animation: pop-in 0.18s var(--ease-out); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 16px 8px 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.55; }
.modal-body { padding: 8px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.modal-body > .btn { align-self: flex-start; }
.acct-card { border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border-line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.acct-card.admins { background: var(--alpha-1); box-shadow: none; }
.acct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.acct-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.acct-role { font-size: 11px; font-weight: 500; color: var(--text-2); padding: 0 7px; border-radius: 9999px; background: var(--alpha-1); }
.acct-role.admin { color: var(--clay-emph); background: color-mix(in srgb, var(--clay) 14%, transparent); }
.acct-role-seg { margin: 0; }
.acct-root { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.acct-trust { display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: 12.5px; cursor: pointer; }
.folder-btn.fixed { cursor: default; }
.folder-btn.fixed:hover { background: none; }
.acct-trust-note { color: var(--text-3); font-size: 12px; }
.acct-actions { display: flex; gap: 4px; flex: none; align-items: center; }
.acct-actions.end { justify-content: flex-end; margin-top: 4px; }
.danger-text { color: var(--text-danger) !important; }
.acct-devices { display: flex; flex-direction: column; }
.acct-device { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 13px; border-top: 0.5px solid var(--border-line); }
.acct-device:first-child { border-top: none; }
.acct-device .dot { width: 7px; height: 7px; border-radius: 9999px; background: var(--border-strong); flex: none; }
.acct-device .dot.on { background: var(--success); }
.acct-device-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-tag { margin-left: 6px; font-size: 11px; color: var(--text-3); padding: 0 6px; border-radius: 9999px; background: var(--alpha-1); }
.acct-device-meta { font-size: 12px; color: var(--text-3); flex: none; }
.text-btn.danger { color: var(--text-danger); }
.acct-empty { font-size: 12.5px; color: var(--text-3); padding: 4px 0; }
.acct-form { display: flex; flex-direction: column; gap: 6px; }
.acct-form label { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.acct-form label .muted { margin-left: 6px; font-size: 12px; }
.acct-form.inline { flex-direction: row; align-items: center; gap: 6px; }
.acct-form.inline .field { flex: 1; min-width: 0; }
.acct-recent { display: flex; flex-wrap: wrap; gap: 4px; }
.root-chip.on { background: var(--fill-primary); color: var(--on-primary); }
.acct-cred { border-radius: 12px; padding: 12px; background: var(--bg-success); display: flex; flex-direction: column; gap: 8px; }
.acct-cred-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-success); }
.acct-cred pre.code { background: var(--surface-3); }
.acct-hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.acct-hint code { font-family: var(--font-mono); font-size: 11.5px; background: var(--alpha-1); padding: 1px 5px; border-radius: 4px; }

/* ── 登录页 ─────────────────────────────────────────────────────────── */
.pair-form { display: flex; flex-direction: column; gap: 6px; }
.pair-form .pair-label { margin-top: 4px; }
.pair-form .pair-label .muted { margin-left: 6px; font-size: 12px; }
.pair-form .btn { margin-top: 8px; }
.pair-progress { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.pair-text.small { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.pair-text code { font-family: var(--font-mono); font-size: 11.5px; background: var(--alpha-1); padding: 1px 5px; border-radius: 4px; }


/* ── 触屏 / 窄屏 ──────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  :root, :root[data-density] { --row-h: 34px; --row-font: 14px; --group-font: 13px; --radius-pill: 8px; }
  .msg-actions { opacity: 1; }
  .step-caret, .group-caret, .row-ctl { opacity: 1; }
  .ghost-btn, .icon-btn, .send-btn { min-height: 36px; }
  .send-btn { width: 36px; }
  .composer-input { font-size: 16px; }
  .draft-remove, .turn-fork { opacity: 1; }
}
@media (max-width: 700px) {
  .att-image, .att-image.pending { width: 104px; height: 104px; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100%; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-w), 86vw); transform: translateX(-100%); margin-left: 0 !important; box-shadow: none; }
  .frame.drawer-open .sidebar { transform: none; box-shadow: var(--shadow-popover); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, 0.3); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  .frame.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .sidebar-open, .frame.collapsed .sidebar-open { display: inline-flex; }
  .pane-header { padding: 0 6px; }
  .hdr-path { display: none; }
  .chat-column { padding: 0 10px; }
  .transcript { scrollbar-gutter: auto; }
  .msg-user .bubble { max-width: 88%; }
  .composer-dock { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .composer-box { border-radius: 18px; padding: 8px 8px 6px; }
  .folder-btn .folder-name { max-width: 34vw; }
  .mode-btn span { display: none; }
  .model-btn .model-effort { display: none; }
  .new-inner { padding-top: 8vh; }
  .greeting { margin-bottom: 20px; }
  .pop { max-width: calc(100vw - 20px); }
  .folder-menu, .usage-card, .ctx-pop { width: min(340px, calc(100vw - 20px)); }
  .composer-foot .foot-chip.path { display: none; }
}

/* ── 侧栏:搜索、置顶、分组、行菜单、重命名 ───────────────────────────── */
.side-search { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 8px; margin: 0 0 6px; border-radius: 8px; background: var(--alpha-1); color: var(--text-3); flex: none; }
.side-search input, .history-search input { flex: 1; min-width: 0; border: none; outline: none; background: none; color: var(--text); font: inherit; font-size: var(--row-font); }
.side-search input::placeholder, .history-search input::placeholder { color: var(--text-3); }
.side-search:focus-within { box-shadow: inset 0 0 0 1px var(--border-strong); }
.session-item { position: relative; display: block; }
.session-item .session-row { padding-right: 26px; }
.row-pin { flex: none; color: var(--text-3); margin-left: -2px; }
.group-icon { flex: none; color: var(--text-3); }
.row-more { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); margin-top: -1px; width: 22px; height: 20px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); opacity: 0; transition: opacity 0.1s; }
.session-item:hover .row-more, .session-item.menu-open .row-more { opacity: 1; }
.row-more:hover { background: var(--ghost-hover); color: var(--text); }
.row-menu { width: 200px; }
.nav-row.renaming { padding: 0 4px; background: var(--ghost-selected); }
.rename-input { flex: 1; min-width: 0; height: calc(var(--row-h) - 4px); border: none; outline: none; border-radius: 5px; padding: 0 6px; background: var(--page); color: var(--text); font: inherit; font-size: var(--row-font); box-shadow: inset 0 0 0 1px var(--border-strong); }
.nav-row.search-hit { height: auto; flex-direction: column; align-items: stretch; gap: 1px; padding: 4px 8px; }
.hit-snippet { font-size: 11.5px; color: var(--text-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
@media (pointer: coarse) {
  .row-more { opacity: 1; }
}

/* 历史对话搜索 */
.history-search { display: flex; align-items: center; gap: 6px; height: 30px; margin: 4px 0 6px; padding: 0 6px 0 10px; border-radius: 8px; background: var(--alpha-1); color: var(--text-3); }
.history-search:focus-within { box-shadow: inset 0 0 0 1px var(--border-strong); }

/* ── 回复里的本机图片:缩略图 ─────────────────────────────────────────── */
.md-img { display: inline-block; vertical-align: top; margin: 4px 0; }
.md-img-ph { display: inline-flex; align-items: center; gap: 6px; min-height: 64px; min-width: 120px; padding: 8px 12px; border-radius: 8px; background: var(--alpha-1); color: var(--text-3); font-family: var(--font-ui); font-size: 12px; }
.md-img.loading .md-img-ph::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--text-2); animation: rcc-spin 0.8s linear infinite; }
.md-img.failed .md-img-ph { min-height: 0; color: var(--text-danger); }
.md-img.failed .md-img-ph::after { content: "(预览失败)"; }
@keyframes rcc-spin { to { transform: rotate(360deg); } }
.md .md-thumb, .md-thumb { display: block; width: auto; max-width: min(240px, 100%); max-height: 160px; border-radius: 8px; cursor: zoom-in; box-shadow: 0 0 0 0.5px var(--border-line), 0 1px 4px rgba(0, 0, 0, 0.08); }
.lightbox { flex-direction: column; gap: 10px; }
.lightbox-cap { color: rgba(255, 255, 255, 0.85); font-size: 13px; text-align: center; }

/* ── 排队中的消息 ─────────────────────────────────────────────────────── */
.queue-block { margin: 0 0 8px; padding: 6px 10px; border-radius: 12px; background: var(--alpha-1); box-shadow: inset 0 0 0 0.5px var(--border-line); }
.queue-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); padding: 2px 0 4px; }
.queue-block { max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.queue-item { display: flex; align-items: flex-start; gap: 4px 8px; padding: 5px 0; border-top: 0.5px solid var(--border-line); font-size: var(--fs-small); }
/* 收起:最多两行(保留换行);展开:全文,太长就在框里滚动,文字可以选中复制 */
.queue-text {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.queue-text.clickable { cursor: pointer; }
.queue-text.clickable:hover { color: var(--text); }
.queue-item.open .queue-text { display: block; max-height: min(40vh, 320px); overflow-y: auto; color: var(--text); padding: 6px 8px; margin: -2px 0; border-radius: 8px; background: var(--page); box-shadow: inset 0 0 0 0.5px var(--border-line); user-select: text; -webkit-user-select: text; }
.queue-files { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }
.queue-actions { flex: none; display: flex; align-items: center; gap: 2px; min-height: 19px; }
.queue-by { flex: none; font-size: 11.5px; color: var(--text-3); margin-right: 4px; }
.queue-toggle { display: inline-flex; align-items: center; gap: 1px; }
.queue-caret { transition: transform 0.15s var(--ease-out); }
.queue-item.open .queue-caret { transform: rotate(90deg); }
.queue-item.open { flex-wrap: wrap; }
.queue-item.open .queue-text { flex-basis: 100%; }
.queue-item.open .queue-actions { margin-left: auto; }
@media (max-width: 700px) {
  /* 手机:文字占满一行,操作按钮放在下面一行靠右,按钮加大好点 */
  .queue-item { flex-wrap: wrap; }
  .queue-text { flex-basis: 100%; }
  .queue-actions { margin-left: auto; }
}
@media (pointer: coarse) {
  .queue-actions .text-btn { min-height: 30px; padding: 0 8px; font-size: 13px; }
}
.text-btn.danger { color: var(--text-danger); }

/* ── 阶段完成:一键压缩建议 ──────────────────────────────────────────── */
.compact-hint { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--clay) 8%, transparent); box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--clay) 30%, transparent); font-family: var(--font-ui); }
.compact-hint > .icon { flex: none; color: var(--clay); align-self: flex-start; margin-top: 2px; }
.ch-body { flex: 1; min-width: 0; }
.ch-title { font-size: var(--fs-small); font-weight: 600; }
.ch-desc { font-size: 12px; color: var(--text-2); line-height: 1.45; margin-top: 1px; }
.ch-actions { flex: none; display: flex; gap: 4px; }
@media (max-width: 700px) {
  .compact-hint { flex-wrap: wrap; }
  .ch-actions { width: 100%; justify-content: flex-end; }
}

/* ── 顺便问侧栏 ──────────────────────────────────────────────────────── */
.pane-split { flex: 1; min-height: 0; display: flex; min-width: 0; }
.pane-split > .pane { min-width: 0; }
.btw-toggle.on { background: var(--ghost-selected); color: var(--text); }
.btw-toggle .icon { color: var(--clay); }
.btw-count { margin-left: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9999px; background: var(--alpha-2); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.btw-panel { flex: none; width: 360px; display: flex; flex-direction: column; min-height: 0; border-left: 0.5px solid var(--border-line); background: var(--sidebar); }
.btw-panel-head { flex: none; height: var(--header-h); display: flex; align-items: center; gap: 6px; padding: 0 8px 0 14px; }
.btw-panel-head > .icon { color: var(--clay); }
.btw-panel-title { font-size: 13.5px; font-weight: 600; }
.btw-panel-sub { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text-3); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.btw-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 12px; }
.btw-empty { font-size: 12.5px; color: var(--text-3); line-height: 1.6; padding: 8px 2px; }
.btw-empty code { font-family: var(--font-mono); font-size: 11.5px; background: var(--alpha-1); padding: 0 4px; border-radius: 4px; }
.btw-item { padding: 10px 0; border-top: 0.5px solid var(--border-line); }
.btw-item:first-child { border-top: none; }
.btw-item .btw-q { font-size: var(--fs-small); font-weight: 600; margin-bottom: 1px; white-space: pre-wrap; }
.btw-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.btw-item .md { font-size: var(--fs-small); }
.btw-panel-input { flex: none; display: flex; align-items: flex-end; gap: 6px; margin: 0 10px 10px; padding: 6px 6px 6px 10px; border-radius: 14px; background: var(--page); box-shadow: inset 0 0 0 0.5px var(--border-strong); cursor: text; }
.btw-panel-input textarea { flex: 1; min-width: 0; resize: none; border: none; outline: none; background: none; color: var(--text); font: inherit; font-size: var(--fs-small); line-height: 1.45; max-height: 140px; }
.btw-panel-input .send-btn { width: 28px; height: 28px; }
@media (max-width: 900px) {
  .btw-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(380px, 92vw); box-shadow: var(--shadow-popover); }
}

/* 后台设置 */
.settings-row { align-items: center; }
.settings-label { font-size: 13px; flex: none; }
.settings-num { width: 90px; flex: none; text-align: right; }
.settings-sel { width: auto; flex: none; }
.settings-row + .settings-row { margin-top: 6px; }
.settings-row input[type=checkbox] { flex: none; }

/* ── 减少动态效果:运行状态改成静止但仍然分得开的样式 ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .status-dot.running { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 32%, transparent); }
  .status-dot.running::after { animation: none; box-shadow: none; }
  .spin-spark { animation: none; }
  .working.running .working-label { animation: none; background: none; -webkit-text-fill-color: currentColor; }
  .spinner { animation-duration: 2.4s; }
}

/* ── 往前翻页(对话顶部) ───────────────────────────────────────────── */
.load-more-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px auto 12px; }
.load-more-row .load-more { margin: 0; }
.load-more.busy { display: inline-flex; align-items: center; gap: 6px; background: transparent; }
.load-all { color: var(--text-3); }
.load-all:hover { color: var(--text-2); }

/* ── 删除对话的确认框 ───────────────────────────────────────────────── */
.modal-back.confirm-back { align-items: center; padding: 16px; }
.modal.confirm-modal { max-width: 420px; }
.confirm-body { padding: 20px 20px 6px; display: flex; flex-direction: column; gap: 8px; }
.confirm-body .modal-title { word-break: break-word; }
.confirm-text { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.confirm-note { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.confirm-warn { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; color: var(--text-danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 4px 10px; border-radius: 9999px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; }
.confirm-actions .btn { gap: 6px; }

/* ── 历史提示词 ───────────────────────────────────────────────────────── */
.modal.prompts-modal { max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; }
.prompts-search { position: relative; margin: 4px 20px 8px; }
.prompts-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.prompts-search .field { width: 100%; padding-left: 32px; }
.prompts-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.prompt-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; }
.prompt-item:hover { background: var(--ghost-hover); }
.prompt-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prompt-time { flex: none; font-size: 11.5px; color: var(--text-3); padding-top: 2px; }
.prompts-empty { padding: 24px 8px; text-align: center; color: var(--text-2); font-size: 13px; }

@media (max-width: 700px) {
  /* 手机:确认框从底部弹出,按钮够大好点 */
  .modal-back.confirm-back { align-items: flex-end; padding: 0; }
  .modal.confirm-modal { max-width: none; min-height: 0; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .confirm-actions { padding: 12px 16px 18px; }
  .confirm-actions .btn { flex: 1; justify-content: center; height: 44px; font-size: 15px; }
  .confirm-actions .btn.ghost { background: var(--fill-secondary); }
  .modal.prompts-modal { max-height: none; height: 100%; }
  .prompt-item { padding: 12px 10px; }
  .prompts-search .field { font-size: 16px; }
}
/* ── 子 agent 卡片(沿用工具调用的紧凑行;第二行是状态和用量,第三行是运行中的阶段摘要) ── */
.agent-row { align-items: flex-start; padding-top: 3px; padding-bottom: 3px; }
.agent-row .step-icon { height: var(--step-h); }
.agent-row .step-caret { flex: none; margin-top: calc((var(--step-h) - 14px) / 2); }
.agent-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.agent-line { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: var(--step-h); }
.agent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 12px; line-height: 18px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.agent-status { font-weight: 500; }
.agent-status.running { color: var(--run-text); }
.agent-status.completed { color: var(--text-success); }
.agent-status.failed { color: var(--text-danger); }
.agent-status.stopped, .agent-status.unknown { color: var(--text-2); }
.agent-tag { font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 9999px; color: var(--text-2); background: var(--alpha-1); box-shadow: inset 0 0 0 0.5px var(--border-line); }
.agent-tool { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); }
.agent-tool::before { content: "正在用"; color: var(--text-3); margin-right: 1px; }
.agent-phase { font-size: 12.5px; line-height: 18px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-body { gap: 8px; }
.agent-section { display: flex; flex-direction: column; gap: 4px; }
.agent-sec-head { display: flex; align-items: center; gap: 6px; min-height: 24px; font-size: 12px; color: var(--text-3); list-style: none; cursor: pointer; user-select: none; }
.agent-sec-head::-webkit-details-marker { display: none; }
.agent-sec-head.static { cursor: default; }
.agent-sec-head > span:not(.agent-sec-note) { font-weight: 500; color: var(--text-2); }
.agent-sec-head:not(.static):hover > span:not(.agent-sec-note) { color: var(--text); }
.agent-copy { margin-left: auto; }
.agent-sec-caret { flex: none; transition: transform 0.15s var(--ease-out); }
.agent-prompt[open] .agent-sec-caret { transform: rotate(90deg); }
.agent-prompt-text { max-height: 360px; }
.agent-report { padding-left: 10px; border-left: 2px solid var(--border-line); }
.agent-report .md { font-size: var(--fs-small); }
.agent-report .md > :last-child { margin-bottom: 0; }
.agent-wait { font-size: 12px; color: var(--text-3); }
.agent-error { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--text-danger); }
.agent-error .icon { flex: none; margin-top: 2px; }
.sub-tool { min-width: 0; }
.sub-tool b, .sub-tool .icon { flex: none; }
.sub-sum { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* 后台命令:工具调用已经返回,命令还在跑 */
.step-bg { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--run-text); }
/* 从输入框上方的小条跳过来:闪一下 */
.step.flash > .step-row { animation: step-flash 1.6s ease-out; }
@keyframes step-flash { 0%, 35% { background: color-mix(in srgb, var(--clay) 16%, transparent); } 100% { background: transparent; } }

/* 输入框上方:有子 agent 在跑 */
.agents-bar { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0 0 8px; padding: 4px 6px 4px 6px; border-radius: 12px; background: var(--alpha-1); box-shadow: inset 0 0 0 0.5px var(--border-line); font-size: 12.5px; }
.agents-count { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 2px 6px; border-radius: 8px; color: var(--run-text); font-weight: 500; }
.agents-count:hover { background: var(--ghost-hover); }
.agents-chips { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.agents-chips::-webkit-scrollbar { display: none; }
.agents-chip { flex: none; max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 9px; border-radius: 9999px; font-size: 12px; color: var(--text-2); background: var(--page); box-shadow: inset 0 0 0 0.5px var(--border-line); }
.agents-chip:hover { color: var(--text); }
@media (max-width: 700px) {
  .agents-chip { max-width: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .step.flash > .step-row { animation: none; }
}
