.ai-chat{display:flex;flex-direction:column;height:calc(100dvh - 190px);min-height:520px;max-height:1100px;background:#fff;border:1px solid #dce5eb;border-radius:18px;overflow:hidden}
.ai-chat-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 24px;border-bottom:1px solid #edf1f4}.ai-chat-toolbar strong,.ai-chat-toolbar small{display:block}.ai-chat-toolbar small{margin-top:6px;color:#748693}.ai-chat-actions{display:flex;gap:8px}
.ai-chat-messages{flex:1;min-height:0;overflow:auto;padding:24px max(24px,calc((100% - 840px)/2));scroll-behavior:smooth}.ai-chat-empty{display:flex;min-height:260px;height:100%;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:#53706d}.ai-chat-empty>span{font-size:42px;color:#197267}.ai-chat-empty h2{margin:16px 0 8px}
.ai-chat-turn{margin-bottom:32px}.ai-chat-user{margin-left:auto;max-width:80%;width:fit-content;background:#edf6f3;padding:14px 18px;border-radius:18px 18px 4px 18px}.ai-chat-user>span{font-size:12px;color:#637c79}.ai-chat-user p{white-space:pre-wrap;margin:8px 0}.ai-chat-user img{display:block;max-width:180px;max-height:180px;object-fit:contain;margin-top:10px;border-radius:10px}.ai-chat-assistant{margin-top:22px;line-height:1.7}.ai-chat-assistant img{display:block;width:auto;max-width:100%;max-height:430px;border-radius:12px;margin:14px 0}.ai-chat-assistant small{display:block;color:#7a8790}.ai-chat-working{color:#197267}
.ai-chat-composer{flex:none;margin:0 24px 18px;border:1px solid #ceddd8;border-radius:16px;padding:12px 16px;box-shadow:0 4px 16px #173e3510}.ai-chat-composer textarea{border:0;resize:none;width:100%;padding:10px 0;box-shadow:none;outline-offset:2px;background:transparent}.ai-chat-source{display:flex;align-items:center;gap:10px;font-size:12px;color:#70867d}.ai-chat-source img{width:44px;height:44px;object-fit:contain;border-radius:6px}.ai-chat-composer-actions{display:flex;align-items:center;gap:12px}.ai-chat-composer-actions>button{margin-left:auto}.ai-upload-button{display:inline-flex!important;align-items:center;cursor:pointer;margin:0!important;color:#176f61;position:relative;overflow:hidden}.ai-upload-button input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%}.ai-chat-composer [data-edit-status]{font-size:13px;margin:6px 0 0}.ai-chat-composer [data-edit-status]:empty{display:none}
.ai-history-dialog{border:1px solid #d9e4df;border-radius:18px;padding:24px;width:min(620px,90vw);max-height:80dvh;color:#183b45}.ai-history-dialog::backdrop{background:#10242b66}.ai-history-heading{display:flex;justify-content:space-between;align-items:center}.ai-history-item{display:block;width:100%;text-align:left;background:#f4f8f6;color:#214a46;margin:10px 0;padding:16px;border:1px solid #dce9e3;border-radius:12px}.ai-history-item small{display:block;margin-top:8px;color:#758982}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:700px){.ai-chat-toolbar{padding:12px;align-items:flex-start}.ai-chat-actions{flex-wrap:wrap;justify-content:flex-end}.ai-chat-messages{padding:18px}.ai-chat-composer{margin:0 10px 10px;padding:10px}.ai-chat{height:calc(100dvh - 140px)}.ai-chat-user{max-width:95%}.ai-chat-composer-actions .muted{display:none}}

/* Keep the conversation header and composer outside the only scrolling region. */
.shell main>#content:has(>.ai-chat){display:flex;flex-direction:column;overflow:hidden}
.shell main>#content>.ai-chat{flex:1 1 0;min-height:0;height:100%;max-height:none;width:100%}
.ai-chat-toolbar{flex:0 0 auto;min-width:0}
.ai-chat-toolbar>div:first-child{min-width:0}
.ai-chat-toolbar [data-chat-title]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-chat-actions{flex-shrink:0}
.ai-chat-messages{flex:1 1 0;min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#b9c9c4 transparent}
.ai-chat-composer{flex:0 0 auto;min-width:0}
@media(max-height:650px){.ai-chat-toolbar{padding:10px 16px}.ai-chat-composer{margin:0 12px 10px;padding:8px 12px}.ai-chat-composer textarea{height:64px;min-height:0}.ai-chat-source img{width:32px;height:32px}}
