/* Chat app base styles. Colors come from CSS variables set by the live UI config (Settings or chat). */
:root{--bg:#141414;--card:#2a2a2a;--card2:#1f1f1f;--text:#fff;--muted:#8a8a8a;--accent:#e0612a;--userBubble:#b5531f;--userText:#fff;--botBubble:#2a2a2a;--botText:#fff;--border:#333;--radius:22px;--font:-apple-system,'Segoe UI',Roboto,sans-serif;--fontSize:16px;--bw:82%;--pad:14px;--gap:12px}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0;background:var(--bg);color:var(--text);font-family:var(--font);font-size:var(--fontSize);overscroll-behavior:none}
button{font:inherit;color:inherit;cursor:pointer}
input,textarea,select{font:inherit;color:var(--text)}
.app{position:fixed;inset:0;display:flex;flex-direction:column;background:var(--bg)}
body.compact{--pad:10px;--gap:7px}
/* header */
.hdr{display:flex;align-items:center;gap:10px;padding:calc(env(safe-area-inset-top) + 10px) 14px 10px;z-index:5}
.ibtn{width:44px;height:44px;border-radius:50%;background:var(--card);border:0;display:grid;place-items:center;flex:none}
.ibtn svg{width:22px;height:22px;stroke:var(--text);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.pill{flex:1;min-width:0;height:44px;border-radius:999px;background:var(--card);border:0;display:flex;align-items:center;gap:10px;padding:0 14px 0 6px;text-align:left}
.pill .av{width:32px;height:32px}
.pill .nm{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pill .sub{color:var(--muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.av{width:34px;height:34px;border-radius:45% 55% 52% 48%;background:var(--accent);flex:none;position:relative}
.av.on::after{content:'';position:absolute;right:-1px;bottom:-1px;width:10px;height:10px;border-radius:50%;background:#2ecc71;border:2px solid var(--card)}
.hdr-extra{display:flex;gap:8px}
/* thread */
.thread{flex:1;overflow-y:auto;padding:8px var(--pad) 18px;display:flex;flex-direction:column;gap:var(--gap);-webkit-overflow-scrolling:touch}
.empty{margin:auto;text-align:center;color:var(--muted);padding:30px}
.empty .av{width:64px;height:64px;margin:0 auto 14px}
.empty h2{color:var(--text);font-weight:600;font-size:22px;margin:0 0 6px}
.msg{display:flex;gap:8px;max-width:100%}
.msg.user{justify-content:flex-end}
.msg .bub{max-width:var(--bw);padding:11px 15px;border-radius:var(--radius);line-height:1.45;word-wrap:break-word;overflow-wrap:anywhere}
.msg.user .bub{background:var(--userBubble);color:var(--userText);border-bottom-right-radius:8px}
.msg.bot .bub{background:var(--botBubble);color:var(--botText);border-bottom-left-radius:8px}
body.flat-bot .msg.bot .bub{background:transparent;padding-left:2px}
body.no-avatars .msg .av{display:none}
.msg.bot .av{width:28px;height:28px;margin-top:4px}
.botcol{display:flex;flex-direction:column;gap:6px;min-width:0;max-width:var(--bw)}
.botcol .bub{max-width:100%}
.bub p{margin:0 0 .6em}.bub p:last-child{margin:0}
.bub pre{background:rgba(0,0,0,.35);padding:10px;border-radius:12px;overflow-x:auto;font-size:13px}
.bub code{font-family:ui-monospace,Menlo,monospace;font-size:.9em}
.bub a{color:inherit;text-decoration:underline}
.bub img.att,.bub video.att{max-width:100%;border-radius:14px;display:block;margin:4px 0}
.filechip{display:inline-flex;align-items:center;gap:8px;background:rgba(0,0,0,.25);border-radius:12px;padding:8px 10px;margin:3px 0;font-size:14px;color:inherit;text-decoration:none}
.vnote{font-size:12px;color:var(--muted);margin-top:4px}
.think{background:var(--card2);border-radius:16px;font-size:14px;color:var(--muted)}
.think summary{list-style:none;padding:8px 12px;display:flex;align-items:center;gap:8px;cursor:pointer}
.think summary::-webkit-details-marker{display:none}
.think summary::before{content:'›';display:inline-block;transition:transform .15s;font-size:18px;line-height:1}
.think[open] summary::before{transform:rotate(90deg)}
.think .tb{padding:0 12px 10px;white-space:pre-wrap;max-height:260px;overflow:auto;font-size:13px}
.step{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);background:var(--card2);border-radius:12px;padding:7px 10px}
.step b{color:var(--text);font-weight:600}
.step.err b{color:#ff8a65}
.step details{flex:1;min-width:0}.step summary{cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.step pre{white-space:pre-wrap;font-size:12px;max-height:200px;overflow:auto;margin:6px 0 0}
.working{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:14px}
.working .av{width:22px;height:22px;animation:bb 1.4s ease-in-out infinite}
.shimmer{background:linear-gradient(90deg,var(--muted) 30%,var(--text) 50%,var(--muted) 70%);background-size:200% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:sh 1.6s linear infinite}
@keyframes sh{to{background-position:-200% 0}}
@keyframes bb{50%{transform:scale(.85) rotate(20deg)}}
.err-line{color:#ff8a65;font-size:14px}
/* composer */
.composer{padding:8px 12px calc(env(safe-area-inset-bottom) + 10px);position:relative}
.atts{display:flex;gap:8px;overflow-x:auto;padding:0 4px 8px}
.att-prev{position:relative;flex:none;background:var(--card);border-radius:14px;padding:6px 26px 6px 8px;font-size:13px;max-width:200px;display:flex;align-items:center;gap:6px}
.att-prev img{width:38px;height:38px;object-fit:cover;border-radius:9px}
.att-prev span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.att-prev .x{position:absolute;right:4px;top:4px;width:18px;height:18px;border-radius:50%;border:0;background:#0006;font-size:12px;line-height:18px;padding:0}
.cbar{display:flex;align-items:flex-end;gap:8px;background:var(--card);border-radius:28px;padding:6px}
.cbar .ibtn{width:40px;height:40px;background:var(--card2)}
.cbar textarea{flex:1;background:transparent;border:0;outline:0;resize:none;padding:9px 4px;max-height:150px;min-height:40px;line-height:1.4}
.cbar textarea::placeholder{color:var(--muted)}
.send{width:40px;height:40px;border-radius:50%;border:0;background:var(--accent);display:grid;place-items:center;flex:none}
.send svg{width:20px;height:20px;stroke:#fff;fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.send.stop{background:var(--card2)}
.extra-btns{display:flex;gap:6px;flex-wrap:wrap;padding:0 4px 6px}
.chipbtn{background:var(--card);border:0;border-radius:999px;padding:7px 12px;font-size:13px}
/* plus popover */
.pop{position:absolute;left:14px;bottom:calc(100% - 4px);background:var(--card);border-radius:20px;padding:6px;min-width:240px;box-shadow:0 10px 40px #0009;z-index:20;display:none}
.pop.open{display:block}
.pop button{display:flex;align-items:center;gap:12px;width:100%;background:none;border:0;padding:12px 14px;border-radius:14px;text-align:left;font-size:15px}
.pop button:active,.pop button:hover{background:var(--card2)}
.pop svg{width:20px;height:20px;stroke:var(--text);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.pop hr{border:0;border-top:1px solid var(--border);margin:4px 8px}
/* drawer */
.scrim{position:fixed;inset:0;background:#0008;opacity:0;pointer-events:none;transition:opacity .2s;z-index:30}
.scrim.open{opacity:1;pointer-events:auto}
.drawer{position:fixed;top:0;bottom:0;left:0;width:min(86vw,360px);background:var(--card2);z-index:31;transform:translateX(-102%);transition:transform .25s ease;display:flex;flex-direction:column;padding:calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px)}
body.drawer-right .drawer{left:auto;right:0;transform:translateX(102%)}
.drawer.open{transform:none!important}
.dhead{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.dhead .ttl{font-weight:600;font-size:20px;flex:1}
.search{display:flex;align-items:center;gap:8px;background:var(--card);border-radius:999px;padding:0 14px;height:44px;margin-bottom:10px}
.search input{flex:1;background:none;border:0;outline:0}
.search svg{width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:2}
.clist{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:2px}
.crow{display:flex;align-items:center;gap:12px;padding:10px;border-radius:16px;background:none;border:0;text-align:left;width:100%}
.crow.active{background:var(--card)}
.crow .av{width:40px;height:40px}
.crow .mid{flex:1;min-width:0}
.crow .t1{display:flex;gap:8px;align-items:baseline}
.crow .tt{font-weight:600;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crow .ts{color:var(--muted);font-size:12px;flex:none}
.crow .pv{color:var(--muted);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crow .more{width:32px;height:32px;border-radius:50%;background:none;border:0;color:var(--muted);font-size:20px;flex:none}
.newbtn{display:flex;align-items:center;justify-content:center;gap:8px;background:var(--accent);color:#fff;border:0;border-radius:999px;height:46px;font-weight:600;margin-top:10px}
/* sheets */
.sheet-wrap{position:fixed;inset:0;z-index:40;display:none;align-items:flex-end;justify-content:center;background:#0009}
.sheet-wrap.open{display:flex}
.sheet{width:100%;max-width:640px;max-height:92vh;background:var(--bg);border-radius:26px 26px 0 0;display:flex;flex-direction:column;animation:up .22s ease}
@keyframes up{from{transform:translateY(40px);opacity:.4}}
.shead{display:flex;align-items:center;gap:10px;padding:14px 14px 8px}
.shead .ttl{flex:1;font-size:20px;text-align:center;margin-right:54px}
.sbody{overflow-y:auto;padding:4px 16px calc(env(safe-area-inset-bottom) + 24px)}
.sec{color:var(--muted);font-size:13px;margin:18px 6px 8px}
.card{background:var(--card);border-radius:20px;overflow:hidden}
.card + .card{margin-top:14px}
.row{display:flex;align-items:center;gap:12px;padding:13px 16px;min-height:52px;border-top:1px solid var(--border)}
.row:first-child{border-top:0}
.row .lbl{flex:1;min-width:0}
.row .lbl small{display:block;color:var(--muted);font-size:12px;margin-top:2px;overflow-wrap:anywhere}
.row .val{color:var(--muted);font-size:14px}
.row input[type=color]{width:40px;height:32px;border:0;border-radius:10px;background:none;padding:0}
.row input[type=range]{width:130px;accent-color:var(--accent)}
.row select,.field{background:var(--card2);border:1px solid var(--border);border-radius:12px;padding:9px 10px;outline:0}
.field{width:100%}
textarea.field{min-height:90px;font-family:ui-monospace,Menlo,monospace;font-size:13px}
.tog{width:52px;height:32px;border-radius:999px;background:#555;border:0;position:relative;flex:none;transition:background .15s}
.tog::after{content:'';position:absolute;top:3px;left:3px;width:26px;height:26px;border-radius:50%;background:#111;transition:left .15s}
.tog.on{background:var(--accent)}.tog.on::after{left:23px;background:#fff}
.btn{background:var(--card2);border:1px solid var(--border);border-radius:999px;padding:8px 14px;font-size:14px;white-space:nowrap}
.btn.pri{background:var(--accent);border-color:var(--accent);color:#fff}
.btn.danger{color:#ff8a65}
.btn:disabled{opacity:.5}
.badge{font-size:11px;padding:3px 8px;border-radius:999px;background:var(--card2);color:var(--muted)}
.badge.cur{background:var(--accent);color:#fff}
.chips{display:flex;gap:8px;overflow-x:auto;padding:2px 0 10px}
.chip{background:var(--card);border:0;border-radius:999px;padding:8px 14px;font-size:14px;white-space:nowrap}
.chip.on{background:#fff;color:#111}
.form{display:flex;flex-direction:column;gap:10px;padding:14px 16px}
.form label{font-size:13px;color:var(--muted)}
.tile{width:40px;height:40px;border-radius:12px;background:var(--card2);display:grid;place-items:center;flex:none;font-size:20px}
.toast{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom) + 96px);transform:translateX(-50%);background:#000c;color:#fff;padding:10px 16px;border-radius:999px;font-size:14px;z-index:60;max-width:90vw;text-align:center}
.model-opt{display:flex;align-items:center;gap:12px;width:100%;background:none;border:0;padding:14px 16px;border-top:1px solid var(--border);text-align:left}
.model-opt:first-child{border-top:0}
.dot{width:9px;height:9px;border-radius:50%;background:#666;flex:none}.dot.on{background:#2ecc71}
.chk{margin-left:auto;color:var(--accent);font-weight:700}
.newbtn svg{width:20px;height:20px;stroke:#fff;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.filechip svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.8;flex:none}
.att-prev svg{width:22px;height:22px;stroke:var(--text);fill:none;stroke-width:1.8;flex:none}
a.btn{color:var(--text);text-decoration:none;display:inline-block}

/* --- Connectors: add/list/enable/remove any MCP server by URL (be --- */
.cn-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#777;vertical-align:middle}
.cn-dot.ok{background:#3ccf6e}.cn-dot.bad{background:#ff6b5a}
.cn-item{border-top:1px solid var(--border)}.cn-item:first-child{border-top:0}
.cn-item .row{border-top:0}
.cn-acts{display:flex;gap:8px;flex-wrap:wrap;padding:0 16px 12px 68px}
.cn-auth{display:flex;flex-direction:column;gap:8px}
.cn-hbox{display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.cn-hrow{display:flex;gap:6px;width:100%}.cn-hrow .field{flex:1;min-width:0}
.cn-tool{border-top:1px solid var(--border);padding:10px 16px}
.cn-tool summary{cursor:pointer;overflow-wrap:anywhere}.cn-tool summary small{color:var(--muted)}
.cn-tool .form{padding:10px 0 4px}
.cn-out{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;background:var(--card2);border-radius:10px;padding:8px;max-height:320px;overflow:auto;margin:0}
.cn-out:empty{display:none}


/* voice call view */
.callview{position:fixed;inset:0;background:#101010;z-index:60;display:none;flex-direction:column;align-items:center;padding:calc(env(safe-area-inset-top) + 26px) 20px calc(env(safe-area-inset-bottom) + 22px)}
.callview.open{display:flex}
.callview .cav{width:110px;height:110px;border-radius:50%;border:3px solid #000;box-shadow:0 0 0 2px #2c2c2c;flex:none}
.callview .cav.listening{animation:cvpulse 1.6s ease-in-out infinite}
.callview .cav.speaking{animation:cvpulse .8s ease-in-out infinite}
@keyframes cvpulse{50%{transform:scale(1.05)}}
.callview .cnm{margin-top:14px;background:#242424;color:#fff;border-radius:999px;padding:8px 22px;font-weight:700;font-size:17px}
.callview .cst{margin-top:9px;color:#9a9a9a;font-size:14px;display:flex;gap:6px;align-items:center}
.callview .cst svg{width:13px;height:13px;stroke:#9a9a9a;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.callview .cmsg{flex:1;width:min(680px,94%);overflow-y:auto;margin-top:18px;display:flex;flex-direction:column;gap:10px}
.callview .cm{max-width:85%;padding:10px 14px;border-radius:18px;line-height:1.45;font-size:15px;white-space:pre-wrap;overflow-wrap:anywhere}
.callview .cm.u{align-self:flex-end;background:#D67D06;color:#fff}
.callview .cm.a{align-self:flex-start;background:#242424;color:#fff}
.callview .cm.sys{align-self:center;color:#9a9a9a;background:none;font-size:13px;text-align:center;max-width:94%}
.callview .clive{min-height:22px;color:#c9c9c9;font-style:italic;text-align:center;width:min(680px,94%);margin-top:8px}
.callview .cbtns{display:flex;gap:26px;margin-top:14px}
.callview .cbtn{width:64px;height:64px;border-radius:50%;border:0;display:grid;place-items:center;background:#2a2a2a;cursor:pointer}
.callview .cbtn svg{width:28px;height:28px;stroke:#fff;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.callview .cbtn.hang{background:#d92c2c}
.callview .cbtn.off{background:#5a1f1f}
/* --- Voice call button: microphone conversation, spoken replies,  --- */
.voice-phone{width:42px;height:42px;flex:none;border:1px solid #70603d;border-radius:50%;background:#342b1b;color:#f7cd70;font-size:24px;display:grid;place-items:center}
.voice-phone.on{background:#f1be58;color:#18140d;box-shadow:0 0 22px #efbd5870}
.voice-call-state{margin:0 12px 8px;padding:9px 14px;border-radius:18px;background:#272219;color:#f6d78c;font-size:13px;text-align:center}
.voice-call-state[hidden]{display:none}


/* --- Visual New Version: attach screenshots and generate from ima --- */
.version-image-button{border:1px dashed #d4a950;background:#28241d;color:#f3d58b;border-radius:18px;padding:20px 12px;font-size:15px;text-align:center;width:100%;cursor:pointer}.version-preview{display:flex;gap:10px;overflow-x:auto}.version-image{position:relative;min-width:110px;max-width:180px;background:#242424;border-radius:12px;overflow:hidden}.version-image img{display:block;width:100%;height:115px;object-fit:cover}.version-image span{display:block;font-size:11px;padding:5px;overflow-wrap:anywhere}

/* --- Restore always-visible model picker above composer --- */
.model-quick{display:flex;align-items:center;gap:6px;max-width:100%;margin:0 0 9px 3px;padding:7px 12px;border:1px solid #61502f;background:#252018;border-radius:18px;color:#f2d18a;font-size:12px;text-align:left}.model-quick strong{font-size:12px;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#fff;font-weight:600}.model-quick:active{background:#4a3922} 

/* --- Responsive Chat layout with conversation history on desktop, --- */
:root {
  --sidebar-width: clamp(250px, 21vw, 296px);
  --content-width: 52rem;
  --gutter: clamp(16px, 4vw, 56px);
  --panel: color-mix(in srgb, var(--bg) 89%, var(--card));
  --soft-text: color-mix(in srgb, var(--text) 28%, var(--muted));
  --hairline: color-mix(in srgb, var(--text) 12%, var(--bg));
}
.app { inset: 0; background: var(--bg); min-width: 0; }
.hdr {
  min-height: 64px; flex: none; border-bottom: 1px solid var(--hairline);
  padding: calc(env(safe-area-inset-top) + 10px) max(var(--gutter), env(safe-area-inset-right)) 10px max(var(--gutter), env(safe-area-inset-left));
  gap: 6px;
}
.chat-heading { display: flex; align-items: center; min-width: 0; margin-right: auto; gap: 11px; }
.chat-heading .nm { font-size: 19px; font-weight: 650; letter-spacing: -.035em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .ibtn, .hdr .hpill {
  color: var(--soft-text); background: transparent; border: 0; border-radius: 12px;
  min-height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 550;
}
.hdr .hpill svg, .drawer-tools svg, .search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wave { display: inline-flex; align-items: center; justify-content: center; gap: .1em; width: 2em; height: 2em; color: var(--accent); flex: none; }
.wave i { width: .15em; height: .45em; border-radius: 1em; background: currentColor; }
.wave i:nth-child(2) {height: .95em;} .wave i:nth-child(3) {height: 1.5em;} .wave i:nth-child(4) {height: .82em;}
.thread {
  align-self: stretch; width: auto; max-width: none; min-height: 0;
  padding: 26px max(var(--gutter), calc((100% - var(--content-width)) / 2)) 16px;
  gap: calc(var(--gap) + 7px); overscroll-behavior-y: contain;
}
.thread > * { flex-shrink: 0; }
.thread .empty { width: min(100%, 38rem); padding: 20px 0; text-wrap: balance; }
.empty .wave {
  width: 2.8em; height: 2.8em; font-size: 25px; margin-bottom: 22px; border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--bg));
  background: radial-gradient(at 50% 100%, color-mix(in srgb, var(--accent) 14%, var(--bg)), var(--panel));
}
.thread .empty h2 { margin: 0 auto; max-width: 17ch; font-size: clamp(32px, 4.1vw, 56px); line-height: 1.07; letter-spacing: -.052em; font-weight: 580; }
.msg { min-width: 0; }
.msg .bub { min-width: 0; padding: 12px 16px; line-height: 1.56; }
.msg.user .bub { border-radius: var(--radius) var(--radius) 6px var(--radius); }
.msg.bot .av { width: 23px; height: 23px; margin-top: 9px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 15%, var(--bg)); display: grid; place-items: center; }
.msg.bot .av .wave { font-size: 10px; }
.botcol { max-width: min(var(--bw), calc(100% - 31px)); min-width: 0; }
body.no-avatars .botcol { max-width: var(--bw); }
.botcol > :empty { display: none !important; }
.botcol .bub { align-self: start; max-width: 100%; background: var(--botBubble); }
.bub pre { max-width: 100%; }
.composer {
  align-self: center; width: min(var(--content-width), calc(100% - 2 * var(--gutter))); max-width: none;
  flex: none; padding: 8px 0 calc(env(safe-area-inset-bottom) + clamp(12px, 2.6vh, 28px));
}
.cbar {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
  grid-template-areas: "message message message message" "add model mic send";
  align-items: center; gap: 2px 4px; padding: 7px 9px; min-height: auto;
  border: 1px solid color-mix(in srgb, var(--text) 17%, var(--bg)); border-radius: 22px;
  background: color-mix(in srgb, var(--card) 74%, var(--bg)); box-shadow: 0 4px 20px #0002;
}
.cbar:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.cbar textarea { grid-area: message; min-width: 0; width: 100%; min-height: 42px; padding: 10px 9px 7px; font-size: max(16px, 1em); }
.cbar .ibtn { width: 44px; height: 44px; background: transparent; border-radius: 12px; }
.cbar .ibtn svg { width: 19px; height: 19px; stroke: var(--soft-text); }
.cbar [aria-label="Add"] { grid-area: add; }
.cbar .mic2 { grid-area: mic; }
.cbar .mic2.rec { background: #5a1f1f; }
.cbar .mic2.rec svg { stroke: #ff986b; }
.cbar .send { grid-area: send; width: 44px; height: 44px; border-radius: 15px; }
.model-quick {
  grid-area: model; justify-self: start; min-width: 0; width: fit-content; max-width: 100%;
  margin: 0; padding: 0 8px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--soft-text);
}
.model-quick strong { font-size: 12px; font-weight: 550; color: inherit; }
.model-quick::after { content: ''; width: 6px; height: 6px; flex: none; margin: -3px 2px 0 3px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.extra-btns:empty, .atts:empty { display: none; }
.pop { left: 0; bottom: calc(100% - 2px); max-width: 100%; max-height: 65dvh; overflow: auto; border: 1px solid var(--hairline); }
.pop .voice-phone { display: flex; width: 100%; height: auto; border: 0; color: var(--text); box-shadow: none; }
.pop .voice-phone.on { color: var(--accent); }
.drawer {
  background: var(--panel); padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px);
  visibility: hidden;
}
.drawer.open { visibility: visible; }
.dhead { order: 0; margin: 0 0 19px; min-height: 40px; padding-inline: 7px; }
.dhead .av { display: none; }
.dhead .ttl { font-size: 17px; letter-spacing: -.025em; font-weight: 620; }
.newbtn {
  order: 1; margin: 0 0 10px; background: var(--card); color: var(--text); border: 1px solid var(--hairline);
  border-radius: 12px; justify-content: flex-start; padding: 0 13px; font-size: 14px; gap: 10px;
}
.newbtn svg { stroke: var(--accent); width: 17px; }
.search { order: 2; background: transparent; border: 1px solid var(--hairline); border-radius: 12px; color: var(--soft-text); height: 42px; margin-bottom: 18px; }
.search input { min-width: 0; width: 100%; font-size: 14px; }
.search input::placeholder { color: var(--soft-text); }
.clist { order: 3; min-height: 0; }
.crow { gap: 4px; border-radius: 10px; padding: 9px 6px 9px 11px; min-height: 52px; }
.crow .av { display: none; }
.crow .tt { font-size: 14px; font-weight: 550; }
.crow .ts, .crow .pv { font-size: 12px; color: var(--soft-text); }
.crow .pv { margin-top: 3px; }
.crow .more { width: 28px; }
.drawer-tools { order: 4; display: flex; gap: 2px; border-top: 1px solid var(--hairline); margin-top: 10px; padding-top: 8px; flex-wrap: wrap; }
.drawer-tools button { flex: auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; border: 0; background: transparent; color: var(--soft-text); border-radius: 10px; font-size: 13px; }
.drawer-tools svg { width: 16px; height: 16px; }
:where(button, [role=button], summary, input, textarea, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cbar textarea:focus-visible { outline: none; }
@media (hover: hover) {
  .hdr button:hover, .cbar .ibtn:hover, .model-quick:hover, .drawer-tools button:hover, .crow:hover { background: var(--card); color: var(--text); }
}
@media (min-width: 1000px) {
  .app { left: var(--sidebar-width); }
  body.drawer-right .app { left: 0; right: var(--sidebar-width); }
  .drawer, body.drawer-right .drawer { width: var(--sidebar-width); visibility: visible; transform: none; border-inline: 1px solid var(--hairline); }
  .hdr > [aria-label="Conversations"], .dhead .ibtn, .scrim { display: none; }
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { max-height: min(88dvh, 900px); border-radius: 22px; border: 1px solid var(--hairline); }
}
@media (max-width: 599px) {
  :root { --gutter: 12px; }
  .hdr { min-height: 57px; padding: calc(env(safe-area-inset-top) + 5px) max(9px, env(safe-area-inset-right)) 5px max(5px, env(safe-area-inset-left)); gap: 2px; }
  .hdr .hpill { padding: 0 9px; gap: 6px; }
  .chat-heading { gap: 6px; }
  .chat-heading .wave { font-size: 13px; }
  .thread { padding-top: 16px; }
  .thread .empty h2 { max-width: 14ch; }
  .composer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .cbar { padding: 4px 6px; border-radius: 19px; }
}
@media (max-height: 480px) {
  .hdr { min-height: 48px; padding-block: 2px; }
  .thread .empty .wave { display: none; }
  .composer { padding-block: 4px; }
  .cbar textarea { max-height: 25dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .scrim, .sheet { animation: none; transition: none; }
}


/* --- Group chat: checkable bubbles — up to 2 local models + 1 CLI --- */

.chkbox{width:22px;height:22px;border-radius:7px;border:2px solid var(--muted);display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#fff;flex:none}
.chkbox.on{background:var(--accent);border-color:var(--accent)}
.model-opt.on{background:rgba(127,127,127,.10)}
.tgt-name{font-size:12px;font-weight:700;color:var(--accent);margin:0 0 4px 2px}


/* --- Group replies: local models' answers render in a compact 'si --- */

.minifeed{display:flex;flex-direction:column;gap:6px;margin:4px 0 10px;padding:10px 10px 4px;border:1px solid var(--border);border-radius:14px;background:color-mix(in srgb, var(--card) 55%, transparent)}
.minifeed-label{font-size:11px;font-weight:700;letter-spacing:.03em;color:var(--muted);text-transform:uppercase;margin:0 0 2px 2px}
.minifeed .msg.bot{margin:0}
.minifeed .msg.bot .bub{font-size:13px;padding:8px 11px;max-height:220px;overflow-y:auto}
.minifeed .msg.bot .av{width:20px;height:20px;margin-top:3px}
.minifeed .msg.bot .tgt-name{font-size:10.5px;margin-bottom:2px}
.minifeed .msg.bot .working{font-size:12px;gap:6px}


.adobe-link{text-decoration:none;white-space:nowrap}.drawer-tools .hpill{background:none;border:0;display:flex;gap:7px;align-items:center}.drawer-tools .hpill svg{width:18px}.hdr .hdr-extra{min-width:0}.hdr .chat-heading{min-width:0}.hdr .hpill{white-space:nowrap}@media(max-width:420px){.hdr{gap:3px}.hdr .hpill{padding-inline:6px}.hdr .adobe-link{font-size:12px}}
