/* Hermes /m — 单栏 + 底部输入，Impeccable 蓝风格 */
:root {
  --bg: #0a0a0c;
  --surface: #141417;
  --surface-2: #1c1c21;
  --border: rgba(255,255,255,.09);
  --text: #ececf0;
  --text-2: #9a9aa4;
  --accent: #3b82f6;          /* impeccable blue */
  --accent-soft: rgba(59,130,246,.16);
  --danger: #ef4444;
  --ok: #22c55e;
  --code-bg: #0d0d10;         /* 代码块/图片衬底：浅色模式下要翻过来 */
  --code-fg: #e6e6ea;
  /* 间距尺度（8pt 网格）：段内、块间、轮次三级 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  color-scheme: dark;
}

/* 跟随系统：浅色模式一套等价的令牌（同一个蓝，只是明暗反过来） */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eceef2;
    --border: rgba(0, 0, 0, .10);
    --text: #15171c;
    --text-2: #4a5570;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, .10);
    --code-bg: #f4f5f7;
    --code-fg: #1f2430;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow-x: hidden;   /* 右滑返回时整页位移，别让页面横向滚 */
}
button { font: inherit; color: inherit; }

.view { height: 100%; display: flex; flex-direction: column; }

/* 会话页 = 盖在列表上的一层：右滑返回时下面露出的是真列表，不是空白。
   touch-action: pan-y 告诉浏览器「横向我自己处理」，避免和原生滚动打架。 */
#view-chat {
  position: fixed; inset: 0; z-index: 20;
  height: 100%;
  background: var(--bg);
  will-change: transform;
  transform: translate3d(0, 0, 0);
  touch-action: pan-y;
  /* 把重排/重绘关在这一层里：拖动时外面不用跟着算 */
  contain: layout paint style;
}
/* 拖动中不加阴影、不加圆角——全屏元素上的大 blur 阴影和圆角遮罩每帧都要重栅格化，
   这就是「滑一半卡住几秒」的元凶。改成 1px 硬边 + 下层压暗，成本几乎为零。 */
#view-chat.dragging { border-left: 1px solid rgba(0, 0, 0, .14); }

/* 下层的压暗用一层固定遮罩做透明度过渡，别对列表用 filter（整块重绘） */
#swipe-scrim {
  position: fixed; inset: 0; z-index: 19;
  background: #000; opacity: 0; pointer-events: none;
  transition: opacity .12s linear;
}
body.swiping #swipe-scrim { opacity: .16; }

#view-chat.settling { transition: transform .2s cubic-bezier(.16, .84, .3, 1); }

/* hidden 属性的 display:none 会被 .view 的 display:flex 盖掉（类选择器优先于
   UA 默认样式），必须显式声明，否则两个 view 会上下叠着都显示 */
[hidden] { display: none !important; }

/* ── 顶栏 ── */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.bar h1 { flex: 1; min-width: 0; font-size: 17px; font-weight: 650; margin: 0; letter-spacing: .2px; }
.bar .conn { margin-left: 8px; flex: 0 0 auto; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.bar .conn.on { color: var(--ok); }
.bar-title { flex: 1; min-width: 0; }
.bar-title .title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title .meta { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  background: none; border: none; font-size: 26px; line-height: 1;
  padding: 4px 8px; color: var(--text); cursor: pointer;
}
.chip {
  background: var(--accent-soft); color: var(--accent); border: none;
  border-radius: 999px; padding: 5px 10px; font-size: 11.5px; line-height: 1.35;
  cursor: pointer; flex: 0 0 auto;
  max-width: 28vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 列表页两个 chip 并排：各让一点宽度，防止挤掉标题/连接状态 */
.bar .chip { max-width: 32vw; }

/* ── 会话列表 ── */
.list { flex: 1; overflow-y: auto; padding: 4px 16px 24px; }
/* 搜索框：会话一多，翻列表不如直接搜 */
.list-search {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 0; background: var(--bg);
}
.list-search + .list .list-group:first-child { padding-top: 10px; }
.list-search input {
  flex: 1; min-width: 0; width: 100%; box-sizing: border-box;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; font-size: 15px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.list-search input:focus { border-color: var(--accent); }
/* 新建会话：挪到搜索框右边，不再用悬浮球压住列表最后一条 */
.new-btn {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; border: none;
  font-size: 22px; line-height: 1; padding: 0 0 2px;
}
.new-btn:active { filter: brightness(.92); }
.list-search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }

/* 分组标题：今天 / 昨天 / 本周 / 更早 */
.list-group {
  padding: 20px 0 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: var(--text-2);
}
.list-group:first-child { padding-top: 12px; }
.list-group:first-child { padding-top: 6px; }

/* 会话行：不再用卡片，平铺 + 细分隔线，信息密度更高 */
.session-row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-radius: 10px;
  cursor: pointer;
}
.session-row + .session-row { box-shadow: inset 0 1px 0 var(--border); }
.session-row:active { background: var(--surface-2); }
.session-row .main { flex: 1; min-width: 0; }
.session-row .t {
  font-size: 15px; font-weight: 500; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-row .s {
  font-size: 12.5px; color: var(--text-2); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-row .side {
  flex: 0 0 54px; display: flex; flex-direction: column;
  align-items: flex-end; gap: 3px; margin-top: 1px;
}
.session-row .when { font-size: 11.5px; color: var(--text-2); }
.session-row .cnt { font-size: 10.5px; color: var(--text-2); opacity: .62; }
.session-row .busy-dot {
  position: absolute; left: -11px; top: 9px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: pulse 1.2s ease-in-out infinite;
}
/* 不忙的时候也占着这 7px，不然标题左边缘会跟着跳 */
.session-row .busy-dot.off { display: none; }
.list-note {
  display: block; width: 100%; margin: 14px 0 0; padding: 10px 8px;
  background: none; border: none; text-align: center;
  color: var(--text-2); font-size: 11.5px; opacity: .8;
}
.list-note:active { opacity: 1; }
.empty { text-align: center; color: var(--text-2); padding: 48px 20px; font-size: 14px; }

.fab, .fab-unused {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 26px;
  border: none; box-shadow: 0 6px 18px rgba(59,130,246,.4);
  cursor: pointer; z-index: 20;
}

/* ── 会话页 ── */
.transcript {
  flex: 1; overflow-y: auto;
  padding: 18px 14px 22px;
  display: flex; flex-direction: column;
}
/* 空正文行一律不占位：真实回合里 message.start 会夹在工具调用之间，
   哪怕 JS 那边漏删，也不能留下一个 20px 的空档把间距撑乱。 */
.row.assistant:has(> .text:empty) { display: none; }

/* 行一律不收缩：flex 项默认 flex-shrink:1，加上 overflow:hidden 就会被压成半截 */
.transcript > * { flex: 0 0 auto; }
/* 节奏只有三档，其余一律 10px：
     32px —— 新的一轮（用户开口）之前
     20px —— 用户提问 → 我的回答
     10px —— 同一轮里面所有块（正文、工具行、推理行）上下间距都一样
   以前工具行上面 16、下面 5、中间还夹着空的助手行，所以看着乱。 */
.transcript > * { margin-top: 0; }
.transcript > * + * { margin-top: 8px; }
.transcript > .row.user { margin-top: 32px; }
.transcript > .row.assistant { margin-top: 20px; }
.transcript > .row.tool.activity { margin-top: 8px; }
/* 操作列表本身要紧凑：工具连工具 6px，工具下面接正文 8px */
.transcript > .row.tool.activity + .row.tool.activity { margin-top: 6px; }
/* 工具行下面收一档：上面 8、下面 6（正文行自带 5px 行距，看上去才平） */
.transcript > .row.tool.activity + .row.assistant { margin-top: 6px; }
.transcript > .row.reasoning + .row.assistant { margin-top: 8px; }

.row { max-width: 88%; }
.row.user {
  align-self: flex-end; max-width: 84%;
  background: var(--accent); color: #fff;
  padding: 11px 15px; border-radius: 18px 18px 4px 18px;
  font-size: 15.5px; line-height: 1.5;
}
.row.assistant.streaming::after { content: '▍'; color: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

.row .thinking {
  font-size: 12.5px; color: var(--text-2); font-style: italic;
  border-left: 2px solid var(--accent); padding-left: 10px; margin-bottom: 8px;
  white-space: pre-wrap; word-break: break-word;
}
.row .text { white-space: pre-wrap; word-break: break-word; }
.row.assistant .text { letter-spacing: .01em; }

.row.tool {
  align-self: stretch;
  background: none; border: none; padding: 0 2px; border-radius: 0;
  font-size: 12.5px; color: var(--text-2);
  font-family: ui-monospace, monospace;
}
.row.tool .name { color: var(--accent); font-weight: 600; }
.row.tool.done .name::after { content: ' ✓'; color: var(--ok); }

/* 工具活动行：一条就够，显示「在做什么 · 具体内容」，新操作就地覆盖 */
.row.tool.activity {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  max-width: 100%; padding: 0 2px;
  font-family: inherit; font-size: 12.5px; line-height: 1.52;
  background: none; border: none;
  white-space: nowrap;          /* 不加 overflow:hidden：加了之后 flex 项会被压成半截 */
}
/* 图标代替中文动词：15px 线性 SVG，跟着文字颜色走 */
.row.tool.activity .ico {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 15px; height: 15px; color: var(--text-2);
}
.row.tool.activity .ico svg { width: 15px; height: 15px; display: block; }
.row.tool.activity.done .ico { opacity: .55; }
.row.tool.activity:not(.done) .ico { color: var(--accent); opacity: 1; }

.row.tool.activity .detail {
  color: var(--text-2); opacity: .82; overflow: hidden;
  text-overflow: ellipsis; max-width: 74vw;
}

/* 正在跑的那一行：一道流光从左扫到右 */
.row.tool.activity:not(.done) {
  position: relative; overflow: hidden; border-radius: 4px;
}
.row.tool.activity:not(.done)::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 60%;
  background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, .38) 50%, transparent 100%);
  animation: tool-sweep 1.35s linear infinite;
  pointer-events: none;
}
@keyframes tool-sweep { from { left: -60%; } to { left: 100%; } }
.row.tool.activity:not(.done) .ico { animation: pulse 1.35s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* 长会话：上面的老消息按需加载，别一进来就画几百行 */
.load-older {
  display: block; width: 100%; margin: 6px 0 12px; padding: 10px;
  background: none; border: 1px dashed var(--border); border-radius: 10px;
  color: var(--text-2); font: inherit; font-size: 12.5px;
}
.load-older:active { background: var(--surface-2); color: var(--text); }

/* 回合结束的小工具条：复制 / 完成时间 / 用时 */
.row.turn-meta {
  display: flex; align-items: center; gap: 7px;
  margin-top: 8px; width: 100%;
  /* .row 的 88% 上限会把这一行截短 40px，右边的「完成时间」就贴不到正文右缘。
     这一条要整行宽，跟 dsh 的 .row-actions 一样铺满。 */
  max-width: none;
  /* 2px 和 .row.assistant 的内边距对齐：那一层也有 padding: 0 2px，
     不补这一下，「完成」会比正文凸出去 2px。 */
  padding: 0 2px;
  font-size: 12px; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.transcript > .row.turn-meta { margin-top: 6px; }
.row.turn-meta .tm-btn {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-2);
}
.row.turn-meta .tm-btn svg { width: 15px; height: 15px; display: block; }
.row.turn-meta .tm-btn:active { background: var(--surface-2); color: var(--text); }

/* 两个时间靠右：用时在前、完成时间在后 */
.row.turn-meta .tm-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.row.turn-meta .tm-sep { opacity: .45; }

/* 推理：只有一行，随流刷新最后一行，不换行 */
.row.reasoning {
  align-self: flex-start; display: flex; align-items: center; gap: 8px;
  max-width: 100%; padding: 0 2px;
  font-size: 13px; color: var(--text-2);
  white-space: nowrap; overflow: hidden;
}
.row.reasoning .dot {
  flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-2); opacity: .55; animation: pulse 1.2s ease-in-out infinite;
}
.row.reasoning.done .dot { animation: none; opacity: .3; }
.row.reasoning.done .line { opacity: .85; }
.row.reasoning .line {
  overflow: hidden; text-overflow: ellipsis; max-width: 84vw;
  font-style: italic; letter-spacing: .01em;
}

/* ── Markdown（助手消息）─────────────────────────────────────────────────── */
.row .text p { margin: 0 0 var(--sp-3); }
.row .text p:last-child { margin-bottom: 0; }
.row .text h1, .row .text h2, .row .text h3, .row .text h4 {
  margin: var(--sp-5) 0 var(--sp-2); line-height: 1.32; font-weight: 600;
}
.row .text > *:first-child { margin-top: 0; }
.row .text h1 { font-size: 17px; }
.row .text h2 { font-size: 16px; }
.row .text h3 { font-size: 15px; }
.row .text h4 { font-size: 14px; }
.row .text ul, .row .text ol { margin: var(--sp-2) 0 var(--sp-3); padding-left: 20px; }
.row .text li { margin: 0; }
.row .text li + li { margin-top: 6px; }
.row .text a { color: var(--accent); text-decoration: underline; word-break: break-all; }
.row .text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; background: var(--surface-2);
  padding: 1px 5px; border-radius: 5px;
}
.row .text blockquote {
  margin: 14px 0; padding: 2px 10px;
  border-left: 2px solid var(--accent-soft); color: var(--text-2);
}
.row .text hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }

/* 代码块：横向滚动 + 复制（头只留「复制」，省一行高度） */
.row .text .code {
  margin: 14px 0; border: 1px solid var(--border); border-left: 2px solid var(--accent-soft); border-radius: 10px;
  overflow: hidden; background: var(--code-bg);
}
.code-h {
  display: flex; align-items: center;
  padding: 3px 11px; background: var(--surface-2);
  color: var(--text-2);
}
.code-h .copy {
  margin-left: auto; background: none; border: 1px solid transparent;
  color: var(--text-2); border-radius: 6px; padding: 2px 7px; font-size: 10.5px;
  opacity: .8;
}
.code-h .copy:active { opacity: 1; border-color: var(--border); background: var(--surface); }
.row .text pre {
  margin: 0; padding: 9px 11px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.row .text pre code {
  background: none; padding: 0; font-size: 13px; line-height: 1.55;
  white-space: pre; word-break: normal;
  color: var(--code-fg);
}

/* 表格：窄屏横向滚动，不撑破气泡 */
.row .text .tbl { overflow-x: auto; margin: 14px 0; -webkit-overflow-scrolling: touch; }
.row .text table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.row .text th, .row .text td {
  border: 1px solid var(--border); padding: 6px 8px;
  text-align: left; white-space: nowrap;
}
.row .text th { background: var(--surface-2); font-weight: 600; }

/* 助手消息：不要气泡，直接铺在背景上（像我们在电脑上聊天那样） */
.row.assistant {
  align-self: stretch;
  max-width: 100%;
  background: none; border: none; padding: 0 2px;
  border-radius: 0;
  font-size: 16px; line-height: 1.62;
}
/* 用户消息略小一点，视觉上有主次 */
.row.user { font-size: 15px; }

/* ── 回到底部按钮 ────────────────────────────────────────────────────────── */
.scroll-btn {
  position: fixed; right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); font-size: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); z-index: 15;
}
/* 未读角标：上翻期间来了几条就显示几 */
.scroll-btn .n {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; padding: 2px 5px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 10px; line-height: 1; font-weight: 600; text-align: center;
}

/* ── 图片 / 附件 ─────────────────────────────────────────────────────────── */
.row .text .media { margin: 6px 0; }
.row .text .md-img-gone {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; white-space: nowrap;
}
.row .text .md-img {
  display: block; max-width: 100%; height: auto;
  margin: 6px 0; border-radius: 10px;
  border: 1px solid var(--border); background: var(--code-bg);
}
.row .text .md-file {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 100%; margin: 6px 0; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text);
  text-decoration: none; font-size: 13.5px;
}
.row .text .md-file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 点图放大 */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ── 安装提示条 ─────────────────────────────────────────────────────────── */
.install-bar {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 0; padding: 9px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, .35);
  border-radius: 12px; font-size: 13px; color: var(--text);
}
.install-bar .t { flex: 1; min-width: 0; }
.install-bar button {
  flex: 0 0 auto; border: none; border-radius: 8px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  background: var(--accent); color: #fff;
}
.install-bar .x { background: none; color: var(--text-2); font-size: 18px; padding: 0 4px; }

/* ── 审批 ── */
.approval {
  margin: 8px 10px; padding: 0; background: none; border: none;
  max-height: 46vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.appr-item {
  padding: 12px;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .4);
  border-radius: 12px;
}
.appr-head {
  font-size: 11.5px; font-weight: 600; color: var(--danger);
  margin-bottom: 6px; letter-spacing: .2px;
}
.approval-text { font-size: 13.5px; margin-bottom: 10px; white-space: pre-wrap; word-break: break-word; }
.approval-btns { display: flex; gap: 10px; }
.btn {
  flex: 1; padding: 11px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); font-weight: 600; cursor: pointer;
}
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ── 输入区 ── */
.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 10px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--surface); border-top: 1px solid var(--border);
}
/* 附件按钮：高度跟输入框单行一致（42px），输入框变高时贴底不居中 */
.composer .pick {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); font-size: 20px; line-height: 1; padding: 0 0 1px;
}
.composer .pick:active { background: var(--surface-2); }
/* 待发附件 */
.attach-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 8px 10px 0; background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.chip-attach {
  position: relative;
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  max-width: 220px; padding: 5px 28px 5px 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; font-size: 12px;
}
.chip-attach img { width: 42px; height: 42px; object-fit: cover; border-radius: 9px; }
.chip-attach .ic {
  width: 42px; height: 42px; display: grid; place-items: center;
  font-size: 19px; border-radius: 9px; background: var(--surface);
}
.chip-attach .nm { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-attach .x {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); border: none; color: #fff;
  font-size: 13px; line-height: 1; padding: 0; border-radius: 50%;
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px; min-height: 42px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font: inherit; font-size: 16px; /* 防 iOS 缩放 */
  line-height: 1.4; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.send {
  background: var(--accent); color: #fff; border: none;
  border-radius: 12px; min-height: 42px; padding: 0 16px;
  display: grid; place-items: center;
  font-weight: 600; font-size: 14px;
  cursor: pointer; flex: 0 0 auto;
}
.send:disabled { opacity: .4; cursor: default; }
@media (prefers-color-scheme: light) {
  .send:disabled { opacity: 1; background: var(--surface-2); color: var(--text-2); }
  /* 浅色里整块高饱和蓝太重：改成浅蓝底 + 深蓝字，跟界面更合 */
  .row.user { background: #e6eeff; color: #1e3a8a; }
  /* 代码块：浅底上要给得出分层，复制按钮别再半透明 */
  .row .text .code { border-color: rgba(0, 0, 0, .10); border-left-color: rgba(37, 99, 235, .45); }
  .code-h { border-bottom: 1px solid rgba(0, 0, 0, .06); }
  .code-h .copy { opacity: 1; color: var(--text-2); }
  .composer textarea::placeholder { color: #6b7488; opacity: 1; }
  #toast { box-shadow: 0 6px 20px rgba(15, 23, 42, .14); }
  .scroll-btn { box-shadow: 0 4px 14px rgba(15, 23, 42, .16); }
}
.send.stop { background: var(--danger); }

/* ── 底部 sheet（模型选择器等）── */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30;
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  background: var(--surface); border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--border);
  max-height: 78vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .22s ease-out;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.sheet-head .t { font-size: 15px; font-weight: 600; flex: 1; }
.sheet-head .x {
  background: none; border: none; color: var(--text-2); font-size: 22px;
  padding: 2px 8px; cursor: pointer;
}
.sheet-filter {
  margin: 10px 14px 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; color: var(--text); font-size: 16px; outline: none;
}
.sheet-filter:focus { border-color: var(--accent); }
.sheet-body { overflow-y: auto; padding: 4px 10px 14px; }
.provider-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text); font-weight: 600;
  padding: 12px 8px; cursor: pointer; user-select: none;
  border-radius: 8px;
}
.provider-h:active { background: var(--surface-2); }
.provider-h .cnt { color: var(--text-2); font-weight: 400; font-size: 11.5px; }
.provider-h .chev { margin-left: auto; color: var(--text-2); font-size: 12px; transition: transform .15s; }
.provider-h.open .chev { transform: rotate(90deg); }
.provider-h .cur { font-size: 11px; color: var(--accent); font-weight: 400; }
.provider-models { padding-left: 10px; }
.model-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; border-radius: 10px; cursor: pointer;
  font-family: ui-monospace, monospace; font-size: 13px;
}
.model-row:active { background: var(--surface-2); }
.model-row.current { color: var(--accent); font-weight: 600; }
.model-row.current::after { content: '✓ 当前'; margin-left: auto; font-size: 11px; font-family: inherit; }
.model-row .free { margin-left: auto; font-size: 11px; color: var(--ok); font-family: inherit; }
.sheet-empty { padding: 30px; text-align: center; color: var(--text-2); font-size: 13px; }

/* ── Bot 切换 ── */
.bot-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; border-radius: 10px; cursor: pointer;
}
.bot-row:active { background: var(--surface-2); }
.bot-row .main { flex: 1; min-width: 0; }
.bot-row .name { font-size: 14px; font-weight: 600; }
.bot-row .desc {
  font-size: 12px; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bot-row .tag { font-size: 11px; color: var(--text-2); flex: 0 0 auto; }
.bot-row.current .name, .bot-row.current .tag { color: var(--accent); }

/* 轻提示（附件反馈），贴在输入框上方 */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(8px);
  bottom: calc(env(safe-area-inset-bottom) + 86px);
  max-width: 86vw; padding: 8px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; font-size: 12.5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 40; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 拖文件进来时给输入区一个框 */
.composer.dragging { outline: 2px dashed var(--accent); outline-offset: -6px; border-radius: 14px; }

/* 提醒开关：哑铃图标，开了就点亮；iOS 没装到桌面时置灰（点了会解释原因） */
.push-btn { flex: 0 0 auto; width: 30px; height: 30px; margin-left: 2px; }
.push-btn svg { display: block; }
.push-btn.on { color: var(--accent); }
.push-btn.on::after {
  content: ''; position: absolute; right: 3px; top: 3px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.push-btn { position: relative; }
.push-btn.off-ios { opacity: .45; }
