#view-beta-chat .beta-tools{flex-wrap:wrap;gap:8px}
#view-beta-chat button:disabled,.bw-modal button:disabled{opacity:.5;cursor:wait}
#view-beta-chat .bw-file{display:flex;align-items:center;gap:8px;border:1px solid #4b5260;border-radius:12px;padding:10px;margin:8px 0;overflow-wrap:anywhere}
#view-beta-chat .bw-file span{flex:1;min-width:0}
#view-beta-chat .bw-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}
#view-beta-chat .bw-links{display:flex;gap:9px;flex-wrap:wrap;font-size:12px;margin-top:8px}
#view-beta-chat .bw-links button{border:0;background:transparent;padding:4px;color:#b9c0cc}
#view-beta-chat .bw-preview{position:relative;display:inline-flex;flex-direction:column;gap:4px;max-width:140px;font-size:11px;border:1px solid #4b5260;border-radius:12px;padding:8px}
#view-beta-chat .bw-preview img{width:90px;height:70px;object-fit:cover;border-radius:8px}
#view-beta-chat .bw-preview button{position:absolute;right:0;top:0;padding:3px 7px;min-width:24px}
#view-beta-chat .beta-preview{gap:8px!important;flex-wrap:wrap!important}
.bw-modal{position:fixed;inset:0;z-index:11020;box-sizing:border-box;background:#181b22;color:#f3f4f6;display:flex;flex-direction:column;padding:max(12px,env(safe-area-inset-top)) 14px max(12px,env(safe-area-inset-bottom));gap:12px;font:14px/1.5 system-ui,sans-serif}
.bw-modal button,.bw-modal select,.bw-modal input,.bw-modal textarea{font:inherit;color:inherit;background:#292e38;border:1px solid #4c5362;border-radius:9px;padding:8px;box-sizing:border-box}
.bw-modal button{cursor:pointer}
.bw-modal button.primary{background:#f1f2f5;color:#1b2028}
.bw-modal header,.bw-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.bw-modal header strong{flex:1;font-size:18px}
.bw-modal header button{padding:6px 12px}
.bw-modal textarea{width:100%;resize:vertical}
.bw-modal .bw-note{font-size:12px;color:#bac2cf;margin:0}
.bw-modal .bw-status{min-height:20px;color:#e8c893;white-space:pre-wrap}
.bw-stage{flex:1;min-height:100px;overflow:auto;position:relative;display:grid;place-items:center;background:#11141a;border-radius:12px}
.bw-canvas-wrap{position:relative;flex-shrink:0}
.bw-canvas-wrap canvas{position:absolute;inset:0;width:100%;height:100%}
.bw-canvas-wrap .bw-paint{touch-action:none;cursor:crosshair}
.bw-toolbar label{display:flex;gap:5px;align-items:center;font-size:12px;white-space:nowrap}
.bw-toolbar input[type=range]{width:90px;padding:0}
.bw-toolbar input[type=checkbox]{width:auto}
.bw-files{overflow-y:auto;flex:1;display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));align-content:start;gap:12px}
.bw-file-card{padding:12px;border:1px solid #414754;border-radius:12px;overflow-wrap:anywhere}
.bw-file-card img{width:100%;height:150px;object-fit:contain;background:#11151b;border-radius:8px}
.bw-file-card .bw-toolbar{margin-top:8px}
.bw-file-card button{font-size:12px;padding:5px 7px}
.bw-voice-orb{width:130px;height:130px;border-radius:50%;margin:30px auto;background:radial-gradient(circle at 35% 30%,#dce4f4,#697da0 50%,#303e58);box-shadow:0 0 60px #7591b033;transition:transform .08s}
.bw-transcript{flex:1;overflow:auto;white-space:pre-wrap;line-height:1.65}
@media(max-width:600px){.bw-toolbar{gap:6px}.bw-toolbar button{font-size:12px;padding:7px}.bw-modal{gap:8px;padding:10px}.bw-stage{min-height:120px}.bw-toolbar label{font-size:11px}}

/* Override inherited page-section spacing inside dialogs. */
.bw-modal{margin:0!important;border:0!important;border-radius:0!important;width:100vw!important;max-width:none!important;height:100dvh;max-height:100dvh;overflow:auto;z-index:120000}
.bw-modal input,.bw-modal select,.bw-modal button,.bw-modal textarea,.bw-modal label{margin:0!important}
.bw-modal .bw-toolbar select{width:auto;max-width:100%}.bw-modal .bw-toolbar label{width:auto}.bw-modal .bw-stage{flex:1 0 180px}.bw-modal details{flex-shrink:0;border:1px solid #424a58;border-radius:10px;padding:8px}.bw-modal details summary{cursor:pointer}.bw-modal details .bw-toolbar{margin-top:8px}.bw-modal>.bw-toolbar{flex-shrink:0}.bw-modal>.bw-status:empty{display:none}

/* Primary voice conversation button next to Send */
#view-beta-chat .beta-compose #beta-voice-call{background:#2878f0;color:#fff;border:0;flex:0 0 36px;box-shadow:0 2px 10px #2878f055;transition:background .15s,transform .15s}
#view-beta-chat .beta-compose #beta-voice-call:active{transform:scale(.93)}
#view-beta-chat .beta-compose #beta-voice-call:focus-visible{outline:2px solid #9dc5ff;outline-offset:2px}

#view-beta-chat .bw-message-actions{gap:4px;align-items:center;margin-top:5px}
#view-beta-chat .bw-message-actions .bw-icon-action{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;min-width:30px;padding:5px;border:0;border-radius:9px;background:transparent;color:#aeb8c8;cursor:pointer}
#view-beta-chat .bw-message-actions .bw-icon-action:hover{background:#ffffff12;color:#f3f5f9}
#view-beta-chat .bw-message-actions .bw-icon-action:focus-visible{outline:2px solid #6ca5ff;outline-offset:2px}

#view-beta-chat .bw-pending{opacity:.8}
#view-beta-chat .bw-send-error{display:block;margin-top:6px;color:#ef9e9e}

/* Telegram mobile keyboard: composer stays in the visible viewport. */
@media(max-width:800px){
 body[data-view="beta-chat"] #view-beta-chat{padding-bottom:90px}
 body[data-view="beta-chat"] #beta-form{position:fixed;left:8px;right:8px;bottom:calc(var(--beta-keyboard-bottom,0px) + env(safe-area-inset-bottom,0px) + 66px);z-index:1100;max-width:calc(100vw - 16px);box-sizing:border-box}
 body[data-view="beta-chat"].beta-input-focused #beta-form{bottom:calc(var(--beta-keyboard-bottom,0px) + 8px)}
 body[data-view="beta-chat"].beta-input-focused .bottom-nav{display:none!important}
 body[data-view="beta-chat"] #beta-input{font-size:16px!important;max-height:110px;overflow-y:auto}
 body[data-view="beta-chat"].beta-input-focused #view-beta-chat{padding-bottom:130px}
}

/* Attached images appear directly above the input, within the visible composer. */
#view-beta-chat #beta-form{flex-wrap:wrap}
#view-beta-chat #beta-form #beta-preview{order:-1;flex:0 0 100%;width:100%;max-width:100%;box-sizing:border-box;display:flex;gap:8px;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;padding:5px 3px 7px;margin:0}
#view-beta-chat #beta-form #beta-preview[hidden]{display:none!important}
#view-beta-chat #beta-form #beta-preview .bw-preview{flex:0 0 auto;max-width:110px}
#view-beta-chat #beta-form #beta-input{flex:1 1 75px}

/* Minimal chat composer: selectors live in compact popup menus. */
#view-beta-chat #beta-form{position:relative}
#view-beta-chat #beta-form #beta-settings-button{color:#c9ced9}
#view-beta-chat #beta-form #beta-model-button{width:auto;min-width:43px;max-width:67px;padding:0 5px;font-size:11px;font-weight:600;border-radius:10px;color:#b8d3ff;background:#2a3444}
#view-beta-chat .bw-compact-menu{position:absolute;bottom:calc(100% + 9px);z-index:1400;max-height:55vh;overflow-y:auto;width:min(260px,85vw);background:#252b36;border:1px solid #4c5362;border-radius:15px;padding:7px;box-shadow:0 10px 30px #0007}
#view-beta-chat .bw-compact-menu[hidden]{display:none!important}
#view-beta-chat #beta-model-menu{right:8px}
#view-beta-chat #beta-settings-menu{left:8px}
#view-beta-chat .bw-compact-menu button{display:block!important;width:100%!important;height:auto!important;min-height:37px;text-align:left!important;padding:9px 11px!important;border-radius:9px!important;font-size:13px!important;background:transparent!important;color:#e9edf5!important}
#view-beta-chat .bw-compact-menu button.bw-selected{background:#354b69!important;color:#fff!important}
#view-beta-chat .bw-menu-label{font-size:11px;color:#aeb7c8;padding:7px 10px}
@media(max-width:390px){#view-beta-chat #beta-form{gap:3px;padding-left:5px;padding-right:5px}#view-beta-chat #beta-form #beta-model-button{font-size:10px;min-width:38px}}

/* Mobile-friendly growing message input and tighter controls. */
#view-beta-chat #beta-memory-toggle[hidden],#view-beta-chat #beta-generate-image[hidden]{display:none!important}
#view-beta-chat #beta-form #beta-input{height:38px;min-height:38px;max-height:124px;line-height:21px;box-sizing:border-box;overflow:hidden;resize:none;transition:height .18s ease;flex:1 1 105px;min-width:65px;padding:8px 2px}
#view-beta-chat #beta-form{gap:2px;padding:5px 6px;align-items:center}
#view-beta-chat #beta-form #beta-attach,#view-beta-chat #beta-form #beta-settings-button,#view-beta-chat #beta-form #beta-mic{width:28px;height:32px;min-width:28px;flex:0 0 28px}
#view-beta-chat #beta-form #beta-attach{width:31px;height:31px;min-width:31px;flex-basis:31px}
#view-beta-chat #beta-form #beta-attach svg,#view-beta-chat #beta-form #beta-settings-button svg,#view-beta-chat #beta-form #beta-mic svg{width:18px;height:18px}
#view-beta-chat #beta-form #beta-voice-call{width:32px;height:32px;min-width:32px;flex:0 0 32px}
#view-beta-chat #beta-form #beta-send{width:33px;height:33px;min-width:33px;flex:0 0 33px}
#view-beta-chat #beta-form #beta-model-button{width:auto;min-width:36px;max-width:55px;padding:0 3px;font-size:10px}
@media(max-width:800px){body[data-view="beta-chat"] #view-beta-chat #beta-form{position:fixed}}

/* Chat header alongside the studio brand, not above messages. */
.topbar>.beta-header{display:none}
body[data-view="beta-chat"] .topbar>.beta-header{display:flex;align-items:center;justify-content:flex-end;gap:5px;margin:0 0 0 auto;padding:0;background:transparent;border:0;min-width:0}
body[data-view="beta-chat"] .topbar>.beta-header h2{font-size:12px;white-space:nowrap;margin:0}
body[data-view="beta-chat"] .topbar>.beta-header h2 small{font-size:9px}
body[data-view="beta-chat"] .topbar>.beta-header #beta-drawer-open{font-size:20px;padding:5px 7px}
body[data-view="beta-chat"] .topbar>.beta-header #beta-new{display:none}
body[data-view="beta-chat"] .topbar>.test-pill{display:none}
body[data-view="beta-chat"] .topbar{gap:5px}
body[data-view="beta-chat"] .topbar .brand{min-width:0}
body[data-view="beta-chat"] .topbar .brand small{font-size:10px}
#beta-drawer .bw-drawer-actions{display:flex;align-items:center;gap:8px}
#beta-drawer .bw-drawer-actions #beta-drawer-new{flex:1;min-width:0}
#beta-drawer .bw-drawer-actions #beta-drawer-memory{flex:0 0 auto;background:#343b49;color:#e7eaf2;border:0;border-radius:9px;padding:11px 10px;font-size:13px}
#beta-drawer #beta-memory-panel{margin:10px 0!important;max-height:45vh;overflow-y:auto}
#view-beta-chat #beta-memory-toggle{display:none!important}
@media(max-width:390px){body[data-view="beta-chat"] .topbar>.beta-header h2{font-size:11px}body[data-view="beta-chat"] .topbar .brand strong{font-size:13px}}

/* Header correction: studio brand left, chat immediately beside it, beta badge right. */
body[data-view="beta-chat"] .topbar{display:flex!important;align-items:center;justify-content:flex-start!important;gap:8px!important}
body[data-view="beta-chat"] .topbar>.beta-header{order:2!important;margin:0!important;margin-left:4px!important;margin-right:0!important;flex:0 1 auto!important;justify-content:flex-start!important;gap:3px!important}
body[data-view="beta-chat"] .topbar>.brand{order:1!important;flex:0 1 auto!important}
body[data-view="beta-chat"] .topbar>.test-pill{display:inline-flex!important;order:3!important;margin-left:auto!important;flex:0 0 auto!important}
body[data-view="beta-chat"] .topbar>.beta-header h2{font-size:11px!important}
body[data-view="beta-chat"] .topbar>.beta-header h2 small{display:none!important}
body[data-view="beta-chat"] .topbar>.beta-header #beta-drawer-open{padding:4px 5px!important;font-size:19px!important}
@media(max-width:390px){body[data-view="beta-chat"] .topbar{gap:3px!important}body[data-view="beta-chat"] .topbar>.beta-header{margin-left:1px!important}body[data-view="beta-chat"] .topbar .brand small{font-size:9px!important}}

/* In AI chat, remove studio branding and put the hamburger/title on the left. */
body[data-view="beta-chat"] .topbar>.brand{display:none!important}
body[data-view="beta-chat"] .topbar{justify-content:flex-start!important;gap:8px!important}
body[data-view="beta-chat"] .topbar>.beta-header{order:1!important;display:flex!important;margin:0!important;gap:7px!important;justify-content:flex-start!important}
body[data-view="beta-chat"] .topbar>.beta-header>div{display:flex!important;align-items:center!important;gap:8px!important}
body[data-view="beta-chat"] .topbar>.beta-header h2{font-size:16px!important;font-weight:650!important}
body[data-view="beta-chat"] .topbar>.beta-header #beta-drawer-open{border:0!important;background:transparent!important;border-radius:11px!important;padding:5px 9px!important;font-size:23px!important;line-height:1!important}
body[data-view="beta-chat"] .topbar>.test-pill{order:2!important;margin-left:auto!important}
/* Soft slide-in with subtle scale and overshoot, like a native mobile drawer. */
#beta-drawer{transform:translate3d(-106%,0,0) scale(.975)!important;transform-origin:left center;opacity:.96;transition:transform .42s cubic-bezier(.22,1.28,.36,1),opacity .26s ease!important;will-change:transform;backface-visibility:hidden}
#beta-drawer.is-open{transform:translate3d(0,0,0) scale(1)!important;opacity:1}
#beta-drawer-backdrop:not([hidden]){animation:bw-drawer-fade .24s ease both}
@keyframes bw-drawer-fade{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){#beta-drawer{transition:none!important}#beta-drawer-backdrop:not([hidden]){animation:none!important}}
