/* CJK pinned via unicode-range: some iOS builds (e.g. the iOS 26.3 simulator) report
   -apple-system as covering CJK and draw empty boxes instead of falling back. */
@font-face { font-family: HHCJK; src: local("PingFangSC-Regular"); font-weight: 100 500; unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF, U+3000-303F, U+20000-2FFFF; }
@font-face { font-family: HHCJK; src: local("PingFangSC-Semibold"); font-weight: 600 900; unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF, U+3000-303F, U+20000-2FFFF; }

:root {
  --bg: #ededed; --page: #f7f7f7; --panel: #ffffff; --text: #111111; --muted: #888888; --faint: #b2b2b2; --line: #e5e5e5;
  --me: #95ec69; --me-text: #111111; --bot: #ffffff; --accent: #07c160; --link: #576b95; --danger: #fa5151; --warn: #f0a020;
  --code: #f3f3f3; --hover: #f2f2f2; --sel: #dedede; --diff-add: #e6ffec; --diff-del: #ffebe9;
  --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  --mono: HHCJK, ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111; --page: #111111; --panel: #191919; --text: #e9e9e9; --muted: #8c8c8c; --faint: #5a5a5a; --line: #262626;
    --me: #3eb575; --me-text: #ffffff; --bot: #2c2c2c; --code: #232323; --hover: #222; --sel: #2a2a2a; --link: #7d90a9;
    --diff-add: #1c3326; --diff-del: #3d1f22;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--text); font: 16px/1.5 HHCJK, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i { flex: none; vertical-align: middle; }
svg.xs { width: 14px; height: 14px; stroke-width: 2; }
svg.sm { width: 18px; height: 18px; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 5px; animation: pulse 1.4s infinite; flex: none; }
.live-dot.warn { background: var(--warn); animation: none; }
.spin { display: inline-block; width: 12px; height: 12px; border: 1.6px solid var(--faint); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
a { color: var(--link); }

/* ------------------------------------------------------------ layout (phone) */
#app { position: fixed; inset: 0; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--page); }
.view.on { display: flex; }
#chat, #session { background: var(--bg); }
.view.push, #fb.push { animation: push .22s cubic-bezier(.2,.8,.2,1); }
@keyframes push { from { transform: translateX(28%); opacity: .4; } to { transform: none; opacity: 1; } }
.placeholder { display: none; }
body.top .view.on { bottom: calc(52px + var(--safe-bottom)); }
/* Swipe back: the page below shows under the one being dragged. */
.view.under { display: flex; }
#list.under { z-index: 0; }
#chat, #session { z-index: 1; }
body.peek-top #list.under { bottom: calc(52px + var(--safe-bottom)); }
body.peek-top .tabs { display: flex; z-index: 0; }

.tabs { position: absolute; left: 0; right: 0; bottom: 0; height: calc(52px + var(--safe-bottom)); padding-bottom: var(--safe-bottom); display: none; background: var(--page); border-top: .5px solid var(--line); z-index: 5; }
body.top .tabs { display: flex; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted); font-size: 10.5px; position: relative; }
.tabs button svg { width: 25px; height: 25px; }
.tabs button.on { color: var(--accent); }
.tabs button.on svg { fill: currentColor; fill-opacity: .12; }
.tabs .badge { position: absolute; top: 4px; left: calc(50% + 6px); }

/* ------------------------------------------------------------ bars */
.bar { flex: none; display: flex; align-items: center; gap: 4px; min-height: 48px; padding: calc(var(--safe-top) + 2px) 8px 2px; background: var(--page); border-bottom: .5px solid var(--line); position: relative; z-index: 2; }
#chat .bar, #session .bar { background: var(--bg); }
.bar h1 { flex: 1; margin: 0 0 0 8px; font-size: 17px; font-weight: 600; }
.bar .title { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; line-height: 1.25; }
.bar .title b { font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; justify-content: center; gap: 1px; }
.bar .title small .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar .title small svg { color: var(--faint); margin-left: 2px; }
.bar .title small.working { color: var(--accent); }
button.title { cursor: pointer; padding: 2px 0; border-radius: 8px; }
button.title:active { background: var(--sel); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; flex: none; }
.icon-btn:active { background: var(--sel); }
.text-btn { font-size: 14px; color: var(--link); padding: 6px 8px; flex: none; }
.conn { display: inline-flex; align-items: center; margin-right: 6px; color: var(--faint); transition: color .3s; }
.conn svg { width: 20px; height: 20px; stroke-width: 1.6; }
.conn[data-mode="p2p"], .ci.net-p2p { color: var(--accent); }
.conn[data-mode="relay"], .ci.net-relay { color: var(--warn); }
.conn[data-mode="off"], .ci.net-off { color: var(--faint); }

/* ------------------------------------------------------------ project list */
.plist { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; background: var(--panel); -webkit-overflow-scrolling: touch; }
.plist li { display: flex; gap: 12px; padding: 11px 16px; align-items: center; cursor: pointer; position: relative; }
.plist li::after { content: ""; position: absolute; left: 72px; right: 0; bottom: 0; border-bottom: .5px solid var(--line); }
.plist li:active, .plist li.sel { background: var(--sel); }
.avatar { width: 46px; height: 46px; border-radius: 8px; background: var(--code); display: grid; place-items: center; font-size: 26px; flex: none; position: relative; }
.avatar.sm { width: 38px; height: 38px; font-size: 22px; border-radius: 6px; }
.avatar.letter { background: hsl(var(--av, 152) 42% 52%); color: #fff; font-size: 19px; font-weight: 600; letter-spacing: -.5px; }
.avatar.letter.sm { font-size: 16px; }
@media (prefers-color-scheme: dark) { .avatar.letter { background: hsl(var(--av, 152) 32% 38%); } }
.msg.me .avatar { background: #c9d6c2; color: #3b5a2c; font-size: 15px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .msg.me .avatar { background: #2f4a39; color: #bfe6c9; } }
.avatar .badge { position: absolute; top: -6px; right: -6px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 500; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); display: none; }
.avatar .dot.working { display: block; background: var(--accent); animation: pulse 1.4s infinite; }
.avatar .dot.needs_you { display: block; background: var(--warn); }
@keyframes pulse { 50% { opacity: .35; } }
.pmeta { flex: 1; min-width: 0; }
.pname { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pname span { font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname time { font-size: 11.5px; color: var(--faint); flex: none; }
.plast { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.plast b { font-weight: 400; color: var(--danger); }
.plast b.w { color: var(--accent); }
.empty { padding: 60px 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ chat */
.msgs { flex: 1; overflow-y: auto; padding: 8px 12px 16px; -webkit-overflow-scrolling: touch; }
.time { text-align: center; font-size: 12px; color: var(--faint); margin: 14px 0 8px; }
.sys { text-align: center; font-size: 12.5px; color: var(--muted); margin: 10px 24px; line-height: 1.5; }
.msg { display: flex; gap: 9px; margin: 12px 0; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.msg > .col { min-width: 0; max-width: calc(100% - 96px); display: flex; flex-direction: column; }
.msg.me > .col { align-items: flex-end; }
.bubble { position: relative; padding: 9px 12px; border-radius: 6px; background: var(--bot); font-size: 16px; line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.msg.me .bubble { background: var(--me); color: var(--me-text); }
.bubble::before { content: ""; position: absolute; top: 13px; left: -5px; border: 5px solid transparent; border-left: 0; border-right-color: var(--bot); }
.msg.me .bubble::before { left: auto; right: -5px; border: 5px solid transparent; border-right: 0; border-left-color: var(--me); }
.bubble p { margin: 0 0 .5em; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: .2em 0 .5em; padding-left: 1.2em; } .bubble li { margin: .1em 0; }
.bubble pre { background: var(--code); padding: 8px 10px; border-radius: 6px; overflow-x: auto; font-size: 12.5px; margin: .4em 0; }
.bubble code { font: 13px var(--mono); background: var(--code); padding: 1px 4px; border-radius: 4px; }
.msg.me .bubble code { background: rgba(0,0,0,.08); }
.bubble pre code { background: none; padding: 0; }
.bot .bubble.tap { cursor: pointer; }
.bot .bubble.tap:active { filter: brightness(.95); }
.meta { margin-top: 4px; font-size: 11.5px; color: var(--faint); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.meta .steps { color: var(--link); cursor: pointer; display: inline-flex; align-items: center; }
.meta .via { color: var(--muted); }
.meta .tagq { color: var(--muted); }
.typing .bubble { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; max-width: 100%; }
.typing .bubble .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dots { display: inline-flex; gap: 3px; flex: none; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 40% { background: var(--accent); } }
.streaming::after { content: "▍"; color: var(--accent); animation: blink 1s infinite; }
.stepline { text-align: center; margin: 8px 0; }
.stepline button { font-size: 12px; color: var(--link); background: var(--panel); padding: 3px 10px; border-radius: 10px; display: inline-flex; align-items: center; }

/* cards (approvals, passwords, notices) */
.card { background: var(--panel); border-radius: 8px; padding: 12px 14px; margin: 12px 0 12px 47px; max-width: 520px; }
.card h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.card .body { font-size: 13.5px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
.card .body.mono { font: 12.5px var(--mono); color: var(--text); background: var(--code); padding: 8px; border-radius: 6px; margin-top: 6px; }
.card.urgent { box-shadow: inset 3px 0 0 var(--warn); }
.card.error h4 { color: var(--danger); }
.card .done { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.card input { width: 100%; margin-top: 10px; padding: 10px 12px; border: .5px solid var(--line); border-radius: 6px; background: var(--page); }
.acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn { padding: 7px 14px; border-radius: 6px; background: var(--code); font-size: 14px; font-weight: 500; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; }
.btn:active { filter: brightness(.92); }

/* artifact card (link-card style) */
.art { background: var(--panel); border-radius: 8px; overflow: hidden; width: 250px; }
.art .thumb { display: block; width: 100%; aspect-ratio: 390/440; object-fit: cover; object-position: top; background: var(--code); }
.art .thumb.img { aspect-ratio: auto; max-height: 300px; object-fit: contain; }
.art .ainfo { padding: 9px 12px 4px; }
.art .ainfo b { font-size: 15px; font-weight: 500; display: block; }
.art .ainfo span { font-size: 12px; color: var(--faint); }
.art .acts { margin: 0; padding: 8px 12px 12px; gap: 6px; }
.art .acts .btn { flex: 1; padding: 7px 6px; font-size: 13px; }

/* composer */
.composer { flex: none; background: var(--page); border-top: .5px solid var(--line); padding: 6px 8px calc(6px + var(--safe-bottom)); }
.composer .row { display: flex; gap: 6px; align-items: flex-end; }
.composer .plus { width: 36px; height: 38px; color: var(--text); }
.composer .plus svg { width: 28px; height: 28px; stroke-width: 1.4; }
.composer textarea { flex: 1; resize: none; border: 0; border-radius: 6px; padding: 8px 10px; font-size: 16px; line-height: 22px; background: var(--panel); max-height: 132px; min-height: 38px; outline: none; }
.composer .send { height: 34px; margin-bottom: 2px; padding: 0 12px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 500; display: none; }
.composer.has .send { display: block; }
.composer.has .plus { display: none; }
#session .composer .send { display: block; }
#session .composer.empty-text .send { opacity: .5; }
.plus-panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; padding: 18px 8px 8px; }
.plus-panel button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.plus-panel i { width: 56px; height: 56px; border-radius: 12px; background: var(--panel); display: grid; place-items: center; font-style: normal; color: var(--text); }
.plus-panel i svg { width: 26px; height: 26px; stroke-width: 1.5; }

/* ------------------------------------------------------------ session stream (Codex-style) */
.turns { flex: 1; overflow-y: auto; padding: 6px 0 28px; -webkit-overflow-scrolling: touch; background: var(--panel); }
.turn { padding: 14px 16px 8px; }
.turn.hl { animation: hl 1.6s ease-out; }
@keyframes hl { from { background: rgba(7,193,96,.10); } }
.uq { display: flex; flex-direction: column; align-items: flex-end; margin: 4px 0 10px 18%; }
.uq .ub { background: var(--bg); border-radius: 16px; padding: 9px 13px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; overflow: hidden; position: relative; user-select: text; -webkit-user-select: text; }
.uq .ub.more { max-height: 12em; }
.uq .ub.more::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2em; background: linear-gradient(transparent, var(--bg)); }
.uq .ub.open { max-height: none; } .uq .ub.open::after { display: none; }
.uq .ubmore { display: inline-flex; align-items: center; gap: 3px; margin: 4px 4px 0; padding: 2px 0; border: 0; background: none; color: var(--link); font-size: 13px; cursor: pointer; }
.uq .ubmore .i { transform: rotate(90deg); transition: transform .2s; }
.uq .ubmore .m2, .uq.open .ubmore .m1 { display: none; } .uq.open .ubmore .m2 { display: inline; }
.uq.open .ubmore .i { transform: rotate(-90deg); }
.uq time { font-size: 11px; color: var(--faint); margin: 4px 4px 0; }
.uq.mid { margin: 10px 0 10px 18%; }
.uq.mid .ub { font-size: 14px; padding: 7px 12px; }
.uq .tagq { font-size: 11px; color: var(--warn); margin: 3px 4px 0; display: inline-flex; align-items: center; gap: 3px; }
.worked { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); padding: 6px 0; }
.worked .wc { transition: transform .15s; color: var(--faint); }
.turn.open .worked .wc { transform: rotate(90deg); }
.proc { display: none; padding: 2px 0 6px; }
.turn.open .proc { display: block; }
.pn { font-size: 15px; line-height: 1.62; margin: 8px 0; color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.pn p { margin: 0 0 .5em; } .pn p:last-child { margin: 0; }
.pn code, .ans code { font: 13px var(--mono); background: var(--code); padding: 1px 4px; border-radius: 4px; }
.grp, .fchip { margin: 4px 0; }
.gh { display: flex; align-items: center; gap: 8px; font-size: 13.5px; line-height: 1.5; color: var(--muted); padding: 5px 0; text-align: left; width: 100%; min-width: 0; }
.gh > span { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh .gf { flex: none; font-weight: 400; }
.gh .ri { flex: none; width: 16px; height: 16px; color: var(--faint); }
.gh .gc { flex: none; color: var(--faint); transition: transform .15s; transform: rotate(-90deg); }
.grp.open > .gh .gc, .fchip.open > .gh .gc { transform: none; }
.gb { margin: 2px 0 6px 7px; padding-left: 15px; border-left: 1.5px solid var(--line); }
.row { padding: 3px 0; }
.row .rh { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.row.has .rh { cursor: pointer; }
.row .rh .ri { flex: none; width: 15px; height: 15px; color: var(--faint); }
.row .rt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.row .rt code { font: 12.5px var(--mono); color: var(--text); background: none; padding: 0; }
.row .rt .fn { color: var(--text); }
.row .ms { font-size: 11px; color: var(--faint); flex: none; }
.row .rh .spin { flex: none; }
.row.has .rh::after { content: ""; flex: none; width: 6px; height: 6px; border: solid var(--faint); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); margin: 0 3px 0 1px; transition: transform .15s; }
.row.has.open .rh::after { transform: rotate(45deg); }
.rd { margin: 6px 0 6px 23px; min-width: 0; }
.rd .cmdl { color: var(--muted); }
.bad { color: var(--danger); }
.a { color: var(--accent); } .r { color: var(--danger); }
.rd pre, .gb pre { margin: 0; font: 11.5px/1.45 var(--mono); background: var(--code); border-radius: 6px; padding: 8px; overflow: auto; max-height: 320px; white-space: pre-wrap; word-break: break-all; }
.rd pre.diff, .gb pre.diff { white-space: pre; word-break: normal; }
.fchip { background: var(--bg); border-radius: 10px; padding: 2px 12px; margin: 10px 0 4px; }
.fchip .gb { border-left: 0; padding: 0; margin: 0 0 8px; }
.file { margin-bottom: 6px; }
.file .fh { font: 12px var(--mono); padding: 4px 0; display: flex; gap: 8px; min-width: 0; }
.file .fh > span:first-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.file .fh > span:not(:first-child) { flex: none; }
.diff .ad { background: var(--diff-add); display: block; } .diff .dl { background: var(--diff-del); display: block; }
.turn .ans { font-size: 15.5px; line-height: 1.65; padding: 6px 0 2px; word-wrap: break-word; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.ans p { margin: 0 0 .65em; } .ans p:last-child { margin: 0; }
.ans h4, .pn h4 { margin: .6em 0 .3em; font-size: 15.5px; }
.ans pre, .pn pre { background: var(--code); padding: 8px 10px; border-radius: 6px; overflow-x: auto; font-size: 12.5px; }
.ans pre code, .pn pre code { background: none; padding: 0; }
.ans ul, .ans ol, .pn ul, .pn ol { padding-left: 1.3em; margin: .3em 0 .65em; }
.ans li, .pn li { margin: .15em 0; }
.ans code.fl, .pn code.fl, .bubble code.fl { color: var(--link); }
.tbl { overflow-x: auto; margin: .4em 0 .7em; }
.tbl table { border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { border: .5px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.tbl th { background: var(--bg); font-weight: 600; }
.hb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--faint); padding: 4px 0; }
.acard { display: flex; align-items: center; gap: 12px; border: .5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0 4px; cursor: pointer; }
.acard img, .acard .ai { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; object-position: top; background: var(--code); flex: none; display: grid; place-items: center; color: var(--muted); }
.acard .am { flex: 1; min-width: 0; }
.acard .am b { display: block; font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard .am small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.acard:active { background: var(--hover); }

/* ------------------------------------------------------------ pages (desk / me) */
.page { flex: 1; overflow-y: auto; padding: 0 0 24px; }
.group { margin: 18px 0 0; }
.group h5 { margin: 0 16px 6px; font-size: 13px; font-weight: 400; color: var(--muted); }
.cells { background: var(--panel); }
.cell { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; font-size: 16px; min-height: 52px; cursor: pointer; }
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.cell:active { background: var(--sel); }
.cell .ci { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 17px; flex: none; background: var(--code); color: var(--muted); }
.cell .ci svg { width: 18px; height: 18px; }
.cell .ci.ok { color: var(--accent); } .cell .ci.bad { color: var(--danger); } .cell .ci.live { color: var(--danger); }
.cell .chev svg { width: 16px; height: 16px; }
.icon-btn.sm { width: 32px; height: 32px; color: var(--faint); }
.icon-btn.sm svg { width: 20px; height: 20px; }
.cell .cm { flex: 1; min-width: 0; }
.cell .cm small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .cv { font-size: 14px; color: var(--muted); flex: none; }
.cell .cv.ok { color: var(--accent); } .cell .cv.bad { color: var(--danger); }
.cell .chev { color: var(--faint); flex: none; }
.note { font-size: 12.5px; color: var(--muted); margin: 8px 16px 0; line-height: 1.5; }

/* ------------------------------------------------------------ overlays */
.overlay { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.ov-bar { display: flex; align-items: center; gap: 2px; padding: calc(var(--safe-top) + 2px) 6px 2px; background: #111; color: #fff; flex: none; }
.ov-title { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.fps { font-size: 11px; color: #888; margin-right: 4px; }
.errs { display: flex; gap: 8px; align-items: center; background: #3a1d1d; color: #ffd7d7; padding: 8px 10px; font-size: 12.5px; }
.lv-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; }
#lv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.lv-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(0,0,0,.7); color: #fff; font-size: 12.5px; padding: 6px 12px; border-radius: 14px; pointer-events: none; max-width: 90%; text-align: center; }
.lv-text { position: absolute; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }
.lv-keys { display: flex; gap: 4px; padding: 6px 6px calc(6px + var(--safe-bottom)); background: #111; overflow-x: auto; flex: none; }
.lv-keys button { flex: none; min-width: 40px; height: 36px; padding: 0 8px; border-radius: 6px; background: #2a2a2a; color: #eee; font-size: 13px; display: grid; place-items: center; }
.lv-keys button svg, .dpad button svg { width: 20px; height: 20px; stroke-width: 2; }
.lv-keys button.on { background: var(--accent); color: #fff; }
.dpad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; padding: 10px 0 calc(10px + var(--safe-bottom)); background: #111; flex: none; }
.dpad button { height: 52px; border-radius: 12px; background: #2a2a2a; color: #fff; font-size: 20px; display: grid; place-items: center; }
.dpad button:active { background: #3a3a3a; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { position: relative; width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--page); border-radius: 12px 12px 0 0; padding: 6px 0 calc(16px + var(--safe-bottom)); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30%); opacity: .6; } }
.sheet-body h3 { margin: 10px 16px 12px; font-size: 17px; text-align: center; font-weight: 600; }
.sheet-body .form { padding: 0 16px; }
.sheet-body label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.sheet-body input, .sheet-body select { width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: var(--panel); font-size: 16px; }
.sheet-body .acts { padding: 0 16px; margin-top: 16px; }
.sheet-body .acts .btn { flex: 1; padding: 11px; }
.seg { display: flex; gap: 8px; padding: 0 16px; margin-top: 8px; }
.seg .btn { flex: 1; padding: 10px; background: var(--panel); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg .btn svg { width: 18px; height: 18px; }
.seg .btn.on { background: var(--accent); color: #fff; }
.sess .cm b { font-weight: 500; font-size: 15.5px; display: flex; align-items: center; min-width: 0; }
.sess .cm b .tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sess .cm b .chip { flex: none; }
.sess.cur .ci { background: var(--accent); color: #fff; }
.chip.on { background: rgba(7,193,96,.14); color: var(--accent); }
.chip { display: inline-block; font-size: 10.5px; padding: 0 5px; border-radius: 4px; background: var(--code); color: var(--muted); margin-left: 6px; vertical-align: 1px; font-weight: 400; }

.toast { position: fixed; left: 50%; top: calc(var(--safe-top) + 10px); transform: translateX(-50%); z-index: 40; width: min(92vw, 420px); background: rgba(40,40,40,.94); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; box-shadow: 0 6px 24px rgba(0,0,0,.25); cursor: pointer; }
.toast b { display: block; font-size: 14px; margin-bottom: 2px; }

/* ------------------------------------------------------------ wide (Mac app / iPad / desktop browser) */
@media (min-width: 900px) {
  body.wide .tabs { display: flex; flex-direction: column; justify-content: flex-start; gap: 6px; top: 0; bottom: 0; right: auto; width: 64px; height: auto; padding: calc(var(--safe-top) + 44px) 0 0; border-top: 0; border-right: .5px solid var(--line); background: var(--bg); }
  body.wide .tabs button { flex: none; height: 56px; }
  body.wide .view { display: none; bottom: 0 !important; }
  body.wide #list { display: flex; left: 64px; right: auto; width: 300px; border-right: .5px solid var(--line); }
  body.wide #chat.on { display: flex; left: 364px; right: 0; }
  body.wide.split #chat.on { right: min(46%, 640px); border-right: .5px solid var(--line); }
  body.wide #session.on { display: flex; left: auto; right: 0; width: min(46%, 640px); }
  body.wide #desk.on, body.wide #me.on { display: flex; left: 64px; right: 0; }
  body.wide.tab-desk #list, body.wide.tab-me #list { display: none; }
  body.wide.split #list { display: none; }
  body.wide.split #chat.on { left: 64px; }
  body.wide .placeholder { display: grid; position: absolute; left: 364px; right: 0; top: 0; bottom: 0; place-items: center; color: var(--faint); background: var(--bg); }
  body.wide.has-chat .placeholder, body.wide.tab-desk .placeholder, body.wide.tab-me .placeholder { display: none; }
  body.wide .back { visibility: hidden; }
  body.wide #session .back { visibility: visible; }
  body.wide .plist li:active { background: var(--sel); }
  body.wide .phone-only { display: none; }
  body.wide .msgs { padding: 8px 28px 16px; }
  body.wide .msg > .col { max-width: min(640px, calc(100% - 110px)); }
  body.wide .bar { min-height: 56px; }
  body.wide #chat .bar .title { text-align: left; padding-left: 8px; }
  body.wide .sheet { align-items: center; }
  body.wide .sheet-body { border-radius: 12px; }
  .plist li:hover { background: var(--hover); }
  .cell:hover { background: var(--hover); }
}

@media (min-width: 1280px) { body.wide.split #list { display: flex; } body.wide.split #chat.on { left: 364px; } }
body.wide #chat .bar .title small { justify-content: flex-start; }

/* ---- other sessions with news (one line under the chat header) */
.others { flex: none; display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; padding: 7px 14px; border: 0; border-bottom: .5px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.others .i { flex: none; color: var(--muted); }
.others .ot { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.others b { flex: none; color: var(--link); font-weight: 500; }
.others.hidden { display: none; }

/* ---- relay login */
body.login-mode #app { display: none; }
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px 16px calc(24px + var(--safe-bottom)); background: var(--page); overflow-y: auto; }
.lg-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.lg-logo { display: block; width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 14px; }
.lg-box h1 { margin: 0; font-size: 24px; }
.lg-box p { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.lg-box input { height: 44px; padding: 0 12px; border-radius: 8px; border: .5px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: 16px; }
.lg-box .btn { height: 44px; font-size: 16px; justify-content: center; }
.lg-err { min-height: 18px; color: var(--danger); font-size: 13px; }
.lg-alt { color: var(--faint); font-size: 12px; }
.lg-cmd { margin: 0; padding: 10px; border-radius: 8px; background: var(--panel); font-family: var(--mono); font-size: 12px; text-align: left; white-space: pre-wrap; word-break: break-all; }

/* Jump-to-latest button (chat and session stream) */
.tobottom { position: absolute; left: 50%; transform: translateX(-50%); z-index: 6; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--text); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0, 0, 0, .1); }
.tobottom .i { width: 16px; height: 16px; }
.tobottom:active { transform: translateX(-50%) scale(.94); }

/* Mac dialog popup: a floating mini window, like a WeChat video call's small window */
.dlg { position: fixed; z-index: 60; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 78px); transform: translateX(-50%); width: min(300px, 82vw); border-radius: 14px; overflow: hidden; background: #1b1b1b; box-shadow: 0 12px 32px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .06); touch-action: none; animation: dlg-in .18s ease-out; }
.dlg.moved { transform: none; bottom: auto; animation: none; }
@keyframes dlg-in { from { opacity: 0; transform: translateX(-50%) scale(.92); } }
.dlg-video { position: relative; background: #111; min-height: 110px; }
.dlg canvas { display: block; width: 100%; height: 100%; }
.dlg-fields { position: absolute; inset: 0; pointer-events: none; }
.dlg-fields i { position: absolute; border: 1.5px solid rgba(7, 193, 96, .9); border-radius: 5px; }
.dlg-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px 14px 12px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); color: #fff; font-size: 12px; }
.dlg-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dlg-x { flex: none; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .2); color: #fff; }
.dlg-x .i { width: 13px; height: 13px; }
.dlg-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; color: #bbb; font-size: 13px; }
.dlg-input { display: flex; gap: 6px; padding: 8px; background: #262626; }
.dlg-input input { flex: 1; min-width: 0; border: 0; border-radius: 8px; padding: 8px 10px; font-size: 16px; background: #3a3a3a; color: #fff; outline: none; }
.dlg-input .btn { flex: none; }

/* Agent marks in their brand colors (the current session keeps white on green). */
.ci.ag-claude, .seg .ag-claude { color: #d97757; }
.seg .ag-claude { display: inline-flex; }
.ci.ag-codex { color: var(--text); }
.sess.cur .ci.ag-claude, .sess.cur .ci.ag-codex { color: #fff; }

/* Main conversation: where the next message goes (left of the input) */
.composer .tgt { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 36px; max-width: 34%; padding: 0 10px; border-radius: 18px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.composer .tgt > span:not([class^="ag-"]) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.composer .tgt svg { width: 15px; height: 15px; flex: none; }
.composer .tgt .ag-claude, .composer .tgt .ag-codex { display: inline-flex; }
.composer .tgt.picked { color: var(--text); border-color: var(--accent); }
.composer .tgt .ag-claude { color: #d97757; }
/* Coordinator notes ("交给「撤销按钮」", "拆成 2 个任务") */
.sys.route { display: flex; align-items: center; justify-content: center; gap: 5px; }
.sys.route .spin { width: 10px; height: 10px; margin-left: 4px; }
/* Live card of a session at work */
.typing .tsess { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.typing .tsess svg { width: 14px; height: 14px; }
.typing .tsess .ag-claude { color: #d97757; display: inline-flex; }
.typing .tsess .ag-codex { display: inline-flex; }
.chip.warn { color: var(--warn); }
.typing .bubble { flex-wrap: wrap; row-gap: 2px; }
.typing .tsess { flex-basis: 100%; margin-bottom: 0; }

/* Live view: tap feedback */
.lv-tap { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9); background: rgba(7, 193, 96, .35); pointer-events: none; animation: lv-tap .45s ease-out forwards; }
.lv-tap.right { background: rgba(240, 160, 32, .4); }
@keyframes lv-tap { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

/* Quick commands above the input: one tap fills "/new", "@Codex", "@<session>" */
.qcmd { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.qcmd::-webkit-scrollbar { display: none; }
.qcmd button { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.qcmd button svg { width: 13px; height: 13px; }
.qcmd button .ag-codex, .qcmd button .ag-claude { display: inline-flex; }
.qcmd button .ag-claude { color: #d97757; }
.qcmd button.sess { color: var(--link); }
.qcmd .qlbl { flex: none; align-self: center; font-size: 12px; color: var(--faint); margin: 0 0 0 4px; }
.qcmd .qsep { flex: none; align-self: center; width: 1px; height: 16px; background: var(--line); margin: 0 2px; }

/* Live view: native video (RTP) and the locally drawn pointer */
.lv-video { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #000; pointer-events: none; object-fit: fill; }
.lv-cursor { position: absolute; left: 0; top: 0; width: 18px; height: 18px; margin: -1px 0 0 -1px; pointer-events: none; z-index: 3;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l14 11.5-6.2.8 3.6 7-2.6 1.3-3.5-7.1L4 20z' fill='%23000' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.lv-stage canvas { z-index: 2; }
.lv-stage canvas.clear { background: transparent !important; }

/* Shortcut bar above the keyboard: symbol + what it does */
.lv-keys button { flex-direction: column; gap: 0; min-width: 46px; height: 42px; line-height: 1.1; }
.lv-keys button b { font-weight: 600; font-size: 14px; display: grid; place-items: center; }
.lv-keys button small { font-size: 9.5px; color: #9a9a9a; }
.lv-keys button.on small { color: #fff; }
.lv-keys button.mod { background: #1d1d1d; }
#live.kb-up .lv-keys { padding-bottom: 6px; }

/* Region map: the app's panes in color, tap one to zoom there */
.lv-map { position: absolute; inset: 0; z-index: 5; background: rgba(0, 0, 0, .28); }
.lv-map-win { position: absolute; border: 1.5px dashed rgba(255, 255, 255, .55); border-radius: 8px; pointer-events: none; }
.lv-reg { position: absolute; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 30%, transparent); border-radius: 6px; display: grid; place-items: center; padding: 0; color: #fff; animation: lv-reg-in .2s ease-out; }
.lv-reg:active { background: color-mix(in srgb, var(--c) 50%, transparent); }
.lv-reg span { background: var(--c); padding: 4px 11px; border-radius: 13px; font-size: 13px; font-weight: 600; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); white-space: nowrap; }
@keyframes lv-reg-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.lv-map-bar { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; overflow-x: auto; background: rgba(24, 24, 24, .9); border-radius: 12px; padding: 6px 8px; color: #eee; font-size: 13px; }
.lv-map-bar b { flex: none; font-weight: 600; margin-right: 4px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-map-bar button { flex: none; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; background: #2c2c2c; color: #eee; font-size: 13px; }
.lv-map-bar button i { width: 10px; height: 10px; border-radius: 3px; }
.lv-map-bar button[data-i="x"] { margin-left: auto; padding: 0 6px; background: transparent; }
.lv-map-bar button svg { width: 18px; height: 18px; }
#lv-regions.on { color: var(--accent); }
.lv-keys .lv-app { flex: none; align-self: center; color: #8a8a8a; font-size: 11px; padding: 0 4px 0 2px; writing-mode: horizontal-tb; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-keys button { min-width: 52px; }
.lv-keys button b { font-family: -apple-system, "SF Pro Text", system-ui, sans-serif; font-variant-emoji: text; font-size: 13.5px; }

/* Session sheet: agents in a sideways strip, the list scrolls in place, "…" opens a dropdown */
.ag-strip { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.ag-strip::-webkit-scrollbar { display: none; }
.ag-strip .btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px; border-radius: 10px; background: var(--bg); font-size: 15px; scroll-snap-align: start; }
.ag-strip .btn svg { width: 18px; height: 18px; }
.ag-strip .btn.on { outline: 2px solid var(--accent); }
.ag-strip .btn.ghost { padding: 0 12px; color: var(--muted); }
.sess-wrap { position: relative; }
.sess-list { max-height: min(46vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sess-list::-webkit-scrollbar { width: 3px; }
.sess-list::-webkit-scrollbar-thumb { background: var(--faint); border-radius: 2px; }
.sess-wrap.fade::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; pointer-events: none; background: linear-gradient(to bottom, transparent, var(--bg)); }
.sess-more { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 2; font-size: 12px; color: var(--muted); background: var(--page); border: .5px solid var(--line); border-radius: 12px; padding: 3px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.sess-list .cell.sess { position: relative; }
.sess-pop { position: absolute; z-index: 40; min-width: 150px; background: var(--page); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18), 0 0 0 .5px var(--line); padding: 4px 0; animation: pop-in .14s ease-out; }
.sess-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; font-size: 15px; text-align: left; color: var(--text); background: none; }
.sess-pop button:active { background: var(--sel); }
.sess-pop button svg { width: 17px; height: 17px; color: var(--muted); }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.tt-edit { font: inherit; font-weight: 600; width: 100%; max-width: 220px; padding: 2px 6px; margin: -3px 0; border: 1px solid var(--accent); border-radius: 6px; background: var(--page); color: var(--text); }
/* Agent settings */
.ag-prefs .cell { gap: 8px; transition: transform .15s; background: var(--bg); }
.ag-prefs .cell.dragging { transition: none; z-index: 3; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.ag-prefs .drag { touch-action: none; color: var(--faint); padding: 6px 2px; display: grid; place-items: center; }
.ag-prefs .drag svg { width: 18px; height: 18px; stroke-width: 3; }
.ag-prefs .tog { flex: none; font-size: 12px; padding: 5px 9px; border-radius: 12px; background: var(--panel); color: var(--muted); }
.ag-prefs .tog.on { background: var(--accent); color: #fff; }
.ag-strip { padding: 0 0 12px; }
.ag-strip::before, .ag-strip::after { content: ''; flex: 0 0 8px; }
.lv-scale { font-weight: 700; font-size: 15px; color: #ddd; width: auto; padding: 0 8px; }
.lv-scale.on { color: var(--accent); }
.lv-pop { position: absolute; right: 8px; top: calc(var(--safe-top) + 48px); z-index: 30; background: rgba(28, 28, 28, .96); border-radius: 12px; padding: 6px; min-width: 190px; box-shadow: 0 8px 28px rgba(0,0,0,.4); display: flex; flex-direction: column; }
.lv-pop small { color: #888; font-size: 12px; padding: 6px 10px 4px; }
.lv-pop button { text-align: left; padding: 10px 12px; border-radius: 8px; color: #eee; font-size: 15px; background: none; }
.lv-pop button.on { background: #2f2f2f; color: var(--accent); }
/* Keyboard up: no home-indicator padding under the input (it sits right on the keyboard) */
body.kb { --safe-bottom: 0px; }

/* New project: folder row, agent choice, folder picker */
.np-dir { display: flex; align-items: center; gap: 6px; padding: 11px 10px 11px 12px; border-radius: 8px; background: var(--panel); cursor: pointer; }
.np-dir:active { background: var(--sel); }
.np-path { flex: 1; min-width: 0; display: flex; font-size: 15px; white-space: nowrap; }
.np-base { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--muted); }
.np-leaf { flex: 0 0 auto; max-width: 70%; overflow: hidden; text-overflow: ellipsis; }
.np-leaf.ph { color: var(--faint); }
.np-dir > svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.sheet-body .np-lbl { display: flex; align-items: center; gap: 10px; }
.np-reset { margin: 0; padding: 0; background: none; font-size: 13px; font-weight: 600; color: var(--link); }
.sheet-body .np-sub { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 14px; color: var(--text); cursor: pointer; }
.sheet-body .np-sub input { width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.np-agents { display: flex; gap: 8px; flex-wrap: wrap; }
.np-ag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px 6px 7px; border-radius: 10px; border: 1.5px solid transparent; background: var(--panel); font-size: 15px; color: var(--text); }
.np-ag .ci { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--bg); }
.np-ag .ci svg { width: 15px; height: 15px; }
.np-ag.on { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.np-ag.on .ci, .np-ag.on .ci.ag-codex, .np-ag.on .ci.ag-claude { background: var(--accent); color: #fff; }
.np-list { max-height: 40vh; overflow-y: auto; }
/* Folder picker: as tall as the sheet it came from; the path and 上一级 stay, folders scroll */
.sheet-body.fixed { overflow: hidden; padding-bottom: 0; }
.np-pick-wrap { display: flex; flex-direction: column; }
.np-pick-wrap h3 { flex: none; }
.np-head { flex: none; }
.np-pick-wrap .np-list { flex: 1; min-height: 0; max-height: none; }
.np-pick-wrap .np-list .cell, .np-up { min-height: 46px; padding: 8px 16px; gap: 10px; font-size: 15px; }
.np-pick-wrap .ci { width: 30px; height: 30px; }
.np-pick-wrap .ci svg { width: 18px; height: 18px; }
.np-up { background: var(--panel); border-bottom: .5px solid var(--line); }
.np-acts { flex: none; display: flex; gap: 8px; margin: 0 !important; padding: 10px 16px calc(16px + var(--safe-bottom)) !important; background: var(--page); box-shadow: 0 -.5px 0 var(--line); }
.np-acts .btn { flex: 1; padding: 11px; min-width: 0; }
.np-list .cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.np-crumbs { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; padding: 2px 12px 8px; scrollbar-width: none; }
.np-crumbs::-webkit-scrollbar { display: none; }
.np-crumbs button { background: none; color: var(--link); font-size: 13px; padding: 2px 3px; }
.np-crumbs i { color: var(--faint); font-style: normal; }
.sheet-body .acts.sticky { position: sticky; bottom: calc(-16px - var(--safe-bottom)); background: var(--page); padding: 10px 16px calc(16px + var(--safe-bottom)); margin: 8px 0 calc(-16px - var(--safe-bottom)); display: flex; gap: 8px; box-shadow: 0 -.5px 0 var(--line); }

/* Input with the @session chip in front (one block; Backspace at the start removes it) */
.composer .tbox { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 0; background: var(--panel); border-radius: 6px; }
.composer .tbox textarea { background: transparent; min-width: 40px; }
.tchip { flex: none; display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 6px 6px; max-width: 55%; height: 26px; padding: 0 4px 0 8px; border-radius: 13px; background: color-mix(in srgb, var(--accent) 14%, var(--page)); color: var(--accent); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; }
.tchip > span { display: inline-flex; }
.tchip > span svg { width: 14px; height: 14px; }
.tchip i { font-style: normal; color: var(--muted); padding: 0 5px; font-size: 15px; cursor: pointer; }

/* Deliverables card: what a turn delivered; tap a row to read it */
.files { background: var(--page); border-radius: 8px; padding: 8px 4px 4px; min-width: 240px; max-width: 100%; border: .5px solid var(--line); }
.files .fh { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 0 8px 6px; }
.files .fh svg { width: 14px; height: 14px; }
.frow { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.frow:active { background: var(--sel); }
.frow.extra { display: none; }
.files.all .frow.extra { display: flex; }
.frow .fm { flex: 1; min-width: 0; }
.frow .fm b { display: block; font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .fm small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow > svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.fthumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; flex: none; background: var(--panel); }
.ficon { width: 38px; height: 38px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--panel); color: var(--muted); }
.ficon svg { width: 22px; height: 22px; }
.ficon.k-web { color: #3b82f6; } .ficon.k-video { color: #ef4444; } .ficon.k-audio { color: #a855f7; } .ficon.k-pdf { color: #dc2626; }
.ficon.k-markdown, .ficon.k-text { color: #0ea5e9; } .ficon.k-code { color: #64748b; } .ficon.k-office { color: #2563eb; } .ficon.k-archive { color: #b45309; }
.ficon.big { width: 64px; height: 64px; border-radius: 14px; } .ficon.big svg { width: 34px; height: 34px; }
.ftag { flex: none; font-size: 11px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 6px; border-radius: 8px; }
.fmore { width: 100%; padding: 7px; font-size: 13px; color: var(--link); background: none; }
.fmore .m2, .files.all .fmore .m1 { display: none; } .files.all .fmore .m2 { display: inline; }
a.flink, code.flink { color: var(--link); cursor: pointer; text-decoration: none; }
a.flink { border-bottom: 1px solid color-mix(in srgb, var(--link) 35%, transparent); }
b.flink { color: var(--link); cursor: pointer; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
a.flink.dchip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: .5px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--link) 8%, transparent); font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vinfo { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
.vinfo small { color: var(--muted); word-break: break-all; } .vinfo p { color: var(--muted); font-size: 14px; margin: 8px 0 12px; }

/* Session view: older Q&As folded to one line + a preview of the answer */
.turn.folded { padding: 10px 14px; border-bottom: .5px solid var(--line); cursor: pointer; }
.turn.folded .fq { display: flex; align-items: center; gap: 6px; font-size: 14.5px; color: var(--text); }
.turn.folded .fq .fc { width: 12px; height: 12px; color: var(--faint); flex: none; }
.turn.folded .fqt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.turn.folded time { flex: none; font-size: 11.5px; color: var(--faint); }
.turn.folded .fa { margin: 4px 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sess-files { margin: 8px 0 0; padding: 0; }
.sess-files .col { max-width: 100%; }

/* Message list: the search bar hides above the list; pull down to reveal it */
.lscroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--panel); overscroll-behavior-y: contain; }
.linner { min-height: calc(100% + 52px); background: var(--panel); }
.lscroll .plist { overflow: visible; flex: none; }
.lsearch { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--page); height: 52px; box-sizing: border-box; }
.lsearch label { flex: 1; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 8px; background: var(--bg); color: var(--faint); }
.lsearch label svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.lsearch input { flex: 1; border: 0; background: none; font-size: 16px; outline: none; color: var(--text); min-width: 0; -webkit-appearance: none; }
.lsearch input::-webkit-search-cancel-button { -webkit-appearance: none; }
.lsearch button { flex: none; background: none; color: var(--link); font-size: 15px; padding: 0 4px; }
.lresults { background: var(--page); padding-bottom: 20px; }
.lresults h5 { margin: 0; padding: 12px 16px 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.lhit { display: flex; gap: 12px; padding: 9px 16px; align-items: center; cursor: pointer; }
.lhit .plast em { color: var(--accent); font-style: normal; }

/* Top right: the computers (Mac / Windows), bright when online; ring + dot on the current one */
#conn { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; padding: 0 4px; }
#conn .dev { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--faint); opacity: .55; }
#conn .dev.on { color: var(--text); opacity: 1; }
#conn .dev.cur { background: var(--bg); }
#conn .dev svg { width: 20px; height: 20px; }
#conn .dev i { position: absolute; right: 1px; bottom: 0; font-style: normal; font-size: 9.5px; font-weight: 700; color: var(--muted); }
#conn .dev .cm { position: absolute; right: 2px; top: 3px; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--page); background: var(--faint); }
#conn .dev .cm.p2p, #conn .dev .cm.relay { background: #22c55e; } #conn .dev .cm.off { background: #f59e0b; }
.dev-ci { color: var(--faint); } .dev-ci.on { color: var(--text); }

/* Desk page: what it's for, the whole desktop, then windows by app */
.desk-intro { padding: 14px 16px 4px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.desk-warn { display: flex; align-items: center; gap: 10px; margin: 10px 12px 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #f59e0b 14%, var(--page)); }
.desk-warn > svg { width: 20px; height: 20px; color: #d97706; flex: none; }
.desk-warn div { flex: 1; } .desk-warn b { display: block; font-size: 14.5px; } .desk-warn small { color: var(--muted); font-size: 12.5px; }
.desk-hero { display: flex; align-items: center; gap: 12px; margin: 12px 12px 4px; padding: 16px; border-radius: 14px; background: var(--page); cursor: pointer; box-shadow: 0 1px 0 var(--line); }
.desk-hero:active { background: var(--sel); }
.desk-hero .dh-ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); flex: none; }
.desk-hero .dh-ic svg { width: 28px; height: 28px; }
.desk-hero .dh-m { flex: 1; min-width: 0; } .desk-hero b { display: block; font-size: 17px; } .desk-hero small { color: var(--muted); font-size: 12.5px; }
.desk-hero.off .dh-ic { background: var(--panel); color: var(--faint); }
.desk-more { display: flex; gap: 8px; padding: 6px 12px; overflow-x: auto; }
.desk-more .btn { display: inline-flex; gap: 6px; align-items: center; } .desk-more svg { width: 16px; height: 16px; }
.cell.app .appic { width: 34px; height: 34px; border-radius: 8px; flex: none; object-fit: contain; }
.appic.ph { display: grid; place-items: center; background: var(--panel); color: var(--muted); font-weight: 600; font-size: 15px; }

/* 我 page, WeChat style */
.me-head { display: flex; align-items: center; gap: 14px; padding: 28px 16px 24px; background: var(--page); cursor: pointer; }
.me-av { width: 60px; height: 60px; border-radius: 10px; display: grid; place-items: center; font-size: 26px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #22c55e, #16a34a); flex: none; }
.me-id { flex: 1; min-width: 0; } .me-id b { display: block; font-size: 20px; font-weight: 600; } .me-id small { color: var(--muted); font-size: 13px; }
.me-g { margin-top: 10px; }
.me-row .mi svg { width: 22px; height: 22px; }
.me-row .cv .bad, .cv .bad { color: var(--danger); }
/* 用量 */
.ucard { background: var(--page); padding: 12px 16px; }
.uquota { margin-bottom: 12px; } .uquota small { color: var(--muted); font-size: 12px; }
.ul { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; margin-bottom: 6px; } .ul span { color: var(--muted); font-size: 13px; }
.ubar { display: block; height: 8px; border-radius: 4px; background: var(--panel); overflow: hidden; margin-bottom: 4px; } .ubar i { display: block; height: 100%; border-radius: 4px; }
.ugrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; } .ugrid small { display: block; color: var(--muted); font-size: 11.5px; } .ugrid b { font-size: 16px; font-weight: 600; }
.udays { display: flex; align-items: flex-end; gap: 6px; height: 64px; margin-top: 12px; }
.udays span { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.udays i { width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 70%, transparent); }
.udays em { font-style: normal; font-size: 10px; color: var(--faint); }

/* Input: the @session chip sits at the start of the first line; the text runs after it and
   wraps to the left edge (text-indent = chip width) */
.composer .tbox { position: relative; display: block; }
.composer .tbox textarea { width: 100%; display: block; }
.tchip { position: absolute; left: 6px; top: 6px; margin: 0; z-index: 1; max-width: 62%; height: 26px; padding: 0 2px 0 8px; gap: 3px; }
.tchip b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tchip i { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; flex: none; }
.tchip i svg { width: 12px; height: 12px; stroke-width: 2.2; }
/* Attachments waiting to be sent, above the input */
.atts { display: flex; gap: 8px; padding: 4px 2px 8px; overflow-x: auto; }
.att { position: relative; flex: none; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--panel); }
.att img { width: 100%; height: 100%; object-fit: cover; }
.att.up img { opacity: .5; }
.att.err { outline: 2px solid #ef4444; }
.att .af { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 2px; padding: 4px; color: var(--muted); }
.att .af svg { width: 22px; height: 22px; }
.att .af small { font-size: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .spin { position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -9px; }
.att i { position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.att i svg { width: 11px; height: 11px; stroke-width: 2.4; }
/* Attachments in a sent message: pictures in a fixed-size horizontal strip above the query */
.uimgs { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; max-width: 100%; width: fit-content; margin: 0 0 6px auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.uimgs::-webkit-scrollbar { display: none; }
.uatts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.uimg { width: 88px; height: 88px; flex: none; border-radius: 8px; object-fit: cover; background: var(--panel); cursor: pointer; display: block; }
.ufile { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; background: var(--page); font-size: 14px; max-width: 220px; cursor: pointer; }
.ufile svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.ufile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .spin { width: 18px; height: 18px; }
.uimg.broken { width: 88px; height: 88px; border: 1px dashed var(--line); }

/* Files: the conversation's folder as a tree + a preview in the chat's own look */
.fb { background: var(--page); color: var(--text); }
.fb .bar { gap: 2px; }
.fb .icon-btn { color: var(--text); }
.fb-crumbs { flex: 0 1 66%; max-width: 66%; min-width: 0; display: flex; align-items: center; white-space: nowrap; font-size: 15.5px; padding: 0 2px; overflow: hidden; }
.fb-cscroll { flex: 1; min-width: 0; display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px); mask-image: linear-gradient(to right, transparent 0, #000 12px); }
.fb-cscroll::-webkit-scrollbar { display: none; }
.fb .fb-tbtn { margin-left: auto; }
.fb-crumbs .crumb { flex: none; padding: 5px 6px; border-radius: 8px; color: var(--muted); font: inherit; background: none; }
.fb-crumbs .crumb.last { color: var(--text); font-weight: 600; }
.fb-crumbs .crumb[data-crumb]:active { background: var(--sel); }
@media (hover: hover) { .fb-crumbs .crumb[data-crumb]:hover { background: var(--hover); } }
.fb-crumbs::-webkit-scrollbar { display: none; }
.fb-crumbs i { display: inline-grid; place-items: center; color: var(--faint); flex: none; }
.fb-crumbs i svg { width: 14px; height: 14px; }
.fb-tbtn { transition: background .15s, color .15s; }
.fb-tbtn.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent) !important; }
.fb-main { flex: 1; min-height: 0; display: flex; position: relative; }
.fb-view { flex: 1; min-width: 0; overflow: auto; -webkit-overflow-scrolling: touch; background: var(--panel); padding-bottom: var(--safe-bottom); }
.fb-view.full { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
.fb-frame { flex: 1; width: 100%; border: 0; background: #fff; display: block; }
.fb-hint { height: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--faint); text-align: center; font-size: 14px; }
.fb-hint svg { width: 44px; height: 44px; }
.fb-hint p { margin: 0; line-height: 1.6; color: var(--muted); }
.fb-hint .spin { width: 22px; height: 22px; }
/* The tree slides in from the right over part of the preview; a tap on the preview (or the
   button) puts it away. */
.fb-tree { display: flex; flex-direction: column; position: absolute; top: 0; bottom: 0; right: 0; width: 66%; z-index: 4; background: var(--page); box-shadow: -8px 0 28px rgba(0,0,0,.14); transform: translateX(105%); visibility: hidden; transition: transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s linear .26s; }
.fb.tree-on .fb-tree { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.fb-scrim { position: absolute; inset: 0; z-index: 3; background: rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: opacity .26s; }
.fb.tree-on .fb-scrim { opacity: 1; pointer-events: auto; }
/* Left edge: catches the swipe back even over a web page preview (an iframe keeps touches). */
.fb-edge { position: absolute; left: 0; top: 0; bottom: 0; width: 18px; z-index: 2; display: none; }
@media (hover: none) { .fb-edge { display: block; } }
/* The tree as a dropdown under the path */
.fb-drop { position: absolute; z-index: 6; max-height: min(62vh, 520px); overflow: auto; -webkit-overflow-scrolling: touch; background: var(--page); border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.18), 0 0 0 .5px var(--line); padding: 6px; animation: pop-in .14s ease-out; }
.fb-drop .fb-list { padding: 0; overflow: visible; }

.fb-filter { display: flex; align-items: center; gap: 6px; margin: 10px 12px 6px; padding: 0 12px; height: 38px; border-radius: 19px; background: var(--panel); border: .5px solid var(--line); flex: none; }
.fb-filter svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.fb-filter input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 15.5px; color: var(--text); outline: none; -webkit-appearance: none; }
.fb-list { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 2px 8px calc(var(--safe-bottom) + 20px); }
.fb-row { display: flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 8px 0 calc(4px + var(--d, 0) * 18px); border-radius: 9px; font-size: 15.5px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.fb-row:active, .fb-row.sel { background: var(--sel); }
@media (hover: hover) { .fb-row:hover { background: var(--hover); } .fb-row.sel:hover { background: var(--sel); } }
.fb-row.muted { color: var(--muted); font-size: 13.5px; cursor: default; background: none !important; }
.fb-row .tw { width: 16px; flex: none; display: grid; place-items: center; color: var(--muted); transition: transform .15s; }
.fb-row .tw svg { width: 13px; height: 13px; }
.fb-row .tw.open { transform: rotate(90deg); }
.fb-row.found .tw svg { width: 16px; height: 16px; }
.fb-row .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-row .fn small { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.fb-row .ficon { width: 22px; height: 22px; background: none; border-radius: 0; }
.fb-row .ficon svg { width: 18px; height: 18px; }
.fbadge { width: 22px; flex: none; font: 700 11.5px/1 ui-monospace, Menlo, monospace; text-align: center; color: var(--muted); letter-spacing: -.5px; }
.fbadge.x-md, .fbadge.x-markdown, .fbadge.x-csv { color: #1a9f4b; } .fbadge.x-html, .fbadge.x-htm { color: #e8742f; font-size: 14px; }
.fbadge.x-css { color: #7a5af5; } .fbadge.x-js, .fbadge.x-mjs, .fbadge.x-jsx { color: #c9a100; } .fbadge.x-ts, .fbadge.x-tsx { color: #2f74c0; }
.fbadge.x-py { color: #3572a5; } .fbadge.x-swift { color: #f05138; } .fbadge.x-go { color: #00add8; } .fbadge.x-rs { color: #b7410e; }
.fb-errs { position: absolute; left: 10px; right: 10px; bottom: calc(var(--safe-bottom) + 10px); display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); box-shadow: 0 4px 18px rgba(0,0,0,.15); font-size: 13px; z-index: 3; }
.fb-errs span { flex: 1; min-width: 0; color: var(--danger); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* previews */
.vimg { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; background: var(--panel); cursor: zoom-in; }
.vimg img { max-width: 100%; max-height: calc(100dvh - 56px - var(--safe-top) - var(--safe-bottom)); object-fit: contain; }
.vimg.zoom { display: block; cursor: zoom-out; } .vimg.zoom img { max-width: none; max-height: none; }
.vvid { flex: 1; min-height: 0; display: grid; place-items: center; background: var(--panel); }
.vvid video { max-width: 100%; max-height: 100%; border-radius: 6px; background: #000; }
.vaudio { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 20px; }
.vaudio audio { width: 100%; max-width: 480px; }
.vfont { padding: 24px 20px; } .vfont .big { font-size: 72px; line-height: 1.2; } .vfont p { font-size: 22px; margin: 14px 0; word-break: break-word; }
.varc { padding: 8px 0 30px; font-size: 14px; }
.varc .vah { display: flex; align-items: center; gap: 8px; padding: 10px 16px 12px; border-bottom: .5px solid var(--line); }
.varc .vah svg { width: 22px; height: 22px; color: var(--muted); } .varc .vah b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .varc .vah small { color: var(--muted); }
.varc .var { padding: 7px 16px; border-bottom: .5px solid var(--line); font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.varc .var.dir { color: var(--muted); }
.vmd { padding: 18px 20px 48px; font-size: 16px; line-height: 1.7; max-width: 780px; margin: 0 auto; word-wrap: break-word; }
.vmd h1, .vmd h2, .vmd h3, .vmd h4, .vmd h5, .vmd h6 { line-height: 1.35; margin: 1.3em 0 .55em; font-weight: 650; }
.vmd > :first-child { margin-top: 0; }
.vmd h1 { font-size: 26px; } .vmd h2 { font-size: 21px; padding-bottom: .25em; border-bottom: .5px solid var(--line); } .vmd h3 { font-size: 18px; } .vmd h4, .vmd h5, .vmd h6 { font-size: 16px; }
.vmd p { margin: .7em 0; white-space: pre-line; }
.vmd ul, .vmd ol { padding-left: 1.5em; margin: .5em 0; } .vmd li { margin: .2em 0; } .vmd li > ul, .vmd li > ol { margin: .15em 0; }
.vmd li.task { list-style: none; margin-left: -1.3em; } .vmd li.task input { margin: 0 .45em 0 0; vertical-align: -1px; }
.vmd blockquote { margin: .8em 0; padding: .1em 1em; border-left: 3px solid var(--line); color: var(--muted); }
.vmd hr { border: 0; border-top: .5px solid var(--line); margin: 1.4em 0; }
.vmd img { max-width: 100%; border-radius: 6px; }
.vmd code { font: 13.5px ui-monospace, Menlo, monospace; background: var(--code); padding: .1em .35em; border-radius: 4px; }
.vmd pre { background: var(--code); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font: 13px/1.55 ui-monospace, Menlo, monospace; }
.vmd pre code { background: none; padding: 0; font-size: inherit; }
.vmd a { color: var(--link); }
.vmd .tbl.fm { font-size: 13px; }
.vtext { margin: 0; padding: 12px 12px 48px 0; font: 12.5px/1.6 ui-monospace, Menlo, monospace; white-space: normal; tab-size: 2; }
.vtext .code-row { display: grid; grid-template-columns: 4.4em minmax(0, 1fr); }
.vtext .ln { display: block; padding-right: 1em; text-align: right; color: var(--faint); user-select: none; -webkit-user-select: none; }
.vtext .code-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hc { color: #8b949e; font-style: italic; } .hs { color: #0a7d32; } .hn { color: #b35900; } .hk { color: #a626a4; }
@media (prefers-color-scheme: dark) { .hc { color: #7d8590; } .hs { color: #7ee787; } .hn { color: #ffa657; } .hk { color: #ff7b72; } }
.vtbl { overflow: auto; height: 100%; } .vtbl table { border-collapse: collapse; font-size: 13px; }
.vtbl th, .vtbl td { border: .5px solid var(--line); padding: 5px 9px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.vtbl th { background: var(--page); position: sticky; top: 0; font-weight: 600; }
.vtbl .rn { color: var(--faint); background: var(--page); text-align: right; font-size: 11.5px; position: sticky; left: 0; }
.vpdf { padding: 12px 10px calc(var(--safe-bottom) + 24px); background: var(--bg); min-height: 100%; }
.vpdf .pg { max-width: 900px; margin: 0 auto 12px; }
.vpdf .pg img { display: block; width: 100%; min-height: 200px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); border-radius: 2px; }
.vpdf .pg small { display: block; text-align: center; color: var(--faint); font-size: 11px; margin-top: 4px; }

/* Session sheet: one group per computer */
.sess-mh { display: flex; align-items: center; gap: 7px; padding: 10px 16px 6px; font-size: 13px; font-weight: 600; color: var(--text); background: var(--bg); position: sticky; top: 0; z-index: 1; }
.sess-mh small { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12px; }
.sess-mh .dev-ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--muted); background: var(--panel); position: relative; }
.sess-mh .dev-ic svg { width: 15px; height: 15px; }
.sess-mh .dev-ic.on::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px var(--bg); }
/* @chip: text only (a new session shows the agent's mark in place of its name); × close to it */
.tchip { padding: 0 0 0 8px; gap: 0; }
.tchip b { display: inline-flex; align-items: center; gap: 1px; }
.tchip b > span { display: inline-flex; margin: 0 2px 0 1px; }
.tchip b > span svg { width: 14px; height: 14px; }
.tchip i { width: 20px; margin-left: -1px; }
/* Session sheet: one "新会话" row, rows that slide left for their actions, archived at the end */
.new-g { margin-top: 4px; }
.new-row { display: flex; gap: 8px; padding: 8px 16px; background: var(--panel); }
.new-row .btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 9px; background: var(--bg); font-size: 15px; }
.new-row .btn svg { width: 18px; height: 18px; }
.new-row .btn.on { outline: 2px solid var(--accent); }
.sw { position: relative; overflow: hidden; }
.sw-acts { position: absolute; top: 0; right: 0; bottom: 0; display: flex; }
.sw-acts button { width: 76px; padding: 0 6px; color: #fff; font-size: 14px; line-height: 1.25; background: #576b95; }
.sw-acts button[data-a="rename"] { background: #f0a020; }
.sw-acts .warn { background: #fa5151; } .sw-acts .ok { background: var(--accent); }
.sw-row { z-index: 1; background: var(--panel); transition: transform .22s cubic-bezier(.2,.8,.2,1); touch-action: pan-y; will-change: transform; user-select: none; -webkit-user-select: none; }
.sw-row.cell:active { background: var(--panel); }
.sess-arch { display: flex; align-items: center; gap: 7px; width: 100%; padding: 12px 16px; font-size: 13.5px; color: var(--muted); background: var(--bg); text-align: left; }
.sess-arch svg { width: 15px; height: 15px; }
.sess-arch span { margin-left: auto; display: grid; transition: transform .15s; } .sess-arch.open span { transform: rotate(180deg); }
.seg.sm { flex: none; padding: 0; margin: 0; gap: 0; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 .5px var(--line); }
.seg.sm .btn { flex: none; padding: 6px 12px; font-size: 13.5px; border-radius: 0; background: var(--bg); }
.seg.sm .btn.on { background: var(--accent); color: #fff; }
.tagq.wait { color: var(--warn); }
#np-here { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Trees: long names and deep folders scroll sideways instead of being cut off */
.fb-list .fb-row { width: max-content; min-width: 100%; box-sizing: border-box; }
.fb-list .fb-row .fn { flex: none; overflow: visible; text-overflow: clip; }

/* Session sheet: a fixed height; title and 新会话 stay, the sessions scroll inside their card.
   Sections are inset white cards on the sheet's grey, so nothing runs into the title. */
.sheet-body.ss { height: min(80vh, 680px); display: flex; flex-direction: column; overflow: hidden; padding-bottom: calc(12px + var(--safe-bottom)); }
.ss > h3 { flex: none; }
.ss .group { margin: 0; }
.ss .group h5 { margin: 0 28px 6px; }
.ss .new-g { flex: none; }
.ss .new-row { margin: 0 12px; padding: 10px; border-radius: 12px; background: var(--panel); }
.ss .all-g { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; margin-top: 4px; }
.ss .sess-wrap { flex: 0 1 auto; min-height: 0; margin: 0 12px; border-radius: 12px; overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.ss .sess-list { flex: 0 1 auto; min-height: 0; max-height: none; overflow-y: auto; background: var(--panel); }
.ss .sess-wrap.fade::after { background: linear-gradient(to bottom, transparent, var(--panel)); }
.ss .sess-mh { background: var(--panel); color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 10px 16px 8px; border-bottom: .5px solid var(--line); }
.ss .sess-mh .dev-ic { background: var(--bg); }
.ss .sw + .sw .sw-row::before, .ss .sw + .sw .sw-row.cell::before { content: ''; position: absolute; left: 58px; right: 0; top: 0; border-top: .5px solid var(--line); }
.ss .sess-arch { background: var(--panel); border-top: .5px solid var(--line); }
.ss > .note { flex: none; margin: 10px 28px 0; }
.sw-acts { visibility: hidden; }
.sw.open .sw-acts, .sw.swiping .sw-acts { visibility: visible; }

/* Search like WeChat: icon and 搜索 centered until you type */
.lsearch label:has(input:placeholder-shown):not(:focus-within) { justify-content: center; }
.lsearch label:has(input:placeholder-shown):not(:focus-within) input { flex: 0 0 auto; width: 2.3em; padding: 0; overflow: visible; }

/* Desk page: the whole desktop as a row like the apps */
.cell.app .appic.dsk { display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.cell.app .appic.dsk svg { width: 21px; height: 21px; }
.cell.app .appic.dsk.off { background: var(--bg); color: var(--faint); }
/* Live view in the app's light look */
#live { background: var(--page); }
#live .ov-bar { background: var(--page); color: var(--text); border-bottom: .5px solid var(--line); min-height: 48px; padding: calc(var(--safe-top) + 2px) 8px 2px; gap: 2px; }
#live .ov-bar .icon-btn { color: var(--text); }
#live .ov-bar .icon-btn.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
#live .ov-title { font-size: 16px; font-weight: 600; }
#live .lv-stage { background: var(--bg); }
#live .lv-video { background: transparent; }
#live .lv-keys { background: var(--page); border-top: .5px solid var(--line); position: absolute; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 8; }
#live .lv-keys button { background: var(--panel); color: var(--text); box-shadow: 0 .5px 0 var(--line); }
#live .lv-keys button small { color: var(--muted); }
#live .lv-keys button.mod { background: var(--bg); }
#live .lv-keys button.on { background: var(--accent); color: #fff; } #live .lv-keys button.on small { color: #fff; }
#live .lv-keys .lv-app { color: var(--muted); }
/* Numbers, top left of the picture */
.lv-stats { position: absolute; left: 8px; top: 8px; z-index: 4; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; pointer-events: none; }
.lv-stats b { font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; color: #fff; background: rgba(0, 0, 0, .45); padding: 2px 6px; border-radius: 6px; }
/* Mini map, top right */
.lv-mini { position: absolute; right: 8px; top: 8px; z-index: 4; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .3); box-shadow: 0 2px 14px rgba(0, 0, 0, .22), 0 0 0 1px rgba(255, 255, 255, .7); opacity: .86; touch-action: none; cursor: pointer; }
.lv-mini canvas { display: block; width: 100%; height: 100%; opacity: .92; }
.lv-mini-regs i { position: absolute; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border-radius: 3px; pointer-events: none; }
.lv-mini-regs span { position: absolute; left: 2px; top: 2px; font-family: inherit; font-size: 9.5px; font-weight: 600; line-height: 1.3; color: #fff; background: var(--c); padding: 0 4px; border-radius: 3px; white-space: nowrap; }
.lv-mini-view { position: absolute; border: 2px solid var(--accent); background: rgba(7, 193, 96, .14); border-radius: 3px; pointer-events: none; box-sizing: border-box; }
.lv-mini-view.all { border-color: rgba(7, 193, 96, .55); background: transparent; }
/* Holding the picture until the Mac's resolution is set */
#live.holding .lv-stage canvas, #live.holding .lv-video, #live.holding .lv-mini, #live.holding .lv-cursor { visibility: hidden; }
#live.holding .lv-stage::before { content: ''; position: absolute; left: 50%; top: 45%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px solid var(--faint); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.cell.awake-seg { padding-top: 4px; } .cell.awake-seg .seg.sm { flex: 1; } .cell.awake-seg .seg.sm .btn { flex: 1; }
.ucard .uat { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.uquota em.bad { color: var(--danger); font-style: normal; font-weight: 600; }
.lv-mini-regs i.sel { border-width: 2.5px; background: color-mix(in srgb, var(--c) 30%, transparent); }

/* Shortcut bar: always docked under the picture (the stage ends above it, so it never covers
   the app); with the keyboard up it rides on the keyboard. Short keys. */
#live { --keys-h: 40px; }
#live .lv-stage { margin-bottom: calc(var(--keys-h) + var(--safe-bottom)); }
#live .lv-keys { height: calc(var(--keys-h) + var(--safe-bottom)); padding: 3px 6px calc(3px + var(--safe-bottom)); box-sizing: border-box; align-items: center; scrollbar-width: none; touch-action: pan-x; }
#live .lv-keys::-webkit-scrollbar { display: none; }
#live.kb-up .lv-keys { height: var(--keys-h); padding-bottom: 3px; }
#live .lv-keys button { height: 34px; min-width: 50px; padding: 0 7px; line-height: 1.05; }
#live .lv-keys button b { font-size: 13px; }
#live .lv-keys button small { font-size: 9px; }
#live .lv-keys button svg { width: 17px; height: 17px; stroke-width: 1.9; }
#live .lv-keys button.press { filter: brightness(.85); }
#live .lv-keys button.voice { color: var(--accent); }
#live .lv-keys button.voice.on { background: var(--accent); color: #fff; }
/* Voice input card */
.vc-overlay { position: fixed; left: 0; right: 0; top: 28%; z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.vc-overlay.hidden { display: none; }
.vc-card { pointer-events: auto; width: min(300px, calc(100vw - 48px)); background: rgba(28,28,30,.94); color: #fff; border-radius: 18px; padding: 18px 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.35); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.vc-wave { position: relative; width: 56px; height: 56px; display: grid; place-items: center; }
.vc-wave i { position: absolute; inset: 0; border-radius: 50%; background: var(--accent); opacity: .35; transition: transform .08s linear; }
.vc-wave svg { position: relative; width: 26px; height: 26px; stroke: #fff; fill: none; stroke-width: 1.9; }
.vc-overlay.cancel .vc-wave i { background: #ef4444; }
.vc-text { font-size: 16px; line-height: 1.45; text-align: center; max-height: 30vh; overflow: auto; word-break: break-word; }
.vc-text.ph { color: rgba(255,255,255,.55); }
.vc-hint { font-size: 12px; color: rgba(255,255,255,.6); }
.vc-overlay.cancel .vc-hint { color: #fca5a5; }
.vc-btns { display: flex; gap: 10px; width: 100%; }
.vc-overlay.hold .vc-btns { display: none; }
.vc-btns button { flex: 1; height: 38px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 15px; }
.vc-btns button.pri { background: var(--accent); }
.composer textarea { -webkit-touch-callout: none; }

/* Pictures in answers (Codex's generated images, ![](path)) */
.mdimg { display: block; max-width: 100%; max-height: 280px; border-radius: 10px; margin: 6px 0; cursor: pointer; background: var(--panel); object-fit: cover; }
.mdimgs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; max-width: 100%; margin: 6px 0; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mdimgs::-webkit-scrollbar { display: none; }
.mdimgs .mdimg { width: 176px; height: 176px; max-height: none; flex: none; margin: 0; object-fit: cover; scroll-snap-align: start; border-radius: 10px; }
.mdimg.broken { width: 160px; height: 110px; border: 1px dashed var(--line); }
.uq .uimgs { margin: 0 0 6px auto; }
.uq .uatts { margin: 2px 0 4px; }
.vtext .ln.hl { color: var(--accent); font-weight: 700; background: rgba(7,193,96,.16); border-radius: 3px; }
#live .lv-keys button.voice { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.appwrap { position: relative; flex: none; display: inline-flex; }
.live-badge { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: #ef4444; border: 2px solid var(--panel, #fff); }
.composer .tbox { position: relative; flex: 1; min-width: 0; }
.composer .tbox .tph { position: absolute; left: 10px; right: 10px; top: 8px; line-height: 22px; font-size: 16px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
/* In-app notice: a white bar that slides down from the top */
.toast { background: #fff; color: #111; border: .5px solid rgba(0,0,0,.06); box-shadow: 0 8px 28px rgba(0,0,0,.16); border-radius: 14px; padding: 11px 14px; transform: translate(-50%, calc(-100% - var(--safe-top) - 24px)); transition: transform .26s cubic-bezier(.2,.9,.3,1.1), opacity .2s; opacity: 0; }
.toast.in { transform: translate(-50%, var(--toast-drag, 0px)); opacity: 1; }
.toast { touch-action: none; user-select: none; -webkit-user-select: none; }
.toast.dragging { transition: none; }
.toast b { color: #111; }
.toast span { display: block; color: #555; font-size: 13px; line-height: 1.4; }
@media (prefers-color-scheme: dark) { .toast { background: #2c2c2e; color: #f2f2f2; border-color: rgba(255,255,255,.08); } .toast b { color: #fff; } .toast span { color: #bbb; } }
/* 我: grouped rows */
.me-grp { margin-top: 14px; }
.me-grp h5 { margin: 0 0 6px 16px; }
.me-grp .cells.me-g { margin-top: 0; }
/* Desk: the window being watched */
.live-dot-r { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; margin: 0 6px 0 8px; box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
/* Shortcut bar: five keys fill the first screen (voice in the middle) */
#live .lv-keys button { width: max(50px, min(calc((100vw - 28px) / 5), 96px)); min-width: 0; flex: none; }
/* Voice, WeChat-style: a button right of the input (like +) swaps it for 按住 说话 */
.composer .vtog { width: 36px; height: 38px; color: var(--text); flex: none; }
.composer .vtog svg { width: 28px; height: 28px; stroke-width: 1.4; fill: none; stroke: currentColor; }
.composer .holdtalk { display: none; flex: 1; min-width: 0; height: 38px; border-radius: 6px; background: var(--panel); color: var(--text); font-size: 15px; font-weight: 500; align-items: center; justify-content: center; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.composer .holdtalk.on { background: color-mix(in srgb, var(--text) 14%, var(--panel)); }
.composer.talk .holdtalk { display: flex; }
.composer.talk .tbox, .composer.talk .send { display: none !important; }
/* WeChat layout: voice left, input, + right (发送 takes its place while there's text) */
.composer.talk .plus { display: grid !important; }
/* Picture viewer (WeChat-like, swipe left/right across multiple pictures) */
.imgview { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0); transition: background .22s; overflow: hidden; touch-action: none; }
.imgview.in { background: #000; }
.imgview .iv-track { display: flex; height: 100%; will-change: transform; }
.imgview .iv-pan { flex: 0 0 100vw; width: 100vw; height: 100%; display: grid; place-items: center; overflow: hidden; }
.imgview img { max-width: none; object-fit: contain; transition: transform .24s cubic-bezier(.2,.8,.2,1); will-change: transform; border-radius: 0; }
.imgview .iv-idx { position: absolute; left: 50%; top: calc(var(--safe-top) + 14px); transform: translateX(-50%); padding: 4px 12px; border-radius: 12px; background: rgba(0,0,0,.5); color: #fff; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.imgview.in .iv-idx { opacity: 1; }
.imgview .iv-save { position: absolute; right: 16px; bottom: calc(var(--safe-bottom) + 18px); width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
.imgview.in .iv-save { opacity: 1; }
.imgview .iv-save svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
/* 我: two or three choices right in the row, the chosen one green */
.me-row:not(.seg-row) .cm { flex: 0 0 auto; }
.me-row:not(.seg-row) .cv { flex: 1; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-row.seg-row { cursor: default; }
.me-row .seg { display: flex; flex: none; background: var(--bg); border-radius: 8px; padding: 2px; gap: 2px; }
.me-row .seg button { min-width: 44px; height: 28px; padding: 0 10px; border-radius: 6px; font-size: 13.5px; color: var(--muted); background: none; }
.me-row .seg button.on { background: var(--accent); color: #fff; font-weight: 500; }
.ag-antigravity { color: #4285f4; display: inline-flex; align-items: center; }
.sess.cur .ci.ag-antigravity { color: #fff; }
/* the app's own colored mark (an <img>): sized and centered identically to Codex / Claude SVGs */
img.i.agmark { width: 1.15em; height: 1.15em; object-fit: contain; vertical-align: middle; flex: none; display: block; }
.cell .ci img.i.agmark { width: 18px; height: 18px; }
.np-ag .ci img.i.agmark { width: 15px; height: 15px; }
.np-ag.on .ci.ag-antigravity { background: #fff; }
.sess.cur .ci.ag-antigravity { background: #fff; }
/* ---- multi-device (docs/multi-device.md) */
.devfilter { display: flex; gap: 8px; padding: 4px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.devfilter::-webkit-scrollbar { display: none; }
.devfilter button { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--panel); color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.devfilter button svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.devfilter button.on { background: var(--text); color: var(--page); }
.devfilter button.off:not(.on) { opacity: .55; }
.avatar .osb { position: absolute; right: -5px; bottom: -5px; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; background: var(--page); color: var(--text); box-shadow: 0 0 0 1px var(--line, rgba(0,0,0,.08)); }
.avatar .osb svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.avatar .osb.off { color: var(--faint); }
.desk-hosts { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.desk-hosts::-webkit-scrollbar { display: none; }
.desk-hosts .dh { display: flex; align-items: center; gap: 8px; flex: none; min-width: 132px; padding: 9px 12px; border-radius: 12px; background: var(--panel); border: 1.5px solid transparent; color: var(--muted); text-align: left; }
.desk-hosts .dh.up { color: var(--text); }
.desk-hosts .dh.on { border-color: var(--accent); }
.desk-hosts .dh svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: none; }
.desk-hosts .dh span { display: flex; flex-direction: column; min-width: 0; }
.desk-hosts .dh b { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.desk-hosts .dh small { font-size: 12px; color: var(--muted); }
.np-hosts { flex-wrap: wrap; }
.np-ag.off { opacity: .5; }
.lv-op { position: absolute; left: 50%; top: calc(var(--safe-top, 0px) + 54px); transform: translateX(-50%); z-index: 5; padding: 5px 12px; border-radius: 14px; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; pointer-events: none; transition: opacity .3s; }
.lv-op.hidden { opacity: 0; }
/* 我: the computers bar, then the picked one's settings */
.me-hosts { padding: 0 12px 10px; }
.me-grp .dv-del-g { margin-top: 10px; }
/* 我 header: the picture changes it, the name signs out */
.me-head { cursor: default; }
button.me-av { border: 0; padding: 0; overflow: hidden; cursor: pointer; }
.me-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-name { border: 0; background: none; padding: 0; font: inherit; font-size: 20px; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.me-id small { display: block; margin-top: 2px; }
/* 我 header like WeChat: picture, nickname, 账号：… */
.me-head { padding: 34px 20px 28px; gap: 16px; }
.me-head .me-av { width: 64px; height: 64px; border-radius: 10px; }
.me-name { font-size: 22px; }
.me-acct { display: block; margin-top: 6px; border: 0; background: none; padding: 0; font: inherit; font-size: 15px; color: var(--muted); cursor: pointer; text-align: left; }
/* desk tab with no computer to open: the icon in the middle, the words under it */
.desk-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; padding: 24px 32px; text-align: center; }
.desk-empty svg { width: 168px; height: 112px; fill: none; stroke: var(--muted, #888); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.desk-empty svg circle { fill: var(--muted, #888); stroke: none; }
.desk-empty svg .link { stroke-dasharray: 3 3.5; }
.desk-empty p { margin: 22px 0 0; max-width: 320px; color: var(--muted); font-size: 15px; line-height: 1.6; }
/* No double-tap zoom anywhere (taps stay fast); elements with their own touch-action keep it */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
/* 我 header: more room between the picture and the names; an edit button after the nickname */
.me-head { gap: 22px; padding: 34px 24px 30px; }
.me-head .me-av { width: 72px; height: 72px; border-radius: 12px; font-size: 30px; }
.me-nickrow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-nickrow .me-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 23px; }
.me-edit { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.me-edit:active { background: var(--sel); color: var(--text); }
.me-edit svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nick-form .acts { display: flex; gap: 12px; }
.me-acct { font-size: 15.5px; margin-top: 8px; }
/* Chat avatars: up to four characters of the name, two per line */
.avatar.letter.two { font-size: 16px; letter-spacing: -.3px; }
.avatar.letter.sm.two { font-size: 13.5px; }
.avatar.letter.four { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 15px; line-height: 1.12; letter-spacing: 0; }
.avatar.letter.sm.four { font-size: 12.5px; }
.avatar.letter.four > span:not([class]) { display: block; white-space: nowrap; }

/* ---- wide (desktop) layout: list : chat : right panel = 1 : 2 : 2 by default, each divider
   draggable (fractions kept per window size), with minimum widths. A file opens in the right
   panel (like a session), its folder tree taking half the panel when expanded. */
body.wide { --lf: .2; --rf: .4; --list-w: max(220px, calc((100vw - 64px) * var(--lf))); --right-w: max(320px, calc((100vw - 64px) * var(--rf))); }
body.wide #list { width: var(--list-w); }
body.wide #chat.on { left: calc(64px + var(--list-w)); }
body.wide.split #chat.on, body.wide.fbdock #chat.on { right: var(--right-w); border-right: .5px solid var(--line); }
body.wide #session.on { width: var(--right-w); }
body.wide .placeholder { left: calc(64px + var(--list-w)); }
body.wide.split:not(.tab-desk):not(.tab-me) #list, body.wide.fbdock:not(.tab-desk):not(.tab-me) #list { display: flex; }
body.wide.split #chat.on, body.wide.fbdock #chat.on { left: calc(64px + var(--list-w)); }
@media (max-width: 1099px) {
  body.wide.split #list, body.wide.fbdock #list { display: none !important; }
  body.wide.split #chat.on, body.wide.fbdock #chat.on { left: 64px; }
}
body.wide #fb { left: auto; right: 0; top: 0; bottom: 0; width: var(--right-w); z-index: 25; border-left: .5px solid var(--line); }
body.wide #fb .fb-tree { display: none; position: relative; flex: none; width: 50%; transform: none; visibility: visible; box-shadow: none; border-left: .5px solid var(--line); transition: none; z-index: 1; }
body.wide #fb.tree-on .fb-tree { display: flex; }
body.wide #fb .fb-scrim, body.wide #fb .fb-edge { display: none; }
body.wide #fb .fb-crumbs { flex: 1; max-width: none; }
/* the dividers */
.col-rs { display: none; position: fixed; top: 0; bottom: 0; width: 9px; margin-left: -4px; z-index: 40; cursor: col-resize; }
.col-rs::after { content: ''; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: transparent; transition: background .15s; }
.col-rs:hover::after, body.col-dragging .col-rs.on::after { background: var(--accent); }
body.wide:not(.tab-desk):not(.tab-me) #rs-list { display: block; left: calc(64px + var(--list-w)); }
body.wide.split #rs-right, body.wide.fbdock #rs-right { display: block; left: calc(100vw - var(--right-w)); }
@media (max-width: 1099px) { body.wide.split #rs-list, body.wide.fbdock #rs-list { display: none; } }
body.col-dragging, body.col-dragging * { cursor: col-resize !important; user-select: none !important; }
body.col-dragging iframe, body.col-dragging video { pointer-events: none; }
/* My messages: my own picture (我 › tap the picture to set it) */
.avatar.pic { background: none !important; overflow: hidden; }
.avatar.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- the Mac app / wide window: finer type, like WeChat for Mac (smaller sizes, medium
   instead of bold, grayscale antialiasing) */
body.wide { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.wide .bar h1 { font-size: 16px; font-weight: 500; }
body.wide .bar .title b { font-size: 15px; font-weight: 500; }
body.wide .bar .title small { font-size: 11.5px; }
body.wide .plist li { padding: 10px 14px; gap: 11px; }
body.wide .plist .avatar { width: 40px; height: 40px; border-radius: 6px; font-size: 20px; }
body.wide .pname span { font-size: 14.5px; }
body.wide .pname time { font-size: 11px; }
body.wide .plast { font-size: 12.5px; margin-top: 3px; }
body.wide .avatar.letter { font-weight: 500; }
body.wide .avatar.letter.four { font-size: 12.5px; line-height: 1.15; }
body.wide .avatar.letter.two { font-size: 13.5px; }
body.wide .avatar.letter.sm.four { font-size: 11px; }
body.wide .avatar.letter.sm.two { font-size: 12px; }
body.wide .avatar.sm { width: 34px; height: 34px; border-radius: 5px; }
body.wide .bubble { font-size: 14.5px; line-height: 1.6; padding: 8px 12px; }
body.wide .bubble code { font-size: 12.5px; }
body.wide .composer textarea, body.wide .composer .tbox .tph { font-size: 14.5px; }
body.wide .lsearch input, body.wide .fb-filter input { font-size: 14px; }
body.wide .turns { font-size: 14.5px; }
body.wide .cell .cm { font-size: 14.5px; }

/* Rove desktop titles and generous session switch target. */
body.wide .bar h1, body.wide .bar .title b { font-weight: 600; }
body.wide #chat .bar .title { text-align: center; padding: 0; align-self: stretch; justify-content: center; }
body.wide #chat .bar .title small { justify-content: center; min-height: 24px; padding: 0 24px; }
#c-name { cursor: default; }
.me-head { gap: 16px; }
.me-nickrow { justify-content: flex-start; gap: 2px; }
.me-edit { width: 32px; height: 32px; }
.me-nickrow .me-name { flex: 0 1 auto; }
.me-acct { margin-top: 5px; }
.card.question .acts { display: flex; flex-direction: column; gap: 8px; }
.card.question .acts .btn { text-align: left; white-space: normal; }
.card.question label { display: flex; gap: 9px; padding: 12px; background: var(--code); border-radius: 10px; }
.card.question [data-text] { margin-top: 10px; width: 100%; box-sizing: border-box; }

/* Antigravity Generative UI (<agent-embed>) inline widgets */
.msg.bot:has(.ag-embed) > .col { width: 100%; max-width: calc(100% - 56px); }
body.wide .msg.bot:has(.ag-embed) > .col { max-width: min(640px, calc(100% - 110px)); }
.ag-embed { position: relative; margin: 8px 0; border-radius: 10px; border: .5px solid var(--line); background: color-mix(in srgb, var(--page) 45%, var(--bot)); overflow: hidden; }
.ag-embed:first-child { margin-top: 2px; }
.ag-embed:last-child { margin-bottom: 2px; }
.ag-embed .ag-frame { display: block; width: 100%; height: 260px; max-height: 800px; border: 0; background: transparent; transition: height .14s ease-out; }
.ag-embed .ag-exp { position: absolute; top: 6px; right: 6px; z-index: 2; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: var(--muted); border: .5px solid var(--line); opacity: .78; }
.ag-embed .ag-exp:active { opacity: 1; background: var(--sel); }
@media (hover: hover) { .ag-embed .ag-exp { opacity: 0; transition: opacity .15s; } .ag-embed:hover .ag-exp { opacity: .92; } .ag-embed .ag-exp:hover { opacity: 1; color: var(--text); } }
