/* ===== Tokens ===== */
:root{
  --bg: #101010;
  --bg-sidebar: #0a0a0a;
  --bg-elev: #1a1a1a;
  --bg-elev-2: #262626;
  --bg-hover: #1f1f1f;
  --border: #2e2e2e;
  --text: #f5f5f5;
  --text-dim: #9c9c9c;
  --text-faint: #5e5e5e;
  --accent: #ffffff;
  --accent-dim: #2e2e2e;
  --danger: #ffffff;
  --radius: 12px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

*{box-sizing:border-box; margin:0; padding:0;}

/* The hidden attribute must always win over display rules on .auth-screen/.app. */
[hidden]{ display:none !important; }

html,body{height:100%;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  overflow:hidden;
}

::selection{ background:var(--accent); color:#141414; }
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:#3a3a3a; border-radius:8px; }
::-webkit-scrollbar-thumb:hover{ background:#4a4a4a; }

button, input, textarea, select{ font-family:inherit; color:inherit; }
a{ color:var(--accent); }

/* ===== Layout ===== */
.app{
  display:block;
  height:100vh;
}

/* ===== Sidebar (drawer, opens with the ☰ button) ===== */
.sidebar{
  position:fixed; z-index:20; top:0; left:0; bottom:0; width:272px;
  background:var(--bg-sidebar);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  min-height:0;
  transform:translateX(-100%);
  transition:transform .2s ease;
  box-shadow:0 0 40px rgba(0,0,0,.5);
}
.sidebar.open{ transform:translateX(0); }

.side-nav{
  display:flex;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:9px;
  padding:3px;
  gap:3px;
}
.side-nav-btn{
  flex:1;
  background:transparent;
  border:none;
  color:var(--text-dim);
  padding:7px 0;
  border-radius:6px;
  font-size:12px;
  font-weight:600;
  cursor:pointer;
  transition:.15s ease;
}
.side-nav-btn.active{ background:var(--bg-elev-2); color:var(--text); }
.side-nav-btn:hover:not(.active){ color:var(--text); }

.sidebar-panel{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:0 14px 14px;
  overflow:hidden;
}
.panel-scroll{
  flex:1;
  min-height:0;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.dev-tool-btn{ width:100%; margin:2px 0; }
.dev-set-row{ display:flex; gap:8px; }
.dev-set-row input{
  flex:1;
  min-width:0;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px 10px;
  font-size:12.5px;
  color:var(--text);
  outline:none;
  transition:border-color .15s ease;
}
.dev-set-row input:focus{ border-color:var(--accent); }

.sidebar-top{
  padding:16px 14px 10px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.brand{ display:flex; align-items:center; gap:8px; padding:0 4px; }
.brand-mark{
  width:16px;
  height:16px;
  object-fit:contain;
}
.brand-name{
  font-family:var(--font-display);
  font-weight:700;
  font-size:15px;
  letter-spacing:-.01em;
}

.new-chat-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  background:transparent;
  border:1px solid var(--border);
  color:var(--text);
  border-radius:8px;
  padding:9px 12px;
  font-size:13px;
  font-weight:500;
  cursor:pointer;
  transition:.15s ease;
}
.new-chat-btn:hover{ background:var(--bg-hover); }
.new-chat-btn .plus{ font-size:15px; line-height:1; color:var(--accent); }

.sidebar-scroll{
  flex:1;
  overflow-y:auto;
  padding:4px 0 0;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.side-section{ display:flex; flex-direction:column; gap:7px; }
.side-label{
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--text-dim);
  cursor:default;
}

#modelSelect, #systemPrompt{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:9px 10px;
  font-size:13px;
  width:100%;
  outline:none;
  transition:border-color .15s ease;
}
#modelSelect:focus, #systemPrompt:focus{ border-color:var(--accent); }
#systemPrompt{ resize:vertical; line-height:1.4; font-size:12.5px; }

.advanced{ border:none; }
.advanced summary{
  cursor:pointer;
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:2px 0;
}
.advanced summary::-webkit-details-marker{ display:none; }
.advanced summary::after{
  content:"›";
  display:inline-block;
  transform:rotate(90deg);
  transition:transform .15s ease;
  color:var(--text-faint);
  font-size:14px;
}
.advanced[open] summary::after{ transform:rotate(-90deg); }
.adv-body{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding-top:12px;
}
.field{ display:flex; flex-direction:column; gap:6px; }

.slider-label-row{ display:flex; justify-content:space-between; align-items:baseline; }
.slider-val{ font-size:11px; color:var(--accent); font-variant-numeric:tabular-nums; }
input[type="range"]{
  -webkit-appearance:none;
  width:100%;
  height:3px;
  background:var(--border);
  border-radius:2px;
  outline:none;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:13px; height:13px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  border:2px solid var(--bg-sidebar);
}
input[type="range"]::-moz-range-thumb{
  width:13px; height:13px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  border:2px solid var(--bg-sidebar);
}

.toggle-row{ flex-direction:row; align-items:center; justify-content:space-between; }
.switch{ position:relative; width:36px; height:20px; flex-shrink:0; }
.switch input{ opacity:0; width:0; height:0; }
.switch-track{
  position:absolute; inset:0; background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:20px; cursor:pointer; transition:.15s ease;
}
.switch-track::before{
  content:""; position:absolute; width:14px; height:14px;
  left:2px; top:2px; background:var(--text-dim);
  border-radius:50%; transition:.15s ease;
}
.switch input:checked + .switch-track{ background:var(--accent-dim); border-color:var(--accent); }
.switch input:checked + .switch-track::before{ transform:translateX(16px); background:var(--accent); }

.side-footer{
  padding:12px 14px 16px;
  border-top:1px solid var(--border);
  display:flex;
  flex-direction:column;
  gap:6px;
}
.footer-row{
  display:flex; justify-content:space-between;
  font-size:11px;
  color:var(--text-dim);
}
.footer-row span:last-child{ color:var(--text); font-variant-numeric:tabular-nums; }

.ghost-btn{
  background:transparent;
  border:1px solid var(--border);
  color:var(--text-dim);
  border-radius:8px;
  padding:8px 12px;
  font-size:12.5px;
  cursor:pointer;
  transition:.15s ease;
  margin-top:4px;
}
.ghost-btn:hover{ border-color:var(--danger); color:var(--danger); }

/* ===== Main ===== */
.main{ display:flex; flex-direction:column; min-width:0; height:100vh; position:relative; }

.topbar{
  height:52px;
  display:flex;
  align-items:center;
  padding:0 20px;
  gap:12px;
  flex-shrink:0;
}
.icon-btn{
  background:transparent;
  border:none;
  color:var(--text-dim);
  font-size:16px;
  cursor:pointer;
  width:32px; height:32px;
  display:flex; align-items:center; justify-content:center;
  border-radius:6px;
}
.icon-btn:hover{ background:var(--bg-hover); color:var(--text); }

.topbar-title{
  display:flex; align-items:center; gap:7px;
  font-size:13px;
  color:var(--text-dim);
}
.dot{
  width:6px; height:6px; border-radius:50%;
  background:#5a5a5a;
  transition:.2s ease;
}
.dot.live{ background:var(--accent); box-shadow:0 0 6px rgba(255,255,255,.5); animation:pulse 1s infinite ease-in-out; }
.dot.ready{ background:var(--accent); }
.dot.err{ background:var(--accent); }
@keyframes pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.4; } }

.speed-readout{
  margin-left:auto;
  display:flex;
  align-items:baseline;
  gap:4px;
  font-size:12px;
  color:var(--text-faint);
  opacity:0;
  transition:opacity .2s ease;
}
.speed-readout.active{ opacity:1; }
.speed-number{ font-weight:600; color:var(--accent); font-variant-numeric:tabular-nums; }

/* ===== Chat area ===== */
.chat{
  flex:1;
  overflow-y:auto;
  padding:8px 0 8px;
}
.empty-state{
  max-width:600px;
  margin:12vh auto 0;
  text-align:center;
  padding:0 24px;
}
.empty-mark{
  width:56px;
  height:56px;
  object-fit:contain;
  display:block;
  margin:0 auto 14px;
}
.empty-state h1{
  font-family:var(--font-display);
  font-size:28px;
  font-weight:700;
  letter-spacing:-.01em;
  margin-bottom:10px;
}
.empty-state p{
  color:var(--text-dim);
  font-size:14px;
  line-height:1.6;
  margin-bottom:22px;
}
.chip-row{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; }
.chip{
  background:var(--bg-elev);
  border:1px solid var(--border);
  color:var(--text-dim);
  padding:9px 14px;
  border-radius:20px;
  font-size:12.5px;
  cursor:pointer;
  transition:.15s ease;
}
.chip:hover{ border-color:var(--accent); color:var(--text); }

.messages{
  max-width:720px;
  margin:0 auto;
  padding:8px 24px 32px;
  display:flex;
  flex-direction:column;
  gap:26px;
}

.msg{ display:flex; flex-direction:column; gap:6px; max-width:100%; }

.msg.user{ align-items:flex-end; }
.msg.user .msg-body{
  background:var(--bg-elev);
  border-radius:18px;
  padding:10px 16px;
  max-width:80%;
  font-size:14.5px;
  line-height:1.55;
  white-space:pre-wrap;
  word-wrap:break-word;
}

.msg.assistant{ flex-direction:row; gap:12px; align-items:flex-start; }
.msg.assistant .avatar{
  width:26px; height:26px; border-radius:6px;
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
  margin-top:2px;
  overflow:hidden;
}
.msg.assistant .avatar img{
  width:100%;
  height:100%;
  object-fit:contain;
  padding:4px;
  box-sizing:border-box;
}
.msg.assistant .msg-content{ flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.msg.assistant .msg-body{
  font-size:14.5px;
  line-height:1.7;
  white-space:pre-wrap;
  word-wrap:break-word;
}
.msg-meta{
  font-size:10.5px;
  color:var(--text-faint);
}

.msg.error{ flex-direction:row; gap:12px; align-items:flex-start; }
.msg.error .avatar{ background:var(--danger); color:#141414; font-size:13px; font-weight:700; }
.msg.error .msg-body{
  color:var(--danger);
  font-size:13.5px;
  line-height:1.6;
}

.msg-body code{
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  padding:1px 5px;
  border-radius:4px;
  font-family:ui-monospace, monospace;
  font-size:.9em;
}
.msg-body pre{
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  border-radius:8px;
  padding:12px 14px;
  overflow-x:auto;
  margin:6px 0;
}
.msg-body pre code{ background:none; border:none; padding:0; }

.cursor-blink{
  display:inline-block;
  width:7px; height:14px;
  background:var(--accent);
  margin-left:2px;
  vertical-align:text-bottom;
  animation:blink 1s step-start infinite;
}
@keyframes blink{ 50%{ opacity:0; } }

/* ===== Image upload ===== */
.image-preview{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:0 2px 8px;
}
.image-preview-item{
  position:relative;
  width:56px;
  height:56px;
  border-radius:8px;
  overflow:hidden;
  border:1px solid var(--border);
  background:var(--bg-elev);
}
.image-preview-item img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.image-preview-remove{
  position:absolute;
  top:2px; right:2px;
  width:18px; height:18px;
  border:none;
  border-radius:50%;
  background:rgba(0,0,0,.75);
  color:#fff;
  font-size:10px;
  line-height:1;
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.image-preview-remove:hover{ background:#000; }

/* Images inside a user message bubble */
.msg-images{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}
.msg-image-item{
  position:relative;
  width:120px;
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  background:#000;
  cursor:pointer;
}
.msg-image-item img{
  width:100%;
  height:100px;
  object-fit:cover;
  display:block;
}
.msg-image-item:hover img{ opacity:.85; }
.msg-image-name{
  display:flex;
  align-items:center;
  gap:4px;
  padding:4px 6px;
  font-size:9.5px;
  color:var(--text-dim);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.msg-image-name::before{
  content:"🖼";
  font-size:9px;
  flex-shrink:0;
}
.msg-image-download{
  position:absolute;
  top:4px;
  right:4px;
  width:22px;
  height:22px;
  border-radius:6px;
  background:rgba(0,0,0,.65);
  color:#fff;
  border:1px solid rgba(255,255,255,.25);
  font-size:11px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  opacity:0;
  transition:opacity .15s;
  text-decoration:none;
}
.msg-image-item:hover .msg-image-download{ opacity:1; }
.msg-image-download:hover{ background:#000; }

/* ===== Inbox ===== */
.inbox-head{
  padding:4px 10px 0;
}
.inbox-tabs{
  display:flex;
  gap:6px;
  margin:8px 0 4px;
}
.inbox-tab{
  flex:1;
  padding:6px 0;
  border:1px solid var(--border);
  border-radius:8px;
  background:transparent;
  color:var(--text-dim);
  font-size:12px;
  font-weight:600;
  cursor:pointer;
}
.inbox-tab.active{
  background:#fff;
  color:#141414;
  border-color:#fff;
}
.email-item{
  display:block;
  width:100%;
  text-align:left;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#141414;
  margin-bottom:6px;
  cursor:pointer;
}
.email-item:hover{ border-color:#fff; }
.email-item.unread{ border-color:#fff; background:#1c1c1c; }
.email-item .email-item-from{
  font-size:12.5px;
  font-weight:600;
  color:#fff;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.email-item.unread .email-item-from::after{
  content:"•";
  color:#fff;
  margin-left:4px;
}
.email-item .email-item-subject{
  font-size:11.5px;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  margin-top:2px;
}
.email-item .email-item-preview{
  font-size:11px;
  color:var(--text-dim);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  margin-top:2px;
}
.email-item .email-item-time{
  font-size:10px;
  color:var(--text-dim);
  margin-top:4px;
}
.compose-actions{
  margin-top:10px;
}
.email-view-card{ max-width:640px; }
.email-view-meta{
  font-size:12.5px;
  color:var(--text-dim);
  margin-bottom:14px;
  white-space:pre-wrap;
}
.email-view-body{
  font-size:14px;
  line-height:1.65;
  color:var(--text);
  white-space:pre-wrap;
  word-break:break-word;
  border-top:1px solid var(--border);
  padding-top:14px;
}

/* ===== Image lightbox ===== */
.lightbox{
  position:fixed;
  inset:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.lightbox-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.88);
}
.lightbox-card{
  position:relative;
  max-width:92vw;
  max-height:92vh;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.lightbox-img{
  max-width:92vw;
  max-height:calc(92vh - 60px);
  object-fit:contain;
  border-radius:12px;
  background:#000;
}
.lightbox-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.lightbox-name{
  color:#fff;
  font-size:14px;
  font-weight:600;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.lightbox-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-shrink:0;
}
.lightbox-download{
  color:#fff;
  border:1px solid rgba(255,255,255,.4);
  border-radius:8px;
  padding:6px 12px;
  font-size:12.5px;
  font-weight:600;
  text-decoration:none;
  display:flex;
  align-items:center;
  gap:6px;
}
.lightbox-download:hover{ background:rgba(255,255,255,.12); }
.lightbox-close{
  width:34px;
  height:34px;
  border-radius:50%;
  border:1px solid rgba(255,255,255,.4);
  background:transparent;
  color:#fff;
  font-size:15px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.lightbox-close:hover{ background:rgba(255,255,255,.12); }

/* Mic button */
.mic-btn{ transition: color .15s, background .15s; }
.mic-btn.recording{
  color:#fff;
  background:#dc2626;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse{
  0%,100%{ box-shadow:0 0 0 0 rgba(220,38,38,.5); }
  50%{ box-shadow:0 0 0 6px rgba(220,38,38,0); }
}

/* ===== Composer ===== */
.composer{
  max-width:720px;
  width:100%;
  margin:0 auto;
  padding:0 24px 18px;
  flex-shrink:0;
}
.composer-inner{
  display:flex;
  align-items:flex-end;
  gap:8px;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:26px;
  padding:8px 8px 8px 18px;
  transition:border-color .15s ease;
}
.composer-inner:focus-within{ border-color:#565656; }
#promptInput{
  flex:1;
  background:transparent;
  border:none;
  padding:8px 0;
  font-size:14.5px;
  resize:none;
  max-height:180px;
  outline:none;
  line-height:1.5;
}
#promptInput::placeholder{ color:var(--text-faint); }
.send-btn{
  width:34px; height:34px;
  border-radius:50%;
  border:none;
  background:var(--text);
  color:var(--bg);
  font-size:15px;
  cursor:pointer;
  flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  transition:transform .12s ease, background .15s ease, opacity .15s ease;
}
.send-btn:hover:not(:disabled){ transform:scale(1.05); }
.send-btn:disabled{ background:var(--bg-elev-2); color:var(--text-faint); cursor:not-allowed; }
.composer-hint{
  text-align:center;
  font-size:11px;
  color:var(--text-faint);
  margin-top:10px;
}

/* ===== Responsive ===== */
@media (max-width:860px){
  .speed-readout{ display:none; }
  .empty-state h1{ font-size:24px; }
  .msg.user .msg-body{ max-width:90%; }
}

/* ===== Auth screen ===== */
.auth-screen{
  position:fixed; inset:0;
  background:var(--bg);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:100;
  padding:20px;
}
.auth-card{
  width:100%;
  max-width:360px;
  background:var(--bg-sidebar);
  border:1px solid var(--border);
  border-radius:16px;
  padding:28px 26px 24px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.auth-brand{ justify-content:center; padding-bottom:4px; }
.auth-brand .brand-mark{ width:22px; height:22px; }
.auth-brand .brand-name{ font-size:17px; }

.auth-tabs{
  display:flex;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:9px;
  padding:3px;
  gap:3px;
}
.auth-tab{
  flex:1;
  background:transparent;
  border:none;
  color:var(--text-dim);
  padding:8px 0;
  border-radius:6px;
  font-size:12.5px;
  font-weight:600;
  cursor:pointer;
  transition:.15s ease;
}
.auth-tab.active{ background:var(--bg-elev-2); color:var(--text); }

.auth-form{ display:flex; flex-direction:column; gap:10px; }
.auth-form input{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:11px 12px;
  font-size:13.5px;
  outline:none;
  width:100%;
  transition:border-color .15s ease;
}
.auth-form input:focus{ border-color:var(--accent); }
.auth-submit{
  background:var(--accent);
  border:none;
  color:#141414;
  font-weight:600;
  font-size:13.5px;
  padding:11px 0;
  border-radius:8px;
  cursor:pointer;
  transition:opacity .15s ease;
  margin-top:2px;
}
.auth-submit:hover{ opacity:.9; }
.auth-submit:disabled{ opacity:.5; cursor:not-allowed; }

.auth-divider{
  display:flex; align-items:center; gap:10px;
  color:var(--text-faint);
  font-size:11px;
}
.auth-divider::before, .auth-divider::after{
  content:""; flex:1; height:1px; background:var(--border);
}

.google-btn{
  display:flex; align-items:center; justify-content:center; gap:10px;
  background:#fff;
  color:#1f1f1f;
  border:1px solid var(--border);
  border-radius:8px;
  padding:10px 0;
  font-size:13.5px;
  font-weight:500;
  cursor:pointer;
  transition:opacity .15s ease;
}
.google-btn:hover{ opacity:.9; }

.auth-error{
  color:var(--danger);
  font-size:12px;
  text-align:center;
  min-height:14px;
}
.auth-hint{
  text-align:center;
  font-size:11px;
  color:var(--text-faint);
  line-height:1.5;
}

/* ===== Sidebar: chat list ===== */
.chat-list-empty{
  font-size:12px;
  color:var(--text-faint);
  padding:10px 4px;
}
.chat-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:9px 10px;
  border-radius:8px;
  cursor:pointer;
  font-size:13px;
  color:var(--text-dim);
  transition:background .15s ease;
  position:relative;
}
.chat-item:hover{ background:var(--bg-hover); }
.chat-item.active{ background:var(--bg-elev); color:var(--text); }
.chat-item-title{
  flex:1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.chat-item-delete{
  background:none;
  border:none;
  color:var(--text-faint);
  font-size:13px;
  cursor:pointer;
  opacity:0;
  padding:2px 4px;
  border-radius:4px;
  flex-shrink:0;
}
.chat-item:hover .chat-item-delete{ opacity:1; }
.chat-item-delete:hover{ color:var(--danger); background:var(--bg-elev-2); }

/* ===== Sidebar: user footer ===== */
.user-row{ display:flex; align-items:center; gap:10px; padding:2px 2px 2px; }
.user-avatar{
  width:32px; height:32px; border-radius:50%;
  background:var(--accent);
  color:#141414;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:700;
  flex-shrink:0;
  text-transform:uppercase;
}
.user-info{ display:flex; flex-direction:column; min-width:0; gap:1px; }
.user-email{
  font-size:12.5px;
  color:var(--text);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  max-width:150px;
}
.user-tokens{ font-size:11px; color:var(--accent); font-variant-numeric:tabular-nums; }
.user-tokens.low{ color:var(--danger); }
.reset-timer{ color:var(--text-faint); font-size:10.5px; }

/* ===== Composer icon button ===== */
.composer-icon{
  width:34px; height:34px;
  border-radius:50%;
  flex-shrink:0;
  color:var(--text-dim);
  font-size:15px;
}
.composer-icon:hover{ background:var(--bg-elev-2); color:var(--text); }

.composer-hint.warn{ color:var(--danger); font-weight:600; }

/* ===== Settings modal ===== */
.modal-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:90;
  padding:20px;
}
.modal{
  width:100%;
  max-width:420px;
  max-height:85vh;
  background:var(--bg-sidebar);
  border:1px solid var(--border);
  border-radius:14px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px;
  border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.modal-header h2{ font-size:14.5px; font-weight:600; }
.modal-body{
  padding:18px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.modal-body #modelSelect, .modal-body #systemPrompt{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:9px 10px;
  font-size:13px;
  width:100%;
  outline:none;
}
.modal-body #systemPrompt{ resize:vertical; line-height:1.4; }

/* ===== Disabled composer state ===== */
.composer-inner.disabled{ opacity:.6; }

/* ===== API keys ===== */
.api-keys-section{
  display:flex;
  flex-direction:column;
  gap:10px;
  border-top:1px solid var(--border);
  padding-top:14px;
}
.api-curl-example{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:10px 12px;
  font-family:ui-monospace, monospace;
  font-size:11px;
  line-height:1.55;
  color:var(--text-dim);
  overflow-x:auto;
  white-space:pre;
}
.api-key-create{ display:flex; gap:8px; }
.api-key-create input{
  flex:1;
  min-width:0;
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:9px 10px;
  font-size:12.5px;
  outline:none;
  transition:border-color .15s ease;
}
.api-key-create input:focus{ border-color:var(--accent); }
.api-key-create button{
  background:var(--accent);
  border:none;
  color:#141414;
  font-weight:600;
  font-size:12.5px;
  padding:9px 14px;
  border-radius:8px;
  cursor:pointer;
  transition:opacity .15s ease;
  flex-shrink:0;
}
.api-key-create button:hover{ opacity:.9; }
.api-key-create button:disabled{ opacity:.5; cursor:not-allowed; }
.api-key-list{ display:flex; flex-direction:column; gap:8px; }
.api-key-item{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px 10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.api-key-item.new{ border-color:var(--accent); }
.api-key-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.api-key-name{ font-size:12.5px; font-weight:600; }
.api-key-date{ font-size:11px; color:var(--text-faint); }
.api-key-row{ display:flex; align-items:center; gap:6px; min-width:0; }
.api-key-code{
  flex:1;
  min-width:0;
  font-family:ui-monospace, monospace;
  font-size:11px;
  color:var(--text-dim);
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  border-radius:6px;
  padding:5px 8px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.api-key-action{
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  color:var(--text-dim);
  font-size:11px;
  font-weight:600;
  padding:4px 10px;
  border-radius:6px;
  cursor:pointer;
  flex-shrink:0;
  transition:.15s ease;
}
.api-key-action:hover{ border-color:var(--accent); color:var(--text); }
.api-key-action.danger:hover{ border-color:var(--danger); color:var(--danger); }

/* ===== Code snippets ===== */
.code-block{
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
  margin:6px 0;
}
.code-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:5px 12px;
  background:var(--bg-elev);
  border-bottom:1px solid var(--border);
}
.code-lang{
  font-family:ui-monospace, monospace;
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--text-dim);
}
.copy-code-btn{
  background:var(--bg-elev-2);
  border:1px solid var(--border);
  color:var(--text-dim);
  font-size:11px;
  font-weight:600;
  padding:3px 10px;
  border-radius:6px;
  cursor:pointer;
  transition:.15s ease;
}
.copy-code-btn:hover{ border-color:var(--accent); color:var(--text); }
.copy-code-btn.copied{ border-color:var(--accent); color:var(--accent); }
.code-block pre{
  background:none;
  border:none;
  margin:0;
  padding:12px 14px;
}
.code-block pre code{ background:none; border:none; padding:0; }

/* ===== Invite ===== */
.invite-btn{
  display:flex;
  align-items:center;
  gap:6px;
  background:var(--bg-elev);
  border:1px solid var(--border);
  color:var(--text-dim);
  border-radius:8px;
  padding:6px 12px;
  font-size:12.5px;
  font-weight:500;
  cursor:pointer;
  transition:.15s ease;
  margin-left:auto;
}
.invite-btn:hover{ border-color:var(--accent); color:var(--text); }
.invite-banners{
  padding:8px 20px 0;
  display:flex;
  flex-direction:column;
  gap:8px;
  flex-shrink:0;
}
.invite-banner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  background:var(--accent-dim);
  border:1px solid var(--accent);
  border-radius:10px;
  padding:10px 14px;
  font-size:13px;
  color:var(--text);
}
.invite-msg{ flex:1; min-width:200px; }
.invite-actions{ display:flex; gap:8px; }
.invite-accept{
  background:var(--accent);
  border:none;
  color:#141414;
  font-weight:600;
  font-size:12.5px;
  padding:6px 14px;
  border-radius:7px;
  cursor:pointer;
  transition:opacity .15s ease;
}
.invite-accept:hover{ opacity:.9; }
.invite-dismiss{
  background:transparent;
  border:1px solid var(--border);
  color:var(--text-dim);
  font-size:12.5px;
  padding:6px 12px;
  border-radius:7px;
  cursor:pointer;
  transition:.15s ease;
}
.invite-dismiss:hover{ border-color:var(--danger); color:var(--danger); }
.modal-note{
  font-size:12.5px;
  color:var(--text-dim);
  line-height:1.5;
}
#inviteEmail{
  background:var(--bg-elev);
  border:1px solid var(--border);
  border-radius:8px;
  padding:10px 12px;
  font-size:13.5px;
  width:100%;
  outline:none;
  transition:border-color .15s ease;
}
#inviteEmail:focus{ border-color:var(--accent); }
