@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');
:root{color-scheme:dark;--bg:#080d18;--panel:#0d1423;--line:#202d43;--text:#edf3ff;--muted:#8291aa;--cyan:#5de4d5}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Vazirmatn,Tahoma,sans-serif}button,textarea,select{font:inherit}button{cursor:pointer}.app{min-height:100dvh;display:flex;background:radial-gradient(ellipse at 75% -20%,#1b2b55 0,transparent 45%),var(--bg)}.sidebar{width:270px;flex-shrink:0;border-left:1px solid var(--line);background:#0b111e;display:flex;flex-direction:column;padding:23px 17px;min-height:100dvh}.brand{display:flex;align-items:center;gap:10px;font-size:21px;font-weight:800;margin:2px 7px 29px}.brand small{font-size:11px;letter-spacing:1.5px;color:var(--cyan);margin-right:4px}.brand-mark{display:grid;place-items:center;width:38px;height:38px;border-radius:13px;background:linear-gradient(145deg,#7587ff,#53ded0);color:#09101d;font-size:25px;box-shadow:0 0 25px #667fff33}.new-chat{height:45px;border:1px solid #34415b;border-radius:12px;background:#151f32;color:#edf3ff;font-weight:600;text-align:right;padding:0 14px}.new-chat:hover{border-color:#788bff;background:#1b2942}.side-caption{font-size:11px;color:#64748b;margin:28px 7px 10px}.session-card{display:flex;align-items:center;gap:10px;padding:12px 11px;background:#121c2d;border:1px solid #1f2d43;border-radius:12px}.session-card>div{display:flex;flex-direction:column;gap:3px}.session-card b{font-size:12px}.session-card small{font-size:10px;color:var(--muted)}.pulse,.status-dot{width:8px;height:8px;border-radius:50%;background:#5ce0b1;box-shadow:0 0 10px #5ce0b155}.side-note{margin-top:auto;display:flex;gap:10px;padding:13px 10px;border:1px solid #1e3041;background:#0f1d29;border-radius:13px}.shield{color:var(--cyan);font-size:22px}.side-note b{font-size:12px}.side-note p{font-size:10px;color:var(--muted);line-height:1.9;margin:5px 0 0}.side-footer{display:flex;justify-content:space-between;color:#687791;font-size:10px;letter-spacing:1px;margin:19px 5px 0}.side-footer span{letter-spacing:0}.main{flex:1;min-width:0;display:flex;flex-direction:column;min-height:100dvh}.topbar{height:68px;flex-shrink:0;border-bottom:1px solid #1a2638;display:flex;align-items:center;justify-content:space-between;padding:0 30px;background:#080d18a8;backdrop-filter:blur(12px)}.top-title{display:flex;align-items:center;gap:10px;font-size:13px;font-weight:600}.beta{font-size:9px;padding:3px 7px;border:1px solid #344a61;border-radius:5px;color:#8fa6c1;letter-spacing:1px}.settings-btn{background:#111b2c;border:1px solid #26344b;color:#c8d5eb;border-radius:10px;padding:8px 13px;font-size:12px}.mobile-menu{display:none}.chat{flex:1;min-height:0;overflow:auto;scroll-behavior:smooth}.welcome{width:min(690px,92%);margin:7vh auto 35px;text-align:center}.hero-icon{height:75px;width:75px;border-radius:25px;margin:0 auto 23px;display:grid;place-items:center;background:linear-gradient(145deg,#7886ff,#57dfd2);box-shadow:0 0 70px #657cff2a;transform:rotate(-5deg)}.hero-icon span{font-size:42px;color:#09101d;transform:rotate(5deg)}.eyebrow{font-size:11px;color:#a6b5ff;letter-spacing:.5px}.welcome h1{font-size:clamp(32px,4vw,46px);line-height:1.5;letter-spacing:-1.2px;margin:12px 0}.welcome h1 em{font-style:normal;background:linear-gradient(90deg,#8f9bff,#60e0d4);background-clip:text;color:transparent}.welcome>p{font-size:13px;color:var(--muted);margin:0 auto;line-height:2}.suggestions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:35px auto 0;max-width:570px}.suggestion{position:relative;text-align:right;display:grid;grid-template-columns:33px 1fr;grid-template-rows:auto auto;align-items:center;gap:2px 9px;padding:15px 13px;border:1px solid #202e44;border-radius:14px;background:#0e1726;color:var(--text);transition:.2s}.suggestion:hover{background:#131f33;border-color:#5366a0;transform:translateY(-2px)}.suggestion>span{grid-row:1/3;display:grid;place-items:center;width:32px;height:32px;border-radius:10px;background:#202c46;color:#aeb8ff;font-size:17px}.suggestion b{font-size:11px;font-weight:600}.suggestion small{font-size:10px;color:var(--muted)}.suggestion i{position:absolute;left:13px;top:14px;font-style:normal;color:#65789a}.composer-wrap{width:min(800px,92%);margin:0 auto;padding:12px 0 19px}.composer{display:flex;align-items:flex-end;gap:10px;padding:12px 12px 12px 13px;border:1px solid #2a3850;border-radius:19px;background:#111a2a;box-shadow:0 12px 45px #0002;transition:.2s}.composer:focus-within{border-color:#6979bd;box-shadow:0 0 0 3px #7284ff0e}.composer textarea{resize:none;max-height:160px;min-height:34px;flex:1;border:0;outline:0;background:transparent;color:var(--text);padding:7px 4px;line-height:1.8;font-size:13px}.composer textarea::placeholder{color:#6f7f98}.send-btn{flex-shrink:0;width:37px;height:37px;border:0;border-radius:12px;background:linear-gradient(140deg,#8290ff,#55dfd3);color:#07111c;font-size:25px;font-weight:700;display:grid;place-items:center}.send-btn:disabled{opacity:.45;cursor:wait}.composer-meta{display:flex;justify-content:space-between;gap:10px;padding:10px 5px 0;color:#63718a;font-size:9px}.composer-meta span:last-child{white-space:nowrap}.composer-meta i{display:inline-block;width:6px;height:6px;border-radius:50%;background:#58dcb7;margin-left:5px}.messages{width:min(800px,92%);margin:28px auto 30px;display:flex;flex-direction:column;gap:27px}.message{display:flex;align-items:flex-start;gap:13px}.message-avatar{width:31px;height:31px;flex-shrink:0;border-radius:11px;display:grid;place-items:center;font-size:16px;font-weight:700}.ai-avatar{background:linear-gradient(140deg,#7c8cff,#58dfd1);color:#07111c}.user-avatar{background:#202c43;color:#cad7ee}.message-content{flex:1;min-width:0}.message-label{font-size:11px;font-weight:700;color:#aebde0;margin:4px 0 9px}.message-text{font-size:13px;line-height:2.15;white-space:pre-wrap;overflow-wrap:anywhere;color:#e3eaf7}.typing{color:#91a2c1}.hidden{display:none!important}.modal-backdrop{position:fixed;inset:0;z-index:10;display:grid;place-items:center;padding:18px;background:#030711b9;backdrop-filter:blur(8px)}.settings-modal{width:min(430px,100%);border:1px solid #2b3a54;border-radius:20px;background:#101a2b;padding:23px;box-shadow:0 25px 90px #0008}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:22px}.modal-head h2{font-size:20px;margin:5px 0}.icon-btn{border:1px solid #29374f;background:#131f32;color:#c8d4e8;border-radius:10px;padding:8px 11px}.settings-modal label{display:block;font-size:12px;color:#c0cde1;margin:14px 0}.settings-modal select{display:block;width:100%;margin-top:8px;padding:11px;border:1px solid #2b3a52;border-radius:10px;background:#0b1321;color:#eaf0fc;outline:none}.apply-btn{width:100%;padding:12px;border:0;border-radius:11px;background:linear-gradient(100deg,#7e8dff,#56ded1);color:#07111c;font-weight:800;margin-top:10px}.privacy-note{font-size:10px;color:#8190a9;line-height:1.9;margin:14px 0 0}.toast{position:fixed;z-index:20;bottom:25px;left:50%;transform:translate(-50%,15px);opacity:0;pointer-events:none;padding:11px 17px;background:#1a2940;border:1px solid #354761;color:#e6efff;border-radius:12px;font-size:12px;max-width:90vw;transition:.2s}.toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:760px){.sidebar{position:fixed;z-index:8;right:0;top:0;bottom:0;width:270px;min-height:0;transform:translateX(105%);transition:transform .22s;box-shadow:-20px 0 60px #0005}.sidebar.open{transform:translateX(0)}.mobile-menu{display:block}.topbar{height:58px;padding:0 13px}.top-title{margin-left:auto;margin-right:12px;font-size:12px}.settings-btn{font-size:11px;padding:8px}.welcome{margin-top:6vh}.hero-icon{width:64px;height:64px;border-radius:21px}.hero-icon span{font-size:35px}.welcome h1{font-size:32px}.welcome>p{font-size:12px}.suggestions{gap:8px;margin-top:26px}.suggestion{padding:12px 9px;grid-template-columns:27px 1fr;gap:2px 7px}.suggestion>span{width:27px;height:29px}.suggestion b{font-size:10px}.suggestion small{font-size:9px}.suggestion i{left:7px;top:7px}.composer-wrap{width:94%;padding-bottom:12px}.composer{border-radius:16px}.composer-meta{font-size:8px}.messages{width:92%;margin-top:20px}.message-text{font-size:12px}}@media(max-width:380px){.suggestions{grid-template-columns:1fr}.welcome{margin-top:25px}.welcome h1{font-size:29px}.suggestion{grid-template-columns:32px 1fr}.suggestion>span{width:31px}.composer-meta span:first-child{max-width:65%}}

/* Authentication and persistent chat history */
.auth-shell{min-height:100dvh;display:grid;place-items:center;padding:24px;background:radial-gradient(ellipse at 50% 0%,#1b2b55 0,transparent 48%),var(--bg)}
.auth-card{width:min(440px,100%);padding:30px;border:1px solid #26364f;border-radius:24px;background:#0e1727;box-shadow:0 25px 100px #0005}
.auth-brand{display:flex;align-items:center;justify-content:center;gap:11px;font-size:25px;font-weight:800;margin:2px 0 27px}
.auth-brand small{font-size:11px;letter-spacing:1.5px;color:var(--cyan);margin-right:4px}
.auth-card>.eyebrow{text-align:center;display:block}
.auth-card h1{text-align:center;font-size:25px;margin:9px 0}
.auth-subtitle{text-align:center;color:var(--muted);font-size:12px;line-height:1.9;margin:0 0 22px}
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:5px;background:#09111e;border:1px solid #202e44;border-radius:13px;margin-bottom:22px}
.auth-tab{padding:10px;border:0;border-radius:9px;background:transparent;color:#94a4be;font-size:12px}
.auth-tab.active{background:#1c2a40;color:#eff5ff;border:1px solid #34465f}
.auth-card label{display:block;font-size:12px;color:#c4d1e6;margin:13px 0 7px}
.auth-card input{width:100%;padding:13px 12px;border:1px solid #2b3a52;border-radius:11px;background:#091321;color:var(--text);outline:none;direction:ltr;text-align:left;font-family:inherit;font-size:13px}
.auth-card input:focus{border-color:#7285c9;box-shadow:0 0 0 3px #7284ff12}
.auth-submit{margin-top:20px}
.auth-submit:disabled{opacity:.6;cursor:wait}
.auth-error{min-height:20px;margin:12px 0 0;color:#ff9f9f;font-size:11px;line-height:1.8}
.auth-footer{margin-top:20px}
.history-list{display:flex;flex-direction:column;gap:5px;overflow-y:auto;max-height:36vh;padding:0 1px}
.history-empty{font-size:11px;line-height:1.9;color:#71819b;padding:9px 7px}
.history-item{display:flex;align-items:center;gap:9px;width:100%;min-width:0;text-align:right;padding:10px 9px;border:1px solid transparent;border-radius:10px;background:transparent;color:#b9c7dd;font-family:inherit;cursor:pointer}
.history-item:hover,.history-item.active{background:#141f31;border-color:#263750;color:#f1f5ff}
.history-icon{font-size:14px;color:#8091b2;flex-shrink:0}
.history-title{font-size:11px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.account-card{display:flex;align-items:center;gap:9px;margin-top:16px;padding:10px 9px;border:1px solid #223149;border-radius:12px;background:#0f1929;min-width:0}
.account-avatar{display:grid;place-items:center;width:30px;height:30px;flex-shrink:0;border-radius:10px;background:#1e3042;color:var(--cyan);font-size:13px}
.account-info{display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}
.account-info b{font-size:11px}
.account-info small{font-size:10px;color:#8b9ab3;direction:ltr;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.logout-btn{border:1px solid #2b3a50;border-radius:9px;background:#111d2e;color:#aebfda;padding:6px 9px;font-size:15px;flex-shrink:0}
.logout-btn:hover{color:#ffb1b1;border-color:#73414c}
@media(max-width:760px){.auth-card{padding:24px 20px}.history-list{max-height:32vh}.account-card{margin-top:12px}}


/* Fix: keep the conversation viewport bounded so only the chat area scrolls. */
.app{width:100%;height:100vh;height:100dvh;min-height:0;display:flex;overflow:hidden}
.main{display:flex;flex-direction:column;flex:1 1 auto;width:calc(100% - 270px);min-width:0;height:100vh;height:100dvh;min-height:0;margin-right:270px;overflow:hidden}
.topbar{flex:0 0 68px}
.chat{display:block;flex:1 1 0%;height:0;min-height:0;width:100%;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;scrollbar-width:none;-ms-overflow-style:none}
.messages{flex-shrink:0}
.composer-wrap{flex:0 0 auto;min-width:0}
@media(max-width:760px){
 .main{margin-right:0;width:100%;min-width:0;height:100vh;height:100dvh}
 .topbar{flex-basis:58px}
 .chat{flex:1 1 0%;height:0;min-height:0}
}
