:root{color-scheme:light;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#fff;color:#172438;font-synthesis:none}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%;margin:0}
body{overflow:hidden}
button,select,textarea{font:inherit}
button,summary,select{cursor:pointer}
button{border:1px solid #dce4ed;border-radius:10px;background:#fff;color:#40536b;padding:8px 12px}
button:hover,summary:hover{background:#f1f5fa}
button:disabled,select:disabled{opacity:.45;cursor:default}
button:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid #3979c7;outline-offset:3px}
.shell{display:flex;flex-direction:column;width:100%;height:100dvh;min-height:0;overflow:hidden}
header{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:0 0 62px;padding:0 clamp(18px,4vw,64px);border-bottom:1px solid #edf0f5}
.brand{display:flex;align-items:baseline;gap:6px;font-size:19px;font-weight:750;letter-spacing:.04em;white-space:nowrap}
.brand>span{font-weight:400;color:#245ca8}
.brand small{margin-left:10px;background:#f0f4f9;border-radius:999px;padding:4px 9px;color:#718198;font-size:10px;font-weight:500;letter-spacing:0}
header nav{display:flex;align-items:center;gap:8px;font-size:13px}
header nav a{color:#49607b;text-decoration:none;border-radius:999px;padding:8px 12px}
header nav a:hover{background:#f0f5fb}
header nav #register-link{background:#f0f5fb;color:#245ca8;font-weight:600}
header button{border-radius:999px;font-size:12px}
.intro{display:none}
.conversation{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:28px max(24px,calc((100vw - 900px)/2)) 24px}
#messages{display:flex;flex-direction:column;gap:26px;min-width:0}
.empty{font-size:clamp(20px,3vw,28px);font-weight:500;color:#59697f;text-align:center;margin:clamp(40px,20vh,200px) 0 20px}
.exchange{display:flex;flex-direction:column;gap:14px;padding:0 0 20px;min-width:0}
.question-row{display:flex;justify-content:flex-end;align-items:center;gap:7px}
.question{margin:0;padding:11px 16px;border-radius:18px;background:#f1f4f8;color:#26384f;max-width:80%;font-size:15px;font-weight:500;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}
.answer{margin:0;color:#203148;line-height:1.85;font-size:16px;white-space:pre-wrap;overflow-wrap:anywhere}
.source{font-size:11px;line-height:1.6;color:#8290a3;margin:-4px 0 0;overflow-wrap:anywhere}
.source-link{display:block;margin-top:4px}
.source-link a{color:#3e73aa;text-decoration:none}
.source-link a:hover{text-decoration:underline}
.answer-actions{display:flex;margin-top:-8px}
.copy-icon{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;padding:5px;border:0;border-radius:8px;background:transparent;color:#8997aa;flex:none}
.copy-icon:hover{color:#31597e;background:#f1f5fa}
.copy-icon.copied{color:#16804b}
#chat-form{position:relative;flex:0 0 auto;width:min(920px,calc(100% - 36px));margin:0 auto 6px;padding:12px 14px 10px;border:1px solid #dce3ec;border-radius:22px;background:#fff;box-shadow:0 6px 26px #233b5610}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#question{display:block;width:100%;border:0;background:transparent;color:#203148;outline:none;box-shadow:none;resize:none;min-height:52px;height:60px;max-height:24dvh;padding:4px 3px 8px;line-height:1.5;font-size:16px}
#question::placeholder{color:#98a3b2}
#question:focus-visible{outline:none}
.composer-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-top:5px;min-width:0}
/* Keep answer/output controls beside Send, rather than occupying chat space. */
.composer-tools{flex:1 1 auto}
#ask{margin-left:auto}
@media(max-width:600px){.composer-footer{align-items:center}.composer-tools{flex-wrap:nowrap;overflow:visible}.tool-select{flex:0 1 auto}.tool-select select{max-width:76px}.settings-panel{right:0;bottom:48px;max-height:50dvh}.settings-help{display:none}}
@media(max-width:390px){.tool-select select{max-width:64px;font-size:11px}.composer-settings summary{width:30px}}
.composer-tools{display:flex;align-items:center;gap:7px;min-width:0}
.attachment-tools{position:relative;display:flex;align-items:center}
#add-attachment{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:0;border-radius:50%;padding:0;font-size:25px;line-height:1;color:#71839b}
#attachment-menu{position:absolute;bottom:46px;left:0;display:flex;gap:5px;padding:8px;background:#fff;border:1px solid #e1e7ef;border-radius:13px;box-shadow:0 8px 24px #20344c1c;z-index:6}
#attachment-menu button{font-size:12px;white-space:nowrap}
.tool-select{display:flex;align-items:center;gap:5px;margin:0;border:1px solid #e5eaf1;background:#f8fafd;border-radius:999px;padding:0 8px 0 10px;height:34px;color:#7b8ba0;font-size:11px;white-space:nowrap}
.tool-select select{min-width:0;max-width:112px;height:32px;border:0;outline:none;background:transparent;color:#3e5571;padding:0 2px;font-size:12px}
.tool-select:focus-within{outline:2px solid #3979c7;outline-offset:2px}
.composer-settings{position:static}
.composer-settings summary{display:flex;align-items:center;justify-content:center;gap:5px;list-style:none;height:36px;padding:0 9px;border-radius:999px;color:#788aa1;font-size:12px;user-select:none}
.composer-settings summary::-webkit-details-marker{display:none}
.composer-settings summary>span:first-child{font-size:18px;line-height:1}
.composer-settings[open] summary{background:#edf3fa;color:#245ca8}
.settings-panel{position:absolute;z-index:8;right:12px;bottom:57px;width:min(350px,calc(100vw - 44px));max-height:min(410px,55dvh);overflow:auto;border:1px solid #e1e7ef;border-radius:16px;padding:18px;background:#fff;box-shadow:0 14px 50px #20344c25}
.settings-heading{font-weight:650;font-size:14px;margin-bottom:16px}
.refresh-setting{display:flex;align-items:flex-start;gap:9px;font-size:13px;color:#344b67;line-height:1.5;cursor:pointer}
.refresh-setting input{width:17px;height:17px;accent-color:#2f6ebd;margin:2px 0 0;flex:none}
.refresh-setting small{display:block;margin-top:3px;color:#8b98aa;font-size:11px}
#knowledge-status,.settings-help{color:#8997a9;font-size:11px;line-height:1.6;margin:14px 0 0}
.settings-help strong{font-weight:600;color:#65768d}
#clear-knowledge{font-size:12px;margin-top:14px;padding:7px 10px;color:#64758b}
#ask{display:flex;align-items:center;justify-content:center;gap:7px;flex:none;min-width:79px;height:36px;padding:0 14px;border:0;border-radius:999px;background:#2b67b4;color:#fff;font-size:13px;font-weight:600}
#ask:hover{background:#215999}
#ask>span:last-child{font-size:19px;line-height:1}
#attachment-preview{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:8px}
#attachment-preview img{width:auto;max-width:100px;max-height:80px;object-fit:contain;border:1px solid #e1e7ef;border-radius:10px}
#attachment-preview button{font-size:11px;padding:6px 9px}
#attachment-note{font-size:11px;line-height:1.5;color:#72839a;margin-bottom:6px}
#attachment-note:empty{display:none}
.status{width:min(920px,calc(100% - 36px));flex:0 0 auto;min-height:15px;max-height:36px;overflow:auto;margin:0 auto 7px;text-align:center;font-size:10px;line-height:1.5;color:#99a5b4}
#check-pending{flex:0 0 auto;align-self:center;margin:0 auto 8px;padding:6px 11px;border-radius:999px;font-size:11px}
.generated-visual{margin:10px 0;padding:10px;border:1px solid #e1e7ef;border-radius:14px;background:#fff;max-width:100%;overflow:hidden}
.generated-visual>svg{display:block;width:100%;height:auto}
.generated-visual table{width:100%;border-collapse:collapse;font-size:12px;margin:10px 0}
.generated-visual caption{text-align:left;font-weight:600}
.generated-visual td,.generated-visual th{text-align:left;padding:5px 8px;border-bottom:1px solid #eef1f5;overflow-wrap:anywhere}
.visual-actions{display:flex;gap:8px;flex-wrap:wrap}
.visual-actions button{font-size:12px;padding:7px 10px}
@media(max-width:600px){
header{flex-basis:54px;padding:0 14px;gap:5px}.brand{font-size:17px}.brand small{margin-left:3px;padding:3px 6px;font-size:9px}
header nav{gap:2px;font-size:12px}header nav a{padding:7px 9px}
.conversation{padding:20px 15px}.empty{font-size:21px}.question{max-width:88%;font-size:14px}.answer{font-size:15px}
#chat-form{width:calc(100% - 20px);padding:11px 10px 8px;border-radius:19px}
.composer-footer{gap:6px}.composer-tools{gap:4px}
.tool-select{padding:0 5px 0 7px;height:34px}.tool-select>span{display:none}.tool-select select{max-width:99px;font-size:12px}
.settings-word{display:none}.composer-settings summary{width:34px;padding:0}
#ask{min-width:36px;width:36px;padding:0}.send-word{display:none}
.status{width:calc(100% - 20px);margin-bottom:5px}
}
@media(max-width:370px){.brand small{display:none}.tool-select select{max-width:80px}.composer-tools{gap:2px}}
@media(max-height:500px){header{flex-basis:44px}.conversation{padding-top:12px}#question{min-height:38px;height:42px}#chat-form{padding-top:7px}.empty{margin-top:35px}}

/* Show submitted photo in the chat, not in the unsent composer. */
.sent-photo{display:block;align-self:flex-end;max-width:min(260px,75%);max-height:220px;width:auto;height:auto;object-fit:contain;border:1px solid #dce4ed;border-radius:13px}

#open-image-library{display:block;margin:6px auto;border:1px solid #dce3ec;background:#fff;border-radius:12px;padding:8px 16px;color:#304b6d}
#image-library{width:min(920px,95%);margin:10px auto;padding:12px;border:1px solid #dce3ec;border-radius:15px;max-height:40vh;overflow:auto}
.library-card{padding:12px;border-bottom:1px solid #e4eaf1}
.library-card button{margin:8px}
