.chat-shell{--chat-border:#373737;display:grid;grid-template-columns:260px minmax(0,1fr);height:calc(100dvh / var(--ui-scale,var(--ui-default-scale)) - 180px);min-height:320px;border:1px solid var(--chat-border);background:#090909;color:#eee;transition:grid-template-columns .45s cubic-bezier(.22,1,.36,1);overflow:hidden}.chat-shell *{box-sizing:border-box}.chat-shell button,.chat-dialog button,.chat-menu button{font:inherit;cursor:pointer;color:inherit;background:transparent;border:1px solid #555;padding:8px 12px;transition:background .18s,transform .24s,border-color .18s}.chat-shell button:hover,.chat-dialog button:hover,.chat-menu button:hover{background:#232323;border-color:#aaa}.chat-shell button:active{transform:scale(.95)}.chat-shell button:disabled{opacity:.4;cursor:default}.chat-shell :focus-visible,.chat-dialog :focus-visible{outline:2px solid white;outline-offset:3px}.chat-shell [hidden]{display:none!important}.chat-sidebar{display:flex;flex-direction:column;min-width:0;border-right:1px solid var(--chat-border);overflow:hidden;transition:opacity .25s}.chat-sidebar>header{padding:18px;display:flex;align-items:center;justify-content:space-between;gap:8px;font:10px var(--font-mono);letter-spacing:2px;white-space:nowrap}.chat-sidebar>header button{font-size:20px;padding:0 8px}.chat-search{display:flex;gap:8px;align-items:center;margin:0 14px;padding:10px;border:1px solid #444}.chat-search input{width:100%;min-width:0;background:transparent;border:0;color:#ddd;font:12px var(--font-sans)}.chat-sidebar-tools{display:flex;gap:6px;padding:12px 14px}.chat-sidebar-tools button{padding:5px 9px;font-size:11px}.chat-sidebar nav{overflow:auto;flex:1;padding:0 8px}.chat-group{margin-bottom:12px}.chat-group .chat-group-name{width:100%;text-align:left;border:0;font-size:11px;color:#aaa;padding:10px}.chat-group-items{display:grid;gap:4px;overflow:hidden;transition:max-height .35s,opacity .25s;max-height:10000px}.chat-group.collapsed .chat-group-items{max-height:0;opacity:0}.chat-thread{display:flex;flex-direction:column;gap:6px;width:100%;text-align:left!important;border-color:transparent!important;min-width:0;position:relative}.chat-thread strong,.chat-thread span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-thread strong{font-size:12px;font-weight:500}.chat-thread span{font-size:10px;color:#888}.chat-thread.active{border-color:#777!important;background:#1a1a1a}.chat-sidebar>footer{border-top:1px solid #333;padding:15px;display:grid;gap:7px;white-space:nowrap;font-size:12px}.chat-sidebar>footer small{font:8px var(--font-mono);letter-spacing:1px;color:#777}.chat-main{grid-column:2;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}.chat-header{padding:14px 22px;display:flex;align-items:center;gap:15px;border-bottom:1px solid #333}.chat-header>div{min-width:0;flex:1}.chat-header small{font:9px var(--font-mono);letter-spacing:2px;color:#888}.chat-header h2{font-size:16px;font-weight:600;margin:5px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-header button{border-color:transparent;font-size:20px;padding:4px 8px}.chat-messages{flex:1;min-height:0;overflow:auto;padding:26px max(24px,calc((100% - 780px)/2));scrollbar-gutter:stable}.chat-welcome{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;min-height:300px;height:100%;color:#bdbdbd}.chat-welcome img{width:100px;height:100px;object-fit:contain;margin-bottom:12px}.chat-welcome h2{font-size:27px;font-weight:600;color:#eee}.chat-welcome p{font-size:13px}.chat-welcome small{font-size:10px;color:#777;letter-spacing:1px;margin-top:25px}.chat-message{display:flex;gap:14px;margin:0 0 32px;align-items:flex-start}.chat-avatar{width:32px;height:32px;object-fit:cover;border:1px solid #555;border-radius:50%;flex-shrink:0}.chat-message-content{min-width:0;flex:1}.chat-message-content>header{display:flex;align-items:center;gap:12px;margin:7px 0 12px}.chat-message-content strong{font-size:12px}.chat-message-content time{font:9px var(--font-mono);color:#777}.chat-markdown{font:14px/1.85 var(--font-sans);overflow-wrap:anywhere;color:#ddd}.chat-markdown p:first-child{margin-top:0}.chat-markdown p:last-child{margin-bottom:0}.chat-message.user .chat-markdown{background:#161616;padding:12px 16px;border:1px solid #333}.chat-markdown pre{position:relative;background:#151515;border:1px solid #414141;overflow:auto;padding:36px 16px 16px;max-width:100%;font:12px/1.7 var(--font-mono)}.chat-markdown code{font-family:var(--font-mono)}.chat-markdown pre .chat-code-copy{position:absolute;right:5px;top:5px;font-size:9px;padding:3px 8px;color:#aaa}.chat-markdown table{display:block;overflow:auto;border-collapse:collapse}.chat-markdown td,.chat-markdown th{border:1px solid #555;padding:6px 10px}.chat-markdown a{color:white;text-decoration:underline}.chat-message footer{display:flex;gap:10px;align-items:center;margin-top:10px;color:#888;font-size:10px}.chat-message footer button{font-size:10px;border:0;padding:3px 0;color:#888}.chat-error{color:#e7b1b1}.chat-bottom{padding:0 max(20px,calc((100% - 780px)/2)) 12px}.chat-bottom [role=status]{font:11px/1.4 var(--font-sans);color:#aaa;min-height:16px;margin:4px 0 8px}.chat-composer{border:1px solid #777;background:#101010;transition:box-shadow .3s,border-color .3s}.chat-composer:focus-within{border-color:#ddd;box-shadow:3px 3px 0 #ffffff16}.chat-composer textarea{display:block;resize:vertical;min-height:64px;max-height:180px;width:100%;padding:15px;border:0;outline:0!important;background:transparent;color:#eee;font:14px/1.6 var(--font-sans)}.chat-composer>div{display:flex;gap:12px;align-items:center;padding:0 12px 10px}.chat-composer>div>span{flex:1;font-size:9px;color:#777}.chat-composer [data-send]{background:#e8e8e8;color:#111;font-size:12px;font-weight:600;border-color:white}.chat-attach{font-size:25px;cursor:pointer;padding:0 6px}.chat-hint{display:block;text-align:center;color:#666;font-size:9px;margin-top:8px}.chat-attachments{display:flex;gap:8px;flex-wrap:wrap}.chat-attachment{font-size:10px;border:1px solid #555;padding:4px 7px;margin-bottom:8px;max-width:100%;overflow-wrap:anywhere}.chat-attachment button{border:0;padding:2px 5px}.chat-file{display:flex;flex-wrap:wrap;align-items:center;gap:10px;max-width:420px;margin-top:12px;border:1px solid #444;padding:10px}.chat-file .chat-image-open{border:0;padding:0;width:100%}.chat-file img{max-width:100%;max-height:300px;object-fit:contain;display:block}.chat-file video{width:100%;max-height:300px}.chat-file audio{width:100%}.chat-file a{color:#ddd;font-size:11px;overflow-wrap:anywhere}.chat-file small{color:#888;font-size:9px}.chat-shell.sidebar-collapsed{grid-template-columns:0 minmax(0,1fr)}.sidebar-collapsed .chat-sidebar{opacity:0;pointer-events:none}.chat-empty{font-size:12px;color:#777;text-align:center}.drop-target{outline:1px dashed white!important;background:#242424!important}.chat-dialog{margin:auto;background:#101010;color:#eee;border:1px solid #777;padding:28px;width:min(440px,90vw);font:14px/1.7 var(--font-sans)}.chat-dialog::backdrop{background:#000b;backdrop-filter:blur(5px)}.chat-dialog h2{font-size:20px;margin:0 0 16px}.chat-dialog p{color:#aaa}.chat-dialog input{width:100%;font:inherit;background:#181818;color:white;padding:10px;border:1px solid #777}.chat-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.chat-menu{position:fixed;z-index:10020;background:#151515;color:white;border:1px solid #777;padding:6px;min-width:180px;box-shadow:8px 8px 0 #0008;font:12px var(--font-sans);max-height:70vh;overflow:auto}.chat-menu button{display:block;width:100%;text-align:left;border:0;padding:10px 12px}.chat-preview{width:min(1000px,90vw);max-height:85vh}.chat-preview>img{max-width:100%;max-height:65vh;object-fit:contain;display:block;margin:auto}.chat-preview-close{float:right}.account-cards{display:grid;gap:12px;margin:20px 0}.account-card{display:flex;align-items:center;gap:14px;border:1px solid #444;padding:14px;flex-wrap:wrap}.account-card img,.account-avatar-preview{width:48px;height:48px;object-fit:cover;border-radius:50%;border:1px solid #777}.account-card>div{flex:1;min-width:100px}.account-card small{display:block}.account-card button{font-size:11px!important;padding:6px 10px!important}.account-create{display:grid;gap:12px;max-width:440px;margin:16px 0}.chat-shell .cm-s-default .cm-string{color:#d4b68c}.chat-shell .cm-s-default .cm-number{color:#b5a7df}.chat-shell .cm-s-default .cm-keyword,.chat-shell .cm-s-default .cm-atom{color:#9dbbe4}.chat-shell .cm-s-default .cm-property{color:#d7d7a4}.chat-shell .cm-s-default .cm-comment{color:#888}
@media(max-width:900px){.chat-shell{grid-template-columns:215px minmax(0,1fr)}.chat-messages{padding:20px}.chat-bottom{padding-inline:15px}.chat-header{padding-inline:15px}}
@media(max-width:600px){.chat-shell{grid-template-columns:180px minmax(0,1fr);height:calc(100dvh - 150px);min-height:320px;position:relative}.chat-shell:not(.sidebar-collapsed) .chat-main{min-width:240px}.chat-messages{padding:16px 12px}.chat-avatar{width:26px;height:26px}.chat-message{gap:9px}.chat-composer>div>span{display:none}.chat-composer [data-send]{margin-left:auto}.chat-header h2{font-size:14px}.chat-welcome h2{font-size:20px}.chat-shell:not(.sidebar-collapsed) .chat-sidebar{position:absolute;z-index:3;inset:0 auto 0 0;width:230px;background:#111;box-shadow:20px 0 40px #000b}.chat-shell{grid-template-columns:0 minmax(0,1fr)}}
@media(prefers-reduced-motion:reduce){.chat-shell,.chat-shell *{transition:none!important;scroll-behavior:auto!important}}

#settingsAccount>details{border:1px solid #444;padding:14px 16px;margin:16px 0}#settingsAccount summary{cursor:pointer;font-weight:600}#settingsAccount details[open]>form{margin-top:16px}#settingsAccount>h3:not(:first-child){font-size:14px;margin-top:25px}#settingsAccount>details[open]{animation:account-open .28s ease-out}@keyframes account-open{from{transform:translateY(8px);opacity:.5}to{transform:none;opacity:1}}

.chat-shell [data-hide-sidebar]{display:none}.chat-sidebar>header>span{flex:1}
@media(max-width:600px){.chat-shell [data-hide-sidebar]{display:block}.chat-shell:not(.sidebar-collapsed) .chat-main{min-width:0}.chat-shell .chat-sidebar{transition:transform .3s,opacity .25s}.chat-shell.sidebar-collapsed .chat-sidebar{transform:translateX(-100%)}body:has(#view-chat.active) .overline-metrics{display:none}.chat-message-content>header{flex-wrap:wrap;gap:5px}.chat-message-content>header strong{overflow-wrap:anywhere}}

/* Pending attachments share the monochrome CHAT surface and remain conversation scoped. */
.chat-attachments{display:flex;flex-wrap:nowrap;gap:10px;min-width:0;overflow-x:auto;max-height:112px;padding:6px 2px 10px;scrollbar-width:thin}
.chat-attachments:empty{display:none}
.chat-attachments .chat-attachment{display:flex;align-items:center;gap:12px;position:relative;margin:0;flex:0 0 230px;min-width:0;height:80px;padding:8px 30px 8px 8px;border:1px solid #555;border-radius:9px;background:#121212;box-sizing:border-box}
.chat-attachment .chat-attachment-visual{display:grid;place-items:center;flex:0 0 62px;width:62px;height:62px;padding:0;border:1px solid #444;border-radius:5px;overflow:hidden;background:#090909;color:#eee}
.chat-attachment button.chat-attachment-visual{cursor:zoom-in;transition:transform .2s ease,border-color .2s ease}
.chat-attachment button.chat-attachment-visual:hover{transform:scale(1.035);border-color:#ddd}
.chat-attachment-visual img{width:100%;height:100%;object-fit:contain;display:block}
.chat-attachment-icon{display:grid;place-items:center;width:40px;height:46px;color:#ddd}
.chat-attachment-icon svg{width:32px;height:36px}
.chat-attachment-details{display:grid;gap:7px;min-width:0;flex:1}
.chat-attachment-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#eee}
.chat-attachment-details small{font:9px var(--font-mono,monospace);color:#aaa;letter-spacing:.03em}
.chat-attachment .chat-attachment-remove{position:absolute;right:3px;top:3px;display:grid;place-items:center;width:24px;height:24px;min-height:0;padding:0;border:0;background:transparent;font-size:19px;line-height:1;color:#aaa;border-radius:4px;transition:color .2s,background .2s}
.chat-attachment .chat-attachment-remove:hover{color:white;background:#333}
.chat-attachment button:focus-visible{outline:2px solid #eee;outline-offset:2px}
@media(max-width:600px){.chat-attachments .chat-attachment{flex-basis:205px}}

/* Shared 36px action geometry keeps icons independent of font baselines. */
.chat-shell{border-color:#303030;border-radius:12px;grid-template-columns:242px minmax(0,1fr)}
.chat-sidebar{background:#101010}.chat-sidebar>header{padding:18px 14px;letter-spacing:1px;font-size:9px;justify-content:flex-start}.chat-sidebar>header>span{flex:1}
.chat-shell :is([data-new],[data-hide-sidebar],[data-collapse],[data-more],.chat-attach){display:inline-grid;place-items:center;width:34px;height:34px;min-width:34px;flex:0 0 34px;padding:0;border:1px solid #3d3d3d;border-radius:7px;line-height:1;vertical-align:middle}
.chat-shell svg{display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.chat-shell [data-hide-sidebar]{width:26px;min-width:26px;flex-basis:26px;border:0}.chat-search{margin:0 14px;border-radius:7px;padding:10px 12px;background:#151515;border-color:#333}.chat-search input{font-size:11px}
.chat-sidebar-tools{gap:8px;padding-block:14px}.chat-sidebar-tools button{border-radius:6px;font-size:10px;min-height:28px}.chat-thread{border-radius:7px;padding:12px!important}.chat-thread.active{background:#222;border-color:#484848!important}.chat-group-name{letter-spacing:.04em}.chat-sidebar>footer{font-size:11px}.chat-sidebar>footer small{display:none}
.chat-header{padding:16px 22px;border-bottom-color:#272727}.chat-header h2{font-size:17px}.chat-header small{font-size:8px}.chat-header [data-more]{border-color:transparent}
.chat-welcome{min-height:180px}.chat-welcome img{width:90px;height:90px;transform:rotate(-5deg)}.chat-welcome h2{font-size:clamp(21px,2.6vw,30px);letter-spacing:-.04em;margin:12px 0}.chat-welcome p{color:#999;font-size:12px;margin:0}
.chat-messages{padding-top:32px;padding-bottom:12px}.chat-message{margin-bottom:30px}.chat-message.user .chat-markdown{border-radius:2px 13px 13px 13px;border-color:#303030}.chat-message-content>header{margin-top:4px}.chat-avatar{width:30px;height:30px}.chat-message footer button{opacity:.6;transition:opacity .2s}.chat-message:hover footer button,.chat-message:focus-within footer button{opacity:1}
.chat-bottom{padding-bottom:18px}.chat-bottom [role=status]:empty{min-height:0;margin:0}.chat-bottom [role=status]{padding-inline:4px}.chat-composer{border-radius:12px;background:#141414;border-color:#555;box-shadow:0 8px 30px #0004;overflow:hidden}.chat-composer textarea{min-height:72px;padding:16px 18px;resize:none;field-sizing:content;max-height:160px}.chat-composer:focus-within{border-color:#aaa;box-shadow:0 8px 32px #0006}.chat-composer>div{padding:0 12px 12px;gap:8px}.chat-composer [data-send]{margin-left:auto;min-height:34px;padding:7px 14px;border-radius:7px;line-height:1.3}.chat-composer [data-stop]{margin-left:auto;border-radius:7px}.chat-composer [data-stop]:not([hidden])+[data-send]{margin-left:0}.chat-attach:hover{background:#292929}
.chat-preview{box-sizing:border-box;padding:0;width:min(920px,calc((100vw - 32px)/var(--ui-scale,var(--ui-default-scale,1))))!important;height:calc((100dvh - 64px)/var(--ui-scale,var(--ui-default-scale,1)));max-height:calc((100dvh - 64px)/var(--ui-scale,var(--ui-default-scale,1)))!important;overflow:hidden;border-radius:10px}
.chat-preview[open]{display:flex;flex-direction:column}.chat-preview-header{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:12px 16px;flex:none;border-bottom:1px solid #333}.chat-preview-header>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;min-width:0}.chat-preview .chat-preview-close{float:none;display:grid;place-items:center;flex:none;width:34px;height:34px;padding:0;font-size:23px;line-height:1;border-radius:6px}.chat-preview-stage{min-height:0;min-width:0;flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;padding:16px}.chat-preview-stage>img{display:block;max-width:100%;max-height:100%;width:100%;height:100%;object-fit:contain}
.chat-toast{position:fixed;right:20px;bottom:20px;z-index:10050;max-width:320px;display:grid;grid-template-columns:1fr auto;gap:8px;padding:16px;background:#171717;color:#fff;border:1px solid #777;border-radius:10px;box-shadow:0 10px 50px #0009}.chat-toast button{color:inherit;background:transparent;border:0;cursor:pointer;text-align:left}.chat-toast strong{display:block;margin-bottom:6px}.chat-toast small{color:#bbb}.chat-thread.is-unread strong::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:#eee;margin-right:7px}
@media(max-width:600px){.chat-shell{grid-template-columns:190px minmax(0,1fr);border-radius:9px}.chat-shell:not(.sidebar-collapsed) .chat-sidebar{position:absolute;inset:0 auto 0 0;width:min(270px,85%);z-index:5;box-shadow:20px 0 60px #000a}.chat-shell:not(.sidebar-collapsed){grid-template-columns:0 minmax(0,1fr)}.chat-shell:not(.sidebar-collapsed) .chat-main{min-width:0}.chat-header{padding:12px}.chat-bottom{padding:0 10px 12px}.chat-composer textarea{font-size:14px}.chat-preview{height:calc((100dvh - 32px)/var(--ui-scale,var(--ui-default-scale,1)))}.chat-toast{right:12px;bottom:12px;max-width:calc(100% - 24px)}}
@media(prefers-reduced-motion:reduce){.chat-shell,.chat-shell *{transition:none!important}}

/* Conversation fills the available page; only the message list scrolls. */
html:has(body.chat-active){overflow:hidden;min-height:0}
.chat-message footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.chat-message footer .chat-error{flex-basis:100%;overflow-wrap:anywhere}
.chat-message .chat-edited{font-size:9px;color:#999}
.chat-message .chat-withdrawn{font-size:12px;color:#999;font-style:italic;padding:6px 0}
.chat-dialog .chat-edit-text{display:block;box-sizing:border-box;width:100%;max-height:45dvh;min-height:120px;resize:vertical;padding:12px;border:1px solid #777;border-radius:6px;background:#171717;color:#eee;font:inherit}
body.chat-active{display:flex;flex-direction:column;height:var(--chat-viewport-height,calc(100dvh / var(--ui-scale,var(--ui-default-scale,1))));min-height:0;overflow:hidden;padding:0}
.chat-active .editorial-topbar{position:relative;flex:none}
.chat-active .telemetry-overline-strip,.chat-active .editorial-footer-ticker{display:none}
.chat-active .editorial-viewport{flex:1;min-height:0;padding:16px var(--page-gutter);overflow:hidden}
.chat-active #view-chat{height:100%;min-height:0}
.chat-shell{position:relative;height:100%;min-height:0;isolation:isolate}
.chat-messages{overscroll-behavior:contain;overflow-anchor:none}
.chat-message{gap:12px}.chat-message-content{flex:0 1 auto;max-width:min(86%,680px)}
.chat-message.user{flex-direction:row-reverse}.chat-message.user .chat-message-content{margin-left:auto}
.chat-message.user .chat-message-content>header,.chat-message.user footer{justify-content:flex-end}
.chat-message .chat-markdown{padding:12px 16px;border:1px solid #3c3c3c;border-radius:4px 16px 16px 16px;background:#181818;color:#e4e4e4}
.chat-message.user .chat-markdown{background:#e4e2df;color:#191919;border-color:#e4e2df;border-radius:16px 4px 16px 16px}
.chat-message.user .chat-markdown a{color:inherit}.chat-message.user .chat-markdown pre{color:#ddd}
@media(max-width:760px){
 .chat-active .editorial-viewport{padding:0 0 6px}.chat-shell{border-radius:0;border-inline:0;grid-template-columns:0 minmax(0,1fr)}
 .chat-shell:not(.sidebar-collapsed) .chat-sidebar{position:absolute;inset:0 auto 0 0;width:min(280px,86%);z-index:5;box-shadow:20px 0 60px #000a}
 .chat-messages{padding:18px 10px 8px;scrollbar-gutter:auto}.chat-message{gap:8px;margin-bottom:22px}
 .chat-message-content{max-width:calc(100% - 36px)}.chat-avatar{width:26px;height:26px}
 .chat-message .chat-markdown{font-size:14px;padding:10px 12px}.chat-header{padding:10px 12px}.chat-bottom{padding:0 10px 10px}
 .chat-message-content>header{gap:8px}.chat-message-content time{font-size:8px}
}

/* A single, compact action rail with equal targets on all clients. */
.chat-message footer{column-gap:4px;row-gap:6px;align-items:center}
.chat-message footer .chat-message-action{display:inline-flex;align-items:center;justify-content:center;flex:0 0 32px;width:32px;height:32px;padding:0;border:1px solid transparent;border-radius:8px;color:#969696;line-height:1;transition:color .18s,background .18s,transform .22s,border-color .18s}
.chat-message footer .chat-message-action svg{display:block;width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.chat-message footer .chat-message-action:hover{color:#fff;background:#ffffff0c;border-color:#ffffff22;transform:translateY(-2px)}
.chat-message footer .chat-message-action:active{transform:scale(.9)}
.chat-message footer .chat-message-action:disabled{opacity:.35;transform:none}
@media(max-width:600px){.chat-message footer .chat-message-action{flex-basis:38px;width:38px;height:38px}.chat-message footer .chat-message-action svg{width:18px;height:18px}}
@media(prefers-reduced-motion:reduce){.chat-message footer .chat-message-action{transition:none;transform:none}}
