:root {
  --bg: #ffffff; --side: #f7f8fa; --panel: #ffffff; --fg: #1d2127; --muted: #6b7380; --faint: #747c88;
  --border: #e5e8ec; --hover: #eef0f3; --active: #e6ebf5;
  --accent: #2f6fed; --accent-fg: #fff; --user-bg: #2f6fed; --user-fg: #fff;
  --code-bg: #f3f4f6; --out-bg: #16191e; --out-fg: #d7dce2;
  --green: #1f9d55; --red: #cf3b3b; --yellow: #d9a31b; --gray: #b3b9c2;
  --green-t: #187a42; --red-t: #c43030; --warn: #8a5a00; --ok-bg: #187a42;
  --add-bg: #e3f6e8; --del-bg: #fbe7e7;
  --col: 820px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c; --side: #1b1e23; --panel: #1f2228; --fg: #e3e6ea; --muted: #8b93a1; --faint: #838b98;
    --border: #2d323b; --hover: #262a31; --active: #2a3242;
    --accent: #4a82f2; --user-bg: #2c4f9e; --user-fg: #f2f5fb;
    --code-bg: #262a32; --out-bg: #0e1013; --out-fg: #cfd5dc; --gray: #5b626d;
    --add-bg: #17301f; --del-bg: #381c1c;
    --green-t: #3cc07a; --red-t: #ff8080; --warn: #f0c860; --red: #d64545; --ok-bg: #1f9d55;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--panel); color: var(--fg); border-radius: 6px; padding: 5px 12px; line-height: 1.4; }
button:hover:not(:disabled) { background: var(--hover); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
button.danger { background: var(--red); color: #fff; border-color: var(--red); }
button.danger:hover:not(:disabled) { background: var(--red); filter: brightness(1.08); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
a.btn-link { font: inherit; text-decoration: none; border-radius: 6px; line-height: 1.4; display: inline-block; }
a.ghost { color: var(--muted); }
a.ghost:hover { background: var(--hover); color: var(--fg); }
button.sm, a.sm { padding: 2px 9px; font-size: 12px; }
input, textarea, select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.composer-box textarea:focus-visible, .title-edit:focus-visible, .list-title-edit:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
svg.ico { flex: none; vertical-align: -3px; }
textarea { resize: none; flex: 1; min-width: 0; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }

.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--side); }
.login-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; width: min(320px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.login-box h1 { margin: 0; font-size: 20px; }
.login-box p { margin: 0; color: var(--muted); }
.login-box button { padding: 8px; }
.err-text { color: var(--red-t); min-height: 1.4em; }

.app { display: flex; height: 100%; height: 100dvh; height: var(--app-h, 100dvh); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* ---------- 侧栏 ---------- */
.sidebar { width: 264px; flex: none; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; position: relative; }
.brand { font-weight: 650; font-size: 15px; flex: 1; display: flex; align-items: center; gap: 6px; }
.logo { color: var(--accent); }
.new-btn { padding: 4px 12px; font-size: 13px; flex: none; }
.new-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-list { list-style: none; margin: 0; padding: 4px 8px 8px; overflow-y: auto; flex: 1; min-height: 0; border-top: 1px solid var(--border); }
.group-head { font-size: 11px; color: var(--faint); padding: 10px 8px 4px; letter-spacing: .02em; }
.list-empty { color: var(--faint); font-size: 12px; padding: 16px 8px; text-align: center; }
.chat-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 2px 8px; border-radius: 6px; min-height: 34px; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item.active .t { font-weight: 600; }
.chat-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .dot { width: 7px; height: 7px; }
.chat-item .dot.stopped { background: transparent; border: 1px solid var(--gray); }
/* 会话标题是真正的按钮（可聚焦、Enter 打开）；⋯ 平时不占位，悬停 / 聚焦时覆盖在标题右侧 */
.chat-main { background: none; border: none; padding: 5px 0; text-align: left; color: inherit; font: inherit; border-radius: 4px; cursor: pointer; }
.chat-main:hover:not(:disabled) { background: none; }
.row-more { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; padding: 3px 5px; border: none; border-radius: 6px; background: var(--hover); color: var(--muted); opacity: 0; pointer-events: none; }
.chat-item.active .row-more { background: var(--active); }
.chat-item:hover .row-more, .chat-item:focus-within .row-more, .chat-item.menu-open .row-more { opacity: 1; pointer-events: auto; }
.row-more:hover:not(:disabled) { color: var(--fg); background: var(--border); }
.chat-item.renaming .row-more { display: none; }
.row-menu { position: fixed; z-index: 40; min-width: 150px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.row-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none; background: transparent; border-radius: 6px; padding: 6px 10px; font-size: 13px; min-height: 32px; }
.row-menu-item:hover, .row-menu-item:focus-visible { background: var(--hover); }
.row-menu-item.danger-text:last-child { border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; margin-top: 3px; padding-top: 7px; }

.side-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.ws-box { display: flex; flex-direction: column; gap: 6px; }
.ws-line { display: flex; align-items: center; gap: 7px; font-size: 12px; padding: 2px 4px 2px 8px; }
.ws-title { flex: none; color: var(--fg); }
.ws-text { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-confirm { font-size: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.ws-confirm-btns { display: flex; gap: 6px; }
.ws-err { min-height: 0; font-size: 12px; padding: 0 8px; }
.ws-err:empty { display: none; }
.avatar { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; margin-right: 4px; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.me-role { font-size: 11px; color: var(--faint); }
.me-role:empty { display: none; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: none; }
.dot.creating { background: var(--yellow); }
.dot.running { background: var(--green); }
.dot.stopped { background: var(--gray); }
.dot.error { background: var(--red); }
.spin { width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.tag { font-size: 11px; padding: 0 7px; border-radius: 10px; background: var(--code-bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; flex: none; }
.tag.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag.warn { background: var(--del-bg); color: var(--red-t); border-color: var(--red); }

/* ---------- 主区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 8px; padding: 0 16px; height: 52px; flex: none; border-bottom: 1px solid var(--border); background: var(--bg); }
.top-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; min-width: 0; flex: 0 1 auto; border: none; background: none; padding: 2px 4px; border-radius: 6px; color: var(--fg); }
.top-title:hover:not(:disabled) { background: none; text-decoration: underline dotted; }
.top-title:disabled { opacity: 1; cursor: default; }
.title-edit { flex: 1; min-width: 0; padding: 2px 8px; font-weight: 600; }
.cwd-btn { border: 1px solid var(--border); background: var(--code-bg); color: var(--muted); border-radius: 10px; padding: 0 8px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; font-size: 11.5px; line-height: 1.6; }
.cwd-btn:hover:not(:disabled) { color: var(--accent); background: var(--code-bg); }
.cwd-edit { padding: 2px 8px; min-width: 0; flex: 0 1 220px; }
.top-gap { flex: 1; min-width: 4px; }
.top-status { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.files-btn { flex: none; }
.icon-btn { display: none; padding: 2px 8px; flex: none; }

.messages { flex: 1; overflow-y: auto; padding: 20px 24px 32px; }
.messages > * { max-width: var(--col); margin-left: auto; margin-right: auto; min-width: 0; }
.empty { color: var(--muted); text-align: center; margin-top: 80px; }
.msg { margin: 14px auto; }
.msg.user { display: flex; justify-content: flex-end; margin-top: 24px; }
.msg.user .bubble { background: var(--user-bg); color: var(--user-fg); padding: 8px 14px; border-radius: 18px; max-width: 80%; white-space: pre-wrap; word-break: break-word; }
.msg.agent .md { word-break: break-word; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md li > ul, .md li > ol { margin: 2px 0 2px; }
.md .md-h { margin: 14px 0 6px; line-height: 1.35; font-weight: 650; }
.md h1 { font-size: 1.35em; }
.md h2 { font-size: 1.2em; }
.md h3 { font-size: 1.08em; }
.md h4 { font-size: 1em; color: var(--muted); }
.md .md-h:first-child { margin-top: 0; }
.md blockquote { margin: 0 0 8px; padding: 2px 0 2px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.md blockquote > :last-child { margin-bottom: 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md-table { overflow-x: auto; margin: 0 0 10px; }
.md table { border-collapse: collapse; font-size: 13px; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 10px; vertical-align: top; }
.md th { background: var(--code-bg); font-weight: 600; text-align: left; }
.md .al-center { text-align: center !important; }
.md .al-right { text-align: right !important; }
.md code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md a { color: var(--accent); }
.codeblock { margin: 6px 0 10px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--code-bg); border-bottom: 1px solid var(--border); padding: 1px 4px 1px 10px; min-height: 24px; }
.codeblock .lang { color: var(--muted); font-size: 11px; }
.cb-copy { font-size: 11px; padding: 0 8px; border-color: transparent; background: transparent; color: var(--muted); }
.cb-copy:hover:not(:disabled) { color: var(--fg); }
.codeblock pre { margin: 0; padding: 10px 12px; overflow-x: auto; background: var(--code-bg); }
.codeblock pre code { background: none; padding: 0; }

.reasoning { color: var(--muted); font-size: 12px; margin: 8px auto; }
.reasoning summary { cursor: pointer; width: max-content; }
.reasoning div { padding: 4px 0 0 14px; white-space: pre-wrap; border-left: 2px solid var(--border); margin: 4px 0 0 4px; }

.card { border: 1px solid var(--border); border-radius: 8px; background: var(--panel); margin: 8px auto; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 12px; background: var(--code-bg); width: 100%; border: none; border-radius: 0; text-align: left; color: var(--fg); }
.card-head.toggle { cursor: pointer; user-select: none; }
.card-head.toggle:hover { background: var(--hover); }
.card-head .chev { color: var(--faint); width: 12px; height: 12px; flex: none; display: inline-flex; transition: transform .15s; }
.card.collapsed .card-head .chev { transform: rotate(-90deg); }
.card-head .cmd { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.badge { padding: 0 7px; border-radius: 10px; font-size: 11px; color: #fff; background: var(--muted); flex: none; }
.badge.run { background: var(--yellow); color: #1d2127; }
.badge.ok { background: var(--ok-bg); }
.badge.bad { background: var(--red); }
.card.failed .card-head .cmd { color: var(--red-t); }
.card .dur { color: var(--muted); flex: none; }
.card .out { margin: 0; padding: 8px 12px; background: var(--out-bg); color: var(--out-fg); max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.card .more { font-size: 12px; padding: 3px 12px; color: var(--accent); cursor: pointer; background: var(--out-bg); border: none; border-radius: 0; width: 100%; text-align: left; }
.fc-file { border-top: 1px solid var(--border); }
.fc-file summary { cursor: pointer; padding: 6px 10px; font-size: 12px; display: flex; gap: 8px; }
.fc-file summary .kind { color: var(--muted); }
.fc-file summary .fc-path { min-width: 0; overflow-wrap: anywhere; }
.fc-stat { margin-left: auto; display: inline-flex; gap: 6px; flex: none; }
.fc-add { color: var(--green-t); }
.fc-del { color: var(--red-t); }
.diff { margin: 0; padding: 6px 0; overflow-x: auto; background: var(--code-bg); }
.diff div { padding: 0 10px; white-space: pre; }
.diff .add { background: var(--add-bg); color: var(--green-t); }
.diff .del { background: var(--del-bg); color: var(--red-t); }
.diff .hunk { color: var(--muted); }

.notice { margin: 8px auto; padding: 6px 12px; border-radius: 6px; font-size: 13px; background: var(--code-bg); color: var(--muted); }
.notice.err { background: var(--del-bg); color: var(--red-t); }

.composer { padding: 0 24px 16px; background: var(--bg); flex: none; }
.composer-box { max-width: var(--col); margin: 0 auto; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 8px 10px 6px 12px; display: flex; flex-direction: column; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.composer-box:focus-within { border-color: var(--accent); }
.composer-box textarea { border: none; padding: 4px 0; background: transparent; min-height: 44px; max-height: 40vh; flex: none; overflow-y: hidden; }
.composer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.composer-actions .hint { flex: 1; font-size: 11px; color: var(--faint); }
.composer-actions button { padding: 3px 14px; }
.mp-wrap { position: relative; min-width: 0; }
.composer-actions .mp-pill { display: flex; align-items: center; gap: 4px; max-width: 100%; border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); background: transparent; border-color: var(--border); }
.mp-pill #mp-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-chev { font-size: 11px; flex: none; }
.mp-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 25; min-width: 190px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); display: flex; flex-direction: column; max-height: min(70vh, 560px); overflow-y: auto; }
.mp-head { font-size: 11px; color: var(--faint); padding: 6px 10px 2px; }
.mp-head:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--border); padding-top: 8px; }
.composer-actions .mp-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border-color: transparent; background: transparent; border-radius: 8px; padding: 5px 10px; font-size: 13px; }
.mp-item:hover, .mp-item:focus-visible { background: var(--hover); }
.mp-check { color: var(--accent); }
.mp-menu:has(.mp-row) { min-width: 280px; }
.mp-sub { position: fixed; right: auto; bottom: auto; width: 260px; z-index: 30; }
.mp-backdrop { position: fixed; inset: 0; z-index: 24; background: rgba(0,0,0,.35); }
.mp-filter { margin: 2px 4px 6px; padding: 5px 8px; font-size: 13px; flex: none; width: calc(100% - 8px); }
.mp-label { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; text-align: left; }
.composer-actions .mp-item.two { padding: 7px 10px; }
.mp-name { color: var(--fg); }
.mp-note { font-size: 11px; color: var(--faint); white-space: normal; }
.mp-desc { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; white-space: normal; line-height: 1.45; }
.mp-sep { height: 1px; background: var(--border); margin: 4px 2px; flex: none; }
.mp-row { width: 100%; }
.mp-val { color: var(--muted); font-size: 12px; }
.mp-badge { display: inline-block; margin-left: 6px; font-size: 10px; padding: 0 6px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.mp-badge.warn { background: #fdf0c8; color: var(--warn); }
@media (prefers-color-scheme: dark) { .mp-badge.warn { background: #4a3a10; } }
.mp-label .mp-badge { margin-left: 0; margin-top: 2px; }
.mp-inline { display: flex; flex-direction: column; margin: 2px 0 4px 10px; padding-left: 6px; border-left: 2px solid var(--border); }
.mp-row[aria-expanded="true"] .mp-val { color: var(--fg); }
.err-bar { max-width: var(--col); margin: 0 auto 6px; color: var(--red-t); background: var(--del-bg); padding: 4px 10px; border-radius: 6px; font-size: 13px; }
.err-bar.bar-x { display: flex; align-items: flex-start; gap: 8px; }
.bar-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bar-close { flex: none; border: none; background: none; color: inherit; opacity: .6; padding: 2px; line-height: 1; margin-top: 2px; }
.bar-close:hover:not(:disabled) { opacity: 1; background: none; }

/* ---------- 文件抽屉 ---------- */
.btn-link { color: var(--fg); background: var(--panel); text-decoration: none; font-size: 12px; line-height: 1.4; border: 1px solid var(--border); border-radius: 6px; padding: 2px 10px; white-space: nowrap; cursor: pointer; }
.btn-link:hover { background: var(--hover); }
.drawer { width: 400px; flex: none; background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 52px; flex: none; border-bottom: 1px solid var(--border); }
.drawer-head strong { flex: 1; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
.crumbs button { border: none; background: none; color: var(--accent); padding: 0 4px; }
.crumbs .cur { padding: 0 4px; font-weight: 600; word-break: break-all; }
.crumbs .sep { color: var(--muted); }
.files-list { flex: 1; overflow-y: auto; }
.f-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); padding-right: 8px; }
.f-row:hover { background: var(--hover); }
.f-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; border: none; background: none; border-radius: 0; padding: 6px 4px 6px 12px; color: var(--fg); }
.f-main:hover:not(:disabled) { background: none; }
.f-ico { flex: none; display: inline-flex; color: var(--muted); }
.f-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-size { color: var(--muted); font-size: 12px; flex: none; }
.f-dl { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--accent); text-decoration: none; flex: none; padding: 2px 4px; border-radius: 4px; }
.f-dl:hover { background: var(--active); }
.f-empty { color: var(--muted); text-align: center; padding: 30px 12px; }
.files-preview { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pv-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.pv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-body { flex: 1; margin: 0; padding: 10px 12px; overflow: auto; background: var(--code-bg); white-space: pre; min-height: 0; }
.pv-msg { padding: 20px 12px; color: var(--muted); }
.drawer .err-bar { margin: 6px 12px; max-width: none; }
.side-backdrop { display: none; }

/* ---------- 弹窗：设置 ---------- */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; width: 760px; max-width: 100%; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head strong { font-size: 15px; }
.modal-head button { padding: 2px 10px; font-size: 12px; }
.set-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 模型账号 */
.acct-panel input { padding: 5px 8px; color: var(--fg); font-size: 13px; width: 100%; }
.acct-steps { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.acct-steps code { background: var(--code-bg); padding: 0 4px; border-radius: 4px; }
.acct-step { font-size: 13px; word-break: break-all; }
.acct-step a { color: var(--accent); }
.acct-code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct-code { font-size: 28px; font-weight: 700; letter-spacing: .12em; user-select: all; padding: 2px 10px; background: var(--code-bg); border-radius: 6px; }
.acct-switching { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--active); }

/* ---------- 手机 ---------- */
.side-close { display: none; padding: 2px 6px; flex: none; }
@media (max-width: 767px) {
  .side-backdrop { position: fixed; inset: 0; z-index: 9; background: rgba(0,0,0,.35); display: block; }
  .side-backdrop.hidden { display: none !important; }
  .sidebar { position: fixed; z-index: 10; top: 0; bottom: 0; left: 0; width: 280px; max-width: 85vw; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .side-close { display: inline-flex; }
  .row-more { opacity: 1; pointer-events: auto; position: static; transform: none; background: none; min-width: 40px; min-height: 40px; }
  .chat-item { min-height: 44px; }
  .chat-main { min-height: 40px; display: flex; align-items: center; }
  .arch-main { display: flex; }
  .proj-btn { opacity: 1; pointer-events: auto; min-width: 36px; min-height: 36px; }
  .proj-toggle { min-height: 40px; }
  .row-menu-item { min-height: 44px; font-size: 14px; }
  .icon-btn { display: inline-flex; align-items: center; }
  .drawer { inset: 0; width: auto; border-left: none; }
  .top { padding: 0 10px; gap: 6px; height: 48px; }
  .top-status .st-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cwd-btn { max-width: 110px; }
  .cwd-edit { flex: 1 1 100px; }
  .messages { padding: 12px 12px 24px; }
  .composer { padding: 0 8px 8px; }
  .composer-actions .hint { display: none; }
  .composer-actions .mp-wrap { flex: 1; }
  .composer-actions .mp-pill { max-width: 100%; }
  .msg.user .bubble { max-width: 92%; }
  .modal { padding: 6px; }
  .modal-box { padding: 12px; }
  /* 模型菜单：底部抽屉 */
  .mp-menu { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 25; min-width: 0; width: auto; max-height: 72vh; border-radius: 16px 16px 0 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
  .mp-menu:has(.mp-row) { min-width: 0; }
  .composer-actions .mp-item { min-height: 44px; }
}
/* 文件抽屉：窗口不够宽时盖在内容上，而不是把对话挤没 */
@media (max-width: 1099px) {
  .drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 15; width: min(400px, 100vw); box-shadow: -8px 0 30px rgba(0,0,0,.25); }
}
@media (max-width: 767px) { .drawer { width: auto; left: 0; } }
@media (hover: none) {
  .row-more { opacity: 1; pointer-events: auto; }
  .proj-btn { opacity: 1; pointer-events: auto; }
}

/* 项目分组 */
.proj-head { display: flex; align-items: center; gap: 2px; padding: 0 4px 0 0; margin-top: 4px; border-radius: 6px; min-height: 30px; font-size: 13px; }
.proj-head:hover { background: var(--hover); }
.proj-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: none; background: none; text-align: left; padding: 5px 6px 5px 4px; font-size: 13px; color: var(--fg); border-radius: 6px; }
.proj-toggle:hover:not(:disabled) { background: none; }
.proj-chev { width: 12px; flex: none; color: var(--faint); display: inline-flex; justify-content: center; }
.proj-ico { flex: none; display: inline-flex; color: var(--muted); }
.proj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--fg); }
.proj-count { flex: none; font-size: 11px; color: var(--faint); }
.proj-btn { opacity: 0; pointer-events: none; flex: none; display: inline-flex; align-items: center; justify-content: center; border: none; background: none; color: var(--muted); padding: 2px 5px; border-radius: 4px; }
.proj-head:hover .proj-btn, .proj-head:focus-within .proj-btn { opacity: 1; pointer-events: auto; }
.proj-btn:hover:not(:disabled) { background: var(--active); color: var(--fg); }
.chat-item.in-proj { margin-left: 14px; }
.proj-card { position: fixed; z-index: 30; width: 250px; max-width: calc(100vw - 16px); padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 6px; }
.pc-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; min-width: 0; }
.pc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-stat { color: var(--muted); font-size: 12.5px; }
.pc-path { text-align: left; border: none; background: var(--code-bg); border-radius: 6px; padding: 4px 8px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-path:hover:not(:disabled) { color: var(--accent); background: var(--code-bg); }
.pc-open { margin-top: 4px; text-align: center; }
/* 新建会话：目录选择器 */
.picker { position: absolute; left: 8px; right: 8px; top: calc(100% - 2px); z-index: 20; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); display: flex; flex-direction: column; max-height: min(70vh, 520px); overflow-y: auto; }
.pk-head { font-size: 11px; color: var(--faint); padding: 8px 8px 2px; }
.pk-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none; background: none; padding: 5px 8px; border-radius: 6px; }
.pk-item:hover, .pk-item:focus-visible { background: var(--hover); }
.pk-ico { flex: none; display: inline-flex; color: var(--muted); }
.pk-model { font-size: 12px; color: var(--muted); padding: 0 8px 4px; }
.pk-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-sub { flex: 0 1 45%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 11px; }
.pk-note { color: var(--faint); font-size: 12px; padding: 4px 8px; }
.pk-new { padding: 8px 2px 2px; }
.pk-new input { width: 100%; padding: 5px 8px; font-size: 13px; }
.pk-err { font-size: 12px; padding: 2px 4px 0; min-height: 0; }
.pk-err:empty { display: none; }

/* 侧栏底部账号菜单 */
.ws-line .icon { font-size: 14px; line-height: 1; padding: 3px 7px; }
.me-wrap { position: relative; }
button.me-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: none; background: transparent; border-radius: 8px; text-align: left; }
button.me-row:hover:not(:disabled), button.me-row[aria-expanded=true] { background: var(--hover); }
.me-row .avatar { margin-right: 0; }
.me-more { color: var(--faint); flex: none; display: inline-flex; }
.me-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 25; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.16); padding: 4px; display: flex; flex-direction: column; }
.me-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; text-align: left; border: none; background: transparent; border-radius: 6px; padding: 6px 10px; font-size: 13px; color: var(--fg); text-decoration: none; cursor: pointer; }
.me-item:hover, .me-item:focus-visible { background: var(--hover); }
.me-sub { font-size: 11px; color: var(--faint); }
.me-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.me-sep:last-child, .me-sep:first-child { display: none; }
.danger-text { color: var(--red-t); }

/* 侧栏重命名 */
.list-title-edit { flex: 1; min-width: 0; padding: 2px 6px; font-size: 14px; }

/* P8 图片输入 */
.queue { display: flex; flex-direction: column; gap: 4px; padding: 0 0 6px; }
.q-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 10px; background: var(--code-bg); border: 1px dashed var(--border); color: var(--muted); font-size: 13px; min-width: 0; }
.q-tag { flex: none; font-size: 11px; padding: 0 7px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); white-space: nowrap; }
.q-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-imgs { flex: none; font-size: 11px; }
.q-x { flex: none; width: 22px; height: 22px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: transparent; border-color: transparent; color: var(--muted); }
.q-x:hover { background: var(--hover); }
@media (hover: none) { .q-x { width: 32px; height: 32px; } }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px; }
.thumb { position: relative; width: 64px; height: 64px; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; display: block; }
.thumb-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border-radius: 50%; line-height: 1; display: flex; align-items: center; justify-content: center; background: var(--panel); }
.attach { padding: 3px 8px; background: transparent; border-color: transparent; display: inline-flex; align-items: center; }
.attach:hover:not(:disabled) { background: var(--hover); }
body.dragging .composer-box { border-color: var(--accent); border-style: dashed; }
.bubble-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.bubble-img { max-height: 160px; max-width: 100%; border-radius: 8px; cursor: zoom-in; display: block; background: rgba(255,255,255,.2); }
.bubble-text { white-space: pre-wrap; }
.bubble-imgs:last-child { margin-bottom: 0; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; object-fit: contain; border-radius: 4px; }

/* ---------- 设置弹窗（左侧标签） ---------- */
.set-box { width: 800px; padding: 0; gap: 0; max-height: 86vh; overflow: hidden; }
.set-box > .modal-head { padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--border); }
.set-layout { display: flex; min-height: 360px; flex: 0 1 auto; height: auto; max-height: calc(86vh - 50px); }
.set-nav { width: 150px; flex: none; padding: 10px 8px; border-right: 1px solid var(--border); background: var(--side); display: flex; flex-direction: column; gap: 2px; }
.set-tab { text-align: left; border: none; background: transparent; padding: 7px 12px; border-radius: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.set-tab:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
.set-tab.active { background: var(--active); color: var(--fg); font-weight: 600; }
.set-panes { flex: 1; min-width: 0; overflow-y: auto; padding: 18px 22px 22px; }
.set-pane { display: flex; flex-direction: column; gap: 12px; }
.set-title { font-size: 16px; font-weight: 600; }
.set-sub { font-size: 12px; color: var(--muted); line-height: 1.55; }
.set-sub code, .acct-steps code { background: var(--code-bg); padding: 0 4px; border-radius: 4px; }
.set-sub.grow { flex: 1; min-width: 0; }
.set-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); }
.set-card-title { font-weight: 600; font-size: 13px; }
.set-row { display: flex; align-items: center; gap: 12px; }
.set-k { color: var(--muted); font-size: 12px; width: 36px; flex: none; }
.acct-panel input { padding: 6px 9px; font-size: 13px; width: 100%; }
.acct-steps li .btn-link { padding: 1px 8px; }
.set-form { display: flex; flex-direction: column; gap: 14px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.set-grid .span2 { grid-column: span 2; }
.set-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.set-grid input { padding: 6px 9px; color: var(--fg); font-size: 14px; width: 100%; }
.lbl-row { display: flex; align-items: center; gap: 8px; }
.set-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--red-t); background: var(--del-bg); border-radius: 8px; padding: 8px 10px; }
.set-confirm span { flex: 1 1 200px; }
#ssh-pub { width: 100%; resize: vertical; font: 12px/1.5 ui-monospace, Menlo, monospace; padding: 8px 10px; background: var(--code-bg); word-break: break-all; }
@media (max-width: 767px) {
  /* 手机上设置全屏，标签横向可滚动 */
  .modal:has(.set-box) { padding: 0; }
  .set-box { width: 100%; height: 100%; max-height: none; border-radius: 0; border: none; }
  .set-layout { flex-direction: column; flex: 1; min-height: 0; max-height: none; }
  .set-nav { width: auto; flex: none; flex-direction: row; border-right: none; border-bottom: 1px solid var(--border); padding: 6px; overflow-x: auto; }
  .set-tab { flex: none; text-align: center; }
  .set-panes { padding: 14px; }
  .set-grid { grid-template-columns: 1fr; }
  .set-grid .span2 { grid-column: auto; }
}

/* 可删除的错误提示 */
.notice-x { display: flex; align-items: flex-start; gap: 8px; }
.notice-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notice-x button.sm { flex: none; margin-top: 1px; }
.notice-del { flex: none; border: none; background: none; color: inherit; opacity: .55; padding: 2px 4px; line-height: 1; display: inline-flex; align-items: center; }
.notice-del:hover:not(:disabled) { opacity: 1; background: none; }
.notice-ok { flex: none; font-size: 12px; color: var(--green-t); }

/* 消息交互：时间分隔、悬停操作 */
.time-divider { text-align: center; color: var(--faint); font-size: 12px; margin: 22px auto 6px; }
.msg.user { flex-direction: column; align-items: flex-end; }
.msg-actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg.agent .msg-actions { margin-left: -6px; }
.msg-act { border: none; background: transparent; color: var(--faint); padding: 3px 7px; border-radius: 6px; line-height: 1; display: inline-flex; align-items: center; }
.msg-act:hover:not(:disabled) { background: var(--hover); color: var(--fg); }
@media (hover: none) { .msg-actions { opacity: 1; } }

/* 原地编辑用户消息 */
.edit-box { max-width: 100%; min-width: min(100%, 280px); background: var(--code-bg); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.edit-box:focus-within { border-color: var(--accent); }
.edit-text { border: none; background: transparent; padding: 0; resize: vertical; font-size: 14px; line-height: 1.6; min-height: 44px; }
.edit-bar { display: flex; align-items: center; gap: 8px; }
.edit-hint { flex: 1; min-width: 0; font-size: 11px; color: var(--faint); }
.edit-bar button { border-radius: 999px; padding: 4px 14px; }

/* 正在处理指示 */
.working { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px auto 6px; }
.working .dots { display: inline-flex; gap: 4px; }
.working .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .3; animation: wdot 1.2s infinite ease-in-out; }
.working .dots i:nth-child(2) { animation-delay: .2s; }
.working .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes wdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.working.retrying { color: var(--warn); }
.working.retrying .dots i { background: var(--yellow); }
.notice-x button.sm + button.sm { margin-left: -2px; }
.working .working-switch { margin-left: 4px; }
.working { flex-wrap: wrap; }
.working .working-thought { flex-basis: 100%; padding-left: 28px; font-size: 12.5px; color: var(--faint, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.notice-x { flex-wrap: wrap; }
.notice-x .notice-text { flex: 1 1 260px; }

/* 生成的图片 */
.gen-img-pic { display: block; max-width: 100%; max-height: 520px; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; background: var(--code-bg); }
.gen-img-cap { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; color: var(--faint); }
.gen-img-cap span { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* P14: Claude Code engine */
.eng-badge { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; line-height: 1; }
.pk-seg { display: flex; gap: 2px; padding: 3px; margin: 2px 2px 4px; border-radius: 8px; background: var(--code-bg); border: 1px solid var(--border); }
.pk-seg-btn { flex: 1; border: none; background: transparent; padding: 4px 8px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.pk-seg-btn.on { background: var(--panel); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.pk-warn { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--warn); padding: 2px 8px 4px; }
.pk-warn.hidden { display: none; }
#cl-text { resize: vertical; min-height: 64px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; width: 100%; }
#cl-label { width: 100%; padding: 6px 9px; font-size: 13px; }

/* Claude 账号：添加方式标签 + OAuth */
.cl-tabs { margin: 0; }
.cl-tabs .pk-seg-btn { cursor: pointer; }
.cl-tab { display: flex; flex-direction: column; gap: 10px; }
.cl-tab.hidden, .cl-oa-run.hidden { display: none; }
.cl-oa-run { display: flex; flex-direction: column; gap: 10px; }
.cl-link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cl-link-row input { flex: 1 1 200px; min-width: 0; font-family: ui-monospace, monospace; font-size: 12px; }
.cl-open { display: inline-flex; align-items: center; text-decoration: none; padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--fg); cursor: pointer; font-size: 12px; white-space: nowrap; }

.mp-item.dis { opacity: .5; cursor: not-allowed; }
.mp-item.dis:hover { background: transparent; }
.mp-reason { font-size: 11px; color: var(--muted); flex: none; }

/* 回复中的图片预览 + 放大层下载 */
.msg-imgs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.msg-img { margin: 0; max-width: 100%; }
.msg-img img { display: block; max-width: min(100%, 520px); max-height: 360px; border-radius: 10px; border: 1px solid var(--border); background: var(--code-bg); cursor: zoom-in; }
.msg-img figcaption { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--faint); margin-top: 4px; }
.msg-img figcaption a { color: var(--accent); text-decoration: none; }
.msg-img-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.lightbox { flex-direction: column; gap: 12px; }
.lb-bar { display: flex; gap: 10px; }
.lb-btn { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 6px 16px; font-size: 13px; text-decoration: none; cursor: pointer; }
.lb-btn:hover { background: rgba(255,255,255,.26); }

/* 归档 */
.chat-list.hidden, .arch-view.hidden { display: none; }
.arch-entry { flex: none; border: none; border-top: 1px solid var(--border); border-radius: 0; background: none; color: var(--muted); text-align: left; padding: 8px 14px; font-size: 12.5px; }
.arch-entry:hover:not(:disabled) { color: var(--accent); background: var(--hover); }
.arch-view { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.arch-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px; }
.arch-title { font-weight: 600; font-size: 14px; }
.arch-search { margin: 4px 8px 6px; width: auto; }
.arch-list { border-top: none; }
.arch-item { align-items: flex-start; }
.arch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.arch-sub { font-size: 11px; color: var(--faint); white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.arch-tag { flex: none; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; background: var(--code-bg); }
.arch-note { max-width: var(--col); margin: 0 auto 6px; color: var(--muted); background: var(--code-bg); padding: 4px 10px; border-radius: 6px; font-size: 13px; }
.arch-note.hidden { display: none; }
.link-btn { border: none; background: none; padding: 0; color: var(--accent); font-size: inherit; text-decoration: underline; cursor: pointer; }
.pc-confirm { color: var(--red-t); font-size: 12.5px; }
.pc-row { display: flex; gap: 6px; }

/* 历史分页：顶部“加载更早消息” */
.more-bar { text-align: center; padding: 4px 0 12px; }

/* ---------- P18：toast、空态、确认框、减少动态效果 ---------- */
.toast-box { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; max-width: min(520px, 92vw); }
.toast-item { background: var(--fg); color: var(--bg); padding: 6px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.25); animation: toast-in .18s ease-out; overflow-wrap: anywhere; }
.toast-item.err { background: var(--red); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.empty-state { text-align: center; margin-top: 8vh; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.es-title { font-size: 18px; font-weight: 600; color: var(--fg); }
.es-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.es-chip { font-size: 12px; padding: 1px 10px; border-radius: 999px; background: var(--code-bg); border: 1px solid var(--border); color: var(--muted); }
.es-sub { font-size: 13px; margin-top: 6px; }
.es-prompts { display: flex; flex-direction: column; gap: 8px; width: min(100%, 460px); }
.es-prompt { text-align: left; padding: 9px 14px; border-radius: 10px; font-size: 13.5px; color: var(--fg); }
.confirm-modal { z-index: 60; }
.confirm-box { width: min(400px, 100%); gap: 12px; padding: 18px; }
.confirm-title { font-size: 15px; }
.confirm-text { font-size: 13px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.confirm-actions { justify-content: flex-end; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spin { animation: none; border-top-color: var(--border); border-right-color: var(--accent); }
  .working .dots i { animation: none; opacity: .7; }
}

/* ---------- P19：我的机器 ---------- */
.mach-list { display: flex; flex-direction: column; gap: 10px; }
.mach-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--panel); display: flex; flex-direction: column; gap: 8px; }
.mach-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mach-head strong { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.mach-head .grow { flex: 1; }
.mach-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; margin: 0; }
.mach-kv dt { color: var(--muted); }
.mach-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; gap: 6px; flex-wrap: wrap; }
.cmdbox { display: flex; align-items: stretch; gap: 8px; min-width: 0; margin-bottom: 8px; }
.cmdbox code { flex: 1; min-width: 0; display: block; overflow-x: auto; white-space: nowrap; font: 12px/1.5 ui-monospace, Menlo, monospace; padding: 8px 10px; background: var(--code-bg); color: var(--fg); border: 1px solid var(--border); border-radius: 6px; user-select: all; }
.cmdbox .cmd-copy { flex: none; display: inline-flex; align-items: center; justify-content: center; }
.mach-muted { font-size: 11.5px; color: var(--faint); }

.es-link { margin-top: 4px; }

/* ---- 账号卡片（P20 排版） ---- */
/* Claude 账号页 */
#cl-add { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 12px; }
#cl-add .cl-tab { display: flex; flex-direction: column; gap: 10px; }
#cl-add .cl-tab.hidden { display: none; }
#cl-add textarea, #cl-add input[type=text] { width: 100%; }
.cl-field { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.cl-field span { flex: none; font-weight: 600; }
.cl-field input { flex: 1; padding: 6px 9px; }
.cl-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.cl-foot .set-sub { font-size: 11.5px; color: var(--faint); }

/* P23：用户自己的 API 端点（Codex 卡片 + 表单）与 Claude 自定义端点字段 */
#acct-api, .src-sheet { padding: 16px; border-radius: 12px; }
#acct-api textarea, #acct-api select { width: 100%; font-size: 14px; }
#acct-api .set-actions .grow { flex: 1; min-width: 0; }
.cl-custom { display: flex; flex-direction: column; gap: 10px; }
.cl-custom.hidden { display: none; }
.cl-custom select { flex: 1; padding: 6px 9px; }
.cl-field.cl-top { align-items: flex-start; }
.cl-field textarea { flex: 1; }

/* P24 本机模式 */
.mode-pick { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.mode-opt { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; min-width: 0; }
.mode-opt:has(input:checked) { border-color: var(--accent); background: var(--active); }
.mode-opt input { margin-top: 4px; flex: none; }
.mode-opt span { display: flex; flex-direction: column; min-width: 0; }
.mode-opt small { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.os-pick { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.os-opt { display: flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.os-opt:has(input:checked) { border-color: var(--accent); background: var(--active); }
.mach-note { border: 1px solid var(--border); background: var(--code-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }
.mach-note code { font-size: 12px; }
.mach-warn { border: 1px solid var(--yellow); background: var(--code-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 12.5px; color: var(--warn); display: flex; flex-direction: column; gap: 6px; }
.mach-ws { display: flex; flex-direction: column; gap: 3px; color: var(--fg); font-size: 12px; }
.mach-ws input { width: 100%; }
.tag.native { background: var(--del-bg); color: var(--warn); border-color: var(--yellow); }
/* ---- P25：模型来源列表（ChatGPT / API / Claude 账号页共用） ---- */
.src-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.src-top-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.src-add { position: relative; flex: none; }
.src-add-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px 6px 10px; border-radius: 8px; font-weight: 500; }
.src-sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.src-list { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.src-list > .set-sub { padding: 14px 16px; }
.src-list.busy .src-row:not(.is-busy) { opacity: .55; pointer-events: none; }
.src-grp + .src-grp { border-top: 1px solid var(--border); }
.src-grp-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.src-count { font-weight: 500; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 999px; background: var(--code-bg); color: var(--faint); font-variant-numeric: tabular-nums; }
.src-empty { display: flex; align-items: center; gap: 6px; padding: 8px 16px 14px; font-size: 13px; color: var(--muted); }
.src-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 4px; padding: 6px 6px 6px 8px; min-height: 68px; transition: background .12s; }
.src-row + .src-row { border-top: 1px solid var(--border); }
.src-grp:last-child > .src-row:last-child { border-radius: 0 0 11px 11px; }
.src-row.can { cursor: pointer; }
.src-row.can:hover { background: var(--hover); }
.src-row.cur { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); box-shadow: inset 3px 0 0 var(--accent); }
.src-main { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 52px; padding: 4px 8px; text-align: left; border: none; background: none; border-radius: 10px; color: inherit; }
.src-main:hover:not(:disabled) { background: none; }
.src-main:disabled { opacity: 1; cursor: default; }
.src-radio { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gray); display: grid; place-items: center; transition: border-color .12s; }
.src-row.can:hover .src-radio { border-color: var(--accent); }
.src-row.cur .src-radio { border-color: var(--accent); }
.src-row.cur .src-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.src-radio .spin { width: 10px; height: 10px; border-width: 1.5px; }
.src-row.is-busy .src-radio { border-color: var(--accent); }
.src-mark { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--code-bg); color: var(--fg); display: grid; place-items: center; }
.src-mark.claude svg { width: 16px; height: 16px; }
.src-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.src-l1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.src-title { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-plan { flex: none; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 5px; background: var(--code-bg); color: var(--muted); }
.src-pill { flex: none; font-size: 11px; line-height: 18px; font-weight: 600; padding: 0 8px; border-radius: 999px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.src-l2 { display: block; font-size: 12px; line-height: 1.5; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-dot { margin: 0 6px; color: var(--faint); }
.src-l2 .warn { color: var(--warn); }
.src-l2 .bad { color: var(--red-t); }
.src-note { color: var(--faint); font-style: italic; }
.src-meter { display: flex; align-items: center; gap: 8px; width: 176px; padding: 8px; border: none; background: none; border-radius: 8px; font-size: 12px; color: var(--muted); }
button.src-meter:hover:not(:disabled) { background: var(--active); }
.src-meter.none { justify-content: flex-end; gap: 6px; color: var(--faint); }
.src-meter-sp { width: 0; }
.src-meter-k { flex: none; }
.src-bar { flex: 1; min-width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--fg) 12%, transparent); overflow: hidden; }
.src-fill { display: block; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--fg) 50%, transparent); }
.src-fill.orange { background: var(--yellow); }
.src-fill.red { background: var(--red); }
.src-meter-v { flex: none; min-width: 32px; text-align: right; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.src-meter-v.orange { color: var(--warn); }
.src-meter-v.red { color: var(--red-t); }
.src-more { position: relative; width: 40px; flex: none; }
.src-more-btn { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: none; background: none; color: var(--muted); border-radius: 10px; }
.src-more-btn:hover:not(:disabled), .src-more-btn[aria-expanded="true"] { background: var(--active); color: var(--fg); }
.src-extra { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 0 12px 10px 86px; }
.src-status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 12px; color: var(--muted); }
.src-status.warn { color: var(--warn); }
.gw-warn { margin: 2px 0 10px; flex-wrap: nowrap; align-items: flex-start; }
.gw-warn > svg { margin-top: 2px; }
.src-status.bad { color: var(--red-t); }
.src-status > svg { flex: none; }
.src-status .spin { width: 11px; height: 11px; border-width: 1.5px; }
.src-link { border: none; background: none; padding: 2px 4px; color: var(--accent); font-size: 12px; border-radius: 4px; }
.src-link:hover:not(:disabled) { background: none; text-decoration: underline; }
.src-detail { font-size: 12px; line-height: 1.7; color: var(--muted); background: var(--code-bg); border-radius: 8px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.src-noteedit input { width: 100%; font-size: 13px; padding: 6px 9px; }
.src-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--code-bg); }
.src-confirm-t { flex: 1 1 200px; font-size: 12.5px; color: var(--fg); }
.src-menu { position: absolute; z-index: 30; right: 0; top: calc(100% + 4px); min-width: 224px; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.16); }
.src-menu.up { top: auto; bottom: calc(100% + 4px); }
.src-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 8px; text-align: left; font-size: 13px; color: var(--fg); white-space: nowrap; }
.src-menu-item:hover:not(:disabled), .src-menu-item:focus-visible { background: var(--hover); }
.src-menu-item:focus-visible { outline-offset: -2px; }
.src-menu-item .ico, .src-menu-item .src-mark { flex: none; color: var(--muted); }
.src-menu-item .src-mark { width: 15px; height: 15px; background: none; border-radius: 0; }
.src-menu-item.src-danger, .src-menu-item.src-danger .ico { color: var(--red-t); }
.src-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.src-menu-foot { padding: 6px 10px 2px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); }
.src-menu-bd { display: none; }
@media (max-width: 480px) {
  .src-top { flex-direction: column; align-items: stretch; }
  .src-add-btn { width: 100%; justify-content: center; min-height: 40px; }
  .src-row { grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "main more" "meter meter"; padding: 6px 4px 6px 4px; }
  .src-main { grid-area: main; align-items: flex-start; gap: 10px; }
  .src-radio { margin-top: 3px; }
  .src-more { grid-area: more; align-self: start; }
  .src-more-btn { width: 44px; height: 44px; }
  .src-l1 { flex-wrap: wrap; row-gap: 2px; }
  .src-title { white-space: normal; overflow-wrap: anywhere; }
  .src-l2 { white-space: normal; }
  .src-meter { grid-area: meter; width: auto; margin: -2px 8px 4px 64px; padding: 8px 0; min-height: 40px; }
  .src-meter.none { justify-content: flex-start; }
  .src-meter-sp { display: none; }
  .src-extra { padding: 0 8px 10px 64px; }
  .src-link { padding: 10px 8px; margin: -8px 0; }
  .src-confirm button { min-height: 40px; padding: 4px 16px; }
  .src-menu-bd { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,.35); }
  .src-menu { position: fixed; z-index: 30; left: 0; right: 0; top: auto; bottom: 0; min-width: 0; border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 28px rgba(0,0,0,.25); }
  .src-menu-item { min-height: 48px; font-size: 15px; }
  .src-menu-foot { text-align: center; }
}

/* ---------- P27 A：手机基础（iOS 不缩放、安全区、触控目标） ---------- */
@media (max-width: 767px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select,
  .acct-panel input, .set-grid input, .set-grid textarea, .edit-text, .list-title-edit, .title-edit, .mp-filter, .src-noteedit input, #acct-api textarea, #acct-api select { font-size: 16px !important; }
  .composer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .toast-box { bottom: calc(84px + env(safe-area-inset-bottom)); }
  #toggle-side, .side-close, #ws-restart, .files-btn, .new-btn, .msg-act, button.sm, a.btn-link.sm, .cb-copy { min-height: 40px; min-width: 40px; }
  .files-btn, .new-btn, button.sm { padding-left: 12px; padding-right: 12px; }
  .msg-act { padding: 0 12px; justify-content: center; }
  .cb-copy { padding: 0 12px; font-size: 12px; }
  .cb-head { padding-right: 0; }
  .card-head { min-height: 40px; }
  .cwd-btn { position: relative; }
  .cwd-btn::after { content: ""; position: absolute; inset: -12px -4px; }
  .msg-actions { gap: 0; }
  .msg.agent .msg-actions { margin-left: -12px; }
  .msg.user .msg-actions { margin-right: -8px; }
}
@media (max-width: 767px) {
  .top { padding-top: env(safe-area-inset-top); height: calc(48px + env(safe-area-inset-top)); }
}

/* ---------- P27：每轮耗时 / token 页脚 ---------- */
.turn-stats { margin: 2px auto 10px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; gap: 2px 12px; cursor: default; }
.turn-stats[role=button] { cursor: pointer; }
.turn-stats[role=button]:hover { color: var(--muted); }
.ts-detail { color: var(--muted); }
@media (hover: none) { .turn-stats { min-height: 32px; align-items: center; } }

/* ---------- P27 B：连接状态条、通知开关 ---------- */
.conn-banner { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 3px 12px; font-size: 12px; color: var(--warn); background: color-mix(in srgb, var(--yellow) 18%, var(--bg)); border-bottom: 1px solid var(--border); }
.conn-banner .spin { width: 10px; height: 10px; border-width: 1.5px; }
.conn-banner.new-ver { color: var(--accent-fg); background: var(--accent); cursor: pointer; border: none; }
.nt-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.nt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nt-title { font-size: 14px; font-weight: 600; }
.nt-switch { flex: none; position: relative; width: 44px; height: 26px; padding: 0; border-radius: 999px; border: 1px solid var(--border); background: var(--code-bg); }
.nt-switch i { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--gray); transition: transform .15s, background .15s; }
.nt-switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.nt-switch[aria-checked="true"] i { transform: translateX(18px); background: #fff; }
@media (max-width: 767px), (pointer: coarse) { .nt-switch { min-height: 40px; height: 40px; width: 60px; } .nt-switch i { top: 9px; } .nt-switch[aria-checked="true"] i { transform: translateX(36px); } }

/* ---------- P27 E：Git / SSH 密钥 / 我的机器 与 P25 同一套行样式 ---------- */
.fm-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 12px; padding: 6px 16px; min-height: 48px; cursor: text; }
.fm-row + .fm-row { border-top: 1px solid var(--border); }
.fm-k { font-size: 13px; color: var(--muted); }
.fm-row input { width: 100%; min-width: 0; }
.fm-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.fm-confirm { margin: 0 12px 12px; }
.src-grp-h .src-count { margin-left: 2px; }
.src-list > .src-empty { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ssh-row, .mach-row { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
.ssh-row .src-extra, .mach-row .src-extra { padding: 8px 12px 4px 52px; }
.ssh-btn, .mach-rm { align-self: start; margin-top: 6px; }
.mach-row .dot { margin: 0 6px 0 2px; }
.mach-main { min-height: 44px; }
.src-detail.mach-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; }
#ssh-pub { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; width: 100%; }
.src-extra .src-confirm { margin-top: 2px; }
@media (max-width: 767px) {
  .fm-row { grid-template-columns: 1fr; gap: 2px; padding: 8px 14px; }
  .fm-foot button { min-height: 40px; }
  .ssh-row, .mach-row { grid-template-columns: minmax(0, 1fr); }
  .ssh-btn, .mach-rm { margin: 0 12px 4px 52px; justify-self: start; }
  .ssh-row .src-extra, .mach-row .src-extra { padding-left: 14px; }
}

/* P28 文件附件 */
.fchips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px; }
.fchip { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; width: 220px; max-width: 100%; padding: 6px 4px 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); overflow: hidden; }
.fchip-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.fchip-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip-meta { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fchip-done .fchip-meta { color: var(--green-t); }
.fchip-error { border-color: var(--red-t); }
.fchip-error .fchip-meta { color: var(--red-t); white-space: normal; }
.fchip-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .15s linear; }
.fchip-btn { flex: none; width: 28px; height: 28px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: transparent; border-color: transparent; color: var(--muted); }
.fchip-btn:hover { background: var(--hover); }
.fic { flex: none; width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .02em; color: #fff; background: #7a8494; }
.fic-pdf { background: #d64545; }
.fic-doc { background: #2f6fed; }
.fic-xls { background: #1f9d55; }
.fic-ppt { background: #d9772b; }
.fic-zip { background: #8a63d2; }
.fic-code { background: #3a4252; }
.bubble-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.bubble-files:last-child { margin-bottom: 0; }
.bfile { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 6px 10px 6px 6px; border-radius: 10px; background: rgba(255,255,255,.16); color: inherit; text-decoration: none; }
.bfile:hover { background: rgba(255,255,255,.26); }
.bfile-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bfile-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.bfile-size { font-size: 11px; opacity: .8; }
@media (hover: none), (max-width: 767px) {
  .fchip { width: 100%; min-height: 48px; }
  .fchip-btn { width: 40px; height: 40px; }
}

/* MCP 工具调用（浏览器）：紧凑的一行一步 */
.tcall { max-width: 100%; }
.tcall .card-head { min-height: 30px; }
.tcall .tc-ic { flex: none; display: inline-flex; color: var(--faint); }
.tcall .tc-sum { font-family: inherit; }
.tcall.running .tc-ic { color: var(--yellow); }
.tcall.failed .tc-sum { color: var(--red-t); }
.tcall .tc-err { padding: 4px 12px; font-size: 12px; color: var(--red-t); background: var(--out-bg); overflow-wrap: anywhere; }
.tcall .tc-body { padding: 0 0 4px; background: var(--out-bg); }
.tcall .tc-k { padding: 6px 12px 0; font-size: 11px; color: var(--faint); }
.tcall .tc-body .out { max-height: 200px; }
.tcall .tc-shots { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
.tcall .tc-shot { display: block; max-width: min(320px, 100%); max-height: 200px; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; background: var(--code-bg); }
.cap-note { padding: 10px 2px 0; }
@media (max-width: 767px), (pointer: coarse) { .tcall .tc-shot { max-width: 100%; } }

/* 桌面操控（P31）：会话顶部开关、执行中的红色横幅、我的机器里的总开关 */
.desk-toggle { flex: none; display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; font-size: 12px; color: var(--muted, var(--faint)); }
.desk-toggle .nt-switch { width: 36px; height: 20px; min-height: 0; }
.desk-toggle .nt-switch i { width: 14px; height: 14px; top: 2px; }
.desk-toggle .nt-switch[aria-checked="true"] { background: var(--red); border-color: var(--red); }
.desk-toggle .nt-switch[aria-checked="true"] i { transform: translateX(16px); }
.desk-toggle .desk-short { display: none; }
@media (max-width: 767px), (pointer: coarse) {
  .desk-toggle .nt-switch { min-height: 28px; height: 28px; width: 46px; }
  .desk-toggle .nt-switch i { top: 5px; width: 18px; height: 18px; }
  .desk-toggle .nt-switch[aria-checked="true"] i { transform: translateX(18px); }
  .desk-toggle .desk-long { display: none; }
  .desk-toggle .desk-short { display: inline; }
}
.desk-banner { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 12px; font-size: 14px; font-weight: 600; color: #fff; background: var(--red); border-bottom: 1px solid color-mix(in srgb, var(--red) 70%, #000); }
.desk-banner .desk-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: desk-pulse 1.2s ease-in-out infinite; }
.desk-banner .desk-sep { opacity: .7; }
.desk-banner button.danger { background: #fff; color: var(--red); border-color: #fff; font-weight: 700; }
@keyframes desk-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .desk-banner .desk-dot { animation: none; } }
.desk-card { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.desk-card .nt-row { padding: 0; }
.desk-perms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.desk-guide { margin-top: 6px; }

/* ---------- P32：虚拟桌面查看窗口（noVNC） ---------- */
.vd-panel { position: fixed; right: 16px; bottom: 16px; z-index: 30; width: min(720px, calc(100vw - 32px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden; }
.vd-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.vd-head strong { font-size: 14px; }
.vd-state { font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-state.err { color: var(--red-t); }
.vd-gap { flex: 1; }
.vd-op { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.vd-op .nt-switch { width: 36px; height: 20px; min-height: 0; }
.vd-op .nt-switch i { width: 14px; height: 14px; top: 2px; }
.vd-op .nt-switch[aria-checked="true"] { background: var(--red); border-color: var(--red); }
.vd-op .nt-switch[aria-checked="true"] i { transform: translateX(16px); }
.vd-stage { background: #0b0d10; aspect-ratio: 8 / 5; width: 100%; position: relative; }
.vd-screen { position: absolute; inset: 0; }
.vd-screen > div { background: #0b0d10 !important; }
.vd-foot { padding: 6px 14px 8px; font-size: 12px; }
@media (max-width: 767px), (pointer: coarse) {
  .vd-panel { left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 12px 12px 0 0; max-height: 92dvh; }
  .vd-op .nt-switch { min-height: 28px; height: 28px; width: 46px; }
  .vd-op .nt-switch i { top: 5px; width: 18px; height: 18px; }
  .vd-op .nt-switch[aria-checked="true"] i { transform: translateX(18px); }
  .vd-head button.sm { min-height: 32px; }
}
