
:root { --bg:#111111; --panel:#181818; --panel2:#222222; --line:#2c2c2c; --text:#ececec; --muted:#9a9a9a;
  --accent:#ec3013; --accent2:#ff5a3c; --user:#262626; --err:#ff7a66; --ok:#3fb27f; --warn:#e0a030;
  --radius:12px; --tab:58px; color-scheme: dark; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg:#f7f7f7; --panel:#ffffff; --panel2:#efefef; --line:#e0e0e0; --text:#1b1b1b;
    --muted:#6b6b6b; --user:#ececec; --err:#c0280f; --ok:#1d8a5a; --warn:#a86b00; color-scheme: light; }
}
:root[data-theme="light"] { --bg:#f7f7f7; --panel:#ffffff; --panel2:#efefef; --line:#e0e0e0; --text:#1b1b1b;
  --muted:#6b6b6b; --user:#ececec; --err:#c0280f; --ok:#1d8a5a; --warn:#a86b00; color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--text);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
.hidden { display:none !important; }
.muted { color:var(--muted); } .small { font-size:12.5px; }
.err { color:var(--err); } .ok { color:var(--ok); }
button { font:inherit; cursor:pointer; border-radius:10px; border:1px solid var(--line); background:var(--panel2);
  color:var(--text); padding:9px 14px; }
button:disabled { opacity:.5; cursor:default; }
button.primary { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
button.primary.stop { background:var(--text); border-color:var(--text); color:var(--bg); }
button.secondary { background:transparent; }
button.danger { background:transparent; border-color:var(--err); color:var(--err); }
button.link { background:none; border:0; color:var(--muted); padding:6px 0; text-decoration:underline; }
button.mini { padding:3px 10px; font-size:12.5px; border-radius:8px; background:transparent; }
button.wide { width:100%; }
.icon-btn { background:none; border:0; font-size:20px; padding:6px 10px; color:var(--text); }
input, textarea, select { font:inherit; color:var(--text); background:var(--panel2); border:1px solid var(--line);
  border-radius:10px; padding:10px 12px; outline:none; max-width:100%; }
input:focus, textarea:focus, select:focus { border-color:var(--accent); }
input[type=checkbox] { width:18px; height:18px; accent-color:var(--accent); }
input[type=range] { accent-color:var(--accent); padding:0; }
svg { flex:none; }

/* login */
.screen { min-height:100%; display:flex; align-items:center; justify-content:center; padding:24px 16px; }
.login-card { width:100%; max-width:360px; background:var(--panel); border:1px solid var(--line);
  border-radius:16px; padding:28px 22px; display:flex; flex-direction:column; gap:12px; text-align:center; }
.login-card h1 { margin:4px 0 0; font-size:22px; } .login-card p { margin:0; }
.logo { width:56px; height:56px; margin:0 auto; } .logo-sm { width:26px; height:26px; }
.login-card .logo.brand { width:auto; height:118px; margin:2px auto 8px; }
.side-logo { height:76px; width:auto; display:block; margin:4px auto 2px; }
.empty .logo.brand { width:auto; height:64px; }
.pw-wrap { position:relative; display:flex; }
.pw-wrap input { flex:1; min-width:0; padding-right:44px; }
.pw-eye { position:absolute; right:4px; top:50%; transform:translateY(-50%); width:36px; height:36px; padding:0;
  border:0; background:transparent; color:var(--muted); border-radius:8px; display:flex; align-items:center;
  justify-content:center; cursor:pointer; }
.pw-eye:hover, .pw-eye:focus-visible { color:var(--text); background:var(--panel2); }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* shell */
#app { display:flex; height:100%; height:100dvh; }
#side { width:264px; flex:none; background:var(--panel); border-right:1px solid var(--line);
  display:flex; flex-direction:column; padding:14px 10px; gap:10px; overflow:hidden; }
.side-head { display:flex; align-items:center; justify-content:center; gap:10px; font-size:16px; padding:0 6px; position:relative; }
.side-head .icon-btn { position:absolute; right:0; top:0; }
#nav { display:flex; flex-direction:column; gap:2px; }
.nav-item { display:flex; align-items:center; gap:12px; background:none; border:0; border-radius:9px;
  padding:9px 10px; color:var(--muted); text-align:left; width:100%; }
.nav-item:hover { background:var(--panel2); color:var(--text); }
.nav-item.active { background:var(--panel2); color:var(--text); font-weight:600; }
.nav-item.active svg { color:var(--accent); }
.nav-item .count { margin-left:auto; font-size:11px; background:var(--accent); color:#fff; border-radius:9px;
  padding:0 7px; }
#side-chat { flex:1; min-height:0; display:flex; flex-direction:column; border-top:1px solid var(--line);
  padding-top:10px; }
.side-label { display:flex; align-items:center; justify-content:space-between; padding:0 8px 6px;
  font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
#conv-list { flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:1px; }
.conv-head { font-size:11px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted);
  padding:10px 10px 4px; flex:none; }
.conv-row { display:flex; align-items:center; border-radius:8px; flex:none; position:relative; }
.conv-row:hover, .conv-row.active, .conv-row.menu-open { background:var(--panel2); }
.conv { flex:1; min-width:0; display:flex; align-items:center; gap:6px; text-align:left; background:none; border:0;
  padding:8px 4px 8px 10px; border-radius:8px; color:var(--text); font-size:14px; cursor:pointer; font-family:inherit; }
.conv svg { flex:none; color:var(--accent); }
.conv-title { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.conv.active { font-weight:600; }
.conv-more { flex:none; width:30px; height:30px; margin-right:4px; display:inline-flex; align-items:center;
  justify-content:center; border:0; border-radius:6px; background:transparent; color:var(--muted); cursor:pointer;
  opacity:0; }
.conv-row:hover .conv-more, .conv-row.active .conv-more, .conv-row.menu-open .conv-more, .conv-more:focus-visible { opacity:1; }
.conv-more:hover { background:var(--line); color:var(--text); }
@media (hover:none) { .conv-more { opacity:1; } }
.conv-edit { flex:1; min-width:0; margin:3px 6px; padding:6px 8px; font-size:14px; }
.conv-menu { position:fixed; z-index:60; min-width:180px; background:var(--panel); border:1px solid var(--line);
  border-radius:10px; padding:4px; box-shadow:0 10px 30px rgba(0,0,0,.3); display:flex; flex-direction:column; }
.conv-menu-item { display:flex; align-items:center; gap:10px; padding:9px 10px; border:0; border-radius:7px;
  background:none; color:var(--text); font:inherit; font-size:14px; text-align:left; cursor:pointer; }
.conv-menu-item:hover, .conv-menu-item:focus-visible { background:var(--panel2); outline:none; }
.conv-menu-item.danger { color:var(--err); }
.danger-btn { background:var(--err); color:#fff; border:0; border-radius:8px; padding:8px 14px; font:inherit;
  font-weight:600; cursor:pointer; }
.danger-btn:disabled { opacity:.6; }
.side-foot { border-top:1px solid var(--line); padding:10px 8px 0; display:flex; flex-direction:column; gap:2px; }
.who-line { display:flex; align-items:center; gap:6px; color:var(--text); min-width:0; }
.who-line b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.who-line svg { color:var(--muted); flex:none; }
.who-line .badge { font-size:10px; padding:1px 6px; border-radius:6px; background:var(--panel2); color:var(--muted); }
#model-pick:disabled { opacity:.75; cursor:default; }
main { flex:1; min-width:0; display:flex; flex-direction:column; min-height:0; }
header { display:flex; align-items:center; gap:8px; padding:8px 16px; border-bottom:1px solid var(--line);
  min-height:52px; flex:none; }
#model-pick { width:auto; max-width:220px; padding:5px 28px 5px 10px; font-size:13px; min-height:34px; }
#login { position:relative; }
#login-theme { position:absolute; top:max(14px, env(safe-area-inset-top)); right:14px; }
.theme-btn svg { width:19px; height:19px; }
.theme-field { margin-top:14px; }
.themes { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px; margin-top:6px; }
.theme-tile { display:flex; flex-direction:column; gap:7px; padding:8px; border:2px solid var(--line); border-radius:12px;
  background:var(--panel); color:var(--text); cursor:pointer; font:inherit; font-size:13px; text-align:center; }
.theme-tile.active { border-color:var(--accent); font-weight:600; }
.pv { display:flex; height:64px; border-radius:8px; overflow:hidden; border:1px solid var(--line); }
.pv > div { flex:1; display:grid; grid-template-columns:28% 1fr; }
.pv .sb { border-right:1px solid; } .pv .ct { padding:7px 6px; display:flex; flex-direction:column; gap:5px; }
.pv i { display:block; height:6px; border-radius:3px; } .pv i.a { width:55%; } .pv i.b { width:80%; margin-left:auto; } .pv i.c { width:40%; }
.pv .d { background:#111111; } .pv .d .sb { background:#181818; border-color:#2c2c2c; } .pv .d i { background:#2c2c2c; } .pv .d i.b { background:#ec3013; }
.pv .l { background:#f7f7f7; } .pv .l .sb { background:#ffffff; border-color:#e0e0e0; } .pv .l i { background:#dcdcdc; } .pv .l i.b { background:#ec3013; }
.title { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0; }
#head-actions { display:flex; gap:6px; }
.view { flex:1; min-height:0; display:flex; flex-direction:column; }
#view-other { overflow-y:auto; }
#tabbar { display:none; }

/* chat */
#messages { flex:1; overflow-y:auto; padding:18px 16px 8px; display:flex; flex-direction:column; gap:18px; }
#messages > * { width:100%; max-width:800px; margin:0 auto; }
.empty { text-align:center; margin-top:10vh; }
.empty h2 { margin:10px 0 6px; font-size:20px; }
.chips { display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:16px; }
.chips button { font-size:13.5px; padding:7px 12px; border-radius:999px; background:transparent; }
.chips.days { justify-content:flex-start; margin-top:4px; gap:6px; }
.chips.days button.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.check { display:inline-flex; align-items:center; gap:8px; padding:4px 0; cursor:pointer; font-size:14px; }
.check input { width:18px; height:18px; accent-color:var(--accent); flex:none; }
.check input:disabled + span { color:var(--muted); }
.checks { display:grid; grid-template-columns:repeat(auto-fill, minmax(210px, 1fr)); gap:2px 12px; margin-top:8px; }
.checks .check span { font-family:ui-monospace, Consolas, monospace; font-size:12.5px; }
.note { border:1px solid var(--line); background:var(--panel2); border-radius:10px; padding:8px 10px; margin-bottom:10px; }
.note.warn { border-color:var(--warn); color:var(--warn); }
.row.wrap { flex-wrap:wrap; }
button.danger-text { color:var(--err); }
.sch-preview { margin-top:12px; font-weight:600; }
.sch-preview.err { color:var(--err); }
.card > .field { margin-top:10px; }
.msg.user { display:flex; flex-direction:column; align-items:flex-end; }
.bubble { background:var(--user); padding:10px 14px; border-radius:14px 14px 4px 14px; max-width:85%;
  white-space:pre-wrap; word-wrap:break-word; }
.msg-actions { display:flex; gap:4px; margin-top:6px; }
.msg-actions.hidden { display:none; }
.copy-btn { display:inline-flex; align-items:center; gap:5px; border:0; background:transparent; color:var(--muted);
  font:inherit; font-size:12px; padding:4px 8px; border-radius:6px; cursor:pointer; }
.copy-btn:hover { background:var(--line); color:var(--text); }
.copy-btn.done { color:var(--accent); }
.took { color:var(--muted); font-size:12px; align-self:center; padding:4px 6px; font-variant-numeric:tabular-nums; }
.gen-status { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; margin-top:6px; }
.gen-status .time { font-variant-numeric:tabular-nums; opacity:.8; }
.spinner.small { width:14px; height:14px; border-width:2px; }
.md.streaming > :last-child::after { content:'▍'; margin-left:1px; color:var(--accent); animation:blink 1s infinite; }
.md pre { position:relative; }
.md pre .copy-btn { position:absolute; top:4px; right:4px; background:var(--bg); opacity:.85; }
.who { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13px; margin-bottom:4px; }
.badge-r { width:18px; height:18px; border-radius:5px; background:var(--accent); color:#fff; font-size:11px;
  font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.md { word-wrap:break-word; overflow-wrap:anywhere; }
.md p { margin:0 0 10px; } .md p:last-child { margin-bottom:0; }
.md h1, .md h2, .md h3 { margin:14px 0 8px; line-height:1.3; } .md h1 { font-size:20px; } .md h2 { font-size:18px; }
.md h3 { font-size:16px; }
.md ul, .md ol { margin:0 0 10px; padding-left:22px; }
.md code { background:var(--panel2); padding:1px 5px; border-radius:5px; font-family:Consolas, monospace; font-size:13.5px; }
.md pre { background:var(--panel2); border:1px solid var(--line); padding:12px; border-radius:10px; overflow-x:auto;
  margin:0 0 10px; }
.md pre code { background:none; padding:0; }
.md a { color:var(--accent2); }
.md table { border-collapse:collapse; display:block; overflow-x:auto; margin:0 0 10px; }
.md th, .md td { border:1px solid var(--line); padding:6px 10px; text-align:left; }
.md th { background:var(--panel2); }
.tag { display:inline-block; font-size:11px; letter-spacing:.05em; text-transform:uppercase; color:var(--muted);
  border:1px solid var(--line); border-radius:6px; padding:1px 6px; margin-top:6px; }
div.typing span { display:inline-block; width:7px; height:7px; margin-right:4px; border-radius:50%;
  background:var(--muted); animation:blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay:.2s; } .typing span:nth-child(3) { animation-delay:.4s; }
@keyframes blink { 0%,80%,100% { opacity:.25; } 40% { opacity:1; } }
.sources { margin-top:10px; border-left:2px solid var(--line); padding-left:10px; display:flex; flex-direction:column; gap:3px; }
.sources b { font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.sources div { font-size:13px; } .sources .unused { color:var(--muted); }
.outputs { display:flex; flex-direction:column; gap:10px; margin-top:10px; }
.out { border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); overflow:hidden; max-width:520px; }
.out img, .out video { display:block; width:100%; max-height:520px; object-fit:contain; background:#000; }
.out audio { display:block; width:100%; padding:10px 10px 0; }
.out-row { display:flex; align-items:center; gap:10px; padding:10px 12px; }
.out-row .name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
.out-row a, a.btn { color:var(--text); text-decoration:none; border:1px solid var(--line); border-radius:8px;
  padding:5px 10px; font-size:13px; white-space:nowrap; display:inline-block; }
.loading { border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); padding:14px;
  max-width:520px; display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.loading .top { display:flex; align-items:center; gap:10px; } .loading .top b { flex:1; }
.spinner { width:20px; height:20px; border-radius:50%; border:3px solid var(--line); border-top-color:var(--accent);
  animation:spin .8s linear infinite; flex:none; display:inline-block; }
@keyframes spin { to { transform:rotate(360deg); } }
.bar { height:6px; background:var(--panel2); border-radius:3px; overflow:hidden; position:relative; }
.bar i { position:absolute; left:0; top:0; bottom:0; background:var(--accent); border-radius:3px; transition:width .4s; }
.bar.busy i { width:35%; animation:slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { left:-35%; } 100% { left:100%; } }
#composer { border-top:1px solid var(--line); padding:10px 16px 10px; background:var(--bg); flex:none; }
#composer > * { max-width:800px; margin-left:auto; margin-right:auto; }
#input { width:100%; display:block; resize:none; max-height:180px; min-height:46px; }
.composer-row { display:flex; align-items:center; gap:4px; margin-top:8px; }
.composer-row select { max-width:40%; padding:8px 10px; margin-left:4px; }
#status { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:0 4px; }
#tray, #kb-bar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px !important; }
.chip { display:flex; align-items:center; gap:8px; border:1px solid var(--line); background:var(--panel);
  border-radius:10px; padding:6px 8px; max-width:100%; font-size:13px; }
.chip img { width:34px; height:34px; object-fit:cover; border-radius:6px; flex:none; }
.chip .ext { width:34px; height:34px; border-radius:6px; background:var(--panel2); display:flex; align-items:center;
  justify-content:center; font-size:10px; font-weight:700; color:var(--muted); flex:none; }
.chip .info { min-width:0; display:flex; flex-direction:column; line-height:1.3; }
.chip .info b { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:180px; }
.chip.error { border-color:var(--err); } .chip.error .info span { color:var(--err); }
.chip .x { background:none; border:0; padding:2px 6px; color:var(--muted); font-size:16px; }
.chip .spinner { width:16px; height:16px; border-width:2px; }
.chip.kb { border-color:var(--accent); padding:4px 6px 4px 10px; }
.sent-files { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-bottom:6px; }
.sent-files span { font-size:12.5px; border:1px solid var(--line); border-radius:8px; padding:3px 8px;
  color:var(--muted); background:var(--panel); }
#composer.drop { outline:2px dashed var(--accent); outline-offset:-6px; }
.tool { color:var(--muted); padding:6px 7px; display:inline-flex; align-items:center; position:relative; }
.tool:hover { color:var(--text); }
.tool.on, #mic.on { color:#fff; background:var(--accent); border-radius:10px; }
#mic.busy { opacity:.5; }
#rec { display:flex; align-items:center; gap:10px; margin-bottom:8px !important; font-variant-numeric:tabular-nums; }
.rec-dot { width:10px; height:10px; border-radius:50%; background:var(--accent); animation:blink 1s infinite; }
.meter { flex:none; width:90px; height:6px; background:var(--panel2); border-radius:3px; overflow:hidden; }
.meter i { display:block; height:100%; width:0; background:var(--accent); transition:width .08s; }
#rec-hint { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* pages */
.page { width:100%; max-width:1040px; margin:0 auto; padding:18px 16px 32px; display:flex; flex-direction:column; gap:16px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px; min-width:0; }
.office-card { gap:8px; display:flex; flex-direction:column; }
iframe.office { width:100%; height:min(640px, 72vh); border:0; border-radius:10px; background:var(--bg); display:block; margin-top:6px; }
.office-wrap { position:relative; margin-top:6px; background:var(--bg); }
iframe.office { margin-top:0; }
.office-exit { display:none; position:absolute; top:max(10px, env(safe-area-inset-top)); left:50%; transform:translateX(-50%); z-index:2;
  align-items:center; gap:6px; box-shadow:0 4px 16px rgba(0,0,0,.3); min-height:40px; padding:0 16px; }
.office-exit svg { width:16px; height:16px; }
.office-wrap:fullscreen, .office-wrap.pseudo-full { width:100vw; height:100vh; height:100dvh; }
.office-wrap.pseudo-full { position:fixed; inset:0; z-index:1000; margin:0; }
.office-wrap:fullscreen iframe.office, .office-wrap.pseudo-full iframe.office { width:100%; height:100%; border-radius:0; }
.office-wrap:fullscreen .office-exit, .office-wrap.pseudo-full .office-exit { display:inline-flex; }
body.office-open { overflow:hidden; }
.card h3 { margin:0 0 10px; font-size:15px; }
.card-head { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.card-head h3 { margin:0; flex:1; }
.grid2 { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:16px; align-items:start; }
.grid3 { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
.row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.row.end { justify-content:flex-end; }
.spacer { flex:1; }
.field { display:flex; flex-direction:column; gap:5px; min-width:0; }
.field > span { font-size:13px; color:var(--muted); }
.field input, .field select, .field textarea { width:100%; }
.card textarea + .fields, .card .fields + .field, .card .fields + .muted { margin-top:10px; }
.fields { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; }
.fields.pick { grid-template-columns:repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.fields > .field.full { grid-column:1 / -1; }
.field textarea { resize:vertical; min-height:72px; }
.fields.pick select { text-overflow:ellipsis; white-space:nowrap; overflow:hidden; }
details > summary { cursor:pointer; color:var(--muted); font-size:13.5px; padding:6px 0; }
.seg { display:inline-flex; background:var(--panel2); border-radius:11px; padding:3px; gap:2px; max-width:100%; overflow-x:auto; }
.seg button { border:0; background:none; padding:7px 16px; border-radius:9px; color:var(--muted); white-space:nowrap; }
.seg button.active { background:var(--panel); color:var(--text); font-weight:600; box-shadow:0 1px 3px rgba(0,0,0,.25); }
.badge { display:inline-flex; align-items:center; gap:5px; font-size:12px; border-radius:999px; padding:2px 9px;
  border:1px solid var(--line); color:var(--muted); white-space:nowrap; }
.badge.ok { color:var(--ok); border-color:var(--ok); } .badge.err { color:var(--err); border-color:var(--err); }
.badge.run { color:var(--accent2); border-color:var(--accent2); } .badge.warn { color:var(--warn); border-color:var(--warn); }
.list { display:flex; flex-direction:column; }
.item { display:flex; align-items:center; gap:12px; padding:12px 4px; border-bottom:1px solid var(--line);
  background:none; border-left:0; border-right:0; border-top:0; border-radius:0; text-align:left; width:100%; color:var(--text); }
.item:last-child { border-bottom:0; }
button.item:hover { background:var(--panel2); }
.item .main { flex:1; min-width:0; }
.item .main b, .item .main .t { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.empty-note { color:var(--muted); text-align:center; padding:24px 8px; }
.gallery { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:10px; }
.tile { position:relative; aspect-ratio:1; border-radius:10px; overflow:hidden; background:var(--panel2);
  border:1px solid var(--line); padding:0; }
.tile img { width:100%; height:100%; object-fit:cover; display:block; }
.tile .play { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:30px;
  color:#fff; text-shadow:0 1px 6px rgba(0,0,0,.6); }
.audio-row { display:flex; flex-direction:column; gap:6px; padding:10px 0; border-bottom:1px solid var(--line); }
.audio-row audio { width:100%; }
.steps { display:flex; flex-direction:column; gap:0; }
.step { display:flex; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.step:last-child { border-bottom:0; }
.step .dot { width:24px; height:24px; border-radius:50%; flex:none; display:flex; align-items:center;
  justify-content:center; font-size:12px; font-weight:700; background:var(--panel2); color:var(--muted); }
.step.completed .dot { background:var(--ok); color:#fff; } .step.failed .dot { background:var(--err); color:#fff; }
.step.running .dot { background:var(--accent); color:#fff; }
.step pre { white-space:pre-wrap; font-size:12.5px; background:var(--panel2); padding:8px; border-radius:8px;
  margin:6px 0 0; max-height:220px; overflow:auto; }
.approval { border:1px solid var(--warn); background:color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.meter-row { display:flex; flex-direction:column; gap:4px; margin:8px 0; }
.meter-row .row { justify-content:space-between; font-size:13px; }
.stat { font-size:26px; font-weight:700; }
.switch { position:relative; width:44px; height:26px; flex:none; }
.switch input { opacity:0; width:0; height:0; position:absolute; }
.switch span { position:absolute; inset:0; background:var(--panel2); border:1px solid var(--line); border-radius:13px;
  transition:.2s; cursor:pointer; }
.switch span::after { content:""; position:absolute; width:20px; height:20px; left:2px; top:2px; border-radius:50%;
  background:var(--muted); transition:.2s; }
.switch input:checked + span { background:var(--accent); border-color:var(--accent); }
.switch input:checked + span::after { left:20px; background:#fff; }
.back { display:inline-flex; align-items:center; gap:6px; }

/* modal + toast */
#modal { position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.6); display:flex; align-items:center;
  justify-content:center; padding:16px; }
.modal-box { background:var(--panel); border:1px solid var(--line); border-radius:16px; max-width:min(960px, 100%);
  max-height:100%; overflow:auto; padding:16px; display:flex; flex-direction:column; gap:12px; width:100%; }
.modal-box img, .modal-box video { max-width:100%; max-height:70vh; object-fit:contain; display:block; margin:0 auto;
  border-radius:8px; background:#000; }
#toast { position:fixed; left:50%; transform:translateX(-50%); bottom:calc(var(--tab) + 18px + env(safe-area-inset-bottom));
  z-index:60; background:var(--text); color:var(--bg); padding:10px 16px; border-radius:10px; max-width:90%;
  font-size:14px; box-shadow:0 4px 18px rgba(0,0,0,.3); }

/* phone */
.only-mobile { display:none; }
@media (max-width: 860px) {
  .only-mobile { display:inline-block; }
  #app { flex-direction:column; }
  #side { position:fixed; z-index:30; top:0; bottom:0; left:0; transform:translateX(-105%); transition:transform .22s;
    width:84%; max-width:320px; padding-top:calc(14px + env(safe-area-inset-top)); }
  #side.open { transform:none; box-shadow:0 0 40px rgba(0,0,0,.4); }
  #scrim { position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:20; }
  header { padding:6px 8px; padding-top:calc(6px + env(safe-area-inset-top)); }
  main { flex:1; }
  #tabbar { display:flex; flex:none; height:calc(var(--tab) + env(safe-area-inset-bottom));
    padding-bottom:env(safe-area-inset-bottom); border-top:1px solid var(--line); background:var(--panel); }
  .tab { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; border:0;
    background:none; color:var(--muted); font-size:11px; padding:4px 0; border-radius:0; }
  .tab.active { color:var(--accent); font-weight:600; }
  #messages { padding:14px 12px 8px; }
  #composer { padding:8px 10px; }
  .bubble { max-width:92%; }
  .page { padding:14px 12px 24px; gap:12px; }
  .card { padding:14px; }
  #model-pick { max-width:32vw; padding-right:22px; }
  .pv { height:52px; }
  iframe.office { height:86vh; }
  .grid2 { grid-template-columns:1fr; }
  .gallery { grid-template-columns:repeat(auto-fill, minmax(104px, 1fr)); gap:6px; }
  .composer-row select { max-width:34%; }
  body.composing #tabbar { display:none; }
}
