/* =========================================================
   Sef AI — dark green / black Arabic assistant
   ========================================================= */

:root{
  --bg:#050d09;
  --bg-2:#07130d;
  --surface:#0a1912;
  --surface-2:#0d2117;
  --line:rgba(52,211,153,.13);
  --line-2:rgba(52,211,153,.28);
  --text:#e9f7ef;
  --text-dim:#b7cec3;
  --muted:#7d9b8e;
  --green:#34d399;
  --green-2:#10b981;
  --green-3:#059669;
  --danger:#f87171;
  --font:'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease:cubic-bezier(.4,0,.2,1);
}

*,*::before,*::after{ box-sizing:border-box; }

html{ -webkit-text-size-adjust:100%; }
html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font);
  font-size:16px;
  line-height:1.6;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

body::before{
  content:'';
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background:
    radial-gradient(900px 520px at 88% -12%, rgba(16,185,129,.17), transparent 62%),
    radial-gradient(760px 460px at 4% 112%, rgba(5,150,105,.13), transparent 64%);
}

button{ font-family:inherit; }
.hidden{ display:none !important; }
::selection{ background:rgba(52,211,153,.3); color:#fff; }

.chat-scroll::-webkit-scrollbar,
.conv-list::-webkit-scrollbar{ width:8px; }
.chat-scroll::-webkit-scrollbar-thumb,
.conv-list::-webkit-scrollbar-thumb{ background:rgba(52,211,153,.16); border-radius:99px; }
.chat-scroll::-webkit-scrollbar-track,
.conv-list::-webkit-scrollbar-track{ background:transparent; }

/* ===================== SHELL ===================== */
.app{
  position:relative;
  z-index:1;
  display:flex;
  height:100dvh;
  height:100vh;
  overflow:hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar{
  flex:0 0 300px;
  width:300px;
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:18px 14px 14px;
  background:linear-gradient(180deg,#08150f 0%,#050f0a 100%);
  border-inline-end:1px solid var(--line);
  overflow:hidden;
}

.sidebar-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding-inline:4px;
}

.brand{ display:flex; align-items:center; gap:10px; min-width:0; }

.brand-mark{
  width:38px; height:38px; flex:0 0 38px;
  display:grid; place-items:center;
  border-radius:12px;
  color:#062b1d;
  background:linear-gradient(140deg,#6ee7b7,#10b981 55%,#047857);
  box-shadow:0 6px 18px rgba(16,185,129,.28), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-mark svg{ width:22px; height:22px; }

.brand-text{ display:flex; flex-direction:column; min-width:0; }
.brand-name{
  font-family:'Space Grotesk','IBM Plex Sans Arabic',sans-serif;
  font-size:19px; font-weight:700; letter-spacing:.2px;
  color:#f2fff9; line-height:1.15;
}
.brand-accent{ color:var(--green); }
.brand-sub{ font-size:11.5px; color:var(--muted); line-height:1.4; }

.btn-new{
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:100%; min-height:46px;
  border:none; border-radius:14px;
  background:linear-gradient(135deg,#34d399,#10b981 60%,#059669);
  color:#04231a;
  font-size:15px; font-weight:600; letter-spacing:.1px;
  cursor:pointer;
  box-shadow:0 8px 22px rgba(16,185,129,.22), inset 0 1px 0 rgba(255,255,255,.4);
  transition:transform .14s var(--ease), box-shadow .2s var(--ease), filter .2s;
  user-select:none;
}
.btn-new svg{ width:18px; height:18px; }
.btn-new:hover{ filter:brightness(1.06); box-shadow:0 10px 26px rgba(16,185,129,.3); }
.btn-new:active{ transform:scale(.975); }

.sidebar-label{
  font-size:11.5px;
  font-weight:600;
  letter-spacing:.4px;
  color:var(--muted);
  padding-inline:6px;
  margin-top:2px;
}

.conv-list{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  display:flex;
  flex-direction:column;
  gap:3px;
  padding-inline:2px;
  padding-bottom:8px;
  scrollbar-width:thin;
}

.conv-item{
  display:flex;
  align-items:center;
  gap:9px;
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--text-dim);
  font-size:13.5px;
  font-family:inherit;
  text-align:start;
  cursor:pointer;
  transition:background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
  user-select:none;
}
.conv-item .conv-ico{ width:16px; height:16px; flex:0 0 16px; opacity:.6; }
.conv-item:hover{ background:rgba(52,211,153,.07); color:var(--text); }
.conv-item.active{
  background:rgba(52,211,153,.11);
  border-color:var(--line-2);
  color:#eafff5;
}
.conv-item.active .conv-ico{ opacity:1; color:var(--green); }

.conv-title{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.conv-actions{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:2px;
  opacity:0;
  transition:opacity .16s var(--ease);
}
.conv-item:hover .conv-actions,
.conv-item:focus-within .conv-actions,
.conv-item.active .conv-actions{ opacity:1; }
.conv-act{
  width:26px; height:26px;
  flex:0 0 26px;
  display:grid; place-items:center;
  border:none; border-radius:8px;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  transition:background .16s var(--ease), color .16s var(--ease);
  -webkit-tap-highlight-color:transparent;
}
.conv-act svg{ width:14px; height:14px; }
.conv-act.conv-ren:hover{ background:rgba(52,211,153,.16); color:#a7f3d0; }
.conv-act.conv-del:hover{ background:rgba(248,113,113,.14); color:#fca5a5; }

.sidebar-empty{
  font-size:12.5px;
  color:var(--muted);
  padding:14px 12px;
  border:1px dashed rgba(52,211,153,.16);
  border-radius:12px;
  text-align:center;
  line-height:1.7;
}

.storage-note{
  display:flex;
  align-items:flex-start;
  gap:9px;
  padding:10px 11px;
  border-radius:12px;
  border:1px solid rgba(52,211,153,.14);
  background:rgba(52,211,153,.05);
  user-select:none;
}
.storage-ico{ width:16px; height:16px; flex:0 0 16px; color:var(--green); margin-top:2px; }
.storage-note-body{ display:flex; flex-direction:column; gap:3px; min-width:0; }
.storage-note-title{ font-size:12px; color:#c6e8d8; line-height:1.5; }
.storage-link{
  border:none; background:none; padding:0;
  font-family:inherit;
  font-size:11.5px;
  color:var(--muted);
  text-align:start;
  cursor:pointer;
  text-decoration:underline;
  text-decoration-color:rgba(52,211,153,.3);
  text-underline-offset:3px;
  transition:color .16s var(--ease);
}
.storage-link:hover{ color:var(--green); }

.sidebar-foot{
  border-top:1px solid var(--line);
  padding-top:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.balance-row{
  display:flex; align-items:center; justify-content:space-between;
  font-size:12.5px;
  color:var(--muted);
}
.balance-value{ color:#a7f3d0; font-weight:600; }
.wallet-link{
  font-size:12.5px;
  color:var(--green);
  text-decoration:none;
  border-bottom:1px dashed rgba(52,211,153,.35);
  align-self:flex-start;
  padding-bottom:1px;
}
.wallet-link:hover{ color:#6ee7b7; }

/* ===================== MAIN ===================== */
.main{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  flex-direction:column;
  height:100%;
  position:relative;
}

.topbar{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:10px;
  padding:11px 14px;
  border-bottom:1px solid var(--line);
  background:rgba(5,13,9,.72);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}

.topbar-info{ flex:1 1 auto; min-width:0; }
.topbar-info h1{
  margin:0;
  font-size:15.5px;
  font-weight:600;
  color:#eafff5;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.35;
}
.topbar-info p{
  margin:0;
  font-size:11.5px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.topbar-actions{ display:flex; align-items:center; gap:8px; flex:0 0 auto; }

.status-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:5px 10px;
  border-radius:99px;
  font-size:11.5px;
  font-weight:500;
  border:1px solid var(--line);
  background:rgba(52,211,153,.06);
  color:var(--text-dim);
  white-space:nowrap;
}
.status-dot{
  width:6px; height:6px; border-radius:50%;
  background:var(--green);
  box-shadow:0 0 0 3px rgba(52,211,153,.14);
}
.status-chip.is-loading{ color:#fcd34d; border-color:rgba(252,211,77,.22); background:rgba(252,211,77,.07); }
.status-chip.is-loading .status-dot{ background:#fcd34d; animation:pulse 1.3s infinite; }
.status-chip.is-off{ color:#fca5a5; border-color:rgba(248,113,113,.24); background:rgba(248,113,113,.08); }
.status-chip.is-off .status-dot{ background:#f87171; box-shadow:0 0 0 3px rgba(248,113,113,.14); }

@keyframes pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }

.icon-btn{
  width:40px; height:40px;
  flex:0 0 40px;
  display:inline-grid;
  place-items:center;
  border-radius:11px;
  border:1px solid var(--line);
  background:rgba(52,211,153,.05);
  color:var(--text-dim);
  cursor:pointer;
  transition:background .16s var(--ease), color .16s var(--ease), border-color .16s;
  -webkit-tap-highlight-color:transparent;
}
.icon-btn svg{ width:19px; height:19px; }
.icon-btn:hover{ background:rgba(52,211,153,.11); color:#eafff5; border-color:var(--line-2); }
.icon-btn:active{ transform:scale(.94); }

.only-mobile{ display:none; }
.close-side{ display:none; }

/* ===================== CHAT ===================== */
.chat-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scroll-behavior:smooth;
}

.messages{
  width:100%;
  max-width:840px;
  margin:0 auto;
  padding:22px 16px 10px;
  display:flex;
  flex-direction:column;
  gap:18px;
}

.msg{
  display:flex;
  gap:10px;
  max-width:100%;
  animation:rise .3s var(--ease) both;
}
@keyframes rise{
  from{ opacity:0; transform:translateY(8px); }
  to{ opacity:1; transform:translateY(0); }
}

.msg.user{ justify-content:flex-end; }

.bubble{
  max-width:min(80%, 620px);
  padding:11px 16px;
  border-radius:18px;
  background:linear-gradient(145deg,#0f3a28,#0b2b1d 70%);
  border:1px solid rgba(52,211,153,.24);
  color:#eafff5;
  font-size:15px;
  line-height:1.75;
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
  box-shadow:0 6px 18px rgba(0,0,0,.28);
}

.avatar{
  flex:0 0 34px;
  width:34px; height:34px;
  border-radius:11px;
  display:grid; place-items:center;
  color:#04231a;
  background:linear-gradient(140deg,#6ee7b7,#10b981 60%,#047857);
  box-shadow:0 4px 14px rgba(16,185,129,.24), inset 0 1px 0 rgba(255,255,255,.35);
  margin-top:2px;
}
.avatar svg{ width:18px; height:18px; }

.msg.assistant{ justify-content:flex-start; }
.msg.assistant .body{ flex:1 1 auto; min-width:0; }

.assistant-name{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:11.5px;
  font-weight:600;
  letter-spacing:.3px;
  color:var(--green);
  margin-bottom:6px;
}
.assistant-name .stamp{ color:var(--muted); font-weight:400; letter-spacing:0; }

.answer{
  background:rgba(10,25,18,.72);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px 16px;
  font-size:15px;
  line-height:1.85;
  color:var(--text);
  word-break:break-word;
  overflow-wrap:anywhere;
}

.msg-actions{
  display:flex;
  gap:6px;
  margin-top:8px;
  flex-wrap:wrap;
}
.mini-btn{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:5px 10px;
  border-radius:9px;
  border:1px solid var(--line);
  background:rgba(52,211,153,.05);
  color:var(--muted);
  font-size:11.5px;
  font-family:inherit;
  cursor:pointer;
  transition:background .16s, color .16s, border-color .16s;
}
.mini-btn svg{ width:13px; height:13px; }
.mini-btn:hover{ background:rgba(52,211,153,.12); color:#d1fae5; border-color:var(--line-2); }
.mini-btn.on{ color:#6ee7b7; border-color:var(--line-2); background:rgba(52,211,153,.14); }

/* ---------- markdown prose ---------- */
.answer p{ margin:0 0 10px; }
.answer p:last-child{ margin-bottom:0; }
.answer h3,.answer h4,.answer h5,.answer h6{
  margin:16px 0 8px;
  color:#d9ffef;
  font-weight:600;
  line-height:1.5;
  font-size:15.5px;
}
.answer h3:first-child,.answer h4:first-child,.answer h5:first-child{ margin-top:0; }
.answer ul,.answer ol{ margin:8px 0 12px; padding-inline-start:20px; }
.answer li{ margin:4px 0; }
.answer li::marker{ color:var(--green); }
.answer strong{ color:#a7f3d0; font-weight:600; }
.answer em{ color:#cdeee0; }
.answer blockquote{
  margin:10px 0;
  padding:8px 14px;
  border-inline-start:3px solid rgba(52,211,153,.4);
  background:rgba(52,211,153,.05);
  border-radius:0 10px 10px 0;
  color:var(--text-dim);
}
.answer hr{ border:none; border-top:1px solid var(--line); margin:14px 0; }
.answer code.inline{
  font-family:var(--mono);
  font-size:.88em;
  background:rgba(52,211,153,.13);
  color:#a7f3d0;
  padding:2px 6px;
  border-radius:6px;
  direction:ltr;
  display:inline-block;
}
.answer pre.code{
  direction:ltr;
  text-align:left;
  background:#03100a;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 14px;
  margin:10px 0;
  overflow-x:auto;
  font-family:var(--mono);
  font-size:12.8px;
  line-height:1.6;
  color:#bfe9d6;
}
.answer pre.code code{ font-family:inherit; white-space:pre; }

/* ---------- error card ---------- */
.err-card{
  border:1px solid rgba(248,113,113,.28);
  background:rgba(248,113,113,.07);
  border-radius:14px;
  padding:13px 15px;
}
.err-title{
  font-size:12.5px;
  font-weight:700;
  color:#fca5a5;
  margin-bottom:5px;
  letter-spacing:.2px;
}
.err-card p{
  margin:0 0 10px;
  font-size:13.8px;
  line-height:1.7;
  color:#f3dada;
}
.err-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.err-btn{
  padding:8px 14px;
  border-radius:10px;
  border:1px solid rgba(248,113,113,.34);
  background:rgba(248,113,113,.1);
  color:#fecaca;
  font-family:inherit;
  font-size:12.5px;
  font-weight:500;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.err-btn:hover{ background:rgba(248,113,113,.18); }
.err-btn.green{
  border-color:var(--line-2);
  background:rgba(52,211,153,.12);
  color:#6ee7b7;
}
.err-btn.green:hover{ background:rgba(52,211,153,.2); }

/* ---------- typing ---------- */
.typing{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:14px 18px;
  border-radius:16px;
  background:rgba(10,25,18,.72);
  border:1px solid var(--line);
}
.typing span{
  width:7px; height:7px;
  border-radius:50%;
  background:var(--green);
  opacity:.35;
  animation:blink 1.25s infinite;
}
.typing span:nth-child(2){ animation-delay:.16s; }
.typing span:nth-child(3){ animation-delay:.32s; }
@keyframes blink{
  0%,100%{ opacity:.25; transform:translateY(0); }
  40%{ opacity:1; transform:translateY(-3px); }
}

/* ---------- empty state ---------- */
.empty{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  padding:26px 8px 10px;
  animation:rise .45s var(--ease) both;
}
.empty-logo{
  position:relative;
  width:74px; height:74px;
  display:grid; place-items:center;
  border-radius:22px;
  color:#04231a;
  background:linear-gradient(140deg,#6ee7b7,#10b981 60%,#047857);
  box-shadow:0 14px 44px rgba(16,185,129,.3), inset 0 1px 0 rgba(255,255,255,.4);
  margin-bottom:18px;
}
.empty-logo::after{
  content:'';
  position:absolute; inset:-22px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(16,185,129,.24), transparent 68%);
  z-index:-1;
  filter:blur(6px);
}
.empty-logo svg{ width:40px; height:40px; }

.empty h2{
  margin:0 0 8px;
  font-size:23px;
  font-weight:700;
  color:#f0fff8;
  letter-spacing:-.2px;
}
.empty p{
  margin:0 0 22px;
  font-size:14px;
  color:var(--muted);
  max-width:420px;
  line-height:1.8;
}

.suggestions{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:9px;
  width:100%;
  max-width:560px;
}
.sug{
  display:flex;
  align-items:center;
  gap:9px;
  text-align:start;
  padding:12px 14px;
  min-height:52px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(10,25,18,.6);
  color:var(--text-dim);
  font-family:inherit;
  font-size:13px;
  line-height:1.55;
  cursor:pointer;
  transition:background .18s var(--ease), border-color .18s var(--ease), color .18s, transform .14s;
}
.sug:hover{ background:rgba(52,211,153,.09); border-color:var(--line-2); color:#eafff5; transform:translateY(-1px); }
.sug:active{ transform:translateY(0) scale(.99); }
.sug .sug-ico{ font-size:16px; line-height:1; flex:0 0 auto; }

/* ===================== COMPOSER ===================== */
.composer-area{
  flex:0 0 auto;
  padding:8px 14px 12px;
  background:linear-gradient(180deg, rgba(5,13,9,0), rgba(5,13,9,.92) 26%, var(--bg) 70%);
}

.banner{
  max-width:840px;
  margin:0 auto 8px;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  padding:9px 13px;
  border-radius:12px;
  border:1px solid rgba(252,211,77,.24);
  background:rgba(252,211,77,.07);
  color:#fde68a;
  font-size:12.5px;
  line-height:1.6;
}
.banner.error{
  border-color:rgba(248,113,113,.28);
  background:rgba(248,113,113,.08);
  color:#fecaca;
}
.banner-text{ flex:1 1 auto; min-width:0; }
.banner-retry{
  flex:0 0 auto;
  padding:6px 12px;
  border-radius:9px;
  border:1px solid rgba(248,113,113,.36);
  background:rgba(248,113,113,.14);
  color:#fecaca;
  font-family:inherit;
  font-size:12px;
  cursor:pointer;
}
.banner-retry:hover{ background:rgba(248,113,113,.24); }

.composer{
  max-width:840px;
  margin:0 auto;
  display:flex;
  align-items:flex-end;
  gap:8px;
  padding:7px 7px 7px 14px;
  border-radius:22px;
  border:1px solid rgba(52,211,153,.22);
  background:rgba(10,24,17,.92);
  box-shadow:0 14px 36px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.03);
  transition:border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.composer:focus-within{
  border-color:rgba(52,211,153,.5);
  box-shadow:0 0 0 4px rgba(52,211,153,.08), 0 14px 36px rgba(0,0,0,.4);
}

.composer-input{
  flex:1 1 auto;
  min-width:0;
  border:none;
  outline:none;
  background:transparent;
  color:var(--text);
  font-family:inherit;
  font-size:16px;
  line-height:1.65;
  padding:9px 2px;
  resize:none;
  max-height:180px;
  overflow-y:auto;
  scrollbar-width:thin;
}
.composer-input::placeholder{ color:#5f7d71; }
.composer-input:disabled{ opacity:.5; }

.send-btn{
  flex:0 0 46px;
  width:46px; height:46px;
  display:grid;
  place-items:center;
  border:none;
  border-radius:16px;
  background:linear-gradient(140deg,#34d399,#10b981 55%,#059669);
  color:#032018;
  cursor:pointer;
  box-shadow:0 8px 20px rgba(16,185,129,.26), inset 0 1px 0 rgba(255,255,255,.4);
  transition:transform .14s var(--ease), filter .2s, opacity .2s, box-shadow .2s;
  -webkit-tap-highlight-color:transparent;
}
.send-btn svg{ width:21px; height:21px; }
.send-btn:hover:not(:disabled){ filter:brightness(1.08); }
.send-btn:active:not(:disabled){ transform:scale(.93); }
.send-btn:disabled{ opacity:.35; cursor:not-allowed; box-shadow:none; }
.send-btn.confirm{
  background:linear-gradient(140deg,#fcd34d,#f59e0b);
  box-shadow:0 0 0 4px rgba(245,158,11,.18), 0 8px 20px rgba(245,158,11,.28);
}

.composer-foot{
  max-width:840px;
  margin:7px auto 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding-inline:6px;
  min-height:18px;
}
.foot-hint{ font-size:11px; color:#557064; }
.cost-chip{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:11.5px;
  font-weight:600;
  padding:3px 9px;
  border-radius:99px;
  border:1px solid var(--line);
  background:rgba(52,211,153,.08);
  color:#6ee7b7;
}
.cost-chip[data-kind="paid"]{
  border-color:rgba(252,211,77,.26);
  background:rgba(252,211,77,.09);
  color:#fcd34d;
}

/* ===================== MODALS ===================== */
.modal{
  position:fixed;
  inset:0;
  z-index:60;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(2,8,5,.74);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  animation:fadeIn .18s var(--ease);
}
.modal-card{
  width:100%;
  max-width:430px;
  max-height:calc(100dvh - 48px);
  overflow-y:auto;
  background:linear-gradient(180deg,#0b1a13,#071310);
  border:1px solid var(--line-2);
  border-radius:20px;
  padding:20px;
  box-shadow:0 24px 60px rgba(0,0,0,.62);
  animation:popIn .22s var(--ease);
}
@keyframes popIn{
  from{ opacity:0; transform:translateY(12px) scale(.985); }
  to{ opacity:1; transform:none; }
}
.modal-card h2{
  margin:0 0 6px;
  font-size:17px;
  font-weight:700;
  color:#eafff5;
  line-height:1.4;
}
.modal-sub{
  margin:0 0 14px;
  font-size:12.5px;
  color:var(--muted);
  line-height:1.7;
}
.modal-input{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(52,211,153,.24);
  background:rgba(5,16,11,.9);
  color:var(--text);
  font-family:inherit;
  font-size:16px;
  outline:none;
  transition:border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.modal-input:focus{
  border-color:rgba(52,211,153,.55);
  box-shadow:0 0 0 3px rgba(52,211,153,.1);
}
.modal-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top:16px;
}
.modal-btn{
  min-height:44px;
  padding:10px 18px;
  border-radius:12px;
  font-family:inherit;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  border:1px solid var(--line);
  background:rgba(52,211,153,.06);
  color:var(--text-dim);
  transition:background .16s var(--ease), color .16s var(--ease), transform .12s var(--ease);
  -webkit-tap-highlight-color:transparent;
}
.modal-btn:hover{ background:rgba(52,211,153,.13); color:#eafff5; }
.modal-btn:active{ transform:scale(.97); }
.modal-btn.primary{
  border:none;
  background:linear-gradient(135deg,#34d399,#10b981 60%,#059669);
  color:#04231a;
  box-shadow:0 8px 20px rgba(16,185,129,.24), inset 0 1px 0 rgba(255,255,255,.35);
}
.modal-btn.primary:hover{ filter:brightness(1.06); }
.modal-btn.danger{
  border-color:rgba(248,113,113,.34);
  background:rgba(248,113,113,.1);
  color:#fecaca;
}
.modal-btn.danger:hover{ background:rgba(248,113,113,.2); color:#fee2e2; }
.info-list{
  margin:0;
  padding-inline-start:18px;
  display:flex;
  flex-direction:column;
  gap:9px;
}
.info-list li{ font-size:13.5px; line-height:1.75; color:var(--text-dim); }
.info-list li::marker{ color:var(--green); }
.info-list strong{ color:#a7f3d0; font-weight:600; }

/* ===================== TOAST ===================== */
.toast{
  position:fixed;
  bottom:22px;
  left:50%;
  transform:translate(-50%, 16px);
  max-width:min(92vw, 460px);
  padding:11px 18px;
  border-radius:14px;
  background:rgba(10,30,21,.96);
  border:1px solid var(--line-2);
  color:#d9ffef;
  font-size:13px;
  line-height:1.6;
  text-align:center;
  box-shadow:0 16px 40px rgba(0,0,0,.5);
  opacity:0;
  pointer-events:none;
  transition:opacity .24s var(--ease), transform .24s var(--ease);
  z-index:90;
}
.toast.show{ opacity:1; transform:translate(-50%, 0); }

/* ===================== FOCUS ===================== */
:focus-visible{
  outline:2px solid rgba(52,211,153,.6);
  outline-offset:2px;
}
.composer-input:focus-visible{ outline:none; }

/* ===================== SCRIM (hidden on desktop) ===================== */
.scrim{ display:none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px){
  .sidebar{
    position:fixed;
    top:0; bottom:0;
    inset-inline-start:0;
    width:min(86vw, 330px);
    z-index:50;
    transform:translateX(100%);
    transition:transform .3s var(--ease);
    box-shadow:-24px 0 70px rgba(0,0,0,.55);
    border-inline-end:1px solid var(--line-2);
    padding-bottom:18px;
  }
  .sidebar.open{ transform:translateX(0); }

  .scrim{
    display:block;
    position:fixed;
    inset:0;
    z-index:45;
    background:rgba(2,8,5,.64);
    backdrop-filter:blur(3px);
    -webkit-backdrop-filter:blur(3px);
    animation:fadeIn .2s var(--ease);
  }
  @keyframes fadeIn{ from{ opacity:0 } to{ opacity:1 } }

  .only-mobile{ display:inline-grid; }
  .close-side{ display:inline-grid; }
  .foot-hint{ display:none; }
  .composer-foot{ justify-content:flex-start; }

  .messages{ padding:18px 12px 8px; gap:16px; }
  .composer-area{ padding:6px 10px 10px; }
  .bubble{ max-width:86%; font-size:14.5px; }
  .answer{ padding:12px 14px; font-size:14.5px; }
  .empty{ padding-top:14px; }
  .empty h2{ font-size:20px; }
  .empty p{ font-size:13px; margin-bottom:18px; }
  .suggestions{ grid-template-columns:1fr; gap:8px; }
  .sug{ min-height:48px; font-size:12.8px; padding:10px 12px; }
  .topbar{ padding:9px 11px; }
  .topbar-info h1{ font-size:14.5px; }
}

@media (hover: none){
  .conv-actions{ opacity:.7; }
  .storage-note{ padding:9px 10px; }
}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
}