:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei UI","PingFang SC",sans-serif;color:#e9edf4;background:#0c1017;font-synthesis:none}*{box-sizing:border-box}body{margin:0}button,textarea,input{font:inherit}button{cursor:pointer}button:focus-visible,textarea:focus-visible{outline:2px solid #80aafb;outline-offset:2px}.app{height:100dvh;min-height:450px;display:grid;grid-template-columns:268px minmax(0,1fr);max-width:1600px;margin:0 auto;border-left:1px solid #202835;border-right:1px solid #202835}.sidebar{background:#111722;border-right:1px solid #252e3b;display:flex;flex-direction:column;min-width:0}.brand{display:flex;gap:12px;align-items:center;padding:22px 20px 31px}.brand-mark{width:38px;height:38px;display:grid;place-items:center;background:#334a70;border:1px solid #5d76a1;color:#fff;border-radius:12px;font-size:18px}.brand strong{font-size:16px;letter-spacing:.4px}.brand small,.account-button small{display:block;color:#8d9bb0;margin-top:3px;font-size:11px}.sidebar-title{display:flex;justify-content:space-between;padding:0 19px 11px;color:#9aa8bb;font-size:12px;align-items:center}.tag{color:#b8c9e7;background:#202c3b;border:1px solid #334359;border-radius:15px;padding:3px 8px;font-size:10px}.room-list{padding:0 10px;display:flex;flex-direction:column;gap:5px;overflow-y:auto}.room{width:100%;text-align:left;border:1px solid transparent;background:transparent;border-radius:12px;color:#c5cfde;padding:12px;display:flex;gap:10px;align-items:center;min-width:0}.room:hover{background:#192332}.room.active{background:#23344d;border-color:#324b70;color:#fff}.room-icon{display:grid;place-items:center;flex:0 0 34px;height:34px;background:#2b3545;border-radius:11px;font-size:16px}.room-name{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.room-desc{color:#92a0b2;font-size:11px;margin-top:4px}.add-room{color:#adc4ed;border:1px dashed #43546b;background:none;margin:14px 18px;border-radius:9px;padding:10px 8px;font-size:12px}.add-room:hover{background:#1b2738}.sidebar-bottom{margin-top:auto;padding:15px 17px 18px;border-top:1px solid #232c38}.sidebar-bottom>p{color:#8291a5;font-size:11px;line-height:1.7;margin:0 0 14px}.account-button{border:0;background:#1b2534;border-radius:11px;padding:9px;display:flex;align-items:center;gap:10px;width:100%;color:#e0e8f4;text-align:left;font-size:12px}.avatar{border-radius:50%;width:35px;height:35px;display:grid;place-items:center;background:#52678a;color:white}.main{min-width:0;display:flex;flex-direction:column;background:radial-gradient(circle at 90% 5%,#182136 0,transparent 33%),#0c111a}.topbar{height:76px;padding:0 28px;display:flex;align-items:center;gap:14px;border-bottom:1px solid #232c39;flex-shrink:0}.chat-heading{display:flex;flex-direction:column;gap:5px;min-width:0}.chat-heading strong{font-size:16px}.chat-heading span{font-size:12px;color:#8f9db1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.top-actions{display:flex;gap:9px;margin-left:auto}.small-button{border:1px solid #384355;background:#1c2634;color:#cad7eb;border-radius:9px;padding:8px 11px;font-size:12px;white-space:nowrap}.small-button:hover{background:#2a3a52}.demo-warning{display:flex;align-items:center;gap:10px;background:#322719;color:#f5d5a2;font-size:12px;padding:11px 28px;border-bottom:1px solid #493721}.warning-dot{width:7px;height:7px;border-radius:50%;background:#e7af65;flex:0 0 7px}.messages{flex:1;min-height:0;overflow:auto;padding:34px max(20px,calc((100% - 850px)/2));display:flex;flex-direction:column;gap:16px}.empty-state{margin:auto;max-width:370px;text-align:center;color:#93a3b9}.empty-state .empty-symbol{font-size:32px;display:block;margin-bottom:12px}.empty-state strong{font-size:16px;color:#d5e0f0;display:block;margin-bottom:10px}.empty-state p{font-size:13px;line-height:1.7}.message-row{display:flex;justify-content:flex-end;gap:10px}.message-row.system{justify-content:center}.bubble{max-width:min(85%,620px);border:1px solid #34527f;background:#1b304d;border-radius:16px 16px 5px 16px;padding:13px 15px;min-width:110px;overflow-wrap:anywhere;white-space:pre-wrap}.bubble .content{font-size:14px;line-height:1.65;white-space:pre-wrap;user-select:text}.meta{display:flex;align-items:center;justify-content:flex-end;gap:12px;color:#a3b8d9;font-size:11px;margin-top:9px}.copy-message{border:0;background:transparent;color:#b9c9e2;padding:2px 5px;font-size:11px}.copy-message:hover{text-decoration:underline}.file-bubble{display:flex;align-items:center;gap:12px;background:#1e3553;border:1px solid #41618c;padding:12px;border-radius:10px;margin-top:10px;white-space:normal;max-width:100%;text-decoration:none;color:#e9f2ff}.file-bubble:hover{background:#254367}.file-icon{font-size:21px}.file-info{display:flex;flex-direction:column;gap:4px;min-width:0}.file-name{font-size:13px;font-weight:600;word-break:break-word}.file-size{color:#a6bad8;font-size:11px}.image-attachment{display:block;margin-top:9px;border-radius:9px;max-width:min(100%,360px);max-height:300px;object-fit:contain}.composer-wrap{padding:0 max(20px,calc((100% - 850px)/2)) 20px;flex-shrink:0}.composer{border:1px solid #38465a;background:#151e2b;border-radius:16px;padding:13px 15px 11px;box-shadow:0 10px 35px #0004}.composer:focus-within{border-color:#5b7cb0}.composer.dragover{border-color:#80aafb;background:#1e2d43}.composer textarea{background:transparent;border:0;outline:none;resize:none;width:100%;min-height:42px;max-height:160px;color:#e9edf4;line-height:1.6;font-size:14px}.composer textarea::placeholder{color:#8393a7}.composer-actions,.left-actions{display:flex;gap:12px;align-items:center;justify-content:space-between}.left-actions{justify-content:flex-start}.icon-button{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;border:0;background:#29384d;color:#cddcf2;font-size:22px}.icon-button:hover{background:#365070}.hint{font-size:11px;color:#8b9aaf}.send-button{border:0;border-radius:9px;background:#6596e4;color:#0d192a;padding:10px 19px;font-size:13px;font-weight:700}.send-button:hover{background:#83adf0}.send-button:disabled{opacity:.6;cursor:not-allowed}.footer-note{color:#738298;font-size:11px;text-align:center;margin:12px 0 0}.attachment-preview{display:flex;gap:9px;flex-wrap:wrap;margin:0 0 12px}.attachment-preview[hidden]{display:none}.pending-file{display:flex;gap:9px;align-items:center;border:1px solid #455472;background:#202f44;border-radius:9px;padding:8px 9px;font-size:12px;max-width:100%}.pending-file span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:230px}.pending-file button{border:0;background:transparent;color:#c6d8ed;font-size:18px}.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);border-radius:10px;color:#e8edf6;background:#2c3950;border:1px solid #536b8b;box-shadow:0 12px 40px #0008;padding:12px 17px;font-size:13px;opacity:0;pointer-events:none;transition:opacity .16s}.toast.show{opacity:1}.mobile-only{display:none}@media(max-width:700px){.app{display:block;border:0}.sidebar{position:absolute;inset:0 auto 0 0;width:min(82vw,310px);z-index:5;box-shadow:15px 0 50px #0009;transform:translateX(-110%);transition:transform .2s}.app.sidebar-open .sidebar{transform:translateX(0)}.main{height:100dvh}.mobile-only{display:grid}.topbar{padding:0 13px;height:68px}.top-actions{gap:5px}.small-button{padding:7px;font-size:11px}.demo-warning{padding:8px 15px;font-size:11px}.messages{padding:18px 13px;gap:12px}.composer-wrap{padding:0 12px 11px}.hint{display:none}.footer-note{font-size:10px}.bubble{max-width:92%}}@media(prefers-reduced-motion:reduce){.sidebar,.toast{transition:none}}
[hidden]{display:none!important}.auth-view{min-height:100dvh;display:grid;place-items:center;padding:24px;background:#0c1017}.auth-panel{width:min(390px,100%);background:#151c28;border:1px solid #2b3649;border-radius:18px;padding:30px;box-shadow:0 24px 60px #0005}.auth-logo{width:50px;height:50px;border-radius:13px;background:#354d76;display:grid;place-items:center;font-size:26px;font-weight:bold}.auth-panel h1{font-size:23px;margin:22px 0 4px}.auth-panel p{font-size:13px;color:#a4adbb}.auth-panel form{display:flex;flex-direction:column;gap:11px;margin-top:24px}.auth-panel label{font-size:12px;color:#b2bbca}.auth-panel input{background:#101723;color:#f2f6ff;border:1px solid #43516b;border-radius:9px;padding:13px;outline:none}.auth-panel form button{margin-top:12px;padding:12px}.text-button{background:none;border:0;color:#9ebff9;padding:13px 0}.auth-note{font-size:13px;color:#e2af7a;min-height:30px;white-space:pre-line}.logout-label{color:#9caec6;font-size:11px;margin-left:auto}.admin-dialog{min-width:min(510px,94vw);max-width:94vw;border:1px solid #42546b;background:#161f2b;color:#e9eef8;border-radius:14px;padding:20px;box-shadow:0 24px 70px #000a}.admin-dialog::backdrop{background:#0009}.admin-dialog header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.approval{padding:12px;border-top:1px solid #334255;display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px}.approval button{background:#263b57;color:#dcecff;border:1px solid #445b7c;border-radius:7px;padding:7px 10px;margin-left:5px}.bubble .sender{font-size:11px;color:#b2caee;margin-bottom:5px}.message-row.other{justify-content:flex-start}.message-row.other .bubble{background:#1e2a3b;border-color:#304257}.message-row.mine{justify-content:flex-end}.bubble .file-bubble{color:#c8dcff}.auth-panel input:focus{border-color:#8caef0}.current-room-hint{font-size:12px;color:#8b9cb2}.room:hover{cursor:pointer}

/* T admin-only budget awareness panel (site-side estimate, not billing). */
.resource-dialog{width:min(580px,94vw);max-height:85vh;overflow:auto}
.resource-status{font-weight:600;color:#d6e6fb;margin:4px 0 12px}
.resource-disclaimer{font-size:12px;line-height:1.65;color:#aab8cd}
.resource-meters{display:grid;gap:18px;margin:20px 0}
.resource-meter-top{display:flex;justify-content:space-between;flex-wrap:wrap;gap:5px;font-size:13px;margin-bottom:7px}
.resource-meter-top>span{color:#bfd2e7;font-variant-numeric:tabular-nums}
.resource-meter-track{height:10px;border-radius:999px;overflow:hidden;background:#29384e}
.resource-meter-fill{height:100%;border-radius:999px;background:#75b6e7;transition:width .15s ease}
.resource-meter-fill.warn{background:#eab861}.resource-meter-fill.stop{background:#eb8383}
.resource-meter-detail{font-size:12px;color:#9baec4;line-height:1.6;margin-top:6px}
.resource-safety p{line-height:1.6;font-size:13px}.resource-ok{color:#9cdbbb}.resource-warn{color:#eac27a}.resource-stop{color:#f3a1a1}
.resource-link{display:inline-block;margin:10px 0;color:#a8caff;font-size:13px}

/* 0.2: the drawer is an overlay; closing it never activates the chat underneath. */
html,body{height:100%;overscroll-behavior:none}
.app{height:var(--app-height,100dvh);min-height:0;overflow:hidden}
.main{height:100%;min-height:0}
.sidebar{min-height:0;overflow-y:auto}
.room-list{min-height:0;flex:1;overflow-y:auto;overscroll-behavior:contain}
.sidebar-bottom{flex-shrink:0}
.brand{padding-bottom:22px}.brand strong{white-space:nowrap}
#closeSidebar{margin-left:auto;flex-shrink:0}
.sidebar-backdrop{position:fixed;inset:0;z-index:19;border:0;border-radius:0;padding:0;background:#0007;cursor:default;touch-action:none}
.sidebar-backdrop:focus-visible{outline:none}
.topbar{position:relative;min-height:64px;height:64px;padding:0 20px;gap:10px}
.chat-heading{flex:1}.chat-heading strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.top-actions{flex-shrink:0;align-items:center}
.chat-menu{position:relative}
.chat-menu>summary{list-style:none;cursor:pointer;min-height:36px;display:flex;align-items:center;justify-content:center}
.chat-menu>summary::-webkit-details-marker{display:none}
.chat-menu[open]>summary{background:#334b6e;border-color:#6885b1}
.chat-menu-items{position:absolute;right:0;top:calc(100% + 9px);min-width:160px;padding:7px;background:#192536;border:1px solid #455773;border-radius:12px;box-shadow:0 15px 40px #0009;z-index:12;display:grid;gap:4px}
.chat-menu-items>.small-button{text-align:left;border:0;background:transparent;padding:12px;font-size:13px}
.chat-menu-items>.small-button:hover{background:#2b405c}
.messages{overscroll-behavior-y:contain;overflow-anchor:none}
.composer-wrap{padding-bottom:max(12px,env(safe-area-inset-bottom));min-width:0}
.composer textarea{height:48px;min-height:48px;max-height:144px;overflow-y:auto}
.small-button:disabled,.icon-button:disabled{opacity:.5;cursor:not-allowed}
.danger-button{color:#f7b5b5;border-color:#804d53;margin-top:12px}.danger-button:hover{background:#4b2931}
.admin-dialog{max-height:calc(var(--app-height,100dvh) - 32px);overflow-y:auto;min-width:0;width:min(510px,calc(100vw - 24px));overscroll-behavior:contain}
.admin-dialog input{max-width:100%}.admin-dialog header{position:sticky;top:-20px;background:#161f2b;padding:8px 0;z-index:1}
.toast{z-index:60;max-width:calc(100vw - 24px);width:max-content;bottom:max(16px,env(safe-area-inset-bottom));pointer-events:none}
button,summary{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid #80aafb;outline-offset:2px}
@media(max-width:700px){
  .sidebar{position:fixed;top:0;bottom:auto;left:0;height:var(--app-height,100dvh);width:min(82vw,310px);z-index:20;visibility:hidden;transform:translateX(-105%);transition:transform .18s ease,visibility .18s}
  .app.sidebar-open .sidebar{visibility:visible;transform:translateX(0)}
  .main{height:100%}.topbar{height:60px;min-height:60px;padding:0 10px;gap:9px}
  .topbar .icon-button{width:40px;height:40px;flex-shrink:0}
  .top-actions{gap:6px}.top-actions>.small-button,.chat-menu>summary{padding:9px 10px;font-size:12px;min-height:38px}
  .chat-heading strong{font-size:15px}.chat-heading span{font-size:11px}
  .composer{padding:10px 12px}.composer-wrap{padding-left:10px;padding-right:10px}
  .composer-actions{gap:8px}.composer-actions .icon-button{width:40px;height:40px}.send-button{min-height:40px;min-width:64px}
  .messages{padding:16px 10px}.bubble{max-width:94%;padding:11px 12px}.meta{gap:8px}.copy-message{min-height:30px;min-width:32px}
  .sidebar-bottom .small-button{min-height:40px;margin-bottom:6px}.account-button{min-height:48px}
  .auth-view{padding:16px}.auth-panel{padding:24px 20px}.auth-panel input{font-size:16px}
}
@media(max-height:450px){.topbar{height:48px;min-height:48px}.messages{padding-top:8px;padding-bottom:8px}.composer{padding:6px 10px}.composer textarea{min-height:36px;height:36px;max-height:80px}.composer-wrap{padding-bottom:6px}.composer-wrap>.hint{display:none}.brand{padding-top:10px;padding-bottom:10px}}
@media(prefers-reduced-motion:reduce){.sidebar{transition:none}}
