/* ── Claude 设计 token（暖米白浅色单主题；改色只动此处，tw-config.js 把它们桥接成语义类）── */
:root {
  --canvas:#F4F3EE; --surface:#FBFAF6; --surface-sunk:#EFEDE4;
  --line:#E3E0D6; --line-soft:#ECEAE1;
  --ink:#1F1E1B; --ink-soft:#54514A; --ink-faint:#73706A;
  /* UI-001：accent 提至 AA 正文对比（白字 5.17 / 字面 4.95）；cta 专供实底白字按钮（深浅一致） */
  --accent:#AE5238; --accent-deep:#8F422C; --accent-bright:#D97757; --accent-wash:#F0E4DD;
  --cta:#AE5238;
  --user-bubble:#ECE8DF; --info:#1B6FB3; --success:#3D8A50; --danger:#BC4334;
  /* warning 加深：字面/surface 4.98（旧 #C77D33 = 3.14） */
  --warning:#9A5F22;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-read: "Source Serif 4", Georgia, Charter, "Songti SC", "Noto Serif SC", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --radius-lg:0.875rem; --radius-md:0.625rem; --radius-sm:0.375rem;
  --shadow-card:0 1px 2px rgba(60,50,40,.05), 0 4px 16px rgba(60,50,40,.06);
  --shadow-pop:0 8px 32px rgba(40,32,24,.16);
  --shadow-lift:0 4px 12px rgba(60,50,40,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas:#121211;
    --surface:#1C1B1A;
    --surface-sunk:#161514;
    --line:#2E2C2A;
    --line-soft:#242221;
    --ink:#EEEEEC;
    --ink-soft:#A3A19D;
    --ink-faint:#7A7874;
    --accent:#D97757;
    --accent-deep:#F0E4DD;
    --accent-bright:#E2886A;
    --accent-wash:#2D231E;
    --cta:#AE5238; /* 深色实底白字仍用深砖橙，勿用提亮的 accent */
    --user-bubble:#282623;
    /* UI-001：深色 danger/info 提亮一档；warning 保持可读（继承浅色过深会掉到 3.3） */
    --danger:#E55D4C;
    --info:#3D8FD4;
    --warning:#D4A04A;
  }
}
/* self-host 开源 serif（SIL OFL）——Claude 回复正文的“书卷阅读感”；中文无字形时由 --font-read 栈回退系统宋体 */
@font-face { font-family:"Source Serif 4"; src:url(/vendor/source-serif-400.woff2) format("woff2"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Source Serif 4"; src:url(/vendor/source-serif-600.woff2) format("woff2"); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:"Source Serif 4"; src:url(/vendor/source-serif-italic.woff2) format("woff2"); font-weight:400; font-style:italic; font-display:swap; }

body { font-family: var(--font-ui); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ── Claude 回复正文：serif 阅读态（区别于其他 AI 聊天 UI 的标志性一笔）── */
.msg-body { font-family: var(--font-read); font-size: 15.5px; line-height: 1.72; color: var(--ink); overflow-wrap: break-word; word-break: break-word; }
.msg-body pre { font-family: var(--font-mono); border: 1px solid var(--line); border-radius: .5rem; padding: .75rem .85rem; overflow-x: auto; font-size: .82rem; line-height: 1.5; background: var(--surface-sunk); margin: .6rem 0; }
.msg-body code:not(pre code) { font-family: var(--font-mono); background: var(--surface-sunk); color: var(--accent-deep); padding: .1rem .35rem; border-radius: .25rem; font-size: .85em; }
.msg-body pre code { padding: 0; }
.msg-body .hljs { background: transparent; color: var(--ink); }  /* 透出 pre 暖底；语法 token 色由 github-light 提供 */
/* Per-code-block copy button — UI-003：pre 顶留白防遮代码；触点 ≥32px */
.code-block-wrap { position: relative; }
.code-block-wrap > pre {
  padding-top: 2rem; /* 给右上角 copy 钮留行，避免压住首行代码 */
}
.code-block-wrap .code-copy-btn {
  position: absolute; top: 0.35rem; right: 0.35rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.15rem;
  min-width: 32px; min-height: 32px;
  padding: 0.35rem 0.5rem;
  border-radius: 0.3rem; font-size: 11px;
  color: var(--ink-faint); background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer; opacity: 0.7;
  transition: opacity 0.15s;
  z-index: 1;
}
/* 热区扩充：按钮本体 32px，::after 再扩一点 */
.code-block-wrap .code-copy-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
}
.code-block-wrap:hover .code-copy-btn { opacity: 1; }
.code-block-wrap .code-copy-btn:hover {
  color: var(--accent-deep); border-color: var(--accent-deep);
}
.msg-body p { margin: .5rem 0; } .msg-body p:first-child { margin-top: 0; } .msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: .5rem 0 .5rem 1.3rem; } .msg-body ul { list-style: disc; } .msg-body ol { list-style: decimal; }
.msg-body li { margin: .2rem 0; }
.msg-body h1, .msg-body h2, .msg-body h3 { font-weight: 600; margin: .9rem 0 .4rem; line-height: 1.3; }
.msg-body h1 { font-size: 1.3em; } .msg-body h2 { font-size: 1.18em; } .msg-body h3 { font-size: 1.05em; }
.msg-body a { color: var(--info); text-decoration: underline; text-underline-offset: 2px; }
.msg-body blockquote { border-left: 3px solid var(--line); padding-left: .8rem; margin: .5rem 0; color: var(--ink-soft); }
.msg-body table { border-collapse: collapse; margin: .5rem 0; font-size: .85em; }
.msg-body td, .msg-body th { border: 1px solid var(--line); padding: .3rem .55rem; }
.msg-body th { background: var(--surface-sunk); font-weight: 600; }
.msg-body hr { border: 0; border-top: 1px solid var(--line); margin: .8rem 0; }

/* 折叠器：去原生三角，光标手型 */
details.thinking > summary, details.toolcard > summary, #cliStatusWrap > summary { cursor: pointer; user-select: none; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
#cliStatusWrap[open] .cli-arrow { transform: rotate(180deg); }
/* 工具卡片：左竖条标记 agent 动作（Claude 风格） */
.toolcard { border-left: 3px solid var(--accent-bright) !important; }
/* 思考块：内心独白——serif 斜体淡色 */
.thinking .t-body { font-family: var(--font-read); font-style: italic; }

.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.safe-top { padding-top: env(safe-area-inset-top); }
/* 弹窗顶部 drag handle */
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto .75rem; }
/* 配置面板下拉关闭热区：扩大把手可点范围，禁浏览器默认手势抢 pointer */
.settings-drag-zone {
  touch-action: none;
  cursor: grab;
  padding-top: 0.35rem;
}
.settings-drag-zone:active,
#settingsSheet.is-dragging .settings-drag-zone {
  cursor: grabbing;
}
#settingsSheet.is-dragging {
  /* 拖动中禁用 CSS transition，跟手；结束时由 JS 清 inline 后恢复 */
  transition: none !important;
  will-change: transform;
}
#settingsSheet.is-dragging .sheet-handle {
  background: var(--accent);
  width: 44px;
}
/* 配置面板打开：锁住背后主页面滚动（#messages 仍是 overflow-y-auto，不锁会把聊天顶穿面板）
   不用 touch-action:none on body——会误伤 fixed 面板内的滑动（部分 Android Chrome）。 */
html.ccm-sheet-open,
body.ccm-sheet-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.ccm-sheet-open #messages {
  overflow: hidden !important;
  overscroll-behavior: none;
}
/* 面板自身内容区允许滚动；overscroll-contain 阻止链式滚动到背后 */
#settingsSheetBody {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 柔和入场动画 + 按钮微反馈（尊重 reduce-motion） */
@media (prefers-reduced-motion: no-preference) {
  #messages > * { animation: msg-in .2s ease both; }
  @keyframes msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  button { transition: background-color .12s ease, transform .08s ease; }
  button:active { transform: scale(.97); }
}
/* 暖色细滚动条 */
#messages::-webkit-scrollbar, #sessionPanel::-webkit-scrollbar { width: 8px; }
#messages::-webkit-scrollbar-thumb, #sessionPanel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
/* 用户消息气泡：sans 覆盖（历史气泡含 .msg-body 也不走 serif；用户消息=sans，仅 Claude 回复=serif） */
.um { font-family: var(--font-ui); font-size: 14px; line-height: 1.55; }

/* 落地页仪表盘高级微动效与精致样式 */
.dashboard-container {
  animation: dash-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes dash-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.premium-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (hover: hover) {
  .premium-card:hover {
    border-color: var(--accent-bright);
    background: var(--surface);
    transform: translateY(-2.5px);
    box-shadow: var(--shadow-lift);
  }
}
.premium-card:active {
  transform: scale(0.975);
  background: var(--surface-sunk);
}
.dash-recent-item {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(60,50,40,.02);
}
@media (hover: hover) {
  .dash-recent-item:hover {
    border-color: var(--accent-bright);
    background: var(--accent-wash);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lift);
  }
}
.dash-recent-item:active {
  transform: scale(0.985);
  background: var(--surface-sunk);
}

/* ── 新版 UI 高级动效与交互样式微调 (Premium UI Enhancements) ── */
.chat-input-pill {
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 0.5rem !important;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.chat-input-pill:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-wash), 0 4px 12px rgba(201,100,66,0.06);
  background-color: var(--surface);
}
.status-pill-chip {
  background-color: var(--surface-sunk);
  border: 1px solid var(--line-soft);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  white-space: nowrap;
}
/* 并入输入框底栏后的紧凑 chip（模型/权限/思考） */
.status-pill-chip.toolbar-pill {
  min-height: 28px;
  height: 28px;
  padding: 0 0.5rem;
  font-size: 10.5px;
  flex-shrink: 0;
  box-shadow: none;
  max-width: 100%;
}
.status-pill-chip.toolbar-pill svg {
  width: 0.85rem;
  height: 0.85rem;
  opacity: 0.75;
}
/* 模型名过长：ellipsis 截断，完整名仍在 title；不整行缩放、不挤钉死动作区 */
#pillModelText,
#pillPermText,
#pillEffortText {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  min-width: 0;
}
#pillModelText {
  /* 约 8 字宽 + 窄屏 vw 上限：长名截断，齿轮永远在右侧可见 */
  max-width: min(7.5rem, 36vw);
}
#pillPermText {
  max-width: min(5rem, 28vw);
}
#pillEffortText {
  max-width: min(4.5rem, 24vw);
}
/* 底栏工具条：chip 区可滚，动作区不缩 */
.composer-toolbar {
  min-width: 0;
}
.composer-chips {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 12px), transparent 100%);
}
.composer-actions {
  position: relative;
  z-index: 1;
  background: var(--surface);
}
/* UX-019：空态档位变更时胶囊短暂高亮（替代消息区系统条） */
@keyframes status-pill-flash {
  0%, 100% { box-shadow: 0 1px 2px rgba(0,0,0,0.02); background-color: var(--surface-sunk); border-color: var(--line-soft); }
  35% { box-shadow: 0 0 0 2px var(--accent); background-color: var(--accent-wash); border-color: var(--accent); }
}
.status-pill-chip.status-pill-flash {
  animation: status-pill-flash 0.7s ease;
}
.status-pill-chip:active {
  transform: scale(0.95);
  background-color: var(--line-soft);
}
.top-context-pill {
  min-height: 32px;
  padding: 0.2rem 0.75rem;
  background: var(--surface-sunk);
  border: 1px solid var(--line-soft);
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  max-width: 90%;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer !important;
  pointer-events: auto !important;
}
/* 顶栏左侧延迟胶囊：比中间 project pill 更小一号，同 sunk/软边/圆角语汇；
   不做成按钮（无 hover scale），避免与工作区入口抢主操作。色阶由 JS 叠 text-*。 */
.conn-rtt-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 0.45rem;
  border-radius: 9999px;
  background: var(--surface-sunk);
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 7.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn-rtt-chip.hidden {
  display: none;
}
@media (hover: hover) {
  .top-context-pill:hover {
    background: var(--line-soft);
    transform: scale(0.98);
  }
}
.top-context-pill:active {
  transform: scale(0.95);
}
.msg-frame {
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}
.empty-start {
  min-height: 0;
}
.empty-start-card {
  min-height: 42vh;
}
.empty-project-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--ink-soft);
  font-weight: 650;
  letter-spacing: -.01em;
}
.msg-action-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.msg-action-bar:hover, .msg-action-bar:focus-within {
  opacity: 1;
}
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 11px;
  color: var(--ink-faint);
  border: 1px solid transparent;
  transition: all 0.12s;
  cursor: pointer;
  background: transparent;
}
.msg-action-btn:hover {
  color: var(--accent-deep);
  background-color: var(--surface-sunk);
  border-color: var(--line-soft);
}
.msg-action-btn:active {
  transform: scale(0.95);
}
/* 隐藏横向滚动条 */
.scrollbar-none::-webkit-scrollbar { display: none; }
.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }

/* Ensure #btnPush with .hidden class is always completely hidden, even overriding mobile display overrides */
#btnPush.hidden {
  display: none !important;
}

@media (max-width: 767px) {
  header {
    padding: max(1.25rem, env(safe-area-inset-top)) 1rem 0.5rem !important;
    background: var(--canvas) !important;
    border-bottom: 1px solid var(--line-soft) !important;
    gap: 0.5rem;
  }
  #btnSessions {
    width: 40px !important;
    height: 40px !important;
    border-radius: 0.75rem !important;
    background: var(--surface) !important;
    border: 1px solid var(--line-soft) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  }
  #connDot {
    /* Connection dot positioning is self-contained in its button wrapper */
  }
  #headerActions {
    display: flex !important;
  }

  #messages {
    padding: 1rem 1rem 1.5rem !important;
    max-width: 640px; /* Comfortable expansive column width */
    width: 100%;
    margin: 0 auto;
  }
  #messages.empty-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }
  .empty-start-card {
    min-height: 50vh;
    padding-bottom: 4vh;
  }
  footer {
    padding: 0 1rem max(1rem, env(safe-area-inset-bottom)) !important;
    background: transparent !important;
  }
  footer > .max-w-2xl {
    max-width: 640px !important;
  }
  #statusPillsRow {
    display: none !important; /* 已并入输入框底栏，保留选择器防旧缓存命中 */
  }
  .status-pill-chip {
    min-height: 28px;
    padding: 0 0.5rem;
    font-size: 10.5px;
    background: var(--surface-sunk);
    border: 1px solid var(--line-soft);
    box-shadow: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
  }
  .status-pill-chip:active {
    background: var(--line);
    transform: scale(0.95);
  }
  .status-pill-chip svg {
    width: 0.85rem;
    height: 0.85rem;
    opacity: 0.7;
  }
  #pillModelText {
    max-width: min(6.5rem, 32vw); /* 窄屏：截断模型名，动作区（齿轮/发送）钉死不挤 */
  }
  #pillPermText {
    max-width: min(4.5rem, 24vw);
  }
  #pillEffortText {
    max-width: min(4rem, 20vw);
  }
  .chat-input-pill {
    min-height: auto !important;
    border-radius: 1.25rem !important;
    box-shadow: var(--shadow-card);
    margin-left: 0 !important; /* Perfect symmetry */
    position: relative;
    width: 100%;
    padding: 0.5rem !important;
  }
  #btnAttach {
    position: relative !important;
    transform: none !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 0.5rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--ink-soft) !important;
  }
  #btnAttach:active {
    transform: scale(0.92) !important;
  }
  #input {
    min-height: 32px !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 16px !important;
  }
  #btnSettings,
  #btnPush {
    display: flex !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 0.5rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--ink-soft) !important;
  }
  #btnSend,
  #btnStop {
    width: 32px !important;
    height: 32px !important;
  }
}

/* ── 桌面端响应式栅格布局 (Desktop Responsive Grid Layout) ── */
@media (min-width: 1024px) {
  body {
    display: grid !important;
    grid-template-columns: 300px 1fr !important;
    grid-template-rows: auto 1fr auto !important;
    height: 100vh !important;
    overflow: hidden !important;
  }

  /* 1. 侧边栏常驻左侧 (Dock Sidebar to the Left) */
  #leftSidebar {
    grid-column: 1 !important;
    grid-row: 1 / -1 !important;
    position: relative !important;
    transform: none !important;
    width: 300px !important;
    max-width: 300px !important;
    height: 100vh !important;
    border-right: 1px solid var(--line) !important;
    box-shadow: none !important;
    background-color: var(--surface) !important;
    z-index: 10 !important;
    transition: none !important;
  }

  /* 2. 主聊天内容分布在右侧 (Main Column) */
  header {
    grid-column: 2 !important;
    grid-row: 1 !important;
    border-bottom: 1px solid var(--line) !important;
    z-index: 5 !important;
  }

  #messages {
    grid-column: 2 !important;
    grid-row: 2 !important;
    height: 100% !important;
    overflow-y: auto !important;
  }

  footer {
    grid-column: 2 !important;
    grid-row: 3 !important;
    z-index: 5 !important;
  }

  /* 3. 隐藏不必要的移动端交互组件 (Hide mobile-only elements) */
  #sidebarScrim {
    display: none !important;
  }
  #sidebarClose {
    display: none !important;
  }

  /* 4. 侧边栏折叠支持 (Sidebar Collapsing Support) */
  body.sidebar-collapsed {
    grid-template-columns: 0px 1fr !important;
  }
  body.sidebar-collapsed #leftSidebar {
    display: none !important;
  }
}

/* ── 底栏弹层的统一滑入滑出过渡 (替代 hidden 硬切) ── */
#permModal, #questionModal, #consoleModal, #confirmModal {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease, visibility .25s ease;
  }
  #permModal > div, #questionModal > div, #consoleModal > div, #confirmModal > div {
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #permModal.sheet-open, #questionModal.sheet-open, #consoleModal.sheet-open, #confirmModal.sheet-open {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
  }
  #permModal.sheet-open > div, #questionModal.sheet-open > div, #consoleModal.sheet-open > div, #confirmModal.sheet-open > div {
    transform: translateY(0);
  }
  /* UX-003：审批 sheet 弹出后短暂防误触（过渡期按钮不可点） */
  #permModal.sheet-arming button {
    pointer-events: none;
  }

  /* ── 流内 live 活动行（busy 时挂在 #messages 末尾，不进 history/cache）── */
  #streamLiveStatus {
    color: var(--activity);
  }
  #btnSend[data-mode="stop"] {
    background: var(--activity);
    color: var(--surface);
    opacity: 1;
    cursor: pointer;
  }
  #btnSend[data-mode="stop"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }
  #btnSend[data-mode="stop"] .btn-send-stop-icon {
    display: block;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 0.12rem;
    background: currentColor;
  }

  /* ── 44px 物理触控热区扩充 ── */
  .chat-input-pill button {
    position: relative;
  }
  .chat-input-pill button::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
  }

  /* ── 规则动画选中过渡 ── */
  .perm-tile {
    transition: all 0.15s ease;
  }

  /* ── 侧边栏工作区与会话高级动效 ── */
  .subtree-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  }
  .subtree-container.expanded {
    max-height: 1200px; /* 容纳多会话 */
    opacity: 1;
  }
  .dir-arrow {
    display: inline-block;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .dir-arrow.rotated {
    transform: rotate(90deg);
  }
  /* 侧滑动画及手势优化 */
  .row-content {
    touch-action: pan-y; /* 仅允许纵向滚动，防止横向滑动与页面滚动冲突 */
  }
  .row-content.swiping {
    transition: none !important; /* 拖拽中禁用过渡，紧贴指尖 */
  }
  /* 骨架屏脉冲动画 */
  .skeleton-shimmer {
    background: linear-gradient(90deg, var(--surface-sunk) 25%, var(--line-soft) 50%, var(--surface-sunk) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer-pulse 1.5s infinite ease-in-out;
  }
  @keyframes skeleton-shimmer-pulse {
    0% { background-position: 150% 0; }
    100% { background-position: -150% 0; }
  }

  /* ── 尊重用户减弱动效偏好 ── */
  @media (prefers-reduced-motion: reduce) {
    #permModal, #questionModal, #consoleModal,
    #permModal > div, #questionModal > div, #consoleModal > div,
    #leftSidebar, #settingsSheet {
      transition: none !important;
    }
    #activityBanner .animate-spin {
      animation: none !important;
    }
    .skeleton-shimmer {
      animation: none !important;
    }
  }

/* UI-004：通用 44px 热区扩充 */
.hit-44 { position: relative; }
.hit-44::after {
  content: '';
  position: absolute;
  inset: -8px;
}
.msg-action-btn {
  min-height: 32px;
  min-width: 32px;
  position: relative;
}
.msg-action-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
}

/* UI-010 回退：运行态恢复品牌 accent（用户偏好熟悉的红橙；与 CTA 同色是已知权衡） */
:root {
  --activity: var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root {
    --activity: var(--accent);
  }
}
#activityBanner,
#streamLiveStatus {
  color: var(--activity);
  border-color: color-mix(in srgb, var(--activity) 40%, transparent);
}
.toolcard { border-left-color: var(--activity) !important; }

/* UX-016：思考进行中 shimmer */
@keyframes thinking-shimmer {
  0% { opacity: 0.55; }
  50% { opacity: 1; }
  100% { opacity: 0.55; }
}
details.thinking.thinking-live > summary {
  animation: thinking-shimmer 1.4s ease-in-out infinite;
}
details.thinking.thinking-live > summary::before {
  content: '思考中 · ';
}

/* 驾驶态：底栏模型/权限/思考 chip 保持可见（只读冻结由 JS 拦截）；
   驾驶提示仅靠上方 #mirrorBanner，不再隐藏设置 chip、不再注入「终端驾驶中」合并胶囊。 */

/* UI-007：状态 SVG 图标 */
.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}
.status-icon .status-svg,
.t-status .status-svg {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
#sessionsDot.status-icon {
  font-size: 0; /* 隐藏残留文本，只留 SVG */
  min-width: 16px;
  min-height: 16px;
}
#sessionsDot.status-icon .status-svg {
  width: 12px;
  height: 12px;
}
.dir-badge.status-icon .status-svg {
  width: 13px;
  height: 13px;
}
