/* 烽火台 — 组件样式（变量来自 design-tokens.css） */

/* 兼容别名：组件中用短名，tokens 中用长名 */
:root {
  --color-d: var(--color-role-d);
  --color-a: var(--color-role-a);
  --color-b: var(--color-role-b);
  --color-c: var(--color-role-c);
  --border: var(--border-primary);
  --accent: var(--color-primary);
  --error: var(--color-error);
  --success: var(--color-success);
  --warning: var(--color-warning);
  --text-muted: var(--text-tertiary);
  --mode-yolo: var(--color-mode-yolo);
  --mode-accept: var(--color-mode-accept);
  --mode-default: var(--color-mode-default);
  --mode-plan: var(--color-mode-plan);
  --radius: var(--radius-lg);
}

/* 防 iOS Safari 输入框聚焦时页面缩放 */
input, textarea, select, button {
  font-size: 16px;
  touch-action: manipulation;
}

/* ===== 全局布局 ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  max-width: 100vw;
  overflow: hidden;
}

.desktop-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 12px 0;
  background: var(--bg-secondary);
  border-bottom: none;
  flex-shrink: 0;
  gap: 8px;
  position: relative;
  z-index: 2;
}

/* 顶栏底部渐变遮罩（内容渐隐而非硬裁） */
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -20px;
  height: 20px;
  background: linear-gradient(to bottom, var(--bg-secondary) 0%, rgba(240,237,232,0.6) 40%, transparent 100%);
  pointer-events: none;
}

.topbar .session-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.topbar .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* SDK 状态 badge */
.sdk-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.sdk-badge.active { background: rgba(26, 127, 55, 0.12); color: var(--color-success); }
.sdk-badge.released { background: rgba(155, 149, 144, 0.15); color: var(--text-muted); }
.sdk-badge i { font-size: 12px; }

.topbar .session-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-btn {
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.topbar-btn:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.topbar-btn:not(:active) { transition: background var(--duration-quick) var(--ease-out); }
#sidebar-new, #btn-new { display: none; } /* tmux 桥接模式下不需要新建会话 */
.action-sheet-item[data-action="attach"] { display: none; } /* tmux 模式下图片上传不可用 */

/* ===== 会话详情面板 ===== */
.session-detail-panel {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  overflow: hidden;
  max-height: 300px;
  transition: max-height var(--duration-quick) var(--ease-out), opacity var(--duration-quick) var(--ease-out), padding var(--duration-quick) var(--ease-out);
  flex-shrink: 0;
}
.session-detail-panel.hidden {
  max-height: 0;
  padding: 0 16px;
  border: none;
  opacity: 0;
  pointer-events: none;
}
.sdp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}
.sdp-label { color: var(--text-muted); }
.sdp-value { color: var(--text-primary); display: flex; align-items: center; gap: 4px; }
.sdp-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.sdp-role-dot, .sdp-mode-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.session-indicator { cursor: pointer; }

/* 模型选择器（详情面板内） */
.model-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  margin-right: 4px;
  transition: background var(--duration-quick) var(--ease-out), color var(--duration-quick) var(--ease-out), border-color var(--duration-quick) var(--ease-out);
}

.model-chip.active {
  background: var(--chip-color, var(--accent));
  color: #fff;
  border-color: var(--chip-color, var(--accent));
}

.model-chip:active { opacity: 0.8; }

/* 网络质量指示器 */
.conn-quality {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

.cq-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.cq-text {
  font-variant-numeric: tabular-nums;
}

/* 批量选择模式 */
.session-chip.batch-selected,
.sidebar-item.batch-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.batch-checkbox {
  font-size: 16px;
  flex-shrink: 0;
  color: var(--accent);
}

.batch-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0));
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 201;
}

.batch-toolbar.hidden { display: none; }

.batch-count {
  flex: 1;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.batch-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
}

.batch-btn:active { background: var(--bg-hover); }
.batch-delete { color: var(--error); border-color: rgba(248,81,73,0.3); }

/* 多设备连接数 */
.device-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.device-icon { font-size: 11px; }

/* ===== 聊天区 ===== */
.chat-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /* padding-bottom 给 fixed 的输入区+Tab栏让空间（input-area 实际 ~54px + 间距） */
  padding: 12px 16px calc(var(--input-min-height) + var(--nav-height) + env(safe-area-inset-bottom, 0px) + 40px);
  /* 不用 scroll-behavior:smooth — 流式消息时平滑动画目标过期导致滚不到底 */
  -webkit-overflow-scrolling: touch;
}

/* 上下文清除分隔线 */
.context-divider {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; margin: 8px 0;
}
.context-divider::before, .context-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}
.context-divider span {
  font-size: 12px; color: var(--text-tertiary);
  white-space: nowrap;
}

/* Typing indicator 火苗 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}
.typing-flame {
  width: 12px;
  height: 18px;
  background: var(--color-primary, #C17F4A);
  border-radius: 50% 0 50% 50%;
  transform: rotate(-45deg);
  animation: flicker 1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes flicker {
  0%, 100% { transform: rotate(-45deg) scaleY(1) scaleX(1); opacity: 1; }
  25% { transform: rotate(-45deg) scaleY(1.15) scaleX(0.9); opacity: 0.85; }
  50% { transform: rotate(-45deg) scaleY(0.9) scaleX(1.1); opacity: 1; }
  75% { transform: rotate(-45deg) scaleY(1.1) scaleX(0.95); opacity: 0.9; }
}
.typing-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* 下拉刷新 */
.pull-refresh {
  text-align: center;
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 13px;
  display: none;
}

.pull-refresh.visible { display: block; }

.pull-refresh .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--spinner-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 消息气泡 */
.message {
  margin-bottom: 2px;
  max-width: 100%;
  position: relative;
  overflow: visible;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* 换人时加间距 */
.message.user + .message.assistant,
.message.assistant + .message.user { margin-top: 12px; }
/* 代码块内允许选中复制 */
.message pre, .message code {
  -webkit-user-select: text;
  user-select: text;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.user .msg-content {
  background: var(--bg-bubble-user);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 8px 12px;
  max-width: 70%;
  font-size: 17px;
  line-height: 1.4;
}

.message.assistant .msg-content {
  background: var(--bg-bubble-assistant);
  border-radius: 18px 18px 18px 4px;
  padding: 8px 12px;
  max-width: 70%;
  font-size: 17px;
  line-height: 1.4;
}

/* ===== Claude 暖光主题组件覆盖 ===== */

/* ===== Claude APP 风格覆盖（原 [data-theme="claude"]，现为默认）===== */

/* 用户气泡：暖米色圆角 */
.message.user .msg-content {
  background: var(--bg-bubble-user);
  color: var(--text-primary);
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 20px 20px 6px 20px;
}

/* AI 消息：无气泡，和页面融合（Claude APP 风格） */
.message.assistant .msg-content {
  background: transparent;
  border-radius: 0;
  padding: 4px 0;
  max-width: 100%;
}

/* 消息正文：16px + 行高 1.65 */
.message .msg-content {
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.01em;
}

/* 消息间距：同角色 8px，换角色 32px */
.message + .message { margin-top: 8px; }
.message.user + .message.assistant,
.message.assistant + .message.user { margin-top: 32px; }

/* Tab 指示器：赤陶下划线 */
.nav-tab.active { color: var(--color-primary); }
.nav-tab.active .nav-icon { filter: none; }
.nav-tab.active::after { background: var(--color-primary); height: 2px; }

/* 卡片：去毛玻璃，薄边框 */
.member-card, .team-card {
  background: var(--bg-tertiary);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-secondary);
}

/* 头像 v3：暖色渐变 + 白色 Phosphor 图标 */
.conv-avatar, .member-avatar, .detail-avatar-lg, .profile-avatar {
  border-radius: 50%; box-shadow: none; color: #fff;
}
.conv-avatar i { font-size: 26px; }
.member-avatar i { font-size: 28px; }
.detail-avatar-lg i { font-size: 42px; }
.profile-avatar i { font-size: 28px; }

/* 工具卡片：透明无框 */
.tool-card {
  border-radius: 12px;
  border: none;
  background: transparent;
}

/* 发送按钮：赤陶 */
.send-btn:not(:disabled) { background: #AE5630; }

/* 输入框：Claude APP 风格 — 白底 + 圆角 24px + 轻影 */
.input-wrapper {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
}
.input-wrapper:focus-within {
  background: var(--bg-tertiary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(174, 86, 48, 0.12);
}
#msg-input { padding: 12px 16px; font-size: 16px; line-height: 1.5; }

/* 全局衬线体 */
#app { font-family: var(--font-serif); }
code, pre, .mono { font-family: var(--font-mono); }

/* 标题 */
.topbar-title, .view-title { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.nav-label { font-family: var(--font-serif); font-size: 10px; letter-spacing: 0.02em; }
.conv-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.conv-avatar, .member-avatar, .detail-avatar-lg { font-family: var(--font-serif); }

/* 降饱和 */
.empty-feature-dot { background: var(--text-secondary) !important; }
.settings-row-icon-wrap { filter: saturate(0.4) brightness(0.9); }
.feed-card-tag, .kanban-col-count, .kanban-card-pri { filter: saturate(0.5); }
.role-chip.team-card-role { filter: grayscale(0.6) brightness(0.85) !important; }

/* 链接赤陶色 */
.msg-content a, .tool-card-name { color: var(--color-primary-text, #C4724C); }

/* 消息左滑回复 */
.message-swipe-wrapper {
  position: relative;
  overflow: hidden;
}

.message-swipe-wrapper .message {
  transition: transform var(--duration-quick) var(--ease-out);
}

.swipe-reply-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 20px;
  opacity: 0;
  transition: opacity var(--duration-quick) var(--ease-out);
}

.swipe-reply-btn.visible { opacity: 1; }

/* 输入状态指示 — fixed 浮在输入区上方，不影响布局 */
/* typing indicator 已移除，改用 textarea placeholder */

.typing-indicator.visible { display: block; }

.typing-dots {
  display: inline-block;
}

.typing-dots span {
  animation: typing-bounce 1.4s infinite;
  display: inline-block;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* 消息时间戳 */
.msg-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.message.assistant .msg-time { text-align: left; }

/* Markdown 渲染 */
.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 600; }
.msg-content em { font-style: italic; color: var(--text-secondary); }
.msg-content ul, .msg-content ol { padding-left: 20px; margin-bottom: 8px; }
.msg-content li { margin-bottom: 4px; }
.msg-content a { color: var(--accent); text-decoration: none; }
.msg-content a:hover { text-decoration: underline; }

.msg-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}

.msg-content h1, .msg-content h2, .msg-content h3 {
  margin: 12px 0 6px;
  font-weight: 600;
}
.msg-content h1 { font-size: 20px; }
.msg-content h2 { font-size: 18px; }
.msg-content h3 { font-size: 16px; }

/* Markdown 表格 */
.msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}
.msg-content thead { border-bottom: 2px solid var(--border-primary); }
.msg-content th, .msg-content td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-secondary);
  white-space: nowrap;
}
.msg-content th { font-weight: 600; color: var(--text-secondary); font-size: 13px; }
.msg-content tr:last-child td { border-bottom: none; }

/* 行内代码 */
.msg-content code:not(pre code) {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

/* 代码块 */
.msg-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
}

.msg-content pre code {
  font-family: var(--font-mono);
  font-size: 14px;
}

/* 代码块容器 + 复制按钮 */
.code-block-wrapper {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-quick) var(--ease-out), background var(--duration-quick) var(--ease-out);
  z-index: 1;
  line-height: 1.4;
}

.code-block-wrapper:hover .code-copy-btn,
.code-collapse-body:hover .code-copy-btn,
.code-copy-btn:focus {
  opacity: 1;
}

/* 触控设备始终显示 */
@media (hover: none) {
  .code-copy-btn { opacity: 0.7; }
}

.code-copy-btn:active { background: var(--bg-hover); }
.code-copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* 轻量语法着色（流式期间，无 hljs）*/
pre code .kw { color: var(--syntax-keyword, #cf222e); }
pre code .st { color: var(--syntax-string, #0a3069); }
pre code .cm { color: var(--syntax-comment, #8B7355); }

/* 代码块折叠（max-height 动画） */
.code-collapse {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  overflow: hidden;
}

.code-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
  user-select: none;
  -webkit-user-select: none;
  min-height: 44px;
}

.code-collapse-header:active { background: var(--bg-hover); }

.code-collapse-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.code-collapse-lang {
  color: var(--accent);
  font-weight: 600;
}

.code-collapse-count {
  color: var(--text-muted);
  font-size: 12px;
}

.code-collapse-body {
  max-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  position: relative;
}

.code-collapse.open .code-collapse-body {
  max-height: none;
  overflow-y: auto;
}

.code-collapse-preview {
  margin: 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  opacity: 0.7;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.code-collapse.open .code-collapse-preview { display: none; }

.code-collapse-arrow {
  transition: transform var(--duration-slow) var(--ease-default);
  font-size: 12px;
  flex-shrink: 0;
}

.code-collapse.open .code-collapse-arrow { transform: rotate(90deg); }

/* 工具调用卡片 */
/* ===== 工具调用卡片 ===== */
.tool-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 8px 0;
  overflow: hidden;
  transition: border-color var(--duration-normal) var(--ease-default);
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 36px;
}
.tool-card-header:active { background: var(--bg-hover); }

.tool-card-icon { font-size: 14px; flex-shrink: 0; color: var(--text-secondary); width: 16px; text-align: center; }
.tool-card-name {
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.tool-card-timer {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 24px;
  font-variant-numeric: tabular-nums;
}
.tool-card-timer.done { color: var(--text-tertiary); }
.tool-card-summary {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.tool-card-body {
  display: none;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border);
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tool-card-body pre {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  -webkit-user-select: text;
  user-select: text;
}

.tool-input-section { border-bottom: 1px solid var(--border-primary); padding-bottom: 8px; margin-bottom: 8px; }
.tool-input-code { background: rgba(0,0,0,0.03); border-radius: 6px; padding: 6px 8px; }
.tool-input-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; padding: 4px 0; }
.tool-card.open .tool-card-body { display: block; }
.tool-card.open .tool-card-arrow { transform: rotate(90deg); }

.tool-card-arrow {
  transition: transform var(--duration-normal) var(--ease-out);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tool-duration {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.tool-waiting {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* 工具执行 spinner */
.tool-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--spinner-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ===== Thinking 块 ===== */
.thinking-block {
  border-left: 3px solid var(--color-info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(59, 130, 246, 0.05);
  overflow: hidden;
}
.thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}
.thinking-header:active { opacity: 0.7; }
.thinking-icon { font-size: 14px; }
.thinking-label { flex: 1; font-style: italic; }
/* 超过 3s 深度思考省略号动画（Safari 兼容：用 width clip 而非 content 动画） */
.thinking-label.thinking-long::after {
  content: '...';
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots-width 1.5s steps(4, end) infinite;
}
@keyframes dots-width {
  0% { width: 0; }
  100% { width: 1.2em; }
}
.thinking-arrow {
  font-size: 10px;
  transition: transform var(--duration-normal) var(--ease-out);
}
.thinking-block.collapsed .thinking-arrow { transform: rotate(-90deg); }
.thinking-content {
  padding: 0 10px 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.75;
}
.thinking-block.collapsed .thinking-content {
  display: none;
}

/* ===== 错误卡片 ===== */
.error-card {
  background: rgba(248, 81, 73, 0.08);
  border: 1px solid rgba(248, 81, 73, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 8px 0;
  color: var(--error);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.error-code {
  display: inline-block;
  background: rgba(248, 81, 73, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.error-retry-btn {
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: 4px;
  background: none;
  color: var(--error);
  font-size: 12px;
  cursor: pointer;
}
.error-retry-btn:active { background: rgba(248, 81, 73, 0.1); }

/* Rate limit 倒计时进度条 */
.rate-limit-card {
  background: var(--color-rate-limit-bg, rgba(255,165,0,0.08));
  border: 1px solid var(--color-rate-limit-border, rgba(255,165,0,0.25));
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 8px 0;
  color: var(--color-rate-limit, #ffa500);
  font-size: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rate-limit-icon { font-size: 16px; }
.rate-limit-text { flex: 1; min-width: 0; }
.rate-limit-countdown { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

.rate-limit-bar {
  width: 100%;
  height: 4px;
  background: var(--color-rate-limit-bar-bg, rgba(255,165,0,0.15));
  border-radius: 2px;
  overflow: hidden;
}

.rate-limit-fill {
  height: 100%;
  width: 0;
  background: var(--color-rate-limit, #ffa500);
  border-radius: 2px;
  transition: width 1s linear;
  will-change: width;
}

/* 上下文满提示 */
.context-full-card { border-left: 3px solid var(--color-warning); }
.context-compact-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.context-compact-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 离线模式提示卡片 */
.offline-card { text-align: center; padding: 0; margin: 12px 0; }
.offline-card-inner {
  background: var(--bg-tertiary); border-radius: 12px; padding: 16px;
  border: 1px dashed var(--border);
}
.offline-card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.offline-card-detail { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.offline-card-hint { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }
.offline-action-btn {
  padding: 6px 16px; border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: transparent; color: var(--accent); font-size: 13px; cursor: pointer;
}
.offline-action-btn:active { background: var(--accent); color: #fff; }

/* AskUserQuestion 按钮组 */
.ask-user-card {
  border-left: 3px solid var(--color-info, #3B82F6);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  max-width: 90%;
}
.ask-user-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 13px; color: var(--text-secondary);
}
.ask-user-header-icon { font-size: 16px; color: var(--color-info, #3B82F6); }
.ask-user-header-title { flex: 1; font-weight: 500; }
.ask-user-timer {
  font-size: 11px; font-family: var(--font-mono);
  font-variant-numeric: tabular-nums; color: var(--text-tertiary);
}
.ask-user-timer.warning { color: var(--color-warning, #FF9500); }
.ask-user-question {
  font-size: 15px; font-weight: 500; color: var(--text-primary);
  padding: 12px 14px 8px; line-height: 1.5;
}
.ask-user-options {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 14px 8px;
}
.ask-user-btn {
  padding: 8px 16px; border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm); background: var(--bg-primary);
  color: var(--text-primary); font-size: 14px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex: 1 1 auto; min-width: 80px; max-width: 100%; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.ask-user-btn.long-option { flex-basis: 100%; text-align: left; }
.ask-user-btn:active { background: var(--bg-pressed, rgba(0,0,0,0.05)); }
.ask-user-btn.selected { background: var(--color-info, #3B82F6); color: #fff; border-color: var(--color-info, #3B82F6); }
.ask-user-btn:disabled { opacity: 0.5; cursor: default; }
.ask-user-input { display: flex; gap: 6px; padding: 0 14px 10px; }
.ask-user-text {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm); background: var(--bg-primary);
  color: var(--text-primary); font-size: 14px;
}
.ask-user-send {
  padding: 8px 12px; border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; cursor: pointer; font-size: 14px;
}
.ask-user-send:disabled { opacity: 0.5; }
.ask-user-skip {
  display: block; width: calc(100% - 28px); margin: 0 14px 12px; padding: 8px;
  border: 1px dashed var(--border-primary); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-tertiary); font-size: 13px;
  cursor: pointer; text-align: center;
}
.ask-user-skip:active { background: var(--bg-pressed, rgba(0,0,0,0.05)); }
.ask-user-skip:disabled { opacity: 0.5; cursor: default; }

/* Streaming 光标 */
/* Claude 风格星芒旋转动画（streaming 时） */
.streaming-spark {
  display: inline-block;
  color: var(--spinner-color);
  font-size: 18px;
  animation: spark-rotate 1.5s linear infinite;
  vertical-align: middle;
  margin-left: 2px;
}
@keyframes spark-rotate {
  0% { transform: rotate(0deg); opacity: 0.7; }
  50% { opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0.7; }
}

/* ===== 跳到底部按钮 ===== */
.scroll-bottom-btn {
  position: fixed;
  right: 16px;
  bottom: calc(var(--nav-height) + var(--input-min-height) + 80px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.scroll-bottom-btn.visible { display: flex; }
.scroll-bottom-btn:active { background: var(--bg-hover); }
/* U04: 新消息到达时药丸形高亮 */
.scroll-bottom-btn.has-new {
  width: auto;
  border-radius: 20px;
  padding: 0 14px;
  gap: 4px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* ===== 快捷回复芯片 ===== */
.chips-area {
  display: none;
  padding: 8px 12px;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: calc(var(--nav-height) + var(--input-min-height) + 16px);
  left: 0;
  right: 0;
  z-index: 101;
}

.chips-area::-webkit-scrollbar { display: none; }
.chips-area.visible { display: flex; }

.chip {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-quick) var(--ease-out);
}

.chip:active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* ===== @文件引用面板 ===== */
.file-ref-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.file-ref-panel.hidden { display: none; }

.file-ref-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.file-ref-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-mono);
  outline: none;
}

.file-ref-input:focus { border-color: var(--accent); }

.file-ref-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.file-ref-results {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  overscroll-behavior: contain;
}

.file-ref-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-mono);
  cursor: pointer;
  text-align: left;
  min-height: 44px;
}

.file-ref-item:active { background: var(--bg-hover); }
.file-ref-icon { font-size: 14px; flex-shrink: 0; }
.file-ref-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-ref-size { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.file-ref-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ===== 触觉反馈 iOS scale 动画 ===== */
.btn-tap {
  animation: btn-tap-scale 0.15s ease;
}

@keyframes btn-tap-scale {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ===== / 命令补全面板 ===== */
.slash-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
  z-index: 10;
}

.slash-panel.hidden { display: none; }

.slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  min-height: 44px;
}

.slash-item:active,
.slash-item.active {
  background: var(--bg-hover);
}

.slash-icon { font-size: 16px; flex-shrink: 0; }
.slash-cmd { font-weight: 600; font-family: var(--font-mono); }
.slash-desc { color: var(--text-muted); font-size: 13px; margin-left: auto; }

/* ===== 输入区（Compact Inline V1） ===== */
.input-area {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 2px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-primary);
  padding: 6px 8px 4px;
}

/* 输入区上方渐变遮罩 */
.input-area::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -12px;
  height: 12px;
  background: linear-gradient(to top, var(--bg-secondary), transparent);
  pointer-events: none;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

/* [+] 按钮 */
.input-plus-btn {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--duration-quick) var(--ease-out);
}
.input-plus-btn:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.input-plus-btn:not(:active) { transition: background var(--duration-quick) var(--ease-out); }

/* 输入框容器（药丸形） */
.input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-height: 44px;
  padding: 4px 12px;
}

/* 输入框内嵌 mode 指示器 */
.input-mode-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  cursor: pointer;
  padding: 8px 6px 8px 2px;
  margin-right: 2px;
  min-height: 32px;
  -webkit-tap-highlight-color: transparent;
}
.input-mode-indicator .mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mode-yolo);
  flex-shrink: 0;
}
.input-mode-indicator .mode-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

#msg-input {
  flex: 1;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 16px; /* ≥16px 防 iOS 自动缩放 */
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  padding: 8px 0;
  font-family: inherit;
  /* 防 iOS Safari 点击 textarea 时页面缩放 */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
#msg-input::placeholder { color: var(--text-muted); }

/* 发送/停止按钮 */
.send-btn {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--duration-quick) var(--ease-out);
}
.send-btn:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: default;
}
.send-btn.stop {
  background: #1A1A18;
  color: #FAF9F7;
}

/* ===== Action Sheet ===== */
.action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 300;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.action-sheet-title {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
  font-weight: 500;
}
.action-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  text-align: left;
}
.action-sheet-item:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.action-sheet-item:not(:active) { transition: background var(--duration-quick) var(--ease-out); }
.action-sheet-item .action-icon { font-size: 20px; width: 28px; text-align: center; }
.action-sheet-item .action-value {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.action-sheet-item.cancel {
  justify-content: center;
  color: var(--text-muted);
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* ===== V2 会话列表页 + 聊天页导航 ===== */

/* 页面容器（列表页 / 聊天页） */
.conv-page {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  will-change: transform;
}

.conv-page.active {
  display: flex;
}

/* Push/Pop 动画 */
.conv-page.push-enter {
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-wechat-nav);
}
.conv-page.push-enter.active {
  transform: translateX(0);
}
.conv-page.push-exit {
  transform: translateX(0);
  transition: transform var(--duration-slow) var(--ease-wechat-nav);
}
.conv-page.push-exit-done {
  transform: translateX(-30%);
}
.conv-page.pop-enter {
  transform: translateX(-30%);
  transition: transform var(--duration-slow) var(--ease-wechat-nav);
}
.conv-page.pop-enter.active {
  transform: translateX(0);
}
.conv-page.pop-exit {
  transform: translateX(0);
  transition: transform var(--duration-slow) var(--ease-wechat-nav);
}
.conv-page.pop-exit-done {
  transform: translateX(100%);
}

/* Edge swipe 半透明遮罩 */
.edge-swipe-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: 1;
  transition: background var(--duration-slow) var(--ease-wechat-nav);
}

/* 列表页 topbar */
.conv-list-topbar {
  justify-content: flex-start;
}

.conv-list-topbar .view-title {
  font-size: 17px;
  font-weight: 600;
}

/* 返回按钮 */
.conv-back-btn {
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  padding: 0 4px;
  min-width: 32px;
  color: var(--color-role-d);
}

/* 会话列表 */
.conv-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

/* 会话行 */
.conv-row {
  display: flex;
  align-items: center;
  height: var(--conv-row-height);
  padding: 0 16px;
  gap: 12px;
  background: var(--bg-primary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 按压态：按下 50ms linear，松开 150ms ease-out（微信规格） */
.conv-row:active {
  background: var(--bg-pressed);
  transition: background var(--duration-instant) linear;
}
.conv-row:not(:active) {
  transition: background var(--duration-quick) var(--ease-out);
}

/* 置顶行 */
.conv-row.pinned {
  background: var(--bg-pinned);
}
.conv-row.pinned:active {
  background: var(--bg-pinned-pressed);
}

/* 左滑操作 */
.conv-row-wrapper {
  display: flex;
  width: 100%;
  position: relative;
  overflow: hidden;
  height: var(--conv-row-height);
}

.conv-row-wrapper .conv-row {
  flex: 0 0 100%;
  min-width: 100%;
}

/* settling 动画由 JS inline style 控制 */

.conv-swipe-actions {
  display: flex;
  flex-shrink: 0;
  height: 100%;
  bottom: 0;
}

.conv-swipe-btn {
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
}

.conv-swipe-btn.pin { background: #C7C7CC; }
.conv-swipe-btn.mute { background: #007AFF; }
.conv-swipe-btn.archive { background: #FF9500; }

/* 头像 */
.conv-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

/* 状态色点 */
.conv-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.conv-row.pinned .conv-status-dot {
  border-color: var(--bg-pinned);
}
.conv-status-dot.breathing {
  animation: breathe 1.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
.conv-working-hint {
  font-size: 11px;
  color: var(--accent);
  margin-left: 6px;
  font-weight: 400;
}

/* 内容区 */
.conv-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.conv-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.conv-last-msg {
  font-size: 15px;
  line-height: 1.3;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右侧：时间 + 未读 */
.conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.conv-time {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.conv-badge {
  display: none; /* 用户不需要未读计数，Tab1 预览已实时更新 */
}

/* 空状态 */
.conv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  gap: 8px;
}

.conv-empty-icon { font-size: 48px; }

/* ===== V2 Tab 2 团队列表 ===== */

.team-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
}

.member-card,
.team-card {
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 16px;
  gap: 12px;
  background: linear-gradient(rgba(250,249,247,0.03),rgba(250,249,247,0.03)), var(--bg-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0.5px 1px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.15);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.member-card:active {
  background: var(--bg-pressed);
  transition: background var(--duration-instant) linear;
}
.member-card:not(:active) {
  transition: background var(--duration-quick) var(--ease-out);
}

/* 分隔线 */
.member-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 76px;
  right: 0;
  height: 0.5px;
  background: linear-gradient(to right, transparent, rgba(250,249,247,0.06) 20%, rgba(250,249,247,0.06) 80%, transparent);
}
.member-card:last-child::after { display: none; }

/* 头像 */
.member-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  position: relative;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}

/* 状态色点 — 14px 描边挖洞 */
.member-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-secondary);
  transition: background-color var(--duration-normal) var(--ease-default);
}

.member-card:active .member-status-dot {
  border-color: var(--bg-pressed);
}

/* 运行中脉冲 */
.member-status-dot.running::after {
  content: '';
  position: absolute;
  top: -2.5px; left: -2.5px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: inherit;
  animation: status-pulse 2s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.8); }
}

/* 信息区 */
.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-role-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  overflow: hidden;
  min-width: 0;
}

.member-task {
  font-size: 14px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* 角色 chip */
.role-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 右侧：上下文进度条 + 模型 */
.member-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 1;
  min-width: 60px;
}

.member-ctx-bar {
  width: 48px;
  height: 4px;
  border-radius: 2px;
  background: rgba(120, 120, 128, 0.24);
  overflow: hidden;
}

.member-ctx-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--color-success);
  transition: width 600ms var(--ease-default);
  will-change: width;
}
.member-ctx-fill.warning { background: #FF9500; }
.member-ctx-fill.danger { background: var(--color-error); }

.member-ctx-label {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1;
}

.member-model {
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 1;
  line-height: 1;
}
.member-sdk-released {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(155,149,144,0.12);
}
.member-sdk-released i { font-size: 10px; }

/* ===== V2 Tab 4 我 ===== */

.me-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 80px);
}

/* 个人信息卡片 */
.profile-card {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary);
  gap: 16px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #C4724C, #AE5630);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-project {
  font-size: 15px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 设置分组 */
.settings-group {
  margin-top: 24px;
}

.settings-group-title {
  padding: 18px 20px 6px;
  font-size: 13px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.settings-group-content {
  background: linear-gradient(rgba(250,249,247,0.03),rgba(250,249,247,0.03)), var(--bg-secondary);
}

/* 设置行 */
.settings-row {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  gap: 16px;
}

.settings-row:active {
  background: var(--bg-pressed);
  transition: background var(--duration-instant) linear;
}
.settings-row:not(:active) {
  transition: background var(--duration-quick) var(--ease-out);
}

.settings-row::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 56px;
  right: 0;
  height: 0.5px;
  background: linear-gradient(to right, transparent, rgba(250,249,247,0.06) 20%, rgba(250,249,247,0.06) 80%, transparent);
}
.settings-row:last-child::after { display: none; }

/* 图标包裹 */
.settings-row-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.settings-row-icon-wrap.theme { background: #5856D6; }
.settings-row-icon-wrap.ai { background: #007AFF; }
.settings-row-icon-wrap.stats { background: #FF9500; }
.settings-row-icon-wrap.notify { background: #FF3B30; }
.settings-row-icon-wrap.qr { background: #007AFF; }
.settings-row-icon-wrap.cache { background: #8E8E93; }
.settings-row-icon-wrap.about { background: #8E8E93; }

.settings-row-label {
  font-size: 17px;
  color: var(--text-primary);
  flex: 1;
}

.settings-row-value {
  font-size: 17px;
  color: var(--text-tertiary);
}

.settings-row-chevron {
  font-size: 18px;
  color: var(--text-tertiary);
  opacity: 0.5;
  flex-shrink: 0;
}

/* 主题分段控制器 */
.theme-seg {
  display: flex;
  background: rgba(120, 120, 128, 0.24);
  border-radius: 8px;
  padding: 2px;
  height: 32px;
  position: relative;
  flex-shrink: 0;
}

.theme-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  padding: 0 6px;
  white-space: nowrap;
  transition: color var(--duration-quick) var(--ease-default);
}

.theme-seg-btn.active {
  color: var(--text-primary);
}

.theme-seg-indicator {
  position: absolute;
  top: 2px;
  left: 2px;
  height: 28px;
  width: calc(25% - 2px);  /* fallback，JS 会用 offsetWidth 精确覆盖 */
  border-radius: 6px;
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-normal) var(--ease-spring-settle),
              width var(--duration-normal) var(--ease-spring-settle);
  will-change: transform, width;
  z-index: 0;
}

/* iOS 开关 */
.ios-switch {
  width: 51px;
  height: 31px;
  border-radius: 15.5px;
  background: rgba(120, 120, 128, 0.24);
  position: relative;
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-default);
  flex-shrink: 0;
  border: none;
  padding: 0;
}

.ios-switch.on {
  background: #34C759;
}

.ios-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform var(--duration-normal) var(--ease-spring-settle);
}

.ios-switch.on .ios-switch-thumb {
  transform: translateX(20px);
}

/* ===== V2 Tab 4 服务统计卡片网格 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--bg-primary);
  border-radius: 10px;
  gap: 4px;
}

.stat-card-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-card-lbl {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1;
}

/* ===== V2 Tab4 统计详情页 ===== */
.stats-detail {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  z-index: var(--z-dropdown);
}
.stats-detail.active { display: flex; }
.stats-detail .detail-back { font-size: 28px; font-weight: 300; color: var(--color-role-d); padding: 0 4px; min-width: 32px; }

.stats-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 24px;
  background: var(--bg-secondary);
}

.stats-hero-num {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stats-hero-label {
  font-size: 15px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.stats-hero-cost {
  font-size: 17px;
  font-weight: 600;
  color: #34C759;
  margin-top: 8px;
}

/* Agent 分布条 */
.agent-dist-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  gap: 10px;
  position: relative;
}
.agent-dist-row::after { content: ''; position: absolute; bottom: 0; left: 58px; right: 0; height: 0.5px; background: var(--border-primary); }
.agent-dist-row:last-child::after { display: none; }

.agent-dist-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.agent-dist-name { font-size: 15px; color: var(--text-primary); width: 56px; flex-shrink: 0; }

.agent-dist-bar {
  flex: 1; height: 8px; border-radius: 4px;
  background: rgba(120,120,128,0.24); overflow: hidden;
}
.agent-dist-fill {
  height: 100%; border-radius: 4px; background: var(--color-role-d);
  transition: width 600ms var(--ease-default); will-change: width;
}

.agent-dist-tokens {
  font-size: 13px; color: var(--text-tertiary);
  font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 60px; text-align: right;
}

/* 系统资源行 */
.sys-row { display: flex; align-items: center; min-height: 44px; padding: 0 16px; position: relative; }
.sys-row::after { content: ''; position: absolute; bottom: 0; left: 16px; right: 0; height: 0.5px; background: var(--border-primary); }
.sys-row:last-child::after { display: none; }
.sys-row-label { font-size: 15px; color: var(--text-tertiary); flex: 1; }
.sys-row-value { font-size: 15px; color: var(--text-primary); }
.sys-row-value.danger { color: #FF3B30; font-weight: 600; }
.sys-row-value.tunnel { font-family: var(--font-mono); font-size: 13px; color: var(--color-role-d); cursor: pointer; }

/* ===== V2 Tab4 趋势图 ===== */
.stats-trend { padding: 16px; }

.trend-seg {
  display: flex;
  height: 28px;
  width: 120px;
  background: rgba(120, 120, 128, 0.24);
  border-radius: 7px;
  padding: 2px;
  position: relative;
  margin-bottom: 12px;
}

.trend-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  border: none;
  background: none;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color var(--duration-quick) var(--ease-default);
}

.trend-seg-btn.active { color: var(--text-primary); }

.trend-seg-ind {
  position: absolute;
  top: 2px;
  left: 2px;
  height: 24px;
  width: calc(50% - 2px);
  border-radius: 5px;
  background: var(--bg-tertiary);
  transition: transform var(--duration-normal) var(--ease-spring-settle);
  will-change: transform;
  z-index: 0;
}

.stats-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 120px;
  gap: 4px;
  padding-bottom: 20px;
}

.stats-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.stats-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 4px 4px 0 0;
  background: var(--color-role-d);
  opacity: 0.5;
  min-height: 2px;
  transform-origin: bottom;
  animation: bar-grow 600ms var(--ease-spring-settle) forwards;
}

.stats-bar.today { opacity: 1; }

@keyframes bar-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.stats-bar-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  text-align: center;
}

/* ===== V2 Tab 2 成员详情页 ===== */
.member-detail {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(250,249,247,0.05),rgba(250,249,247,0.05)), var(--bg-primary);
  z-index: var(--z-dropdown);
}
.member-detail.active { display: flex; }

.member-detail .detail-back { font-size: 28px; font-weight: 300; color: var(--color-role-d); padding: 0 4px; min-width: 32px; }
.member-detail .topbar-title { font-size: 17px; font-weight: 600; flex: 1; }

.detail-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.detail-header { display: flex; flex-direction: column; align-items: center; padding: 24px 16px 20px; background: var(--bg-secondary); }
.detail-avatar-lg { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 600; color: #fff; margin-bottom: 12px; position: relative; }
.detail-name { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.detail-subtitle { font-size: 15px; color: var(--text-tertiary); margin-top: 2px; }
.detail-status-line { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.detail-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.detail-status-text { font-size: 13px; color: var(--text-tertiary); }
.detail-sdk-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; }
.detail-sdk-tag.active { background: rgba(26,127,55,0.12); color: var(--color-success); }
.detail-sdk-tag.released { background: rgba(155,149,144,0.15); color: var(--text-muted); }
.detail-sdk-tag i { font-size: 10px; }

.detail-section { margin-top: 24px; }
.detail-section-title { padding: 0 20px 6px; font-size: 13px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.3px; }
.detail-section-card { background: linear-gradient(rgba(250,249,247,0.03),rgba(250,249,247,0.03)), var(--bg-secondary); }

.detail-role-desc { padding: 12px 16px; }
.detail-role-text { font-size: 15px; color: var(--text-primary); line-height: 22px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.detail-role-text.expanded { -webkit-line-clamp: unset; }
.detail-role-files { font-size: 13px; font-family: var(--font-mono); color: var(--text-tertiary); margin-top: 8px; line-height: 18px; }
.detail-expand-btn { font-size: 13px; color: var(--color-role-d); margin-top: 6px; background: none; border: none; padding: 0; cursor: pointer; }

.detail-ctx-bar { width: 100%; height: 8px; border-radius: 4px; background: rgba(120,120,128,0.24); overflow: hidden; }
.detail-ctx-fill { height: 100%; border-radius: 4px; transition: width 600ms var(--ease-default); will-change: width; }
.detail-ctx-pct { font-size: 28px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; margin-top: 8px; }
.detail-ctx-tokens { font-size: 13px; color: var(--text-tertiary); }

.detail-row { display: flex; align-items: center; min-height: 44px; padding: 0 16px; position: relative; }
.detail-row::after { content: ''; position: absolute; bottom: 0; left: 16px; right: 0; height: 0.5px; background: var(--border-primary); }
.detail-row:last-child::after { display: none; }
.detail-row-label { font-size: 15px; color: var(--text-tertiary); flex: 1; }
.detail-row-value { font-size: 15px; color: var(--text-primary); }

.detail-task-text { padding: 12px 16px; font-size: 15px; color: var(--text-primary); line-height: 22px; }

.detail-msg-list { }
.detail-msg-row { display: flex; align-items: flex-start; min-height: 40px; padding: 8px 16px; gap: 8px; position: relative; }
.detail-msg-row::after { content: ''; position: absolute; bottom: 0; left: 16px; right: 0; height: 0.5px; background: var(--border-primary); }
.detail-msg-row:last-child::after { display: none; }
.detail-msg-sender { font-size: 13px; flex-shrink: 0; width: 20px; }
.detail-msg-text { font-size: 14px; color: var(--text-primary); line-height: 20px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-msg-time { font-size: 12px; color: var(--text-tertiary); flex-shrink: 0; }
.detail-view-all { display: flex; align-items: center; justify-content: center; height: 40px; font-size: 13px; color: var(--color-role-d); cursor: pointer; }
.detail-view-all:active { background: var(--bg-pressed); transition: background var(--duration-instant) linear; }

.detail-stats-row { display: flex; justify-content: space-around; padding: 16px; }
.detail-stat { display: flex; flex-direction: column; align-items: center; }
.detail-stat-num { font-size: 22px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.detail-stat-lbl { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

.detail-actions { position: fixed; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 16px; background: var(--bg-secondary); border-top: 0.5px solid var(--border-primary); z-index: var(--z-overlay); }
.detail-action-btn { height: 44px; border-radius: 10px; font-size: 15px; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; -webkit-tap-highlight-color: transparent; }
.detail-action-btn:active { transform: scale(0.96); transition: transform 100ms var(--ease-default); }
.detail-action-btn:not(:active) { transition: transform var(--duration-quick) var(--ease-spring-settle); }
.detail-action-btn.msg { background: var(--color-role-d); color: #fff; }
.detail-action-btn.compact { background: #007AFF; color: #fff; }
.detail-action-btn.restart { background: #FF9500; color: #fff; }
.detail-action-btn.model { background: var(--bg-tertiary); color: var(--text-primary); }
.detail-action-btn.takeover { background: var(--color-success); color: #fff; }
.detail-action-btn.release { background: var(--text-muted); color: #fff; }

/* ===== V2 Tab 2 快速操作栏 ===== */
.member-quick-actions {
  display: flex;
  gap: 12px;
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
  left: 16px;
  right: 16px;
  z-index: var(--z-dropdown);
  transform: translateY(80px);
  opacity: 0;
  transition: transform var(--duration-normal) var(--ease-spring-bounce),
              opacity var(--duration-quick) var(--ease-out);
  pointer-events: none;
}

.member-quick-actions.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.member-quick-btn {
  flex: 1;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.member-quick-btn:active {
  transform: scale(0.96);
  transition: transform 100ms var(--ease-default);
}

.member-quick-btn.msg {
  background: var(--color-role-d);
  color: #fff;
}

.member-quick-btn.task {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* 选中卡片高亮 */
.member-card.selected {
  background: var(--bg-hover);
}

/* ===== V2 Tab 3 发现 ===== */

/* 分段控制器 */
.disc-seg {
  display: flex;
  position: relative;
  height: 32px;
  background: rgba(120, 120, 128, 0.24);
  border-radius: 8px;
  padding: 2px;
  margin: 8px 16px 0;
  flex-shrink: 0;
}

.disc-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  border: none;
  background: none;
  border-radius: 7px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  padding: 0;
  white-space: nowrap;
  transition: color var(--duration-quick) var(--ease-default);
  -webkit-tap-highlight-color: transparent;
}

.disc-seg-btn.active { color: var(--text-primary); }

.disc-seg-indicator {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: calc(33.33% - 2px);
  border-radius: 7px;
  background: var(--bg-tertiary);
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-normal) var(--ease-spring-settle);
  will-change: transform;
  z-index: 0;
}

/* 子视图容器 */
.disc-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.disc-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
}

.disc-panel.active { display: flex; }

/* 筛选 chip */
.feed-filters {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.feed-filters::-webkit-scrollbar { display: none; }

.feed-chip {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  background: rgba(120, 120, 128, 0.24);
  color: var(--text-tertiary);
  transition: background var(--duration-quick) var(--ease-out), color var(--duration-quick);
  -webkit-tap-highlight-color: transparent;
}

.feed-chip.active {
  background: var(--color-role-d);
  color: #fff;
}

.feed-chip:active { transform: scale(0.95); }

/* 动态流卡片 */
.feed-list { padding: 0 16px 16px; }

.feed-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 12px 16px 12px;
  margin-top: 8px;
  animation: feed-card-in var(--duration-normal) var(--ease-out);
}

@keyframes feed-card-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-card.urgent { border-left: 3px solid #FF3B30; }

.feed-card-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.feed-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

.feed-card-route {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-card-time {
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.feed-card-body {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 10px 12px;
}

.feed-card-tag {
  display: inline-flex;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 4px;
  vertical-align: middle;
  line-height: 18px;
}
.feed-card-tag.report { background: rgba(0,122,255,0.15); color: #007AFF; }
.feed-card-tag.negotiate { background: rgba(255,149,0,0.15); color: #FF9500; }
.feed-card-tag.notify { background: rgba(142,142,147,0.15); color: #8E8E93; }
.feed-card-tag.alert { background: rgba(255,59,48,0.15); color: #FF3B30; }

.feed-card-content {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-card-actions {
  display: flex;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border-primary);
}

.feed-card-action {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
}
.feed-card-action:active { background: rgba(120, 120, 128, 0.24); }

/* 任务看板 */
.kanban-board {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 12px;
  padding: 12px 16px 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.kanban-board::-webkit-scrollbar { display: none; }

.kanban-col {
  flex: 0 0 85vw;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 200px;
}

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.kanban-col-title { font-size: 17px; font-weight: 600; color: var(--text-primary); }

.kanban-col-count {
  font-size: 13px;
  width: 24px; height: 20px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(120, 120, 128, 0.24);
  color: var(--text-tertiary);
}
.kanban-col-count.wip { background: rgba(0,122,255,0.15); color: #007AFF; }
.kanban-col-count.done { background: rgba(52,199,89,0.15); color: #34C759; }
.kanban-col-count.blocked { background: rgba(255,59,48,0.15); color: #FF3B30; }

.kanban-cards { display: flex; flex-direction: column; gap: 8px; }

.kanban-card {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.kanban-card:active { background: var(--bg-pressed); transform: scale(0.98); transition: background var(--duration-instant) linear, transform var(--duration-instant) linear; }
.kanban-card:not(:active) { transition: background var(--duration-quick) var(--ease-out), transform var(--duration-quick) var(--ease-spring-settle); }
.kanban-card.p0 { border-left: 3px solid #FF3B30; }
.kanban-card.p1 { border-left: 3px solid #FF9500; }
.kanban-card.p2 { border-left: 3px solid #FFD60A; }
.kanban-card.p3 { border-left: 3px solid #34C759; }

.kanban-card-pri {
  display: inline-flex; height: 18px; padding: 0 6px; border-radius: 4px;
  font-size: 11px; font-weight: 600; line-height: 18px; margin-bottom: 6px;
}
.kanban-card-pri.p0 { background: rgba(255,59,48,0.15); color: #FF3B30; }
.kanban-card-pri.p1 { background: rgba(255,149,0,0.15); color: #FF9500; }

.kanban-card-title {
  font-size: 15px; font-weight: 500; color: var(--text-primary);
  line-height: 20px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kanban-card-desc {
  font-size: 12px; color: var(--text-secondary); margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}

.kanban-card-footer {
  display: flex; align-items: center; justify-content: space-between; margin-top: 10px;
}

.kanban-card-assignee { display: flex; align-items: center; gap: 6px; }
.kanban-card-avatar { width: 22px; height: 22px; border-radius: 6px; font-size: 10px; display: flex; align-items: center; justify-content: center; color: #fff; }
.kanban-card-name { font-size: 12px; color: var(--text-tertiary); }
.kanban-card-pct { font-size: 12px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* 项目状态 */
.status-scroll { padding: 0 0 16px; }

.status-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 16px 0;
}

.status-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px;
}

/* 团队总览 6 人横排 */
.team-overview { display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; }

.team-ov-member { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }

.team-ov-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; position: relative; margin-bottom: 6px;
  flex-shrink: 0; overflow: hidden;
}
.team-ov-avatar i { font-size: 20px; }

.team-ov-avatar::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2.5px solid var(--text-tertiary);
  transition: border-color var(--duration-normal) var(--ease-default);
}
.team-ov-avatar.running::after { border-color: #34C759; }
.team-ov-avatar.waiting::after { border-color: #FFD60A; }
.team-ov-avatar.error::after { border-color: #FF3B30; }

.team-ov-avatar.running::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2.5px solid #34C759; animation: ring-pulse 2s ease-in-out infinite;
}
@keyframes ring-pulse { 0%,100%{opacity:0;transform:scale(1)} 50%{opacity:0.3;transform:scale(1.15)} }

.team-ov-name { font-size: 11px; font-weight: 500; color: var(--text-primary); text-align: center; }
.team-ov-task { font-size: 11px; color: var(--text-tertiary); text-align: center; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* 今日统计 */
.daily-stats { display: flex; justify-content: space-around; }
.daily-stat { display: flex; flex-direction: column; align-items: center; }
.daily-stat-num { font-size: 28px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.daily-stat-lbl { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* Git 状态 */
.git-info { display: flex; flex-direction: column; gap: 8px; }
.git-row { display: flex; justify-content: space-between; align-items: center; }
.git-label { font-size: 15px; color: var(--text-tertiary); }
.git-val { font-size: 15px; color: var(--text-primary); font-family: var(--font-mono); }
.git-branch { background: rgba(0,122,255,0.15); color: #007AFF; padding: 2px 8px; border-radius: 6px; font-size: 13px; }

/* 工具集 */
.tools-scroll { padding: 0 0 16px; }

.tools-group { margin: 12px 16px 0; }
.tools-group-title { font-size: 13px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; padding: 0 4px; }

/* 桌面端看板四列 */
@media (min-width: 768px) {
  .kanban-board { scroll-snap-type: none; overflow-x: visible; }
  .kanban-col { flex: 1 1 0; min-width: 0; }
}

/* ===== V2 底部导航栏 ===== */
.nav-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-nav-bar);
  border-top: 0.5px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  padding-top: 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  position: relative;
  border: none;
  background: none;
  padding: 4px 0;
  min-height: 49px;
  -webkit-tap-highlight-color: transparent;
}

.nav-tab:active { opacity: 0.7; }
.nav-tab.active { color: var(--color-role-d); }

.nav-icon {
  font-size: 24px;
  line-height: 1;
}

/* 选中态：regular→bold 瞬切 */
.nav-tab .icon-filled { display: none; }
.nav-tab .icon-outline { display: block; }
.nav-tab.active .icon-filled { display: block; }
.nav-tab.active .icon-outline { display: none; }
.nav-tab.active { color: var(--color-primary); }
.nav-tab.active .nav-icon { filter: none; }

/* 选中态底部指示器（赤陶实色） */
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: var(--color-primary);
}

.nav-label {
  font-size: 10px;
  line-height: 1;
}

/* 导航栏未读角标 — 18px + 弹性动画 */
.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 18px;
  height: 18px;
  border-radius: 8px;
  background: #FF3B30;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
  transform: scale(0);
  opacity: 0;
  transition: transform var(--duration-quick) var(--ease-spring-bounce),
              opacity var(--duration-quick) var(--ease-out);
}

.nav-badge.visible {
  transform: scale(1);
  opacity: 1;
}

/* 导航栏红点（发现 Tab 紧急消息） */
.nav-dot {
  position: absolute;
  top: 4px;
  right: calc(50% - 14px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF3B30;
  transform: scale(0);
  opacity: 0;
  transition: transform var(--duration-quick) var(--ease-spring-bounce),
              opacity var(--duration-quick) var(--ease-out);
}

.nav-dot.visible { transform: scale(1); opacity: 1; }

/* ===== V2 Tab 视图容器 ===== */
.tab-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tab-view.active {
  display: flex;
  background: var(--bg-primary);
}

/* 其他 Tab 的 topbar 样式 */
.view-topbar {
  justify-content: center;
}

.view-title {
  font-size: 17px;
  font-weight: 600;
}

.view-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: var(--nav-height);
}

.view-placeholder {
  text-align: center;
  color: var(--text-tertiary);
}

.view-placeholder-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* ===== V2 Session 横栏（原底部 Tab → 顶部 chips） ===== */
.session-bar {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.session-bar::-webkit-scrollbar { display: none; }

.session-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  min-height: 32px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast);
}

.session-chip:active { background: var(--bg-active); }

.session-chip.active {
  background: var(--color-role-d);
  color: #fff;
}

.session-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Session 角标 */
.session-chip-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 8px;
  background: var(--color-error);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
}

.session-chip-badge.pulse {
  animation: badge-pulse 0.6s ease-out;
}

@keyframes badge-pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.5); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ===== 上下文用量 ===== */
.ctx-usage {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: default;
}

.ctx-bar {
  width: 48px;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}

.ctx-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--success);
  transition: width var(--duration-emphasis) var(--ease-default), background var(--duration-emphasis) var(--ease-default);
  will-change: width;
  width: 0%;
}

.ctx-fill.warn { background: var(--warning); }
.ctx-fill.danger { background: var(--error); }

.ctx-label {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
}

/* ===== 模式选择器弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mode-picker {
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
}

.mode-picker-title {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.mode-option:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.mode-option:not(:active) { transition: background var(--duration-quick) var(--ease-out); }
.mode-option small { color: var(--text-secondary); font-size: 13px; }

.mode-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== 终端输出分色（学 Happy terminal-output 4色）===== */
.terminal-output { background: var(--bg-secondary); border-radius: 6px; padding: 8px 10px; margin: 0; }
.terminal-output code { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.term-stdout { color: var(--color-term-stdout); }
.term-stderr { color: var(--color-term-stderr); }
.term-command { color: var(--color-term-command); font-weight: 600; }
.term-exit-error { color: var(--color-term-exit-error); font-weight: 600; }

/* 工具输出智能截断 */
.tool-output-truncated { position: relative; }
.tool-output-expand {
  display: block; width: 100%; padding: 8px; margin-top: 4px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--accent); font-size: 12px;
  cursor: pointer; text-align: center;
}
.tool-output-expand:active { background: var(--bg-hover); }
.tool-output-scroll { max-height: 400px; overflow-y: auto; border-radius: 6px; }

/* 推送权限引导条 */
.push-guide-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--bg-tertiary); border-radius: 12px; margin: 8px 0; font-size: 13px;
}
.push-guide-text { flex: 1; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.push-guide-text i { color: var(--accent); font-size: 16px; }
.push-guide-btn {
  padding: 6px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none;
}
.push-guide-btn.enable { background: var(--accent); color: #fff; }
.push-guide-btn.later { background: transparent; color: var(--text-secondary); }

/* 权限审批卡片 */
.permission-card {
  background: var(--bg-bubble-assistant); border-radius: 14px; padding: 14px 16px; max-width: 85%;
}
.perm-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.perm-icon { font-size: 18px; }
.perm-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.perm-risk { font-size: 12px; font-weight: 600; margin-left: auto; }
.perm-tool { font-size: 14px; color: var(--text-primary); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.perm-input {
  font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono);
  background: var(--bg-secondary); border-radius: 6px; padding: 6px 8px; margin-bottom: 8px;
  white-space: pre-wrap; word-break: break-all; max-height: 80px; overflow-y: auto;
}
.perm-countdown { font-size: 12px; color: var(--text-tertiary); margin-bottom: 8px; }
.perm-actions { display: flex; gap: 8px; }
.perm-btn {
  flex: 1; padding: 10px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.perm-btn.approve { background: var(--color-success); color: #fff; }
.perm-btn.deny { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.perm-btn:active { opacity: 0.8; }
.perm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Diff 视图 ===== */
.diff-view {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}

.diff-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  min-height: 44px;
}

.diff-header:active { opacity: 0.8; }

.diff-file {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-primary);
}

.diff-stat-add {
  color: var(--diff-add-color, #3fb950);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
}

.diff-stat-remove {
  color: var(--diff-remove-color, #f85149);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
}

.diff-toggle-arrow {
  font-size: 12px;
  transition: transform var(--duration-slow) var(--ease-default);
  flex-shrink: 0;
}

.diff-open .diff-toggle-arrow { transform: rotate(90deg); }

.diff-body {
  max-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  transition: max-height var(--duration-slow) var(--ease-default);
  border-top: 1px solid var(--border);
}

.diff-open .diff-body {
  max-height: 2000px;
}

.diff-line {
  padding: 0 4px;
  white-space: pre;
  min-height: 20px;
  display: flex;
}

/* 行号（old + new 双列）*/
.diff-ln {
  display: inline-block;
  width: 32px;
  text-align: right;
  padding-right: 6px;
  color: var(--diff-line-no, #6e7681);
  font-size: 11px;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.6;
}

.diff-line.add {
  background: var(--diff-add-bg, rgba(63, 185, 80, 0.12));
  color: var(--diff-add-color, #3fb950);
}

.diff-line.remove {
  background: var(--diff-del-bg, rgba(248, 81, 73, 0.12));
  color: var(--diff-del-color, #f85149);
}

.diff-line.hunk {
  color: var(--diff-hunk-color, #88a6ff);
  background: var(--diff-hunk-bg, rgba(88, 166, 255, 0.08));
  font-size: 12px;
  padding: 4px 4px;
}

.diff-line.ctx {
  color: var(--diff-context, var(--text-muted));
}

.diff-line.diff-file-header {
  color: var(--diff-header-color, var(--accent));
  font-weight: 600;
  font-size: 12px;
  padding: 2px 4px;
}

/* ===== 快捷短语面板 ===== */
.phrases-panel {
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
}

.phrases-title {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.phrases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.phrase-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.phrase-btn:active { background: var(--bg-hover); }
.phrase-icon { font-size: 16px; flex-shrink: 0; }

.phrase-add {
  border: 1px dashed var(--border) !important;
  color: var(--text-muted);
  background: transparent;
}

.phrase-add:active { background: var(--bg-hover); }

/* ===== 消息长按菜单 ===== */
.msg-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.msg-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.msg-menu-item:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.msg-menu-item:not(:active) { transition: background var(--duration-quick) var(--ease-out); }
.msg-menu-item.danger { color: var(--error); }

/* ===== 转发面板 ===== */
.forward-panel {
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
}

.forward-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  border-radius: var(--radius-sm);
}

.forward-item:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.forward-item:not(:active) { transition: background var(--duration-quick) var(--ease-out); }

.forward-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== 团队视图 ===== */
.team-view {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  animation: fade-in 0.15s ease-out;
}

.team-view.hidden { display: none; }

.team-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.team-view-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.team-stats-bar {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.team-stats-bar::-webkit-scrollbar { display: none; }

.stat-chip {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.team-view-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}

/* 单个 session 卡片 */
#team-view-grid .team-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--duration-quick) var(--ease-out), transform var(--duration-instant) var(--ease-default);
  min-height: 100px;
}

#team-view-grid .team-card:active { transform: scale(0.97); }
#team-view-grid .team-card.status-running { border-color: var(--accent); }
#team-view-grid .team-card.status-error { border-color: var(--error); }

/* 卡片头部：状态灯 + 角色名 */
.team-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.team-card-role {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.team-card-label {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-card-status {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* 最后消息摘要 */
.team-card-msg {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 34px;
}

.team-card-msg.empty {
  color: var(--text-muted);
  font-style: italic;
}

/* 上下文用量条 */
.team-card-ctx {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-card-ctx-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}

.team-card-ctx-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--success);
  transition: width var(--duration-emphasis) var(--ease-default);
  will-change: width;
}

.team-card-ctx-fill.warn { background: var(--warning); }
.team-card-ctx-fill.danger { background: var(--error); }

.team-card-ctx-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* 未读角标 */
.team-card-badge {
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

/* 3列布局（平板） */
@media (min-width: 600px) {
  .team-view-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== 搜索面板 ===== */
.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 300;
  display: flex;
  flex-direction: column;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-muted); }

.search-close {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.search-group-header {
  padding: 12px 12px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.search-result-item:active { background: var(--bg-hover); transition: background var(--duration-instant) linear; }
.search-result-item:not(:active) { transition: background var(--duration-quick) var(--ease-out); }

.search-result-session {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.search-result-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.search-result-text mark {
  background: rgba(88, 166, 255, 0.3);
  color: var(--text-primary);
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.search-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}

.search-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}

/* ===== 连接状态栏（聊天区顶部内联） ===== */
.connection-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 0 12px 8px;
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
  flex-shrink: 0;
}

.connection-bar.hidden {
  display: none;
}

/* 断连状态 */
/* 断开 — 灰色（降低焦虑，学 Happy disconnected 灰调）*/
.connection-bar.disconnected {
  background: rgba(142, 142, 147, 0.12);
  color: #999999;
  border: 1px solid rgba(142, 142, 147, 0.25);
}

/* 重连中 — 蓝色（学 Happy connecting 蓝色 #007AFF）*/
.connection-bar.reconnecting {
  background: rgba(0, 122, 255, 0.12);
  color: #007AFF;
  border: 1px solid rgba(0, 122, 255, 0.25);
}

.connection-bar.reconnecting .connection-bar-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 离线模式（灰色） */
.connection-bar.offline {
  background: rgba(115, 115, 115, 0.12);
  color: var(--text-secondary);
  border: 1px solid rgba(115, 115, 115, 0.25);
}

/* 已连接（短暂显示） */
.connection-bar.connected {
  background: rgba(63, 185, 80, 0.12);
  color: var(--success);
  border: 1px solid rgba(63, 185, 80, 0.25);
}

.connection-bar.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

/* 恢复连接绿色 pulse */
.connection-bar.connection-pulse {
  animation: connection-pulse 2s ease-out;
}

@keyframes connection-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.4); }
  20% { box-shadow: 0 0 0 6px rgba(63, 185, 80, 0.2); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

/* 旧 reconnect-bar 兼容（动态创建的仍可能存在，保留基础样式） */
.reconnect-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: calc(4px + env(safe-area-inset-top, 0px)) 8px 4px;
  background: var(--error);
  color: #fff;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.reconnect-bar.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ===== 设置面板 ===== */
.settings-panel {
  background: var(--bg-secondary);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
}

.settings-section { margin-bottom: 16px; }

.settings-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

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

.theme-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: border-color var(--duration-normal) var(--ease-default), transform var(--duration-quick) var(--ease-out);
}

.theme-btn:active { background: var(--bg-hover); transform: scale(0.97); }
.theme-btn.active { border-color: var(--accent); }

/* 主题预览色块 */
.theme-preview {
  display: block;
  width: 36px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid;
}

/* 字体大小控件 */
.font-size-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-size-sample {
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

#font-size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  outline: none;
}

#font-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#font-size-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#font-size-value {
  font-weight: 600;
  color: var(--accent);
}

/* ===== 图片消息 ===== */
.msg-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: contain;
}

.msg-image:active { opacity: 0.8; }

/* 输入区图片预览条 */
.image-preview-bar {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
}

.image-preview-bar::-webkit-scrollbar { display: none; }

.image-preview-thumb {
  position: relative;
  flex-shrink: 0;
}

.image-preview-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.image-preview-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

/* 图片上传进度/错误叠层 */
.upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 1;
}

.upload-overlay.error {
  background: rgba(200,0,0,0.45);
  cursor: pointer;
}

.upload-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.upload-retry-icon {
  font-size: 20px;
  color: #fff;
  font-weight: bold;
}

.image-preview-thumb.upload-error img {
  opacity: 0.5;
}

/* ===== 图片全屏预览 ===== */
.img-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.2s ease-out;
  touch-action: none; /* 全部手势由 JS 接管 */
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.img-preview-overlay.hidden { display: none; }

.img-preview-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 601;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-preview-close:active { background: rgba(255, 255, 255, 0.3); }

.img-preview-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.img-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform var(--duration-instant) var(--ease-out);
  user-select: none;
  -webkit-user-drag: none;
}

/* ===== 离线待发送消息 ===== */
.msg-pending {
  opacity: 0.55;
}

.pending-badge {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

/* ===== 会话管理弹窗 ===== */

/* 侧边栏项操作菜单 */
.sidebar-ctx-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.sidebar-ctx-menu button {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.sidebar-ctx-menu button:active { background: var(--bg-hover); }
.sidebar-ctx-menu button.danger { color: var(--error); }

/* 侧边栏 inline 重命名 */
.sidebar-item .sidebar-rename-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  min-width: 0;
}

/* 确认弹窗 */
.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease-out;
}

.confirm-dialog {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 280px;
  max-width: 90vw;
}

.confirm-dialog-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-dialog-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.confirm-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.confirm-dialog-actions button {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  cursor: pointer;
}

.confirm-dialog-actions .btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.confirm-dialog-actions .btn-cancel:active { background: var(--bg-hover); }

.confirm-dialog-actions .btn-confirm {
  background: var(--error);
  color: #fff;
}

.confirm-dialog-actions .btn-confirm:active { opacity: 0.8; }

/* 新建会话弹窗 input */
.confirm-dialog input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.confirm-dialog input:focus { border-color: var(--accent); }

/* 模板选择器 */
.template-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.template-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--duration-quick) var(--ease-out), color var(--duration-quick) var(--ease-out), border-color var(--duration-quick) var(--ease-out);
}

.template-chip.active {
  border-color: var(--accent);
  background: rgba(147, 51, 234, 0.1);
  color: var(--text-primary);
}

.template-chip:active { transform: scale(0.95); }

.template-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 角色选择器 */
.role-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.role-picker-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.role-picker .role-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--duration-quick) var(--ease-out), background var(--duration-quick) var(--ease-out);
}

.role-picker .role-chip:active { transform: scale(0.95); }

.role-picker .role-chip.active {
  color: var(--text-primary);
}

.role-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.confirm-dialog-actions .btn-primary {
  background: var(--accent);
  color: #fff;
}

.confirm-dialog-actions .btn-primary:active { opacity: 0.8; }

/* ===== 引导流程 ===== */

/* 欢迎卡片 */
.onboard-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 16px;
  padding: 20px;
  animation: msg-in 0.3s ease-out;
}

.onboard-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.onboard-tips { margin-bottom: 16px; }

.onboard-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0;
  line-height: 1.4;
}

.onboard-tip-icon {
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}

.onboard-dismiss {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.onboard-dismiss:active { opacity: 0.8; }

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 70vh;
  padding: 24px;
  text-align: center;
}

.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.empty-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }
.empty-features { text-align: left; margin-bottom: 32px; }

.empty-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0;
}

.empty-feature-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.empty-cta {
  padding: 14px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.empty-cta:active { opacity: 0.8; }

/* 会话内无消息空状态 */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.chat-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }
.chat-empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 16px; }

.chat-empty-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chat-empty-hint {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-quick) var(--ease-out);
}

.chat-empty-hint:active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 停止按钮提示 */
.stop-hint {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--input-min-height) + 8px);
  right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 200;
  animation: fade-in 0.2s ease-out;
  white-space: nowrap;
}

.stop-hint-arrow {
  position: absolute;
  bottom: -5px;
  right: 16px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  transform: rotate(45deg);
}

.stop-hint.fade-out {
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}

/* ===== 工具提示 / 隐藏状态 ===== */
.hidden { display: none !important; }

/* ===== 桌面端侧边栏布局 ===== */
@media (min-width: 768px) {
  #app {
    flex-direction: row;
    max-width: 1200px;
    margin: 0 auto;
  }

  /* 左侧会话列表 */
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: 280px;
    min-width: 280px;
    height: 100dvh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    transition: width 0.25s ease, min-width 0.25s ease;
  }

  .desktop-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: none;
  }

  .desktop-sidebar-header {
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .desktop-sidebar-list {
    flex: 1;
    overflow-y: auto;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 100%;
    text-align: left;
  }

  .sidebar-item:hover { background: var(--bg-hover); }
  .sidebar-item.active { background: var(--bg-tertiary); }

  .sidebar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .sidebar-label { flex: 1; }

  .sidebar-badge {
    background: var(--error);
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
  }

  .sidebar-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
  }

  .sidebar-footer button {
    flex: 1;
    padding: 8px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
  }

  .sidebar-footer button:hover { background: var(--bg-hover); color: var(--text-primary); }

  /* 右侧聊天主区 */
  .desktop-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-width: 0;
    min-height: 0;
  }

  /* 桌面端取消 fixed 定位（回到 flex 布局） */
  .input-area {
    position: static;
  }
  .chat-area {
    padding-bottom: 12px;
  }
  .chips-area, .typing-indicator {
    position: static;
  }

  /* 桌面端：底部导航栏 → 左侧边栏 */
  .nav-bar {
    position: static;
    flex-direction: column;
    width: 240px;
    min-width: 240px;
    height: 100dvh;
    border-top: none;
    border-right: 1px solid var(--border);
    padding-bottom: 0;
    order: -1; /* 排在 desktop-main 内容前面 */
  }

  .nav-tab {
    flex: 0;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 20px;
    min-height: 48px;
    font-size: 15px;
    border-radius: 0;
  }

  .nav-tab:hover { background: var(--bg-hover); }

  .nav-label {
    font-size: 15px;
    font-weight: 500;
  }

  .nav-badge {
    position: static;
    margin-left: auto;
  }

  .nav-dot {
    position: static;
    margin-left: auto;
  }

  /* 桌面端 desktop-main 改为 row 以容纳 nav 侧边栏 */
  .desktop-main {
    flex-direction: row;
  }

  /* view 容器在桌面端需要占满剩余空间 */
  .tab-view.active {
    flex: 1;
    min-width: 0;
  }

  /* 桌面端：隐藏 session-bar（用 desktop-sidebar 代替） */
  .session-bar { display: none; }
}

/* 移动端隐藏侧边栏和桌面专属元素 */
@media (max-width: 767px) {
  .desktop-sidebar { display: none !important; }
  .desktop-only { display: none !important; }
}

/* ===== 手机横屏适配 ===== */
@media (max-width: 767px) and (orientation: landscape) {
  .topbar {
    height: 36px;
    padding-top: 0;
  }
  .nav-bar {
    padding-top: 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .nav-tab { gap: 1px; }
  .nav-icon { width: 20px; height: 20px; }
  .input-area { padding: 4px 8px 4px 4px; }
  .chips-area { padding: 4px 12px; }
  .chat-area { padding: 8px 12px 4px; }

  /* 横屏左右 safe area */
  #app {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

/* ===== 用户反馈面板 ===== */
.feedback-btn { font-size: 16px; }
.feedback-panel {
  position: fixed; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  left: 8px; right: 8px; z-index: 800;
  background: var(--bg-secondary); border-radius: 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.25);
  padding: 0; overflow: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.feedback-panel.hidden { display: none; }
.feedback-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px; border-bottom: 1px solid var(--border);
}
.feedback-title { font-size: 15px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.feedback-close { background: none; border: none; color: var(--text-secondary); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.feedback-close:active { background: var(--bg-hover); }
.feedback-body { padding: 12px 16px 16px; }
.feedback-images {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.feedback-add-img {
  width: 64px; height: 64px; border-radius: 10px;
  border: 2px dashed var(--border); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--text-tertiary); font-size: 11px; cursor: pointer;
  transition: border-color 0.15s;
}
.feedback-add-img i { font-size: 22px; }
.feedback-add-img:active { border-color: var(--accent); color: var(--accent); }
.feedback-thumb {
  position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
}
.feedback-thumb img { width: 100%; height: 100%; object-fit: cover; }
.feedback-thumb-del {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  font-size: 11px; line-height: 20px; text-align: center; cursor: pointer;
}
.feedback-text {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-primary); color: var(--text-primary);
  padding: 8px 12px; font-size: 14px; resize: none;
  font-family: inherit; margin-bottom: 10px;
}
.feedback-text:focus { outline: none; border-color: var(--accent); }
.feedback-send-btn {
  width: 100%; padding: 10px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.2s, opacity 0.2s;
}
.feedback-send-btn:active { opacity: 0.85; }
.feedback-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 文件浏览器面板（Day 16）===== */
.file-browser-panel {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary); z-index: 300;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s var(--ease-out, ease-out);
}
.file-browser-panel.open { transform: translateX(0); }
.fb-breadcrumb {
  flex: 1; display: flex; align-items: center; gap: 2px;
  overflow-x: auto; white-space: nowrap; font-size: 14px; color: var(--text-secondary);
}
.fb-crumb { cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.fb-crumb:hover { background: var(--bg-hover); }
.fb-crumb:last-child { color: var(--text-primary); font-weight: 500; }
.fb-sep { color: var(--text-tertiary); margin: 0 1px; }
.fb-list {
  flex: 1; overflow-y: auto; padding: 0;
  -webkit-overflow-scrolling: touch;
}
.fb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 0.5px solid var(--border-secondary, var(--border));
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.fb-item:active { background: var(--bg-hover); }
.fb-icon { font-size: 18px; color: var(--text-secondary); flex-shrink: 0; width: 24px; text-align: center; }
.fb-dir .fb-icon { color: var(--accent); }
.fb-name { flex: 1; font-size: 14px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-size { font-size: 12px; color: var(--text-tertiary); flex-shrink: 0; }
.fb-empty { text-align: center; padding: 40px 16px; color: var(--text-secondary); font-size: 14px; }
.fb-loading { text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: 13px; }
.fb-loading .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--spinner-color); border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 6px; }
.fb-section-title { padding: 12px 16px 4px; font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.fb-commit .fb-name { font-family: var(--font-mono); font-size: 12px; }

/* 文件预览 */
.fb-preview-md { padding: 16px; overflow-y: auto; max-height: calc(100dvh - 60px); }
.fb-preview-md h1, .fb-preview-md h2, .fb-preview-md h3 { color: var(--text-primary); }
.fb-preview-md p { color: var(--text-secondary); line-height: 1.6; }
.fb-preview-md code { background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 13px; }
.fb-preview-md pre { background: var(--bg-secondary); border-radius: 8px; padding: 12px; overflow-x: auto; }
.fb-preview-code { overflow: auto; max-height: calc(100dvh - 60px); }
.fb-preview-code pre { margin: 0; padding: 12px; font-size: 12px; line-height: 1.5; }
.fb-preview-img { text-align: center; padding: 16px; }
.fb-preview-img img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
