/* ═══════════════════════════════════════════════════════
   SetupAI — style.css
   Aesthetic: Deep-space noir with electric accents
   Fonts: Syne (display) + IBM Plex Mono (code/meta)
═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@300;400;500;600&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

/* ── Tokens ───────────────────────────────────────────── */
:root {
  --bg:        #04060e;
  --bg2:       #070b16;
  --surface:   #0b1020;
  --surface2:  #0f1629;
  --surface3:  #141e35;
  --surface4:  #1a273f;
  --border:    rgba(100,150,255,.07);
  --border2:   rgba(100,150,255,.13);
  --border3:   rgba(100,150,255,.22);

  --blue:      #4f8ef7;
  --blue2:     #7ab0ff;
  --cyan:      #00e5ff;
  --violet:    #9d6fff;
  --green:     #00e5a0;
  --amber:     #f7a93e;
  --red:       #ff4d6a;

  --grad:      linear-gradient(135deg, #4f8ef7 0%, #9d6fff 100%);
  --grad-soft: linear-gradient(135deg, rgba(79,142,247,.12), rgba(157,111,255,.07));

  --text:      #dce8ff;
  --text2:     #7f9abf;
  --text3:     #3d5474;
  --text4:     #1f2f45;

  --font:      'Syne', sans-serif;
  --mono:      'IBM Plex Mono', monospace;
  --serif:     'Lora', serif;

  --r-sm:  8px;
  --r:     14px;
  --r-lg:  22px;
  --r-xl:  32px;

  --sb-w:  280px;
  --tb-h:  58px;

  --sh:    0 8px 32px rgba(0,0,0,.45);
  --sh-lg: 0 24px 64px rgba(0,0,0,.55);
  --glow:  0 0 40px rgba(79,142,247,.18);
  --glow-v:0 0 40px rgba(157,111,255,.14);

  --ease:        cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

/* ── Reset ────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 15px; }
body {
  height: 100%; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.65; overflow: hidden;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button { cursor: pointer; font-family: var(--font); border: none; background: none; color: inherit; }
input, textarea { font-family: var(--font); color: var(--text); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface4); border-radius: 2px; }

/* ── Animated background ──────────────────────────────── */
.bg-orb {
  position: fixed; border-radius: 50%;
  filter: blur(90px); pointer-events: none; z-index: 0;
}
.bg-orb-1 {
  width: 700px; height: 700px; opacity: .18;
  background: radial-gradient(circle, rgba(79,142,247,.4), transparent 65%);
  top: -280px; left: -220px;
  animation: orb1 22s ease-in-out infinite;
}
.bg-orb-2 {
  width: 550px; height: 550px; opacity: .14;
  background: radial-gradient(circle, rgba(157,111,255,.4), transparent 65%);
  bottom: -180px; right: -180px;
  animation: orb1 28s ease-in-out infinite reverse;
}
@keyframes orb1 {
  0%,100% { transform: translate(0,0) scale(1); }
  40%     { transform: translate(40px,-30px) scale(1.06); }
  70%     { transform: translate(-25px,35px) scale(.96); }
}

/* ── Layout ───────────────────────────────────────────── */
#app { display: flex; height: 100vh; position: relative; z-index: 1; }

/* ── Sidebar ──────────────────────────────────────────── */
#sidebar {
  width: var(--sb-w); min-width: var(--sb-w);
  background: rgba(7,11,22,.96);
  border-right: 1px solid var(--border2);
  display: flex; flex-direction: column;
  transition: transform .35s var(--ease);
  z-index: 100; overflow: hidden;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
#sidebar.collapsed { transform: translateX(calc(-1 * var(--sb-w))); }

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 11px; flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; box-shadow: var(--glow);
}
.logo-name { font-size: 16px; font-weight: 800; letter-spacing: -.4px; }
.logo-sub  { font-size: 10px; color: var(--text3); font-family: var(--mono);
             letter-spacing: 1.5px; text-transform: uppercase; }

.new-chat-btn {
  margin: 12px 10px 4px;
  padding: 11px 14px;
  background: var(--grad);
  border-radius: var(--r);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 22px rgba(79,142,247,.28);
  transition: transform .2s var(--ease-spring), box-shadow .2s, opacity .2s;
  flex-shrink: 0;
}
.new-chat-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(79,142,247,.38); }
.new-chat-btn:active { transform: scale(.97); }

.sidebar-section {
  padding: 14px 15px 5px;
  font-size: 10px; color: var(--text3); letter-spacing: 1.8px;
  text-transform: uppercase; font-family: var(--mono); flex-shrink: 0;
}
#chat-list { flex: 1; overflow-y: auto; padding: 0 6px 8px; }
.chat-item {
  padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background .15s, transform .15s; margin-bottom: 2px;
  font-size: 13px; color: var(--text2); user-select: none;
}
.chat-item:hover { background: var(--surface3); color: var(--text); transform: translateX(2px); }
.chat-item.active { background: rgba(79,142,247,.1); color: var(--text); border: 1px solid rgba(79,142,247,.14); }
.ci-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-del {
  opacity: 0; padding: 3px 6px; border-radius: 5px;
  color: var(--text3); font-size: 13px;
  transition: opacity .15s, color .15s, background .15s;
}
.chat-item:hover .ci-del { opacity: 1; }
.ci-del:hover { color: var(--red); background: rgba(255,77,106,.1); }

.sidebar-footer {
  border-top: 1px solid var(--border); padding: 10px 8px 12px;
  display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.sf-btn {
  padding: 9px 12px; border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--text2);
  transition: background .15s, color .15s;
}
.sf-btn:hover { background: var(--surface3); color: var(--text); }

/* ── Sidebar overlay (mobile) ─────────────────────────── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
}
#sidebar-overlay.show { display: block; }

/* ── Main area ────────────────────────────────────────── */
#main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}

/* ── Topbar ───────────────────────────────────────────── */
#topbar {
  height: var(--tb-h); min-height: var(--tb-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(7,11,22,.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0; z-index: 10;
}
.tb-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); font-size: 17px;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.tb-btn:hover { background: var(--surface3); color: var(--text); }
#chat-title {
  flex: 1; font-size: 14px; font-weight: 600;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 20px;
  border: 1px solid var(--border2); cursor: pointer;
  font-size: 12px; font-family: var(--mono); color: var(--text2);
  transition: border-color .2s, background .2s, color .2s;
  position: relative; flex-shrink: 0;
}
.model-pill:hover { border-color: var(--border3); color: var(--text); background: var(--surface2); }
.model-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.model-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--r); min-width: 200px;
  box-shadow: var(--sh-lg); z-index: 200;
  overflow: hidden;
  display: none;
}
.model-dropdown.open { display: block; }
.md-item {
  padding: 10px 14px; cursor: pointer;
  font-size: 12px; font-family: var(--mono); color: var(--text2);
  transition: background .12s, color .12s;
  display: flex; align-items: center; gap: 8px;
}
.md-item:hover { background: var(--surface3); color: var(--text); }
.md-item.active { color: var(--blue2); background: rgba(79,142,247,.06); }
.md-badge {
  font-size: 9px; padding: 2px 6px; border-radius: 4px;
  background: rgba(79,142,247,.15); color: var(--blue2);
  letter-spacing: .5px; text-transform: uppercase; flex-shrink: 0;
}

.token-badge {
  font-size: 11px; font-family: var(--mono); color: var(--text3);
  padding: 4px 9px; border-radius: 12px; border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Progress bar */
#progress {
  height: 2px; background: transparent; flex-shrink: 0; position: relative; overflow: hidden;
}
#progress-line {
  height: 100%; width: 0%;
  background: var(--grad); border-radius: 2px;
  transition: width .15s linear;
  box-shadow: 0 0 12px rgba(79,142,247,.5);
}

/* ── Chat area ────────────────────────────────────────── */
#chat-area {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 28px 16px 20px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ── Welcome screen ───────────────────────────────────── */
#welcome {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; text-align: center;
  padding: 32px 20px; gap: 20px;
}
.wl-icon {
  width: 72px; height: 72px; border-radius: 22px;
  background: var(--grad); display: flex; align-items: center;
  justify-content: center; font-size: 32px;
  box-shadow: var(--glow); animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}
.wl-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.wl-title span { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.wl-sub { font-size: 14px; color: var(--text2); max-width: 380px; font-family: var(--serif); font-style: italic; }
.wl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 500px; }
.wl-chip {
  padding: 9px 15px; border-radius: 20px;
  border: 1px solid var(--border2); background: var(--surface);
  font-size: 13px; color: var(--text2); cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .15s;
}
.wl-chip:hover { border-color: var(--blue); color: var(--text); background: var(--surface2); transform: translateY(-2px); }

/* ── Messages ─────────────────────────────────────────── */
#messages-wrap { display: flex; flex-direction: column; gap: 4px; }
.msg-row {
  display: flex; flex-direction: column; max-width: 780px;
  margin: 6px auto; width: 100%;
  animation: msg-in .25s var(--ease) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.msg-row.user { align-items: flex-end; }
.msg-row.ai   { align-items: flex-start; }

.msg-meta {
  font-size: 11px; color: var(--text3); font-family: var(--mono);
  margin-bottom: 5px; padding: 0 4px;
}
.msg-bubble {
  padding: 13px 16px; border-radius: var(--r-lg);
  max-width: 88%; font-size: 14.5px; line-height: 1.7;
  position: relative;
}
.msg-row.user .msg-bubble {
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 20px rgba(79,142,247,.22);
}
.msg-row.ai .msg-bubble {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-bottom-left-radius: 5px;
  color: var(--text);
}
.msg-row.ai .msg-bubble:hover { border-color: var(--border3); }

/* Markdown inside bubbles */
.msg-bubble p   { margin: 0 0 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble h1,.msg-bubble h2,.msg-bubble h3 { margin: 14px 0 6px; font-weight: 700; }
.msg-bubble ul,.msg-bubble ol { padding-left: 20px; margin: 6px 0; }
.msg-bubble li { margin: 3px 0; }
.msg-bubble code {
  font-family: var(--mono); font-size: 12.5px;
  background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 5px;
}
.msg-bubble pre {
  background: rgba(0,0,0,.35); border: 1px solid var(--border2);
  border-radius: var(--r-sm); padding: 12px; overflow-x: auto;
  margin: 10px 0;
}
.msg-bubble pre code { background: none; padding: 0; font-size: 12px; }
.msg-bubble blockquote {
  border-left: 3px solid var(--violet);
  padding: 4px 14px; margin: 8px 0;
  color: var(--text2); font-style: italic; font-family: var(--serif);
}
.msg-bubble a { color: var(--blue2); text-decoration: underline; }
.msg-bubble strong { font-weight: 700; }
.msg-bubble em { font-style: italic; font-family: var(--serif); }
.msg-bubble table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.msg-bubble th { background: var(--surface3); padding: 7px 10px; text-align: left; font-weight: 600; }
.msg-bubble td { padding: 7px 10px; border-top: 1px solid var(--border); }
.msg-bubble hr { border: none; border-top: 1px solid var(--border2); margin: 14px 0; }

/* Message actions */
.msg-actions {
  display: flex; gap: 4px; margin-top: 6px; padding: 0 4px;
  opacity: 0; transition: opacity .2s;
}
.msg-row:hover .msg-actions { opacity: 1; }
.ma-btn {
  padding: 4px 8px; border-radius: 6px; font-size: 11px;
  font-family: var(--mono); color: var(--text3);
  transition: background .15s, color .15s;
}
.ma-btn:hover { background: var(--surface3); color: var(--text); }

/* Image in message */
.msg-img {
  max-width: 100%; max-height: 380px; border-radius: var(--r);
  cursor: zoom-in; display: block;
  border: 1px solid var(--border2); margin-top: 8px;
  transition: opacity .2s;
}
.msg-img:hover { opacity: .9; }

/* ── Typing indicator ─────────────────────────────────── */
#typing {
  display: none; align-items: center; gap: 10px;
  max-width: 780px; margin: 6px auto; width: 100%;
}
#typing.show { display: flex; }
.typing-bubble {
  padding: 12px 16px; background: var(--surface2);
  border: 1px solid var(--border2); border-radius: var(--r-lg);
  border-bottom-left-radius: 5px;
  display: flex; align-items: center; gap: 10px;
}
.dots { display: flex; gap: 5px; }
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--blue2);
  animation: dot-pulse 1.4s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: .22s; background: var(--violet); }
.dot:nth-child(3) { animation-delay: .44s; background: var(--cyan); }
@keyframes dot-pulse {
  0%,80%,100% { transform: scale(.7); opacity: .4; }
  40%         { transform: scale(1.1); opacity: 1; }
}
.typing-label { font-size: 12px; color: var(--text3); font-family: var(--mono); }

/* ── Input area ───────────────────────────────────────── */
#input-area {
  flex-shrink: 0; padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: rgba(7,11,22,.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.input-box {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r-lg); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.input-box:focus-within { border-color: rgba(79,142,247,.4); box-shadow: 0 0 0 3px rgba(79,142,247,.06); }
#msg-input {
  width: 100%; background: none; border: none; outline: none;
  color: var(--text); padding: 14px 16px 6px;
  font-size: 14px; line-height: 1.5; resize: none;
  max-height: 180px; overflow-y: auto;
}
#msg-input::placeholder { color: var(--text3); }
.input-toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 10px;
}
.it-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text3);
  transition: background .15s, color .15s;
}
.it-btn:hover { background: var(--surface3); color: var(--text2); }
.it-spacer { flex: 1; }
.send-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s var(--ease-spring), box-shadow .2s, opacity .2s;
  box-shadow: 0 4px 16px rgba(79,142,247,.28);
}
.send-btn:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(79,142,247,.4); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .4; cursor: default; transform: none; }
.input-hint { font-size: 11px; color: var(--text4); text-align: center; margin-top: 6px; font-family: var(--mono); }

/* ── Panels (right drawer) ────────────────────────────── */
#panel-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
}
#panel-overlay.show { display: block; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 95vw); background: var(--surface);
  border-left: 1px solid var(--border2); z-index: 210;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s var(--ease);
  box-shadow: var(--sh-lg);
}
.panel.open { transform: none; }
.panel-head {
  padding: 18px 18px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.panel-title { font-size: 15px; font-weight: 700; flex: 1; }
.panel-close {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 18px;
  transition: background .15s, color .15s;
}
.panel-close:hover { background: var(--surface3); color: var(--text); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; }

/* Settings rows */
.set-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--r);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.set-row:hover { background: var(--surface2); border-color: var(--border); }
.set-icon { font-size: 18px; width: 30px; text-align: center; flex-shrink: 0; }
.set-label { flex: 1; }
.set-name { font-size: 13px; font-weight: 600; }
.set-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Toggle */
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--surface4); border-radius: 11px;
  transition: background .2s;
}
.toggle-track::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; top: 3px; left: 3px;
  transition: transform .2s var(--ease-spring);
}
.toggle input:checked + .toggle-track { background: var(--blue); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* Slider */
.range-input {
  -webkit-appearance: none; width: 100%; height: 4px;
  background: var(--surface4); border-radius: 2px; outline: none;
  transition: background .2s;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); cursor: pointer; box-shadow: 0 0 6px rgba(79,142,247,.4);
}

/* System prompt textarea */
.sys-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r); padding: 12px; color: var(--text);
  font-size: 13px; line-height: 1.6; resize: vertical;
  outline: none; transition: border-color .2s;
  min-height: 100px;
}
.sys-input:focus { border-color: rgba(79,142,247,.4); }

/* ── Modal ────────────────────────────────────────────── */
#modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
#modal-overlay.show { display: flex; }
.modal {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--r-xl); padding: 28px 26px 22px;
  max-width: 380px; width: 90%;
  box-shadow: var(--sh-lg);
  animation: modal-in .25s var(--ease-spring);
}
@keyframes modal-in {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.modal-body  { font-size: 13.5px; color: var(--text2); line-height: 1.6; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cancel {
  padding: 9px 18px; border-radius: var(--r);
  border: 1px solid var(--border2); font-size: 13px; color: var(--text2);
  transition: background .15s, color .15s;
}
.btn-cancel:hover { background: var(--surface3); color: var(--text); }
.btn-confirm {
  padding: 9px 18px; border-radius: var(--r);
  background: var(--red); color: #fff; font-size: 13px; font-weight: 600;
  transition: opacity .15s, transform .15s;
}
.btn-confirm:hover { opacity: .88; }
.btn-confirm:active { transform: scale(.96); }

/* ── Lightbox ─────────────────────────────────────────── */
#lightbox {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.88); backdrop-filter: blur(8px);
  align-items: center; justify-content: center; cursor: zoom-out;
}
#lightbox.show { display: flex; }
#lightbox img {
  max-width: 92vw; max-height: 92vh; border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); animation: modal-in .25s var(--ease-spring);
}

/* ── Toast ────────────────────────────────────────────── */
#toast-stack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 8px;
  z-index: 500; pointer-events: none;
}
.toast {
  padding: 10px 18px; background: var(--surface3);
  border: 1px solid var(--border2); border-radius: 24px;
  font-size: 13px; color: var(--text);
  box-shadow: var(--sh); animation: toast-in .3s var(--ease-spring);
  white-space: nowrap;
}
@keyframes toast-in {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.toast.error { border-color: rgba(255,77,106,.3); background: rgba(255,77,106,.1); }
.toast.success { border-color: rgba(0,229,160,.3); background: rgba(0,229,160,.07); }

/* ── Scroll FAB ───────────────────────────────────────── */
#scroll-fab {
  position: fixed; bottom: 130px; right: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface3); border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text2); z-index: 50;
  box-shadow: var(--sh); cursor: pointer;
  opacity: 0; pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s, transform .25s;
}
#scroll-fab.show { opacity: 1; pointer-events: auto; transform: none; }
#scroll-fab:hover { background: var(--surface4); color: var(--text); }

/* ── Image mode ───────────────────────────────────────── */
.mode-toggle {
  display: flex; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 2px; flex-shrink: 0;
}
.mode-btn {
  padding: 5px 12px; border-radius: 18px; font-size: 12px;
  color: var(--text3); transition: background .2s, color .2s;
}
.mode-btn.active { background: var(--surface4); color: var(--text); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { position: fixed; top: 0; bottom: 0; left: 0; }
  #sidebar:not(.collapsed) { box-shadow: var(--sh-lg); }
  #chat-area { padding: 16px 10px 10px; }
  #input-area { padding: 8px 10px 12px; }
  .msg-bubble { max-width: 96%; font-size: 14px; }
  .token-badge { display: none; }
}
@media (max-width: 480px) {
  .wl-title { font-size: 22px; }
  .wl-chip { font-size: 12px; padding: 7px 12px; }
}
