/* ---------------------------------------------------------------------------
   DSH Cloud — 视觉语言借鉴 HuLa (github.com/HuLaSpark/HuLa)
   令牌取自其 src/styles/scss/global/variable.scss 与 theme/default.scss：
     主色 #13987F / 深 #1AB292，背景 #FAFAFA，面板 #F1F1F1，
     接收气泡 #FDFDFD，分割线 #E3E3E3，搜索框 #EAEAEA，圆角 12px，
     缓动 cubic-bezier(.4,0,.2,1) 200ms。
   --------------------------------------------------------------------------- */

:root {
  /* 取值来自 DSH 浅色主题（dsh-client-ui-theme/design-platform.css）：
     bg-base 纯白 / sidebar-fill #F9FAFB / label-primary #0F1115 /
     label-secondary #61666B / border-l1 4% / 品牌蓝 rgb(65,118,230) */
  --bg: #ffffff;
  --card: #ffffff;
  --sidebar: #f9fafb;
  --panel: #ffffff;
  --text: #0f1115;
  --muted: #61666b;
  --line: rgba(0, 0, 0, .1);
  --line-soft: rgba(0, 0, 0, .04);
  --accent: rgb(65, 118, 230);
  --accent-deep: rgb(38, 82, 180);
  --accent-soft: rgba(65, 118, 230, .08);
  --accent-2: rgb(65, 118, 230);
  --ok: #2f9e58;
  --bubble-in: #ffffff;
  --bubble-out: #0f1115;
  --search: #ebedf2;
  --hover: rgba(0, 0, 0, .04);
  --avatar: #f2f4f7;
  --danger: #d93a34;
  --shadow: 0 1px 2px rgba(15, 17, 21, .06);
  --shadow-pop: 0 8px 28px rgba(15, 17, 21, .12);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "PingFang SC", "PingFang", "Microsoft YaHei", "Segoe UI", sans-serif;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: #b0b0b0; }
.ico { display: block; flex: none; }

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ---------- 顶栏 ---------- */
.nav {
  padding-top: var(--safe-top);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.pane-list .nav { background: var(--sidebar); }
.nav-row {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}
.nav-btn {
  height: 34px;
  min-width: 36px;
  padding: 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  color: var(--text);
  transition: background-color .2s var(--ease);
}
.nav-btn:active { background: var(--hover); }
.nav-title { font-size: 16px; font-weight: 600; letter-spacing: .1px; }
.nav-actions { display: flex; align-items: center; gap: 2px; }
.device-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.online-dot.off { background: #cfd3d6; }
.chev { color: var(--muted); transition: transform .2s var(--ease); }

/* ---------- 搜索 ---------- */
.search-wrap { padding: 0 12px 8px; }
.search {
  height: 36px;
  background: var(--search);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  transition: background-color .2s var(--ease);
}
.search:focus-within { background: #e3e3e3; }
.search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  min-width: 0;
  color: var(--text);
}
.search .clear { color: var(--muted); display: flex; }

/* ---------- 列表 ---------- */
.list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(16px + var(--safe-bottom));
  background: var(--card);
}
.row {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  user-select: none;
  text-align: left;
  width: 100%;
  transition: background-color .2s var(--ease);
}
.row:active { background: var(--hover); }
.avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  background: var(--avatar);
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 16px; font-weight: 600;
}
.row-body { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-title {
  font-size: 15px; font-weight: 500; letter-spacing: .1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.row-time { font-size: 11px; color: var(--muted); flex: none; }
.row-bottom { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.row-sub {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.pill {
  flex: none; font-size: 10px; padding: 1px 7px; border-radius: 6px;
  background: var(--line-soft); color: var(--muted); letter-spacing: .2px;
}
.pill.running { background: var(--accent-soft); color: var(--accent-deep); }

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 56px 28px; line-height: 1.7; }
.empty b { display: block; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.loading { padding: 44px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 聊天 ---------- */
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--panel); position: relative; }
.chat .nav { background: var(--panel); border-bottom: 1px solid var(--line); }
.chat .nav-row { height: 52px; }
.chat-flow {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 16px 16px 8px;
}
/* 会话按 DSH 的排版：用户提问是一张小卡片，助手回复是整段 markdown */
.turn { margin-bottom: 16px; }
.turn.user { display: flex; justify-content: flex-end; }
.user-text {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  background: #f3f5f8;
  border: 0;
  box-shadow: none;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.6;
}
.sys-text {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
}
.turn-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .2px;
}
.turn.user .turn-meta { text-align: right; }

/* 图片：先用 ref 里的宽高撑出占位，滑到才加载 */
.imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.img-ph {
  width: 220px; max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #eef0f4;
  position: relative;
  display: grid;
  place-items: center;
}
.turn.user .img-ph { margin-left: auto; }
.img-ph img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.img-fail { font-size: 11px; color: var(--muted); }

/* 图片查看器 */
.viewer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 9, 11, .94);
  display: flex; flex-direction: column;
  animation: fade .16s var(--ease);
}
.viewer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(8px + var(--safe-top)) 14px 8px;
  color: rgba(255, 255, 255, .82); font-size: 12px;
}
.viewer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-close {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); color: #fff;
}
.viewer-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px calc(16px + var(--safe-bottom));
  position: relative;
}
.viewer-img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}
.viewer-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: rgba(255, 255, 255, .55);
}
.img-ph { cursor: zoom-in; }

/* markdown */
.md { font-size: 15px; line-height: 1.68; color: var(--text); word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 {
  margin: 18px 0 8px; font-weight: 600; line-height: 1.35;
}
.md h1 { font-size: 18px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > p { margin: 0 0 4px; }
.md code {
  font: 13px/1.5 ui-monospace, "SF Mono", Consolas, monospace;
  background: rgba(0, 0, 0, .05);
  color: var(--text);
  border-radius: 4px;
  padding: 1px 5px;
}
.md pre {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--sidebar);
  border: 1px solid var(--line-soft);
  overflow-x: auto;
}
.md pre code {
  background: none; color: var(--text); padding: 0;
  font-size: 12.5px; line-height: 1.6;
}
.md blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--accent-soft);
  color: var(--muted);
}
.md a { color: var(--accent); text-decoration: none; }
.md a:active { text-decoration: underline; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.md th { background: var(--line-soft); font-weight: 600; }
.md img { max-width: 100%; border-radius: 8px; }
.typing { padding: 2px 14px 14px; font-size: 12px; color: var(--muted); }

/* 右侧索引：照 DSH TurnNavigator —— 20×2 短横线、间距 10px、右对齐 */
.outline {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  max-height: min(calc(100% - 180px), 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  z-index: 6;
}
.outline::-webkit-scrollbar { display: none; }
.outline-item { position: relative; height: 10px; }
.outline-tick {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 8px;
}
.outline-tick::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: rgba(15, 17, 21, .16);
  transform-origin: 100%;
  transform: translateY(-50%) scaleX(.6);
  transition: transform .14s, background-color .14s;
}
.outline-tick.preview::before { background: var(--muted); transform: translateY(-50%) scaleX(.9); }
.outline-tick.on::before { background: var(--text); transform: translateY(-50%) scaleX(1); }

/* 预览卡：提问 1 行 + 回复 3 行（放在滚动容器外面，否则会被裁掉） */
.outline-tip {
  position: absolute;
  right: 52px;
  top: 0;
  transform: translateY(-50%);
  width: min(300px, 58vw);
  max-height: 100px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  overflow: hidden;
  z-index: 8;
  animation: tipIn .12s ease-out;
}
@keyframes tipIn { from { opacity: 0; transform: translate(4px, -50%) } }
.outline-tip-prompt {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.outline-tip-response {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
@media (max-width: 900px) {
  .outline { display: none; }
}

/* 细滚动条（DSH 观感） */
.chat-flow, .list, .sheet, .dir-list, .mask .sheet { scrollbar-width: thin; }
.chat-flow::-webkit-scrollbar,
.list::-webkit-scrollbar,
.sheet::-webkit-scrollbar,
.dir-list::-webkit-scrollbar { width: 8px; height: 8px; }
.chat-flow::-webkit-scrollbar-track,
.list::-webkit-scrollbar-track,
.sheet::-webkit-scrollbar-track,
.dir-list::-webkit-scrollbar-track { background: transparent; }
.chat-flow::-webkit-scrollbar-thumb,
.list::-webkit-scrollbar-thumb,
.sheet::-webkit-scrollbar-thumb,
.dir-list::-webkit-scrollbar-thumb {
  background: rgba(15, 17, 21, .16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.chat-flow::-webkit-scrollbar-thumb:hover,
.list::-webkit-scrollbar-thumb:hover,
.sheet::-webkit-scrollbar-thumb:hover,
.dir-list::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 17, 21, .32);
  background-clip: content-box;
}
.typing i {
  display: inline-block; width: 4px; height: 4px; margin-right: 3px;
  border-radius: 50%; background: var(--accent); opacity: .5;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .2 } 30% { opacity: .9 } }

/* ---------- 输入区 ---------- */
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--panel);
}
.input-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px 6px;
  box-shadow: var(--shadow);
  transition: border-color .2s var(--ease);
}
.input-card:focus-within { border-color: var(--accent-2); }
.input-card textarea {
  flex: 1; resize: none; border: 0; outline: none; background: transparent;
  min-height: 26px; max-height: 120px; line-height: 20px; font-size: 15px;
  padding: 2px 0; caret-color: var(--accent);
}

/* 工具按钮（添图 / 发送） */
.tool-btn {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tool-btn:active, .tool-btn:hover { background: var(--hover); color: var(--text); }

/* 工具行（两种布局都用） */
.input-tools {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}
.input-tools .grow { flex: 1; }

/* 模型 / 权限小胶囊 */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 8px; border-radius: 6px;
  background: var(--line-soft); color: var(--muted);
  font-size: 11px; max-width: 42%;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.chip:active, .chip:hover { background: var(--hover); color: var(--text); }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 宽屏：DSH 式多功能输入框 */
.composer.wide .input-card { padding: 10px 12px 8px; }
.composer.wide .input-card textarea { min-height: 44px; max-height: 220px; }
.composer-hint { font-size: 11px; color: var(--muted); }
.send-inline { width: 32px; height: 32px; border-radius: 8px; }

/* 待发送图片 */
.pending { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pending-item {
  position: relative; width: 56px; height: 56px;
  border-radius: 8px; overflow: hidden; background: var(--avatar);
}
.pending-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pending-x {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff;
}
.send {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--text); color: #fff;
  transition: background-color .2s var(--ease), transform .12s var(--ease), opacity .2s var(--ease);
}
.send:active { transform: scale(.94); }
.send:disabled { background: #cfd3d6; color: #fff; }
.stop-btn { color: var(--danger); }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .32);
  z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s var(--ease);
}
.mask.center { align-items: center; }
@keyframes fade { from { opacity: 0 } }
.sheet {
  width: 100%; max-width: 560px; background: var(--card);
  border-radius: 16px 16px 0 0; padding-bottom: var(--safe-bottom);
  max-height: 82vh; overflow-y: auto;
  box-shadow: var(--shadow-pop);
  animation: up .22s var(--ease);
}
@keyframes up { from { transform: translateY(18px); opacity: .5 } }
.sheet-title {
  padding: 16px 16px 10px; font-size: 12px; color: var(--muted);
  text-align: center; letter-spacing: .2px;
}
.sheet-item {
  min-height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--line-soft);
  font-size: 15px; text-align: left; width: 100%;
  transition: background-color .2s var(--ease);
}
.sheet-item:last-child { border-bottom: 0; }
.sheet-item:active { background: var(--hover); }
.sheet-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-item .meta { font-size: 11px; color: var(--muted); flex: none; }
.sheet-item .accent { color: var(--accent); }
.sheet-danger {
  justify-content: center;
  color: #b3261e;
  font-weight: 500;
}
/* 取消：做成分隔清楚的页脚，不留空行 */
.sheet-cancel {
  width: 100%; height: 52px; margin: 0;
  background: var(--sidebar);
  font-size: 15px; color: var(--muted);
  border: 0;
  border-top: 1px solid var(--line-soft);
}
.dialog {
  width: min(330px, 86vw); background: var(--card); border-radius: 14px; padding: 20px;
  box-shadow: var(--shadow-pop); animation: up .2s var(--ease);
}
.dialog h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.dialog p { margin: 0 0 16px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.dialog input {
  width: 100%; height: 40px; border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; outline: none; margin-bottom: 10px;
  font-size: 14px; background: var(--bg);
  transition: border-color .2s var(--ease);
}
.dialog input:focus { border-color: var(--accent-2); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.btn { height: 36px; padding: 0 16px; border-radius: 10px; font-size: 14px; }
.btn.ghost { color: var(--muted); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:active { background: var(--accent-deep); }

/* 目录浏览器 */
.path-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.path-row input { flex: 1; margin-bottom: 0; }
.path-btn { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--accent); }
.dir-sheet { display: flex; flex-direction: column; max-height: 82vh; overflow: hidden; }
/* 目录浏览器叠在「新建工作区」对话框之上 */
.mask.dir-mask { z-index: 60; }
/* 头部行不许被压缩，只有列表滚动 */
.dir-top, .dir-roots, .dir-crumbs, .dir-actions, .dir-new { flex: none; }
.dir-top {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 10px 8px 14px;
}
.dir-top .dir-roots { flex: 1; min-width: 0; padding: 0; }
.dir-close {
  flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
  background: var(--line-soft);
}
.dir-roots {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px 10px; overflow-x: auto;
}
.root-chip {
  flex: none;
  height: 26px; padding: 0 10px; border-radius: 7px;
  background: var(--line-soft); color: var(--text);
  font-size: 12px; font-weight: 500;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.root-chip.on { background: var(--accent); color: #fff; }
.root-chip:active { opacity: .85; }
.dir-crumbs {
  display: flex; align-items: center; gap: 1px;
  padding: 0 14px 10px; overflow-x: auto;
  border-bottom: 1px solid var(--line-soft);
}
.crumb {
  font-size: 12px; color: var(--accent); white-space: nowrap;
  padding: 2px 4px; border-radius: 4px;
}
.crumb:active { background: var(--hover); }
.crumb-sep { color: var(--muted); font-size: 11px; }
.dir-list { flex: 1; min-height: 0; overflow-y: auto; }
.dir-list .sheet-item { border-bottom: 1px solid var(--line-soft); }
.dir-ico { color: var(--accent); }
.dir-actions {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--line-soft);
  background: var(--card);
}
.dir-actions .grow { flex: 1; }
.dir-new-btn { color: var(--accent); display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; }
.dir-new {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--sidebar);
  border-top: 1px solid var(--line-soft);
}
.dir-new input {
  flex: 1; min-width: 0;
  height: 36px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card);
  outline: none; font-size: 14px;
}
.dir-new input:focus { border-color: var(--accent); }
.dir-new .btn { height: 34px; padding: 0 12px; }

/* ---------- 配对页 ---------- */
.pair { padding: 56px 28px; text-align: center; }
.pair h1 { font-size: 19px; margin: 0 0 8px; font-weight: 600; }
.pair p { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.pair .ok { color: var(--accent); font-weight: 600; margin-top: 18px; font-size: 15px; }
.pair .spin {
  width: 22px; height: 22px; margin: 0 auto 18px;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- 状态 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(24, 24, 28, .86); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 90;
  max-width: 78vw; text-align: center; backdrop-filter: blur(8px);
  animation: up .2s var(--ease);
}

/* ---------- 分栏（PC） ---------- */
.pane-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--sidebar);
}
.pane-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--panel);
}

.app.wide {
  flex-direction: row;
  max-width: 1180px;
  box-shadow: 0 0 0 1px var(--line);
}
.app.wide .pane-list {
  width: 358px;
  flex: none;
  border-right: 1px solid var(--line);
}
@media (max-width: 1040px) {
  .app.wide .pane-list { width: 300px; }
}
.app.wide .pane-chat {
  flex: 1;
  min-width: 0;
}
.app.wide .row.active { background: var(--accent-soft); }
.app.wide .search-wrap { padding: 0 12px 10px; }

.chat-head { flex: 1; min-width: 0; padding-right: 8px; }
.chat-head-title {
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-head-sub {
  margin-top: 2px; font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app.wide .chat .nav-row { height: 56px; }
.app.wide .chat-flow { padding: 20px 28px 8px; }
.app.wide .composer { padding: 10px 28px calc(12px + var(--safe-bottom)); }

/* 未选中会话时的占位 */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.chat-empty b { font-size: 15px; color: var(--text); font-weight: 500; }
.chat-empty-mark {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--card); color: var(--accent);
  box-shadow: var(--shadow); margin-bottom: 6px;
}