/* ============ CUBEX — Perplexity-style dark theme ============ */
:root{
  --bg:#191A1A;
  --bg-elev:#1E2020;
  --surface:#202222;
  --surface-2:#262828;
  --border:#2F3333;
  --border-strong:#3D4244;
  --text:#E8E8E6;
  --muted:#9B9FA3;
  --muted-2:#7A7E82;
  --accent:#20808D;
  --accent-h:#2A9AAD;
  --accent-soft:rgba(44,180,168,.12);
  --danger:#E5626A;
  --radius:14px;
  --radius-lg:20px;
  --font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Arial,sans-serif;
  --shadow:0 12px 40px rgba(0,0,0,.45);
}
*{margin:0;padding:0;box-sizing:border-box}
[hidden]{display:none!important}
html{scroll-behavior:smooth}
body{
  background:var(--bg);color:var(--text);
  font-family:var(--font);font-size:14px;line-height:1.6;
  -webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;
}
::selection{background:rgba(44,180,168,.35)}
a{color:var(--text);text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}
textarea{font-family:inherit;color:inherit;background:none;border:none;resize:none;outline:none;width:100%}
textarea::placeholder,input::placeholder{color:var(--muted-2)}
input{font-family:inherit;color:var(--text);outline:none}
.ic{width:16px;height:16px;flex:none;display:inline-block;vertical-align:middle}

/* scrollbars */
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-thumb{background:#333838;border-radius:8px}
::-webkit-scrollbar-thumb:hover{background:#3d4242}
::-webkit-scrollbar-track{background:transparent}

/* ============ buttons ============ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:9px 18px;border-radius:10px;font-size:14px;font-weight:600;
  transition:all .18s ease;white-space:nowrap;
}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-h);transform:translateY(-1px)}
.btn-ghost{color:var(--muted)}
.btn-ghost:hover{color:var(--text);background:var(--surface-2)}
.btn-outline{border:1px solid var(--border-strong);color:var(--text)}
.btn-outline:hover{border-color:var(--accent);background:var(--accent-soft)}
.btn-lg{padding:13px 30px;font-size:16px;border-radius:12px}

/* ============ nav ============ */
.nav{
  position:fixed;top:0;left:0;right:0;z-index:100;
  background:rgba(25,26,26,.82);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border);
}
.nav.nav-hidden{display:none}
.nav-inner{
  max-width:1240px;margin:0 auto;padding:0 24px;height:62px;
  display:flex;align-items:center;gap:28px;
}
.logo{display:flex;align-items:center;gap:10px;flex:none}
.logo-cube{width:26px;height:26px;flex:none}
.logo-word{font-weight:800;font-size:19px;letter-spacing:.14em}
.nav-links{display:flex;gap:26px;margin-left:12px}
.nav-links a{color:var(--muted);font-size:14px;font-weight:500;transition:color .15s}
.nav-links a:hover{color:var(--text)}
.nav-actions{margin-left:auto;display:flex;align-items:center;gap:10px}
.burger{display:none;flex-direction:column;gap:4px;padding:8px}
.burger span{width:20px;height:2px;background:var(--text);border-radius:2px;display:block}

/* ============ hero ============ */
.home{position:relative}
.hero{position:relative;padding:150px 24px 90px;overflow:hidden}
.hero-glow{
  position:absolute;top:-320px;left:50%;transform:translateX(-50%);
  width:900px;height:640px;pointer-events:none;
  background:radial-gradient(ellipse at center,rgba(32,128,141,.22) 0%,rgba(32,128,141,.08) 40%,transparent 70%);
}
.hero-inner{max-width:820px;margin:0 auto;position:relative;text-align:center}
.hero-badge{
  display:inline-flex;align-items:center;gap:7px;
  padding:6px 14px;border-radius:999px;font-size:13px;font-weight:600;color:#7FD6CB;
  background:var(--accent-soft);border:1px solid rgba(44,180,168,.25);margin-bottom:26px;
}
.hero-badge .ic{width:13px;height:13px}
.hero-title{
  font-size:clamp(42px,7vw,72px);font-weight:800;line-height:1.05;letter-spacing:-.03em;margin-bottom:20px;
}
.hero-sub{font-size:17px;color:var(--muted);max-width:560px;margin:0 auto 40px;line-height:1.65}

/* search box */
.searchbox{
  position:relative;text-align:left;
  background:var(--surface);border:1px solid var(--border-strong);
  border-radius:var(--radius-lg);padding:18px 18px 12px;
  transition:border-color .2s, box-shadow .2s;
  box-shadow:0 8px 30px rgba(0,0,0,.35);
}
.searchbox:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px rgba(32,128,141,.18),0 8px 30px rgba(0,0,0,.35)}
.searchbox textarea{
  font-size:16px;line-height:1.5;min-height:56px;max-height:200px;
}
.searchbox-row{display:flex;align-items:center;gap:10px;margin-top:8px}
.searchbox-spacer,.composer-spacer{flex:1}
.model-chip{
  display:inline-flex;align-items:center;gap:7px;
  padding:7px 13px;border-radius:999px;font-size:13px;font-weight:600;
  color:var(--muted);border:1px solid var(--border-strong);
  transition:all .15s;max-width:260px;
}
.model-chip:hover{color:var(--text);border-color:var(--accent);background:var(--accent-soft)}
.model-chip .ic{width:14px;height:14px;color:var(--accent)}
.model-chip .chev{width:12px;height:12px;color:var(--muted-2)}
.model-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.send-btn{
  width:40px;height:40px;border-radius:12px;flex:none;
  background:var(--accent);color:#fff;display:inline-flex;align-items:center;justify-content:center;
  transition:all .15s;
}
.send-btn:hover{background:var(--accent-h);transform:translateY(-1px)}
.send-btn:disabled{background:var(--surface-2);color:var(--muted-2);cursor:default;transform:none}
.send-btn.stop{background:var(--danger)}
.send-btn .ic{width:19px;height:19px}

/* model dropdown: absolute inside the input box, opens upward as a pill continuation */
.model-menu{
  position:absolute;left:14px;bottom:calc(100% + 6px);z-index:60;
  width:340px;max-width:calc(100vw - 28px);max-height:min(480px,52vh);overflow-y:auto;
  background:var(--bg-elev);border:1px solid var(--border-strong);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:6px;
  animation:menuIn .16s ease;
}
@keyframes menuIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.model-menu .mm-title{padding:8px 12px 4px;font-size:11px;font-weight:700;letter-spacing:.08em;color:var(--muted-2);text-transform:uppercase}
.mm-item{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:9px 12px;border-radius:9px;text-align:left;font-size:14px;transition:background .12s;
}
.mm-item:hover{background:var(--surface-2)}
.mm-item.active{background:var(--accent-soft)}
.mm-item.locked{opacity:.55}
.mm-item.locked:hover{background:rgba(228,120,51,.08)}
.mm-item .mm-name{font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mm-item .mm-badge{font-size:11px;font-weight:700;padding:2px 8px;border-radius:999px;background:var(--surface-2);color:var(--muted);flex:none}
.mm-item .mm-badge.hot{background:rgba(228,120,51,.15);color:#E8A87C}
.mm-item .mm-badge.fast{background:var(--accent-soft);color:#7FD6CB}
.mm-item .mm-check{color:var(--accent);width:15px;height:15px;flex:none}

/* suggestions */
.suggestions{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-top:22px}
.sug{
  padding:9px 16px;border-radius:999px;font-size:13.5px;color:var(--muted);
  border:1px solid var(--border);background:rgba(32,34,34,.6);transition:all .15s;
}
.sug:hover{color:var(--text);border-color:var(--accent);background:var(--accent-soft)}

/* ============ sections ============ */
.section{padding:90px 24px;border-top:1px solid var(--border)}
.section-inner{max-width:1140px;margin:0 auto}
.section-title{font-size:clamp(28px,4vw,40px);font-weight:800;letter-spacing:-.02em;text-align:center}
.section-sub{color:var(--muted);text-align:center;margin:12px 0 50px;font-size:16px}

/* features */
.features-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
.feature-card{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:26px;transition:all .2s;
}
.feature-card:hover{border-color:var(--accent);transform:translateY(-3px);box-shadow:0 10px 30px rgba(0,0,0,.3)}
.feature-ic{
  width:44px;height:44px;border-radius:12px;background:var(--accent-soft);
  display:flex;align-items:center;justify-content:center;margin-bottom:16px;color:var(--accent-h);
}
.feature-ic svg{width:22px;height:22px}
.feature-card h3{font-size:16.5px;font-weight:700;margin-bottom:8px}
.feature-card p{color:var(--muted);font-size:14px;line-height:1.65}

/* pricing */
.pricing-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;align-items:stretch}
.price-card{
  position:relative;background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-lg);padding:30px 26px;display:flex;flex-direction:column;transition:all .2s;
}
.price-card:hover{transform:translateY(-3px)}
.price-card.featured{border-color:var(--accent);background:linear-gradient(180deg,rgba(32,128,141,.14),rgba(32,34,34,1) 55%);box-shadow:0 10px 40px rgba(32,128,141,.15)}
.price-flag{
  position:absolute;top:-13px;left:50%;transform:translateX(-50%);
  background:var(--accent);color:#fff;font-size:12px;font-weight:700;
  padding:4px 14px;border-radius:999px;letter-spacing:.04em;white-space:nowrap;
}
.price-name{font-size:15px;font-weight:700;color:var(--muted);margin-bottom:10px;text-transform:uppercase;letter-spacing:.08em}
.price-value{font-size:40px;font-weight:800;letter-spacing:-.02em;margin-bottom:22px}
.price-value span{font-size:15px;font-weight:500;color:var(--muted)}
.price-list{list-style:none;flex:1;margin-bottom:26px}
.price-list li{
  padding:7px 0 7px 26px;position:relative;color:#C9CCCB;font-size:14px;
}
.price-list li::before{
  content:"";position:absolute;left:0;top:12px;width:15px;height:15px;
  background:no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%2320808D'/%3E%3Cpath d='M4.8 8.2l2.1 2.1 4.3-4.5' stroke='%23fff' stroke-width='1.7' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.price-note{text-align:center;color:var(--muted-2);font-size:13px;margin-top:28px}

/* faq */
.faq-list{max-width:760px;margin:0 auto}
.faq-item{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  margin-bottom:12px;overflow:hidden;transition:border-color .2s;
}
.faq-item[open]{border-color:var(--accent)}
.faq-item summary{
  padding:18px 22px;font-weight:600;font-size:15px;cursor:pointer;list-style:none;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.faq-item summary::-webkit-details-marker{display:none}
.faq-item summary::after{
  content:"+";font-size:22px;color:var(--muted);font-weight:400;transition:transform .2s;flex:none;
}
.faq-item[open] summary::after{transform:rotate(45deg);color:var(--accent-h)}
.faq-item p{padding:0 22px 20px;color:var(--muted);font-size:14.5px}

/* cta + footer */
.cta-band{padding:90px 24px;text-align:center;border-top:1px solid var(--border)}
.cta-band h2{font-size:clamp(24px,3.5vw,34px);font-weight:800;margin-bottom:28px;letter-spacing:-.02em}
.footer{border-top:1px solid var(--border);padding:36px 24px}
.footer-inner{display:flex;align-items:center;gap:26px;flex-wrap:wrap}
.footer-brand{display:flex;align-items:center;gap:9px;font-weight:800;letter-spacing:.14em}
.footer-brand .logo-cube{width:22px;height:22px}
.footer-links{display:flex;gap:22px;margin-left:auto}
.footer-links a{color:var(--muted);font-size:14px}
.footer-links a:hover{color:var(--text)}
.footer-copy{color:var(--muted-2);font-size:13px;width:100%;margin-top:4px}

/* ============ chat layout ============ */
.chat{position:fixed;inset:0;display:flex;background:var(--bg);z-index:50}
.chat[hidden]{display:none}
.sidebar{
  width:264px;flex:none;background:var(--bg-elev);border-right:1px solid var(--border);
  display:flex;flex-direction:column;padding:16px 12px;transition:transform .25s ease;
}
.sidebar-top{padding:2px 8px 14px}
.newchat-btn{
  display:flex;align-items:center;gap:9px;width:100%;
  padding:11px 14px;border-radius:11px;font-size:14px;font-weight:600;color:var(--text);
  border:1px solid var(--border-strong);transition:all .15s;
}
.newchat-btn:hover{border-color:var(--accent);background:var(--accent-soft)}
.newchat-btn .ic{color:var(--accent-h)}
.sidebar-label{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted-2);padding:18px 10px 8px}
.chat-list{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:2px}
.chat-item{
  display:flex;align-items:center;gap:8px;padding:9px 10px 9px 12px;border-radius:9px;
  font-size:13.5px;color:var(--muted);cursor:pointer;transition:background .12s;position:relative;
}
.chat-item:hover{background:var(--surface-2);color:var(--text)}
.chat-item.active{background:var(--accent-soft);color:var(--text)}
.chat-item .ci-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-item .ci-del{
  opacity:0;flex:none;width:22px;height:22px;border-radius:6px;color:var(--muted-2);
  display:inline-flex;align-items:center;justify-content:center;font-size:15px;transition:all .12s;
}
.chat-item:hover .ci-del{opacity:1}
.chat-item .ci-del:hover{background:rgba(229,98,106,.15);color:var(--danger)}
.sidebar-bottom{border-top:1px solid var(--border);padding-top:10px;display:flex;flex-direction:column;gap:2px}

/* profile panel (replaces chats list) */
.profile-view{display:flex;flex-direction:column;flex:1;min-height:0;overflow-y:auto;animation:viewIn .24s cubic-bezier(.2,.7,.3,1)}
.profile-view[hidden]{display:none!important}
#chats-view{animation:viewIn .24s cubic-bezier(.2,.7,.3,1)}
@keyframes viewIn{from{opacity:0;transform:translateX(-16px)}to{opacity:1;transform:none}}
.sidebar.profile-mode .sidebar-bottom{display:none}
.prof-logout{margin-top:auto}
.prof-upgrade{width:100%;margin-top:12px;font-size:13px}
.back-btn{margin-bottom:10px;color:var(--muted)}
.back-btn:hover{color:var(--text)}
.prof-head{display:flex;gap:11px;align-items:center;padding:8px 8px 14px;border-bottom:1px solid var(--border);margin-bottom:10px}
.prof-name{font-weight:700;font-size:14.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.prof-email{font-size:11.5px;color:var(--muted-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.prof-head .user-avatar{width:38px;height:38px;font-size:16px;flex:none}
.prof-plan-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:13px;margin-bottom:10px}
.prof-plan-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.prof-plan-row .plan-badge{font-size:12px;padding:3px 10px}
.prof-until{font-size:11px;color:var(--muted-2)}
.prof-meter{height:7px;border-radius:99px;background:var(--surface-2);overflow:hidden}
.prof-meter-fill{height:100%;background:linear-gradient(90deg,var(--accent),#2CB4A8);border-radius:99px;transition:width .4s ease}
.prof-meter-lbl{font-size:11.5px;color:var(--muted);margin-top:7px}
.side-btn.danger:hover{color:var(--danger);background:rgba(229,98,106,.08)}
.prof-logout .ic{transform:rotate(180deg)}

/* profile button in sidebar bottom */
.profile-btn .user-avatar{width:26px;height:26px;font-size:12px;flex:none}
.profile-btn .pb-name{font-weight:600;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}
.profile-btn .chev{width:12px;height:12px;color:var(--muted-2)}
.side-btn{
  display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:9px;
  font-size:13.5px;color:var(--muted);transition:all .12s;text-align:left;
}
.side-btn:hover{background:var(--surface-2);color:var(--text)}
.side-btn .ic{width:17px;height:17px}
.sidebar-overlay{display:none}

.chat-main{flex:1;display:flex;flex-direction:column;min-width:0;position:relative}
.chat-head{
  height:58px;flex:none;display:flex;align-items:center;gap:12px;padding:0 20px;
  border-bottom:1px solid var(--border);position:relative;background:var(--bg);
}
.head-burger{display:none;color:var(--muted);padding:8px}
.head-burger .ic{width:20px;height:20px}

/* messages */
.messages{flex:1;overflow-y:auto;padding:28px 20px 12px;scroll-behavior:smooth;display:flex;flex-direction:column}
.chat-empty{margin:auto}
.chat-empty{width:100%;max-width:680px;margin:auto;text-align:center}
.chat-auth{margin:auto;text-align:center;max-width:480px;padding:0 16px;display:flex;flex-direction:column;align-items:center;justify-content:center}
.chat-auth h2{font-size:22px;font-weight:800;letter-spacing:-.02em;margin:16px 0 10px}
.chat-auth p{color:var(--muted);font-size:13.5px;line-height:1.6;margin-bottom:20px}
.chat-auth-btns .btn{width:100%;max-width:320px}
.empty-cube{width:52px;height:52px;margin-bottom:18px}
.chat-empty h2{font-size:26px;font-weight:800;letter-spacing:-.02em;margin-bottom:30px}
.empty-cards{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.empty-card{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px;text-align:left;transition:all .18s;display:flex;flex-direction:column;gap:3px;
}
.empty-card:hover{border-color:var(--accent);background:var(--accent-soft);transform:translateY(-2px)}
.empty-card b{font-size:14px;font-weight:700}
.empty-card span{font-size:13px;color:var(--muted)}

.msg-list{max-width:none;margin:0;display:flex;flex-direction:column;gap:24px;padding:0 38px 20px}
.msg{display:flex;gap:14px;animation:msgIn .25s ease}
@keyframes msgIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.msg-user{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px 18px;white-space:pre-wrap;word-wrap:break-word}
.msg-ai{flex:1;min-width:0}
.msg-ai-avatar{
  width:30px;height:30px;flex:none;border-radius:9px;background:var(--surface);
  border:1px solid var(--border-strong);display:flex;align-items:center;justify-content:center;margin-top:2px;
}
.msg-ai-avatar svg{width:17px;height:17px}
.msg-body{min-width:0}
.msg-content{word-wrap:break-word;overflow-wrap:break-word;font-size:13.5px;line-height:1.68}
.msg-content p{margin:0 0 12px}
.msg-content p:last-child{margin-bottom:0}
.msg-content h1,.msg-content h2,.msg-content h3,.msg-content h4{margin:18px 0 10px;line-height:1.35}
.msg-content h1{font-size:22px}.msg-content h2{font-size:19px}.msg-content h3{font-size:16.5px}.msg-content h4{font-size:15px}
.msg-content ul,.msg-content ol{margin:0 0 12px;padding-left:24px}
.msg-content li{margin-bottom:5px}
.msg-content a{color:#7FD6CB;text-decoration:underline;text-underline-offset:2px}
.msg-content a:hover{color:#A5E5DC}
.msg-content blockquote{border-left:3px solid var(--accent);padding:2px 0 2px 14px;color:var(--muted);margin:0 0 12px}
.msg-content pre{
  background:#151616;border:1px solid var(--border);border-radius:11px;
  padding:14px 16px;overflow-x:auto;margin:0 0 12px;font-size:13.5px;line-height:1.6;
}
.msg-content pre code{font-family:'JetBrains Mono',ui-monospace,'Cascadia Code',Consolas,monospace;color:#D5E0DF}
.msg-content code.mcode{
  background:var(--surface-2);border:1px solid var(--border);border-radius:6px;
  padding:1px 6px;font-family:'JetBrains Mono',ui-monospace,Consolas,monospace;font-size:13px;color:#A8D8D0;
}
.msg-content table{border-collapse:collapse;margin:0 0 12px;width:100%;font-size:14px}
.msg-content th,.msg-content td{border:1px solid var(--border-strong);padding:7px 11px;text-align:left}
.msg-content th{background:var(--surface)}
.msg-content hr{border:none;border-top:1px solid var(--border-strong);margin:16px 0}
.caret{display:inline-block;width:8px;height:17px;background:var(--accent-h);border-radius:2px;vertical-align:-3px;animation:blink 1s steps(2) infinite;margin-left:2px}
@keyframes blink{50%{opacity:0}}

.msg-actions{display:flex;gap:6px;margin-top:10px;opacity:0;transition:opacity .15s}
.msg-ai:hover .msg-actions{opacity:1}
.msg-act{
  display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:8px;
  font-size:12.5px;color:var(--muted-2);transition:all .12s;
}
.msg-act:hover{background:var(--surface-2);color:var(--text)}
.msg-act .ic{width:13px;height:13px}
.msg-error{
  border:1px solid rgba(229,98,106,.4);background:rgba(229,98,106,.08);
  color:#F0A9AD;border-radius:11px;padding:12px 16px;font-size:14px;
}

/* composer */
.composer{flex:none;padding:10px 38px 16px;background:linear-gradient(transparent,var(--bg) 30%)}
.composer-box{
  position:relative;max-width:760px;margin:0 auto;
  background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--radius-lg);
  padding:14px 14px 10px;transition:border-color .2s, box-shadow .2s;
}
.composer-box:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px rgba(32,128,141,.18)}
.composer-box textarea{font-size:15px;min-height:24px;max-height:180px;line-height:1.5;margin-bottom:6px}
.composer-row{display:flex;align-items:center;gap:10px}
.composer .model-chip{max-width:220px}
.composer .model-menu{bottom:calc(100% - 2px)}
.composer-note{text-align:center;color:var(--muted-2);font-size:11.5px;margin-top:9px}

/* context circle: progress ring = used context; hover shows tooltip above */
.ctx-btn{
  height:40px;min-width:40px;width:40px;padding:0;border-radius:999px;flex:none;
  border:1px solid var(--border-strong);color:var(--muted);
  display:inline-flex;align-items:center;justify-content:center;
  position:relative;cursor:default;transition:border-color .15s;
}
.ctx-btn:hover{border-color:var(--border-strong)}
.ctx-btn .ring{width:22px;height:22px;transform:rotate(-90deg);flex:none}
.ctx-btn .ring circle{fill:none;stroke-width:2.6}
.ctx-btn .ring-bg{stroke:var(--border-strong)}
.ctx-btn .ring-fill{stroke:var(--accent-h);stroke-linecap:round;transition:stroke-dashoffset .35s ease}
.ctx-btn .ring-fill.warn{stroke:var(--danger)}
.ctx-btn::after{
  content:attr(data-tip);
  position:absolute;bottom:calc(100% + 10px);left:50%;transform:translateX(-50%) translateY(3px);
  background:var(--bg-elev);border:1px solid var(--border-strong);color:var(--text);
  padding:7px 13px;border-radius:10px;font-size:12px;font-weight:500;white-space:nowrap;
  opacity:0;pointer-events:none;transition:opacity .18s ease, transform .18s ease;
  box-shadow:var(--shadow);z-index:90;
}
.ctx-btn:hover::after{opacity:1;transform:translateX(-50%) translateY(0)}

/* context segmented control in settings */
.ctx-seg{display:flex;flex-wrap:wrap;gap:8px}
.ctx-seg-btn{
  padding:9px 18px;border-radius:11px;border:1px solid var(--border-strong);
  background:var(--bg-elev);color:var(--muted);font-size:13.5px;font-weight:600;
  cursor:pointer;transition:all .16s ease;
}
.ctx-seg-btn:hover{color:var(--text);border-color:var(--accent);transform:translateY(-1px)}
.ctx-seg-btn.active{
  background:var(--accent);border-color:var(--accent);color:#fff;
  box-shadow:0 4px 14px rgba(32,128,141,.35);
}
.head-spacer{flex:1}
.chat-head{height:46px}

.attach-btn{
  width:40px;height:40px;border-radius:12px;flex:none;color:var(--muted);
  border:1px solid var(--border-strong);display:inline-flex;align-items:center;justify-content:center;
  transition:all .15s;
}
.attach-btn:hover{color:var(--accent-h);border-color:var(--accent);background:var(--accent-soft)}
.attach-btn .ic{width:18px;height:18px}
.attach-row{display:flex;flex-wrap:wrap;gap:8px;margin:2px 0 8px}
.att-chip{
  display:inline-flex;align-items:center;gap:8px;padding:5px 8px;border-radius:10px;
  background:var(--surface-2);border:1px solid var(--border-strong);max-width:220px;
}
.att-chip img{width:38px;height:38px;object-fit:cover;border-radius:7px}
.att-ic{font-size:16px}
.att-name{font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:140px}
.att-del{
  flex:none;width:20px;height:20px;border-radius:6px;color:var(--muted-2);font-size:14px;
  display:inline-flex;align-items:center;justify-content:center;transition:all .12s;
}
.att-del:hover{background:rgba(229,98,106,.15);color:var(--danger)}
.msg-files{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.msg-file-thumb{width:86px;height:86px;object-fit:cover;border-radius:10px;border:1px solid var(--border-strong)}
.msg-file-chip{
  display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:9px;
  background:var(--surface-2);border:1px solid var(--border-strong);font-size:12.5px;color:var(--muted);
}

/* ============ modals ============ */
.modal-backdrop{
  position:fixed;inset:0;z-index:200;background:rgba(10,11,11,.7);backdrop-filter:blur(4px);
  display:flex;align-items:center;justify-content:center;padding:20px;
  overflow-y:auto;
}
.modal-backdrop .modal{margin:auto}
.modal-backdrop[hidden]{display:none}
.modal{
  width:100%;max-width:480px;background:var(--bg-elev);border:1px solid var(--border-strong);
  border-radius:var(--radius-lg);box-shadow:var(--shadow);animation:pop .18s ease;
}
@keyframes pop{from{transform:scale(.96) translateY(8px);opacity:0}to{transform:none;opacity:1}}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 22px 0}
.modal-head h3{font-size:18px;font-weight:700}
.modal-x{font-size:26px;color:var(--muted);line-height:1;padding:2px 8px;border-radius:8px}
.modal-x:hover{color:var(--text);background:var(--surface-2)}
.modal-body{padding:16px 22px 6px}
.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:12px 22px 20px}
.field{display:block;margin-bottom:16px}
.field span{display:block;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:7px}
.field input{
  width:100%;background:var(--surface);border:1px solid var(--border-strong);
  border-radius:10px;padding:10px 13px;font-size:14px;transition:border-color .15s;
}
.field input:focus{border-color:var(--accent)}
.field small{display:block;color:var(--muted-2);font-size:12px;margin-top:6px;line-height:1.5}
.field small a{color:#7FD6CB;text-decoration:underline}
.set-row{display:flex;align-items:center;gap:12px;margin:4px 0 10px}
.test-status{font-size:13px}
.test-status.ok{color:#6BCB8F}
.test-status.err{color:var(--danger)}
.set-demo-hint{color:var(--muted-2);font-size:12.5px;margin-bottom:8px}
.sub-tg{
  background:var(--surface);border:1px dashed var(--border-strong);border-radius:10px;
  padding:12px;text-align:center;font-size:15px;margin-top:10px;color:#7FD6CB;
}
.modal-body p{color:#C9CCCB;font-size:14.5px}

/* user chip in sidebar */
.user-chip{
  display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:11px;
  background:var(--surface);border:1px solid var(--border);margin-bottom:8px;
}
.user-avatar{
  width:32px;height:32px;flex:none;border-radius:50%;
  background:var(--accent);color:#fff;font-weight:700;font-size:14px;
  display:flex;align-items:center;justify-content:center;text-transform:uppercase;
}
.user-meta{flex:1;min-width:0}
.user-name{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-plan{font-size:11.5px;color:var(--muted)}
.user-plan .plan-badge{
  display:inline-block;padding:1px 7px;border-radius:999px;font-size:10.5px;font-weight:700;
  background:var(--surface-2);color:var(--muted);
}
.user-plan .plan-badge.pro{background:rgba(228,120,51,.18);color:#E8A87C}
.user-out{
  flex:none;width:28px;height:28px;border-radius:8px;color:var(--muted-2);
  display:flex;align-items:center;justify-content:center;transition:all .12s;
}
.user-out:hover{background:rgba(229,98,106,.12);color:var(--danger)}
.user-out .ic{width:15px;height:15px}

/* auth modal */
.auth-err{
  background:rgba(229,98,106,.1);border:1px solid rgba(229,98,106,.35);color:#F0A9AD;
  border-radius:10px;padding:9px 13px;font-size:13px;margin-bottom:14px;
}
.auth-agree{
  display:flex;align-items:flex-start;gap:9px;margin-bottom:14px;cursor:pointer;
  font-size:12.5px;color:var(--muted);line-height:1.5;
}
.auth-agree input{margin-top:2px;accent-color:var(--accent);width:15px;height:15px;flex:none}
.auth-agree a{color:#7FD6CB;text-decoration:underline;text-underline-offset:2px}
.auth-err[hidden]{display:none}
.auth-submit{width:100%;padding:12px;font-size:15px}
.auth-divider{
  display:flex;align-items:center;gap:12px;color:var(--muted-2);font-size:12.5px;
  margin:16px 0;
}
.auth-divider::before,.auth-divider::after{content:"";flex:1;height:1px;background:var(--border-strong)}
.auth-yandex{width:100%;padding:11px;font-size:14px;justify-content:center}
.auth-switch{text-align:center;color:var(--muted);font-size:13px;margin-top:16px}
.auth-switch a{color:#7FD6CB;cursor:pointer;text-decoration:underline;text-underline-offset:2px}

/* reasoning block (thinking models): gray, compact, collapses when done */
.reasoning{
  border:1px solid var(--border);border-radius:10px;
  padding:6px 12px;margin:0 0 10px;background:transparent;
}
.reasoning summary{
  cursor:pointer;font-size:11.5px;font-weight:600;color:var(--muted-2);
  letter-spacing:.02em;user-select:none;
}
.reasoning summary:hover{color:var(--muted)}
.reasoning-body{color:var(--muted);font-size:12px;line-height:1.55;padding-top:4px}
.reasoning-body p{margin:0 0 6px}
.reasoning-body p:last-child{margin-bottom:0}

/* images in chat */
.msg-content img{
  max-width:100%;max-height:420px;border-radius:12px;border:1px solid var(--border-strong);
  display:block;margin:4px 0 10px;
}

/* toast */
.toast{
  position:fixed;bottom:26px;left:50%;transform:translateX(-50%);z-index:300;
  background:var(--bg-elev);border:1px solid var(--border-strong);color:var(--text);
  padding:11px 20px;border-radius:12px;font-size:14px;box-shadow:var(--shadow);animation:pop .18s ease;
}
.toast[hidden]{display:none}



/* ============ responsive ============ */
@media (max-width:1024px){
  .features-grid{grid-template-columns:1fr 1fr}
  .pricing-grid{grid-template-columns:1fr 1fr;max-width:720px;margin:0 auto}
}

@media (max-width:640px){
  .pricing-grid{grid-template-columns:1fr;max-width:440px;margin:0 auto}
}
@media (max-width:768px){
  .nav-inner{padding:0 16px;gap:14px}
  .nav-links{display:none}
  .nav-actions .btn-ghost{display:none}
  .nav-actions .btn-primary{padding:8px 14px;font-size:13px}
  .burger{display:flex}
  .nav-links.open{
    display:flex;position:fixed;top:62px;left:0;right:0;flex-direction:column;gap:0;
    background:var(--bg-elev);border-bottom:1px solid var(--border);padding:8px 16px 14px;
  }
  .nav-links.open a{padding:12px 4px;border-bottom:1px solid var(--border);font-size:15px}
  .hero{padding:120px 16px 60px}
  .hero-sub{font-size:15.5px}
  .features-grid{grid-template-columns:1fr}
  .section{padding:64px 16px}
  .sidebar{
    position:fixed;top:0;bottom:0;left:0;z-index:120;transform:translateX(-100%);
    box-shadow:var(--shadow);width:280px;padding:12px 10px;overflow-y:auto;
  }
  .newchat-btn{padding:9px 12px;font-size:13.5px}
  .sidebar-bottom .side-btn{padding:8px 10px;font-size:13px}
  .prof-head{padding:6px 6px 12px}
  .prof-plan-card{padding:11px}
  .prof-head .user-avatar{width:32px;height:32px;font-size:14px}
  .sidebar.open{transform:none}
  .sidebar-overlay{display:none;position:fixed;inset:0;z-index:110;background:rgba(0,0,0,.5)}
  .sidebar-overlay.show{display:block}
  .head-burger{display:inline-flex}
  .empty-cards{display:none}
  .messages{padding:20px 14px 8px}
  .msg-list{padding:0 8px 16px}
  .composer{padding:8px 8px 12px}
  .composer .model-chip{max-width:150px}
  .composer .attach-btn{width:36px;height:36px}
  .composer .send-btn{width:36px;height:36px}
  .ctx-btn{height:36px;width:36px;min-width:36px;padding:0}
  .model-chip-name{max-width:110px}
}
@media (max-width:520px){
  .hero-title{font-size:40px}
  .suggestions{gap:8px}
  .sug{font-size:12.5px;padding:8px 13px}
  .price-value{font-size:34px}
}
