dialog.waga-chat{box-sizing:border-box;position:fixed;inset:auto 28px 28px auto;margin:0;width:440px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:0;border:1px solid #b8cbd3;border-radius:24px;background:#f1f5f5;color:#293e4a;box-shadow:0 18px 70px #193b4b30;overflow:auto;font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif}
.waga-chat::backdrop{background:#18334120;backdrop-filter:blur(3px)}
.waga-chat .waga-header{display:flex;gap:12px;justify-content:space-between;align-items:flex-start;padding:25px 24px 20px;border-bottom:1px solid #cddce1}
.waga-chat h2{margin:0;font-size:27px;letter-spacing:.03em}.waga-chat h2 span{font-family:-apple-system,"PingFang SC",sans-serif;font-size:13px;letter-spacing:0}
.waga-chat p{margin:0;font-size:12px;line-height:1.7;color:#607985}.waga-header p{margin-top:8px}.waga-chat button{cursor:pointer;font:inherit;color:inherit}.waga-chat button:focus-visible,.waga-chat textarea:focus-visible{outline:2px solid #527989;outline-offset:3px}
.waga-close{flex:none;width:40px;height:40px;border:0;border-radius:50%;background:#dfe9ec;font-size:26px!important}
.waga-body{padding:22px 24px}.waga-welcome{padding:19px 20px;border-radius:18px;background:#e2ecef;font-size:15px;line-height:1.95}.waga-chat .waga-preview{margin-top:16px}.waga-prompts{display:flex;flex-wrap:wrap;gap:9px;margin-top:18px}.waga-prompts button{padding:9px 13px;border:1px solid #c0d2da;border-radius:18px;background:transparent;font-size:13px}.waga-prompts button:hover{background:#e2ecef}
.waga-form{padding:0 24px 22px}.waga-compose{display:flex;align-items:center;gap:8px;padding:9px 10px 9px 15px;border:1px solid #afc4cf;border-radius:18px;background:#fbfdfd}.waga-compose textarea{font:inherit;font-size:16px;line-height:1.5;resize:none;width:100%;min-width:0;border:0;outline:0;background:transparent;color:#293e4a}.waga-compose button{border:0;border-radius:50%;width:40px;height:40px;flex:none;background:#426575;color:white;font-size:23px}.waga-chat .waga-status{margin-top:10px}.waga-chat .waga-note{margin-top:8px;font-size:10px;color:#74858c}.waga-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-width:650px){dialog.waga-chat{inset:auto 12px 12px;max-width:none;width:calc(100% - 24px);max-height:calc(100dvh - 24px);border-radius:22px}.waga-chat .waga-header{padding:20px 18px 16px}.waga-body{padding:18px}.waga-form{padding:0 18px 18px}.waga-welcome{font-size:14px;padding:16px}.waga-chat h2{font-size:25px}}

.waga-messages{display:grid;gap:14px;margin-top:22px}.waga-message{white-space:pre-wrap;font-size:14px;line-height:1.9;padding:15px 17px;border-radius:17px;overflow-wrap:anywhere}.waga-user{background:#426575;color:white;margin-left:28px}.waga-assistant{background:#e2ecef;margin-right:6px}.waga-error{color:#805446}.waga-sources{margin-top:14px;border-top:1px solid #bdcfd6;padding-top:10px;display:grid;gap:8px;white-space:normal}.waga-sources small{color:#607985}.waga-sources a{font-size:12px;text-decoration:underline;text-underline-offset:3px}.waga-compose button:disabled{opacity:.45;cursor:wait}
/* Keep close and compose controls visible while long answers scroll. */
dialog.waga-chat[open]{display:flex;flex-direction:column;height:min(740px,calc(100dvh - 32px));overflow:hidden}
.waga-chat .waga-header,.waga-chat .waga-form{flex:none}.waga-chat .waga-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
@media(max-width:650px){dialog.waga-chat[open]{height:min(780px,calc(100dvh - 24px))}}

/* Window controls and a top-left grip, anchored to the lower-right corner. */
.waga-window-actions{display:flex;align-items:center;gap:7px;flex:none}
.waga-expand{border:0;border-radius:20px;padding:0 12px;height:40px;background:#dfe9ec;font-size:12px!important;white-space:nowrap}
.waga-chat .waga-header>div:first-child{min-width:0}.waga-chat .waga-header h2 span{display:block;margin-top:5px}
.waga-resize{position:absolute;left:0;top:0;width:25px;height:25px;padding:0;border:0;background:transparent;color:#607985!important;cursor:nwse-resize!important;touch-action:none;font-size:17px!important;z-index:2}
.waga-chat .waga-header{padding-left:30px}
dialog.waga-chat.waga-expanded[open]{inset:8px!important;width:calc(100vw - 16px)!important;height:calc(100dvh - 16px)!important;max-width:none;max-height:none;border-radius:18px}
.waga-expanded .waga-resize{display:none}.waga-expanded .waga-body,.waga-expanded .waga-form{width:100%;max-width:1000px;box-sizing:border-box;margin-left:auto;margin-right:auto}
@media(max-width:650px){.waga-resize{display:none}.waga-chat .waga-header{padding-left:18px}.waga-window-actions{gap:5px}.waga-expand{padding:0 10px}dialog.waga-chat:not(.waga-expanded){width:calc(100% - 24px)!important;max-height:calc(100dvh - 24px)}}

.waga-restart{border:0;border-radius:20px;padding:0 10px;height:40px;background:#dfe9ec;font-size:12px!important;white-space:nowrap}.waga-restart:hover{background:#cddde3}
@media(max-width:650px){.waga-chat .waga-header{flex-wrap:wrap}.waga-window-actions{margin-left:auto}}

/* Slightly smaller reading text; keep the input at 16px to avoid mobile focus zoom. */
.waga-chat .waga-welcome{font-size:14px;line-height:1.85}
.waga-chat .waga-message{font-size:13px;line-height:1.85}
.waga-chat .waga-prompts button{font-size:12px}
@media(max-width:650px){
 .waga-chat h2{font-size:23px}
 .waga-chat h2 span{font-size:12px}
 .waga-chat .waga-welcome{font-size:13px}
 .waga-chat .waga-preview,.waga-chat .waga-status,.waga-chat .waga-header p{font-size:11px}
 .waga-chat .waga-restart{font-size:11px!important}
}

/* Show focus on the rounded compose container instead of the inner textarea. */
.waga-chat .waga-compose textarea:focus,
.waga-chat .waga-compose textarea:focus-visible{outline:none;box-shadow:none}
.waga-chat .waga-compose{transition:border-color .18s ease,box-shadow .18s ease}
.waga-chat .waga-compose:focus-within{border-color:#527989;box-shadow:0 0 0 1px #52798940}
