*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
*{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;}
.bubble,#user-input,textarea,.bubble *{-webkit-user-select:text;-moz-user-select:text;user-select:text;}
#error-toast{opacity:0;transform:translateX(-50%) translateY(5px)!important;transition:opacity .18s ease,transform .18s ease;}.toast-visible{opacity:1!important;transform:translateX(-50%) translateY(0)!important;}
.bubble pre,.bubble code,.bubble .code-header{-webkit-user-select:text;-moz-user-select:text;user-select:text;}
input:focus, textarea:focus, select:focus, button:focus{outline:none!important;box-shadow:none!important;}

:root{
  --bg:#111111;
  --sidebar-bg:rgba(20,20,20,0.45);
  --surface:#232323;
  --surface2:#2a2a2a;
  --border:#333333;
  --text:#ececec;
  --muted:#888888;
  --subtle:#232323;
  --accent:#555555;
  --accent2:#aaaaaa;
  --accent-glow:rgba(150,150,150,0.12);
  --accent-hover:#444444;
  --danger:#f85149;
  --user-bubble:#2a2a2a;
  --user-text:#ffffff;
  --ai-bubble:#1c1c1c;
  --ai-border:#333333;
  --sidebar-w:260px;
  --sidebar-icon-w:56px;
}

html,body{height:100%;font-family:'Inter',-apple-system,sans-serif;font-size:14px;background:var(--bg);color:var(--text);overflow:hidden;touch-action:pan-x pan-y;}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


#app{display:flex;height:100vh;height:100dvh;position:relative;}


#sidebar{
  width:var(--sidebar-w);
  height:100%;height:100dvh;
  background:var(--sidebar-bg);
  backdrop-filter:blur(18px) saturate(1.4);
  -webkit-backdrop-filter:blur(18px) saturate(1.4);
  border-right:none;
  display:flex;flex-direction:column;
  transition:width .32s cubic-bezier(.4,0,.2,1);
  overflow:hidden;position:relative;z-index:20;flex-shrink:0;
  will-change:width;
}
#sidebar.collapsed{width:var(--sidebar-icon-w);}

#sidebar::after{
  content:'';position:absolute;top:0;right:0;height:100%;width:1px;
  background:var(--border);opacity:.5;pointer-events:none;
}


.sb-top{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 10px 10px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0;
  min-height:52px;transition:justify-content 0s .16s,padding .32s cubic-bezier(.4,0,.2,1);
}
#sidebar.collapsed .sb-top{justify-content:center;padding:12px 0 10px;}
.sb-top-controls{display:flex;align-items:center;gap:2px;flex-shrink:0;}
.sb-search-expanded-btn{width:32px;height:32px;border:0;border-radius:7px;background:none;color:var(--muted);display:grid;place-items:center;cursor:pointer;transition:background .2s,color .2s;}
.sb-search-expanded-btn:hover{background:var(--surface2);color:var(--text);}
#sidebar.collapsed .sb-search-expanded-btn{display:none;}
.sb-logo{
  font-size:15px;font-weight:600;color:var(--text);
  white-space:nowrap;overflow:hidden;opacity:1;
  display:flex;align-items:center;gap:8px;
  transition:opacity .22s cubic-bezier(.4,0,.2,1),max-width .32s cubic-bezier(.4,0,.2,1);max-width:180px;
}
.sb-logo-icon{width:20px;height:20px;border-radius:5px;flex-shrink:0;object-fit:contain;}
#sidebar.collapsed .sb-logo{opacity:0;max-width:0;}
.sb-toggle{
  width:32px;height:32px;border:none;background:none;color:var(--muted);
  border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:background .2s,color .2s,transform .32s cubic-bezier(.4,0,.2,1);flex-shrink:0;
}
.sb-toggle:hover{background:var(--surface2);color:var(--text);}
#sidebar.collapsed .sb-toggle{}


.sb-actions{padding:8px 8px 4px;flex-shrink:0;display:flex;flex-direction:column;gap:4px;}
#sidebar.collapsed .sb-actions{padding:8px 0 4px;justify-content:center;}
.new-chat-btn{
  flex:1;padding:9px 14px;
  background:var(--surface);border:none;
  border-radius:20px;color:var(--text);font-size:13px;font-weight:500;cursor:pointer;
  display:flex;align-items:center;justify-content:flex-start;gap:8px;
  transition:background .18s,width .32s cubic-bezier(.4,0,.2,1),padding .32s cubic-bezier(.4,0,.2,1),border-radius .32s cubic-bezier(.4,0,.2,1),gap .32s cubic-bezier(.4,0,.2,1);
  white-space:nowrap;overflow:hidden;
}
.new-chat-btn:hover{background:var(--surface2);}
.new-chat-btn svg{flex-shrink:0;width:14px;height:14px;}
.new-chat-btn span{transition:opacity .18s cubic-bezier(.4,0,.2,1),max-width .32s cubic-bezier(.4,0,.2,1);max-width:200px;overflow:hidden;}
#sidebar.collapsed .new-chat-btn{
  flex:none;
  width:32px;
  height:32px;
  padding:0;
  display:flex;
  justify-content:center;
  align-items:center;
  border-radius:8px;
  gap:0;
}
#sidebar.collapsed .new-chat-btn span{display:none!important;}

.sb-search-collapsed-btn{display:none;}
.sb-search{padding:6px 10px;flex-shrink:0;overflow:hidden;transition:max-height .32s cubic-bezier(.4,0,.2,1),opacity .22s cubic-bezier(.4,0,.2,1),padding .32s;}
.sb-search input{
  width:100%;padding:9px 14px;
  background:var(--surface);border:none;
  border-radius:20px;color:var(--text);font-size:13px;outline:none;
  transition:background .2s;
}
.sb-search input:focus{background:var(--surface2);}
.sb-search input::placeholder{color:var(--muted);}
#sidebar.collapsed .sb-search{
  padding:6px 0;
  display:flex;
  justify-content:center;
  align-items:center;
}
#sidebar.collapsed .sb-search input{display:none;}
#sidebar.collapsed .sb-search-collapsed-btn{
  display:flex;
  justify-content:center;
  align-items:center;
  width:32px;
  height:32px;
  background:var(--surface);
  border:none;
  border-radius:8px;
  color:var(--muted);
  cursor:pointer;
  transition:background .2s,color .2s;
}
#sidebar.collapsed .sb-search-collapsed-btn:hover{
  background:#2e2e2e;
  color:var(--text);
}
#sidebar:not(.collapsed) .sb-search{display:none;}
#sidebar.collapsed .sb-actions{align-items:center;}
#sidebar.collapsed .sb-toggle,#sidebar.collapsed .new-chat-btn,#sidebar.collapsed .sb-search-collapsed-btn,#sidebar.collapsed .sb-footer-btn{color:#fff;}

.chat-search-screen{position:fixed;inset:0;z-index:9000;display:none;align-items:flex-start;justify-content:center;padding:40px 18px;}.chat-search-screen.open{display:flex;}.chat-search-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.62);backdrop-filter:blur(5px);opacity:0;transition:opacity .2s ease;}.chat-search-box{position:relative;width:min(720px,100%);min-height:430px;max-height:calc(100dvh - 80px);overflow:auto;border-radius:17px;background:var(--surface);padding:18px 26px;opacity:0;transform:translateY(-10px) scale(.98);transition:opacity .22s ease,transform .22s cubic-bezier(.22,1,.36,1);}.chat-search-screen.visible .chat-search-backdrop{opacity:1;}.chat-search-screen.visible .chat-search-box{opacity:1;transform:none;}.chat-search-head{display:flex;align-items:center;gap:12px;border-bottom:1px solid var(--border);}.chat-search-head input{flex:1;border:0;background:transparent;color:var(--text);font:14px inherit;padding:10px 0 14px;}.chat-search-head input::placeholder{color:var(--muted);}.chat-search-head button{width:28px;height:28px;border:0;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.08);color:#fff;font-size:20px;line-height:1;cursor:pointer;padding:0;transition:background .15s,color .15s;}.chat-search-head button:hover{background:var(--surface);color:var(--text);}.chat-search-label{margin:26px 0 12px;color:var(--muted);font-size:13px;}.chat-search-results{display:flex;flex-direction:column;gap:2px;}.chat-search-result{display:flex;align-items:center;gap:16px;border:0;background:transparent;color:var(--text);padding:12px 6px;border-radius:8px;text-align:left;font:500 14px inherit;cursor:pointer;}.chat-search-result:hover{background:var(--surface2);}.chat-search-result svg{color:#fff;flex-shrink:0;}.chat-search-empty{color:var(--muted);font-size:13px;padding:14px 6px;}


.conv-list{flex:1;overflow-y:auto;overflow-x:hidden;padding:4px 6px;scrollbar-width:thin;scrollbar-color:var(--border) transparent;}
.conv-list::-webkit-scrollbar{width:3px;}
.conv-list::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px;}
#sidebar.collapsed .conv-list{padding:4px 2px;}

.conv-group-label{
  font-size:10px;color:var(--muted);padding:8px 8px 3px;font-weight:500;
  text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;overflow:hidden;
  transition:opacity .18s cubic-bezier(.4,0,.2,1),height .32s,padding .32s;
}
#sidebar.collapsed .conv-group-label{opacity:0;height:0;padding:0;}

.conv-item{
  display:flex;align-items:center;justify-content:space-between;
  padding:8px 10px;border-radius:8px;cursor:pointer;
  transition:background .18s ease,padding .32s cubic-bezier(.4,0,.2,1);
  position:relative;margin-bottom:1px;min-height:36px;overflow:hidden;
}
.conv-item:hover{background:var(--surface);}
.conversation-fade-in{animation:conversationFadeIn .3s cubic-bezier(.22,1,.36,1) both;}
@keyframes conversationFadeIn{from{opacity:0;transform:translateY(5px);}to{opacity:1;transform:none;}}
.conv-item.active{background:var(--surface2);}
.conv-title{
  font-size:13px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  flex:1;transition:opacity .18s cubic-bezier(.4,0,.2,1),width .32s;
}
#sidebar.collapsed .conv-title{opacity:0;width:0;}
#sidebar.collapsed .conv-item{justify-content:center;padding:8px;}
.conv-item .conv-icon{display:none;flex-shrink:0;color:var(--muted);}
#sidebar.collapsed .conv-item .conv-icon{display:flex;}

.conv-menu-btn{
  width:22px;height:22px;border:none;background:none;color:var(--muted);
  border-radius:4px;cursor:pointer;visibility:hidden;align-items:center;justify-content:center;
  flex-shrink:0;font-size:14px;transition:background .1s;display:flex;
}
.conv-item:hover .conv-menu-btn,.conv-item.active .conv-menu-btn{visibility:visible;}
.conv-menu-btn:hover{background:var(--surface2);color:var(--text);}
#sidebar.collapsed .conv-menu-btn{display:none!important;}


.sb-footer{
  padding:12px 10px 14px;
  display:flex;
  flex-direction:column;
  gap:5px;
  align-items:center;
  flex-shrink:0;
  box-sizing:border-box;
  transition:padding .32s cubic-bezier(.4,0,.2,1);
}
#sidebar.collapsed .sb-footer{
  padding:12px 0 16px;
  justify-content:center;
  flex-direction:column;
  align-items:center;
  gap:5px;
}
.sb-footer-btn{
  width:100%;padding:9px 10px;background:none;border:1px solid transparent;
  border-radius:9px;color:var(--text);font-size:13px;font-weight:500;cursor:pointer;
  display:flex;align-items:center;gap:9px;transition:background .15s, border-color .15s,width .32s cubic-bezier(.4,0,.2,1),padding .32s cubic-bezier(.4,0,.2,1),border-radius .32s cubic-bezier(.4,0,.2,1),gap .32s cubic-bezier(.4,0,.2,1);
  white-space:nowrap;overflow:hidden;
}
.sb-footer-btn:hover{background:var(--surface);border-color:var(--border);}
.sb-footer-btn.settings-trigger{
  background:var(--surface);border:none;border-radius:20px;
  height:36px;padding:0 14px;
  transition:background .18s;
}
.sb-footer-btn.settings-trigger:hover{background:var(--surface2);}
.sb-footer-btn svg{flex-shrink:0;color:var(--accent2);}
.sb-footer-btn span{transition:opacity .18s cubic-bezier(.4,0,.2,1),max-width .32s cubic-bezier(.4,0,.2,1);max-width:200px;overflow:hidden;}
#sidebar.collapsed .sb-footer-btn{
  flex:none;
  width:32px;
  height:32px;
  padding:0;
  display:flex;
  justify-content:center;
  align-items:center;
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
  margin:0 auto;
}
#sidebar.collapsed .sb-footer-btn span{display:none;}
.profile-row{
  width:100%;padding:8px 10px;background:none;border:none;border-radius:9px;color:var(--text);
  display:flex;align-items:center;gap:9px;cursor:pointer;transition:background .18s,width .32s cubic-bezier(.4,0,.2,1),padding .32s cubic-bezier(.4,0,.2,1),border-radius .32s cubic-bezier(.4,0,.2,1),gap .32s cubic-bezier(.4,0,.2,1);
  white-space:nowrap;overflow:hidden;
}
.profile-row:hover{background:var(--surface);}
#sidebar.collapsed .profile-row{
  flex:none;
  width:32px;
  height:32px;
  padding:0;
  display:flex;
  justify-content:center;
  align-items:center;
  border-radius:8px;
  background:#252525;
  margin:0 auto;
  gap:0;
}
#sidebar.collapsed .profile-info{display:none!important;}
#sidebar.collapsed .signout-btn{display:none!important;}
.avatar{
  width:28px;height:28px;border-radius:50%;background:var(--surface2);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;
  color:var(--muted);flex-shrink:0;
}
.profile-info{flex:1;overflow:hidden;transition:opacity .18s cubic-bezier(.4,0,.2,1),max-width .32s cubic-bezier(.4,0,.2,1);max-width:160px;text-align:left;}
#sidebar.collapsed .profile-info{opacity:0;max-width:0;}
.profile-name{font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.profile-email{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.signout-btn{
  border:none;background:none;color:var(--muted);cursor:pointer;padding:4px;
  border-radius:4px;flex-shrink:0;transition:color .15s;display:flex;
}
.signout-btn:hover{color:var(--danger);}
#sidebar.collapsed .signout-btn{display:none;}


#main{
  flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0;position:relative;
  background: var(--bg);
}


#ghost-mode-btn{
  position:absolute;top:12px;right:14px;z-index:50;
  display:flex;align-items:center;gap:7px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:20px;padding:6px 13px 6px 10px;
  font-family:inherit;font-size:12px;font-weight:500;color:var(--muted);
  cursor:pointer;transition:background .2s, border-color .2s, color .2s, box-shadow .2s;white-space:nowrap;
}
#ghost-mode-btn:hover{background:var(--surface2);color:var(--text);border-color:var(--border);}
#ghost-mode-btn.active{
  background:rgba(88,166,255,.08);
  border-color:rgba(88,166,255,.35);
  color:#58a6ff;
  box-shadow:0 0 0 3px rgba(88,166,255,.07);
}
#ghost-mode-btn svg{flex-shrink:0;transition:transform .3s cubic-bezier(.34,1.56,.64,1);}
#ghost-mode-btn.active svg{transform:scale(1.15);}


#ghost-banner{
  overflow:hidden;max-height:0;opacity:0;
  display:flex;align-items:center;justify-content:center;gap:7px;
  background:rgba(88,166,255,.07);
  border-bottom:1px solid rgba(88,166,255,.15);
  font-size:12px;color:rgba(88,166,255,.8);flex-shrink:0;
  transition:max-height .35s cubic-bezier(.4,0,.2,1), opacity .25s ease, padding .35s cubic-bezier(.4,0,.2,1);
  padding:0 14px;
}
#ghost-banner.show{max-height:40px;opacity:1;padding:7px 14px;}

@keyframes ghostFloat{
  0%,100%{transform:translateY(0);}
  50%{transform:translateY(-7px);}
}


#chat-window{
  flex:1;overflow-y:auto;padding:20px 16px 12px;
  display:flex;flex-direction:column;gap:6px;scroll-behavior:smooth;
}
#chat-window::-webkit-scrollbar{width:4px;}
#chat-window::-webkit-scrollbar-thumb{background:var(--border);border-radius:4px;}
.ad.adsbox.ad-banner.advertisement{position:absolute!important;left:-10000px!important;top:-10000px!important;width:2px!important;height:2px!important;pointer-events:none!important;}
#feature-access-notice{position:fixed;inset:0;z-index:20000;display:none;align-items:center;justify-content:center;padding:20px;background:rgba(0,0,0,.8);backdrop-filter:blur(10px);}.adblock-detected #feature-access-notice{display:flex;}.adblock-card{width:min(390px,100%);padding:28px;background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:0 28px 80px rgba(0,0,0,.65);text-align:left;}.adblock-card h2{margin:0 0 8px;font-size:18px;color:var(--text);text-align:left;}.adblock-card p{margin:0 0 15px;color:var(--muted);font-size:13px;line-height:1.5;}.adblock-points{margin:0 0 20px;padding-left:19px;color:var(--muted);font-size:12px;line-height:1.5;}.adblock-points li+li{margin-top:9px;}.adblock-actions{display:grid;gap:8px;}.adblock-card button{width:100%;border:0;border-radius:10px;padding:14px;background:var(--accent-primary,#1f6feb);color:#fff;font:800 17px inherit;cursor:pointer;}.adblock-card .adblock-limited-btn{background:transparent;border:1px solid var(--border);color:var(--text);}
.chat-load-indicator{margin:auto;display:grid;place-items:center;min-height:120px;}.chat-load-indicator .spinner-loader{width:30px;height:30px;border-width:3px;border-color:rgba(139,148,158,.28);border-top-color:var(--accent2);}


.welcome{
  margin:auto;text-align:center;max-width:380px;padding:20px 0 14px;
  animation:fadeUp .4s cubic-bezier(.25,.46,.45,.94);
}
@keyframes fadeUp{from{opacity:0;transform:translateY(12px);}to{opacity:1;transform:none;}}
.welcome h2{font-size:17px;font-weight:600;color:var(--text);margin-bottom:14px;}
.welcome-dots{justify-content:center;}
.welcome-dots span{width:8px;height:8px;}
.welcome-typewriter{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  font-size:24px;
  font-weight:600;
  letter-spacing:-.35px;
  color:var(--text);
}
.welcome-typewriter-text{
  background:linear-gradient(90deg,#f5f5f5,#cfcfcf);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.welcome-typewriter-caret{
  width:2px;
  height:1.1em;
  margin-left:6px;
  border-radius:2px;
  background:var(--accent2);
  animation:blink .8s step-end infinite;
}


.message{display:flex;max-width:100%;animation:msgIn .32s cubic-bezier(.25,.46,.45,.94) forwards;}
@keyframes msgIn{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:translateY(0);}}
.history-message-fade{animation-fill-mode:both;}
.message.user{justify-content:flex-end;}
.message.ai{justify-content:flex-start;}
.bubble{
  max-width:72%;padding:10px 14px;font-size:14px;line-height:1.55;
  word-break:break-word;
}
.message.user .bubble{
  background:var(--user-bubble);color:#ffffff;
  border-radius:18px 18px 4px 18px;
  box-shadow:none;
  white-space:pre-wrap;
}
.message.ai .bubble{
  background:var(--ai-bubble);color:var(--text);
  border-radius:18px 18px 18px 4px;border:1px solid var(--ai-border);
}
.bubble img{display:block;max-width:100%;border-radius:10px;margin-bottom:6px;}
.bubble code{font-family:'Courier New',monospace;background:rgba(31,111,235,.1);padding:2px 6px;border-radius:4px;color:var(--accent2);}
.bubble p{margin:0 0 12px;line-height:1.6;}.bubble p:last-child{margin-bottom:0;}
.bubble blockquote{margin:12px 0;padding:12px 16px;border-left:3px solid var(--accent);background:rgba(31,111,235,.06);}
.bubble strong{font-weight:600;}
.bubble em{font-style:italic;}
.bubble a{color:var(--accent2);text-decoration:none;cursor:pointer;}
.bubble a:hover{text-decoration:underline;}
.bubble h1,.bubble h2,.bubble h3,.bubble h4,.bubble h5,.bubble h6{margin-top:4px;margin-bottom:4px;color:var(--text);}
.bubble h1{font-size:19px;}.bubble h2{font-size:17px;}.bubble h3{font-size:15px;}
.bubble h4{font-size:14px;}.bubble h5{font-size:13px;}.bubble h6{font-size:12px;color:var(--muted);}
.bubble ul,.bubble ol{margin:4px 0 4px 20px;padding:0;}
.bubble ul ul,.bubble ol ol,.bubble ul ol,.bubble ol ul{margin:2px 0 2px 16px;}
.bubble li{margin-bottom:2px;}
.bubble table{width:100%;border-collapse:collapse;margin:12px 0;}
.bubble th{padding:10px 12px;text-align:left;background:var(--surface2);border-bottom:1px solid var(--border);font-weight:500;font-size:13px;}
.bubble hr{border:none;border-top:1px solid var(--border);margin:16px 0;}
.bubble td{padding:10px 12px;border-bottom:1px solid var(--border);font-size:13px;}
.bubble tr:last-child td{border-bottom:none;}
.message.ai .bubble .ai-fade-line{
  opacity:0;
  transform:translateY(6px);
  animation:aiLineIn .2s cubic-bezier(.22,1,.36,1) forwards;
  will-change:opacity,transform;
}
@keyframes aiLineIn{
  to{
    opacity:1;
    transform:none;
  }
}

.bubble .code-header{
  display:flex;align-items:center;gap:6px;font-size:11px;font-weight:500;color:var(--muted);
  background:var(--surface2);border:1px solid var(--border);
  border-bottom:none;border-radius:8px 8px 0 0;padding:6px 10px;
  font-family:inherit;letter-spacing:.03em;
}
.bubble .code-header img{display:inline-block;flex-shrink:0;width:14px;height:14px;vertical-align:middle;}
.bubble .code-header span{vertical-align:middle;}
.bubble pre{margin:0 0 12px;padding:0;overflow-x:auto;border-radius:0 0 12px 12px;border:1px solid var(--border);}
.bubble pre code.hljs{border-radius:0 0 12px 12px;padding:12px;font-size:13px;}
.bubble pre:hover{opacity:.93;}
.bubble pre:last-child{margin-bottom:0;}


.typing-dots{display:flex;gap:4px;align-items:center;padding:2px 0;}
.typing-dots span{width:5px;height:5px;background:var(--muted);border-radius:50%;animation:dot 1.2s infinite;}
.typing-dots span:nth-child(2){animation-delay:.2s;}
.typing-dots span:nth-child(3){animation-delay:.4s;}
@keyframes dot{0%,60%,100%{opacity:.3;}30%{opacity:1;}}
.bubble.streaming:not(.loading-dots)::after{
  content:'';display:inline-block;width:2px;height:1em;
  background:var(--accent2);border-radius:1px;margin-left:2px;
  vertical-align:text-bottom;animation:blink .7s step-end infinite;
}
@keyframes blink{0%,100%{opacity:1;}50%{opacity:0;}}



#chat-fade {
  position: relative;
  flex-shrink: 0;
  height: 48px;
  margin-bottom: -48px;
  pointer-events: none;
  z-index: 2;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 60%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 60%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: linear-gradient(to bottom, rgba(17,17,17,0.8), transparent);
}

#input-area{padding:6px 12px 6px;padding-bottom:max(8px,env(safe-area-inset-bottom));background:transparent;position:relative;flex-shrink:0;z-index:3;}
#footer{padding:2px 14px 4px;padding-bottom:max(8px,env(safe-area-inset-bottom));text-align:center;font-size:11px;color:var(--muted);background:transparent;flex-shrink:0;position:sticky;bottom:0;z-index:1;}

#file-previews{display:none;flex-wrap:wrap;gap:6px;padding:4px 4px 2px;}
#file-previews.has-files{display:flex;}
.file-chip{
  display:flex;align-items:center;gap:5px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:8px;padding:4px 8px;
  font-size:11px;color:var(--muted);max-width:160px;
}
.file-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.file-chip-remove{
  background:none;border:none;cursor:pointer;color:var(--muted);
  font-size:13px;padding:0;line-height:1;flex-shrink:0;transition:color .15s;
}
.file-chip-remove:hover{color:var(--text);}
.attachment-tag{
  display:flex;align-items:center;gap:5px;
  margin-top:6px;font-size:11px;opacity:.6;color:var(--muted);
}
.attachment-tag svg{flex-shrink:0;opacity:.85;}
.attachment-tag span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}


#model-btn .chevron {
  color: var(--muted);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  flex-shrink: 0;
}
#model-btn.open .chevron {
  transform: rotate(90deg);
}
#model-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#model-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 99999;
  opacity: 0;
  transform: translateY(-6px) scaleY(.95);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity .18s, transform .2s cubic-bezier(.34,1.3,.64,1);
  overflow: hidden;
  min-width: 220px;
}
#model-menu.open {
  opacity: 1;
  transform: none;
  pointer-events: all;
}
#model-menu-inner {
  overflow-y: auto;
  max-height: 167px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
#model-menu-inner::-webkit-scrollbar {
  width: 3px;
}
#model-menu-inner::-webkit-scrollbar-track {
  background: transparent;
}
#model-menu-inner::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}
#model-menu-inner:hover::-webkit-scrollbar-thumb { background: transparent; }
.model-opt {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  min-height: 40px;
  touch-action: manipulation;
  transition: background .12s;
}
.model-opt:last-child {
  border-bottom: none;
}
.model-opt:hover, .model-opt:active {
  background: var(--surface2);
}
.model-opt > span:first-child {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-opt .check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent2);
  opacity: 0;
  transition: opacity .2s;
  margin-left: auto;
}
.model-opt.selected .check {
  opacity: 1;
}
.model-opt .tag {
  font-size: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.model-opt.vision-model .tag {
  color: var(--accent2);
  border-color: rgba(56,139,253,.25);
  background: rgba(56,139,253,.08);
}
.donor-mode-row{align-items:center;gap:14px;}.donor-mode-row>span{display:flex;flex-direction:column;gap:4px;flex:1;}.donor-mode-row small{font-size:12px;color:var(--muted);line-height:1.4;}
.donor-key-title{color:#fff!important;letter-spacing:.02em;}.donor-key-field{height:46px;box-sizing:border-box;margin-top:10px;border:1px solid #3a3a3a;border-radius:10px;background:#202020;overflow:hidden;transition:border-color .15s,box-shadow .15s,background .15s;}.donor-key-field:focus-within{border-color:#2f7cf6;background:#232323;box-shadow:0 0 0 3px rgba(47,124,246,.14);}.donor-key-field input{display:block;width:100%;min-width:0;height:100%;box-sizing:border-box;padding:10px 46px 10px 14px!important;border:0!important;background:transparent!important;color:#fff!important;font:13px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace;}.donor-key-field input::placeholder{color:#a1a1a1;}
#donor-openrouter-status,#sidenav-byok-status,#byok-status{opacity:0;transform:translateY(-3px);transition:opacity .2s ease,transform .2s ease;}#donor-openrouter-status.key-status-visible,#sidenav-byok-status.key-status-visible,#byok-status.key-status-visible{opacity:1;transform:translateY(0);}

#send-btn.send-press{animation:sendPress .26s cubic-bezier(.22,1,.36,1);}
@keyframes sendPress{0%{transform:scale(1)}45%{transform:scale(.86)}100%{transform:scale(1)}}


@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.plus-popup {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 240px;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 6px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform-origin: bottom left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transition: opacity .18s ease, transform .22s cubic-bezier(.22,1,.36,1), visibility 0s linear .22s;
}
.plus-popup.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}
.popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ececec;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  position: relative;
}
.popup-item:hover {
  background: var(--surface2);
}
.popup-item.active {
  color: #3b82f6; 
}
.popup-item.active:hover {
  background: rgba(59, 130, 246, 0.08);
}
.popup-icon {
  flex-shrink: 0;
  color: #888888;
  transition: color 0.15s;
}
.popup-item:hover .popup-icon {
  color: #ffffff;
}
.popup-item.active .popup-icon {
  color: #3b82f6;
}
.popup-item .check-icon {
  margin-left: auto;
  color: #3b82f6;
  display: none;
  flex-shrink: 0;
}
.popup-item.active .check-icon {
  display: block;
}
.popup-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
  flex-shrink: 0;
}


#popup-web-search:hover,
#popup-deep-research:hover {
  background: transparent;
}
#popup-web-search:hover .popup-icon,
#popup-deep-research:hover .popup-icon {
  color: #888888;
}
#popup-web-search.active:hover,
#popup-deep-research.active:hover {
  background: transparent;
}


.popup-item.locked {
  opacity: 0.6;
  cursor: not-allowed;
}
.popup-item.locked:hover {
  background: transparent;
}
.popup-item.locked .popup-icon {
  color: #666;
}
.popup-item.locked .lock-icon {
  margin-left: auto;
  color: #666;
  display: block;
  flex-shrink: 0;
}
.popup-item .lock-icon {
  display: none;
}

.spin{width:10px;height:10px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite;}
@keyframes spin{to{transform:rotate(360deg);}}

.bar{
  display:flex;align-items:center;gap:8px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:24px;padding:8px 8px 8px 6px;
  transition:border-radius .3s cubic-bezier(.34,1.56,.64,1),border-color .2s;
}
.bar:focus-within{border-color:#383838;}
.char-count{display:flex;align-items:center;color:var(--muted);font-size:12px;white-space:nowrap;min-width:60px;}
.char-count.overlimit{color:var(--danger);}
#plus-btn{
  width:32px;height:32px;flex-shrink:0;
  background:var(--surface2);border:1px solid var(--border);
  border-radius:50%;cursor:pointer;
  position:relative;
  transition:background .2s,transform .3s cubic-bezier(.34,1.56,.64,1);
  touch-action:manipulation;padding:0;box-sizing:border-box;
}
#plus-btn .plus-h,#plus-btn .plus-v{
  display:block;position:absolute;background:var(--text);border-radius:2px;
}
#plus-btn .plus-h{width:12px;height:2px;top:14px;left:9px;transition:transform .3s cubic-bezier(.34,1.56,.64,1);}
#plus-btn .plus-v{width:2px;height:12px;top:9px;left:14px;transition:transform .3s cubic-bezier(.34,1.56,.64,1);}
#plus-btn:hover{background:var(--border);}
#plus-btn.active .plus-h{transform:rotate(45deg) translate(0,0);}
#plus-btn.active .plus-v{transform:rotate(45deg) translate(0,0);}
#user-input{
  flex:1;background:transparent;border:none;outline:none;
  font-family:inherit;font-size:16px;color:var(--text);
  resize:none;max-height:120px;min-height:20px;
  line-height:1.5;padding:6px 4px;touch-action:manipulation;
}
#user-input::placeholder{color:var(--muted);}
#send-btn{
  width:32px;height:32px;flex-shrink:0;
  background:var(--accent-primary,#1f6feb);color:#fff;
  border:none;border-radius:50%;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:all .2s cubic-bezier(.25,.46,.45,.94);
  touch-action:manipulation;
}
#send-btn:not(:disabled):hover{background:var(--accent-primary-hover,#1a60d6);}
#send-btn svg{display:block;width:13px;height:13px;pointer-events:none;}
#send-btn:active{transform:scale(.95);}
#send-btn:disabled{opacity:.3;cursor:not-allowed;transform:none;box-shadow:none;}

.file-chip.animate-in{animation:fileIn .25s ease-out forwards;}
@keyframes fileIn{from{opacity:0;transform:translateY(8px) scale(.95);}to{opacity:1;transform:none;}}

.image-modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:9999;padding:24px;opacity:0;pointer-events:none;transition:opacity .22s ease;}
.image-modal.active{opacity:1;pointer-events:auto;}
.image-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.75);backdrop-filter:blur(4px);opacity:0;transition:opacity .22s ease;}
.image-modal.active .image-modal-backdrop{opacity:1;}
.image-modal-content{position:relative;max-width:min(95vw,720px);max-height:min(95vh,720px);border-radius:18px;overflow:hidden;box-shadow:0 28px 80px rgba(0,0,0,.35);background:rgba(0,0,0,.9);transform:scale(.94);opacity:0;transition:transform .22s ease,opacity .22s ease;}
.image-modal.active .image-modal-content{transform:scale(1);opacity:1;}
.image-modal-content img{display:block;width:100%;height:auto;max-height:80vh;object-fit:contain;}
.image-modal-caption{padding:12px 14px 14px;font-size:13px;color:#fff;background:rgba(0,0,0,.45);}


.ctx-menu{
  position:fixed;background:var(--surface2);border:1px solid var(--border);
  border-radius:9px;padding:4px;z-index:500;min-width:140px;
  box-shadow:0 8px 24px rgba(0,0,0,.5);
  opacity:0;transform:translateY(6px) scale(.97);pointer-events:none;
  transition:opacity .15s ease,transform .15s cubic-bezier(.22,1,.36,1);
}
.ctx-menu.open{
  opacity:1;transform:translateY(0) scale(1);pointer-events:auto;
  transition:opacity .2s ease,transform .2s cubic-bezier(.22,1,.36,1);
}
@keyframes popIn{from{opacity:0;transform:scale(.95);}to{opacity:1;transform:scale(1);}}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
@keyframes slideUp{from{opacity:0;transform:translateY(16px) scale(.97);}to{opacity:1;transform:none;}}
.ctx-item{
  display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:6px;
  font-size:13px;cursor:pointer;transition:background .1s;color:var(--text);
  border:none;background:none;width:100%;
}
.ctx-item:hover{background:var(--surface);}
.ctx-item.danger{color:var(--danger);}
.ctx-item.danger:hover{background:rgba(248,81,73,.1);}


#auth-screen{
  position:fixed;inset:0;display:none;align-items:center;justify-content:center;
  z-index:1000;padding:20px;padding-bottom:max(20px,env(safe-area-inset-bottom));
}
#auth-screen.visible{display:flex;}
.auth-backdrop{
  position:absolute;inset:0;background:rgba(0,0,0,0);backdrop-filter:blur(0px);
  transition:background .3s ease,backdrop-filter .3s ease;
}
#auth-screen.visible .auth-backdrop{background:rgba(0,0,0,.82);backdrop-filter:blur(12px);}
.auth-box{
  position:relative;z-index:1;width:100%;max-width:320px;
  padding:32px 28px 28px;
  background:var(--surface);border-radius:24px;
  box-shadow:0 32px 80px rgba(0,0,0,.85),0 0 0 1px rgba(255,255,255,.07);
  opacity:0;transform:translateY(32px) scale(.95);
  transition:opacity .4s cubic-bezier(.22,1,.36,1),transform .4s cubic-bezier(.22,1,.36,1);
}
#auth-screen.visible .auth-box{opacity:1;transform:none;}
.auth-close{
  position:absolute;top:16px;right:16px;
  width:28px;height:28px;border-radius:50%;
  border:1px solid var(--border);background:var(--surface2);color:var(--muted);
  cursor:pointer;font-size:16px;line-height:28px;text-align:center;
  transition:background .15s,color .15s;display:flex;align-items:center;justify-content:center;
}
.auth-close:hover{background:var(--surface2);color:var(--text);}
.auth-logo{font-size:13px;font-weight:600;color:#888;letter-spacing:.06em;text-transform:uppercase;margin-bottom:20px;}
.auth-box h2{font-size:22px;font-weight:700;color:var(--text);letter-spacing:-.4px;margin-bottom:6px;line-height:1.2;}
.auth-box .auth-sub{color:var(--muted);font-size:13px;margin-bottom:28px;line-height:1.5;}

.auth-steps{display:flex;gap:6px;margin-bottom:24px;}
.auth-step-dot{width:6px;height:6px;border-radius:50%;background:var(--border);transition:background .3s,width .3s;flex-shrink:0;}
.auth-step-dot.active{background:#1f6feb;width:18px;border-radius:3px;}

.auth-field{margin-bottom:14px;}
.auth-field input{
  width:100%;padding:14px 16px;
  background:var(--surface2);border:1.5px solid transparent;
  border-radius:12px;color:var(--text);font-size:15px;outline:none;
  font-family:inherit;
  transition:border-color .2s,background .2s;
  -webkit-user-select:text;user-select:text;
}
.auth-field input:focus{background:#2e2e2e;}
.auth-field input::placeholder{color:#555;}
.auth-btn{
  width:100%;padding:14px;background:#1f6feb;border:none;border-radius:12px;
  color:#fff;font-size:15px;font-weight:600;cursor:pointer;margin-top:4px;
  transition:background .2s,transform .15s,box-shadow .2s;
  font-family:inherit;
}
.auth-btn:hover{background:#1a60d6;box-shadow:0 6px 20px rgba(31,111,235,.4);}
.auth-btn:active{transform:scale(.98);}
.auth-btn:disabled{opacity:.45;cursor:not-allowed;transform:none;box-shadow:none;}
.auth-btn.locked{background:#f85149;opacity:1;cursor:not-allowed;}
.auth-btn.locked:hover{background:#f85149;box-shadow:none;}
.auth-provider-row{display:flex;gap:10px;margin-top:10px;}.auth-provider-btn{flex:1;min-height:48px;display:flex;align-items:center;justify-content:center;padding:11px;border:0;border-radius:12px;background:var(--surface2);color:var(--text);cursor:pointer;transition:background .15s;}.auth-provider-btn:hover{background:#303030;}.auth-provider-btn:disabled{opacity:.45;cursor:not-allowed;}
.provider-icon{width:22px;height:22px;object-fit:contain;}
.provider-mark{width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;font-weight:700;line-height:1;}.google-mark{color:#4285f4;font-family:Arial,sans-serif;font-size:20px;}.microsoft-mark{display:grid;grid-template-columns:repeat(2,8px);grid-template-rows:repeat(2,8px);gap:2px;}.microsoft-mark i:nth-child(1){background:#f25022}.microsoft-mark i:nth-child(2){background:#7fba00}.microsoft-mark i:nth-child(3){background:#00a4ef}.microsoft-mark i:nth-child(4){background:#ffb900}
.discord-mark{color:#5865f2;font-size:21px;}
.github-mark{color:var(--text);font-size:20px;}
.password-field{position:relative;}.password-field input{padding-right:46px!important;}.password-toggle{position:absolute;right:9px;top:50%;transform:translateY(-50%);width:30px;height:30px;border:0;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer;display:grid;place-items:center;}.password-toggle svg{width:17px;height:17px;}.password-toggle:hover{background:rgba(255,255,255,.08);color:var(--text);}
.dot-loader{display:inline-flex;align-items:center;justify-content:center;gap:4px;height:14px;}
.dot-loader span{
  width:5px;height:5px;border-radius:50%;background:currentColor;
  animation:dot-bounce 1.1s infinite ease-in-out both;
}
.dot-loader span:nth-child(1){animation-delay:-0.24s;}
.dot-loader span:nth-child(2){animation-delay:-0.12s;}
.dot-loader span:nth-child(3){animation-delay:0s;}
.spinner-loader{display:inline-block;width:17px;height:17px;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:spin-loader .7s linear infinite;vertical-align:middle;}@keyframes spin-loader{to{transform:rotate(360deg)}}
.sidebar-loading{text-align:center;padding:20px 0;}.sidebar-loading .spinner-loader{width:15px;height:15px;border-color:rgba(139,148,158,.28);border-top-color:var(--accent2);}
@keyframes dot-bounce{
  0%, 80%, 100% { transform:scale(0.6); opacity:.5; }
  40% { transform:scale(1); opacity:1; }
}
.auth-divider{display:flex;align-items:center;gap:12px;margin:18px 0;color:#444;font-size:12px;}
.auth-divider::before,.auth-divider::after{content:'';flex:1;height:1px;background:#2a2a2a;}
.auth-switch{text-align:center;font-size:13px;color:#555;margin-top:16px;}
.auth-switch button{background:none;border:none;color:#888;cursor:pointer;font-size:13px;font-family:inherit;transition:color .15s;padding:0;}
.auth-switch button:hover{color:#fff;}
.auth-error{color:#f85149;font-size:12px;margin-top:10px;text-align:center;min-height:16px;}
.auth-success{color:#3fb950;font-size:13px;margin-top:10px;text-align:center;line-height:1.5;}
.auth-method-list{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:12px;overflow:hidden;}.auth-method-row{display:flex;align-items:center;gap:10px;padding:13px 14px;border-bottom:1px solid var(--border);font-size:13px;}.auth-method-row:last-child{border-bottom:0;}.auth-method-row>span:first-child{min-width:78px;color:var(--text);font-weight:500;}.auth-provider-name{display:flex;align-items:center;gap:8px;}.auth-provider-name img{width:16px;height:16px;object-fit:contain;}.auth-method-email{margin-left:auto;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.auth-password-row>span:last-child,.auth-status{margin-left:auto;color:#f87171;font-size:12px;}.auth-status.linked,.auth-password-row>span:last-child.linked{color:#4ade80;}.auth-link-btn{padding:5px 9px;border:1px solid var(--border);border-radius:7px;background:var(--surface2);color:var(--text);font:600 12px inherit;cursor:pointer;}.auth-link-btn:hover{border-color:#666;}.auth-link-btn[disabled]{opacity:.45;cursor:not-allowed;}.auth-password-set{padding:12px 14px;border-bottom:1px solid var(--border);}.auth-password-set .settings-save-btn{margin-top:9px;width:100%;padding:8px;}.auth-password-set input{box-sizing:border-box;width:100%;height:42px;padding:10px 42px 10px 12px;background:var(--surface2);border:1px solid var(--border);border-radius:9px;color:var(--text);font:13px inherit;outline:none;transition:border-color .15s,background .15s;}.auth-password-set input::placeholder{color:var(--muted);}.auth-password-set input:focus{border-color:var(--accent2);background:rgba(31,111,235,.06);}
.auth-delete-btn{margin-top:16px!important;background:transparent!important;border:1px solid rgba(248,81,73,.55)!important;color:#f87171!important;}.auth-delete-btn:hover{background:rgba(248,81,73,.10)!important;}
.auth-inline-row{position:relative;display:flex;align-items:center;min-height:48px;border-bottom:1px solid var(--border);background:var(--surface2);}.auth-inline-row:first-child{border-radius:11px 11px 0 0;overflow:hidden;}.auth-inline-row input{width:100%;height:48px;box-sizing:border-box;border:0;background:transparent;color:var(--text);font:13px inherit;outline:0;padding:0 46px 0 14px;}.auth-inline-row input::placeholder{color:var(--muted);}.auth-inline-row:focus-within{z-index:1;box-shadow:inset 0 0 0 1px var(--accent-primary,#1f6feb);}.auth-inline-save{position:absolute;right:9px;width:28px;height:28px;border:0;border-radius:8px;background:transparent;color:var(--accent-primary,#1f6feb);display:grid;place-items:center;cursor:pointer;padding:0;}.auth-inline-save:hover{background:rgba(255,255,255,.08);}.auth-inline-save svg{width:16px;height:16px;}.auth-inline-eye{right:41px;}.auth-inline-row.password-field input{padding-right:78px!important;}.auth-email-row{background:rgba(255,255,255,.018);}.auth-email-row input{color:var(--muted);padding-right:58px;cursor:default;}.auth-email-row span{position:absolute;right:14px;color:var(--muted);font-size:11px;}.auth-delete-btn{background:#ef4444!important;border-color:#ef4444!important;color:#fff!important;}.auth-delete-btn:hover{background:#dc2626!important;}


.modal-bg{
  position:fixed;inset:0;z-index:9600;
  display:none;align-items:center;justify-content:center;
  padding:20px;
}
.modal-bg.open{display:flex;}
.modal-bg .modal-backdrop{
  position:absolute;inset:0;background:rgba(0,0,0,0);backdrop-filter:blur(0px);
  transition:background .3s ease,backdrop-filter .3s ease;
}
.modal-bg.open.visible .modal-backdrop{background:rgba(0,0,0,.75);backdrop-filter:blur(8px);}
.modal{
  position:relative;z-index:1;
  background:var(--surface);border-radius:16px;padding:28px 24px 24px;
  width:100%;max-width:300px;
  box-shadow:0 24px 60px rgba(0,0,0,.7),0 0 0 1px rgba(255,255,255,.06);
  opacity:0;transform:translateY(20px) scale(.96);
  transition:opacity .35s cubic-bezier(.22,1,.36,1),transform .35s cubic-bezier(.22,1,.36,1);
}
.modal-bg.open.visible .modal{opacity:1;transform:none;}
.modal h3{font-size:16px;font-weight:600;margin-bottom:6px;text-align:center;}
.modal p.modal-sub{font-size:13px;color:var(--muted);text-align:center;margin-bottom:20px;}
.modal input{
  width:100%;padding:12px 14px;background:#2a2a2a;border:1.5px solid transparent;
  border-radius:10px;color:var(--text);font-size:14px;outline:none;margin-bottom:16px;
  font-family:inherit;transition:border-color .2s;
}
.modal input:focus{border-color:transparent;}
.modal-actions{display:flex;gap:10px;justify-content:center;}
.modal-btn{
  flex:1;padding:11px;border-radius:10px;border:none;
  font-size:14px;font-weight:500;cursor:pointer;transition:all .15s;font-family:inherit;
}
.modal-btn.cancel{background:#2a2a2a;color:var(--text);}
.modal-btn.cancel:hover{background:var(--surface2);}
.modal-btn.primary{background:#1f6feb;color:#fff;}
.modal-btn.primary:hover{background:#1a60d6;}
.modal-btn.danger{background:#f85149;color:#fff;}
.modal-btn.danger:hover{background:#e03d35;}


#overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:15;display:none;animation:fadeIn .2s ease;}
#overlay.show{display:block;}

@media(max-width:640px){
  #sidebar{position:absolute;top:0;left:0;height:100%;height:100dvh;z-index:200;}
  #sidebar.collapsed{width:var(--sidebar-icon-w);}
  #main{margin-left:var(--sidebar-icon-w);transition:margin-left .32s cubic-bezier(.4,0,.2,1);}
  #sidebar:not(.collapsed) ~ #main{margin-left:0;}
  .auth-box{margin:0 16px;max-width:calc(100% - 32px);}
  #auth-screen{align-items:flex-end;padding-bottom:max(24px,env(safe-area-inset-bottom));}
}


#sidebar.collapsed .conv-item{position:relative;}
#sidebar.collapsed .guest-conv-msg{opacity:0;pointer-events:none;}


#main.has-welcome {
  justify-content: center;
}
#main.has-welcome #chat-window {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  padding: 0 16px;
}
#main.has-welcome .welcome {
  margin: 0 0 20px;
  text-align: center;
}
#main.has-welcome #chat-fade {
  display: none;
}
#main.has-welcome #input-area {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 8px;
  flex-shrink: 0;
}
#main:not(.has-welcome) #input-area {
  margin-top: auto;
}

#sidebar.collapsed .conv-list { visibility: hidden; opacity: 0; pointer-events: none; }
#sidebar.collapsed .sb-search {
  padding: 6px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: visible;
  opacity: 1;
}


.settings-anchor{
  position:relative;width:100%;
}
.settings-popup{
  position:fixed;
  background:var(--surface);border:1px solid var(--border);border-radius:12px;
  padding:4px;z-index:300;min-width:220px;
  box-shadow:0 8px 28px rgba(0,0,0,.4);
  opacity:0;transform:translateY(8px) scale(.97);
  pointer-events:none;
  transition:opacity .2s cubic-bezier(.22,1,.36,1),transform .2s cubic-bezier(.22,1,.36,1);
  left:14px;max-width:calc(100vw - 80px);overflow-y:auto;max-height:60vh;
}
.settings-popup.open{
  opacity:1;transform:translateY(0) scale(1);pointer-events:auto;
}
.settings-profile-header{
  display:flex;align-items:center;gap:10px;
  padding:10px 10px 8px;pointer-events:none;cursor:default;
}
.settings-profile-header .avatar{
  position:relative;display:flex;align-items:center;justify-content:center;
}
.settings-profile-header .avatar img{display:block;width:28px;height:28px;border-radius:50%;object-fit:cover;}
.settings-guest-icon{
  width:15px;height:15px;color:var(--muted);flex-shrink:0;
}
.settings-profile-info{flex:1;overflow:hidden;min-width:0;}
.settings-profile-name{font-size:13px;font-weight:500;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.settings-profile-email{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.settings-sep{height:1px;background:var(--border);margin:4px 6px;}
.settings-trigger.active{background:var(--surface);}
.settings-detail-screen{
  position:fixed;inset:0;z-index:8500;display:none;align-items:center;justify-content:center;padding:20px;
}
.settings-detail-screen.open{display:flex;}
.settings-detail-backdrop{
  position:absolute;inset:0;background:rgba(0,0,0,0);backdrop-filter:blur(0px);
  transition:background .3s ease,backdrop-filter .3s ease;
}
.settings-detail-screen.open.visible .settings-detail-backdrop{background:rgba(0,0,0,.75);backdrop-filter:blur(10px);}
.settings-detail-box{
  position:relative;z-index:1;width:100%;max-width:560px;
  background:var(--surface);border-radius:20px;padding:0;
  box-shadow:0 32px 80px rgba(0,0,0,.85),0 0 0 1px rgba(255,255,255,.07);
  opacity:0;transform:translateY(24px) scale(.96);
  transition:opacity .35s cubic-bezier(.22,1,.36,1),transform .35s cubic-bezier(.22,1,.36,1);
  max-height:min(90vh,520px);overflow:hidden;
}
.settings-detail-screen.open.visible .settings-detail-box{opacity:1;transform:none;}
.settings-detail-back{display:none;}
.settings-detail-close{
  position:absolute;top:14px;right:14px;z-index:2;
  width:28px;height:28px;border-radius:50%;
  border:none;background:rgba(255,255,255,.08);color:#888;
  cursor:pointer;font-size:16px;display:grid;place-items:center;padding:0;line-height:1;
  transition:background .15s,color .15s;
}
.settings-detail-close:hover{background:var(--surface);color:var(--text);}
.settings-detail-close span{display:block;line-height:1;transform:translateY(-.5px);}
.settings-detail-layout{
  display:flex;height:min(90vh,520px);
}
.settings-sidenav{
  width:170px;flex-shrink:0;background:var(--surface2);border-right:1px solid var(--border);
  padding:48px 8px 12px;display:flex;flex-direction:column;gap:2px;overflow-y:auto;
}
.settings-sidenav-item{
  display:flex;align-items:center;gap:9px;width:100%;
  padding:9px 10px;background:none;border:none;border-radius:8px;
  color:var(--muted);font-size:13px;font-weight:500;cursor:pointer;
  text-align:left;font-family:inherit;transition:background .15s,color .15s;
  white-space:nowrap;
}
.settings-sidenav-item svg{flex-shrink:0;}
.settings-sidenav-item:hover{background:var(--surface);color:var(--text);}
.settings-sidenav-item.active{background:var(--surface);color:var(--text);}
.settings-detail-content{
  flex:1;overflow-y:auto;overflow-x:hidden;padding:48px 24px 24px;min-width:0;box-sizing:border-box;
}
.settings-detail-content.panel-switching .settings-panel.visible{
  animation:settingsPanelIn .24s cubic-bezier(.22,1,.36,1);
}
@keyframes settingsPanelIn{
  from{opacity:0;transform:translateX(12px);}
  to{opacity:1;transform:none;}
}
.settings-panel{display:none;}
.settings-panel.visible{display:block;}
.settings-title{font-size:18px;font-weight:700;color:var(--text);margin-bottom:16px;letter-spacing:-.3px;}
.settings-sub{font-size:12px;color:#666;margin-bottom:14px;line-height:1.5;}
.settings-item{
  width:100%;display:flex;align-items:center;gap:10px;
  padding:12px 10px;background:none;border:none;border-radius:10px;
  color:var(--text);font-size:14px;font-weight:500;cursor:pointer;
  transition:background .15s;text-align:left;font-family:inherit;
}
.settings-item:hover{background:var(--surface);}
.settings-item.danger{color:var(--danger);}
.settings-item.danger:hover{background:rgba(248,81,73,.1);}
.settings-signout-item{color:var(--danger);font-weight:400;}.settings-signout-item svg:first-child{color:var(--danger);}.settings-signout-item:hover{background:rgba(248,81,73,.1);}
.settings-item svg:first-child{flex-shrink:0;color:var(--accent2);}
.settings-chevron{margin-left:auto;flex-shrink:0;color:var(--muted);opacity:.6;}
.settings-back{
  background:none;border:none;color:var(--muted);font-size:13px;
  cursor:pointer;padding:0 0 12px;font-family:inherit;transition:color .15s;
}
.settings-back:hover{color:var(--text);}
.notif-permission-bar{background:rgba(245,158,11,.12);border:1px solid rgba(245,158,11,.3);border-radius:10px;padding:10px 12px;margin-bottom:16px;display:flex;align-items:center;justify-content:space-between;gap:10px;}.notif-permission-bar span{font-size:12px;color:#f59e0b;line-height:1.35;min-width:0;}.notif-permission-bar button{flex-shrink:0;border:1px solid rgba(245,158,11,.45);border-radius:7px;padding:5px 9px;background:transparent;color:#fbbf24;font:600 12px inherit;cursor:pointer;}.notif-permission-bar button:hover{background:rgba(245,158,11,.12);}
.settings-textarea{
  width:100%;background:var(--surface2);border:1px solid var(--border);border-radius:10px;
  padding:12px;font-size:13px;color:var(--text);font-family:inherit;
  resize:none;min-height:120px;max-height:200px;outline:none;line-height:1.5;
  overflow-y:auto;box-sizing:border-box;
  -webkit-user-select:text;user-select:text;
}
.settings-textarea-wrap{
  position:relative;
}
.settings-textarea-wrap .settings-textarea{
  padding-bottom:30px;
}
.settings-textarea:focus{border-color:var(--accent2);}
.settings-textarea::placeholder{color:var(--muted);}
.settings-word-count{
  position:absolute;
  right:10px;
  bottom:8px;
  font-size:10px;
  color:var(--muted);
  text-align:right;
  pointer-events:none;
}
.settings-word-count.overlimit{color:var(--danger);}
.settings-save-btn{
  width:100%;margin-top:14px;padding:11px;background:var(--accent-primary,#1f6feb);border:none;
  border-radius:10px;color:#fff;font-size:14px;font-weight:600;cursor:pointer;
  font-family:inherit;transition:background .15s;
}
.settings-save-btn:hover{background:var(--accent-primary-hover,#1a60d6);}
.settings-status{font-size:12px;margin-top:10px;min-height:16px;color:var(--muted);}
.settings-status:empty{display:none;}

.katex-display{overflow-x:auto;overflow-y:hidden;padding:4px 0;}.katex{font-size:1.05em;}
/* ── Appearance panel ─────────────────────────────────────── */
.appearance-section-label{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);margin-bottom:10px;}
.theme-cards{display:flex;gap:10px;flex-wrap:wrap;}
.theme-card{background:var(--surface);border:1.5px solid var(--border);border-radius:10px;padding:10px 14px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:6px;transition:border-color .15s;min-width:80px;}
.theme-card.active{border-color:var(--accent-primary,#1f6feb);}
.theme-card:hover{border-color:var(--accent-primary,#1f6feb);}
.theme-preview{width:52px;height:34px;border-radius:6px;overflow:hidden;display:flex;flex-direction:column;gap:3px;padding:5px;}
.theme-preview-dark{background:#111;}
.theme-preview-midnight{background:#000;}
.theme-preview-light{background:#f5f5f5;}
.theme-preview-bar{height:6px;border-radius:3px;background:rgba(255,255,255,.15);}
.theme-preview-light .theme-preview-bar{background:rgba(0,0,0,.12);}
.theme-preview-line{height:4px;border-radius:2px;background:rgba(255,255,255,.1);}
.theme-preview-line.short{width:60%;}
.theme-preview-light .theme-preview-line{background:rgba(0,0,0,.08);}
.theme-label{font-size:12px;color:var(--text);font-weight:500;}
.theme-check{font-size:11px;color:var(--accent-primary,#1f6feb);font-weight:700;height:14px;}
.font-cards{display:flex;gap:10px;flex-wrap:wrap;}
.font-card{background:var(--surface);border:1.5px solid var(--border);border-radius:10px;padding:10px 16px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px;transition:border-color .15s;min-width:70px;}
.font-card.active{border-color:var(--accent-primary,#1f6feb);}
.font-card:hover{border-color:var(--accent-primary,#1f6feb);}
.font-preview{font-size:22px;font-weight:600;color:var(--text);}
.font-label{font-size:11px;color:var(--muted);}
.font-check{font-size:11px;color:var(--accent-primary,#1f6feb);font-weight:700;height:14px;}
.accent-swatches{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:8px;}
.accent-swatch{width:28px;height:28px;border-radius:50%;border:2px solid transparent;cursor:pointer;transition:transform .15s,border-color .15s;display:flex;align-items:center;justify-content:center;}
.accent-swatch.active{border-color:#fff;transform:scale(1.15);}
.accent-swatch:hover{transform:scale(1.1);}
.accent-custom-swatch{background:var(--surface);border:1.5px solid var(--border);color:var(--muted);}

/* ── Notifications panel ─────────────────────────────────── */
.notif-row{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--border);}
.notif-row:last-child{border-bottom:none;}
.notif-label{font-size:13px;color:var(--text);}
.notif-toggle{position:relative;display:inline-block;width:38px;height:22px;}
.notif-toggle input{opacity:0;width:0;height:0;}
.notif-slider{position:absolute;cursor:pointer;inset:0;background:var(--border);border-radius:22px;transition:.2s;}
.notif-slider:before{content:'';position:absolute;width:16px;height:16px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:.2s;}
.notif-toggle input:checked + .notif-slider{background:var(--accent-primary,#1f6feb);}
.notif-toggle input:checked + .notif-slider:before{transform:translateX(16px);}

/* ── Theme overrides ─────────────────────────────────────────────── */
body.theme-midnight, html[data-theme="midnight"] body,
:root:has(body.theme-midnight) {
  --bg:#000000;
  --sidebar-bg:rgba(0,0,0,0.8);
  --surface:#0f0f0f;
  --surface2:#161616;
  --border:#2a2a2a;
  --text:#e8e8e8;
  --muted:#888888;
  --user-bubble:#141414;
  --user-text:#e8e8e8;
  --ai-bubble:#080808;
  --ai-border:#1e1e1e;
}
html[data-theme="midnight"] {
  --bg:#000000;
  --surface:#0f0f0f;
  --surface2:#161616;
  --border:#2a2a2a;
  --text:#e8e8e8;
}
body.theme-light, html[data-theme="light"] body,
:root:has(body.theme-light) {
  --bg:#f0f0f0;
  --sidebar-bg:rgba(235,235,235,0.95);
  --surface:#e8e8e8;
  --surface2:#dcdcdc;
  --border:#cccccc;
  --text:#1a1a1a;
  --muted:#444444;
  --accent:#444444;
  --accent2:#333333;
  --user-bubble:#d8d8d8;
  --user-text:#1a1a1a;
  --ai-bubble:#e8e8e8;
  --ai-border:#cccccc;
}
html[data-theme="light"] {
  --bg:#f0f0f0;
  --surface:#e8e8e8;
  --surface2:#dcdcdc;
  --border:#cccccc;
  --text:#1a1a1a;
}
body.theme-light .welcome-typewriter-text, html[data-theme="light"] .welcome-typewriter-text {
  background:linear-gradient(90deg,#1a1a1a,#3a3a3a);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}

/* ── Mobile layout ───────────────────────────────────────────────── */
@media(max-width:640px) {
  /* Sidebar: slides in/out off-screen */
  html.mobile-sidebar-preload-closed #sidebar {
    transform:translateX(-100%) !important;
    transition:none !important;
  }
  #sidebar {
    position:fixed;top:0;left:0;height:100%;height:100dvh;
    z-index:200;width:var(--sidebar-w) !important;
    transform:translateX(-100%);
    transition:transform .28s cubic-bezier(.4,0,.2,1);
  }
  #sidebar:not(.collapsed) { transform:translateX(0); }
  #sidebar.collapsed { transform:translateX(-100%); }
  #main { margin-left:0 !important; }

  /* Topbar: transparent, no border, flush */
  #mobile-topbar {
    display:flex;
    position:fixed;top:0;left:0;right:0;z-index:150;
    height:50px;align-items:center;
    padding:0 10px;gap:6px;
    background:transparent;
    border-bottom:none;
  }

  /* Sidebar toggle pill */
  #mobile-sidebar-fab {
    display:flex;align-items:center;justify-content:center;
    flex-shrink:0;
    background:var(--surface);border:1px solid var(--border);
    border-radius:999px;
    width:38px;height:34px;
    cursor:pointer;color:var(--muted);
    transition:opacity .2s, background .15s;
  }
  #mobile-sidebar-fab:active { background:var(--surface2); }
  /* Hide FAB pill when sidebar is open */
  #sidebar:not(.collapsed) ~ #main #mobile-sidebar-fab {
    opacity:0;pointer-events:none;
  }

  /* Combined action pill */
  #mobile-action-pill {
    display:inline-flex;align-items:center;
    background:var(--surface);border:1px solid var(--border);
    border-radius:999px;height:34px;overflow:hidden;
  }
  #mobile-ghost-btn, #mobile-topbar-dots {
    display:inline-flex;align-items:center;justify-content:center;
    width:38px;height:34px;
    background:transparent;border:none;
    color:var(--muted);cursor:pointer;
    transition:background .15s, color .15s;
    font-family:inherit;
  }
  #mobile-ghost-btn:hover, #mobile-topbar-dots:hover {
    background:transparent;
  }
  #mobile-ghost-btn.active svg {
    color:#58a6ff;
  }
  .mobile-pill-sep {
    width:1px;height:18px;background:var(--border);flex-shrink:0;
  }

  /* Hide desktop ghost btn and push chat below topbar */
  #ghost-mode-btn { display:none !important; }
  #chat-window { padding-top:50px !important; }
  #connections-page { padding-top:60px !important; }

  /* Settings categories rise from the bottom and remain scrollable. */
  .settings-popup {
    position:fixed !important;
    left:8px !important;right:8px !important;top:auto !important;bottom:10px !important;
    width:calc(100% - 16px) !important;max-width:none !important;
    border-radius:22px !important;
    max-height:calc(100dvh - 20px) !important;
    padding:8px 8px calc(14px + env(safe-area-inset-bottom)) !important;
    transform:translateY(24px) !important;
    z-index:400 !important;
    overflow-y:auto !important;
    box-sizing:border-box;
  }
  .settings-popup.open { transform:translateY(0) !important; }
  .settings-popup.mobile-settings-underlay { pointer-events:none; }
  #settings-blur-backdrop {
    display:none;position:fixed;inset:0;z-index:399;
    background:rgba(0,0,0,.45);backdrop-filter:blur(6px);
    -webkit-backdrop-filter:blur(6px);
  }
  #settings-blur-backdrop.open { display:block; }

  /* A category opens as a rounded bottom sheet with Back and Close controls. */
  .settings-detail-screen{align-items:flex-end;padding:0 8px 10px;}
  .settings-detail-box{width:100%;max-width:none;height:calc(100dvh - 20px);max-height:calc(100dvh - 20px);border-radius:22px;transform:translateY(28px) scale(1);transition:opacity .28s ease,transform .32s cubic-bezier(.22,1,.36,1);}
  .settings-detail-screen.open.visible .settings-detail-box{transform:translateY(0) scale(1);}
  .settings-detail-layout{height:100%;max-height:none;display:block;}
  .settings-detail-close{top:12px;right:12px;width:36px;height:36px;font-size:22px;color:#fff;display:grid;place-items:center;line-height:1;}
  .settings-detail-close span{display:block;line-height:1;transform:translateY(-1px);}
  .settings-detail-back{position:absolute;top:12px;left:12px;z-index:2;width:36px;height:36px;border:0;border-radius:50%;display:grid;place-items:center;padding:0;background:rgba(255,255,255,.08);color:#fff;cursor:pointer;}
  .settings-sidenav{display:none;}
  .settings-detail-content{height:100%;box-sizing:border-box;padding:68px 16px calc(24px + env(safe-area-inset-bottom));}
  .settings-title{font-size:20px;margin-bottom:10px;}
  .settings-sub{font-size:13px;margin-bottom:18px;}
  .settings-item{padding:13px 10px;}
  .settings-textarea{font-size:16px;}
}

/* Hide mobile elements on desktop */
@media(min-width:641px) {
  #mobile-topbar { display:none !important; }
  #mobile-ghost-btn { display:none !important; }
  .settings-mobile-category { display:none !important; }
}

/* ── Connections Panel ─────────────────────────────────────── */
.connections-panel {
  position:absolute;inset:0;z-index:50;
  background:var(--sidebar-bg);backdrop-filter:blur(18px);
  display:flex;flex-direction:column;
  transform:translateX(-100%);
  transition:transform .28s cubic-bezier(.4,0,.2,1);
}
.connections-panel.open { transform:translateX(0); }
.connections-header {
  display:flex;align-items:center;gap:8px;
  padding:14px 12px 10px;border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.connections-back {
  background:none;border:none;color:var(--muted);cursor:pointer;
  display:flex;align-items:center;padding:4px;border-radius:6px;
}
.connections-back:hover { background:var(--surface); }
.connections-title { font-size:14px;font-weight:600;color:var(--text); }
.connections-list { flex:1;overflow-y:auto;padding:10px 8px;display:flex;flex-direction:column;gap:6px; }
.conn-card {
  display:flex;align-items:center;gap:10px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:12px;padding:10px 12px;
}
.conn-icon-wrap {
  width:36px;height:36px;border-radius:9px;
  background:var(--surface2);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;color:var(--muted);overflow:hidden;
}
.conn-icon-img { width:24px;height:24px;object-fit:contain; }
.conn-info { flex:1;min-width:0; }
.conn-name { display:block;font-size:13px;font-weight:600;color:var(--text); }
.conn-desc { display:block;font-size:11px;color:var(--muted);margin-top:1px; }
.conn-badge { font-size:10px;font-weight:600;border-radius:6px;padding:2px 7px;flex-shrink:0; }
.conn-badge-on { background:rgba(31,111,235,.15);color:#3b82f6; }
.conn-toggle { position:relative;display:inline-block;width:36px;height:20px;flex-shrink:0; }
.conn-toggle input { opacity:0;width:0;height:0; }
.conn-slider { position:absolute;cursor:pointer;inset:0;background:var(--border);border-radius:20px;transition:.2s; }
.conn-slider:before { content:'';position:absolute;width:14px;height:14px;left:3px;bottom:3px;background:#fff;border-radius:50%;transition:.2s; }
.conn-toggle input:checked + .conn-slider { background:var(--accent-primary,#1f6feb); }
.conn-toggle input:checked + .conn-slider:before { transform:translateX(16px); }

/* ── Sidebar nav button (below new-chat) ─────────────────── */
.sb-nav-btn {
  color:#ffffff;
  transition:background .15s, color .15s;
}
.sb-nav-btn:hover { background:var(--surface2);color:var(--text); }
.sb-nav-btn.active { color:var(--text);background:var(--surface2); }
#sidebar.collapsed .sb-nav-btn span { display:none; }

/* ── Connections main page cards ─────────────────────────── */
.conn-page-card {
  display:flex;align-items:center;gap:14px;
  padding:14px 16px;
  background:var(--surface);border:1px solid var(--border);
  border-radius:14px;
}
.conn-page-icon {
  width:44px;height:44px;border-radius:11px;
  background:var(--surface2);border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;color:var(--muted);
}
.conn-page-img{width:26px;height:26px;object-fit:contain;}
#connections-page.connections-enter .conn-page-card{opacity:0;transform:translateY(8px) scale(.99);animation:connectionCardIn .52s cubic-bezier(.16,1,.3,1) forwards;will-change:opacity,transform;}
#connections-page.connections-enter .conn-page-card:nth-child(1){animation-delay:.02s}#connections-page.connections-enter .conn-page-card:nth-child(2){animation-delay:.07s}#connections-page.connections-enter .conn-page-card:nth-child(3){animation-delay:.12s}#connections-page.connections-enter .conn-page-card:nth-child(4){animation-delay:.17s}#connections-page.connections-enter .conn-page-card:nth-child(5){animation-delay:.22s}#connections-page.connections-enter .conn-page-card:nth-child(6){animation-delay:.27s}#connections-page.connections-enter .conn-page-card:nth-child(7){animation-delay:.32s}
@keyframes connectionCardIn{to{opacity:1;transform:none}}
.conn-page-info { flex:1;min-width:0; }
.conn-page-name { font-size:14px;font-weight:600;color:var(--text);margin-bottom:3px; }
.conn-page-desc { font-size:12px;color:var(--muted);line-height:1.4; }

/* ── Cookie consent banner ────────────────────────────────── */
.cookie-consent{
  position:fixed;left:16px;bottom:16px;z-index:10000;
  width:320px;max-width:calc(100vw - 32px);
  background:var(--surface);border:1px solid var(--border);
  border-radius:14px;padding:16px;box-shadow:0 12px 40px rgba(0,0,0,.4);
  display:flex;flex-direction:column;gap:12px;
  opacity:0;transform:translateY(12px);pointer-events:none;
  transition:opacity .25s ease,transform .25s ease;
}
.cookie-consent.show{opacity:1;transform:none;pointer-events:auto;animation:cookieFadeIn .28s cubic-bezier(.22,1,.36,1);}
@keyframes cookieFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
.cookie-consent-text strong{font-size:13px;color:var(--text);display:block;margin-bottom:4px;}
.cookie-consent-text p{font-size:12px;color:var(--muted);line-height:1.5;}
.cookie-consent-actions{display:flex;flex-direction:column;gap:8px;}
.cookie-btn{
  width:100%;padding:9px 10px;border-radius:9px;border:none;
  font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;
  transition:background .18s,border-color .18s;
}
.cookie-btn-outline{background:none;border:1px solid var(--border);color:var(--text);}
.cookie-btn-outline:hover{background:var(--surface2);}
.cookie-btn-primary{background:#1f6feb;color:#fff;}
.cookie-btn-primary:hover{background:#1a60d6;}
@media (max-width:640px){
  .cookie-consent{left:8px;right:8px;bottom:8px;width:auto;max-width:none;}
}
