:root{color-scheme:dark;--bg:#0b1020;--pane:#0d1423;--side:#0b1221;--border:rgba(185,201,232,.12);--text:#e9edf7;--muted:#8997b1;--accent:#7c83ff;--accent2:#b991ff;--good:#39cf95;--card:#141e30;--shadow:0 25px 100px rgba(0,0,0,.38)}*{box-sizing:border-box}body{margin:0;font-family:Inter,'Segoe UI',system-ui,-apple-system,sans-serif;background:var(--bg);color:var(--text);font-size:14px}button,input,select,textarea{font:inherit}button{cursor:pointer;color:inherit}button:disabled{opacity:.5;cursor:not-allowed}.hidden{display:none!important}.small{font-size:12px}.muted{color:var(--muted)}.eyebrow,.small-label{color:#9aa1ff;font-size:10px;font-weight:800;letter-spacing:2px}.auth-screen{min-height:100vh;display:grid;grid-template-columns:minmax(320px,52%) 1fr}.login-card{width:min(420px,85%);margin:auto}.brand-mark{width:48px;height:48px;border-radius:15px;background:linear-gradient(140deg,#727aff,#bb8bfa);display:grid;place-items:center;font-size:28px;color:white;box-shadow:0 10px 30px #5654ff33}.login-card .eyebrow{margin-top:30px}.login-card h1{font-size:clamp(34px,3.8vw,50px);letter-spacing:-2px;line-height:1.1;margin:14px 0 12px}.login-card>p.muted{line-height:1.8;margin:0 0 32px}.login-card form{display:flex;flex-direction:column}.login-card label,.settings-card label{font-weight:650;margin:17px 0 9px;color:#c7cee0}.login-card input,.settings-card input,.inline-form input{border:1px solid var(--border);background:#141d2e;color:var(--text);border-radius:12px;padding:16px;outline:none}.login-card input:focus,textarea:focus,.settings-card input:focus,.inline-form input:focus{border-color:var(--accent)}.primary{border:none;background:linear-gradient(100deg,#646ef3,#8a6cde);padding:12px 18px;border-radius:11px;font-weight:700;color:white}.primary.big{width:100%;margin-top:24px;padding:16px;display:flex;justify-content:space-between}.error{color:#ff9494;min-height:18px}.login-scenery{background:radial-gradient(ellipse at 75% 40%,#5244a866,transparent 43%),linear-gradient(155deg,#171e39,#0b1425);display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;overflow:hidden;border-left:1px solid var(--border)}.login-scenery .orb{width:240px;height:240px;border:1px solid #aca8ff55;border-radius:40%;transform:rotate(-28deg);display:grid;place-items:center;font-size:110px;color:#c5b7ff;box-shadow:inset 0 0 75px #9793ff44,0 0 120px #514eb044}.login-scenery p{font-size:42px;letter-spacing:-2px;font-weight:700;line-height:1.25;margin:58px 0 16px}.login-scenery span{font-size:10px;letter-spacing:4px;color:#919cb9}.workspace{height:100dvh;display:grid;grid-template-columns:270px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;background:var(--side);border-right:1px solid var(--border);padding:23px 13px 12px;min-height:0}.logo{display:flex;align-items:center;gap:10px;padding:2px 10px 27px;font-weight:850;font-size:19px;letter-spacing:-.5px}.logo em{font-size:9px;color:#a9a7ff;font-style:normal;letter-spacing:2px;margin-left:3px}.smallmark{width:32px;height:32px;border-radius:9px;font-size:19px}.new-chat{width:100%;text-align:left;background:#19213a;border:1px solid #3a456b;border-radius:11px;padding:13px 14px;font-weight:700}.new-chat:hover{background:#242f50}.small-label{color:#717f9b;letter-spacing:1.35px;margin:28px 13px 13px}.threads{overflow:auto;flex:1}.thread{width:100%;background:transparent;border:0;text-align:left;padding:12px 12px;border-radius:9px;display:flex;align-items:center;gap:10px;color:#a3b0c9;min-width:0}.thread span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.thread.active,.thread:hover{background:#20283f;color:#fff}.thread .del{opacity:0;color:#aab3cd;padding:2px 6px;border:0;background:transparent}.thread:hover .del{opacity:1}.sidebar-bottom{border-top:1px solid var(--border);padding-top:12px}.nav-pill{background:none;border:none;width:100%;text-align:left;padding:12px 10px;border-radius:8px;color:#9daac5}.nav-pill:hover{background:#1a2439;color:white}.profile{display:flex;align-items:center;border-top:1px solid var(--border);margin-top:10px;padding:15px 3px 3px;gap:10px}.avatar{height:35px;width:35px;background:#3c4169;border-radius:11px;display:grid;place-items:center;font-weight:800}.profile-name{flex:1;display:flex;flex-direction:column;gap:4px;min-width:0}.profile-name strong{overflow:hidden;text-overflow:ellipsis}.profile-name small{color:#8e9bb6}.profile>button{background:none;border:0;color:#9daac5;font-size:20px;padding:8px}.main{min-width:0;display:flex;flex-direction:column;background:linear-gradient(135deg,#101a2c 0,#0d1524 35%,#0c1421 100%)}.topbar{height:72px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0 28px;border-bottom:1px solid var(--border)}.topbar>div:first-of-type{display:flex;flex-direction:column;gap:4px;font-weight:700}.topbar small{font-size:11px;color:#7886a1;font-weight:500}.top-actions{display:flex;align-items:center;gap:9px}.top-status{font-size:12px;color:#a1adc0}.status-bullet{width:7px;height:7px;border-radius:50%;background:var(--good);box-shadow:0 0 12px #39cf957a}.icon-button{background:none;border:1px solid var(--border);border-radius:9px;padding:7px 11px;margin-left:12px;color:#aeb9d2;font-size:17px}.mobile{display:none}.chat-pane{min-height:0;display:flex;flex:1;flex-direction:column}.messages{flex:1;overflow-y:auto;padding:32px max(30px,calc((100% - 850px)/2));scrollbar-color:#3d4560 transparent}.welcome{text-align:center;margin:clamp(40px,12vh,130px) auto 30px;max-width:760px}.welcome-emblem{font-size:44px;color:#a8aaff;text-shadow:0 0 25px #8783ffaa}.welcome .eyebrow{margin-top:20px}.welcome h2{font-size:clamp(28px,4vw,39px);margin:13px 0;font-weight:720;letter-spacing:-1.3px}.welcome>p{color:#8d9ab3}.prompts{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:42px}.prompts button{text-align:left;border:1px solid var(--border);border-radius:12px;background:#152037;color:#c4cce0;padding:17px;font-size:13px}.prompts span{float:right;color:#9ca4ff}.prompts button:hover{border-color:#7379e9}.chat-message{display:flex;gap:14px;max-width:860px;margin:0 auto 26px;align-items:flex-start;white-space:pre-wrap;line-height:1.75;overflow-wrap:anywhere}.chat-message .bubble-icon{flex-shrink:0;display:grid;place-items:center;width:30px;height:30px;border-radius:10px;background:#3a436b;color:#cad3ff;font-size:15px;font-weight:800}.chat-message.assistant .bubble-icon{background:linear-gradient(130deg,#6973e9,#8f6de4);color:white}.chat-message .bubble-text{flex:1;min-width:0;padding-top:3px}.chat-message.user .bubble-text{color:#d7deef}.chat-message.assistant .bubble-text{color:#eef2f9}.chat-message.failed .bubble-text{color:#ff9292}.composer-wrap{width:min(900px,calc(100% - 46px));margin:auto auto 16px}.composer{border:1px solid #394362;border-radius:17px;background:#182238;box-shadow:0 8px 36px #0003;overflow:hidden;padding:5px 8px 9px}.composer:focus-within{border-color:#666ee9}.composer textarea{display:block;resize:none;background:none;border:none;width:100%;color:var(--text);padding:12px 13px;max-height:210px;min-height:62px;outline:none;line-height:1.6}.composer textarea::placeholder{color:#72809d}.composer-bottom{display:flex;align-items:center;padding:1px 7px;gap:10px}.select-wrap select{background:#25304a;color:#cfd6ed;border:1px solid #394562;border-radius:9px;padding:8px;outline:0;font-size:12px}.char-count{color:#6d7895;font-size:11px;margin-left:auto}.send,.stop{border:0;border-radius:10px;width:36px;height:36px;background:#a7afff;color:#111a37;font-size:22px;font-weight:800}.stop{background:#d8a5a5;font-size:14px}.notice{text-align:center;color:#6f7d99;font-size:10px;padding:12px 5px 0}.panel{flex:1;overflow:auto;padding:38px 45px;max-width:1300px;width:100%;margin:auto}.panel-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:30px}.panel-heading h2{font-size:32px;letter-spacing:-1px;margin:9px 0}.secondary{background:#1c2841;border:1px solid #414b6e;border-radius:10px;padding:11px 16px;color:#b7c7e7}.metric-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.metric,.subpanel{background:#131d31;border:1px solid var(--border);border-radius:15px;padding:22px}.metric span{display:block;font-size:12px;color:#8b9ab3;margin-bottom:16px}.metric strong{font-size:22px;color:#c6d2f4}.panel-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px;margin:15px 0}.subpanel h3{margin:0;font-size:16px}.subheading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:20px}.subheading small{color:#7283a0}.metric-list{display:flex;flex-direction:column;gap:15px}.metric-line{display:flex;justify-content:space-between;border-bottom:1px solid var(--border);padding-bottom:10px;gap:10px}.metric-line span{color:#8798b4}.metric-line strong{color:#cedafa}.capabilities{display:flex;flex-wrap:wrap;gap:8px}.capability{padding:8px 11px;border-radius:8px;font-size:12px;border:1px solid #315b52;background:#12372c;color:#7fdbb5}.capability.no{border-color:#493e58;background:#2a2539;color:#ac9fb9}.inline-form{display:flex;gap:10px;margin-bottom:15px}.inline-form input{flex:1;min-width:0;padding:12px}.temporary{border-radius:12px;border:1px solid #495e5b;background:#172e2e;padding:13px;overflow-wrap:anywhere;margin-bottom:20px}.user-row{padding:13px 2px;display:flex;gap:12px;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border)}.user-row>span{min-width:0;overflow-wrap:anywhere}.user-actions{display:flex;gap:6px}.user-actions button{border:1px solid #3a456b;border-radius:8px;background:#1b2941;padding:7px 9px;font-size:11px}.hint{font-size:12px;color:#8a9ab6;line-height:1.7;margin:22px 0}.settings-card{max-width:540px}.settings-card form{display:flex;flex-direction:column;gap:10px}.settings-card label{margin-top:6px}.settings-card button{margin-top:12px}.sr-only{position:absolute;left:-10000px}.toast{position:fixed;bottom:24px;right:25px;background:#293455;padding:14px 19px;border:1px solid #7b84cc;border-radius:12px;box-shadow:var(--shadow);max-width:min(450px,90vw);z-index:20}@media(max-width:1000px){.metric-grid{grid-template-columns:repeat(2,1fr)}.panel-grid{grid-template-columns:1fr}.sidebar{width:240px}.workspace{grid-template-columns:240px 1fr}.panel{padding:26px}}@media(max-width:720px){.auth-screen{grid-template-columns:1fr}.login-scenery{display:none}.login-card{padding:50px 0}.workspace{display:block}.sidebar{position:absolute;z-index:12;top:0;left:0;height:100dvh;width:270px;transform:translateX(-101%);transition:transform .2s;box-shadow:var(--shadow)}.sidebar.open{transform:translateX(0)}.main{height:100dvh}.mobile{display:inline-block;margin:0 12px 0 0}.topbar{padding:0 14px}.top-status{display:none}.messages{padding:24px 17px}.prompts{grid-template-columns:1fr;margin-top:23px}.welcome{margin-top:45px}.composer-wrap{width:calc(100% - 18px)}.panel{padding:24px 16px}.metric-grid{gap:8px}.metric{padding:14px}.metric strong{font-size:17px}.panel-heading{align-items:flex-start}.inline-form{flex-direction:column}.user-row{align-items:flex-start;flex-direction:column}.topbar .icon-button{margin-left:5px}}@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}

.tool-bench{display:grid;gap:12px;max-width:850px}.tool-bench label{display:block;color:#9eabc4;font-size:12px;margin-bottom:7px}.tool-bench select,.tool-bench textarea{width:100%;background:#0d1728;color:#dbe5ff;border:1px solid #394665;border-radius:9px;padding:12px;outline:0}.tool-bench textarea{resize:vertical;min-height:105px}.tool-bench button{justify-self:start}.tool-output{white-space:pre-wrap;overflow-wrap:anywhere;background:#091122;color:#bcd2e6;border:1px solid #283b57;border-radius:10px;padding:18px;min-height:65px;max-height:390px;overflow:auto;font-size:12px;line-height:1.7}

/* Phase 16N document editor. Existing Lab layout stays unchanged. */
.message-body{flex:1;min-width:0}
.message-tools{margin:8px 0 0 0}
.doc-export-btn{background:transparent;border:1px solid var(--border,#cbd5e1);color:inherit;border-radius:9px;padding:5px 10px;font-size:12px;cursor:pointer;opacity:.8}
.doc-export-btn:hover{opacity:1}
.doc-export-btn:disabled{opacity:.25;cursor:not-allowed}
.doc-overlay{position:fixed;inset:0;z-index:500;display:flex;align-items:center;justify-content:center;background:rgba(8,16,30,.73);padding:15px}
.doc-overlay.hidden{display:none}
.doc-modal{display:flex;flex-direction:column;width:min(850px,96vw);max-height:95vh;overflow:auto;gap:8px;padding:22px;border-radius:15px;background:#fff;color:#192538;box-shadow:0 15px 60px rgba(0,0,0,.3)}
.doc-modal-head{display:flex;align-items:center;justify-content:space-between}
.doc-modal-head h2{margin:0;font-size:20px}
.doc-x{background:none;border:none;font-size:28px;cursor:pointer;color:#253448}
.doc-modal .muted{color:#667285}
.doc-label{font-weight:650;font-size:13px;margin-top:7px}
.doc-title,.doc-textarea{font:inherit;color:#182433;background:#fff;border:1px solid #cad2dd;border-radius:8px;padding:10px;box-sizing:border-box;width:100%}
.doc-textarea{height:min(48vh,400px);min-height:180px;resize:vertical;white-space:pre-wrap;line-height:1.48}
.doc-count{text-align:right}
.doc-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.doc-actions button{padding:10px 16px;border-radius:9px;border:1px solid #c9d2de;cursor:pointer;font-weight:600}
.doc-actions .primary{background:#173f75;color:#fff;border:1px solid #173f75}
.doc-actions .doc-secondary{background:#f8fafc;color:#173f75}
.doc-actions button:disabled{opacity:.6;cursor:wait}
