/* style.css — Z Remote H5 深色移动优先 */
:root {
  --bg: #0E0F11;
  --card: #17181B;
  --card2: #1E2024;
  --border: #2A2D33;
  --text: #E8EAED;
  /* v0.8.3(P1-7):次要灰字提亮至 ≥#A8A8A8(旧 #9a9aa3 对比不足) */
  --text2: #9AA0A6;
  --text3: #8b8b96;
  --accent: #6E9BFF;
  /* v0.52.7 棒6a2:等拍板信号专用色(中性蓝紫,与 --warn 警示黄严格区分) */
  --await: #7B8CFF;
  /* v0.8.3(P0-2):主操作按钮专用蓝(白图标对比 4.9:1 ≥ 4.5:1;--accent 白字仅 3.7:1) */
  --accent-strong: #4263eb;
  --accent-dim: #3a53ad;
  --success: #4FBF8B;
  --warn: #E0A94F;
  /* P0:禁红——错误态统一用 --warn 警示黄,不再使用红色 */
  --danger: #E0A94F;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --kb-inset: 0px; /* 键盘高度(visualViewport 实时写入,iOS 弹键盘不缩布局视口的补偿) */

  /* --- chat detail / process rail (R1-R8 deep-theme fix 2026-08-14) --- */
  /* 层:比 --card 更下沉,用于"退后一层"的辅助内容 */
  --card-sunken: oklch(0.185 0.006 285);
  /* 线:1px 分隔与描边,低对比 */
  --hairline:    oklch(0.30 0.008 285 / 0.55);
  /* 导轨:过程行左侧 2px,比 hairline 略亮以形成串联感 */
  --rail:        oklch(0.42 0.015 285);
  /* 字:次要 / 辅助文字 */
  --text-dim:    oklch(0.635 0.010 285);
  /* 强调弱化底:segmented 选中 / toggle 激活 */
  --accent-weak: oklch(0.48 0.085 265 / 0.24);
  /* 代码 / 工具明细块底 */
  --code-bg:     oklch(0.155 0.005 285);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
/* v0.10.13:锁宽——任何子树超宽都不允许产生页面级横向滚动(顶栏曾 404px/390 视口,整页可横拖) */
html, body { height: 100%; overflow-x: hidden; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  overscroll-behavior: none;
}
/* P0-3:dvh(Dynamic Viewport Height)适配 iPhone 12 Pro 等机型底部工具栏遮挡;
   100dvh 随浏览器 chrome 显隐动态缩放,确保 composer 始终可见;
   不支持 dvh 的旧浏览器退化到 100%(等同原有行为) */
#app { height: 100%; display: flex; flex-direction: column; }
@supports (height: 100dvh) {
  #app { height: 100dvh; }
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--border); border-radius: 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
a { color: var(--accent); }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 通用 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 600;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .4; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--warn); }
.btn.small { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 14px; }

#toast-root { position: fixed; left: 0; right: 0; bottom: calc(90px + var(--sab) + var(--kb-inset)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 99; pointer-events: none; }
/* v0.42.1:queuebar/runbar 可见时 toast 上移避免遮挡 */
#toast-root.with-qbar { bottom: calc(130px + var(--sab) + var(--kb-inset)); }
.toast {
  max-width: 86vw; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  background: #2a2a33; color: var(--text); box-shadow: 0 4px 18px rgba(0,0,0,.5);
  animation: fadein .15s ease;
}
.toast.err { background: #2a2618; color: #f0d080; }
/* 带操作按钮的 toast(归档撤销等) */
.toast.act { display: flex; align-items: center; gap: 12px; }
.toast-act { color: var(--accent); font-weight: 700; background: none; border: 0; padding: 0; font-size: 14px; }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--text2); border-top-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; vertical-align: -2px; }
@keyframes rot { to { transform: rotate(360deg); } }

/* v0.26.1 FV-1:离线时压制自动 loading(保留 .user-loading 手动 loading) */
.off-suppressed { display: none !important; }
.user-loading { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--text2); border-top-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; vertical-align: -2px; }

/* v0.26.1 FV-8:危险操作确认 Modal */
.danger-modal { background: #3a3218; color: #f0d080; border-radius: 12px; padding: 24px 20px; max-width: 360px; margin: 15vh auto 0; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.5); }
.danger-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.danger-cmd { background: rgba(0,0,0,.3); color: #fff; padding: 12px; border-radius: 8px; font-size: 14px; white-space: pre-wrap; word-break: break-all; margin: 0 0 20px; text-align: left; max-height: 200px; overflow-y: auto; }
.danger-actions { display: flex; gap: 12px; justify-content: center; }
.danger-cancel { padding: 10px 20px; font-size: 15px; border: 0; border-radius: 8px; background: rgba(255,255,255,.2); color: #fff; cursor: pointer; }
.danger-cancel:active { background: rgba(255,255,255,.3); }
.danger-confirm { padding: 10px 20px; font-size: 15px; border: 0; border-radius: 8px; background: #fff; color: #c49420; font-weight: 700; cursor: pointer; }
.danger-confirm[disabled] { background: rgba(255,255,255,.3); color: rgba(255,255,255,.5); cursor: not-allowed; }

/* v0.26.1 FV-9:权限四档 chip */
.perm-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; }
.perm-readonly { background: #374151; color: #d1d5db; }
.perm-standard { background: #14532d; color: #4ade80; }
.perm-elevated { background: #78350f; color: #fbbf24; }
.perm-yolo { background: #7f1d1d; color: #f87171; animation: perm-yolo-blink 1s ease-in-out infinite; }
@keyframes perm-yolo-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.offline-bar, .reconn-bar {
  padding: 6px 12px; text-align: center; font-size: 13px;
  background: #3a2f1c; color: var(--warn);
}
.reconn-bar { background: #2a2a33; color: var(--text2); }
.machine-bar {
  padding: 8px 14px; font-size: 13px;
  background: #1c2a3a; color: #9ecfff;
  border-bottom: 1px solid var(--border);
}
.machine-bar .link {
  background: transparent; border: none; color: var(--accent);
  text-decoration: underline; padding: 0; margin-left: 4px;
  font-size: 13px; cursor: pointer;
}

/* ---------- 登录页 ---------- */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 32px 24px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--text2); font-size: 14px; margin-bottom: 24px; }
.login-card input { width: 100%; height: 48px; padding: 0 14px; margin-bottom: 14px; }
.login-card .btn { width: 100%; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 8px; }

/* ---------- 顶栏 ---------- */
/* v0.10.13:三层独立布局——顶栏 sticky 吸顶(z-index 提到 20 盖住内容层);
   min-width:0 让 flex 子项可收缩,配合 html/body overflow-x:hidden 根治横溢 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
  padding: calc(8px + var(--sat)) 14px 8px;
  background: rgba(14,14,17,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  overscroll-behavior: contain;
}
.topbar h1 { font-size: 17px; font-weight: 700; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.52.9-F1:iOS WebKit 未重置 appearance 的 select 强制原生主题(灰蓝药丸),与自定义控件脱节;
   重置后 JS 增强失败兜底场景两平台一致 */
.machine-select { font: inherit; font-size: 13px; color: var(--text); background: var(--card2); background-image: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; outline: none; min-width: 0; -webkit-appearance: none; appearance: none; }
.machine-select:focus { border-color: var(--accent); }
/* v0.53 PRD §5.2:首页「设备|Agent」两段切换(顶栏分段控件,触控 ≥44px 高度由 .topbar 拉伸保证) */
.seg2 { flex: none; display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--card2); }
.seg2-btn { border: 0; background: transparent; color: var(--text2); font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 12px; cursor: pointer; min-height: 30px; }
.seg2-btn + .seg2-btn { border-left: 1px solid var(--border); }
.seg2-btn.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.seg2-btn:active { opacity: .75; }
@media (max-width: 420px) { .seg2-btn { padding: 6px 10px; font-size: 12px; } }
/* v0.26.15-FIX:聊天页机器下拉限宽(避免挤压 quota-chip/标题),且窄屏进一步压缩 */
.chat-machine-select { max-width: 96px; font-size: 12.5px; padding: 5px 8px; -webkit-appearance: none; appearance: none; background-image: none; }
.icon-btn { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--text2); font-size: 19px; }
/* v0.52.9-F2:顶栏图标统一 20px SVG,消灭文字字形随平台字体漂移(iOS PingFang vs 安卓 Roboto 基线参差) */
.topbar .icon-btn svg { width: 20px; height: 20px; display: block; }
.icon-btn:active { background: var(--card2); }
/* v0.10.13:窄屏(≤420px,全部手机竖屏)顶栏紧凑——收窄选择器/图标,
   低频动作(刷新/添加设备)收进 ⋮ 菜单(菜单内恒有,功能不减);
   作用域限 .topbar-list:fleet 页 btn-refresh 是其顶栏唯一刷新入口,不可隐藏 */
@media (max-width: 420px) {
  .topbar { gap: 6px; padding-left: 14px; padding-right: 14px; }
  .topbar h1 { font-size: 15px; min-width: 0; flex: 1 1 0; max-width: 55%; }
  /* v0.40.0:窄屏 icon-btn 也保底 44px(触控命中区 ≥44px) */
  .topbar .icon-btn { width: 44px; height: 44px; font-size: 17px; }
  .machine-select { max-width: 72px; padding: 5px 6px; font-size: 12px; }
  .chat-machine-select { max-width: 68px; font-size: 12px; padding: 5px 6px; }
  /* v0.33.5:窄屏隐藏低频按钮——fleet/work 收进 ⋮ 菜单,刷新/添加设备已隐藏 */
  .topbar-list #btn-refresh,
  .topbar-list #btn-machine-add,
  .topbar-list #btn-fleet,
  .topbar-list #btn-work { display: none; }
  /* v0.26.16:顶栏状态徽章窄屏压缩——纯图标模式 */
  .topbar .st { font-size: 0; gap: 0; }
  .topbar .st .dot { width: 10px; height: 10px; }
  /* v0.33.7:窄屏额度芯片——只显电池图标,文字隐藏,异常时角标徽章叠图标右上
     修复:v0.33.6 设 min-width:0 导致 SVG 未加载时 chip 缩成竖条;加 min-width:28px 保底 */
  .topbar .quota-chip { font-size: 0; gap: 0; padding: 4px 6px; min-width: 28px; width: auto; max-width: none; overflow: visible; height: 36px; box-sizing: border-box; position: relative; justify-content: center; }
  .topbar .quota-chip .q-battery { display: inline-flex; font-size: 14px; flex-shrink: 0; }
  .topbar .quota-chip .q-arrow { display: none; }
  .topbar .quota-chip .q-badge { position: absolute; top: 0; right: 0; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; border-radius: 7px; transform: translate(25%, -25%); }
  .topbar .fleet-h { font-size: 9px; padding: 1px 4px; margin-right: 4px; }
}

/* ---------- 搜索与筛选(对标 Claude App 极简设计) ---------- */
.list-tools { padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--border); }
/* v0.26.14: dup-toolbar 已移出 list-tools-row,独立全宽显示,不再被水平 flex 挤压 */
#dup-toolbar { width: 100%; box-sizing: border-box; flex-shrink: 0; }
#dup-toolbar span { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dup-toolbar button { flex: none; }
/* v0.26.12-REV7:搜索+chips 紧凑同行布局 */
.list-tools-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; min-width: 0; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
/* v0.52.9-F3:窄屏(390/393)筛选 pills 右溢出时给渐隐提示,替代「被切坏」观感;纯 CSS 无 JS */
.list-tools-row::-webkit-scrollbar { display: none; }
.list-tools-row .filter-chips { flex: 0 0 auto; min-width: 0; overflow-x: auto; }
/* v0.26.14:搜索框展开时,chips 收缩但不溢出 */
.list-tools-row .search-box { flex: 1 1 160px; min-width: 0; overflow: hidden; }
.search-toggle {
  flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--card2); border: 1px solid var(--border); font-size: 17px; color: var(--text2);
  transition: all .15s ease;
}
.search-toggle:active { background: var(--border); }
.search-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* v0.26.12-REV7:搜索框 inline 展开,不占满整行,与 chips 同行 */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px; flex: 1 1 auto; min-width: 0;
}
.list-tools-row .search-box { margin-bottom: 0; }
.search-box:focus-within { border-color: var(--accent); }
.search-ico { font-size: 16px; color: var(--text2); flex-shrink: 0; }
.search-box input {
  flex: 1; background: none; border: 0; outline: none;
  font-size: 15px; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.search-box input::placeholder { color: var(--text2); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--card); color: var(--text2); font-size: 18px;
  flex-shrink: 0; transition: opacity .15s ease;
}
.search-clear:active { background: var(--border); }
/* v0.8.3(P1-4):harness 筛选收进搜索框旁漏斗图标,首屏少一层 chrome */
.search-funnel {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text2); flex-shrink: 0; position: relative;
}
.search-funnel:active { background: var(--card); }
.search-funnel.on { color: var(--accent); }
.search-funnel.on::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
/* v0.68.21(hotfix 搜索窄):搜索展开时隐藏状态/工具 chips,搜索框占满整行
   (原 .search-box flex 1 1 160px 与 chips 同行,390 屏实测被挤压到 ~57px,输入框几乎不可用) */
.list-tools-row.search-open .filter-chips { display: none; }
.list-tools-row.search-open .search-box { flex: 1 1 auto; min-width: 0; }
.list-tools-row.search-open .search-box input { font-size: 16px; }
/* v0.68.21(hotfix 搜索慢):搜索态顶部「匹配 N 条」即时反馈 */
.search-result-count {
  padding: 6px 4px 2px; font-size: 12px; color: var(--text2); line-height: 1.4;
}

.filter-chips {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  flex: 1 1 auto; min-width: 0;
}
/* v0.26.12-REV7:搜索框展开时,chips 缩小不换行 */
.search-toggle.active ~ .filter-chips { flex: 0 1 auto; }
.filter-chips:first-child { flex: 0 1 auto; }
/* v0.8.3(P1-4):harness 条;v0.28.0 恢复默认展开(可发现性回退修复) */
.harness-row { display: flex; margin-bottom: 4px; }
.harness-row.open { display: flex; }
.filter-chips::-webkit-scrollbar { display: none; /* Chrome/Safari */ }
.fchip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 99px;
  background: var(--card2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text2); white-space: nowrap;
  transition: all .15s ease;
}
/* v0.26.12: 重名筛选 chip 的数字 badge */
.dup-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; line-height: 18px;
  border-radius: 9px; margin-left: 4px; font-size: 11px; font-weight: 600; text-align: center;
  background: rgba(255,179,71,.18); color: #ffb347;
}
.fchip.on .dup-badge { background: rgba(255,255,255,.22); color: #fff; }
.fchip:active { transform: scale(.96); }
.fchip.on {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 500;
}

/* ---------- v0.26.8 强制刷新已收进三点菜单,不再独立放 banner/顶栏按钮 ---------- */

/* ---------- 会话列表 ---------- */
/* v0.10.13:内容层独立滚动 + overscroll contain(滚到头不传导给页面,顶栏拖动同理) */
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wrap { max-width: 760px; margin: 0 auto; padding: 10px 14px calc(20px + var(--sab)); }
/* v0.26.14-排版修复:会话列表容器必须避让底部导航栏(56px)+ FAB(44px)+ 呼吸空间(60px),否则最后卡片被裁切 */
#sess-wrap { padding: 10px 14px calc(20px + var(--sab) + 56px + 100px); }
/* P1-6 修复:桌面端充分利用宽度 */
@media (min-width: 1024px) {
  .wrap { max-width: 960px; }
  #sess-wrap { max-width: 960px; }
  .msgs-inner { max-width: 960px; }
  .composer-inner { max-width: 960px; }
}

/* 左滑操作(对标 iOS Mail / Claude App):actions 绝对定位藏在卡片右缘,卡片左移露出 */
.sess-row { position: relative; overflow: hidden; margin-bottom: 10px; border-radius: 14px; touch-action: pan-y; }
.sess-row .sess-item { margin-bottom: 0; position: relative; z-index: 1; transition: transform .18s ease; touch-action: pan-y; }
.sess-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; z-index: 0; }
/* v0.40.0:swipe-act 保底 min-height:44px(触控命中区) */
.swipe-act { width: 76px; height: 100%; min-height: 44px; color: #fff; font-size: 14px; font-weight: 600; }
.swipe-act.pin { background: var(--accent); }
.swipe-act.arch { background: var(--danger); }
.swipe-act.arch.restore { background: var(--success); }
/* 归档折叠移除(配合 JS 先定高再加 .gone) */
.sess-row.gone { transition: height .2s ease, opacity .2s ease, margin-bottom .2s ease; height: 0 !important; opacity: 0; margin-bottom: 0; }

.sess-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  /* v0.26.14-排版修复:右侧内边距 14→56px,避让右下角 FAB(44px宽+16px右边距=60px覆盖带) */
  padding: 13px 56px 13px 14px; margin-bottom: 10px;
}
/* 入场动画只给非静默渲染(进列表/手动刷新);15s 轮询静默刷新不播,否则半透明瞬间露出左滑操作钮+卡片位移(owner 2026-07-24 反馈) */
.anim-in .sess-item { animation: fadein .15s ease; }
.sess-item:active { background: var(--card2); }
.sess-main { flex: 1; min-width: 0; }
.sess-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.8.3(P0-3):标题行 = 标题 + 右侧主状态点(色点+文字),meta 行只留单色次要标签 */
.sess-head { display: flex; align-items: center; gap: 8px; }
.sess-head .sess-title { flex: 1; min-width: 0; }
.sess-status { flex: none; display: inline-flex; align-items: center; }
.sess-chev { color: var(--text2); flex: none; }
/* P1-5:最后消息预览(对标 Claude App) */
.sess-preview { font-size: 13px; color: var(--text2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-snippet { font-size: 12.5px; color: var(--text3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sess-meta { font-size: 12.5px; color: var(--text2); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* v0.8.3(P0-3):模型/Harness/设备/来源统一降为单色次要标签(≥12px),色彩噪声只留状态点 */
.meta-chip {
  font-size: 12px; color: var(--text2); background: var(--card2);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
  white-space: nowrap;
}
/* v0.8.3(P1-7):路径等等宽信息加轻微底色区块 */
.path-chip {
  font-family: var(--mono); font-size: 11.5px; color: var(--text2);
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--text2); }
.badge.busy { color: var(--accent); border-color: var(--accent-dim); }
.badge.pending { color: var(--warn); border-color: #57431f; }
.badge.archived { opacity: .7; }
/* v0.41.0(LINEAGE):子代理+接力徽标 */
.badge.subagent { color: #a78bfa; border-color: #7c3aed33; background: #7c3aed18; font-size: 10px; padding: 0 6px; }
.badge.relay { color: #38bdf8; border-color: #0ea5e933; background: #0ea5e918; font-size: 10px; padding: 0 6px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.52.7 棒6a2:等拍板 badge——中性蓝紫,禁黄禁⚠;ico 单独设 font-size(禁 font-size:0 灭 emoji) */
.badge.await-badge { color: var(--await); border-color: rgba(123,140,255,.35); background: rgba(123,140,255,.08); max-width: 200px; }
.badge.await-badge .ico { font-size: 14px; line-height: 1; }
.badge.await-badge .lbl { font-size: 11px; white-space: nowrap; }
.fleet-subagent { opacity: .75; }
.fleet-subagent-toggle { display: flex; gap: 6px; margin: 0 0 8px; }
.fleet-subagent-toggle .tg-subagent { border: 1px solid #7c3aed44; background: #7c3aed0d; color: #a78bfa; border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.fleet-subagent-toggle .tg-subagent.on { background: #7c3aed22; border-color: #7c3aed66; }
.fleet-subagent-count { display: inline-block; min-width: 14px; height: 14px; border-radius: 7px; background: #7c3aed44; color: #fff; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; padding: 0 3px; }
/* v0.42.0(LINEAGE-II):子代理折叠到父会话下 */
.fleet-children { padding-left: 16px; border-left: 2px solid #7c3aed33; margin-left: 12px; }
.fleet-child { opacity: .85; font-size: 13px !important; }
.fleet-child .sess-title { font-size: 13px !important; }
.fleet-child-count { display: inline-block; margin-left: 6px; font-size: 10px; color: #a78bfa; font-weight: 600; }
.fleet-probe { opacity: .55; }
.fleet-probe .sess-title { font-size: 12px !important; }
.empty { text-align: center; color: var(--text2); padding: 60px 20px; font-size: 14px; }
/* v0.10.6:加载失败重试入口(消息列表首载 / 智能层快照)。复用 accent 链接色,加粗+可点。 */
.load-retry { padding: 60px 20px; }
.retry-link { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }
.retry-link:hover { text-decoration: underline; }
.retry-msg { color: var(--text2); }
.menu { position: relative; }
/* P2-2 修复:菜单弹出增加过渡动画 */
.menu-pop {
  position: absolute; right: 0; top: 46px; min-width: 170px; z-index: 30;
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: 0 8px 30px rgba(0,0,0,.55);
  animation: fadein .12s ease;
}
/* v0.8.3(P1-5):菜单项 = 前置图标 + 文案(两列对齐);置灰项沉底 + 分隔线 */
.menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 8px; font-size: 15px; }
.menu-pop button:active { background: var(--card); }
.menu-ico { flex: none; width: 20px; text-align: center; font-size: 15px; }
.menu-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.menu-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.8.3(P1-11):置灰项不再用 opacity 压对比(旧 .45 后 <3:1),改实色灰 ≥3:1 */
.menu-pop button.menu-disabled { color: #82828c; cursor: default; }
.menu-pop button.menu-disabled .menu-ico { opacity: .6; }
.menu-pop button.menu-disabled:active { background: transparent; }
.menu-sub { display: block; font-size: 11px; color: var(--text2); margin-top: 1px; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 8px; }

/* ---------- 弹层 ---------- */
/* v0.26.15-FIX:mask z-index 提至 9100,必须压过 zr-bottom-bar(z-index:8998)与 composer,否则底部栏会盖在确认框上面导致按钮不可点/显示不全 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9100; display: flex; align-items: flex-end; justify-content: center; touch-action: none; /* v0.37.1-FIX:mask 本身绝不应参与手势竞争,把 pan 让给内部 sheet */ }
.zr-work-mask { align-items: safe center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 18px 18px 0 0;
  /* v0.26.15-FIX:底部统一 +56px 避让 zr-bottom-bar(56px)+safe-area,所有 sheet(确认/秒记/下拉单等)都不被底部栏遮挡 */
  padding: 20px 18px calc(20px + 56px + var(--sab));
  animation: sheetup .18s ease;
}
/* v0.26.12-REV7:秒记弹窗 — 居中显示,键盘弹起时自适应 */
/* v0.43.2:输入框加大+留白收敛 — textarea 占弹窗主体,去掉多余 padding */
.zr-quick-sheet {
  max-height: 80vh;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  /* 关闭贴底模式,改为居中 */
  margin-bottom: auto;
  margin-top: auto;
}
.zr-quick-sheet h2 { margin-bottom: 8px; font-size: 16px; flex-shrink: 0; }
.zr-quick-hint { font-size: 13px; color: var(--text2); margin-bottom: 10px; flex-shrink: 0; }
/* 输入框:自适应填满弹窗主体,最小 140px,多行可用 */
.zr-qn-input {
  width: 100%;
  min-height: 140px;
  flex: 1;
  padding: 12px;
  font-size: 15px;
  line-height: 1.6;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}
.zr-qn-input:focus { outline: none; border-color: var(--primary); }
.zr-qn-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text2); padding: 6px 0; flex-shrink: 0; }
.zr-quick-sheet .zr-qn-bar { position: sticky; bottom: 0; padding-top: 8px; background: var(--card); border-top: 1px solid var(--border); flex-shrink: 0; }
/* 键盘弹起时 sheet 自适应缩小 */
@media (max-height: 600px) {
  .zr-quick-sheet { max-height: 85vh; padding-top: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .zr-quick-hint { display: none; /* 键盘弹起时隐藏提示文字节省空间 */ }
  .zr-qn-input { min-height: 100px; }
}
@media (max-height: 450px) {
  .zr-quick-sheet { max-height: 90vh; }
  .zr-qn-input { min-height: 80px; }
}
@keyframes sheetup { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 17px; margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.field input, .field select { width: 100%; height: 46px; padding: 0 12px; }
.field textarea { width: 100%; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 12.5px; padding: 5px 10px; border-radius: 99px; background: var(--card2); border: 1px solid var(--border); color: var(--text2); }
.chip.on { border-color: var(--accent); background: rgba(91,124,250,.12); color: var(--text); }
/* v0.66.0 hotfix:按设备真值表过滤——当前设备不可建的 harness 灰显(禁用+降透明+虚线边框+原因 title) */
.chip.chip-off { opacity: .42; border-style: dashed; cursor: not-allowed; background: var(--card); color: var(--text2); }
.ns-note { font-size: 12.5px; color: var(--text2); padding: 8px 0; line-height: 1.5; }
.sheet-row { display: flex; gap: 10px; margin-top: 18px; }
.sheet-row .btn { flex: 1; }
/* v0.26.12-REV8:确认弹窗样式(v0.26.15-FIX:底部额外+56px避让zr-bottom-bar,确认/取消按钮不被遮挡) */
.zr-confirm-sheet { max-width: 400px; padding: 24px 18px calc(24px + 56px + var(--sab)); }
.zr-confirm-sheet h2 { font-size: 17px; margin-bottom: 8px; text-align: center; }
.zr-confirm-desc { font-size: 14px; color: var(--text2); text-align: center; margin-bottom: 20px; line-height: 1.5; }
.zr-confirm-bar { display: flex; gap: 10px; }
.zr-confirm-bar .btn { flex: 1; }
.switch-row { display: flex; align-items: center; justify-content: space-between; min-height: 46px; }

/* ---------- 聊天页 ---------- */
.msgs { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; overflow-anchor: none; }
.msgs-inner { max-width: 760px; margin: 0 auto; padding: 14px 14px 8px; }
/* P2-3 修复:消息间距从 14px 收紧到 10px,增强对话感 */
.msg {
  margin-bottom: 10px;
  /* 视口外消息跳过布局/绘制:虚拟列表 80% 收益零 JS 成本(Safari 15.4+ 支持,旧浏览器退化) */
  content-visibility: auto;
  contain-intrinsic-size: 0 90px;
}
/* v0.52.20:翻页锚定期间强制真实布局——屏外 .msg 的 contain-intrinsic-size 90px 占位
   让锚定算术整体失效(估算 rel 恒 -176 不随滚动变化,krReanchor 步进反向空转);
   翻页操作短时挂 cv-off(≤3.6s,~150 节点全量布局可忽略),锚定五棒结束后摘除恢复虚拟化。 */
#msg-list.cv-off .msg { content-visibility: visible; }
#msg-list.cv-off pre.code { content-visibility: visible; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  max-width: 82%; background: var(--accent); color: #fff;
  border-radius: 16px 16px 4px 16px; padding: 10px 14px;
  white-space: pre-wrap; word-break: break-word; font-size: 15px;
}
/* P2-4 修复:assistant bubble 内边距从 2px 增加到 4px 8px,避免内容贴边 */
.msg.assistant .bubble { padding: 4px 8px; font-size: 15px; word-break: break-word; }
/* v0.59:失败轮次气泡(zcode/claude turn_failed + 本地 error)红边框标红,一眼可辨 */
.msg.assistant .bubble.fd-msg-err { border: 1px solid var(--danger); border-radius: 10px; background: rgba(224,169,79,.07); }
.msg .role { font-size: 11.5px; color: var(--text2); margin-bottom: 4px; }
.msg .files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.file-pill { font-size: 12px; padding: 4px 10px; border-radius: 8px; background: var(--card2); border: 1px solid var(--border); color: var(--text2); }
.chat-thumb { max-width: 160px; max-height: 160px; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; object-fit: cover; }
.chat-thumb:active { transform: scale(1.02); }
.img-lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.img-lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }
.tool-preview { font-size: 12px; color: var(--text2); font-family: var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 60px; overflow: hidden; }
.tool-full { font-size: 12px; color: var(--text2); font-family: var(--mono); white-space: pre-wrap; word-break: break-all; }

/* markdown */
.bubble p { margin: 6px 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: 14px 0 6px; line-height: 1.35; }
.bubble h1 { font-size: 19px; } .bubble h2 { font-size: 17.5px; } .bubble h3 { font-size: 16px; } .bubble h4 { font-size: 15px; }
.bubble ul, .bubble ol { margin: 6px 0 6px 22px; }
.bubble li { margin: 3px 0; }
.bubble blockquote { border-left: 3px solid var(--border); padding: 2px 12px; margin: 8px 0; color: var(--text2); }
.bubble hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.bubble code.inline { font-family: var(--mono); font-size: 13px; background: var(--card2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
pre.code { background: #101014; border: 1px solid var(--border); border-radius: 12px; margin: 10px 0; overflow: hidden;
  /* 代码块延迟布局 */
  content-visibility: auto; contain-intrinsic-size: 0 120px;
}
pre.code .code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: var(--card2); font-size: 12px; color: var(--text2); }
.copy-btn { font-size: 13px; color: var(--text2); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border); min-width: 32px; }
pre.code code { display: block; font-family: var(--mono); font-size: 13px; line-height: 1.5; padding: 12px; overflow-x: auto; white-space: pre; }
.table-wrap { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; font-size: 13.5px; min-width: 60%; }
th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
th { background: var(--card2); }

/* tool / thinking 折叠卡 */
details.tool-card, details.think-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  margin: 8px 0; overflow: hidden;
  /* 闭合折叠卡跳过内部布局,打开时才做(配合 JS 惰性挂载,真正省 DOM 构建成本) */
}
details.tool-card:not([open]) .body, details.think-card:not([open]) .body { display: none; }
details.tool-card summary, details.think-card summary {
  list-style: none; cursor: pointer; padding: 9px 12px; font-size: 13px; color: var(--text2);
  display: flex; align-items: center; gap: 8px; user-select: none;
}
details.tool-card summary::-webkit-details-marker, details.think-card summary::-webkit-details-marker { display: none; }
.tool-name { font-family: var(--mono); font-size: 12.5px; color: var(--accent); }
.tool-sum { font-family: var(--mono); font-size: 11.5px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
details.tool-card .body, details.think-card .body { padding: 0 12px 10px; font-family: var(--mono); font-size: 12px; color: var(--text2); white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; }
details.think-card .body { color: #8b8b96; font-family: inherit; font-size: 13px; }
details.tool-card summary::after, details.think-card summary::after { content: "›"; margin-left: auto; transition: transform .12s; }
details[open].tool-card summary::after, details[open].think-card summary::after { transform: rotate(90deg); }
/* tool 惰性展开按钮 */
.tool-expand { display: block; margin-top: 6px; font-size: 12px; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; font-family: inherit; }
/* 长文本懒展开 */
.long-more { display: inline; color: var(--accent); cursor: pointer; font-size: 13px; }

/* 审批 / 提问卡 */
.action-card {
  position: sticky; top: 8px; z-index: 5;
  background: #221d14; border: 1px solid #57431f; border-radius: 14px;
  padding: 12px 14px; margin-bottom: 12px;
}
.action-card.q { background: var(--card); border-color: var(--accent-dim); }
.action-card .ac-title { font-size: 13.5px; font-weight: 600; color: var(--warn); margin-bottom: 6px; }
.action-card.q .ac-title { color: var(--accent); }
.action-card .ac-meta { font-size: 11.5px; color: var(--text3); margin: -2px 0 8px; }
.action-card .ac-body { font-size: 13px; color: var(--text2); font-family: var(--mono); max-height: 140px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }
.action-card .ac-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ac-actions .btn { min-height: 38px; font-size: 14px; }
/* v0.68.4:审批卡可读化——风险点醒目(删除/外发/覆写=红,写盘=橙),机器字段折叠收起 */
.action-card .ac-risks { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.action-card .ac-risk-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  color: #f87171; background: rgba(248, 113, 113, .14);
  border: 1px solid rgba(248, 113, 113, .4);
  border-radius: 999px; padding: 2px 10px;
}
.action-card .ac-title.ac-risk-danger { color: #f87171; }
.action-card .ac-body.ac-risk-danger { color: #fca5a5; border-left: 3px solid rgba(248, 113, 113, .6); padding-left: 8px; }
.action-card .ac-title.ac-risk-write { color: #fbbf24; }
.action-card .ac-body.ac-risk-write { color: #fde68a; border-left: 3px solid rgba(251, 191, 36, .55); padding-left: 8px; }
.action-card .ac-machine { font-size: 11.5px; color: var(--text3); margin: 0 0 8px; }
.action-card .ac-machine summary { cursor: pointer; color: var(--text3); user-select: none; }
.action-card .ac-machine-row { display: flex; gap: 8px; padding: 2px 0; font-family: var(--mono); }
.action-card .ac-machine-k { color: var(--text3); flex: 0 0 auto; }
.action-card .ac-machine-v { color: var(--text2); word-break: break-all; }
/* v0.65.9:YOLO 自动批准呈现窗——先让用户看清要批什么,再给可打断入口(390 优先,touch>=44) */
.action-card .ac-auto {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--warn); line-height: 1.5;
  background: rgba(224, 169, 79, .10); border: 1px solid rgba(224, 169, 79, .32);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 10px;
}
.action-card .ac-auto b { font-variant-numeric: tabular-nums; font-weight: 700; }
.action-card .ac-auto .ac-auto-keep { margin-left: auto; min-height: 44px; font-size: 13px; white-space: nowrap; }
@media (max-width: 480px) {
  .action-card .ac-auto .ac-auto-keep { margin-left: 0; width: 100%; }
}
/* v0.65.9:数据陈旧 / 回源失败的可见降级提示——替代此前的静默吃旧值 */
.fresh-warn {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; line-height: 1.5; color: var(--warn);
  background: rgba(224, 169, 79, .10); border: 1px solid rgba(224, 169, 79, .32);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 10px;
}
.fresh-warn.err { color: var(--danger); background: rgba(224, 169, 79, .16); border-color: rgba(224, 169, 79, .48); }
.fresh-warn .fw-text { flex: 1 1 auto; min-width: 0; }
.fresh-warn .fw-refresh { margin-left: auto; min-height: 44px; font-size: 13px; white-space: nowrap; }
@media (max-width: 480px) {
  .fresh-warn .fw-refresh { margin-left: 0; width: 100%; }
}
.opt-btn { display: block; width: 100%; text-align: left; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 14.5px; }
.opt-btn.sel { border-color: var(--accent); background: rgba(91,124,250,.12); }
/* v0.67:未开通能力(如 mimo-ultraspeed)灰显——保留可点,点击由 onPick 拦截给「需申请开通」提示 */
.opt-btn.opt-btn-off { opacity: .5; cursor: not-allowed; background: var(--card); color: var(--text2); }
/* v0.6.3:选项名称/描述各占一行,单行省略号——治 iOS 原生 select 弹层字大且截断 */
.opt-btn .opt-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-btn .opt-desc { display: block; font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* v0.8.8:接力副本徽标(可点)+ 副本浮层项(chip + 单行摘要) */
.relay-badge { cursor: pointer; color: var(--accent); font-weight: 600; }
.relay-badge:active { opacity: .6; }
.relay-mirror-item { display: flex; align-items: center; }
.relay-mirror-item .rm-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.6.3:新建面板自定义选择字段(替代原生 <select>),单行「名称 — 描述」超出省略号 */
/* v0.8.3(P0-1):右侧 16px chevron ⌄ 给出「这是个选择器,可点」的提示 */
.ns-pick { display: block; position: relative; width: 100%; min-height: 46px; padding: 11px 34px 11px 12px; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; text-align: left; font-size: 14.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ns-pick::after { content: '⌄'; position: absolute; right: 10px; top: 50%; transform: translateY(-52%); font-size: 16px; line-height: 1; color: var(--text2); pointer-events: none; }
.ns-pick:active { border-color: var(--accent); }
.ns-pick-label { white-space: nowrap; }
.ns-pick-desc { color: var(--text2); font-size: 12.5px; }
/* v0.8.3(P1-10):harness 选中态统一蓝色实心 + 白字(对齐首页 fchip.on;旧细蓝描边与实心不一致) */
#ns-harness .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
/* v0.8.3(P0-1):创建改 sticky 底部主按钮,字段再多也始终可见 */
.ns-create-bar {
  position: sticky; bottom: 0; z-index: 2;
  margin: 18px -18px calc(-20px - var(--sab));
  padding: 12px 18px calc(12px + var(--sab));
  background: var(--card); border-top: 1px solid var(--border);
}
.ns-create { width: 100%; min-height: 48px; font-size: 16px; background: var(--accent-strong); border-color: var(--accent-strong); }
/* v0.8.3(P2-12):Plan 模式原生 checkbox 改主题 Switch(选中蓝,触达区整行 ≥44px) */
.kr-switch-row { cursor: pointer; }
.kr-switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.kr-switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.kr-switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--card2); border: 1px solid var(--border); transition: background .15s ease, border-color .15s ease; pointer-events: none; }
.kr-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text2); transition: left .15s ease, background .15s ease; }
.kr-switch input:checked + i { background: var(--accent-strong); border-color: var(--accent-strong); }
.kr-switch input:checked + i::after { left: 21px; background: #fff; }

/* 回到底部 */
.to-bottom {
  position: absolute; right: 16px; bottom: 96px; z-index: 8;
  min-width: 40px; height: 40px; border-radius: 20px;
  background: var(--card2); border: 1px solid var(--border); color: var(--text2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  padding: 0 12px; box-shadow: 0 4px 14px rgba(0,0,0,.4);
  white-space: nowrap;
  /* v0.42.1:runbar 显示时上移避免重叠 */
  transition: bottom .2s ease;
}
.to-bottom.has-new {
  background: var(--accent); color: #fff; border-color: var(--accent);
  font-size: 13px; font-weight: 600; padding: 0 14px;
}

/* ---------- composer ---------- */
/* P0-3:底部安全区 + 键盘补偿;max() 兜底确保微信浏览器等 env() 返回 0 时仍有最小边距 */
/* v0.9.11 / v0.25.12:底部 composer 上滑隐藏/下滑展开,增加阅读区空间(CHANGELOG v0.9.11 已记录但此前未落地)
   — 用户手指上滑(继续阅读)时 composer 下移隐藏;下滑(想输入/操作)时立即滑回展开。
   键盘升起(KB-flag)或内容少于一屏时禁用收起,避免误藏找不到输入框。
   touch-action: manipulation 避免 300ms 点击延迟。 */
.composer {
  border-top: 1px solid var(--border); background: rgba(14,14,17,.94); backdrop-filter: blur(12px);
  padding: 8px 12px max(calc(10px + var(--kb-inset)), calc(10px + var(--sab) + var(--kb-inset)));
  transition: transform .22s ease, padding-bottom .15s ease, box-shadow .2s ease, opacity .18s ease;
  position: sticky; bottom: 0; z-index: 5;
  touch-action: manipulation;
}
.composer.slide-hide { transform: translateY(100%); box-shadow: none; opacity: .92; }
.composer.slide-hide + * { /* 无,防止错位 */ }
.composer.kb-open { transform: none !important; } /* 键盘升起强制展开 */
.view.short .composer { transform: none !important; } /* 内容不足一屏强制展开 */

.composer-inner { max-width: 900px; margin: 0 auto; position: relative; }
.attach-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--card2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 220px; }
.attach-chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .p { color: var(--accent); font-variant-numeric: tabular-nums; }
.attach-chip .x { color: var(--text2); font-size: 14px; padding: 0 2px; }
.input-row { display: flex; align-items: flex-end; gap: 10px; }
.input-row textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 52px;
  padding: 14px 16px; border-radius: 16px; font-size: 16px; line-height: 1.5;
}
/* v0.6.7:他源详情输入框 #fd-input 字号/行高/padding/圆角与 Kimi 会话 #input(.input-wrap textarea)完全一致,
   修「字号过大、输入几字就折行溢出」;保留 .input-row 的 flex:1 内联发送键布局 */
#fd-input {
  font-size: 15px; line-height: 1.45;
  padding: 13px 14px; border-radius: 14px;
  min-height: 52px; max-height: 132px;
  background: var(--card2);
}
.round-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card2); border: 1px solid var(--border); color: var(--text2); font-size: 19px;
}
/* v0.8.3(P0-2):发送键统一为最强视觉——有内容蓝色实心白图标(对比 ≥4.5:1),空态降灰;
   Kimi 会话(.action-row)与他源详情(.input-row)同规格 40×40 */
.round-btn.send { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.round-btn.send[disabled] { background: var(--card2); color: var(--text2); border-color: var(--border); }
.input-row .round-btn.send { width: 38px; height: 38px; font-size: 16px; flex: none; }
.round-btn:active { transform: scale(.95); }

/* Step0 热修·sending态视觉:与纯空内容disabled有视觉区分(微透明+呼吸光动画) */
.round-btn.send.sending {
  opacity: .72; cursor: progress;
  animation: sendPulse 1.1s ease-in-out infinite;
  background: var(--accent-strong) !important;
  color: #fff !important;
  border-color: var(--accent-strong) !important;
}
@keyframes sendPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(64,158,255,0); }
  50% { box-shadow: 0 0 0 6px rgba(64,158,255,.18); }
}

/* 加载失败/空白重试按钮样式兜底(与双空兜底UI联动) */
.empty.load-retry { background: transparent !important; border: none !important; }
.empty.load-retry .btn.primary {
  background: var(--accent-strong); color: #fff; border: 1px solid var(--accent-strong);
  border-radius: 10px; font-size: 14px; font-weight: 500;
}

/* / 指令面板 */
.slash-panel {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20;
  max-height: 300px; overflow-y: auto;
  background: var(--card2); border: 1px solid var(--border); border-radius: 14px; padding: 6px;
  box-shadow: 0 -6px 30px rgba(0,0,0,.5);
}
.slash-item { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 10px 12px; border-radius: 9px; }
.slash-item.sel { background: rgba(91,124,250,.16); }
.slash-item .cmd { font-family: var(--mono); font-size: 14px; color: var(--accent); flex: none; }
.slash-item .desc { font-size: 12.5px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- v0.2:状态反馈 ---------- */
/* 状态点(列表行/详情顶栏共用) */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.st .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text2); flex: none; }
.st-run { color: var(--success); }
.st-run .dot { background: var(--success); }
.st-pend { color: var(--warn); }
.st-pend .dot { background: var(--warn); }
.st-idle { color: var(--text2); }
.st-idle .dot { background: #4a4a55; }
/* v0.52.7 棒6a2:等拍板状态点——实心无 pulse(漏报可忍误报不可忍,不做动效抢注意) */
.st-await { color: var(--await); }
.st-await .dot { background: var(--await); }
/* v0.46.0:发送失败状态(红色) */
.st-fail { color: var(--err); }
.st-fail .dot { background: var(--err); }
/* v0.26.16:纯图标状态(顶栏窄屏)——隐藏文字只保留点,通过 title 属性提供明文 */
.st-icon-only { font-size: 0; gap: 0; cursor: default; }
.st-icon-only .dot { width: 10px; height: 10px; }
.dot.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}

/* 运行指示条(消息区底部) */
#runbar, #fd-runbar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 12px calc(4px + var(--sab) / 2);
  font-size: 13px; color: var(--text2);
  background: linear-gradient(transparent, rgba(14,14,17,.85));
  /* v0.42.1:低于 toast z-index:99,避免与定位 toast 重叠 */
  position: relative; z-index: 5;
}
.tdots { display: inline-flex; gap: 4px; }
.tdots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: tbounce 1.2s ease-in-out infinite;
}
.tdots i:nth-child(2) { animation-delay: .15s; }
.tdots i:nth-child(3) { animation-delay: .3s; }
@keyframes tbounce {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(-4px); opacity: 1; }
}
/* v0.68.15:运行条「在跑什么」对齐 Kimi Code——转动 spinner + 阶段色(空闲/等待/思考/生成/编排/卡死可辨) */
#runbar .spin { border-color: var(--accent); border-top-color: transparent; width: 12px; height: 12px; flex: none; }
#runbar-text.phase-wait { color: #4fc3dc; }
#runbar-text.phase-stuck { color: var(--warn); }
#runbar-text.phase-orch { color: #7c4dff; }

/* 消息回执状态 */
/* v0.8.3(P1-6):时间戳不再独占一行,浮动进气泡右下角(11px 次要灰;跨分钟才输出,见 shouldShowMsgTime) */
.msg-time { float: right; margin: 6px 0 0 12px; font-size: 11px; line-height: 1.4; opacity: .75; }
.msg.user .msg-time { color: rgba(255,255,255,.85); }
.msg.assistant .msg-time { color: var(--text2); }
.msg.user.pending .bubble { opacity: .88; }
/* v0.40.1:gap 指示消息——最新指令在消息窗口外时,气泡稍淡+左边框标记 */
.msg.user.gap-indicator .bubble { opacity: .92; border-left: 3px solid rgba(255,255,255,.4); }
.msg-status { font-size: 11.5px; color: rgba(255,255,255,.9); }
.msg-status.ok { color: #d6ffe9; }
.msg-status.queued { color: #ffe9c2; }
.msg-status.running { color: #c2e0ff; }
.msg-status.failed { color: #ffd2d2; text-decoration: underline; cursor: pointer; }
.msg-status.cancelled { color: #cfcfd6; }
.msg-status .spin { border-color: rgba(255,255,255,.7); border-top-color: transparent; width: 11px; height: 11px; }

/* 骨架屏 v0.26.12:改用高对比度的灰度,避免与背景同色看不见 */
.skel-item, .skel-msg {
  border-radius: 14px; margin-bottom: 10px;
  background: linear-gradient(90deg,
    #26262e 0%,   /* 深色停 */
    #3a3a44 40%,  /* 中色移动 */
    #26262e 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-item { height: 64px; }
.skel-msg { height: 74px; width: 86%; }
.skel-msg.w60 { width: 60%; margin-left: auto; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* composer 提示条(待审批锁定/排队提示) */
.composer-hint {
  margin-bottom: 6px; padding: 7px 12px; border-radius: 10px;
  background: #2a2416; color: var(--warn); font-size: 13px; text-align: center;
}

/* ⚡/■ 按钮:v0.8.3(P0-2)降为描边/次要色,发送键才是最强视觉(旧彩字彩边抢镜) */
.round-btn.steer, .round-btn.stop { background: transparent; color: var(--text2); border-color: var(--border); }
.round-btn.steer:active { color: var(--warn); border-color: #57431f; }
.round-btn.stop:active { color: var(--danger); border-color: #5a2a2a; }

/* 列表行 cwd 副标题(走查 v0.2.1) */
.sess-cwd {
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 11px; opacity: .75;
}

/* ---------- v0.3:会话体验 ---------- */
/* 置顶图标与来源 tag */
.pin { margin-right: 5px; font-size: 13px; }
.sess-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 99px;
  background: var(--card2); border: 1px solid var(--border); color: var(--text2);
  max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sess-tag.machine { color: var(--accent); border-color: var(--accent); }

/* 会话信息条 */
#infobar, #fd-infobar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px 14px; border-bottom: 1px solid var(--border);
  background: rgba(14,14,17,.9); font-size: 12.5px;
}
.info-chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  background: var(--card2); border: 1px solid var(--border); color: var(--text2);
  font-size: 12px; min-height: 26px;
}
button.info-chip:active { border-color: var(--accent); color: var(--text); }
.info-chip.static { opacity: .8; }

/* 系统注入卡 */
details.inject-card {
  max-width: 82%; margin: 6px 0 2px auto;
  background: #14141a; border: 1px dashed #2e2e3a; border-radius: 12px; overflow: hidden;
}
details.inject-card summary {
  list-style: none; cursor: pointer; padding: 7px 12px;
  font-size: 12px; color: #8e8e99; user-select: none; /* v0.8.3(P1-7):#7a7a88 对比不足 */
}
details.inject-card summary::-webkit-details-marker { display: none; }
details.inject-card .body {
  padding: 0 12px 10px; font-family: var(--mono); font-size: 11.5px; color: #83838e; /* v0.8.3(P1-7) */
  white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto;
}
details.inject-card summary::after { content: "›"; margin-left: 8px; float: right; transition: transform .12s; }
details[open].inject-card summary::after { transform: rotate(90deg); }

/* composer 两行重构:输入框全宽 + 操作行 */
.input-wrap textarea {
  width: 100%; resize: none; min-height: 48px; max-height: 132px;
  padding: 12px 14px; border-radius: 14px; font-size: 15px; line-height: 1.45;
  background: var(--card2);
}
/* v0.54.3:按钮收小 44→38(王佐令"都改小一点"),行距收紧 8→6,底部堆叠整体减高 */
.action-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.action-row .act-left { display: flex; gap: 6px; flex-wrap: wrap; }
.action-row .act-right { display: flex; gap: 6px; align-items: center; }
.action-row .round-btn { width: 38px; height: 38px; font-size: 15px; }
/* 快捷按钮(非发送/停止)在宽屏(≥640px)展开全部,窄屏默认收起2个,点「⋯」再展开(避免输入区拥挤) */
@media (max-width: 639px) {
  .action-row .round-btn.quick-fold { display: none; }
  .action-row.unfold .round-btn.quick-fold { display: inline-flex; }
}

/* 提问卡子问题分组(v0.4.1) */
.q-sub { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.q-sub:last-child { border-bottom: 0; margin-bottom: 2px; }
.q-sub-head { font-size: 13px; font-weight: 600; color: var(--text); margin: 6px 0 6px; }
.q-sub-body { font-size: 12.5px; color: var(--text2); margin-bottom: 8px; }
.q-other {
  width: 100%; height: 42px; padding: 0 12px; margin-top: 2px;
  font-size: 14px; background: var(--card2);
}
.error-card {
  padding: 10px 12px; border: 1px dashed var(--danger); border-radius: 10px;
  color: var(--danger); font-size: 13px;
}

/* 排队条(v0.4.4 权威队列) */
#queuebar, #fd-queuebar {
  border-top: 1px solid var(--border);
  background: rgba(23,23,28,.92);
  padding: 6px 14px calc(4px + var(--sab) / 2);
}
.qbar-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--warn); cursor: pointer; user-select: none;
  min-height: 30px;
}
.qbar-head b { color: var(--warn); }
.qbar-arrow { margin-left: auto; font-size: 12px; color: var(--text2); }
/* v0.52.33:排队项两行布局(390 移动第一)——行1=图标/时间/耗时/操作按钮,行2=文本全宽。
 * 修前单行 6~8 个 flex 子元素把 .qbar-text 挤到 62~130px(约 4~9 字),指令预览被
 * "遮盖显示不完整"(王佐 08-27 实测:active 行文本实测仅 62px / 701px)。 */
.qbar-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 7px 4px; border-top: 1px dashed var(--border);
  font-size: 13px;
}
.qbar-meta { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; min-width: 0; }
.qbar-meta .qbar-act { margin-left: 0; }
.qbar-meta .qbar-act + .qbar-act { margin-left: 0; }
.qbar-elapsed { margin-left: auto; }
.qbar-idx { color: var(--text2); font-family: var(--mono); font-size: 11.5px; flex: none; }
.qbar-time { color: var(--text2); font-family: var(--mono); font-size: 11.5px; flex: none; }
.qbar-text {
  flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); cursor: pointer;
}
.qbar-text.open { white-space: normal; word-break: break-all; }

/* 气泡/工具卡一键复制(2026-07-21 复制优化轮) */
.bubble { position: relative; }
.bubble-copy {
  position: absolute; top: 4px; right: 6px; z-index: 2;
  border: 0; background: transparent; color: inherit; opacity: .32;
  font-size: 14px; line-height: 1; padding: 6px; cursor: pointer;
  transition: opacity .15s, background .15s;
}
.bubble:hover .bubble-copy,
.bubble-copy:focus-visible { opacity: .72; }
.bubble-copy:active { opacity: 1; transform: scale(1.1); }
/* v0.27.5:assistant 气泡 copy 按钮常驻弱可见(不再只有 hover 才显,手机无 hover) */
.msg.assistant .bubble-copy { opacity: .4; }
.msg.assistant .bubble:hover .bubble-copy { opacity: .72; }
.msg.user .bubble-copy { color: rgba(255,255,255,.85); }
/* v0.39.0:用户气泡 copy 按钮常驻可见(与 assistant 同款,手机无 hover 也能看到) */
.msg.user .bubble-copy { opacity: .5; }
.msg.user .bubble:hover .bubble-copy { opacity: .85; }
/* v0.6.7:他源详情用户长指令截断+展开(继承蓝色气泡的 pre-wrap;展开键白字下划线,贴气泡可读) */
.fd-text { white-space: pre-wrap; word-break: break-word; }
.fd-expand {
  display: inline; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; padding: 0; margin-left: 2px;
  color: rgba(255,255,255,.92); text-decoration: underline;
}
/* v0.6.9 B5:重复用户消息右上角 ×N 角标(同一指令被 resume 重复写入 jsonl,已合并为一条) */
.fd-dup {
  position: absolute; top: -9px; right: -7px; z-index: 3;
  font-size: 11px; font-weight: 700; line-height: 1; color: #fff;
  background: #e0576b; border-radius: 99px; padding: 3px 7px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); pointer-events: none;
}
.tool-copy {
  float: right; border: 0; background: transparent; color: var(--text2);
  opacity: .5; font-size: 13px; padding: 2px 6px; cursor: pointer;
}
.tool-copy:active { opacity: 1; }
.qbar-act.copy-one { color: var(--text2); }
.copy-sheet-mask {
  position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.28);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.copy-sheet {
  width: min(360px, 100%); background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.copy-sheet button {
  display: block; width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 12px 10px; border-radius: 8px; text-align: left; font: inherit;
}
.copy-sheet button:active { background: var(--card2); }

/* turn 静默失败显形红条(2026-07-22) */
.errbar {
  margin: 6px 10px; padding: 9px 12px; border-radius: 10px;
  background: #3a1f22; color: #ffb4ab; border: 1px solid #7a3a3f;
  font-size: 13px; line-height: 1.5;
  display: flex; align-items: center; gap: 8px;
}
.errbar-text { flex: 1; min-width: 0; }
.errbar-hint { color: #d98c86; margin-left: 8px; font-size: 12px; }
/* v0.10.5:hint 三态视觉区分 */
.errbar-hint-running { color: #a8c7a0; }
.errbar-hint-queued { color: #c7b88a; }
.errbar-hint-retry { color: #d98c86; cursor: pointer; text-decoration: underline; }
.errbar-close {
  flex: none; width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: #d98c86; font-size: 18px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.errbar-close:active { background: rgba(255,180,171,.15); }

/* v0.9.10(C quota banner):Kimi 配额冻结 / 10 分钟无回复 顶部横幅 */
.quota-banner {
  position: sticky; top: 0; z-index: 50;
  margin: 0; padding: 10px 14px;
  background: #3a2c14; color: #f4d488;
  border-bottom: 1px solid #6b4e1f;
  font-size: 13px; line-height: 1.5;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,.4);
}
.quota-banner-text { flex: 1; min-width: 0; }
.quota-banner-relay {
  flex: none; padding: 6px 10px; border-radius: 8px;
  background: #f4d488; color: #2b1e08; font-weight: 600;
  text-decoration: none; font-size: 12.5px;
  border: 1px solid #b08a3a;
}
.quota-banner-relay:active { transform: scale(.96); background: #e8c66f; }
/* v0.26.12-REV9:预付余额模式——黄色 info 而非红色 warn,不引起恐慌 */
.quota-banner.quota-prepaid {
  background: #1a2e1a; color: #7dd97d; border-bottom-color: #2e5a2e;
}
.quota-banner.quota-prepaid .quota-banner-relay {
  background: #7dd97d; color: #1a2e1a; border-color: #3a6a3a;
}
/* 棒14 F2:suspected 分级——蓝灰中性(同 await 色系),非红色指控 */
.quota-banner.quota-suspected {
  background: #1c2136; color: #aab4e8; border-bottom-color: #2c3556;
}
.quota-banner .quota-banner-more {
  flex: none; margin-left: 6px; padding: 5px 8px; border-radius: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: inherit; cursor: pointer; display: inline-flex; align-items: center;
}
.quota-banner .quota-banner-more:active { transform: scale(.96); }

/* 棒14 F1:composer 上方常驻迷你条(一条线高,底部场景不依赖上滑) */
/* v0.54.3:对齐 composer 版心——inset 12px 圆角小条(修全出血条与输入框错位),高度收紧 32→28 */
.quota-dock {
  display: flex; align-items: center; gap: 7px;
  margin: 0 12px 6px; padding: 4px 12px;
  font-size: 11.5px; line-height: 1.35;
  background: #3a2c14; color: #f4d488;
  border: 1px solid #6b4e1f; border-radius: 10px;
  cursor: pointer; min-height: 28px;
}
.quota-dock.quota-prepaid { background: #1a2e1a; color: #7dd97d; border-color: #2e5a2e; }
.quota-dock.quota-suspected { background: #1c2136; color: #aab4e8; border-color: #2c3556; }
.quota-dock-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.quota-dock-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota-dock-more { flex: none; font-size: 11.5px; opacity: .85; white-space: nowrap; }

/* 棒14 F3:未处理指令全量抽屉(composer 上方,dock 下) */
.quota-drawer {
  background: #17181d; color: var(--text1, #e6e6ea);
  border-top: 1px solid #3a3b44; border-bottom: 1px solid #3a3b44;
  font-size: 13px;
}
.quota-drawer .qd-title {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px 6px; font-weight: 600; font-size: 13px;
}
.quota-drawer .qd-close {
  margin-left: auto; background: none; border: none; color: var(--text2, #9a9aa3);
  font-size: 14px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.quota-drawer .qd-close:active { background: rgba(255,255,255,.1); }
.quota-drawer .qd-list { max-height: 42vh; overflow-y: auto; padding: 0 14px 8px; }
.quota-drawer .qd-item {
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.quota-drawer .qd-item:last-child { border-bottom: none; }
.quota-drawer .qd-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.quota-drawer .qd-time { font-size: 11.5px; color: var(--text2, #9a9aa3); }
.quota-drawer .qd-st { font-size: 11px; padding: 1px 7px; border-radius: 8px; border: 1px solid; }
.quota-drawer .qd-queued { color: #f4d488; border-color: rgba(244,212,136,.4); background: rgba(244,212,136,.08); }
.quota-drawer .qd-unsent { color: #f49e97; border-color: rgba(244,158,151,.4); background: rgba(244,158,151,.08); }
.quota-drawer .qd-text { font-size: 12.5px; line-height: 1.5; word-break: break-word; }
.quota-drawer .qd-acts { display: flex; gap: 8px; margin-top: 5px; }
.quota-drawer .qd-act {
  padding: 4px 10px; border-radius: 8px; font-size: 11.5px; cursor: pointer;
  background: rgba(123,140,255,.12); color: var(--await, #7B8CFF);
  border: 1px solid rgba(123,140,255,.35);
}
.quota-drawer .qd-act:active { transform: scale(.96); }
.quota-drawer .qd-empty { padding: 14px 0; color: var(--text2, #9a9aa3); font-size: 12.5px; }
.quota-drawer .qd-foot { padding: 6px 14px 9px; font-size: 11px; color: var(--text2, #9a9aa3); border-top: 1px solid rgba(255,255,255,.06); }

/* 棒14 F1:列表行「额度」冻结标记(复用 badge 骨架,黄点) */
.badge.quota-row-badge { color: #f4d488; border-color: rgba(244,212,136,.35); background: rgba(244,212,136,.08); max-width: 200px; }
.badge.quota-row-badge .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #f4d488; margin-right: 4px; vertical-align: middle; }

/* v0.10.11(B):Kimi 额度芯片(顶栏 brain 旁) — merged into v0.31.4 rule below */
/* v0.33.7:旧 inline-block 定义已删除,仅保留 warn/danger 状态色(由 v0.31.4 base rule 接管) */
.quota-chip.warn { background: #3a2c14; color: #f4d488; border-color: #6b4e1f; }
.quota-chip.danger { background: #2a2618; color: #f0d080; border-color: #4a3a18; }
/* v0.26.17:额度/状态明细面板(sheet 复用) */
.qdetail-sheet { padding-bottom: calc(20px + 56px + var(--sab)); }
.qdetail-rows { margin-bottom: 8px; }
.qdetail-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.qdetail-row:last-child { border-bottom: 0; }
.qdetail-label { color: var(--text2); flex: none; }
.qdetail-value { color: var(--text); text-align: right; font-weight: 600; }
.qdetail-warn .qdetail-value { color: #f4d488; }

/* v0.31.4: 多 harness 额度聚合 UI */
/* QuotaChip:顶栏聚合芯片(v0.33.7:加 min-width:28 防窄屏缩成竖条) */
.quota-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 16px; font-size: 12px; font-weight: 600; cursor: pointer; background: var(--card); color: var(--text); border: 1px solid var(--border); transition: all 0.2s ease; user-select: none; min-width: 28px; }
.quota-chip:active { opacity: .7; transform: scale(0.96); }
.quota-chip.q-warning { background: #3a2c14; color: #f4d488; border-color: #D9A441; }
.quota-chip.q-exhausted { background: #2a2a2a; color: #8b949e; border-color: #6E7681; }
.quota-chip .q-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; border-radius: 8px; background: #D9A441; color: #1a1a1a; font-size: 10px; font-weight: 700; line-height: 1; padding: 0 4px; }
.quota-chip .q-arrow { font-size: 10px; opacity: 0.6; margin-left: 2px; }
.quota-chip .q-battery { display: inline-flex; align-items: center; margin-right: 2px; line-height: 1; flex-shrink: 0; }
.quota-chip .q-battery svg { vertical-align: middle; }
/* QuotaSheet:底部抽屉 */
/* v0.35.1-FIX:去掉 position:fixed —— 让 qsheet 成为 mask 的 flex 子项(与 .sheet 一致),
   避免 iOS Safari 上 fixed-in-fixed 不滚的问题;
   mask align-items:flex-end 自动贴底,max-height+overflow-y:auto 处理内容溢出滚动 */
.qsheet { max-height: min(60vh, calc(100dvh - 40px)); background: var(--bg, #1a1a1a); border-radius: 16px 16px 0 0; padding: 0 16px 20px; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain; animation: sheetup .18s ease; }
.qsheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 8px auto 12px; }
.qsheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.qsheet-header h2 { font-size: 14px; font-weight: 600; margin: 0; color: var(--text); }
.qsheet-updated { font-size: 10.5px; color: var(--text3, #8b949e); }
.qsheet-refresh { font-size: 18px; padding: 8px; cursor: pointer; background: none; border: none; color: var(--text2); min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.qsheet-refresh.spinning { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qsheet-stale { background: #3a2c14; color: #f4d488; padding: 8px 12px; border-radius: 8px; font-size: 12px; margin-bottom: 8px; }
.qsheet-src-fail { line-height: 1.5; }
.qsheet-src-line { margin: 2px 0; }
.qsheet-section-head { font-size: 11px; font-weight: 700; color: var(--text2); padding: 8px 0 4px; letter-spacing: .02em; }
.qsheet-current-head { color: #4fc3dc; }
/* v0.68.19:「全部账号 ›」二级入口折叠条 */
.qsheet-all-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 10px 2px; margin-top: 4px; background: none; border: none; border-top: 1px dashed var(--border, #2a2a2a); cursor: pointer; color: var(--text); text-align: left; }
.qsheet-all-toggle:active { opacity: .7; }
.qsheet-all-main { font-size: 12.5px; font-weight: 600; color: #4fc3dc; white-space: nowrap; }
.qsheet-all-sub { flex: 1; min-width: 0; font-size: 10.5px; color: var(--text3, #8b949e); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qsheet-all-arrow { font-size: 16px; color: #4fc3dc; flex-shrink: 0; }
.qrow-current-badge { display: inline-flex; align-items: center; height: 16px; padding: 0 6px; margin-left: 6px; border-radius: 8px; background: #0d3a42; color: #4fc3dc; font-size: 10px; font-weight: 700; line-height: 1; vertical-align: middle; }
.qrow-expired-group { opacity: 0.72; }
.qrow-expired-sub { white-space: normal; }
.qsheet-empty { text-align: center; color: var(--text3); padding: 24px 0; font-size: 14px; }
/* QuotaRow:每 harness 一行 */
.qsheet-rows { display: flex; flex-direction: column; }
.qrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "id data";
  column-gap: 12px;
  row-gap: 4px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #2a2a2a);
  min-height: 48px;
}
.qrow:last-child { border-bottom: 0; }
.qrow-id { grid-area: id; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.qrow-name { font-size: 12.5px; font-weight: 500; color: var(--text); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow-name-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.qrow-name-line .qrow-name { min-width: 0; }
.qrow-dim-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.qrow-dim { font-size: 11px; color: var(--text2, #8b949e); font-weight: 500; white-space: nowrap; }
.qrow-unmapped-tag { display: inline-flex; align-items: center; height: 15px; padding: 0 5px; border-radius: 7px; background: #2a2a2a; color: var(--text3, #8b949e); font-size: 9px; font-weight: 600; line-height: 1; white-space: nowrap; flex-shrink: 0; }
.qrow-data { grid-area: data; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; justify-self: end; }
.qrow-data-top { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; max-width: 100%; }
.qrow-value { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.qrow-value-strike { text-decoration: line-through; color: var(--text3, #8b949e); }
.qrow-sub { font-size: 10.5px; color: var(--text3, #8b949e); font-weight: 400; white-space: nowrap; }
.qrow-id .qrow-wrap { white-space: normal; overflow-wrap: break-word; line-height: 1.5; }
.qrow-bar { height: 3px; background: var(--border, #2a2a2a); border-radius: 2px; overflow: hidden; width: 100%; max-width: 88px; }
.qrow-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
.qrow-meta { font-size: 10.5px; color: var(--text3, #8b949e); white-space: nowrap; }
.qrow-stale { font-size: 11px; color: #D9A441; font-weight: 700; }
/* 状态点 */
.qdot { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.qdot-ok { background: #3FB950; }
.qdot-warn { background: #D9A441; color: #1a1a1a; }
.qdot-exhaust { background: transparent; color: #6E7681; border: 1.5px solid #6E7681; }
/* 状态变体 */
.qrow-exhausted { opacity: 0.7; }
.qrow-unknown { opacity: 0.45; }
.qrow-unknown .qrow-value { color: var(--text3, #484F58); }
/* v0.35.1-FIX:quota-sheet-mask 不再需要单独 z-index,qsheet 已是 mask flex 子项,用 mask 默认 z-index:9100 */
/* v0.37.1-FIX:确保 mask 层 touch-action:none 传递——mask 绝不参与手势竞争,pan 手势全部让给 qsheet 内容区 */
.quota-sheet-mask { touch-action: none; -webkit-touch-callout: none; }

/* QuotaOS P0: 三档视觉 + stale + 未接入 + 置信度标签 */
.qrow-stale-row { border-left: 3px solid #D9A441; padding-left: 8px; }
.qrow-stale-row .qrow-value { color: #D9A441 !important; }
.qrow-stale-note { font-size: 10px; color: #D9A441; font-weight: 500; white-space: nowrap; }
.qrow-unaccessed { opacity: 0.45; }
.qrow-unaccessed .qrow-value { color: var(--text3, #484F58); }
.qrow-conf { font-size: 9px; color: var(--text3, #6E7681); background: var(--card2, #1a1a1a); padding: 1px 4px; border-radius: 3px; white-space: nowrap; flex-shrink: 0; }
.qdot-ok { color: #3FB950; font-size: 8px; }
.qdot-warn { color: #D9A441; font-size: 11px; font-weight: 700; }
.qdot-exhaust { color: #6E7681; font-size: 11px; }

.st-icon-only { cursor: pointer; }
.st-icon-only:active { opacity: .7; }
/* v0.26.16:状态新鲜度标签(点击可展开详情) */
.st-freshness { font-size: 10px; color: var(--text3); margin-left: 3px; cursor: help; }

/* v0.10.11(A):横幅点击定位消息高亮 */
.flash-highlight { animation: flashMsg 2s ease-out; }
@keyframes flashMsg {
  0% { background: rgba(244,212,136,.25); }
  100% { background: transparent; }
}

.qbar-act {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card2); border: 1px solid var(--border); font-size: 14px;
}
.qbar-act.steer-one { color: var(--warn); }
.qbar-act.cancel-one { color: var(--danger); }
.qbar-act:active { transform: scale(.94); }

/* v0.9.11 版本自更新提示条 */
.ver-update-bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #1a2e1a; color: #a8e6a8;
  border-bottom: 1px solid #2e5a2e;
  font-size: 13px; line-height: 1.5;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.ver-update-text { flex: 1; min-width: 0; }
.ver-update-btn {
  flex: none; padding: 6px 14px; border-radius: 8px;
  background: #4caf50; color: #fff; font-weight: 600;
  border: none; font-size: 12.5px; cursor: pointer;
}
.ver-update-btn:active { transform: scale(.96); background: #43a047; }
.ver-update-later {
  flex: none; padding: 6px 10px; border-radius: 8px;
  background: transparent; color: #a8e6a8; font-size: 12.5px;
  border: 1px solid #2e5a2e; cursor: pointer;
}
.ver-update-later:active { background: #2e5a2e; }

/* 队列条:执行中行与完成淡出(v0.4.5) */
.qbar-item.active { border-top: 0; }
.qbar-live { color: var(--success); font-size: 12px; animation: pulse 1.2s ease-in-out infinite; }
/* v0.52.23:执行耗时+阶段显形——active 行不再只有转圈,用户能看清「跑了多久/跑到哪/是否卡死」 */
.qbar-elapsed { color: var(--text2); font-family: var(--mono); font-size: 11px; flex: none; white-space: nowrap; }
.qbar-elapsed.wait { color: #4fc3dc; }      /* 等待后台任务=守护蓝(与 .st-guard 同色系,非卡死) */
.qbar-elapsed.stuck { color: var(--warn); } /* 疑似卡死=警示黄 */
.qbar-item.active.stuck .qbar-live { color: var(--warn); animation: none; }
/* v0.65.7(C):无正文时长——独占一行,与三态判词并列而非替换。
   常态低调(text2),≥10min 转琥珀警示;文案中性,不指控卡死。 */
.qbar-notext {
  font-family: var(--mono); font-size: 11px; color: var(--text2);
  margin: 2px 0 0 0; padding: 1px 0 0 18px; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qbar-notext.warn { color: #f0a02a; }
/* v0.66.4:编排态如实呈现——队列条 active 行层级:标题 + 子代理交接列表 + 降级指令原文 */
.qbar-item.active.orch { border-left: 2px solid #7c4dff; }
.qbar-elapsed.orch { color: #7c4dff; }              /* 编排中=紫(子代理徽标同色系) */
.qbar-orch { padding: 4px 0 4px 16px; }
.qbar-orch-title { font-size: 12.5px; color: var(--text); line-height: 1.5; word-break: break-all; }
.qbar-orch-subs { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.qbar-orch-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; line-height: 1.5; }
.qbar-orch-icon { flex: none; width: 12px; text-align: center; }
.qbar-orch-sub.done .qbar-orch-icon { color: var(--success); }
.qbar-orch-sub.running .qbar-orch-icon { color: #7c4dff; animation: pulse 1.2s ease-in-out infinite; }
.qbar-orch-sub.pending .qbar-orch-icon { color: var(--text3); }
.qbar-orch-desc { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qbar-orch-sub.done .qbar-orch-desc { color: var(--text3); text-decoration: line-through; }
.qbar-orch-bg { flex: none; color: #4fc3dc; font-size: 10px; white-space: nowrap; }
.qbar-orch-instr { margin-top: 4px; font-size: 11px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.66.4:时间线工具卡——子代理派发归属标记 */
.tool-card.subagent .tool-name { color: #7c4dff; }
/* v0.66.4:编排态排队头——与编排的关系说明 + 折叠态首条指令预览 */
.qbar-qrel { color: var(--text3); font-weight: 400; }
.qbar-qfirst { color: var(--text3); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* v0.65.7(B2):队列条系统注入角标——机队通知不得与王佐手输指令同形 */
.qbar-inject-tag {
  display: inline-block; margin-right: 5px; padding: 0 5px;
  border-radius: 4px; font-size: 10px; line-height: 16px; vertical-align: 1px;
  background: rgba(122, 162, 247, .16); color: #7aa2f7; white-space: nowrap;
}
.qbar-head.done { color: var(--success); cursor: default; }
/* v0.42.1:完成提示 8s 后自动淡出,避免与"回到最新" pill 叠加 */
.qbar-head.done { animation: qbarDoneFade 8s ease forwards; }
@keyframes qbarDoneFade {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; }
}

/* 守护中状态与活动面板(v0.4.8) */
.st-guard { color: #4fc3dc; }
.st-guard .dot { background: #4fc3dc; }

#activitybar {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px; border-bottom: 1px solid var(--border);
  background: rgba(14,14,17,.88); font-size: 12px; cursor: pointer; user-select: none;
  min-height: 30px;
}
#activitybar .qbar-arrow { margin-left: auto; }
.act-hist { color: var(--text2); }

#activity-panel {
  border-bottom: 1px solid var(--border);
  background: #121218;
  max-height: 280px; overflow-y: auto;
  padding: 6px 14px;
}
.act-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 2px; font-size: 12.5px; border-bottom: 1px dashed #1e1e26;
  width: 100%; text-align: left; color: var(--text);
}
.act-item:last-child { border-bottom: 0; }
.act-kind { color: var(--accent); font-family: var(--mono); font-size: 11px; flex: none; }
.act-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }
.act-time { color: var(--text2); font-size: 11px; flex: none; }
.act-sep { margin: 8px 0 4px; font-size: 11.5px; color: var(--text2); }
button.act-child { cursor: pointer; border-radius: 8px; }
button.act-child:active { background: var(--card2); }

/* 流式视图与工具摘要(v0.4.9) */
.cursor { display: inline-block; color: var(--accent); animation: blink 1s steps(1) infinite; font-weight: 700; }
@keyframes blink { 50% { opacity: 0; } }
.msg.live .bubble { opacity: .92; }
details.think-card.live-think { border-color: #2b3a55; }
.tool-sum {
  color: var(--text2); font-family: var(--mono); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 55%; margin-left: 6px;
}
details.tool-card summary { display: flex; align-items: center; gap: 6px; }
details.tool-card summary::after { margin-left: auto; }

/* 机群联邦页 */
.fleet-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.fleet-stat { font-size: 12.5px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); color: var(--text2); }
.fleet-h { display: inline-block; font-size: 10.5px; font-weight: 700; color: #0e0e11; border-radius: 6px; padding: 1px 6px; margin-right: 7px; vertical-align: 1px; }

/* 机群生命体征卡 */
.fleet-vitals { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; }
.vital-card { flex: 1 0 108px; background: var(--card); border: 1px solid var(--border); border-top: 2px solid transparent; border-radius: 12px; padding: 10px 12px; }
.vital-name { font-size: 12px; font-weight: 700; }
.vital-count { font-size: 22px; font-weight: 700; margin: 2px 0; }
.vital-sub { font-size: 11px; color: var(--text2); white-space: nowrap; }
.fleet-note { font-size: 11px; color: var(--text2); margin: -6px 2px 10px; line-height: 1.5; }
.sys-group-head { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: none; color: var(--text2); font-size: 12px; padding: 10px 4px 4px; cursor: pointer; }
.sys-caret { font-size: 10px; }
.sys-group { opacity: 0.72; }

/* 账号全景卡 — v0.8.3(P1-8)统一卡结构:账号名 + 额度状态条(无接口→「额度未知」占位条)+ 一行次要说明 */
.acct-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.acct-card { flex: 1 0 168px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; }
.acct-name { font-size: 12px; font-weight: 700; }
.acct-sub { font-size: 11px; color: var(--text2); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-quota { margin-top: 6px; font-size: 11px; display: flex; align-items: center; gap: 6px; }
.acct-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; display: inline-block; }
.acct-bar i { display: block; height: 100%; border-radius: 2px; }
.acct-bar.unknown i { width: 100%; background: repeating-linear-gradient(45deg, #26262e 0 5px, #1d1d24 5px 10px); }
.acct-pct { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
.acct-pct.unk { color: var(--text2); }

/* 分组切换 + 模型主标签 */
.fleet-toggle { display: flex; gap: 6px; margin: 0 0 8px; }
.fleet-toggle .tg { border: 1px solid var(--border); background: var(--card); color: var(--text2); border-radius: 999px; padding: 4px 12px; font-size: 12px; }
.fleet-toggle .tg.on { color: var(--text); border-color: var(--text2); font-weight: 600; }
.fleet-m { display: inline-block; color: #fff; font-size: 10px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px; }
.fleet-ghead { display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; font-size: 12px; color: var(--text2); }
.fleet-gcount { font-size: 11px; opacity: 0.7; }
.fleet-h2 { font-size: 10px; font-weight: 600; margin-right: 6px; }

/* 待答锁定横幅(可点,引导到答题卡) */
.locked-banner { background: rgba(224,164,88,.14); border: 1px solid rgba(224,164,88,.45); color: #e0a458; border-radius: 10px; padding: 9px 12px; font-size: 13px; text-align: center; cursor: pointer; }
.locked-banner b { color: #f0b96a; }
.action-card.flash { animation: acflash 1.6s ease; }
@keyframes acflash { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px rgba(224,164,88,.8); } }
.newver-bar { background: #2fbf71; color: #fff; text-align: center; font-size: 13px; padding: 9px 10px; border-radius: 10px; margin: 6px 10px; cursor: pointer; font-weight: 600; }

/* v0.6.0:harness 筛选条色点 */
.hchip-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
/* v0.6.0:首页联邦会话分隔标题 */
.fleet-home-sep { font-size: 12px; color: var(--text2); margin: 14px 0 6px; padding-left: 2px; }
/* v0.6.0:首页联邦会话行(无滑动手势) */
.fleet-home-item { width: 100%; }
/* v0.6.0:机群页缓存提示 */
.fleet-cache-note { font-size: 11px; color: var(--text2); text-align: center; padding: 6px 0 2px; opacity: 0.7; }

/* v0.6.1:我的指令面板(痛点2) */
.my-cmd-sheet { max-height: 78vh; display: flex; flex-direction: column; }
.my-cmd-count { font-size: 12.5px; color: var(--text2); margin: -6px 0 12px; }
.my-cmd-last { width: 100%; text-align: left; padding: 12px; margin-bottom: 10px; border-radius: 10px; background: rgba(91,124,250,.14); border: 1px solid rgba(91,124,250,.4); color: #8aa2ff; font-size: 14px; font-weight: 600; }
.my-cmd-last:disabled { opacity: .4; }
.my-cmd-list { overflow-y: auto; flex: 1; margin: 0 -6px; }
.my-cmd-item { display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px; border-radius: 8px; cursor: pointer; }
.my-cmd-item:active { background: var(--card2); }
.my-cmd-tag { flex: 0 0 auto; font-size: 11px; padding: 2px 7px; border-radius: 99px; margin-top: 1px; white-space: nowrap; }
.my-cmd-tag.manual { background: rgba(91,124,250,.16); color: #8aa2ff; }
.my-cmd-tag.inj { background: rgba(224,164,88,.14); color: #e0a458; }
.my-cmd-prev { flex: 1; font-size: 13.5px; color: var(--text); word-break: break-all; line-height: 1.4; }
/* v0.6.1:消息定位高亮(痛点2 跳转闪烁) */
.kr-flash { animation: krflash 1.6s ease; }
@keyframes krflash { 0%,100% { box-shadow: none; } 25% { box-shadow: 0 0 0 3px rgba(91,124,250,.85); background: rgba(91,124,250,.10); } }

/* ──────────────────────────────────────────────────────────────
 * v0.9.0 · 批 3a:智能层面板(全舰队快照 / 问答 / 增强三选一)
 * 390px 手机优先,深色 SaaS 风格,复用 var(--card/border/text/accent/danger/warn/success)
 * ────────────────────────────────────────────────────────────── */
.intel-modal { max-width: 460px; max-height: 86vh; overflow-y: auto; }
.intel-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.intel-snapshot-row { display: flex; gap: 8px; flex-wrap: wrap; }
.intel-stat { flex: 1 0 78px; padding: 10px 10px; background: var(--card2); border-radius: 10px; min-width: 0; }
.intel-stat-num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.15; }
.intel-stat-lbl { font-size: 11px; color: var(--text2); margin-top: 4px; }
.intel-stat.warn .intel-stat-num { color: var(--warn); }
.intel-stat.danger .intel-stat-num { color: var(--warn); }
.intel-stat.ok .intel-stat-num { color: var(--success); }
.intel-ask-row { display: flex; gap: 8px; margin-top: 10px; }
.intel-ask-row input { flex: 1; min-width: 0; padding: 10px 12px; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 14px; outline: none; }
.intel-ask-row input:focus { border-color: var(--accent); }
.intel-ask-row button { padding: 10px 16px; background: var(--accent); color: #fff; border: 0; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.intel-ask-row button:active { opacity: .85; }
.intel-ask-out { margin-top: 12px; padding: 12px; background: var(--card2); border-radius: 10px; font-size: 13.5px; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.intel-evidence { margin-top: 8px; font-size: 11.5px; color: var(--text3); }
.intel-evidence span { display: inline-block; margin: 2px 6px 2px 0; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; }
.intel-copilot-3col { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .intel-copilot-3col { grid-template-columns: 1fr 1fr 1fr; } }
.intel-copilot-col { background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.55; max-height: 280px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.intel-copilot-col h4 { margin: 0 0 8px; font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: .3px; }
.intel-copilot-col .axis { font-size: 11.5px; padding: 6px 0; border-top: 1px dashed var(--border); color: var(--text2); }
.intel-copilot-col .axis b { color: var(--text2); margin-right: 4px; font-weight: 600; }
.intel-copilot-col .axis.changed b { color: var(--warn); }
.intel-copilot-col .axis.changed b::after { content: '⚠ '; }
.intel-copilot-banner { padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-size: 13px; line-height: 1.5; }
.intel-copilot-banner.required { background: rgba(224,92,92,.14); border: 1px solid var(--danger); color: var(--danger); }
.intel-copilot-banner.silent { background: rgba(63,178,127,.14); border: 1px solid var(--success); color: var(--success); }
.intel-copilot-actions { display: flex; gap: 8px; margin-top: 12px; }
.intel-copilot-actions button { flex: 1; padding: 11px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.intel-copilot-actions .send-orig { background: var(--card2); border: 1px solid var(--border); color: var(--text); }
.intel-copilot-actions .send-enhanced { background: var(--accent); border: 0; color: #fff; }
.intel-copilot-actions button:active { opacity: .85; }
.round-btn.enhance:active { color: var(--accent); border-color: var(--accent-strong); background: rgba(91,124,250,.12); }
/* v0.26.15:存入灵感按钮(📌),视觉辅助色(橙系),与增强蓝/发送蓝区分 */
.round-btn.save-inspire { color: var(--accent-orange, #ff8a3c); border-color: var(--border); }
.round-btn.save-inspire:hover:not([disabled]) { color: #fff; background: var(--accent-orange, #ff8a3c); border-color: var(--accent-orange, #ff8a3c); }
.round-btn.save-inspire:active:not([disabled]) { transform: scale(.95); background: rgba(255,138,60,.15); color: var(--accent-orange, #ff8a3c); }

/* ================= TaskPanel 5 子组件 + FAB (v0.27) ================= */
/* ---- Root 抽屉(桌面 ≥1200px) ---- */
#task-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: 320px;
  background: #111118; border-left: 1px solid var(--border);
  z-index: 50; display: none; flex-direction: column;
  color: var(--text);
}
#task-panel.open { display: flex; }
#task-panel .tp-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
#task-panel .tp-title { font-size: 14px; font-weight: 700; letter-spacing: .4px; }
#task-panel .tp-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
#task-panel .tp-close {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--card2); color: var(--text2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
}
#task-panel .tp-body {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
@media (min-width: 1200px) {
  #app.with-task-panel { max-width: calc(100vw - 320px); }
}

/* ---- 1. TodoCard (4 态: 灰 pending / 蓝 running / 红 failed / 绿 done) ---- */
.tp-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.tp-card h5 {
  margin: 0; padding: 10px 12px; font-size: 12px; font-weight: 600;
  color: var(--text2); border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.tp-card h5 .tp-count { font-size: 10.5px; color: var(--text3); font-weight: 500; }
.tp-card .tp-body-inner { padding: 10px 12px; }

.todo-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.todo-item:last-child { border-bottom: 0; }
.todo-dot {
  width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.02);
}
.todo-dot.pending { background: #6b7280; }     /* 灰 */
.todo-dot.running { background: #4263eb; animation: tp-pulse 1.4s ease-in-out infinite; } /* 蓝 */
.todo-dot.failed  { background: var(--danger); }     /* 警告 */
.todo-dot.done    { background: #3fb27f; }     /* 绿 */
@keyframes tp-pulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(66,99,235,.15); }
  50%     { box-shadow: 0 0 0 6px rgba(66,99,235,.05); }
}
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: 12.5px; color: var(--text); line-height: 1.4; word-break: break-word; }
.todo-meta  { font-size: 10.5px; color: var(--text3); margin-top: 3px; }
.todo-empty { font-size: 11.5px; color: var(--text3); text-align: center; padding: 14px 0; }

/* ---- 2. ToolList (退出码 + 耗时) ---- */
.tool-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 11.5px;
}
.tool-item:last-child { border-bottom: 0; }
.tool-name { color: var(--text); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.tool-meta { display: flex; align-items: center; gap: 6px; }
.tool-exit-ok  { color: var(--success); font-weight: 600; }
.tool-exit-err { color: var(--danger);  font-weight: 600; }
.tool-dur { color: var(--text3); font-family: var(--mono); }

/* ---- 3. ProgressBar (渐变 0-100%) ---- */
.tp-pbar-wrap { margin: 10px 0 4px; }
.tp-pbar {
  position: relative; width: 100%; height: 8px; border-radius: 999px;
  background: #1f1f28; overflow: hidden;
}
.tp-pbar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #4263eb 0%, #5b7cfa 40%, #3fb27f 100%);
  transition: width .3s ease;
  border-radius: 999px;
}
.tp-pbar-fill.anim { background-size: 200% 100%; animation: tp-shimmer 1.6s linear infinite; }
@keyframes tp-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.tp-pbar-labels {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 10.5px; color: var(--text3);
}
.tp-pbar-labels b { color: var(--text); font-weight: 600; }

/* ---- 4. EventTimeline (最近 10 条事件) ---- */
.tl-item {
  display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border);
  font-size: 11px;
}
.tl-item:last-child { border-bottom: 0; }
.tl-dot {
  width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
  background: var(--accent);
}
.tl-dot.start { background: #4263eb; }
.tl-dot.end   { background: #3fb27f; }
.tl-dot.fail  { background: var(--danger); }
.tl-dot.update{ background: var(--warn); }
.tl-body { flex: 1; min-width: 0; }
.tl-evt   { color: var(--text2); font-family: var(--mono); font-weight: 600; }
.tl-ts    { color: var(--text3); margin-top: 2px; }

/* ---- 5. BidirectionalBridge (10s 对账状态) ---- */
.bridge-card {
  background: linear-gradient(135deg, rgba(66,99,235,.08), rgba(63,178,127,.06));
  border: 1px solid rgba(66,99,235,.25);
}
.bridge-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 11.5px;
}
.bridge-row .lbl { color: var(--text2); }
.bridge-row .val { color: var(--text); font-family: var(--mono); font-weight: 600; }
.bridge-row .val.ok { color: var(--success); }
.bridge-row .val.diverge { color: var(--warn); }
.bridge-last {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
  font-size: 10.5px; color: var(--text3);
}

/* ---- 快捷键 Hint + 移动端 FAB ---- */
.tp-hint {
  margin-top: auto; padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--text3); display: flex; justify-content: space-between; align-items: center;
}
.tp-hint kbd {
  background: var(--card2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-family: var(--mono); font-size: 10.5px; color: var(--text);
}

#task-panel-fab {
  position: fixed; right: 16px; bottom: calc(100px + var(--sab)); width: 52px; height: 52px;
  border-radius: 50%; background: linear-gradient(135deg,#4263eb,#5b7cfa);
  color: #fff; display: none; align-items: center; justify-content: center;
  box-shadow: 0 6px 22px rgba(66,99,235,.55); z-index: 40; cursor: pointer;
  font-size: 22px; font-weight: 700;
}
#task-panel-fab.show { display: inline-flex; }
#task-panel-fab:active { transform: scale(.94); }

@media (max-width: 1199.98px) {
  #task-panel { width: 88vw; max-width: 360px; transform: translateX(100%); transition: transform .25s ease; display: flex; }
  #task-panel.open { transform: translateX(0); box-shadow: -8px 0 24px rgba(0,0,0,.5); }
  #task-panel-fab { display: inline-flex; }
}
@media (min-width: 390px) and (max-width: 1199.98px) { /* 手机端浮动按钮保留,meta键不存在,⌘/禁用 */ }
@media (max-width: 389px) {
  #task-panel { width: 92vw; }
}

/* =========================================================
   P1 三件 (US-09/US-10/US-11) v0.27 追加样式
   Worker#4 xiaomi-mimo · ROI 顺序 US-11→US-10→US-09
   ========================================================= */

/* ---------- US-09 思考区折叠 (thinking-block) ---------- */
.thinking-block {
  margin: 6px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(91,124,250,.04);
  overflow: hidden;
}
.thinking-block summary {
  cursor: pointer;
  color: #4b5563;
  border-bottom: 1px dashed #e5e7eb;
  padding: 4px 8px;
  font-size: 13px;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.thinking-block summary::-webkit-details-marker { display: none; }
.thinking-block summary::before {
  content: "▸";
  display: inline-block;
  transition: transform .12s;
  font-size: 12px;
  color: var(--text3);
}
.thinking-block[open] > summary::before { transform: rotate(90deg); }
.thinking-content {
  font-size: 0.92em;
  opacity: 0.88;
  max-height: 600px;
  overflow-y: auto;
  padding: 10px 12px;
  color: #8b8b96;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.thinking-block:not([open]) .thinking-content { display: none; }

/* ---------- US-10 Token 燃烧仪表盘 ---------- */
.token-dashboard-host {
  position: fixed;
  right: 16px;
  top: calc(64px + var(--sat, 0px));
  z-index: 40;
  /* D2 精度修复(2026-08-09):外层容器不拦截点击,让下层输入框可聚焦/点击,
     只有 .token-dashboard 本体(子元素)才接受事件,避免整张遮罩挡住交互 */
  pointer-events: none;
}
.token-dashboard-host > .token-dashboard {
  pointer-events: auto;
}
.token-dashboard {
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
  border-left-width: 4px;
  border-left-style: solid;
}
.token-dashboard.token-neutral { border-left-color: var(--text3); }
.token-dashboard.token-green   { border-left-color: var(--success, #3fb27f); background: linear-gradient(135deg, rgba(63,178,127,.08), transparent); }
.token-dashboard.token-yellow  { border-left-color: var(--warn, #e0a458); }
.token-dashboard.token-red     { border-left-color: var(--danger, #E0A94F); background: linear-gradient(135deg, rgba(224,169,79,.08), transparent); }
.token-dashboard .td-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  color: var(--text2);
  line-height: 1.5;
}
.token-dashboard .td-row.td-cost  { color: var(--text); font-weight: 600; font-size: 13.5px; }
.token-dashboard .td-row.td-roi   {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  color: var(--text);
  font-weight: 600;
}
.token-dashboard .roi-num { font-family: var(--mono); margin-left: 6px; }
.token-green  .roi-num { color: var(--success, #3fb27f); }
.token-yellow .roi-num { color: var(--warn, #e0a458); }
.token-red    .roi-num { color: var(--danger, #E0A94F); }

/* 设置页右上角仪表盘入口按钮 (US-10) */
.p1-dash-entry-btn {
  margin-left: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4263eb, #5b7cfa);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  box-shadow: 0 2px 10px rgba(66,99,235,.4);
}
.p1-dash-entry-btn:active { transform: scale(.96); }
@media (max-width: 480px) {
  /* v0.52.7 棒6a2:窄屏等拍板 badge 只留 ⌛ ico(AC-UI-3),文字走 title;ico 保留非 0 font-size */
  .badge.await-badge { font-size: 0; gap: 0; padding: 1px 6px; }
  .badge.await-badge .lbl { display: none; }
  .badge.await-badge .ico { font-size: 14px; }
  .token-dashboard-host { right: 8px; top: calc(58px + var(--sat, 0px)); }
  .token-dashboard { min-width: 140px; padding: 8px 10px; font-size: 11.5px; }
  /* D2 精度修复(2026-08-09):移动端默认隐藏 token 成本浮窗,
     因为屏幕窄,右上角刚好是搜索/输入热区,显示会严重遮挡交互;
     移动端如需查看 token,通过顶栏"📊 Token 仪表盘"按钮打开详情板即可 */
  .token-dashboard-host { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════
   v0.27.4 T4:分组渲染引擎 — turn 容器 + CSS order + 过程卡
   ══════════════════════════════════════════════════════════════ */

/* turn 容器:flex column,子元素通过 order 控制视觉顺序 */
.turn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.turn > .turn-reply {
  order: 2; /* 默认:回复在下(流式中过程在上,见下方) */
}
.turn > .turn-process {
  order: 1; /* 流式中:过程在回复上方(用户看到 AI 在干活) */
}
.turn--settled > .turn-reply {
  order: 1; /* settled 后:回复移到上方(主视觉) */
}
.turn--settled > .turn-process {
  order: 2; /* settled 后:过程卡移到下方 */
}

/* turn 内 user 气泡(不属于 reply/process,直接在 turn 下) */
.turn > .msg.user { order: 0; }

/* process 容器 — R3:左侧导轨而非粗边框 */
.turn-process {
  padding-left: 10px;
  border-left: 2px solid var(--rail);
  margin-left: 4px;
  font-size: 12px;
}

/* R2(a) R1:过程卡 — card → rail item,透明底 + 左导轨 */
details.process-card {
  border: 0;
  border-left: 2px solid var(--rail);
  border-radius: 0;
  background: transparent;
  margin: 4px 0;
  padding: 4px 10px;
  min-height: 28px;
}
details.process-card + details.process-card { margin-top: 2px; }
details.process-card summary {
  padding: 2px 0;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
/* R6:touch 命中区 ≥44px(内边距法,适配 process 容器可能的 overflow) */
details.process-card summary {
  padding: 11px 0;
  margin: -11px 0;
}
details.process-card summary::-webkit-details-marker { display: none; }
details.process-card summary::after {
  content: "›";
  margin-left: auto;
  transition: transform .12s;
  font-size: 14px;
  color: var(--text-dim);
}
details[open].process-card summary::after { transform: rotate(90deg); }
details.process-card .process-items {
  padding: 4px 0 8px;
}

/* R7:展开态明细块 — 深色底 + 等宽 + 内滚 */
details.process-card .process-items .think-card .body,
details.process-card .process-items pre,
details.process-card .process-items code {
  background: var(--code-bg);
  color: var(--text);
  font: 12px/1.6 var(--mono);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

/* 过程子项(紧凑) — R3 三级层次 L3 */
.process-item {
  margin: 2px 0;
  font-size: 12px;
}
.process-item summary {
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
}
/* R7:子项展开内容也用 --code-bg */
.process-item .body {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 8px 10px;
  font: 12px/1.6 var(--mono);
  color: var(--text);
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

/* system_note 常驻可见 */
.system-note.process-item {
  padding: 4px 8px;
  font-size: 12px;
  color: var(--danger);
  background: oklch(0.18 0.04 25 / 0.4);
  border-radius: 4px;
}

/* 强制可见白名单(pending/undelivered/failed/system-note/err-bar 任何组合下 !important 可见) */
#msgs[data-filter="ai"] .msg.pending,
#msgs[data-filter="ai"] .msg.undelivered,
#msgs[data-filter="ai"] .msg.send-failed,
#msgs[data-filter="ai"] .msg-status.failed,
#msgs[data-filter="mine"] .msg.pending,
#msgs[data-filter="mine"] .msg.undelivered,
#msgs[data-filter="mine"] .msg.send-failed,
#msgs[data-filter="process"] .msg.pending,
#msgs[data-filter="process"] .msg.undelivered,
#msgs[data-filter="process"] .msg.send-failed,
#msgs[data-filter="none"] .msg.pending,
#msgs[data-filter="none"] .msg.undelivered,
#msgs[data-filter="none"] .msg.send-failed,
#msgs[data-filter="default"] .msg.pending,
#msgs[data-filter="default"] .msg.undelivered,
#msgs[data-filter="default"] .msg.send-failed,
#msgs[data-filter="ai+process"] .msg.pending,
#msgs[data-filter="ai+process"] .msg.undelivered,
#msgs[data-filter="ai+process"] .msg.send-failed,
#msgs[data-filter="mine+process"] .msg.pending,
#msgs[data-filter="mine+process"] .msg.undelivered,
#msgs[data-filter="mine+process"] .msg.send-failed {
  display: flex !important;
}
/* 系统通知/错误栏任何组合下可见 */
#msgs .msg.system-note { display: flex !important; }
#msgs .msg.err-bar { display: flex !important; }

/* flat 退路:data-view="flat" 时还原平铺 */
#msgs[data-view="flat"] .turn {
  display: contents; /* turn wrapper 变透明,子元素直接参与外部 flex/flow */
}
#msgs[data-view="flat"] .turn-reply,
#msgs[data-view="flat"] .turn-process {
  display: contents;
}
#msgs[data-view="flat"] .process-card {
  display: none; /* flat 模式不显示过程卡(原样平铺) */
}

/* CSS-only 多选过滤(v0.10.2):data-filter 属性驱动,零重渲
   隐藏规则:缺哪个维度就隐藏该维度容器
   ai 隐藏:turn-user(用户输入) + turn-process(过程)
   mine 隐藏:turn-reply(AI回复) + turn-process(过程)
   process 只显示:turn-process(隐藏 user+reply)
   default = ai+mine(隐藏 turn-process)
   all = 全开(什么都不隐藏)
   none = 全关(隐藏全部) */

/* 单维度隐藏 */
#msgs[data-filter="ai"] .turn-user,
#msgs[data-filter="ai"] .turn-process { display: none; }
#msgs[data-filter="mine"] .turn-reply,
#msgs[data-filter="mine"] .turn-process { display: none; }
#msgs[data-filter="process"] .turn-user,
#msgs[data-filter="process"] .turn-reply { display: none; }

/* 组合态:default = ai+mine(隐藏过程) */
#msgs[data-filter="default"] .turn-process { display: none; }

/* 组合态:ai+process(隐藏用户输入) */
#msgs[data-filter="ai+process"] .turn-user { display: none; }

/* 组合态:mine+process(隐藏AI回复) */
#msgs[data-filter="mine+process"] .turn-reply { display: none; }

/* none = 全部隐藏 */
#msgs[data-filter="none"] .turn-user,
#msgs[data-filter="none"] .turn-reply,
#msgs[data-filter="none"] .turn-process { display: none; }

/* all = 全开,无隐藏规则 */

/* v0.52.27:reply 空占位提示(有过程块但零正文 reply 的 turn)
   v0.65.8:改「连续 N 轮聚合成一行 + 携带真实精简信息 + 可点按下探」。
   单行 nowrap + ellipsis 是硬约束:长工具名 / 英文内容一律截断,严禁换行撑破 390。 */
.turn-reply-empty-hint {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  border-left: 2px solid var(--border, rgba(128, 128, 128, 0.35));
  margin: 2px 0 6px;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 聚合行(N>1):左导轨提亮一档,表示「这一行代表多轮」 */
.turn-reply-empty-hint.is-agg { border-left-color: var(--rail); color: var(--text2); }
/* 进行中态:呼吸点给实时感(复用既有 pulse keyframes,不新增动画) */
.turn-reply-empty-hint.is-active::before {
  content: '';
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); margin-right: 6px; vertical-align: 1px;
  animation: pulse 1.2s ease-in-out infinite;
}
.turn-reply-empty-hint:active { opacity: .55; }
.turn-reply-empty-hint.is-open { color: var(--text2); }
/* 下探(E3):点开的聚合组强制显形该组过程,不改全局筛选 chip 状态 */
#msgs .turn.turn--peek-process > .turn-process { display: block !important; }

/* mine 态占位 */
#msgs[data-filter="mine"] .turn-mine-placeholder { display: block !important; }
#msgs[data-filter="mine+process"] .turn-mine-placeholder { display: block !important; }
.turn-mine-placeholder {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border: 0;
  background: transparent;
  min-height: 0;
  opacity: .6;
}
.turn-mine-placeholder:active { opacity: 0.4; }

/* R4 R6 R9:filter bar — segmented 占主 + toggle 降级 + 无 hex 兜底 */
.kr-filter-bar {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  overflow: visible;
  margin-left: 6px;
  margin-top: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  padding: 2px;
  background: var(--card);
}
/* v0.65.7(B3):多选并集语义的引导词——把三个 chip 统一冠以「显示」,
   使默认态「AI 结论 + 我的」同亮读作并集而非互斥矛盾。低调不抢焦点。 */
.kr-filter-lead {
  font-size: 11px;
  color: var(--text-dim);
  opacity: .65;
  padding: 0 4px 0 5px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.kr-fbtn {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 28px;
  line-height: 28px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
  border-radius: 7px;
  position: relative;
}
.kr-fbtn:not(:last-child) { border-right: 0; }
.kr-fbtn.active {
  background: rgba(91,124,250,.22);
  color: #c8d4ff;
  font-weight: 600;
  border: 1px solid rgba(91,124,250,.35);
}
/* R6:touch 命中区 ≥44px for filter buttons */
.kr-fbtn { position: relative; }
.kr-fbtn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: max(44px, 100%);
  height: max(44px, 100%);
  transform: translate(-50%, -50%);
}
.kr-view-toggle {
  margin-left: 4px;
  font-size: 12px;
  cursor: pointer;
  flex: 0 0 32px;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative; /* R6::after 命中区锚定本元素(缺此=锚到错误祖先) */
}
/* R4(r2):态由 aria-pressed 表达(JS 从不设 .active,原 .active 是死选择器) */
.kr-view-toggle[aria-pressed="true"] {
  background: rgba(91,124,250,.22);
  color: #c8d4ff;
  border-color: rgba(91,124,250,.35);
}
/* R6:touch ≥44px for view toggle */
.kr-view-toggle::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: max(44px, 100%);
  height: max(44px, 100%);
  transform: translate(-50%, -50%);
}

/* ═══ R3:三级视觉层次(L1 主=AI回复 / L2 次=用户气泡 / L3 辅=过程卡) ═══ */
.turn-reply > .msg.reply,
.turn-reply > .msg:not(.user) {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  font-weight: 400;
  margin: 12px 0;
  max-width: 68ch;
  /* 不加卡片框,靠留白与亮度取得权重 */
}
/* R3 L2:用户消息气泡 */
.turn > .msg.user {
  background: var(--card);
  border-radius: 14px;
  padding: 8px 12px;
  max-width: 84%;
  margin-left: auto;
  font-size: 14px;
  color: var(--text);
}
/* R3:间距编码(8px 阶梯):过程串↔正文 8px,正文段↔正文段 12px */
.turn-process + .turn-reply { margin-top: 8px; }
.turn-reply > .msg + .msg { margin-top: 12px; }

/* ═══ R5(r2):顶栏/chips 挂真实 DOM——kr-topbar/kr-chip 系列在 app.js 无对应节点,
   改挂 #chat-title / #infobar(仅聊天详情页作用域,不动 4 页共用的 .topbar 与 #fd-infobar)
   v0.37.0:#fd-infobar 也纳入(对齐 Kimi 主详情页 filter chips + view toggle) ═══ */
/* R5:聊天标题收一档(全局 .topbar h1=17px/700,详情页 15px/600,标题让位正文) */
#chat-title { font-size: 15px; font-weight: 600; min-width: 0; max-width: 55vw; }
/* v0.40.0:fleet 详情页标题也限宽,防止长标题挤掉 ⋮ 菜单 */
#fd-title { min-width: 0; max-width: 50vw; }
/* v0.40.0:菜单容器不收缩,保证 ⋮ 按钮始终可见 */
.topbar .menu { flex: 0 0 auto; }
/* R5:chips 单行横滑;min-height 56px-12px 纵向 padding=44px 内容行,
   恰好容纳 .kr-fbtn::after 的 44px 命中区(overflow-x:auto 下纵向不溢出=无纵向滚动条) */
#infobar, #fd-infobar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  min-height: 56px;
  -webkit-overflow-scrolling: touch;
}
#infobar::-webkit-scrollbar, #fd-infobar::-webkit-scrollbar { display: none; }
/* R5:chip 收一档(24px pill/11px/text-dim),与 segmented 控件和正文拉开层级 */
#infobar .info-chip, #fd-infobar .info-chip {
  height: 24px;
  min-height: 0;
  padding: 0 9px;
  font-size: 11px;
  border-radius: 12px;
  background: var(--card);
  border-color: var(--hairline);
  color: var(--text-dim);
}
/* R5:视图 toggle 保持 32px 触控方钮(icon-only,态走 aria-pressed) */
#infobar .kr-view-toggle, #fd-infobar .kr-view-toggle {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 13px;
}
/* R6:可点 chip 命中区扩 44px(行内容高恰 44px,::after 不被横滑容器裁切;
   仅 button chip——static chip 无交互不扩) */
#infobar button.info-chip, #fd-infobar button.info-chip { position: relative; }
#infobar button.info-chip::after, #fd-infobar button.info-chip::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: max(44px, 100%);
  height: max(44px, 100%);
  transform: translate(-50%, -50%);
}

/* 390 移动端:过程卡缩进不溢出 */
@media (max-width: 480px) {
  .turn-process {
    padding-left: 8px;
    margin-left: 2px;
  }
  details.process-card summary {
    font-size: 12px;
  }
  /* v0.27.5:390 下过滤 chips 缩小防溢出切字(王佐实测:AI结论/我的输入/过程被切) */
  .kr-filter-bar {
    flex-shrink: 1;
    min-width: 0;
  }
  .kr-fbtn {
    padding: 3px 7px;
    font-size: 12px;
    min-height: 24px;
    line-height: 24px;
  }
  #infobar .info-chip, #fd-infobar .info-chip {
    font-size: 10px;
    padding: 0 7px;
    height: 22px;
  }
  /* v0.31.4:390 下 infobar 允许换行,筛选区独立成行——根治重叠/挤压/切字 */
  #infobar, #fd-infobar {
    flex-wrap: wrap;
    padding-right: 8px;
    row-gap: 4px;
  }
  /* info-chips 行(模型/思考/权限/上下文)保持横排不换行 */
  #infobar .info-chip, #fd-infobar .info-chip {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* 筛选栏 + 视图 toggle 独占第二行,取满宽 */
  #infobar .kr-filter-bar, #fd-infobar .kr-filter-bar {
    flex-basis: auto;
    order: 10;
    margin-left: 0;
    margin-top: 2px;
  }
  #infobar .kr-view-toggle, #fd-infobar .kr-view-toggle {
    order: 11;
    margin-left: auto;
  }
  /* 筛选按钮恢复可读尺寸(有独立行后不再被挤压) */
  .kr-filter-bar {
    gap: 2px;
  }
  .kr-fbtn {
    font-size: 13px;
    padding: 4px 10px;
    min-height: 28px;
    line-height: 28px;
  }
}

/* v0.45.1:#fd-artifacts 芯片与 #fd-infobar 同高(防止 grok 子代理/终端芯片比 info-chip 高一截) */
#fd-artifacts { padding: 0 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#fd-artifacts .info-chip {
  height: 22px;
  min-height: 0;
  padding: 0 9px;
  font-size: 11px;
  border-radius: 12px;
  background: var(--card);
  border-color: var(--hairline);
  color: var(--text-dim);
}

/* v0.31.1:发送失败重发提示条(输入框上方) */
.draft-retry-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 0 8px 4px;
  background: rgba(255, 120, 80, 0.12);
  border: 1px solid rgba(255, 120, 80, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: #ffb090;
  animation: draftRetryIn .25s ease;
}
@keyframes draftRetryIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.draft-retry-icon { font-size: 15px; flex-shrink: 0; }
.draft-retry-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-retry-btn {
  flex-shrink: 0;
  padding: 4px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 160, 120, 0.4);
  background: rgba(255, 140, 100, 0.18);
  color: #ffd0b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.draft-retry-btn:active { background: rgba(255, 140, 100, 0.32); }
.draft-retry-dismiss {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.fd-earlier{display:block;width:100%;min-height:44px;margin:8px 0;}

/* v0.42.0 — 指令导航 (command navigation) */
.kr-cmdnav-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  margin-left: 2px;
  /* v0.42.1:对齐 filter bar 内其他 chip 行高,防止 44px trigger 撑高整行 */
  height: 100%;
  flex-shrink: 0;
}
.kr-cmdnav-filter {
  border-radius: 6px 0 0 6px !important;
  margin-left: 0 !important;
  /* v0.42.1:与 trigger 等高,由父 kr-cmdnav-chip 统一约束 */
  height: 100%;
}
.kr-cmdnav-trigger {
  border-radius: 0 6px 6px 0 !important;
  min-width: 44px;
  /* v0.42.1:去掉 min-height:44px——改用 ::after 命中区,不撑高 filter bar 行 */
  min-height: 0;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px !important;
  font-size: 12px;
  color: #b0b8c4;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 0;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
/* v0.42.1:触摸命中区 44px 用 ::after 实现,不撑高父行 */
.kr-cmdnav-trigger::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: max(44px, 100%);
  height: max(44px, 100%);
  transform: translate(-50%, -50%);
}
.kr-cmdnav-trigger:active { background: rgba(255,255,255,0.12); }

/* Sheet overlay */
.instr-sheet-mask {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.55);
  opacity: 0; transition: opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
.instr-sheet-mask.open { opacity: 1; }

/* Sheet container */
.instr-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 9001;
  height: 62vh;
  background: #101215;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.instr-sheet.open { transform: translateY(0); }

/* Grabber */
.instr-sheet-grabber {
  width: 36px; height: 4px;
  background: #3a4048;
  border-radius: 2px;
  margin: 8px auto 4px;
  flex-shrink: 0;
}

/* Header */
.instr-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 6px;
  flex-shrink: 0;
}
.instr-sheet-title {
  font-size: 15px; font-weight: 600; color: #e6e9ec;
}
.instr-sheet-earlier {
  font-size: 13px; color: #7c8590;
  background: none; border: none; cursor: pointer;
  padding: 6px 10px; min-height: 44px;
}
.instr-sheet-earlier:active { color: #b0b8c4; }

/* Scrollable list */
.instr-sheet-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Date header */
.instr-date-header {
  position: sticky; top: 0; z-index: 1;
  background: #101215;
  padding: 6px 16px 4px;
  font-size: 12px; font-weight: 600; color: #7c8590;
}

/* Item row */
.instr-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: start;
  gap: 4px;
  padding: 12px 14px;
  min-height: 56px;
  cursor: pointer;
  transition: background .12s;
  content-visibility: auto;
  contain-intrinsic-size: auto 56px;
}
.instr-item:active { background: rgba(255,255,255,0.06); }

/* Sequence number */
.instr-seq {
  font-size: 12px; font-family: monospace; color: #6b7480;
  padding-top: 2px;
}

/* Body: two-line clamp */
.instr-body { min-width: 0; }
.instr-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px; color: #d3d8dd; line-height: 1.4;
  word-break: break-word;
}

/* Time + state */
.instr-time {
  font-size: 11px; color: #7c8590;
  white-space: nowrap;
  padding-top: 2px;
  display: flex; align-items: center; gap: 4px;
}

/* Pending / undelivered indicators */
.instr-state { font-size: 10px; }
.instr-pending { color: #e0a750; }
.instr-undelivered { color: #9aa3ad; font-size: 11px; }

/* More hint */
.instr-more-hint {
  padding: 12px 16px;
  font-size: 12px; color: #6b7480; text-align: center;
}

/* Locate highlight: green glow, breathe x2 then fade */
@keyframes kr-locate-glow {
  0%, 100% { outline: 2px solid transparent; box-shadow: none; }
  25%, 75% { outline: 2px solid #3f7f6a; box-shadow: 0 0 0 6px rgba(63,127,106,0.18); }
}
.kr-locate {
  outline: 2px solid #3f7f6a;
  box-shadow: 0 0 0 6px rgba(63,127,106,0.18);
  animation: kr-locate-glow 1.2s ease-in-out 1;
  outline-offset: 2px;
}

/* reduced-motion: no animation */
@media (prefers-reduced-motion: reduce) {
  .kr-locate { animation: none; outline: 2px solid #3f7f6a; box-shadow: 0 0 0 6px rgba(63,127,106,0.18); }
  .instr-sheet { transition: none; }
  .instr-sheet-mask { transition: none; }
}

/* P0: 过程卡折叠 (reasoning/tool_call/tool_result) */
.process-card { background: var(--card-sunken); border: 1px solid var(--hairline); border-radius: 10px; margin: 6px 0; padding: 0; overflow: hidden; }
.process-card summary { padding: 8px 12px; font-size: 13px; line-height: 1.5; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.process-card summary::marker { content: ''; }
.process-card summary::before { content: '▸'; display: inline-block; transition: transform .15s; }
.process-card[open] summary::before { transform: rotate(90deg); }
.process-card .body { padding: 0 12px 10px; font-size: 13px; line-height: 1.5; color: var(--text-dim); border-top: 1px solid var(--hairline); }

/* P0: user 右对齐气泡 + assistant 左对齐竖线 */
.msg.user .bubble { background: var(--accent-dim); color: #fff; border-radius: 12px 12px 4px 12px; max-width: 82%; margin-left: auto; }
.msg.assistant .bubble { border-left: 2px solid var(--rail); padding-left: 10px; background: none; max-width: 100%; }

/* P0: 代码块独立滚动 */
.bubble pre, .bubble code { overflow-x: auto; max-width: 100%; }
.bubble pre { background: var(--code-bg); border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre; word-break: normal; }

/* P0: 长消息折叠 */
.msg-truncated .msg-full { display: none; }
.msg-truncated .msg-expand { display: block; }
.msg-expand-btn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 4px 0; }

/* P0: 思考中占位卡 */
.thinking-placeholder { background: var(--card-sunken); border: 1px solid var(--hairline); border-radius: 10px; padding: 10px 14px; margin: 6px 0; color: var(--text-dim); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.thinking-placeholder .dot-pulse { animation: dotPulse 1.4s infinite; }
@keyframes dotPulse { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

/* P0: 计数对账告警 */
.count-warn { background: #2a2618; color: #f0d080; padding: 6px 12px; border-radius: 8px; font-size: 12px; margin: 4px 0; border-left: 3px solid var(--warn); }

/* ============ v0.52.6(rog-ux-0823)棒2:设备切换器健康色 ============ */
/* R3:视觉隐藏原生 select(不 display:none,保留可达性与表单语义);增强失败时保持可见可点 */
.machine-select.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0; padding: 0;
}
/* trigger(可见脸):8px pip + 机器名;390 沿用既有 max-width,不新增顶栏控件 */
.machine-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; max-width: 92px; padding: 5px 8px;
  background: transparent; border: 1px solid var(--line, rgba(255,255,255,.14));
  border-radius: 8px; color: inherit; font-size: 12px; cursor: pointer;
}
.machine-trigger .mh-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* pip:8×8 圆点,连通六态上色(负载永不进 trigger) */
.mh-pip { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block; }
.mh-pip[data-state="online"] { background: #22c55e; }
.mh-pip[data-state="tunnel_down"] { background: #eab308; }
.mh-pip[data-state="auth_error"] { background: #a855f7; }
.mh-pip[data-state="service_error"] { background: #f97316; }
.mh-pip[data-state="agent_stuck"] { background: #f97316; }
.mh-pip[data-state="offline"] { background: #ef4444; }
.mh-pip[data-state="unknown"], .mh-pip[data-state=""] { background: #6b7280; }
/* sheet 行内 SERVICE_ERROR/AGENT_STUCK 用空心橙(区分实心) */
.mh-pip.hollow { background: transparent; border: 2px solid #f97316; box-sizing: border-box; }
/* 棒10 F2:忙档实心橙(ONLINE 上的负载 hot 叠层,与 service_error 同色但实心=含义不同) */
.mh-pip[data-busy="1"] { background: #f97316 !important; }
/* 底栏 sheet 机器行:行高≥44px(触控),当前机高亮 */
.machine-sheet-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 14px; cursor: pointer; font-size: 14px;
}
.machine-sheet-row .ms-word { margin-left: auto; font-size: 12px; color: var(--text2, #9a9aa3); }
.machine-sheet-row[aria-selected="true"] { background: rgba(120,130,150,.14); font-weight: 600; }
@media (max-width: 420px) {
  .machine-trigger { max-width: 72px; font-size: 12px; padding: 5px 6px; }
}
