:root {
  color-scheme: light;
  --bg: #f3f2ee;
  --card: #fcfcfb;
  --border: #e6e4de;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6b6a66;
  --band: rgba(11, 11, 11, .04);
  --hover: rgba(11, 11, 11, .03);
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, .08);
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-text: #006300;
  --warning-text: #875800;
  --critical-text: #b42f2f;
  --add-bg: rgba(12, 163, 12, .08);
  --del-bg: rgba(208, 59, 59, .08);
  --chip: #eceae5;
  --user-bubble: #e3eefb;
  --code-bg: #efede8;
  --shadow: 0 1px 2px rgba(20, 20, 10, .04), 0 2px 8px rgba(20, 20, 10, .03);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs: 1;  /* 字号缩放：侧栏底部「字号」设置，1 = 正文 14px */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --card: #1a1a19;
    --border: #2c2c29;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9a998f;
    --band: rgba(255, 255, 255, .05);
    --hover: rgba(255, 255, 255, .03);
    --accent: #5598e7;
    --accent-soft: rgba(85, 152, 231, .10);
    --good-text: #4cc94c;
    --warning-text: #fab219;
    --critical-text: #e66767;
    --add-bg: rgba(76, 201, 76, .10);
    --del-bg: rgba(230, 103, 103, .10);
    --chip: #262624;
    --user-bubble: #1d3350;
    --code-bg: #222220;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111110;
    --card: #1a1a19;
    --border: #2c2c29;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9a998f;
    --band: rgba(255, 255, 255, .05);
    --hover: rgba(255, 255, 255, .03);
    --accent: #5598e7;
    --accent-soft: rgba(85, 152, 231, .10);
    --good-text: #4cc94c;
    --warning-text: #fab219;
    --critical-text: #e66767;
    --add-bg: rgba(76, 201, 76, .10);
    --del-bg: rgba(230, 103, 103, .10);
    --chip: #262624;
    --user-bubble: #1d3350;
    --code-bg: #222220;
    --shadow: none;
  }
* { box-sizing: border-box; }
html, body { height: 100%; }
/* 关掉手机浏览器的「自动放大文字」：iOS 横屏时会把字放大，内容一变（比如发了消息）又重新放大一遍 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: calc(14px * var(--fs))/1.6 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: calc(12px * var(--fs)); }
a { color: var(--accent); }

button, .btn, select, input, textarea {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
}
button, .btn { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
button:hover:not(:disabled), .btn:hover { border-color: var(--muted); }
button:disabled { opacity: .55; cursor: default; }
button.primary, .btn.primary { background: var(--text); color: var(--card); border-color: var(--text); }
button.primary:hover:not(:disabled), .btn.primary:hover { opacity: .88; }
button.danger { color: var(--critical-text); border-color: var(--critical-text); background: none; }
button.ghost { border-color: transparent; background: none; color: var(--muted); padding: 4px 8px; }
button.ghost:hover:not(:disabled) { color: var(--text); background: var(--band); border-color: transparent; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.logo { width: 26px; height: 26px; }
.error-text { color: var(--critical-text); margin: 0; }

/* 登录 */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; box-shadow: var(--shadow); }
.login-card p { margin: 0; font-size: calc(13px * var(--fs)); }
.login-card input { padding: 10px 12px; }
.login-card button { padding: 10px; }

/* 整体布局 */
.app { height: 100%; display: grid; grid-template-columns: 288px minmax(0, 1fr); }
.side { display: flex; flex-direction: column; gap: 12px; padding: 14px 12px; border-right: 1px solid var(--border); background: var(--card); min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.side-head .btn { padding: 5px 10px; font-size: calc(13px * var(--fs)); }
#search { width: 100%; }
.session-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.group-label { font-size: calc(12px * var(--fs)); color: var(--muted); padding: 10px 8px 4px; }
.proj-bar { display: flex; gap: 6px; overflow-x: auto; padding: 6px 4px 2px; scrollbar-width: none; }
.proj-bar::-webkit-scrollbar { display: none; }
.proj-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--card); color: var(--muted); font: inherit; font-size: calc(12px * var(--fs)); cursor: pointer; }
.proj-chip span { opacity: .7; }
.proj-chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.session { display: block; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.session:hover { background: var(--hover); }
.session.active { background: var(--band); }
.session .s-title { display: flex; align-items: center; gap: 6px; font-size: calc(13px * var(--fs)); }
.session .s-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.session .s-sub { font-size: calc(12px * var(--fs)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: calc(11px * var(--fs)); padding: 0 6px; border-radius: 99px; background: var(--chip); color: var(--text-2); flex: none; }
.badge.run { background: var(--accent-soft); color: var(--accent); }
.badge.wait { background: rgba(250, 178, 25, .16); color: var(--warning-text); }
.empty-list { color: var(--muted); font-size: calc(13px * var(--fs)); padding: 12px 8px; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: grid; gap: 6px; }
.quota { font-size: calc(12px * var(--fs)); color: var(--muted); display: grid; gap: 6px; padding: 0 4px; }
.quota-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.bar { height: 4px; border-radius: 2px; background: var(--band); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.warn { background: var(--warning); }
.bar i.crit { background: var(--critical); }
.scrim { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.menu { display: none; font-size: calc(18px * var(--fs)); }
.head-text { flex: 1; min-width: 0; }
.head-text h1 { margin: 0; font-size: calc(15px * var(--fs)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-text .sub { font-size: calc(12px * var(--fs)); color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: calc(12px * var(--fs)); padding: 2px 10px; border-radius: 99px; background: var(--chip); color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; flex: none; }
.status.run { background: var(--accent-soft); color: var(--accent); }
.status.wait { background: rgba(250, 178, 25, .16); color: var(--warning-text); }
.status.run::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }

.scroller { flex: 1; overflow-y: auto; padding: 20px 20px 8px; scroll-behavior: auto; }
.messages, .new-panel, .activity { max-width: 860px; margin: 0 auto; }
.messages { display: flex; flex-direction: column; gap: 12px; }
.messages.catching-up { display: none; }
.catchup { text-align: center; color: var(--muted); font-size: calc(13px * var(--fs)); padding: 32px 0; }
.older { display: block; margin: 0 auto 12px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--muted); font: inherit; font-size: calc(13px * var(--fs)); cursor: pointer; }
.tool-wait { color: var(--muted); font-size: calc(12px * var(--fs)); padding: 4px 0; }

/* 新对话 */
.new-panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: 14px; margin-top: 8vh; }
.new-panel h2 { margin: 0; font-size: calc(17px * var(--fs)); }
.new-panel, .field { grid-template-columns: minmax(0, 1fr); }  /* 很窄的屏幕上目录输入框不把卡片撑出屏幕 */
.field { display: grid; gap: 6px; font-size: calc(13px * var(--fs)); color: var(--text-2); }
.field input { font-family: var(--mono); font-size: calc(13px * var(--fs)); }
.cwd-row { display: flex; gap: 8px; }
.cwd-row input { flex: 1; min-width: 0; }
.cwd-row button { flex: none; }
.new-panel p { margin: 0; }

/* 消息 */
.msg-user { align-self: flex-end; max-width: min(640px, 88%); background: var(--user-bubble); border-radius: 14px 14px 4px 14px; padding: 8px 14px; display: grid; gap: 8px; }
.user-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text { overflow-wrap: anywhere; }
.msg-text.live::after { content: "▍"; color: var(--muted); animation: pulse 1s steps(2) infinite; }
.notice { align-self: center; font-size: calc(12px * var(--fs)); color: var(--muted); background: var(--band); padding: 2px 12px; border-radius: 99px; text-align: center; }
.error-line { color: var(--critical-text); background: var(--del-bg); border-radius: 8px; padding: 8px 12px; font-size: calc(13px * var(--fs)); white-space: pre-wrap; overflow-wrap: anywhere; }
.result-line { font-size: calc(12px * var(--fs)); color: var(--muted); display: flex; gap: 8px; align-items: center; }
.result-line::before { content: ""; flex: none; width: 18px; height: 1px; background: var(--border); }
.activity { font-size: calc(13px * var(--fs)); color: var(--muted); padding: 4px 0 8px; display: flex; align-items: center; gap: 8px; }
.activity::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md .table-wrap { margin: 0 0 10px; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 2px 0; }
.md li > p { margin: 0; }
.md h3, .md h4, .md h5 { margin: 16px 0 8px; line-height: 1.4; }
.md h3 { font-size: calc(16px * var(--fs)); } .md h4 { font-size: calc(15px * var(--fs)); } .md h5 { font-size: calc(14px * var(--fs)); }
.md code { font-family: var(--mono); font-size: calc(12.5px * var(--fs)); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--code-bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; font-size: calc(12.5px * var(--fs)); line-height: 1.5; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md .table-wrap { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: calc(13px * var(--fs)); }
.md th, .md td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--band); font-weight: 600; }

/* 工具调用 */
.tool { border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; }
.tool + .tool { margin-top: -6px; }
.tool-head { width: 100%; border: 0; border-radius: 0; background: none; justify-content: flex-start; padding: 7px 12px; gap: 8px; font-size: calc(13px * var(--fs)); text-align: left; }
.tool-head:hover:not(:disabled) { background: var(--hover); }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot.run { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.dot.ok { background: var(--good); }
.dot.err { background: var(--critical); }
.dot.wait { background: var(--warning); }
.tool-name { flex: none; font-weight: 600; color: var(--text-2); }
.tool-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: calc(12px * var(--fs)); color: var(--muted); }
.chev { flex: none; color: var(--muted); font-size: calc(11px * var(--fs)); transition: transform .15s; }
.tool.open .chev { transform: rotate(90deg); }
.tool-body { border-top: 1px solid var(--border); padding: 10px 12px; display: grid; gap: 8px; }
pre.out, pre.cmd { margin: 0; font-family: var(--mono); font-size: calc(12px * var(--fs)); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; background: var(--code-bg); border-radius: 6px; padding: 8px 10px; }
pre.out.err { color: var(--critical-text); }
.diff { font-family: var(--mono); font-size: calc(12px * var(--fs)); line-height: 1.5; border-radius: 6px; overflow: auto; max-height: 420px; background: var(--code-bg); }
.diff div { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 10px; }
.diff .add { background: var(--add-bg); color: var(--good-text); }
.diff .del { background: var(--del-bg); color: var(--critical-text); }
.diff-file { font-family: var(--mono); font-size: calc(12px * var(--fs)); color: var(--muted); }
.todos { list-style: none; margin: 0; padding: 6px 12px 8px; display: grid; gap: 2px; font-size: calc(13px * var(--fs)); }
.todos li { display: flex; gap: 8px; }
.todos .done { color: var(--muted); text-decoration: line-through; }
.todos .doing { font-weight: 600; }

/* 权限确认 / 提问 */
.perm { border: 1px solid var(--warning); border-radius: 12px; background: var(--card); padding: 12px 14px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.perm.done { border-color: var(--border); box-shadow: none; padding: 8px 14px; }
.perm-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.perm-title .muted { font-weight: 400; font-size: calc(12px * var(--fs)); }
.perm-desc { font-size: calc(13px * var(--fs)); color: var(--text-2); }
.perm-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.perm-actions input { flex: 1 1 200px; min-width: 0; }
.perm-outcome { font-size: calc(13px * var(--fs)); color: var(--muted); }
.perm-outcome.ok { color: var(--good-text); }
.perm-outcome.no { color: var(--critical-text); }
.question { display: grid; gap: 6px; }
.question-text { font-size: calc(14px * var(--fs)); }
.question-text .badge { margin-right: 6px; }
.options { display: grid; gap: 6px; }
.option { justify-content: flex-start; text-align: left; white-space: normal; display: grid; gap: 0; padding: 8px 12px; }
.option small { color: var(--muted); }
.option.picked { border-color: var(--accent); background: var(--accent-soft); }
.plan { max-height: 480px; overflow-y: auto; background: var(--band); border-radius: 8px; padding: 10px 14px; }

/* 输入框 */
.composer { position: relative; max-width: 900px; width: 100%; margin: 0 auto; padding: 8px 20px calc(14px + env(safe-area-inset-bottom)); }
.composer textarea { width: 100%; resize: none; display: block; min-height: 46px; max-height: 40vh; padding: 12px 14px; border-radius: 12px; line-height: 1.5; box-shadow: var(--shadow); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pickers { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.mode { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: calc(13px * var(--fs)); }
.mode select { min-width: 0; max-width: 100%; padding: 4px 8px; font-size: calc(13px * var(--fs)); }
.hint { flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash { position: absolute; left: 20px; right: 20px; bottom: calc(100% - 4px); background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); max-height: 280px; overflow-y: auto; padding: 4px; }
.slash-item { display: flex; gap: 10px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: calc(13px * var(--fs)); }
.slash-item b { font-family: var(--mono); font-weight: 600; flex: none; }
.slash-item span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-item.sel, .slash-item:hover { background: var(--band); }

/* 附件 */
.user-images { display: flex; flex-wrap: wrap; gap: 6px; }
.user-images img { max-width: 220px; max-height: 160px; border-radius: 8px; cursor: zoom-in; display: block; object-fit: cover; background: var(--card); }
.img-stub { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 160px; height: 96px; border: 1px dashed var(--border); border-radius: 8px; background: var(--card); color: var(--muted); font: inherit; font-size: calc(12px * var(--fs)); cursor: pointer; }
.img-stub span:first-child { color: var(--text-2); }
.user-files, .attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; font-size: calc(12px * var(--fs)); font-family: var(--mono); background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments { margin-bottom: 8px; }
.att { position: relative; display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px 26px 4px 4px; font-size: calc(12px * var(--fs)); max-width: 240px; }
.att img { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; display: block; }
.att .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.att .att-size { color: var(--muted); flex: none; }
.att button { position: absolute; top: 2px; right: 2px; padding: 0 5px; font-size: calc(13px * var(--fs)); line-height: 18px; border: 0; background: none; color: var(--muted); }
.att button:hover:not(:disabled) { color: var(--text); }
.attach { gap: 4px; }
.composer.dragging textarea { border-color: var(--accent); background: var(--accent-soft); }
.drop-hint { font-size: calc(12px * var(--fs)); color: var(--accent); margin-bottom: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .8); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

.lightbox svg { width: min(1400px, 100%); height: auto; max-height: 100%; background: var(--card); border-radius: 8px; padding: 16px; }
/* 回复里的图 */
.md-img { max-width: 100%; max-height: 520px; border-radius: 8px; display: block; margin: 6px 0; cursor: zoom-in; }
.mermaid-block { margin: 0 0 10px; }
.mermaid-svg { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; overflow-x: auto; cursor: zoom-in; text-align: center; }
.mermaid-svg svg { max-width: 100%; height: auto; }
.mermaid-toggle { font-size: calc(12px * var(--fs)); margin-top: 4px; padding: 2px 6px; }
.mermaid-block pre { margin-top: 6px; }
.tool-preview { border-top: 1px solid var(--border); padding: 8px 12px; }
.tool-preview .md-img { max-height: 320px; margin: 0; }

/* 子任务进度 */
.sub-list { border-top: 1px solid var(--border); padding: 6px 12px 8px 27px; display: grid; gap: 2px; font-size: calc(12px * var(--fs)); }
.sub-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sub-row .tool-name { font-weight: 500; }
.sub-more { color: var(--muted); font-size: calc(12px * var(--fs)); background: none; border: 0; padding: 0; justify-content: flex-start; }
.sub-more:hover:not(:disabled) { color: var(--text); }
.sub-list.folded .sub-row { display: none; }

/* 头部菜单 */
.more-wrap { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); padding: 4px; display: grid; min-width: 140px; }
.menu-pop button { border: 0; background: none; justify-content: flex-start; padding: 7px 10px; font-size: calc(13px * var(--fs)); }
.menu-pop button:hover:not(:disabled) { background: var(--band); }
.session.hidden-item { opacity: .6; }
/* 会话条目右边的删除按钮：鼠标移上去才出现（触屏上一直显示）；正在运行的会话没有 */
.session-row { position: relative; }
.session-row .s-del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); opacity: 0; padding: 4px 6px;
  border: 0; border-radius: 6px; background: none; color: var(--muted); line-height: 0; }
.session-row:hover .s-del, .session-row .s-del:focus-visible { opacity: 1; }
.session-row:has(.s-del):hover .badge { visibility: hidden; }  /* 按钮出现时让出右边的标签位置 */
.session-row .s-del:hover { color: var(--critical-text); background: var(--band); }
.session-row .s-del svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: none) { .session-row .s-del { opacity: .7; } .session-row .s-title { padding-right: 26px; } }
/* 侧栏收起：桌面上整个藏起来，标题栏左边的 ☰ 再展开 */
.side-head-actions { display: flex; align-items: center; gap: 4px; }
#collapse { padding: 3px 8px; font-size: calc(16px * var(--fs)); line-height: 1; }
/* 「窄屏」= 宽度不到 821px，或手机横屏（触屏、横着、高度不到 501px）；和 app.js 里的 NARROW 保持一致 */
@media (min-width: 821px) and (min-height: 501px), (min-width: 821px) and (orientation: portrait), (min-width: 821px) and (pointer: fine), (min-width: 821px) and (pointer: none) {  /* 只在宽屏生效：窄屏上侧栏是浮层，不受「收起」影响 */
  .app.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app.side-collapsed .side { display: none; }
  .app.side-collapsed .menu { display: inline-flex; }
}
.show-hidden { display: block; width: 100%; margin-top: 8px; font-size: calc(12px * var(--fs)); }

/* 文件面板 */
.files { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 25; background: var(--card); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0, 0, 0, .10); display: flex; flex-direction: column; }
.files-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 2px; background: var(--band); border-radius: 8px; padding: 2px; margin-right: auto; }
.tab { border: 0; background: none; padding: 4px 14px; font-size: calc(13px * var(--fs)); color: var(--muted); border-radius: 6px; }
.tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.files-body { flex: 1; overflow: auto; padding: 10px 12px 24px; font-size: calc(13px * var(--fs)); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--mono); font-size: calc(12px * var(--fs)); margin-bottom: 8px; }
.crumbs button { border: 0; background: none; padding: 2px 4px; color: var(--accent); font-family: inherit; font-size: inherit; }
.crumbs span { color: var(--muted); }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; width: 100%; border: 0; border-radius: 6px; background: none; padding: 5px 8px; font-size: calc(13px * var(--fs)); text-align: left; }
.entry:hover:not(:disabled) { background: var(--hover); }
.entry .e-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: calc(12.5px * var(--fs)); justify-self: start; }
.entry.dir .e-name { color: var(--accent); }
.entry.dot-file .e-name { color: var(--muted); }
.entry .e-size, .entry .e-time { color: var(--muted); font-size: calc(12px * var(--fs)); }
.viewer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.viewer-head .v-name { flex: 1; min-width: 0; font-family: var(--mono); font-size: calc(12px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .btn { padding: 3px 10px; font-size: calc(12px * var(--fs)); }
pre.viewer { margin: 0; font-family: var(--mono); font-size: calc(12px * var(--fs)); line-height: 1.5; background: var(--code-bg); border-radius: 8px; padding: 10px 12px; overflow: auto; white-space: pre; tab-size: 4; }
.viewer-img { max-width: 100%; border-radius: 6px; background: repeating-conic-gradient(var(--band) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.git-section { margin-bottom: 16px; }
.git-section h4 { margin: 0 0 6px; font-size: calc(13px * var(--fs)); }
.git-status { display: grid; gap: 1px; font-family: var(--mono); font-size: calc(12px * var(--fs)); }
.git-status button { display: flex; gap: 10px; border: 0; background: none; padding: 3px 6px; justify-content: flex-start; font-family: inherit; font-size: inherit; border-radius: 4px; }
.git-status button:hover:not(:disabled) { background: var(--hover); }
.git-status .code { width: 3.2em; flex: none; font-weight: 600; }
.git-status .code.add { color: var(--good-text); }
.git-status .code.del { color: var(--critical-text); }
.git-status .code.mod { color: var(--warning-text); }
.udiff { font-family: var(--mono); font-size: calc(12px * var(--fs)); line-height: 1.5; background: var(--code-bg); border-radius: 8px; overflow: auto; padding: 6px 0; }
.udiff div { white-space: pre; padding: 0 10px; min-height: 1.5em; }
.udiff .add { background: var(--add-bg); color: var(--good-text); }
.udiff .del { background: var(--del-bg); color: var(--critical-text); }
.udiff .hunk { color: var(--accent); }
.udiff .meta { color: var(--muted); font-weight: 600; }
.git-log { font-family: var(--mono); font-size: calc(12px * var(--fs)); display: grid; gap: 2px; }
.git-log div { display: flex; gap: 10px; }
.git-log span:first-child { color: var(--accent); flex: none; }
.git-log span:nth-child(2) { color: var(--muted); flex: none; }

/* 多账号：侧栏底部的账号栏、admin 的账号管理 */
.admin-title { margin-right: auto; font-size: calc(14px * var(--fs)); }
.admin-note { background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 6px; }
.admin-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-actions button { font-size: calc(12px * var(--fs)); padding: 3px 10px; border-color: var(--border); }
.badge.state-active { background: var(--add-bg); color: var(--good-text); }
.badge.state-failed { background: var(--del-bg); color: var(--critical-text); }
.danger-text { color: var(--critical-text); }
.admin-form { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 6px; margin-bottom: 12px; display: grid; gap: 8px; }
.admin-form h4 { margin: 0; font-size: calc(13px * var(--fs)); }
.admin-form p { margin: 0; }
.admin-form .row { display: flex; }
.admin-form input, .admin-form select { flex: 1; min-width: 0; padding: 7px 10px; }
.admin-form > button { justify-self: start; }

@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 24px rgba(0, 0, 0, .2); }
  .app.side-open .side { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 10; }
  .menu { display: inline-flex; }
  .chat-head { padding: 8px 12px; }
  .scroller { padding: 14px 16px 8px; }
  .composer { padding: 6px 16px calc(10px + env(safe-area-inset-bottom)); }
  .slash { left: 16px; right: 16px; }
  .hint { display: none; }
  .composer-bar { justify-content: flex-end; }
  .pickers { margin-right: auto; }
  .mode > .muted { display: none; }  /* 窄屏放不下「权限」「模型」两个字，选项本身看得懂 */
  .mode select { padding: 4px 6px; }
  .new-panel { margin-top: 0; }
  .attach span { display: none; }
  .user-images img { max-width: 160px; }
}

/* 手机竖屏：权限、模型、强度、计费单独占一行、平分宽度；附件和发送在最下面一行，拇指好按 */
@media (max-width: 600px) {
  .composer-bar { flex-wrap: wrap; row-gap: 8px; }
  .pickers { order: -1; display: flex; width: 100%; margin-right: 0; gap: 6px; }
  .pickers .mode { flex: 1 1 0; min-width: 0; }
  .pickers select { width: 100%; padding: 6px 4px; text-overflow: ellipsis; }
  .attach { margin-right: auto; }
}

/* iOS Safari 聚焦字号小于 16px 的输入框时会自动放大页面，触屏设备上输入控件至少 16px（字号调大时跟着变大） */
@media (pointer: coarse) {
  input, textarea, select, .field input, .mode select { font-size: max(16px, 1em); }
}

/* 手机通知面板 */
.notify-h { margin: 14px 0 8px; font-size: calc(13px * var(--fs)); }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: calc(13px * var(--fs)); color: var(--text-2); cursor: pointer; }
.check-row input { margin-top: 4px; flex: none; }
.admin-form > .check-row { margin-bottom: 4px; }

/* App 锁屏：盖住整个页面，验证面容 / 指纹后拿开 */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; }
.lock-card { display: grid; gap: 12px; justify-items: center; text-align: center; }
.lock-card p { margin: 0; }
.lock-logo { width: 56px; height: 56px; }

/* 全屏显示（手机 App、加到主屏幕的网页）时避开刘海、状态栏和底部横条；普通浏览器里这些值是 0 */
.chat-head { padding-top: calc(10px + env(safe-area-inset-top)); }
.side { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.files { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.login { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.lightbox { padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .chat-head { padding-top: calc(8px + env(safe-area-inset-top)); }
}

/* 侧栏底部：账号名 + 设置齿轮 */
.foot-row { display: flex; align-items: center; gap: 6px; padding-left: 4px; }
.foot-who { flex: 1; min-width: 0; font-size: calc(12px * var(--fs)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { flex: none; padding: 6px; line-height: 0; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 设置面板：分组卡片，一行一项 */
.settings { display: grid; gap: 18px; align-content: start; }
.set-section { display: grid; gap: 6px; }
.set-section h4 { margin: 0 4px; font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); }
.set-card { border: 1px solid var(--border); border-radius: 10px; background: var(--card); overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 8px 12px;
  border: 0; border-radius: 0; background: none; color: var(--text); font-size: calc(14px * var(--fs)); text-align: left; white-space: normal; cursor: default; }
.set-row + .set-row { border-top: 1px solid var(--border); }
button.set-row, label.set-row { cursor: pointer; }
button.set-row:hover:not(:disabled) { background: var(--hover); }
.set-label { flex: 1; min-width: 0; display: grid; gap: 1px; }
.set-label small { color: var(--muted); font-size: calc(12px * var(--fs)); }
.set-value { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chev { flex: none; color: var(--muted); font-size: calc(18px * var(--fs)); line-height: 1; }
.set-row select { flex: 0 1 auto; min-width: 0; max-width: 60%; padding: 4px 8px; }
.font-ctl { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.font-ctl button { padding: 4px 12px; }
.font-val { min-width: 3em; text-align: center; color: var(--text-2); }
.set-quota { padding: 10px 12px; font-size: calc(13px * var(--fs)); }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* 开关 */
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; padding: 0;
  border: 0; border-radius: 99px; background: var(--border); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus { outline: none; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 横屏时左右两边可能是刘海 / 圆角，内容让开；竖屏这些值是 0 */
.side { padding-left: max(12px, env(safe-area-inset-left)); }
.files { padding-right: env(safe-area-inset-right); }
@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .side { width: calc(min(300px, 86vw) + env(safe-area-inset-left)); }
}

/* 手机横屏：高度只有 ~400px，标题栏和输入区压成一行，把地方留给对话 */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .chat-head { gap: 6px; padding: calc(4px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 4px max(12px, env(safe-area-inset-left)); }
  .head-text { display: flex; align-items: baseline; gap: 10px; }
  .head-text h1 { flex: 0 1 auto; min-width: 0; max-width: 60%; }
  .head-text .sub { flex: 1 1 0; min-width: 0; }
  .scroller { padding: 10px max(16px, env(safe-area-inset-right)) 4px max(16px, env(safe-area-inset-left)); }
  .composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: end;
    max-width: 960px; padding: 4px max(16px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .drop-hint, .attachments { grid-column: 1 / -1; }
  .composer textarea { min-height: 40px; padding: 8px 12px; }
  .composer-bar { margin-top: 0; gap: 6px; }
  .slash { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); }
  .new-panel { padding: 14px 16px; gap: 10px; }
  /* 侧栏：会话列表至少占六成高度，底部的账号、字号、退出等往下滑就能看到 */
  .side { gap: 8px; overflow-y: auto; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .session-list { flex: 1 0 auto; height: 60%; }
  .side-foot { gap: 4px; padding-top: 6px; }
  .side .quota { display: none; }  /* 设置面板里有 */
  .files-head { padding: 6px 12px; }
}

/* ---------- 主题「Claude 风格」：暖色米白底、陶土橙强调色、Claude 的回复用衬线字体 ----------
   设置 → 显示 → 主题 切换，记在这台设备上（<html data-skin="claude">）；跟随系统深色模式 */
:root[data-skin="claude"] {
  color-scheme: light;
  --bg: #faf9f5;
  --side-bg: #f5f4ed;
  --card: #ffffff;
  --border: #e8e6dc;
  --text: #141413;
  --text-2: #3d3d3a;
  --muted: #73726c;
  --band: rgba(20, 20, 19, .04);
  --hover: rgba(20, 20, 19, .04);
  --accent: #c96442;
  --accent-soft: rgba(201, 100, 66, .10);
  --chip: #f0eee6;
  --user-bubble: #f0eee6;
  --code-bg: #f5f4ed;
  --shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 4px 14px rgba(20, 20, 19, .04);
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
}
@media (prefers-color-scheme: dark) {
  :root[data-skin="claude"]:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #262624;
    --side-bg: #1f1e1d;
    --card: #30302e;
    --border: #3e3e38;
    --text: #faf9f5;
    --text-2: #c2c0b6;
    --muted: #9c9a92;
    --band: rgba(255, 255, 255, .05);
    --hover: rgba(255, 255, 255, .04);
    --accent: #d97757;
    --accent-soft: rgba(217, 119, 87, .14);
    --chip: #3a3a37;
    --user-bubble: #141413;
    --code-bg: #1f1e1d;
    --shadow: none;
  }
}
:root[data-skin="claude"][data-theme="dark"] {
    color-scheme: dark;
    --bg: #262624;
    --side-bg: #1f1e1d;
    --card: #30302e;
    --border: #3e3e38;
    --text: #faf9f5;
    --text-2: #c2c0b6;
    --muted: #9c9a92;
    --band: rgba(255, 255, 255, .05);
    --hover: rgba(255, 255, 255, .04);
    --accent: #d97757;
    --accent-soft: rgba(217, 119, 87, .14);
    --chip: #3a3a37;
    --user-bubble: #141413;
    --code-bg: #1f1e1d;
    --shadow: none;
  }
[data-skin="claude"] .side { background: var(--side-bg); }
[data-skin="claude"] .msg-text.md { font-family: var(--serif); font-size: calc(15.5px * var(--fs)); line-height: 1.7; }
[data-skin="claude"] .msg-text.md code, [data-skin="claude"] .msg-text.md pre { font-family: var(--mono); }
[data-skin="claude"] .msg-text.md pre { line-height: 1.5; font-size: calc(12.5px * var(--fs)); }
[data-skin="claude"] .msg-user { border-radius: 12px; padding: 10px 16px; }
[data-skin="claude"] button.primary, [data-skin="claude"] .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-skin="claude"] .head-text h1 { font-family: var(--serif); font-weight: 500; font-size: calc(16px * var(--fs)); }

/* ---------- 两个主题共用：输入卡片骨架、代码块复制 ---------- */
.composer-card { display: contents; }  /* 默认主题下不存在这层，布局和原来一样 */
.ic-plus, .ic-send { display: none; }
.greeting { display: none; }
.code-block { margin: 0 0 10px; border-radius: 8px; background: var(--code-bg); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 6px 3px 12px;
  font: calc(12px * var(--fs))/1.6 var(--mono); color: var(--muted); border-bottom: 1px solid var(--border); }
.code-copy { padding: 2px 8px; border: 0; background: none; color: var(--muted); font-size: calc(12px * var(--fs)); cursor: pointer; }
.code-copy:hover { color: var(--text); background: var(--hover); }
.md .code-block pre { margin: 0; border-radius: 0; }

/* ---------- Claude 风格：布局细节 ---------- */
:root[data-skin="claude"] { --border-strong: #d1cec2; }
@media (prefers-color-scheme: dark) {
  :root[data-skin="claude"]:not([data-theme="light"]) { --border-strong: #5a5852; }
}
:root[data-skin="claude"][data-theme="dark"] { --border-strong: #5a5852; }
/* 输入框：一张悬浮的圆角卡片，文字区和下面的按钮在同一张卡片里 */
[data-skin="claude"] .composer-card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 2px 12px rgba(20, 20, 19, .06); padding: 4px 10px 10px; transition: border-color .15s; }
[data-skin="claude"] .composer-card:focus-within { border-color: var(--border-strong); }
[data-skin="claude"] .composer-card textarea, [data-skin="claude"] .composer-card textarea:focus {
  border: 0; outline: 0; background: transparent; box-shadow: none; border-radius: 0; padding: 12px 6px 8px; }
[data-skin="claude"] .composer.dragging .composer-card { border-color: var(--accent); background: var(--accent-soft); }
[data-skin="claude"] .composer-bar { margin-top: 2px; }
[data-skin="claude"] .hint { display: none; }
[data-skin="claude"] .pickers { margin-right: auto; gap: 2px; }
[data-skin="claude"] .mode > .muted { display: none; }
[data-skin="claude"] .mode select { border: 0; background-color: transparent; color: var(--text-2); padding: 4px 6px; border-radius: 8px; cursor: pointer; }
[data-skin="claude"] .mode select:hover { background-color: var(--hover); }
[data-skin="claude"] .attach { width: 32px; height: 32px; padding: 0; justify-content: center; border: 1px solid var(--border); border-radius: 8px; }
[data-skin="claude"] .attach > svg:not(.ic-plus), [data-skin="claude"] .attach span { display: none; }
[data-skin="claude"] .ic-plus, [data-skin="claude"] .ic-send { display: block; }
[data-skin="claude"] #send { width: 32px; height: 32px; padding: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
[data-skin="claude"] #send .send-text { display: none; }
[data-skin="claude"] #send:disabled { opacity: .45; }
/* 侧栏：「新对话」是一个橙色圆形加号 + 文字，不是实心按钮 */
[data-skin="claude"] #new-chat { background: transparent; border-color: transparent; color: var(--text); font-weight: 500; gap: 6px; }
[data-skin="claude"] #new-chat:hover { background: var(--hover); opacity: 1; }
[data-skin="claude"] #new-chat .nc-ic { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; line-height: 1; }
[data-skin="claude"] #search { background: transparent; }
[data-skin="claude"] .chat-head { border-bottom-color: transparent; }
/* 新对话页：居中的大号衬线问候语，下面是轻一点的目录卡片 */
[data-skin="claude"] .greeting { display: block; max-width: 860px; margin: 9vh auto 20px; text-align: center;
  font: 400 calc(30px * var(--fs))/1.3 var(--serif); color: var(--text); }
[data-skin="claude"] .greeting[hidden] { display: none; }
[data-skin="claude"] .new-panel { margin-top: 0; box-shadow: none; background: transparent; }
[data-skin="claude"] .new-panel h2 { font-weight: 500; }
/* 工具调用卡片轻一点 */
[data-skin="claude"] .tool { background: transparent; }
[data-skin="claude"] .code-block { border: 1px solid var(--border); }
/* 手机横屏：输入区压成一行，卡片拆开，沿用原来的网格 */
@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  [data-skin="claude"] .composer-card { display: contents; }
  [data-skin="claude"] .composer-card textarea, [data-skin="claude"] .composer-card textarea:focus {
    border: 1px solid var(--border); background: var(--card); border-radius: 14px; padding: 8px 12px; }
}

/* ---------- 弹出菜单、回复操作、停止按钮 ---------- */
.pick-btn, .ic-stop { display: none; }
.msg-actions { display: none; }
[data-skin="claude"] .pickers select { display: none; }
[data-skin="claude"] .pick-btn { display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: calc(13px * var(--fs)); white-space: nowrap; cursor: pointer; }
[data-skin="claude"] .pick-btn:hover, [data-skin="claude"] .pick-btn.open { background: var(--hover); color: var(--text); }
[data-skin="claude"] .pick-btn svg { flex: none; opacity: .6; }
.pick-menu { position: absolute; z-index: 30; min-width: 200px; max-width: min(300px, 100%); padding: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 20px rgba(20, 20, 19, .10); display: grid; gap: 1px; }
.pick-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 6px 10px; border: 0;
  border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.pick-item:hover { background: var(--hover); }
.pick-text { display: grid; gap: 1px; min-width: 0; }
.pick-text b { font-weight: 400; font-size: calc(13px * var(--fs)); line-height: 1.45; }
.pick-text small { color: var(--muted); font-size: calc(11.5px * var(--fs)); line-height: 1.4; }
.pick-check { flex: none; width: 14px; height: 14px; color: var(--accent); visibility: hidden; }
.pick-item.on .pick-check { visibility: visible; }
[data-skin="claude"] .composer-card { position: relative; }
/* 回复下面的「复制」：电脑上鼠标移上去才出现，手机上一直显示 */
[data-skin="claude"] .msg-text:has(+ .result-line) > .msg-actions { display: flex; margin-top: 6px; opacity: 0; transition: opacity .15s; }
[data-skin="claude"] .msg-text:hover > .msg-actions, [data-skin="claude"] .msg-actions:focus-within { opacity: 1; }
@media (hover: none) { [data-skin="claude"] .msg-actions { opacity: 1; } }
[data-skin="claude"] .msg-copy { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 0; border-radius: 7px;
  background: none; color: var(--muted); font: calc(12px * var(--fs))/1.5 system-ui, -apple-system, "PingFang SC", sans-serif; cursor: pointer; }
[data-skin="claude"] .msg-copy:hover { background: var(--hover); color: var(--text); }
[data-skin="claude"] #stop { width: 32px; height: 32px; padding: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); border-color: var(--text); color: var(--card); }
[data-skin="claude"] #stop[hidden] { display: none; }
[data-skin="claude"] #stop .stop-text { display: none; }
[data-skin="claude"] .ic-stop { display: block; }
/* 手机：选择按钮平分一行 */
@media (max-width: 600px) {
  [data-skin="claude"] .pickers .pick-btn { width: 100%; justify-content: space-between; padding: 6px 8px; font-size: max(14px, calc(13px * var(--fs))); }
  .pick-menu { left: 8px !important; right: 8px; max-width: none; }
}
[data-skin="claude"] .pick-btn:focus { outline: none; }
[data-skin="claude"] .pick-btn:focus-visible { outline: 2px solid var(--accent-soft); }

/* ---------- Claude 风格：信息更少、更安静 ---------- */
/* 侧栏：每个会话只显示标题（选中的那个才显示目录和时间）；项目筛选是灰色文字标签，不用橙色 */
[data-skin="claude"] .proj-chip { border-color: transparent; background: transparent; color: var(--muted); padding: 3px 8px; }
[data-skin="claude"] .proj-chip:hover { color: var(--text); background: var(--hover); }
[data-skin="claude"] .proj-chip.active { background: var(--chip); border-color: transparent; color: var(--text); }
[data-skin="claude"] .group-label { padding: 14px 10px 4px; font-weight: 500; }
[data-skin="claude"] .session { padding: 6px 10px; }
[data-skin="claude"] .session .s-title { font-size: calc(13.5px * var(--fs)); }
[data-skin="claude"] .session .s-sub { display: none; }
[data-skin="claude"] .session.active .s-sub { display: block; margin-top: 1px; }
[data-skin="claude"] .session.active { background: var(--chip); }
[data-skin="claude"] .session .badge:not(.run):not(.wait) { display: none; }  /* 只留「运行中」「等你确认」 */
/* 标题栏：只留标题，副标题用普通字体；空闲时不显示状态标签 */
[data-skin="claude"] .head-text h1 { font-family: inherit; font-weight: 500; font-size: calc(14px * var(--fs)); }
[data-skin="claude"] .head-text .sub { font-family: inherit; }
[data-skin="claude"] .status:not(.run):not(.wait) { display: none; }
/* 命令、读文件这些工具调用：一行灰字，不要卡片；成功的圆点用灰色，失败还是红色 */
[data-skin="claude"] .tool { border-color: transparent; background: transparent; }
[data-skin="claude"] .tool + .tool { margin-top: -10px; }
[data-skin="claude"] .tool-head { padding: 3px 4px; color: var(--muted); }
[data-skin="claude"] .tool-head:hover:not(:disabled) { background: var(--hover); border-radius: 6px; }
[data-skin="claude"] .tool-name { font-weight: 500; color: var(--muted); }
[data-skin="claude"] .tool-sum { opacity: .85; }
[data-skin="claude"] .dot.ok { background: var(--border-strong); }
[data-skin="claude"] .tool-body { border: 1px solid var(--border); border-radius: 10px; background: var(--card); margin: 4px 0 6px; }
/* 「完成 · 用时」那行更淡 */
[data-skin="claude"] .result-line { font-size: calc(11.5px * var(--fs)); opacity: .7; }
[data-skin="claude"] .result-line::before { display: none; }
/* 输入框（电脑）：左边「＋」、权限、强度、计费；模型挪到右下角发送按钮旁边 */
@media (min-width: 601px) {
  [data-skin="claude"] .pickers { display: contents; }
  [data-skin="claude"] .composer-bar .attach { order: 0; }
  [data-skin="claude"] .composer-bar .mode { order: 1; }
  [data-skin="claude"] .composer-bar .mode:has(#model) { order: 5; margin-left: auto; }
  [data-skin="claude"] #stop { order: 6; }
  [data-skin="claude"] #send { order: 7; }
}

/* ---------- Claude 风格：新对话页 ----------
   问候语、一行工作目录、输入框整组在页面中间（不再是一张卡片 + 底部输入框）；发出第一条消息后回到正常布局 */
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .scroller { flex: 0 0 auto; margin-top: auto; overflow: visible; padding-bottom: 0; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .composer { margin-bottom: auto; padding-top: 4px; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .composer-card textarea { min-height: 72px; }
[data-skin="claude"] .greeting { margin: 0 auto 22px; }
[data-skin="claude"] .new-panel { max-width: 860px; padding: 0 2px; border: 0; background: none; box-shadow: none; gap: 0; }
[data-skin="claude"] .new-panel h2, [data-skin="claude"] .new-panel > p { display: none; }
[data-skin="claude"] .new-panel .field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: calc(12.5px * var(--fs)); }
[data-skin="claude"] .new-panel .field label { flex: none; }
[data-skin="claude"] .new-panel .cwd-row { flex: 1; min-width: 0; gap: 6px; }
[data-skin="claude"] .new-panel .cwd-row input { padding: 4px 10px; border-color: transparent; background: transparent; border-radius: 8px;
  font-size: calc(12.5px * var(--fs)); color: var(--text-2); }
[data-skin="claude"] .new-panel .cwd-row input:hover { background: var(--hover); }
[data-skin="claude"] .new-panel .cwd-row input:focus { background: var(--card); border-color: var(--border-strong); outline: 0; }
[data-skin="claude"] .new-panel .cwd-row button { padding: 3px 10px; border-color: transparent; background: transparent; color: var(--muted);
  font-size: calc(12.5px * var(--fs)); border-radius: 8px; }
[data-skin="claude"] .new-panel .cwd-row button:hover { background: var(--hover); color: var(--text); }
@media (max-width: 600px) {
  [data-skin="claude"] .greeting { font-size: calc(26px * var(--fs)); margin-bottom: 16px; }
}

/* ---------- 账号管理：和设置页同一套「分区 + 卡片 + 行」 ---------- */
#admin-body.settings { display: grid; gap: 18px; align-content: start; }
#admin-body .admin-note { margin: 0; }
.acct + .acct, .acct + .acct-add { border-top: 1px solid var(--border); }
.acct-main { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 0; background: none;
  color: var(--text); text-align: left; cursor: pointer; justify-content: flex-start; }
.acct-main:hover:not(:disabled) { background: var(--hover); }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--chip);
  color: var(--text-2); font-weight: 600; font-size: calc(13px * var(--fs)); }
.acct-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.acct-text b { font-weight: 500; font-size: calc(14px * var(--fs)); }
.acct-text small { color: var(--muted); font-size: calc(12px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-state { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: calc(12px * var(--fs)); }
.acct-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong, var(--muted)); }
.acct-state.ok i { background: var(--good); }
.acct-state.busy i { background: var(--warning); }
.acct-state.err i { background: var(--critical); }
.acct-chev { flex: none; color: var(--muted); transition: transform .15s; }
.acct.open .acct-chev { transform: rotate(90deg); }
.acct-detail { display: none; padding: 2px 12px 12px 56px; gap: 10px; }
.acct.open .acct-detail { display: grid; }
.acct-note { margin: 0; color: var(--muted); font-size: calc(12.5px * var(--fs)); line-height: 1.6; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: calc(12.5px * var(--fs)); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text-2); }
.acct-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.acct-actions button { font-size: calc(12.5px * var(--fs)); padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.acct-actions button:hover:not(:disabled) { background: var(--hover); }
.acct-actions .acct-del { margin-left: auto; border-color: transparent; background: none; color: var(--critical-text); }
.acct-add { color: var(--text-2); justify-content: flex-start; gap: 12px; }
.acct-plus { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1px dashed var(--border-strong, var(--border));
  color: var(--muted); flex: none; }
/* 表单：一行一个字段，左边标签、右边输入 */
.acct-form, .acct-new { display: grid; gap: 0; }
.acct-form { gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.acct-new { padding: 4px 0 0; }
.form-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; padding: 8px 12px; }
.acct-new .form-row + .form-row { border-top: 1px solid var(--border); }
.acct-form .form-row { padding: 0; }
.form-label { display: grid; gap: 1px; font-size: calc(13px * var(--fs)); color: var(--text-2); }
.form-label small { color: var(--muted); font-size: calc(11.5px * var(--fs)); }
.form-row input { width: 100%; min-width: 0; padding: 6px 10px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; }
.acct-form .form-foot { padding: 0; }
.acct-new .form-foot { border-top: 1px solid var(--border); }
.form-foot .foot-left { margin-right: auto; }
.form-foot button { padding: 5px 14px; }
.token-form { margin: 0 12px 12px; }
.token-form input { width: 100%; padding: 6px 10px; }
.row-btn { flex: none; padding: 4px 12px; font-size: calc(12.5px * var(--fs)); }
/* 两选一的切换（系统账号 / 容器） */
.seg-box { display: grid; gap: 4px; }
.seg { display: inline-flex; justify-self: start; padding: 2px; border-radius: 9px; background: var(--chip); gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 14px; border-radius: 7px; font-size: calc(13px * var(--fs)); color: var(--text-2); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg-hint { color: var(--muted); font-size: calc(11.5px * var(--fs)); }
@media (max-width: 600px) {
  .acct-detail { padding-left: 12px; }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ---------- Claude 风格：侧栏顶部 ----------
   第一行 logo + 收起按钮；「新对话」单独一整行（橙色圆形加号 + 文字），和会话列表左对齐 */
[data-skin="claude"] .side-head { flex-wrap: wrap; row-gap: 10px; padding: 0; }
[data-skin="claude"] .side-head .brand { order: 1; margin-right: auto; padding-left: 4px; }
[data-skin="claude"] .side-head-actions { display: contents; }
[data-skin="claude"] #collapse { order: 2; }
[data-skin="claude"] #new-chat { order: 3; width: 100%; justify-content: flex-start; gap: 10px; padding: 7px 10px; border-radius: 8px;
  font-size: calc(14px * var(--fs)); font-weight: 500; color: var(--text); }
[data-skin="claude"] #new-chat .nc-ic { width: 24px; height: 24px; font-size: 13px; transition: transform .15s; }
[data-skin="claude"] #new-chat:hover .nc-ic { transform: scale(1.06); }

/* ---------- 设置、账号管理、手机通知：点空白处关掉 ----------
   默认主题：遮罩透明，面板还是右侧抽屉；Claude 风格：屏幕中间的弹窗，背后变暗（手机上从底部弹出） */
.panel-scrim { position: fixed; inset: 0; z-index: 24; background: transparent; }
[data-skin="claude"] .panel-scrim { background: rgba(20, 20, 19, .32); }
[data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) {
  top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px)); height: min(720px, calc(100vh - 48px));
  border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, .18); overflow: hidden; }
[data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) .files-head { padding: 14px 16px; border-bottom-color: transparent; }
[data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) .admin-title { font-size: calc(16px * var(--fs)); font-weight: 600; }
[data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) .files-body { padding: 4px 16px 24px; }
@media (max-width: 600px) {
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) {
    top: auto; left: 0; bottom: 0; transform: none; width: 100%; height: calc(100% - 48px); border-radius: 16px 16px 0 0; border-bottom: 0; }
}

/* 弹窗的进出动画（Claude 风格）：遮罩淡入淡出；电脑上弹窗轻微放大淡入，手机上从底部滑上来 */
@keyframes cw-fade-in { from { opacity: 0; } }
@keyframes cw-pop-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
@keyframes cw-sheet-in { from { transform: translateY(100%); } }
[data-skin="claude"] .panel-scrim:not([hidden]) { animation: cw-fade-in .2s ease-out; }
[data-skin="claude"] .panel-scrim.closing { opacity: 0; transition: opacity .16s ease-in; }
[data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files):not([hidden]) { animation: cw-pop-in .22s cubic-bezier(.2, .8, .2, 1); }
[data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files).closing {
  opacity: 0; transform: translate(-50%, -48%) scale(.98); transition: opacity .16s ease-in, transform .16s ease-in; }
@media (max-width: 600px) {
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files):not([hidden]) { animation: cw-sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files).closing { opacity: 1; transform: translateY(100%); transition: transform .16s ease-in; }
}
@media (prefers-reduced-motion: reduce) {
  [data-skin="claude"] :is(.panel-scrim, #settings-panel, #admin-panel, #notify-panel, #files) { animation: none !important; transition: none !important; }
}

/* 手机底部弹窗顶上的小横杠：提示可以往下拉关掉 */
@media (max-width: 600px) {
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files)::before {
    content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px;
    background: var(--border-strong, var(--border)); }
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) .files-head { padding-top: 20px; touch-action: none; }
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) .files-body { overscroll-behavior: contain; }
}

.error-text.login-note { color: var(--muted); text-align: center; }

/* 设置 → 计费方式：API key 花费（今天 / 本月 / 累计） */
.usage-row { border-top: 1px solid var(--border); }
.usage-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 12px 12px; }
.usage-nums:empty, #auth-usage-row[hidden] + .usage-nums { display: none; }
.usage-nums span { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--band); color: var(--muted); font-size: calc(12px * var(--fs)); }
.usage-nums b { color: var(--text); font-size: calc(16px * var(--fs)); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Claude 风格：再贴近 claude.ai 首页（2026-11-18） ----------
   中性白底 + 浅灰侧栏；侧栏是一行行带线条图标的导航；问候语前加橙色星芒；工作目录做成输入框下面的一张卡片 */
.nav-ic, .greet-mark { display: none; }
.search-wrap { display: block; }
:root[data-skin="claude"] {
  --bg: #ffffff;
  --side-bg: #f9f9f8;
  --card: #ffffff;
  --border: #ebebe9;
  --border-strong: #d9d9d6;
  --text: #141413;
  --text-2: #3a3a38;
  --muted: #6e6e6b;
  --band: rgba(0, 0, 0, .04);
  --hover: rgba(0, 0, 0, .045);
  --chip: #ececea;
  --user-bubble: #f2f2f0;
  --code-bg: #f7f7f5;
  --spark: #d97757;
  --tile: #f2f2f0;
  --tile-hover: #e8e8e6;
  --card-line: #d9d9d6;
  --card-line-focus: #c4c4c0;
}
@media (prefers-color-scheme: dark) {
  :root[data-skin="claude"]:not([data-theme="light"]) { --tile: #3a3a37; --tile-hover: #45453f; --card-line: #46463f; --card-line-focus: #5a5852; }
}
:root[data-skin="claude"][data-theme="dark"] { --tile: #3a3a37; --tile-hover: #45453f; --card-line: #46463f; --card-line-focus: #5a5852; }
[data-skin="claude"] .nav-ic { display: block; flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* 侧栏 */
[data-skin="claude"] .side { gap: 2px; padding: 10px 8px 10px; }
[data-skin="claude"] .side-head { row-gap: 12px; margin-bottom: 2px; }
[data-skin="claude"] .side-head .brand { order: 1; gap: 6px; padding-left: 2px; }
[data-skin="claude"] .side-head .brand .logo { display: none; }
[data-skin="claude"] .side-head .brand span { font: 500 calc(21px * var(--fs))/1 var(--serif); letter-spacing: -.01em; }
[data-skin="claude"] #collapse { order: 0; width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--text-2); }
[data-skin="claude"] #collapse .col-txt { display: none; }
[data-skin="claude"] #new-chat { gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--chip); font-weight: 400;
  font-size: calc(14.5px * var(--fs)); }
[data-skin="claude"] #new-chat:hover { background: var(--tile-hover); }
[data-skin="claude"] #new-chat .nc-ic { display: none; }
[data-skin="claude"] .search-wrap { display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 10px; color: var(--text); cursor: text; }
[data-skin="claude"] .search-wrap:hover { background: var(--hover); }
[data-skin="claude"] .search-wrap:focus-within { background: var(--card); box-shadow: inset 0 0 0 1px var(--border-strong); }
[data-skin="claude"] #search, [data-skin="claude"] #search:focus { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; box-shadow: none;
  padding: 7px 0; font-size: calc(14.5px * var(--fs)); color: var(--text); }
[data-skin="claude"] #search::placeholder { color: var(--text); opacity: 1; }
[data-skin="claude"] #search:focus::placeholder { color: var(--muted); }
[data-skin="claude"] .proj-bar { padding: 10px 2px 0; }
[data-skin="claude"] .group-label { padding: 18px 10px 6px; color: var(--text-2); font-size: calc(13px * var(--fs)); font-weight: 500; }
[data-skin="claude"] .session { padding: 7px 10px; border-radius: 10px; }
[data-skin="claude"] .session .s-title { font-size: calc(14.5px * var(--fs)); color: var(--text); }
[data-skin="claude"] .session.active { background: var(--chip); }
[data-skin="claude"] .side-foot { border-top: 0; padding-top: 6px; }
/* 新对话页：不显示「新对话」标题；问候语大一号，前面一个橙色星芒 */
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .head-text { visibility: hidden; }
[data-skin="claude"] .greeting:not([hidden]) { display: flex; align-items: center; justify-content: center; gap: 14px;
  font: 400 calc(40px * var(--fs))/1.2 var(--serif); letter-spacing: -.015em; color: var(--text); }
[data-skin="claude"] .greet-mark { display: block; flex: none; width: 1em; height: 1em; fill: none; stroke: var(--spark); stroke-width: 2.4; stroke-linecap: round; }
/* 输入卡片：边框更清楚、阴影更轻 */
[data-skin="claude"] .composer-card { border-color: var(--card-line); border-radius: 22px; box-shadow: 0 4px 20px rgba(0, 0, 0, .035); padding: 6px 12px 12px; }
[data-skin="claude"] .composer-card:focus-within { border-color: var(--card-line-focus); }
[data-skin="claude"] .composer-card textarea::placeholder { color: var(--muted); opacity: .85; }
[data-skin="claude"] .attach { border: 0; border-radius: 10px; color: var(--text); }
[data-skin="claude"] .attach:hover { background: var(--hover); }
[data-skin="claude"] .attach .ic-plus { width: 20px; height: 20px; }
[data-skin="claude"] .pick-btn { font-size: calc(14px * var(--fs)); color: var(--text-2); }
@media (min-width: 601px) {
  /* 右下角「模型 强度」连在一起：模型深色，强度浅灰，像 claude.ai 的「Opus 5.5 Medium」 */
  [data-skin="claude"] .composer-bar .mode:has(#effort) { order: 5; }
  [data-skin="claude"] .composer-bar .mode:has(#model) { order: 4; }
  [data-skin="claude"] .composer-bar .mode:has(#model) .pick-btn { color: var(--text); padding-right: 2px; }
  [data-skin="claude"] .composer-bar .mode:has(#model) .pick-btn svg { display: none; }
  [data-skin="claude"] .composer-bar .mode:has(#effort) .pick-btn { color: var(--muted); padding-left: 2px; }
  [data-skin="claude"] .composer-bar .mode:has(#effort) .pick-btn:hover, [data-skin="claude"] .composer-bar .mode:has(#effort) .pick-btn.open { color: var(--text); }
  [data-skin="claude"] #stop, [data-skin="claude"] #send { margin-left: 6px; }
}
[data-skin="claude"] #send { border-radius: 10px; }
/* 新对话页：问候语 → 输入框 → 工作目录卡片，整组在页面中间 */
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .scroller { display: contents; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .greeting { order: 1; margin: auto auto 28px; padding: 0 20px; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .composer { order: 2; margin-bottom: 0; padding-bottom: 0; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .new-panel { order: 3; align-self: center; width: calc(100% - 40px); max-width: 860px;
  margin: 18px auto auto; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) :is(#messages, #activity, .older) { display: none; }
[data-skin="claude"] .main:has(#new-panel:not([hidden])) .composer-card textarea { min-height: 64px; }
[data-skin="claude"] .new-panel { padding: 14px 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); }
[data-skin="claude"] .new-panel .field { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-rows: auto auto;
  column-gap: 14px; row-gap: 0; align-items: center; color: var(--text); font-size: calc(14.5px * var(--fs)); }
[data-skin="claude"] .new-panel .field::before { content: ""; grid-row: 1 / 3; grid-column: 1; width: 40px; height: 40px; border-radius: 10px;
  background: var(--tile); color: var(--text-2);
}
[data-skin="claude"] .new-panel .field::after { content: ""; grid-row: 1 / 3; grid-column: 1; justify-self: center; width: 20px; height: 20px; background: var(--text-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M3.5 7.5a2 2 0 0 1 2-2h4l2 2.2h7a2 2 0 0 1 2 2v7.8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z'/%3E%3C/svg%3E") center / 20px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M3.5 7.5a2 2 0 0 1 2-2h4l2 2.2h7a2 2 0 0 1 2 2v7.8a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z'/%3E%3C/svg%3E") center / 20px no-repeat; }
[data-skin="claude"] .new-panel .field label { grid-row: 1; grid-column: 2; font-weight: 500; }
[data-skin="claude"] .new-panel .cwd-row { display: contents; }
[data-skin="claude"] .new-panel .cwd-row input { grid-row: 2; grid-column: 2; width: 100%; margin-left: -6px; padding: 1px 6px; border-radius: 6px;
  font: calc(14px * var(--fs))/1.5 inherit; font-family: inherit; color: var(--muted); }
[data-skin="claude"] .new-panel .cwd-row button { grid-row: 1 / 3; grid-column: 3; padding: 6px 12px; border-radius: 10px; background: var(--tile);
  color: var(--text); font-size: calc(14px * var(--fs)); }
[data-skin="claude"] .new-panel .cwd-row button:hover { background: var(--tile-hover); color: var(--text); }
@media (max-width: 600px) {
  [data-skin="claude"] .greeting:not([hidden]) { font-size: calc(30px * var(--fs)); gap: 10px; }
  [data-skin="claude"] .main:has(#new-panel:not([hidden])) .new-panel { width: calc(100% - 32px); }
  [data-skin="claude"] .new-panel { padding: 12px; }
  [data-skin="claude"] .new-panel .field { grid-template-columns: 36px minmax(0, 1fr) auto; column-gap: 12px; }
  [data-skin="claude"] .new-panel .field::before { width: 36px; height: 36px; }
}

/* ---------- Claude 风格：侧栏质感（2026-11-18 第二轮） ----------
   所有行共用一列图标：会话前面一个小圆圈，文字和「新对话」「搜索」对齐；
   日期分组和项目标签换成一个可折叠的「对话 ⌄」标题，项目筛选收进右边的图标 */
.set-txt { display: none; }
[data-skin="claude"] .session-list { margin: 0; padding: 0; }
[data-skin="claude"] .side-sec { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 16px 2px 4px 10px; }
[data-skin="claude"] .sec-toggle { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 3px 0; border: 0; background: none;
  color: var(--text); font-size: calc(13.5px * var(--fs)); font-weight: 500; cursor: pointer; }
[data-skin="claude"] .sec-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-skin="claude"] .sec-toggle:hover { color: var(--text); }
[data-skin="claude"] .sec-chev { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; transition: transform .15s; }
[data-skin="claude"] .sec-toggle.closed .sec-chev { transform: rotate(-90deg); }
[data-skin="claude"] .sec-filter { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; }
[data-skin="claude"] .sec-filter:hover, [data-skin="claude"] .sec-filter.open { background: var(--hover); color: var(--text); }
[data-skin="claude"] .sec-filter.on { color: var(--accent); }
.pick-menu.side-menu { right: auto; z-index: 60; min-width: 220px; max-height: 60vh; overflow-y: auto; }
.pick-n { margin-left: auto; color: var(--muted); font-size: calc(12px * var(--fs)); }
[data-skin="claude"] .session .s-title { gap: 6px; }
[data-skin="claude"] .session .s-title::before { content: ""; flex: none; width: 6px; height: 6px; margin: 0 10px 0 6px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.3px var(--muted); opacity: .55; }
[data-skin="claude"] .session:has(.badge.run) .s-title::before { background: var(--accent); box-shadow: none; opacity: 1; }
[data-skin="claude"] .session:has(.badge.wait) .s-title::before { background: var(--warning); box-shadow: none; opacity: 1; }
[data-skin="claude"] .session.active .s-sub { padding-left: 28px; }
[data-skin="claude"] .session .badge { padding: 1px 7px; border-radius: 6px; background: var(--tile); color: var(--muted); font-size: calc(11.5px * var(--fs)); }
[data-skin="claude"] .session .badge.run { background: var(--accent-soft); color: var(--accent); }
[data-skin="claude"] .empty-list { padding: 8px 10px; }
[data-skin="claude"] .show-hidden { margin-top: 2px; padding: 7px 10px; border-radius: 10px; text-align: left; color: var(--muted);
  font-size: calc(14px * var(--fs)); }
/* 底部：整行的「设置」，和上面的导航行一样；登录账号名放右边 */
[data-skin="claude"] .foot-row { padding-left: 0; gap: 4px; }
[data-skin="claude"] #settings-btn { order: 1; flex: 1; display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 7px 10px;
  border-radius: 10px; line-height: 1.4; color: var(--text); font-size: calc(14.5px * var(--fs)); }
[data-skin="claude"] #settings-btn svg { stroke-width: 1.6; }
[data-skin="claude"] #settings-btn .set-txt { display: inline; }
[data-skin="claude"] .foot-who { order: 2; flex: 0 1 auto; max-width: 50%; padding-right: 8px; text-align: right; font-size: calc(12.5px * var(--fs)); }
/* 「＋」弹出菜单 */
[data-skin="claude"] #attach.open { background: var(--hover); }
.plus-menu { min-width: 270px; max-width: min(330px, 100%); padding: 6px; border-radius: 16px; gap: 0; box-shadow: 0 10px 32px rgba(0, 0, 0, .12); }
.plus-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none;
  color: var(--text); text-align: left; cursor: pointer; font-size: calc(14.5px * var(--fs)); }
.plus-item:hover:not(.off) { background: var(--hover); }
.plus-item.off { cursor: default; }
.plus-item.off .nav-ic, .plus-item.off b { opacity: .45; }
.plus-item .nav-ic { width: 20px; height: 20px; }
.plus-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.plus-text b { font-weight: 400; line-height: 1.45; }
.plus-text small { color: var(--muted); font-size: calc(12.5px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plus-item kbd { flex: none; padding: 0; border: 0; background: none; color: var(--muted); font: calc(12.5px * var(--fs))/1 inherit; font-family: inherit; }
.plus-item .plus-chev { width: 16px; height: 16px; color: var(--muted); }
.plus-sep { height: 1px; margin: 5px 10px; background: var(--border); }

/* Claude 风格：分区里的日期小标题（今天 / 昨天 / 最近 7 天 / 更早），浅灰小字，和会话文字左对齐 */
[data-skin="claude"] .session-list .group-label { padding: 12px 10px 4px; color: var(--muted); font-size: calc(12px * var(--fs)); font-weight: 500; }
[data-skin="claude"] .session-list .side-sec + .group-label { padding-top: 4px; }

/* Claude 风格：「文件」从顶栏挪到侧栏（搜索下面一行），点开是居中弹窗（上面的弹窗规则已包含 #files）；默认主题不变 */
.side-row { display: none; }
[data-skin="claude"] #files-btn { display: none; }
[data-skin="claude"] .side-row { display: flex; align-items: center; justify-content: flex-start; gap: 10px; min-height: 0; font-weight: 400; width: 100%; padding: 7px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text); font: inherit; font-size: calc(14.5px * var(--fs)); text-align: left; cursor: pointer; }
[data-skin="claude"] .side-row:hover { background: var(--hover); }
/* 弹窗尺寸跟着屏幕走：小屏幕跟以前一样（620×720），大屏幕放大，最大 960×960；文件弹窗更宽一些 */
@media (min-width: 601px) {
  [data-skin="claude"] :is(#settings-panel, #admin-panel, #notify-panel, #files) {
    width: min(clamp(620px, 52vw, 960px), calc(100vw - 32px)); height: min(max(720px, 86vh), 960px, calc(100vh - 48px)); }
  [data-skin="claude"] #files { width: min(clamp(760px, 68vw, 1280px), calc(100vw - 32px)); }
}

/* 文件面板里的 Markdown 预览 */
.viewer-md { padding: 4px 4px 32px; font-size: calc(14px * var(--fs)); line-height: 1.7; overflow-wrap: anywhere; }
/* 页面的 Markdown 渲染把标题降了两级：# → h3，## → h4，### → h5 */
.viewer-md h3 { font-size: calc(20px * var(--fs)); margin: 8px 0 12px; }
.viewer-md h4 { font-size: calc(17px * var(--fs)); margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.viewer-md h5 { font-size: calc(15px * var(--fs)); margin: 16px 0 8px; }

/* ---------- 右侧文档预览 ---------- */
.app.doc-open { grid-template-columns: 288px minmax(0, 1fr) var(--doc-w, 46%); }
.app.doc-open.side-collapsed { grid-template-columns: minmax(0, 1fr) var(--doc-w, 46%); }
.doc-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%;
  border-left: 1px solid var(--border); background: var(--card); }
.doc-resize { position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; cursor: col-resize; z-index: 2; }
.doc-resize:hover, body.resizing .doc-resize { background: linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat; }
body.resizing { cursor: col-resize; user-select: none; }
.doc-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--border); }
.doc-title { flex: 1; min-width: 0; display: grid; gap: 1px; }
.doc-title strong { font-weight: 600; font-size: calc(14px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title small { color: var(--muted); font-size: calc(11.5px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-head .btn, .doc-head button { padding: 4px 10px; font-size: calc(13px * var(--fs)); }
.doc-body { flex: 1; min-height: 0; overflow: auto; padding: 20px 28px 48px; }
.doc-body .viewer-md { max-width: 780px; margin: 0 auto; }
/* 回复里的文档链接和卡片 */
code.doc-link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
code.doc-link:hover { color: var(--accent); }
.doc-cards { display: grid; gap: 8px; margin-top: 10px; }
.doc-card { display: flex; align-items: center; gap: 12px; justify-content: flex-start; width: min(420px, 100%); padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); text-align: left; cursor: pointer;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.doc-card:hover:not(:disabled) { border-color: var(--border-strong, var(--muted)); background: var(--hover); }
.doc-card-ic { flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--chip); color: var(--text-2); }
.doc-card-text { min-width: 0; display: grid; gap: 1px; }
.doc-card-text b { font-weight: 500; font-size: calc(13.5px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card-text small { color: var(--muted); font-size: calc(12px * var(--fs)); }
/* 窄屏：文档预览盖满整个屏幕 */
@media (max-width: 820px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .app.doc-open, .app.doc-open.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  .doc-pane { position: fixed; inset: 0; z-index: 22; border-left: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .doc-resize { display: none; }
  .doc-body { padding: 16px 16px 40px; }
}
a.set-row { color: var(--text); text-decoration: none; cursor: pointer; }
a.set-row:hover { background: var(--hover); }
