:root {
  --bg: #ffffff; --panel: #f6f6f4; --line: #e4e3df; --text: #1f1f1d; --muted: #77756f;
  --accent: #c15f3c; --accent-ink: #ffffff; --user: #efeee9; --code: #f1f0ec; --tool: #f6f6f4;
  --ok: #3a9d5d; --busy: #d69a2d; --idle: #9a9892; --err: #c0392b;
  --radius: 14px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1b1a; --panel: #232321; --line: #34332f; --text: #ecebe6; --muted: #98968f;
    --accent: #d97757; --accent-ink: #1b1b1a; --user: #2c2b28; --code: #2a2926; --tool: #232321;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); }
button { font: inherit; color: inherit; cursor: pointer; }
#app { display: flex; height: 100dvh; }

/* 侧栏 */
#side { width: 300px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 14px 14px 10px; }
.brand { font-weight: 650; font-size: 16px; margin-bottom: 10px; }
#q { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; outline: none; }
#q:focus { border-color: var(--accent); }
#list, #results { list-style: none; margin: 0; padding: 4px 8px; overflow-y: auto; flex: 1; min-height: 0; }
#results { flex: none; max-height: 45%; border-bottom: 1px solid var(--line); }
.item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 10px; }
.item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.item .t { display: flex; align-items: center; gap: 8px; font-weight: 560; }
.item .t .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); font-size: 12.5px; margin-top: 1px; display: flex; gap: 8px; }
.item .snip { color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); display: inline-block; flex: none; }
.dot.busy { background: var(--busy); animation: pulse 1.4s ease-in-out infinite; }
.dot.idle { background: var(--ok); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--err); }
@keyframes pulse { 50% { opacity: .35; } }
.tag { font-size: 11px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.tag.rw { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.side-foot { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; align-items: center; }

/* 主区 */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
#head { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); min-height: 56px; }
.title-wrap { flex: 1; min-width: 0; }
.h-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.busy { color: var(--busy); border-color: var(--busy); }
.pill.idle { color: var(--ok); border-color: var(--ok); }
.icon { display: none; background: none; border: 0; font-size: 20px; padding: 4px 8px; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 9px; padding: 5px 11px; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--muted); }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 8px 20px; font-weight: 600; }
.primary:disabled { opacity: .5; cursor: default; }
#chat { flex: 1; overflow-y: auto; min-height: 0; outline: none; scroll-behavior: auto; }
#msgs { max-width: 860px; margin: 0 auto; padding: 18px 18px 26px; }
.empty { text-align: center; color: var(--text); padding: 18vh 20px 0; }
.muted { color: var(--muted); font-size: 13px; }
#jump { position: absolute; right: 24px; bottom: 150px; z-index: 5; background: var(--text); color: var(--bg); border: 0; border-radius: 999px; padding: 7px 14px; box-shadow: 0 2px 10px #0004; }

/* 消息 */
.m { margin: 14px 0; }
.m.user { display: flex; justify-content: flex-end; }
.m.user > div:not(details) { max-width: 82%; display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; }
.m.user .bubble { background: var(--user); border-radius: var(--radius); padding: 9px 14px; white-space: pre-wrap; word-break: break-word; }
.m.user .bubble.peer { border: 1px dashed var(--line); background: transparent; color: var(--muted); font-size: 13.5px; }
.m.assistant .body { word-break: break-word; }
.m.assistant .body > :first-child { margin-top: 0; } .m.assistant .body > :last-child { margin-bottom: 0; }
.m .ts { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.m.user .ts { text-align: right; }
.note { text-align: center; color: var(--muted); font-size: 12.5px; margin: 16px 0; }
.note::before, .note::after { content: ""; display: inline-block; width: 60px; height: 1px; background: var(--line); vertical-align: middle; margin: 0 10px; }
details.card { margin: 8px 0; border: 1px solid var(--line); border-radius: 11px; background: var(--tool); }
details.card > summary { cursor: pointer; padding: 6px 12px; color: var(--muted); font-size: 13px; list-style: none; display: flex; gap: 8px; align-items: center; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; font-size: 11px; }
details.card[open] > summary::before { content: "▾"; }
details.card .sum-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
details.card pre { margin: 0; padding: 8px 12px 10px; border-top: 1px solid var(--line); max-height: 320px; overflow: auto; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
details.card .res { border-top: 1px solid var(--line); }
details.card .res.err pre { color: var(--err); }
details.thinking > summary { font-style: italic; }
.body p { margin: .6em 0; } .body ul, .body ol { padding-left: 1.5em; margin: .5em 0; }
.body h1, .body h2, .body h3, .body h4 { margin: 1em 0 .4em; line-height: 1.3; }
.body h1 { font-size: 1.3em; } .body h2 { font-size: 1.18em; } .body h3, .body h4 { font-size: 1.05em; }
.body code { font: .88em var(--mono); background: var(--code); padding: .12em .38em; border-radius: 5px; }
.body pre { background: var(--code); border-radius: 10px; padding: 11px 13px; overflow-x: auto; position: relative; }
.body pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; }
.body blockquote { margin: .6em 0; padding: 0 0 0 12px; border-left: 3px solid var(--line); color: var(--muted); }
.body table { border-collapse: collapse; margin: .7em 0; display: block; overflow-x: auto; }
.body th, .body td { border: 1px solid var(--line); padding: 5px 10px; }
.body th { background: var(--panel); }
.body a { color: var(--accent); }
.body hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.copy { position: absolute; top: 6px; right: 6px; font-size: 11.5px; padding: 1px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.working { color: var(--muted); font-size: 13px; margin: 10px auto 18px; max-width: 860px; padding: 0 18px; display: flex; align-items: center; gap: 8px; }

/* 终端画面 / 提示条 */
#screen-panel { border-top: 1px solid var(--line); background: var(--panel); max-height: 38%; display: flex; flex-direction: column; }
.screen-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; color: var(--muted); font-size: 12.5px; }
#screen, #prompt-text { margin: 0; padding: 0 14px 10px; overflow: auto; font: 12px/1.45 var(--mono); white-space: pre; }
#screen { flex: 1; }
#prompt-strip { margin: 0 auto 8px; max-width: 860px; border: 1px solid var(--accent); border-radius: 12px; padding: 8px 4px 10px; background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
#prompt-strip .muted { padding: 0 14px; }
#prompt-text { white-space: pre-wrap; max-height: 150px; }
.keys { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px; }
.keys button { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 4px 14px; }
.keys button:hover { border-color: var(--accent); }

/* 输入 */
#composer-wrap { padding: 8px 18px calc(12px + env(safe-area-inset-bottom)); }
#composer { max-width: 860px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 10px 12px 8px; }
#composer:focus-within { border-color: var(--accent); }
#input { width: 100%; resize: none; border: 0; outline: none; background: none; color: var(--text); font: inherit; max-height: 220px; }
#composer .row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.keys.small { padding: 0; } .keys.small button { background: none; color: var(--muted); padding: 2px 10px; font-size: 12.5px; }
.readonly { max-width: 860px; margin: 0 auto; text-align: center; color: var(--muted); font-size: 13px; padding: 8px; }

@media (max-width: 800px) {
  #side { position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(86vw, 330px); transform: translateX(-102%); transition: transform .2s; }
  #app.open #side { transform: none; box-shadow: 4px 0 24px #0005; }
  #scrim { position: fixed; z-index: 15; inset: 0; background: #0006; }
  .icon { display: block; }
  #msgs { padding: 12px 12px 20px; } #composer-wrap { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .m.user .bubble { max-width: 92%; }
  #jump { bottom: 140px; right: 14px; }
}

.sync { background: none; border: 0; font-size: 12.5px; color: var(--muted); padding: 2px 6px; border-radius: 8px; }
.sync.ok { color: var(--ok); } .sync.warn { color: var(--busy); } .sync.bad { color: var(--err); cursor: pointer; font-weight: 600; }

#list li.row { position: relative; }
#list li.sec { padding: 8px 12px 2px; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.pin { position: absolute; right: 8px; bottom: 6px; background: none; border: 0; font-size: 13px; padding: 2px 4px; border-radius: 6px; opacity: 0; filter: grayscale(1); }
li.row:hover .pin, .pin.on { opacity: .9; }
.pin.on { filter: none; }
.pin:hover { background: color-mix(in srgb, var(--text) 10%, transparent); opacity: 1; }
@media (hover: none) { .pin { opacity: .45; } .pin.on { opacity: .9; } }
.item .s { padding-right: 26px; }

.older { text-align: center; color: var(--muted); font-size: 12.5px; padding: 6px 0 14px; cursor: pointer; user-select: none; }
.older:empty { display: none; }

.termonly { display: none; }
body.term .termonly { display: inline-block; }
body.term #chat, body.term #jump, body.term #btn-screen, body.term #prompt-strip { display: none !important; }
body.term #screen-panel { display: flex; flex: 1; max-height: none; border-top: 0; background: #1c1c1b; color: #e8e6e1; min-height: 0; }
body.term .screen-bar { color: #9a9892; }
body.term .screen-bar .ghost { display: none; }
body.term #screen { color: #e8e6e1; padding-bottom: 12px; font-size: 13px; }

.tag.cc { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); font-weight: 600; letter-spacing: .02em; }
.m.assistant { margin-bottom: calc(14px + 1.6em); }
#screen { user-select: text; -webkit-user-select: text; cursor: text; }
.bar-btns { display: flex; gap: 8px; }
body.term .screen-bar .bar-btns #screen-close { display: none; }
body.term .screen-bar .ghost#screen-copy { display: inline-block; color: #bdbab3; border-color: #4a4944; }

/* 终端输入：命令高亮 + 灰色待补全提示（仅终端模式） */
#input-wrap { position: relative; }
#mirror { display: none; }
body.term #mirror { display: block; position: absolute; inset: 0; margin: 0; padding: 0; overflow: hidden; pointer-events: none; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; color: var(--text); }
body.term #input { position: relative; z-index: 1; background: transparent; color: transparent; caret-color: var(--text); }
body.term #input::placeholder { color: var(--muted); }
body.term #input, body.term #mirror { font: 14px/1.55 var(--mono); letter-spacing: 0; tab-size: 4; }
#mirror .k { color: #2e8b57; font-weight: 600; } #mirror .f { color: #0f8aa0; } #mirror .s { color: #a9741a; }
#mirror .v { color: #a64ca6; } #mirror .o { color: #c15f3c; } #mirror .c { color: var(--muted); font-style: italic; }
#mirror .g { color: var(--muted); opacity: .75; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #mirror .k { color: #7bd88f; } :root:not([data-theme="light"]) #mirror .f { color: #5fd3e6; } :root:not([data-theme="light"]) #mirror .s { color: #e6b95c; } :root:not([data-theme="light"]) #mirror .v { color: #d58fd5; } }
.send-wrap { display: flex; gap: 8px; align-items: center; }
body.term #input { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }

/* 置顶快捷入口 / 标签筛选 */
#quick { flex: none; max-height: 32%; overflow-y: auto; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sec-t { padding: 8px 14px 2px; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; position: sticky; top: 0; background: var(--panel); z-index: 1; }
#quicklist { list-style: none; margin: 0; padding: 2px 8px; }
#filterbar { flex: none; padding: 8px 10px 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); }
#filterbar .ghost { font-size: 12.5px; padding: 3px 10px; }
.badge { display: inline-block; margin-left: 6px; min-width: 17px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; line-height: 17px; text-align: center; }
#active-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 9px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
.fchip button { background: none; border: 0; padding: 0 4px; color: var(--muted); font-size: 13px; line-height: 1; }
#tagpanel { flex: none; max-height: 52%; overflow-y: auto; border-bottom: 1px solid var(--line); background: var(--bg); padding: 8px 12px 10px; }
.tp-h { font-size: 11.5px; color: var(--muted); margin: 8px 0 5px; }
.tp-h:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; color: var(--text); }
.chip:hover { border-color: var(--muted); }
.chip.on { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); }
.chip .n { color: var(--muted); margin-left: 5px; font-size: 11.5px; }
.chip.zero { opacity: .5; }
#tagpanel input[type=text] { width: 100%; padding: 6px 10px; margin-bottom: 7px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; outline: none; }
#tagpanel input[type=text]:focus { border-color: var(--accent); }
.tp-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.tp-foot .ghost { font-size: 12px; padding: 2px 10px; }
.mrow { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; }
.mrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .n { color: var(--muted); font-size: 11.5px; }
.mrow button { background: none; border: 0; padding: 1px 5px; border-radius: 6px; color: var(--muted); }
.mrow button:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.mrow button.danger { color: var(--err); }
.mrow input { flex: 1; margin: 0 !important; }
.item .tg { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; padding-right: 50px; }
.item .tg span { font-size: 11px; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--muted); }
.tagbtn { position: absolute; right: 30px; bottom: 6px; background: none; border: 0; font-size: 12.5px; padding: 2px 4px; border-radius: 6px; opacity: 0; filter: grayscale(1); }
li.row:hover .tagbtn { opacity: .8; } .tagbtn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); opacity: 1; }
@media (hover: none) { .tagbtn { opacity: .45; } }
#tagedit { position: fixed; z-index: 40; width: 260px; max-height: 60vh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px #0004; padding: 10px 12px; }
#tagedit .te-t { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
#tagedit input[type=text] { width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; outline: none; margin-bottom: 6px; }
#tagedit label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; cursor: pointer; }
#tagedit .hint { color: var(--muted); font-size: 12px; padding: 4px 0; }

.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.brand-row .brand { margin-bottom: 0; }
#btn-new { font-size: 12.5px; padding: 3px 11px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.dlg-mask { position: fixed; inset: 0; background: #0006; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { width: min(460px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 16px; box-shadow: 0 12px 40px #0006; }
.dlg h3 { margin: 0 0 12px; font-size: 16px; }
.dlg .lbl { font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
.dlg input[type=text] { width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; outline: none; }
.dlg input[type=text]:focus { border-color: var(--accent); }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 7px 4px; border: 1px solid var(--line); border-radius: 10px; background: none; }
.seg button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.dlg .pv { font-size: 12px; color: var(--muted); margin-top: 5px; font-family: var(--mono); }
.dlg .nt { font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.5; }
.dlg .er { color: var(--err); font-size: 13px; margin-top: 10px; min-height: 1.2em; }
.dlg .ft { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.m.user .qtag { display: none; color: var(--busy); }
.m.user.queued .qtag { display: inline; }
.m.user.queued .bubble { opacity: .72; border: 1px dashed var(--line); }

/* 终端窗口：GitHub Light 风格（浅色，不随系统深色模式变化） */
#screen-panel { background: #ffffff; color: #24292f; border-top: 1px solid #d0d7de; }
.screen-bar { background: #f6f8fa; color: #57606a; border-bottom: 1px solid #d0d7de; }
#screen { background: #ffffff; color: #24292f; font: 13px/1.5 ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }
#screen::selection, #screen *::selection { background: #b6e3ff; color: inherit; }
body.term #screen-panel { background: #ffffff; color: #24292f; border-top: 0; }
body.term .screen-bar { color: #57606a; }
body.term #screen { color: #24292f; }
body.term .screen-bar .ghost#screen-copy, .screen-bar .ghost { color: #57606a; border-color: #d0d7de; background: #ffffff; }

/* 分享 */
#btn-share.on { color: var(--accent); border-color: var(--accent); }
.sf-btn { margin-left: auto; padding: 2px 9px; font-size: 12px; }
#pickbar { max-width: 860px; margin: 0 auto; border: 1px solid var(--accent); border-radius: 16px; background: var(--panel); padding: 10px 14px 8px; }
#pickbar .sb-top { font-weight: 600; margin-bottom: 6px; }
#sb-count.over { color: var(--err); }
#pickbar .sb-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#pickbar .sb-btns .primary { margin-left: auto; padding: 6px 16px; }
#pickbar .sb-hint { font-size: 12px; margin-top: 6px; }
body.sharing #composer, body.sharing #readonly, body.sharing #prompt-strip { display: none !important; }
body.sharing .pk { position: relative; cursor: pointer; padding-left: 30px; border-radius: 10px; }
body.sharing .pk::before { content: "☐"; position: absolute; left: 6px; top: 2px; color: var(--muted); font-size: 16px; }
body.sharing .pk.picked { background: color-mix(in srgb, var(--accent) 10%, transparent); }
body.sharing .pk.picked::before { content: "☑"; color: var(--accent); }
body.sharing .pk.nopick { opacity: .4; cursor: default; }
body.sharing .pk.nopick::before { content: "—"; }
.dlg.wide { width: min(680px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; }
.dlg textarea { width: 100%; height: 150px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: 12.5px/1.45 var(--mono); outline: none; resize: vertical; }
.dlg .ck { display: block; margin-top: 8px; font-size: 13.5px; }
.dlg .hits { margin-top: 10px; font-size: 12.5px; color: var(--ok); }
.dlg #sd-prev { margin: 0; max-height: 230px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: 12.5px/1.5 var(--mono); }
.dlg .nt.over { color: var(--err); }
.dlg input[readonly] { font-family: var(--mono); font-size: 12.5px; }
.mslist { max-height: 60vh; overflow-y: auto; }
.msrow { border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; margin-bottom: 8px; }
.msrow.dead { opacity: .55; }
.msrow .mst { font-weight: 600; word-break: break-word; }
.msrow .msm { color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.msrow .msb { display: flex; gap: 6px; }
.msrow .msb a.ghost { text-decoration: none; display: inline-block; }
.msrow .danger, .danger { color: var(--err); border-color: var(--err); }
#head .ghost { white-space: nowrap; padding: 5px 9px; }
#sb-next.idle { opacity: .55; }
#pickbar .sb-hint.warn { color: var(--err); }

#sb-float { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60; padding: 10px 24px; border-radius: 999px; box-shadow: 0 6px 24px #0006; font-weight: 600; }
#app.open #sb-float { display: none; }

/* 选择模式下分享栏固定贴在窗口底部（和浮动按钮同一机制），不依赖页脚的排版 */
body.sharing #pickbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); width: min(860px, calc(100% - 20px)); z-index: 55; box-shadow: 0 6px 24px #0005; }
body.sharing #composer-wrap { min-height: 135px; }

/* 会话在等用户（最后回复的「等你」一节不是“无”且会话不在工作中） */
.askme { flex: none; background: var(--err); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; animation: askpulse 1.8s ease-in-out infinite; }
.askme.big { font-size: 13px; padding: 5px 11px; }
.askline { margin-top: 3px; font-size: 12px; color: var(--err); font-weight: 560; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@keyframes askpulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--err) 55%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
@media (prefers-reduced-motion: reduce) { .askme { animation: none; } }

/* ===== ocweb 追加 ===== */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 24px 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-card .primary { width: 100%; margin-top: 18px; padding: 10px; }
.login-card .er { color: var(--err); font-size: 13px; min-height: 1.3em; margin-top: 10px; }
.login-card pre { white-space: pre-wrap; word-break: break-all; background: var(--code); padding: 8px 10px; border-radius: 8px; font: 12.5px var(--mono); user-select: all; }
#list li.sec { padding: 8px 12px 2px; font-size: 11.5px; color: var(--muted); }
.dlg input[type=password], .dlg input[type=text], .dlg select { width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; outline: none; }
.dlg .rowb { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dlg a.ghost { text-decoration: none; display: inline-block; }
.dlg ul.lg { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.mini { font-size: 12px; padding: 2px 9px; }
.tool-sum { font-family: var(--mono); font-size: 12.5px; }
.badge-del { color: var(--err); border-color: var(--err); }
.hdr-btns { display: flex; gap: 6px; align-items: center; }
.xmenu { position: relative; display: inline-block; }
.xmenu .pop { position: absolute; right: 0; top: 100%; margin-top: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px #0004; z-index: 30; min-width: 150px; padding: 4px; }
.xmenu .pop a { display: block; padding: 6px 12px; border-radius: 7px; color: var(--text); text-decoration: none; font-size: 13.5px; }
.xmenu .pop a:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.login-card .ck { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 13.5px; color: var(--text); margin-top: 14px; }
.login-card .ck input { width: auto; margin-right: 4px; }
.login-card .hello { font-weight: 600; margin: 4px 0 6px; }
.login-card .alt { text-align: center; margin-top: 14px; font-size: 13px; }
.login-card .alt a { color: var(--accent); }
.login-card .steps { padding-left: 1.2em; margin: 0 0 10px; font-size: 14px; line-height: 1.6; }
.login-card .steps li { margin-bottom: 8px; }
.login-card .mini { margin-top: 4px; }
.confirm-strip { max-width: 860px; margin: 0 auto 8px; border: 1px solid var(--busy); background: color-mix(in srgb, var(--busy) 12%, var(--bg)); border-radius: 12px; padding: 9px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; }
.working-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--busy); animation: pulse 1.2s ease-in-out infinite; }
.more-pop a, .more-pop button { display: block; width: 100%; text-align: left; padding: 7px 12px; border: 0; background: none; border-radius: 7px; color: var(--text); font-size: 13.5px; text-decoration: none; cursor: pointer; }
.more-pop a:hover, .more-pop button:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.big-keys { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 14px 10px; }
.big-keys button { padding: 6px 16px; }
.empty .step { margin: 8px auto; max-width: 420px; text-align: left; }

.attach { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; }
.chip-f { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; background: var(--bg); max-width: 100%; }
.chip-f .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chip-f button { background: none; border: 0; color: var(--muted); padding: 0 6px; font-size: 14px; line-height: 1; }
.chip-f .bar { width: 60px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.chip-f .bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.chip-f.fail { border-color: var(--err); color: var(--err); }
.drop-on #composer { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.frow { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.frow .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .fm { color: var(--muted); font-size: 12px; white-space: nowrap; }
.frow a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.dl-link { display: inline-block; margin: 0 12px 8px; font-size: 13px; color: var(--accent); text-decoration: none; }
