:root{color-scheme:dark;--bg:#212121;--sidebar:#171717;--surface:#303030;--hover:#2a2a2a;--text:#ececec;--muted:#aaa;--border:#424242;--accent:#fff;--accent-text:#171717;--error:#ffad99}
:root[data-theme=light],:root[data-theme=blue],:root[data-theme=green],:root[data-theme=amber]{color-scheme:light;--bg:#fff;--sidebar:#f9f9f9;--surface:#f4f4f4;--hover:#ececec;--text:#202020;--muted:#666;--border:#dedede;--accent:#202020;--accent-text:#fff;--error:#a12c20}
:root[data-theme=blue]{--bg:#f5faff;--sidebar:#eaf3fa;--surface:#e7f0f7;--accent:#155a80}
:root[data-theme=green]{--bg:#f6faf7;--sidebar:#eaf3ec;--surface:#e7f0e9;--accent:#256047}
:root[data-theme=amber]{--bg:#fffaf5;--sidebar:#fbefe4;--surface:#f7ede3;--accent:#855025}
#theme{display:none}
#preferences{position:relative;font-size:12px;margin-left:auto}
#preferences summary,#toolbox summary{cursor:pointer;padding:8px 12px;border:1px solid var(--border);border-radius:12px;width:fit-content}
#preferences>div{position:absolute;right:0;top:42px;z-index:20;background:var(--bg);border:1px solid var(--border);border-radius:16px;box-shadow:0 10px 30px #0002;padding:18px;width:250px}
#preferences label{display:flex;justify-content:space-between;gap:10px;align-items:center;margin:0 0 12px}
#toolbox{position:relative;font-size:12px;margin-bottom:8px}
#toolbox[open]>div{position:absolute;bottom:42px;background:var(--bg);border:1px solid var(--border);border-radius:12px;padding:14px;z-index:10;max-width:100%}
#mode-description{display:none}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
body{display:flex;height:100dvh;overflow:hidden}
button,input,textarea,select{font:inherit}
button,select{cursor:pointer}
button{color:var(--text);background:transparent;border:0}
button:disabled,select:disabled{opacity:.4;cursor:not-allowed}
button:focus-visible,select:focus-visible,textarea:focus-visible,input:focus-visible,summary:focus-visible{outline:2px solid var(--muted);outline-offset:3px}
button:hover:not(:disabled){background:var(--hover)}
a{color:inherit}
aside{width:260px;flex:0 0 260px;display:flex;flex-direction:column;background:var(--sidebar);padding:14px 12px 12px}
.sidebar-top{display:flex;justify-content:space-between;align-items:center;margin:0 8px 18px}
.brand{display:flex;align-items:center;gap:10px;font-size:17px;font-weight:600;text-decoration:none}
.brand-symbol{width:30px;height:30px;flex:0 0 30px;border:1px solid var(--border);border-radius:9px;display:block;position:relative;overflow:hidden;background:var(--surface)}
.brand-symbol img{position:absolute;width:400%;max-width:none;height:auto;left:-150%;top:-40%;pointer-events:none}
.icon-button{width:36px;height:36px;border-radius:9px;font-size:20px;display:grid;place-items:center;flex-shrink:0}
#new{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:9px;text-align:left;font-size:14px;margin-bottom:20px}
#new span{font-size:23px;line-height:1}
.label{font-size:12px;color:var(--muted);font-weight:600;margin:8px 12px}
nav{overflow:auto;flex:1;min-height:0;scrollbar-width:thin;scrollbar-color:var(--border) transparent}
nav button{display:block;width:100%;text-align:left;padding:9px 12px;border-radius:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px;margin:1px 0}
nav button.active{background:var(--hover)}
footer{padding:14px 8px 0}
.account{display:flex;align-items:center;gap:10px;font-size:12px}
.account>div{min-width:0}
#account-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}
.account-avatar{background:#665b8a;color:#fff;width:32px;height:32px;border-radius:50%;display:grid;place-items:center;font-weight:600;flex-shrink:0}
.account small{color:var(--muted);font-size:11px}
#logout{font-size:11px;color:var(--muted);padding:5px 7px;margin:6px 0 0 35px;border-radius:6px}
main{flex:1;min-width:0;display:flex;flex-direction:column;height:100dvh}
header{min-height:64px;padding:12px 22px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.header-left{display:flex;gap:10px;align-items:center;min-width:0}
header strong{display:none;font-size:20px;font-weight:600}
select{color:var(--text);background:transparent;border:1px solid var(--border);border-radius:9px;padding:7px 10px;font-size:12px}
select option{background:var(--bg);color:var(--text)}
#provider{border:0;color:var(--muted);font-size:13px}
#query-modes{display:flex;flex-wrap:wrap;gap:12px;padding:10px 0;align-items:center;font-size:14px}
#query-modes label{cursor:pointer}
#query-modes input{accent-color:var(--accent)}
#mode-description{flex-basis:100%;color:var(--muted);font-size:12px}
#action-tools{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
#action-tools[hidden],#action-jobs[hidden]{display:none}
#action-jobs{max-height:380px;overflow:auto;margin-bottom:12px;border:1px solid var(--border);padding:10px;border-radius:12px}
.action-card{padding:12px;margin:8px 0;border:1px solid var(--border);border-radius:8px}
.action-card pre{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:13px}
.action-card button{margin-right:8px}
.action-card audio{max-width:100%;display:block;margin:8px 0}
#menu,#close-menu{display:none}
#messages{flex:1;min-height:0;overflow:auto;padding:12px max(24px,calc((100% - 768px)/2)) 28px;scroll-behavior:smooth;scrollbar-width:thin;scrollbar-color:var(--border) transparent}
#welcome{min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px 0 36px;text-align:center}
h1{font-size:32px;font-weight:600;line-height:1.25;letter-spacing:-.7px;margin:0 0 12px}
#welcome>p{color:var(--muted);margin:0;font-size:14px}
.suggestions{display:flex;gap:10px;margin-top:28px;max-width:580px}
.suggestions button{font-size:12px;line-height:1.5;border:1px solid var(--border);border-radius:16px;padding:13px 16px;flex:1;color:var(--muted)}
.msg{margin:20px 0 32px;line-height:1.75;overflow-wrap:anywhere}
.msg.user{background:var(--surface);padding:10px 18px;border-radius:22px;max-width:85%;width:fit-content;margin-left:auto;white-space:pre-wrap}
.msg.assistant{padding:0;white-space:normal}
.by{display:none}
.answer-body{font-size:15px;line-height:1.8}
.answer-body p{margin:0 0 16px}
.answer-body p:last-child{margin-bottom:0}
.answer-body h3{font-size:19px;line-height:1.4;margin:24px 0 12px}
.answer-body h3:first-child{margin-top:0}
.answer-body ul,.answer-body ol{padding-left:26px;margin:12px 0 20px}
.answer-body li{margin:8px 0;padding-left:2px}
.answer-body strong{font-weight:650}
.answer-body a{text-decoration:underline;text-underline-offset:3px}
.answer-body code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;background:var(--surface);border-radius:4px;padding:2px 5px;font-size:13px}
.answer-body pre{padding:16px;background:var(--sidebar);border:1px solid var(--border);border-radius:14px;overflow:auto;white-space:pre}
.answer-body pre code{background:none;padding:0}
.code-block{background:var(--sidebar);border:1px solid var(--border);border-radius:14px;overflow:hidden;margin:12px 0}
.code-toolbar{display:flex;justify-content:space-between;align-items:center;padding:8px 14px;font-size:11px;color:var(--muted);border-bottom:1px solid var(--border)}
.code-toolbar button{font-size:11px;border-radius:8px;padding:5px 10px}
.code-block pre{margin:0;border:0;border-radius:0}
.answer-image{display:block;max-width:100%;max-height:420px;object-fit:contain;border-radius:12px;margin:12px 0}
.copy{display:block;width:fit-content;font-size:11px;padding:6px 12px;margin-top:12px;border-radius:9px}
.copy,.code-toolbar button{color:var(--text);background:var(--surface);border:1px solid var(--border);box-shadow:0 2px 5px #00000014;transition:background .15s ease,box-shadow .15s ease}
.copy:hover:not(:disabled),.code-toolbar button:hover:not(:disabled){background:var(--hover);box-shadow:0 3px 8px #00000024}
.copy:active,.code-toolbar button:active{box-shadow:0 1px 2px #00000014}
.web-status{display:block;font-size:11px;color:var(--muted);margin-top:12px}
.sources{display:block;margin-top:10px;font-size:11px;line-height:1.6;color:var(--muted);white-space:normal}
.sources a{color:inherit;border:0;border-radius:0;padding:0;font-size:inherit;text-decoration:underline;text-decoration-color:var(--border);text-underline-offset:2px;overflow-wrap:anywhere}
.sources a:hover{color:var(--text);text-decoration-color:currentColor}
.ops-options{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.ops-options button,#ops-menu{font:inherit;font-size:12px;padding:7px 11px;border:1px solid var(--border);border-radius:16px;background:transparent;color:var(--text);cursor:pointer}
.ops-options button:disabled{opacity:.5;cursor:wait}
#ops-tools{font-size:12px;margin:0 0 10px;line-height:2}
#ops-tools label{margin-left:10px}
#ops-status{display:block;color:var(--muted)}
.pending{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:14px}
.pending::before{content:"";width:30px;height:30px;flex:0 0 30px;background:var(--surface) url('/static/linkito-noc.jpeg') 50% 12% / 400% auto;border:1px solid var(--border);border-radius:10px;animation:thinking 1.8s ease-in-out infinite}
@keyframes thinking{50%{opacity:.7;transform:scale(.95)}}
.composer{width:100%;max-width:816px;padding:0 24px 10px;margin:0 auto;flex-shrink:0}
#form{background:var(--surface);border:1px solid transparent;border-radius:28px;padding:12px 12px 10px;box-shadow:0 3px 15px #0000000d}
#form:focus-within{border-color:var(--border)}
textarea{display:block;width:100%;border:0;background:transparent;color:var(--text);resize:none;padding:4px 8px 12px;min-height:44px;max-height:180px;line-height:1.5;outline:none!important}
textarea::placeholder{color:var(--muted)}
textarea:disabled{cursor:wait;opacity:.7}
.composer-tools,.tools-left{display:flex;align-items:center;gap:8px}
.composer-tools{justify-content:space-between}
.tools-left{min-width:0}
#attach{font-size:27px;line-height:1;width:34px;height:34px;border-radius:50%;flex-shrink:0}
#saved-file{font-size:11px;max-width:170px;padding:5px;border-color:transparent}
.web-toggle{display:flex;align-items:center;gap:4px;font-size:12px;white-space:nowrap;color:var(--muted)}
.web-toggle input{accent-color:var(--muted);width:13px;height:13px}
#send{width:36px;height:36px;background:var(--accent);color:var(--accent-text);border-radius:50%;font-size:27px;line-height:1;flex-shrink:0}
#send:hover:not(:disabled){opacity:.85;background:var(--accent)}
#attachment{border:1px solid var(--border);border-radius:16px;padding:10px 14px;background:var(--surface);margin:0 0 10px;font-size:12px;max-height:140px;overflow:auto;overflow-wrap:anywhere}
.attachment-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}
#attachment-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#attachment-type{display:grid;place-items:center;flex:0 0 36px;height:36px;background:var(--bg);border:1px solid var(--border);border-radius:10px;font-size:9px;font-weight:700;color:var(--text)}
#attachment details{margin:6px 0 0 46px;color:var(--muted);font-size:11px}
#attachment summary{cursor:pointer}
.history-heading{font-size:11px;color:var(--muted);font-weight:600;margin:18px 12px 7px;letter-spacing:0}
.history-row{display:flex;align-items:flex-start;position:relative;gap:2px}
.history-row>button{flex:1;min-width:0;width:0;padding-right:6px}
.history-actions{flex:0 0 32px;margin-top:3px}
.history-actions summary{display:grid;place-items:center;list-style:none;height:32px;border-radius:8px;cursor:pointer;color:var(--muted)}
.history-actions summary::-webkit-details-marker{display:none}
.history-actions summary:hover{background:var(--hover);color:var(--text)}
.history-actions[open]{background:var(--surface);border:1px solid var(--border);border-radius:9px;flex-basis:92px}
.history-actions button{font-size:11px;padding:8px}
#chats>p{font-size:12px;color:var(--muted);padding:0 12px}
#attachment-details{white-space:pre-wrap;margin:6px 0 0;color:var(--muted);font-size:11px}
#remove-file{border-radius:6px;padding:3px 6px;font-size:11px;color:var(--muted);flex-shrink:0}
#error{font-size:12px;color:var(--error);margin:6px 6px 9px}
#error:empty{display:none}
.file-help{font-size:11px;color:var(--muted);margin:7px 8px 0;max-height:150px;overflow:auto}
.file-help summary{cursor:pointer;width:fit-content}
.file-help p{margin:8px 0}
.disclaimer{display:block;text-align:center;font-size:11px;color:var(--muted);padding-top:5px}
.auth-card{width:min(440px,calc(100% - 40px));margin:30px auto;overflow:auto;padding:24px;border:1px solid var(--border);border-radius:22px}
.auth-card>.label{margin:0}
.auth-card h2{font-size:26px;margin:8px 0}
.auth-card p{font-size:13px;color:var(--muted)}
.auth-tabs{display:flex;gap:8px;margin:20px 0}
.auth-tabs button{flex:1;border:1px solid var(--border);border-radius:10px;padding:9px}
.auth-card label{display:block;margin:12px 0;font-size:13px}
.auth-card input{display:block;width:100%;min-width:0;border:1px solid var(--border);background:var(--surface);color:var(--text);padding:12px;border-radius:10px;margin-top:5px}
#auth-submit{width:100%;padding:12px;border-radius:20px;background:var(--accent);color:var(--accent-text);font-weight:600;margin-top:6px}
.auth-links{display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-top:16px}
.auth-links button{font-size:12px;padding:3px;color:var(--muted)}
#auth-feedback{white-space:pre-wrap;line-height:1.6}
#auth-feedback:not(:empty){padding:14px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text);font-weight:600}
#auth-feedback[data-state="success"]{border-left:4px solid #258461}
#auth-feedback[data-state="error"]{border-left:4px solid #c43e36}
.auth-card .auth-privacy{font-size:11px;margin-top:20px}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#sidebar-overlay{position:fixed;inset:0;background:#0008;z-index:20}
@media(max-width:760px){
 body,main{height:var(--chat-height,100dvh)}
 main{position:fixed;left:0;right:0;top:var(--chat-offset,0px);width:100%;overflow:hidden}
 #messages{overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
 .composer{max-height:calc(var(--chat-height,100dvh) - 64px);overflow-y:auto;overscroll-behavior-y:contain;background:var(--bg)}
 #form{position:relative}
 #attach,#send,#menu,#close-menu{min-width:44px;min-height:44px}
 #input{max-height:min(120px,25dvh)}
 #action-jobs{max-height:24dvh}
 .auth-card input,.auth-card select{font-size:16px}
 #input{font-size:16px}
 aside{position:fixed;inset:0 auto 0 0;z-index:30;transform:translateX(-100%);transition:transform .18s}
 body.menu-open aside{transform:translateX(0)}
 #menu,#close-menu{display:grid}
 header{min-height:58px;padding:10px 12px}
 header strong{display:block;font-size:18px}
 .header-left{gap:6px}
 #messages{padding:12px 20px 20px}
 .composer{padding:0 12px max(9px,env(safe-area-inset-bottom))}
 h1{font-size:27px}
 #welcome>p{font-size:12px}
 .suggestions{flex-direction:column;max-width:280px;gap:8px;margin-top:22px}
 .suggestions button{padding:10px 14px}
 .answer-body{font-size:14px}
 .msg.user{max-width:90%}
 #saved-file{max-width:130px;font-size:10px}
 .tools-left{gap:4px}
 .web-toggle{font-size:11px}
 .disclaimer{font-size:10px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
.response-language{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:12px;color:var(--muted);margin:6px 0}
.response-language select{font:inherit;max-width:130px}
.response-language small{flex-basis:100%;font-size:10px}
:root[data-theme=violet],:root[data-theme=rose],:root[data-theme=slate]{color-scheme:light;--text:#202020;--muted:#666;--border:#dedede;--accent-text:#fff;--error:#a12c20}:root[data-theme=violet]{--bg:#f9f7fc;--sidebar:#f0eaf7;--surface:#efeaf7;--hover:#e5ddf1;--accent:#66518d}:root[data-theme=rose]{--bg:#fff7f8;--sidebar:#faedf0;--surface:#f8e9ed;--hover:#f1dce3;--accent:#92506b}:root[data-theme=slate]{--bg:#f6f8fa;--sidebar:#edf1f4;--surface:#e9eef2;--hover:#dce4ea;--accent:#465e70}
