/* ==========================================================================
   Codex 手机端 · 视觉与交互样式
   色值、圆角、字号全部对齐 Codex 桌面版（app.asar 主题引擎 U() 原样移植）：
   表面 #ffffff / #181818，正文 #1a1c1f / #e6e6e6，边框 8% 墨色，
   卡片 20px 圆角、选项行 12px、按钮与输入区胶囊形，14px 正文 / 12px 辅助字。
   ========================================================================== */

:root {
  color-scheme: light dark;
  /* 颜色：与桌面版 app-color-* 一一对应（浅色 = 默认主题 surface #ffffff / ink #1a1c1f） */
  --bg: #ffffff;                       /* 主区 app-color-background-surface */
  --side: #f6f6f6;                     /* 侧栏 surface-under */
  --surface: #ffffff;                  /* 卡片/面板 control-opaque */
  --composer-bg: #ffffff;              /* 输入框 elevated-primary-opaque */
  --surface-2: #f4f4f4;                /* 用户气泡 = 正文色 5% */
  --code-bg: #f6f6f7;
  --hover: rgba(26, 28, 31, .05);
  --hover-strong: rgba(26, 28, 31, .08);
  --text: #1a1c1f;
  --text-2: rgba(26, 28, 31, .82);
  --muted: rgba(26, 28, 31, .695);     /* text-foreground-secondary */
  --faint: rgba(26, 28, 31, .495);     /* text-foreground-tertiary / codex-description */
  --line: rgba(26, 28, 31, .078);      /* border */
  --line-strong: rgba(26, 28, 31, .117); /* border-heavy */
  --solid: #1a1c1f;                    /* 主按钮 / 发送按钮 */
  --on-solid: #ffffff;
  --blue: #339cff;                     /* accent */
  --blue-text: #0285ff;
  --blue-soft: #e5f2ff;
  --warning: #e25507;                  /* 「完全访问」 */
  --purple: #924ff7;                   /* 技能 / Ultra */
  --danger: #e02e2a;
  --danger-soft: rgba(224, 46, 42, .1);
  --green: #00a240;
  --green-soft: rgba(0, 162, 64, .12);
  --diff-del: #ba2623;
  --amber: #e25507;
  --amber-soft: rgba(226, 85, 7, .1);
  --shadow-sm: 0 1px 2px -1px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, .1);
  --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, .19);
  --elev-composer: 0 0 0 1px rgba(0, 0, 0, .04), 0 2px 8px 0 rgba(0, 0, 0, .04), 0 4px 80px 8px rgba(0, 0, 0, .024);
  /* 尺寸 */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-card: 20px;
  --radius-pill: 9999px;
  --tap: 44px;
  --control: 28px;
  --app-h: 100dvh;
  /* 键盘占掉的高度：整页按 --app-h 收，底部弹出的面板再按 --kb 抬起来 */
  --kb: 0px;
  --safe-l: env(safe-area-inset-left);
  --safe-r: env(safe-area-inset-right);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 430;
  -webkit-text-size-adjust: 100%;
  font-synthesis: none;
}

/* ---------- 基础 ---------- */

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body { line-height: 1.6; }

button, input, textarea, select { font: inherit; color: inherit; }

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { opacity: .45; cursor: default; }

input, textarea, select {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius);
  color: var(--text);
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--blue) 60%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

[hidden] { display: none !important; }

svg { flex: none; }

::selection { background: color-mix(in srgb, var(--blue) 24%, transparent); }

.thread-list,


.conversation,


.sheet,


.tool-detail,


.pending-cards,


.file-list,


.file-text-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

/* ---------- 通用按钮 ---------- */

.quiet {
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 13px;
  transition: background-color .15s ease, color .15s ease;
}
.quiet:hover { background: var(--hover); color: var(--text-2); }

.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  min-height: var(--tap);
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 560;
  transition: background-color .15s ease, transform .08s ease, filter .15s ease;
}
.primary { background: var(--solid); color: var(--on-solid); }
.primary:hover { filter: brightness(1.12); }
.secondary { background: var(--surface); border: 1px solid var(--line); }
.secondary:hover { background: var(--hover); }
.primary:active, .secondary:active { transform: scale(.985); }

.icon-button {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  flex: 0 0 var(--tap);
  border-radius: var(--radius);
  font-size: 21px;
  line-height: 1;
  color: var(--text-2);
  transition: background-color .15s ease;
}
.icon-button:hover { background: var(--hover); }

.compact { padding: 8px 6px; font-size: 12.5px; }

.mobile-only, .side-icon.mobile-only { display: none; }
.error, .danger-text { color: var(--danger); }
.muted { color: var(--muted); }

/* ---------- 状态小部件 ---------- */

.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 1.6px solid var(--line-strong);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.unread-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue);
  display: block;
  flex: none;
}

.pending-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- 应用骨架 ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: var(--app-h);
  min-height: 0;
}

/* ---------- 侧栏（桌面版：Codex 标题 + 搜索图标、「新聊天」行、置顶/项目分组、只显示标题） ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 10px 8px 0;
  padding-top: max(10px, env(safe-area-inset-top));
  border-right: 1px solid var(--line);
  background: var(--side);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 0 4px 6px 10px;
}

.brand {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }

.side-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--faint);
}
.side-icon:hover, .side-icon.active { background: var(--hover); color: var(--text); }

.side-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  text-align: left;
}
.side-row:hover { background: var(--hover); }
.side-row .cx-icon { color: var(--muted); }
.new-chat { margin-bottom: 8px; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--faint);
}
.search-wrap:focus-within { border-color: var(--line-strong); }
.search-wrap input {
  width: 100%;
  padding: 7px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
}
.search-wrap input:focus { box-shadow: none; }

.list-tabs { display: none; }

.thread-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 16px;
}

.thread-group { margin: 4px 0 12px; }

.group-name {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 4px;
  overflow: hidden;
  color: var(--faint);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.group-name .group-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--faint);
  cursor: pointer;
}
.group-name .group-new:hover { background: var(--hover); color: var(--text); }
.group-name .group-new[hidden] { display: none; }

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  transition: background-color .12s ease, color .12s ease;
}
.thread-row:hover { background: var(--hover); color: var(--text); }
.thread-row.selected {
  background: var(--hover-strong);
  color: var(--text);
  font-weight: 400;
  box-shadow: none;
}

.activity-button { position: relative; }
.activity-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.activity-dot[hidden] { display: none; }
.new-target { display: inline-flex; align-items: center; gap: 6px; margin: 0 auto 14px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2); font-size: 13px; background: transparent; }
.new-target:hover { background: var(--hover); color: var(--text); }
.new-target.inline { margin: 0 2px; padding: 0 6px; font: inherit; color: var(--text); border-color: transparent; background: var(--hover); vertical-align: baseline; }
.new-target[hidden] { display: none !important; }
.pick-row .pick-name { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { gap: 2px; }
.brand-chev { color: var(--faint); flex: none; margin-left: -2px; }
.send-button.queued-flash { background: var(--blue); color: #fff; }
.thread-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: flex; align-items: center; gap: 6px; }
/* 进行中的对话：标题下面一行显示此刻在做什么（电脑侧栏那行灰字） */
.thread-activity {
  grid-column: 1 / -1;
  margin-top: 1px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  line-height: 16px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.thread-activity[hidden] { display: none; }
.thread-row.is-active { min-height: 46px; align-content: center; row-gap: 1px; }

/* 进行中的圈：和电脑一样亮黄色、带光晕 */
.row-spinner { display: grid; place-items: center; color: #f0a11c; filter: drop-shadow(0 0 4px rgba(240, 161, 28, .65)); }
.row-spinner .cx-icon { width: 14px; height: 14px; animation: spin 1s linear infinite; }
.thread-row.is-active .thread-label { color: var(--text); }
.pending-label {
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--blue-soft);
  color: var(--blue-text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.list-more { display: block; width: calc(100% - 8px); margin: 4px 4px 10px; color: var(--faint); text-align: center; font-size: 13px; }
.list-empty { padding: 24px 12px; color: var(--muted); font-size: 13px; line-height: 1.8; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 0 max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.sidebar-foot .side-row { flex: 1; width: auto; }
.connection-label { padding: 0 8px; color: var(--faint); font-size: 11px; white-space: nowrap; }

/* ---------- 主区（桌面版：顶栏 46px，文件夹图标 + 粗体标题，右侧 … 菜单；无分隔线） ---------- */

.main-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 46px;
  padding: 6px 12px 6px 16px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: var(--bg);
}

.thread-heading { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding-right: 4px; }
.heading-folder { flex: none; width: 16px; height: 16px; color: var(--muted); }
.thread-heading h1 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar .icon-button {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.topbar .icon-button:hover { background: var(--hover); color: var(--text); }
.topbar .icon-button .cx-icon { width: 16px; height: 16px; }
.header-files { min-height: 0; padding: 0; }

.update-banner {
  padding: 9px 16px;
  background: var(--blue-soft);
  color: var(--blue-text);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.connection-banner {
  padding: 9px 16px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  line-height: 1.6;
}

/* 额度用完 / 登录失效：常驻在输入区上方，直到点「再试」或 30 分钟自然过期 */
.hold-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 6px;
  padding: 8px 10px 8px 12px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  line-height: 1.5;
}
.hold-bar[hidden] { display: none; }
.hold-bar span { flex: 1; min-width: 0; }
.hold-retry { flex: none; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; }

/* ---------- 对话 ---------- */

.conversation {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 22px 32px;
  scroll-padding-bottom: 24px;
  -webkit-overflow-scrolling: touch;
}

.messages { width: 100%; max-width: 780px; margin: 0 auto; }

.history-more {
  display: block;
  margin: 0 auto 18px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
}

.turn { margin: 0 0 24px; }

.item { margin: 12px 0; min-width: 0; overflow-wrap: anywhere; }

/* 用户消息：桌面版 bubble —— 最宽 70%，左右 16px、上下 10px，22px 圆角，底色 = 正文色 5% */
.item.userMessage {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: 8px 0 22px;
}
.user-bubble {
  max-width: min(70%, 560px);
  min-width: 0;
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  line-height: 22px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
  max-height: calc(22px * 8 + 20px);
  overflow: hidden;
}
.user-bubble.expanded { max-height: none; }
.user-bubble strong { font-weight: 600; }
.question-reply [data-user-action="edit"], .question-reply [data-user-action="resend"] { display: none; }
.bubble-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
}
.bubble-more:hover { background: var(--hover); color: var(--text); }
.bubble-more.open .cx-icon { transform: rotate(180deg); }
.mobile-input-label {
  display: block;
  margin: 0 4px 6px;
  color: var(--faint);
  font-size: 12px;
  text-align: right;
}
.user-images { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 82%; margin-top: 8px; }
.user-images:empty { display: none; }
.user-images img {
  display: block;
  max-width: 180px;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* 消息下方的图标按钮（复制 / 朗读 / 分享；用户消息：复制 / 改一改 / 再发） */
.message-tools {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity .15s ease;
}
.item:hover .message-tools,
.item:focus-within .message-tools { opacity: 1; }
.tool-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  color: var(--faint);
}
.tool-icon:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.tool-icon .cx-icon { width: 14px; height: 14px; }
.assistant-tools { justify-content: flex-start; margin-left: -6px; }
.item.agentMessage:not(.final) .assistant-tools,
.item.commentary .assistant-tools { display: none; }

/* 正文：14px，行高 1.65（桌面实测 23px） */
.message-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}
.message-content > *:first-child { margin-top: 0; }
.message-content > *:last-child { margin-bottom: 0; }
.message-content p { margin: 10px 0; }
.message-content h1, .message-content h2, .message-content h3 {
  margin: 20px 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}
.message-content h4, .message-content h5, .message-content h6 { margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
.message-content ul, .message-content ol { margin: 10px 0; padding-left: 22px; }
.message-content li { margin: 4px 0; padding-left: 2px; }
.message-content blockquote {
  margin: 12px 0;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
}
.message-content hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.message-content a { color: var(--blue-text); text-decoration: none; }
.message-content a:hover { text-decoration: underline; }
.item.commentary { margin: 8px 0; }
.item.commentary .message-content { color: var(--text); }

code {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Cascadia Code", monospace;
  font-size: .88em;
}
p code, li code, td code, h2 code, h3 code, h4 code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.6 ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Cascadia Code", monospace;
}

.code-wrap {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 4px 12px;
  color: var(--faint);
  font-size: 12px;
}
.code-head button { padding: 4px 8px; border-radius: var(--radius-sm); font-size: 12px; color: var(--faint); }
.code-head button:hover { background: var(--hover); color: var(--text); }
.code-wrap pre { padding: 4px 12px 12px; overflow-x: auto; white-space: pre; overflow-wrap: normal; }

.table-wrap { margin: 12px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); font-weight: 600; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* 时间分隔：桌面「今天 17:29」居中、淡色 */
.turn-stamp {
  margin: 18px 0 14px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 中间步骤：完成后收进「用时 X ›」，进行中展开显示 */
.activity { margin: 4px 0 12px; }
.activity-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 0;
  color: var(--faint);
  font-size: 14px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.activity-head:hover { color: var(--text); }
.activity-chev { width: 12px; height: 12px; opacity: .7; transition: transform .2s ease; }
.activity.open .activity-chev { transform: rotate(90deg); }
.activity.running .activity-head { color: var(--muted); }
.activity-body { display: none; padding: 6px 0 2px; }
.activity.open .activity-body { display: block; }
.activity.has-final:not(.running) {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.activity.empty .activity-body { display: none; }

/* 单个步骤行：图标 + 「已运行 git status」，文字 60% 正文色，悬停变实 */
.item.act-row { margin: 0; }
.act-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  padding: 4px 0;
  color: color-mix(in srgb, var(--text) 60%, transparent);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}
.act-head:hover { color: var(--text); }
.act-icon { display: grid; place-items: center; flex: none; width: 16px; height: 16px; color: color-mix(in srgb, var(--text) 60%, transparent); }
.act-icon .cx-icon { width: 14px; height: 14px; }
.act-summary { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.act-target.mono { font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.act-stats { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.act-stats .add { color: var(--green); }
.act-stats .del { color: var(--diff-del); }
.act-chev { display: grid; place-items: center; flex: none; opacity: 0; transition: transform .2s ease, opacity .15s ease; color: var(--faint); }
.act-chev .cx-icon { width: 12px; height: 12px; }
.act-head:hover .act-chev, .act-row.open .act-chev { opacity: 1; }
.act-row.open .act-chev { transform: rotate(90deg); }
@media (hover: none) { .act-chev { opacity: .55; } }
.act-row.failed .act-verb { color: var(--danger); }
.act-body { padding: 2px 0 8px 24px; }
.act-body .tool-detail {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--text);
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
}
.act-command { color: var(--text); font-weight: 500; }
.act-output { margin-top: 8px; color: var(--muted); }
.act-meta { margin-top: 6px; color: var(--faint); font-size: 11.5px; }
.act-file { margin: 8px 0 4px; font-weight: 500; font-size: 12px; overflow-wrap: anywhere; }
.act-file:first-child { margin-top: 0; }
.tool-detail img { display: block; max-width: 100%; max-height: 280px; border-radius: var(--radius-sm); }

/* 「正在思考」的流光字 */
.shimmer {
  background: linear-gradient(90deg, var(--faint) 0%, var(--faint) 35%, var(--text) 50%, var(--faint) 65%, var(--faint) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.reasoning { font-size: 13px; line-height: 1.65; color: var(--muted); }

.diff { border-radius: var(--radius-sm); overflow: hidden; }
.diff > span { display: block; padding: 0 6px; }
.diff .added { background: var(--green-soft); color: var(--green); }
.diff .removed { background: var(--danger-soft); color: var(--diff-del); }
.diff .hunk { color: var(--blue-text); background: var(--blue-soft); }

/* 本轮改动卡：桌面「已编辑 6 个文件 +327 -0」 */
.diff-card {
  margin: 12px 0 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--bg);
}
.diff-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
}
.diff-card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
}
.diff-card-title { display: flex; flex-direction: column; min-width: 0; }
.diff-card-title strong { font-size: 13.5px; font-weight: 600; }
.diff-card-files { display: flex; flex-direction: column; }
.diff-card-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
}
.diff-card-file:hover, .diff-card-file.open { background: var(--hover); }
.diff-card-diff { max-height: 280px; overflow: auto; border-top: 1px solid var(--line); background: var(--code-bg); font-size: 12px; }
.diff-card-more {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}
.diff-card-more:hover { background: var(--hover); color: var(--text); }

.plan-list {
  list-style: none;
  margin: 14px 0 0 !important;
  padding: 10px 12px !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.7;
}
.plan-list li { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 3px 0; }
.plan-list .plan-icon { width: 14px; flex: none; text-align: center; color: var(--muted); }
.plan-list .completed { color: var(--muted); }
.plan-list .completed .plan-icon { color: var(--green); }

.turn-error {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
}

.compaction {
  margin: 20px 0;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}
.compaction::before, .compaction::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  margin: 0 10px;
  vertical-align: middle;
  background: var(--line);
}

/* 空状态＝桌面新聊天页：居中一句「我们要构建什么？」，选了项目时项目名就是下拉 */
.empty-state {
  max-width: 420px;
  margin: clamp(48px, 16vh, 180px) auto 40px;
  padding: 0 20px;
  text-align: center;
}
.empty-state .empty-mark {
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 16px;
  color: var(--text);
}
.empty-state h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.empty-state p { margin: 0 0 20px; color: var(--faint); font-size: 14px; line-height: 1.7; }
.empty-state .secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.empty-state .secondary:hover { background: var(--hover); }

.jump-latest {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 4;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- 输入区 ---------- */

.composer-area {
  position: relative;
  align-self: center;
  width: 100%;
  max-width: 820px;
  flex: none;
  padding: 0 22px max(14px, env(safe-area-inset-bottom));
  padding-left: max(22px, var(--safe-l));
  padding-right: max(22px, var(--safe-r));
}
.composer-area::before {
  content: '';
  position: absolute;
  inset: -28px 0 auto;
  height: 28px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}

/* 输入框上方的「正在运行」胶囊：照桌面的浮条，黄色转圈 + 任务名 + 当前步骤，点一下回到最下面 */
.run-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0 0 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--elev-composer);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.run-bar[hidden] { display: none; }
.run-bar:hover { border-color: var(--line-strong); }
.run-spinner { display: grid; place-items: center; flex: none; color: #f0a11c; filter: drop-shadow(0 0 4px rgba(240, 161, 28, .55)); }
.run-spinner .cx-icon { width: 14px; height: 14px; animation: spin 1s linear infinite; }
.run-copy { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 12.5px; line-height: 17px; }
#runTitle { flex: none; font-weight: 600; }
#runStep { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.run-bar.no-step #runStep { display: none; }

/* 输入区：和桌面版一样是一个圆角框，底行左「+ 权限」，右「模型 发送」 */
.composer {
  padding: 10px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--composer-bg);
  box-shadow: var(--elev-composer);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer:focus-within { border-color: var(--line-strong); }

#prompt {
  display: block;
  width: 100%;
  min-height: 26px;
  /* 输入框最多占可视高的三成：折叠屏折成矮窗口时，一长段字也不会把对话挤没 */
  max-height: min(180px, 30dvh);
  padding: 4px 6px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none !important;
  resize: none;
  font-size: 14px;
  line-height: 20px;
}
#prompt::placeholder { color: var(--faint); }
#prompt:focus { box-shadow: none; }

.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }

.composer-round {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--muted);
  transition: background-color .12s ease, color .12s ease;
}
.composer-round:hover { background: var(--hover); color: var(--text); }
.composer-round .cx-icon { width: 16px; height: 16px; }

.composer-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.composer-pill:hover { background: var(--hover); color: var(--text); }
.composer-pill .chev { width: 12px; height: 12px; opacity: .7; }
#modelButton { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
#modelButton .cx-icon { flex: none; }

.send-button, .stop-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--solid);
  color: var(--on-solid);
  transition: opacity .15s ease, transform .08s ease;
}
.send-button .cx-icon, .stop-button .cx-icon { width: 16px; height: 16px; }
.send-button:active, .stop-button:active { transform: scale(.94); }
.send-button:disabled { opacity: .28; }
.stop-button { background: var(--solid); color: var(--on-solid); }
.composer.running.empty .send-button { display: none; }
.composer:not(.running) .stop-button, .composer.running:not(.empty) .stop-button { display: none; }



.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.attachment-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 6px 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11.5px;
}
.attachment-chip span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { padding: 0 4px; font-size: 15px; color: var(--muted); }
.attachment-chip img { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; }

.suggestion {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: left;
}
.suggestion:hover { color: var(--text-2); background: var(--hover); }

.slash-menu {
  position: absolute;
  right: 22px;
  bottom: 100%;
  left: 22px;
  z-index: 8;
  max-height: 320px;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
}
.slash-menu button {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
}
.slash-menu button:hover { background: var(--hover); }
.slash-menu small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }

/* ---------- 提问 / 审批卡片（对齐桌面版 requestInputPanel / ApprovalCard） ---------- */

.pending-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52dvh;
  margin-bottom: 10px;
  overflow: auto;
  overscroll-behavior: contain;
}

.ask-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
  color: var(--text);
}

/* 顶部：图标+说明 / 标题，右侧进度与收起 */
.ask-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 8px 16px;
  border-bottom: 1px solid var(--line);
}
.ask-head-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ask-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
}
.ask-eyebrow .cx-icon { color: var(--faint); }
.ask-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.ask-title.secondary { font-weight: 400; color: var(--muted); }
.ask-head-side { display: flex; align-items: center; gap: 4px; flex: none; color: var(--muted); font-size: 12px; }
.ask-count { font-variant-numeric: tabular-nums; color: var(--faint); }
.ask-head .collapse {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  color: var(--faint);
}
.ask-head .collapse:hover { background: var(--hover); color: var(--text); }
.ask-steps { display: flex; align-items: center; gap: 1px; }
.ask-steps button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--muted);
}
.ask-steps button:hover:not(:disabled) { background: var(--hover); color: var(--text); }

.ask-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 8px;
}



/* 选项列表：每行 32px 高、12px 圆角、左侧 20px 编号方块 */
.ask-options { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.ask-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  line-height: 16px;
  transition: background-color .12s ease;
}
@media (hover: hover) { .ask-option:hover { background: var(--hover); } }
.ask-option.selected { background: var(--hover); }
.ask-option:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.option-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--hover);
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ask-option.selected .option-number {
  border-color: var(--text);
  background: var(--solid);
  color: var(--on-solid);
}
.option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.option-label { font-size: 13.5px; font-weight: 500; line-height: 18px; overflow-wrap: anywhere; }
.option-description { font-size: 13px; line-height: 18px; color: var(--muted); overflow-wrap: anywhere; }
.option-badge {
  flex: none;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--hover-strong);
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
}

/* 自由输入行：同一行里一个铅笔图标 + 输入框 */
.ask-other { padding: 0 8px; }
.ask-other-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: text;
}
.ask-other-row:focus-within { background: var(--hover); }
.ask-other-row .cx-icon { flex: none; color: var(--faint); }
.ask-other-row input {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none !important;
  font-size: 13.5px;
  line-height: 18px;
  color: var(--text);
}
.ask-other-row input::placeholder { color: var(--faint); }
.ask-other-row input:focus { box-shadow: none; border: 0; }

.ask-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px;
}
.ask-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.ask-actions .quiet { color: var(--muted); padding-inline: 10px; }
.ask-actions .quiet:hover { background: var(--hover); color: var(--text); }
.ask-actions .secondary { border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
.ask-actions .secondary:hover { background: var(--hover); }
.ask-actions .primary { background: var(--solid); color: var(--on-solid); }
.ask-actions .primary:hover { filter: none; background: color-mix(in srgb, var(--solid) 88%, var(--bg)); }
.ask-actions .primary.accent { background: var(--blue); color: #fff; }
.ask-actions .enter-key {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .18);
  font-size: 11px;
  line-height: 1;
}

.ask-reason { margin: 0; padding: 0 16px; color: var(--muted); font-size: 13px; line-height: 20px; white-space: pre-wrap; }
.ask-command {
  margin: 0 16px;
  max-height: 220px;
  padding: 8px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", menlo, consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.ask-card > .ask-command { margin-inline: 16px; }
.ask-cmd-wrap { padding: 0 16px; }
.ask-cmd-wrap > .ask-command { margin: 0; }
.ask-cmd-more {
  display: flex;
  justify-content: flex-end;
  padding: 2px 0 0;
}
.ask-cmd-more button { padding: 2px 6px; border-radius: var(--radius-sm); color: var(--faint); font-size: 12px; }
.ask-cmd-more button:hover { background: var(--hover); color: var(--text); }
.ask-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
}
.ask-collapsed:hover { background: var(--hover); }
.ask-errors { margin: 0; padding: 8px 16px 12px; color: var(--danger); font-size: 12.5px; line-height: 1.6; }

.schema-field { display: block; margin: 0 16px 12px; font-size: 12.5px; color: var(--muted); }
.schema-field input, .schema-field select, .schema-field textarea { width: 100%; margin-top: 6px; padding: 9px 10px; font-size: 14px; color: var(--text); }
.schema-field input[type=checkbox] { width: auto; }




/* 方案卡：和桌面「实施此计划？」同一张卡 */









.ask-body textarea {
  display: block;
  width: calc(100% - 32px);
  min-height: 64px;
  max-height: 24dvh;
  margin: 0 16px;
  padding: 9px 10px;
  resize: vertical;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
}


/* 老的独立方案卡仍然可能被别处调用，保持同样的外观 */
.plan-approval {
  max-height: 46dvh;
  margin-bottom: 10px;
  padding: 14px 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-2);
}








/* ---------- 语音条 ---------- */

.voice-panel {
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.voice-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.voice-top > span::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
}
.voice-transcript { max-height: 170px; padding: 6px 0; overflow: auto; font-size: 12px; line-height: 1.7; color: var(--muted); }
.voice-transcript p { margin: 6px 0; }
.voice-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.voice-controls button { min-height: 34px; padding: 8px 11px; font-size: 11.5px; }
.voice-options .mode-row { min-height: 76px; }

.speech-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 4px 7px 4px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
}
.speech-bar > span { min-width: 0; max-height: 60px; overflow: auto; line-height: 1.6; overflow-wrap: anywhere; }
.speech-bar button { flex: none; min-height: 36px; font-size: 11.5px; white-space: nowrap; }

/* ---------- 面板（sheet）：手机上从底部弹出，里面的列表和桌面下拉菜单一个样子 ---------- */

.sheet {
  position: fixed;
  inset: auto 0 0;
  bottom: var(--kb, 0px);
  width: min(100% - 24px, 460px);
  max-height: min(86dvh, 760px);
  margin: auto;
  padding: 22px 12px max(16px, env(safe-area-inset-bottom));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.sheet::backdrop { background: rgba(0, 0, 0, .32); }
.sheet-grip {
  position: absolute;
  top: 0;
  left: 0;
  right: 48px;
  height: 24px;
  touch-action: none;
}
.sheet-grip::after {
  content: '';
  position: absolute;
  top: 7px;
  left: calc(50% + 24px);
  width: 36px;
  height: 4px;
  margin-left: -18px;
  border-radius: 999px;
  background: var(--line-strong);
}
@media (max-width: 700px) { #sheetContent > h2 { touch-action: none; } }
@media (min-width: 701px) { .sheet-grip { display: none; } }
.sheet-close { position: absolute; top: 10px; right: 8px; width: 32px; height: 32px; flex-basis: 32px; border-radius: var(--radius-sm); color: var(--faint); }
.sheet-close:hover { background: var(--hover); color: var(--text); }
.sheet h2 { margin: 2px 40px 12px 8px; font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.sheet h3 { margin: 18px 8px 6px; font-size: 12px; color: var(--faint); font-weight: 500; }
.sheet p { margin-inline: 8px; color: var(--faint); font-size: 13px; line-height: 1.7; }
.sheet label { display: block; margin: 14px 8px 6px; font-size: 12px; color: var(--faint); font-weight: 500; }
.sheet input:not([type=checkbox]), .sheet select { width: calc(100% - 16px); margin-inline: 8px; padding: 9px 10px; border-radius: var(--radius-sm); font-size: 16px; }
.sheet .full-width { width: calc(100% - 16px); margin: 14px 8px 0; }

.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.sheet-row:last-of-type { border-bottom: 0; }
.sheet-row span { min-width: 0; overflow-wrap: anywhere; }
.sheet-row small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; line-height: 1.5; }

.sheet-menu { display: flex; flex-direction: column; gap: 1px; }
.sheet-menu > button {
  padding: 10px 10px;
  border-radius: 10px;
  font-size: 14px;
  text-align: left;
  transition: background-color .12s ease;
}
.sheet-menu > button:hover { background: var(--hover); }
.sheet-menu > button > span > small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; line-height: 1.5; }

/* 改动卡「查看变更」：列整轮全部文件与 diff（桌面同名按钮打开右侧 Changes 面板） */
.diff-card-review {
  margin-left: auto;
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  transition: background-color .12s ease;
}
.diff-card-review:hover { background: var(--hover); }
.sheet-note { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.diff-review-sheet .diff-card-file { padding-left: 0; padding-right: 0; border-top: 0; }
.diff-review-sheet .diff-card-diff { max-height: 320px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius); }

.menu-thread-name {
  margin: -6px 8px 10px !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.settings-check {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  margin: 14px 8px !important;
  font-size: 14px !important;
  color: var(--text) !important;
}
.settings-check input { width: 20px; height: 20px; accent-color: var(--solid); }

/* 权限选择：桌面「应如何批准 Codex 操作？」菜单——标题 + 说明，选中项右侧打勾 */
.mode-row {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 40px 10px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition: background-color .12s ease;
}
.mode-row:hover { background: var(--hover); }
.mode-row.selected { background: var(--hover); }
.mode-row.selected::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 14px;
  width: 6px;
  height: 11px;
  margin-top: -7px;
  border-right: 1.6px solid var(--text);
  border-bottom: 1.6px solid var(--text);
  transform: rotate(45deg);
}
.mode-row strong { display: block; font-size: 14px; font-weight: 500; }
.mode-row small { display: block; margin-top: 2px; color: var(--faint); font-size: 12.5px; line-height: 1.5; }
.mode-row[data-mode="full-access"] strong { color: var(--warning); }

.usage-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; margin: 4px 8px 14px; font-size: 13px; }
.usage-grid dt { color: var(--faint); }
.usage-grid dd { margin: 0; font-variant-numeric: tabular-nums; }

.confirmation-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 18px 8px 0; }
.confirmation-actions > button { min-height: 32px; padding: 0 14px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500; }
.danger-button {
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.delete-warning {
  margin: 0 8px 10px !important;
  color: var(--text) !important;
  font-size: 14px !important;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ---------- 文件 ---------- */

.files-loading { padding: 26px 0; color: var(--muted); font-size: 13px; }
.files-loading .spinner { margin-right: 6px; vertical-align: -1px; }

.file-roots { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 8px 12px; }
.file-root {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12.5px;
}
.file-root:hover { background: var(--hover); color: var(--text); }
.file-root.selected { border-color: transparent; background: var(--hover-strong); color: var(--text); font-weight: 500; }

.files-location { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 8px 6px; }
.files-location > span {
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
  direction: ltr;
}
.files-location button { flex: none; padding: 4px 8px; border-radius: var(--radius-sm); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.files-location button:hover { background: var(--hover); color: var(--text); }
.files-notice { font-size: 12px !important; }

.file-list {
  max-height: 50dvh;
  min-height: 100px;
  overflow: auto;
  overscroll-behavior: contain;
}
.file-row { display: flex; align-items: center; gap: 2px; min-height: 40px; border-radius: 10px; }
.file-row:hover { background: var(--hover); }
.file-row-open { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; padding: 6px 4px 6px 10px; text-align: left; }
.file-type-icon { display: grid; place-items: center; flex: none; width: 20px; height: 20px; color: var(--muted); }
.file-row-label { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.file-row-label strong { min-width: 0; overflow: hidden; font-size: 14px; font-weight: 400; line-height: 20px; white-space: nowrap; text-overflow: ellipsis; }
.file-row-label small { flex: none; color: var(--faint); font-size: 12px; }
.file-download, .file-chevron {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--faint);
}
.file-download:hover { background: var(--hover-strong); color: var(--text); text-decoration: none; }
.files-empty { padding: 20px 12px; }

.file-path-details { margin-top: 16px; font-size: 12px; }
.file-path-details summary { padding: 8px 0; color: var(--muted); cursor: pointer; }
.file-path-actions { display: flex; gap: 8px; margin-top: 8px; }
.file-path-actions button { flex: 1; padding: 10px; font-size: 12.5px; }

.file-card {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  margin: 6px 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-decoration: none !important;
  vertical-align: middle;
}
.file-card-open { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 5px 8px; border-radius: var(--radius-sm); text-align: left; }
.file-card-open:hover { background: var(--hover); }
.file-symbol { display: grid; place-items: center; flex: none; width: 20px; height: 20px; color: var(--muted); }
.file-card-name { min-width: 0; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.file-card-name small { display: block; margin-top: 1px; color: var(--faint); font-size: 12px; }
.file-card-download {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--faint);
  text-decoration: none !important;
}
.file-card-download:hover { background: var(--hover); color: var(--text); }

/* 预览 */
.file-preview-content {
  display: grid;
  place-items: center;
  min-height: 140px;
  margin: 10px 0;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.file-preview-image { display: block; max-width: 100%; max-height: 54dvh; object-fit: contain; }
.file-preview-content video { width: 100%; max-height: 54dvh; background: #000; }
.file-preview-content audio { width: calc(100% - 24px); margin: 28px 12px; }
.file-preview-content > .error { padding: 16px; color: var(--danger); font-size: 13px; }
.file-preview-loading { display: flex; align-items: center; gap: 8px; padding: 22px; color: var(--muted); font-size: 12.5px; }

.file-preview-placeholder { display: grid; place-items: center; gap: 8px; padding: 26px 16px; text-align: center; }
.file-preview-placeholder > span { color: var(--muted); font-size: 40px; }
.file-preview-placeholder > strong { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.file-preview-placeholder > small { color: var(--muted); font-size: 11.5px; }

.file-text-wrap { display: block; width: 100%; padding: 0; max-height: 54dvh; overflow: auto; background: var(--bg); }
.file-text-wrap > .file-text {
  padding: 14px 15px;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
  text-align: left;
  color: var(--text-2);
  font-variant-ligatures: none;
}
.file-text-md { padding: 16px 16px 18px; text-align: left; background: var(--bg); }
.file-text-note { padding: 8px 15px 12px; color: var(--muted); font-size: 11.5px; text-align: left; margin: 0; }

.file-preview-path { font-size: 10.5px !important; line-height: 1.6 !important; overflow-wrap: anywhere; }
.file-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.file-preview-actions > a, .file-preview-actions > button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 12.5px;
  text-decoration: none !important;
  min-height: 42px;
}
.file-preview-actions > a.primary { background: var(--solid); color: var(--on-solid); }
.file-preview-actions > a.secondary, .file-preview-actions > button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}

.hydrate-item { min-height: 36px; margin-top: 10px; padding: 7px 12px; font-size: 11.5px; }

/* ---------- 单点提示 ---------- */

.toast.actionable { cursor: pointer; }
.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 1000;
  max-width: min(90vw, 520px);
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  transform: translateX(-50%);
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- 登录 ---------- */

.login-screen { display: grid; place-items: center; height: var(--app-h); padding: 24px; background: var(--bg); }
.login-form { width: 100%; max-width: 320px; text-align: center; }
.brand-icon { display: block; margin: 0 auto 20px; color: var(--text); }
.login-form h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.login-form p { margin: 0 0 24px; color: var(--faint); font-size: 14px; line-height: 1.6; }
.login-form label { display: block; margin-bottom: 6px; color: var(--faint); font-size: 12px; font-weight: 500; text-align: left; }
.login-form input { display: block; width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 16px; letter-spacing: .06em; }
.login-form .primary { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 40px; margin-top: 12px; padding: 0 16px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 500; }
.login-form .error { margin: 12px 0 0; color: var(--danger); font-size: 13px; }
.login-form small { display: block; margin-top: 16px; color: var(--faint); font-size: 12px; line-height: 1.6; }

/* ---------- 微信/QQ 内置浏览器提示 ---------- */

.browser-hint { position: fixed; inset: 0; z-index: 2000; padding: 76px 28px; background: var(--bg); }
.browser-hint h2 { font-size: 22px; font-weight: 600; }
.browser-hint p { color: var(--muted); font-size: 15px; line-height: 1.8; }

/* ---------- 响应式 ---------- */

/* 折叠屏展开 / 中等宽度：两栏等分，右栏不撑破 */
@media (min-width: 701px) and (max-width: 1099px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sidebar { padding-inline: 8px; padding-left: max(8px, env(safe-area-inset-left)); }
  .topbar { padding-inline: 16px; padding-right: max(16px, env(safe-area-inset-right)); }
  .conversation { padding-inline: 16px; padding-right: max(16px, env(safe-area-inset-right)); }
  .composer-area { padding-inline: 14px; padding-right: max(14px, env(safe-area-inset-right)); }
}

@media (horizontal-viewport-segments: 2) {
  .app-shell { grid-template-columns: env(viewport-segment-width 0 0, 1fr) env(viewport-segment-width 1 0, 1fr); justify-content: start; column-gap: 0; }
  .sidebar { position: static !important; transform: none !important; }
  .mobile-only { display: none !important; }
}

/* 折叠屏横屏折成矮窗口（可视高很小）：顶栏和输入区一起收紧，输入框再压到两成高，别把对话挤没 */
@media (max-height: 520px) and (orientation: landscape) {
  .topbar { min-height: 40px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .conversation { padding-top: 8px; padding-bottom: 10px; }
  .composer-area { padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .composer { border-radius: 18px; padding: 4px 6px 4px; }
  #prompt { max-height: min(96px, 22dvh); padding: 3px 4px 4px; }
  .empty-state { margin-top: 6vh; }
}

/* 手机：单栏，侧栏是抽屉 */
@media (max-width: 700px) {
  :root { font-size: 15px; }
  .app-shell { display: block; }
  .main-pane { height: 100%; }
  .mobile-only, .side-icon.mobile-only { display: grid; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(86vw, 330px);
    height: var(--app-h);
    padding-left: max(10px, var(--safe-l));
    transform: translateX(-101%);
    transition: transform .2s cubic-bezier(.32, .72, .28, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 29;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background: rgba(18, 16, 12, .36);
  }

  .topbar { min-height: 48px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); gap: 2px; }
  .topbar .icon-button { width: 36px; height: 36px; flex-basis: 36px; }
  .heading-folder { display: none; }

  .conversation { padding: 14px 16px 22px; }

  .composer-area { padding: 0 max(10px, var(--safe-r)) max(8px, env(safe-area-inset-bottom)) max(10px, var(--safe-l)); }
  .composer { border-radius: 22px; padding: 8px 8px 8px; }
  #prompt { font-size: 16px; max-height: min(140px, 28dvh); } /* 16px 避免 iOS 聚焦时缩放；矮窗口时按可视高收窄 */

  .compact { font-size: 11.5px; }



  .empty-state { margin-top: 14vh; }
  .empty-state h2 { font-size: 21px; }

  .connection-banner { padding: 9px 16px; font-size: 11.5px; }


  .message-content { font-size: 15px; line-height: 1.65; }
  .user-bubble { max-width: 82%; font-size: 15px; }
  .message-tools { opacity: .75; }
  .thread-row { min-height: 40px; font-size: 15px; }
  .side-row { min-height: 40px; font-size: 15px; }
  .group-name { font-size: 13px; }
  .pending-cards { max-height: 50dvh; }

  .sheet {
    width: 100%;
    max-height: 90dvh;
    padding-inline: 10px;
    border-inline: 0;
    border-radius: 20px 20px 0 0;
  }

  .slash-menu { right: 10px; left: 10px; }
  .file-list { max-height: 44dvh; }
  .file-preview-actions > a, .file-preview-actions > button { flex: 1 1 100%; }
}


/* ---------- 深色模式 ---------- */

.file-preview-content video { background: #000; }

/* 用户要求减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 补充：JS 动态生成的容器 ---------- */

.turn-items { display: block; }
.turn-plan:empty, .turn-diff:empty { display: none; }


.ask-body { display: block; }
.ask-options { display: block; }

.elicitation-form { margin: 4px 0 2px; }

/* 预览里的「看排版 / 看原文」切换按钮 */
.file-preview-mode {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
}
.file-preview-mode:hover { background: var(--hover); }

/* 按下反馈：手指按在哪，哪个按钮就轻微暗一下（比全站 :active 更稳） */
button.down { opacity: .65; }
@media (hover: hover) { button.down { opacity: 1; } }

/* ---------- 修正：关着的抽屉不露阴影；上下文圆环；空状态品牌标 ---------- */

@media (max-width: 700px) {
  .sidebar:not(.open) { box-shadow: none; }
}

.context-button {
  --pct: 0;
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(var(--muted) calc(var(--pct) * 1%), var(--line) 0);
}
.context-button::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--composer-bg);
}
.context-button.empty { background: var(--line); }
.context-button.warn { background: conic-gradient(var(--amber) calc(var(--pct) * 1%), var(--line) 0); }
.context-button.full { background: conic-gradient(var(--danger) calc(var(--pct) * 1%), var(--line) 0); }

img.empty-mark {
  display: block;
  width: 52px;
  height: 52px;
  padding: 0;
  margin: 0 auto 20px;
  border-radius: 14px;
  background: none;
}

.search-wrap > svg { color: var(--faint); }

.image-missing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 11.5px;
}
.image-missing .cx-icon { flex: none; opacity: .7; }
.jump-latest, .image-missing { display: inline-flex; align-items: center; gap: 4px; }
.mode-row strong .cx-icon { margin-right: 6px; vertical-align: -2px; }
@media (max-width: 700px) { .message-tools { opacity: .5; } }

/* 下拉箭头：细线 V 形，跟图标线宽一致 */
.chevron { display: inline-flex; align-items: center; gap: 6px; }
.chevron::after {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: .7;
}

/* 面板菜单：左图标 + 文字，对齐成一列 */
.sheet-menu > button { display: flex; align-items: flex-start; gap: 10px; }
.sheet-menu > button > span { flex: 1; min-width: 0; padding-top: 1px; }
.menu-icon { width: 16px; height: 16px; color: var(--muted); margin-top: 2px; }
.sheet-menu > .danger-text .menu-icon { color: var(--danger); }
.menu-divider { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

/* 预览底部按钮：始终一行等分，手机上也不竖着堆 */
.file-preview-actions { flex-wrap: nowrap; }
.file-preview-actions > a, .file-preview-actions > button { flex: 1 1 0 !important; min-width: 0 !important; padding-inline: 8px; white-space: nowrap; }

/* ---------- 发件箱、重试、拖放、文件排序 ---------- */

/* 发送队列：这一轮在跑时排到后面，和桌面输入框的 Ctrl+Enter 一样 */
.queued-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 2px 8px;
}
.queued-bar[hidden] { display: none !important; }
.queued-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 19px;
  color: var(--text);
}
.queued-item .queued-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queued-item .queued-actions { display: flex; gap: 2px; flex: none; }
.queued-item .tool-icon { width: 26px; height: 26px; }
.queued-head { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; padding: 0 4px; }
.queued-head .quiet { padding: 2px 6px; font-size: 11.5px; color: var(--blue); }

.outbox-item .user-bubble { opacity: .72; }
.outbox-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}
.outbox-status .quiet { padding: 4px 8px; font-size: 11.5px; color: var(--blue); }

.turn-records:empty { display: none; }
.turn-error { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.turn-error[hidden] { display: none !important; }
.turn-error > span { flex: 1; min-width: 0; }
.turn-retry { flex: none; min-height: 32px; padding: 0 12px; font-size: 12px; color: var(--text); }

.main-pane.drop-target::after {
  content: '松手添加附件';
  position: absolute;
  inset: 10px;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.file-sort { display: flex; gap: 4px; margin: 0 0 8px; }
.file-sort button {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11.5px;
}
.file-sort button:hover { background: var(--hover); }
.file-sort button.selected { background: var(--surface-2); color: var(--text); font-weight: 550; }

/* ---------- 补齐：新卡片结构用到的零碎部件 ---------- */

.cx-icon { width: var(--icon, 16px); height: var(--icon, 16px); flex: none; stroke: none; }
.ask-expand-hint { display: inline-flex; align-items: center; color: var(--faint); }

/* 选项里未选中/选中的小圆点（只有一个选项时用点代替数字） */
.option-number .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.ask-option.selected .option-number .dot { background: var(--on-solid); }


/* 验证链接 */
.ask-body-link { padding: 0 16px; }
.ask-body-link > a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  font-size: 13px;
}
.ask-body-link > a:hover { background: var(--hover); text-decoration: none; }

/* 表单类补充信息 */
.elicitation-form { display: flex; flex-direction: column; gap: 2px; }
.elicitation-form .schema-field:last-child { margin-bottom: 4px; }

/* 深色：色值与桌面版 dark 主题（surface #181818 / ink #ffffff，对比度 60）实测一致。
   默认跟随系统；设置里选了「深色/浅色」就用 data-theme 固定（和桌面「外观」一样） */
:root[data-theme="dark"] {
    --bg: #181818;
    --side: #171717;
    --surface: #2d2d2d;
    --composer-bg: #363636;
    --surface-2: #222222;
    --code-bg: #282828;
    --hover: rgba(255, 255, 255, .055);
    --hover-strong: rgba(255, 255, 255, .075);
    --text: #e6e6e6;
    --text-2: rgba(255, 255, 255, .82);
    --muted: rgba(255, 255, 255, .71);
    --faint: rgba(255, 255, 255, .498);
    --line: rgba(255, 255, 255, .084);
    --line-strong: rgba(255, 255, 255, .156);
    --solid: #dfdfdf;
    --on-solid: #181818;
    --blue: #339cff;
    --blue-text: #83c3ff;
    --blue-soft: #0d273f;
    --warning: #ff8549;
    --purple: #ad7bf9;
    --danger: #fa423e;
    --danger-soft: rgba(250, 66, 62, .14);
    --green: #40c977;
    --green-soft: rgba(64, 201, 119, .14);
    --diff-del: #fa423e;
    --amber: #ff8549;
    --amber-soft: rgba(255, 133, 73, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .6);
    --elev-composer: inset 0 0 1px 0 rgba(255, 255, 255, .2);
  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #181818;
    --side: #171717;
    --surface: #2d2d2d;
    --composer-bg: #363636;
    --surface-2: #222222;
    --code-bg: #282828;
    --hover: rgba(255, 255, 255, .055);
    --hover-strong: rgba(255, 255, 255, .075);
    --text: #e6e6e6;
    --text-2: rgba(255, 255, 255, .82);
    --muted: rgba(255, 255, 255, .71);
    --faint: rgba(255, 255, 255, .498);
    --line: rgba(255, 255, 255, .084);
    --line-strong: rgba(255, 255, 255, .156);
    --solid: #dfdfdf;
    --on-solid: #181818;
    --blue: #339cff;
    --blue-text: #83c3ff;
    --blue-soft: #0d273f;
    --warning: #ff8549;
    --purple: #ad7bf9;
    --danger: #fa423e;
    --danger-soft: rgba(250, 66, 62, .14);
    --green: #40c977;
    --green-soft: rgba(64, 201, 119, .14);
    --diff-del: #fa423e;
    --amber: #ff8549;
    --amber-soft: rgba(255, 133, 73, .14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .6);
    --elev-composer: inset 0 0 1px 0 rgba(255, 255, 255, .2);
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- 审批卡（桌面版 ApprovalCard：头部 px16 pt16 pb12，命令块 rounded-md，拒绝 + 允许一次▾） ---------- */
.ask-card { background: var(--surface); }
.approval-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 12px 12px 16px;
}
.ask-subtitle { color: var(--faint); font-size: 13px; line-height: 18px; overflow-wrap: anywhere; white-space: pre-wrap; }
.approval-body { display: flex; flex-direction: column; gap: 8px; padding-bottom: 4px; }
.ask-cmd-wrap { padding: 0 12px; }
.ask-cmd-box {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
}
.ask-cmd-box > .ask-command {
  margin: 0;
  padding: 8px;
  max-height: none;
  overflow: auto;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.ask-cmd-more { display: flex; justify-content: flex-end; padding: 0 4px 4px; }

.approval-files { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; padding: 0 16px; }
.approval-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
}
.approval-file:hover, .approval-file.open { background: var(--hover); }
.approval-file-name { display: flex; min-width: 0; }
.approval-file-name .dir { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); }
.approval-file-name .base { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-file-stat { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; }
.approval-file-stat .add { color: var(--green); }
.approval-file-stat .del { color: var(--diff-del); }
.approval-file-diff { margin: 2px 0 6px; max-height: 200px; overflow: auto; border-radius: var(--radius-sm); background: var(--code-bg); font-size: 12px; }

.approval-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 16px;
}
.approval-main { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.approval-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.approval-actions .secondary { border: 1px solid var(--line-strong); background: var(--hover); color: var(--text); }
.approval-actions .secondary:hover { background: var(--hover-strong); }
.approval-actions .primary { background: var(--solid); color: var(--on-solid); border: 0; }
.split-button { position: relative; display: inline-flex; align-items: stretch; }
.split-button .split-main { border-radius: var(--radius-pill) 0 0 var(--radius-pill); padding-right: 10px; }
.split-button .split-more {
  width: 30px;
  padding: 0;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  border-left: 1px solid color-mix(in srgb, var(--on-solid) 22%, transparent) !important;
}
.split-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: min(320px, 86vw);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.split-menu button {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start !important;
  height: auto !important;
  min-height: 36px;
  padding: 8px 10px !important;
  border-radius: var(--radius-sm) !important;
  background: transparent !important;
  color: var(--text) !important;
  font-size: 13.5px !important;
  white-space: normal !important;
  text-align: left;
}
.split-menu button:hover { background: var(--hover) !important; }
.split-menu small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; font-weight: 400; line-height: 1.45; }

/* 窄卡（< 448px，等同桌面 @max-md/approval-card）：按钮竖排拉满，拒绝在上、允许在下 */
@media (max-width: 520px) {
  .approval-actions { flex-direction: column; align-items: stretch; }
  .approval-main { flex-direction: column; align-items: stretch; margin-left: 0; width: 100%; }
  .approval-actions button { height: 36px; width: 100%; }
  .split-button { width: 100%; }
  .split-button .split-main { flex: 1; width: auto; padding-left: 36px; }
  .split-button .split-more { width: 36px; flex: none; }
}

/* ---------- 提问卡细节（桌面 requestInputPanel：头部无分隔线、选项 13px、自由输入行右侧放按钮） ---------- */
.ask-head { border-bottom: 0; padding: 16px 12px 8px 16px; }
.ask-body { gap: 12px; padding: 4px 0 8px; }
.ask-list { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.ask-list > .ask-options { padding: 0; }
.ask-option { min-height: 32px; padding: 6px 8px; }
.option-text { gap: 2px; }
.option-head { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.option-label { font-size: 13px; font-weight: 500; line-height: 18px; }
.option-description { font-size: 13px; line-height: 18px; color: var(--faint); }
.option-number { margin-top: 0; align-self: flex-start; }
.ask-other-row { min-height: 32px; padding: 6px 8px; border-radius: var(--radius); }
.ask-other-row:focus-within { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.ask-other-row.standalone { padding: 6px 8px; }
.ask-other-row input { font-size: 13px; }
.ask-other-row > button,
.ask-actions > button,
.approval-actions button {
  min-height: 0;
  min-width: 0;
}
.ask-other-row > button,
.ask-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 28px;
  padding: 0 10px !important;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}
.ask-other-row > .secondary, .ask-actions > .secondary { border: 1px solid var(--line-strong); background: var(--hover); color: var(--text); }
.ask-other-row > .secondary:hover, .ask-actions > .secondary:hover { background: var(--hover-strong); }
.ask-other-row > .primary, .ask-actions > .primary { border: 1px solid transparent; background: var(--solid); color: var(--on-solid); }
.ask-actions { padding: 0 16px 12px; }
.plan-sheet { max-height: 70dvh; overflow: auto; font-size: 14px; }
@media (pointer: coarse) {
  .ask-option { min-height: 40px; }
  .ask-other-row > button, .ask-actions > button { height: 32px; padding: 0 12px; }
}

/* ---------- 「已询问 N 个问题」记录（桌面 userInputRequest 完成态） ---------- */
.item.ask-record { margin: 10px 0; }
.ask-record-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 2px 0;
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}
.ask-record-label { color: var(--faint); }
.ask-record-count { color: color-mix(in srgb, var(--text) 40%, transparent); }
.ask-record-row:hover .ask-record-label, .ask-record-row:hover .ask-record-count { color: var(--text); }
.ask-record-chev { width: 12px; height: 12px; color: var(--faint); opacity: .7; transition: transform .2s ease; }
.ask-record.open .ask-record-chev { transform: rotate(90deg); opacity: 1; }
.ask-record-list { display: flex; flex-direction: column; gap: 12px; padding: 6px 0 2px; }
.ask-record-qa { display: flex; flex-direction: column; gap: 4px; }
.ask-record-qa .q { color: color-mix(in srgb, var(--text) 60%, transparent); font-size: 14px; white-space: pre-wrap; }
.ask-record-qa .a { color: color-mix(in srgb, var(--text) 30%, transparent); font-size: 14px; white-space: pre-wrap; }


/* 权限胶囊：完全访问 = 桌面同款橙色 + 警告图标 */
#modeButton.danger-mode { color: var(--warning); }
#modeButton.danger-mode:hover { background: color-mix(in srgb, var(--warning) 12%, transparent); }
.model-name { overflow: hidden; text-overflow: ellipsis; }
.model-effort { color: var(--muted); }
.model-effort.strong { color: var(--purple); }

/* 连续同类步骤合成一组 */
.act-group { margin: 0; }
.act-group .act-count { color: var(--faint); font-variant-numeric: tabular-nums; }
.act-group.open > .act-head .act-chev { opacity: 1; transform: rotate(90deg); }
.act-group-body { padding-left: 24px; }
.act-group-body .act-head { min-height: 26px; padding: 3px 0; font-size: 13.5px; }

/* 手机发起的计划模式：同一张「实施此计划？」卡 */
.plan-approval.ask-card { max-height: 52dvh; margin-bottom: 10px; padding: 0; overflow: auto; border-radius: var(--radius-card); background: var(--surface); }

/* 计划卡片：照桌面版（圆角 10px、1px 边框、标题行 40px、正文最高 160px 底部渐隐） */
.item.plan { margin: 12px 0; }
.plan-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  overflow: hidden;
}
.plan-card-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  color: var(--faint);
}
.plan-card-icon { flex: none; display: inline-flex; }
.plan-card-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 400;
}
.plan-card-actions {
  position: relative;
  z-index: 1;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.plan-card.ready:hover .plan-card-actions,
.plan-card.ready:focus-within .plan-card-actions { opacity: 1; }
@media (hover: none) { .plan-card.ready .plan-card-actions { opacity: 1; } }
.plan-card-open {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
.plan-card-body {
  position: relative;
  max-height: 160px;
  padding: 0 16px 12px;
  overflow: hidden;
}
.plan-card-body .message-content { color: var(--text); user-select: none; }
.plan-card-body.clamped::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4rem;
  background: linear-gradient(to bottom, transparent, var(--surface) 85%);
  pointer-events: none;
}

.user-tools { justify-content: flex-end; }
.activity-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.approval-actions .grow { flex: 1 1 auto; }

/* 分段选择（外观：跟随系统 / 浅色 / 深色） */
.segmented { display: inline-flex; flex: none; padding: 2px; border-radius: var(--radius-pill); background: var(--hover); }
.segmented button { height: 26px; padding: 0 10px; border-radius: var(--radius-pill); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.segmented button.selected { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }

.plan-dot { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--line-strong); border-radius: 50%; vertical-align: -1px; }
.plan-list .plan-icon { display: grid; place-items: center; width: 16px; }
.plan-list .completed .plan-icon .cx-icon { color: var(--green); }
.attachment-chip button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border-radius: 50%; color: var(--faint); }
.attachment-chip button:hover { background: var(--hover); color: var(--text); }

/* 模型 / 推理选择：桌面下拉菜单样式的列表，点了立即生效 */
.pick-list { display: flex; flex-direction: column; gap: 1px; }
.pick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 7px 12px 7px 10px;
  border-radius: 10px;
  text-align: left;
}
.pick-row:hover { background: var(--hover); }
.pick-row.selected { background: var(--hover); }
.pick-row strong { display: block; font-size: 14px; font-weight: 500; }
.pick-row small { display: block; margin-top: 1px; color: var(--faint); font-size: 12px; line-height: 1.45; }
.pick-check { width: 12px; height: 12px; color: var(--text); }
.pick-more > summary { padding: 8px 10px; color: var(--faint); font-size: 13px; cursor: pointer; }

/* ---------- iPhone 细节：输入框 ≥16px 防止点进去整页放大；连点不缩放；按钮长按不选字 ---------- */
html { touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sidebar, .thread-list, .conversation, .sheet, .pending-cards, .file-list, .activity-body { overscroll-behavior: contain; }
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
  .ask-other-row input { line-height: 20px; }
}

/* 图片查看：App 内全屏看图，底部「存到手机」 */
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 12px calc(76px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .86);
}
.image-viewer img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); object-fit: contain; }
.image-viewer-bar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.image-viewer-bar button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 14px;
  backdrop-filter: blur(8px);
}
.image-viewer-bar button:disabled { opacity: .5; }
.image-viewer-close { width: 40px; padding: 0 !important; justify-content: center; }
.image-viewer-save { min-width: 112px; }
.user-images a, .message-content img { cursor: zoom-in; }

/* 计划标签：桌面输入框底栏同款——灯泡 + 「计划」，点一下退出；按住/悬停时灯泡换成圆叉 */
.plan-tag { gap: 4px; padding: 0 8px; color: var(--faint); }
.plan-tag .plan-x { display: none; }
.plan-tag:active .plan-bulb, .plan-tag:focus-visible .plan-bulb { display: none; }
.plan-tag:active .plan-x, .plan-tag:focus-visible .plan-x { display: block; }
@media (hover: hover) {
  .plan-tag:hover .plan-bulb { display: none; }
  .plan-tag:hover .plan-x { display: block; }
}

/* 完全访问确认：桌面「要开启完整访问权限吗？」弹窗 */
.full-access-confirm h2 { display: flex; align-items: center; gap: 8px; }
.full-access-confirm h2 .cx-icon { flex: none; }
.full-access-confirm > p { margin: 0 8px 12px; color: var(--muted); font-size: 13px; line-height: 1.55; text-wrap: pretty; }
.full-access-list { margin: 0 8px 12px; padding: 12px 16px; border-radius: 16px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.full-access-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.full-access-item:first-child { padding-top: 0; }
.full-access-item:last-child { padding-bottom: 0; border-bottom: 0; }
.full-access-item .cx-icon { flex: none; }
.full-access-item > div { min-width: 0; }
.full-access-item strong { display: block; font-size: 14px; font-weight: 600; }
.full-access-item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.full-access-confirm .danger-button { display: inline-flex; align-items: center; gap: 6px; }

/* 500-700 之间的窄单栏（外屏放大字号、小窗）：只收留白，不动抽屉逻辑 */
@media (min-width: 501px) and (max-width: 700px) {
  .topbar { padding-left: max(12px, var(--safe-l)); padding-right: max(12px, var(--safe-r)); }
  .conversation { padding: 18px 20px 26px; }
  .composer-area { padding-left: max(14px, var(--safe-l)); padding-right: max(14px, var(--safe-r)); }
  .messages { max-width: 640px; }
}
