/* ─────────────────────────────────────────────────────────────
   chat.css — Atlas Chat (drawer + full-page + FAB).
   Reuses the slate + purple design tokens from index.html / learn.css.
   ───────────────────────────────────────────────────────────── */

/* ── Floating "Ask" button (FAB) ─────────────────────────────── */
.atlas-chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #9333ea, #a855f7);
  color: #fff;
  font: 700 14.5px 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border: 0;
  cursor: pointer;
  box-shadow: 0 12px 28px -8px rgba(147, 51, 234, .55), 0 4px 10px -2px rgba(0, 0, 0, .35);
  transition: transform .14s, box-shadow .14s;
}
.atlas-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -8px rgba(147, 51, 234, .65), 0 6px 12px -2px rgba(0, 0, 0, .4); }
.atlas-chat-fab svg { width: 20px; height: 20px; flex: none; }
body.atlas-chat-fullpage .atlas-chat-fab,
.atlas-chat-drawer.is-open ~ .atlas-chat-fab,
body.atlas-chat-open .atlas-chat-fab { display: none; }
@media (max-width: 640px) {
  .atlas-chat-fab { right: 14px; bottom: 14px; padding: 0 18px 0 14px; height: 48px; }
}

/* ── Backdrop + drawer container ─────────────────────────────── */
.atlas-chat-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 6, 23, .55);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.atlas-chat-backdrop.is-open { opacity: 1; pointer-events: auto; }

.atlas-chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(440px, 100vw);
  height: 100dvh;
  z-index: 101;
  background: #0f172a;
  border-left: 1px solid #26324a;
  box-shadow: -18px 0 44px -12px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4, 0, .2, 1);
  font: 400 15px 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #cbd5e1;
}
.atlas-chat-drawer.is-open { transform: translateX(0); }
@media (max-width: 640px) {
  .atlas-chat-drawer { width: 100vw; border-left: 0; }
}

/* ── Full-page mode (chat.html) ──────────────────────────────── */
.atlas-chat-page {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: calc(100vh - 120px);
  border: 1px solid #26324a;
  border-radius: 16px;
  overflow: hidden;
  background: #0f172a;
}
.atlas-chat-page.no-sidebar { grid-template-columns: 1fr; }
.atlas-chat-page .atlas-chat-sidebar {
  border-right: 1px solid #26324a;
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: #131c31;
  overflow-y: auto;
}
.atlas-chat-page .atlas-chat-main {
  display: flex; flex-direction: column;
  min-height: 60vh;
}
@media (max-width: 860px) {
  .atlas-chat-page { grid-template-columns: 1fr; }
  .atlas-chat-page .atlas-chat-sidebar { display: none; }
}

/* Sidebar bits */
.atlas-chat-sidebar-header {
  font-size: 12.5px; color: #94a3b8; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 8px 8px;
}
.atlas-chat-new {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  font: 700 14px 'Inter', sans-serif;
  color: #f1f5f9; background: #1e293b;
  border: 1px solid #334155; border-radius: 10px;
  cursor: pointer; transition: .14s;
}
.atlas-chat-new:hover { border-color: #9333ea; }
.atlas-chat-conv-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px; color: #cbd5e1;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .12s;
}
.atlas-chat-conv-item:hover { background: #1e293b; color: #f1f5f9; }
.atlas-chat-conv-item.is-active { background: rgba(147,51,234,.14); color: #f1f5f9; }
.atlas-chat-signin-card {
  padding: 14px; border: 1px dashed #334155; border-radius: 12px;
  font-size: 13.5px; color: #94a3b8; margin-top: 6px;
}
.atlas-chat-signin-card b { color: #f1f5f9; display: block; margin-bottom: 4px; }

/* ── Header (both drawer + full-page main) ───────────────────── */
.atlas-chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #26324a;
  background: #131c31;
}
.atlas-chat-page .atlas-chat-header { border-radius: 0; }
.atlas-chat-header .atlas-chat-title {
  font: 800 15px 'Inter', sans-serif; color: #f1f5f9;
  letter-spacing: -.01em;
  display: flex; align-items: center; gap: 9px;
  flex: 1; min-width: 0;
}
.atlas-chat-header .atlas-chat-title .pill {
  font: 700 10.5px 'Inter', sans-serif;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(147,51,234,.14); color: #c084fc;
}
.atlas-chat-icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: #94a3b8; background: transparent; border: 0; border-radius: 8px;
  cursor: pointer; transition: .12s;
}
.atlas-chat-icon-btn:hover { color: #f1f5f9; background: #1e293b; }
.atlas-chat-icon-btn svg { width: 18px; height: 18px; }
body.atlas-chat-fullpage .atlas-chat-header .atlas-chat-expand { display: none; }

/* ── Body wrapper (holds messages + floating jump pill) ──────── */
.atlas-chat-body {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
}
.atlas-chat-page .atlas-chat-main .atlas-chat-body { min-height: 40vh; }

/* ── "Jump to latest" pill (shown when user scrolled up mid-stream) */
.atlas-chat-jump {
  position: absolute;
  right: 14px; bottom: 12px;
  z-index: 4;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: rgba(19, 28, 49, .92);
  backdrop-filter: blur(6px);
  color: #f1f5f9;
  font: 600 12.5px 'Inter', sans-serif;
  cursor: pointer;
  opacity: 0; pointer-events: none;
  transform: translateY(6px);
  transition: opacity .16s, transform .16s;
  box-shadow: 0 8px 18px -6px rgba(0,0,0,.55);
}
.atlas-chat-jump.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.atlas-chat-jump:hover { border-color: #9333ea; }

/* ── Restored-session banner ─────────────────────────────────── */
.atlas-chat-restored {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 4px;
  border: 1px dashed #334155;
  border-radius: 10px;
  font-size: 12.5px; color: #94a3b8;
  background: rgba(30, 41, 59, .35);
}
.atlas-chat-restored .reset {
  background: transparent; border: 0;
  color: #c084fc; font: 700 12.5px 'Inter', sans-serif;
  cursor: pointer;
}
.atlas-chat-restored .reset:hover { color: #a855f7; }

/* ── Message list ────────────────────────────────────────────── */
.atlas-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 12px;
  display: flex; flex-direction: column; gap: 16px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.atlas-chat-empty {
  padding: 22px 18px;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.6;
  border: 1px dashed #26324a;
  border-radius: 12px;
  background: rgba(19, 28, 49, .5);
}
.atlas-chat-empty h3 {
  font: 800 17px 'Inter', sans-serif; color: #f1f5f9;
  margin: 0 0 6px; letter-spacing: -.01em;
}
.atlas-chat-empty .starters { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.atlas-chat-empty .starter {
  text-align: left; padding: 10px 12px;
  font: 500 13.5px 'Inter', sans-serif; color: #cbd5e1;
  background: #1e293b; border: 1px solid #334155; border-radius: 10px;
  cursor: pointer; transition: .12s;
}
.atlas-chat-empty .starter:hover { border-color: #9333ea; color: #f1f5f9; }

.atlas-chat-message { display: flex; flex-direction: column; gap: 6px; }
.atlas-chat-message.user { align-items: flex-end; }
.atlas-chat-message.user .atlas-chat-bubble {
  background: linear-gradient(135deg, #9333ea, #a855f7);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  max-width: 82%;
}
.atlas-chat-message.assistant { align-items: flex-start; }
.atlas-chat-message.assistant .atlas-chat-bubble {
  background: #1e293b;
  border: 1px solid #26324a;
  color: #f1f5f9;
  border-radius: 14px 14px 14px 4px;
  max-width: 92%;
}
.atlas-chat-bubble {
  padding: 11px 14px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.atlas-chat-bubble p { margin: 0 0 10px; }
.atlas-chat-bubble p:last-child { margin-bottom: 0; }
.atlas-chat-bubble strong { color: #fff; }
.atlas-chat-bubble ul, .atlas-chat-bubble ol { margin: 6px 0 8px; padding-left: 20px; }
.atlas-chat-bubble li { margin: 3px 0; }
.atlas-chat-bubble a { color: #c084fc; border-bottom: 1px solid transparent; transition: .14s; }
.atlas-chat-bubble a:hover { border-color: #c084fc; }
.atlas-chat-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #0f172a; border: 1px solid #334155; border-radius: 5px;
  padding: 1px 5px; color: #c084fc;
}

/* Tool-use status ("Searching for …") */
.atlas-chat-tool-status {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  font-size: 13px; color: #94a3b8;
  background: rgba(30, 41, 59, .5);
  border: 1px solid #26324a;
  border-radius: 10px;
  align-self: flex-start;
}
.atlas-chat-tool-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #c084fc;
  animation: atlas-chat-pulse 1.1s ease-in-out infinite;
}
@keyframes atlas-chat-pulse {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
.atlas-chat-tool-status .q { color: #f1f5f9; font-weight: 600; }

/* ── Inline error pill with Retry ────────────────────────────── */
.atlas-chat-error {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(220, 38, 38, .10);
  border: 1px solid rgba(248, 113, 113, .45);
  border-radius: 10px;
  align-self: flex-start;
  max-width: 92%;
  font-size: 13px; color: #fecaca;
}
.atlas-chat-error .msg { flex: 1; line-height: 1.4; }
.atlas-chat-error .retry {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: transparent; color: #fecaca;
  border: 1px solid rgba(248, 113, 113, .55);
  border-radius: 8px;
  font: 700 12.5px 'Inter', sans-serif;
  cursor: pointer;
  transition: .12s;
}
.atlas-chat-error .retry:hover { background: rgba(248, 113, 113, .12); color: #fff; }
.atlas-chat-error .retry svg { width: 13px; height: 13px; }

/* ── Stopped-turn marker ─────────────────────────────────────── */
.atlas-chat-stopped {
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
  color: #94a3b8;
  border: 1px solid #26324a;
  border-radius: 999px;
  background: rgba(30, 41, 59, .5);
}

/* Inline ontology card row */
.atlas-chat-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin: 4px 0 2px;
}
.atlas-chat-card {
  display: block;
  padding: 10px 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  transition: border-color .14s, transform .14s;
}
.atlas-chat-card:hover { border-color: #9333ea; transform: translateY(-1px); }
.atlas-chat-card .name {
  font: 700 13.5px 'Inter', sans-serif; color: #f1f5f9;
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 3px;
}
.atlas-chat-card .name .acr {
  font-size: 11px; color: #c084fc; font-weight: 800;
  letter-spacing: .04em;
  background: rgba(147,51,234,.14);
  padding: 1px 5px; border-radius: 999px;
}
.atlas-chat-card .cat {
  font-size: 11.5px; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .05em; font-weight: 600;
  margin-bottom: 4px;
}
.atlas-chat-card .desc {
  font-size: 12.5px; color: #cbd5e1; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Composer (textarea + send) ──────────────────────────────── */
.atlas-chat-composer {
  border-top: 1px solid #26324a;
  padding: 12px 14px 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: #131c31;
}
.atlas-chat-composer form {
  display: flex; gap: 8px;
  background: #1e293b; border: 1px solid #334155; border-radius: 12px;
  padding: 4px;
  transition: border-color .14s, opacity .14s;
}
.atlas-chat-composer form:focus-within { border-color: #9333ea; }
.atlas-chat-composer.is-streaming form { border-color: #26324a; }
.atlas-chat-composer.is-streaming textarea { color: #64748b; }
.atlas-chat-composer textarea {
  flex: 1;
  min-height: 40px; max-height: 160px;
  padding: 10px 12px;
  background: transparent;
  border: 0; outline: 0; resize: none;
  color: #f1f5f9;
  font: 400 14.5px 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
}
.atlas-chat-composer textarea::placeholder { color: #64748b; }
.atlas-chat-composer .send {
  align-self: flex-end;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: #9333ea; color: #fff; border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background .14s, transform .1s;
}
.atlas-chat-composer .send:hover { background: #a855f7; }
.atlas-chat-composer .send:disabled { background: #334155; cursor: not-allowed; }
.atlas-chat-composer .send svg { width: 18px; height: 18px; }
/* Send → Stop while streaming */
.atlas-chat-composer .send.is-stop {
  background: #1e293b;
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, .55);
  position: relative;
}
.atlas-chat-composer .send.is-stop::before {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, .25);
  animation: atlas-chat-pulse-ring 1.6s ease-in-out infinite;
  pointer-events: none;
}
.atlas-chat-composer .send.is-stop:hover { background: rgba(248, 113, 113, .12); color: #fff; }
.atlas-chat-composer .send.is-stop svg { width: 14px; height: 14px; }
@keyframes atlas-chat-pulse-ring {
  0%, 100% { opacity: .3; transform: scale(1); }
  50% { opacity: .8; transform: scale(1.03); }
}
.atlas-chat-composer .foot {
  padding: 8px 4px 0;
  font-size: 11.5px; color: #64748b;
  display: flex; justify-content: space-between; gap: 8px;
}

/* ── Sign-in required panel (30-msg gate) ────────────────────── */
.atlas-chat-signin {
  margin: 12px 4px 0;
  padding: 18px;
  background: #131c31;
  border: 1px solid #9333ea;
  border-radius: 14px;
  color: #cbd5e1;
}
.atlas-chat-signin h4 {
  font: 800 15.5px 'Inter', sans-serif; color: #f1f5f9;
  margin: 0 0 8px; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px;
}
.atlas-chat-signin p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: #cbd5e1; }
.atlas-chat-signin .why { color: #94a3b8; font-size: 12.5px; margin-bottom: 14px; }
.atlas-chat-signin .signin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 11px 14px;
  background: #1e293b; border: 1px solid #334155; border-radius: 999px;
  color: #f1f5f9; font: 700 14px 'Inter', sans-serif;
  cursor: pointer; transition: .14s;
}
.atlas-chat-signin .signin-btn:hover { border-color: #a855f7; }
.atlas-chat-signin .signin-btn svg { width: 17px; height: 17px; }

/* ── Sign-in required panel: full-page variant is roomier ───── */
body.atlas-chat-fullpage .atlas-chat-signin { max-width: 480px; margin: 24px auto; }

/* ═════════════════════════════════════════════════════════════════════
   FULL-PAGE MODE (chat.html) — Grok-style landing that collapses into a
   normal thread once the conversation starts.
   ═════════════════════════════════════════════════════════════════════ */

/* Compact page header — no giant hero eating the fold. */
body.atlas-chat-fullpage .chat-page-header {
  padding: 18px 0 8px;
  border-bottom: 1px solid rgba(38, 50, 74, .6);
  background: rgba(15, 23, 42, .85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
body.atlas-chat-fullpage .chat-page-header .brand { padding: 0 24px; }
body.atlas-chat-fullpage .chat-page-header .brand img { height: 32px; width: 32px; }
body.atlas-chat-fullpage .chat-page-header .brand .name { font-size: 17px; }

/* Main area fills the rest of the viewport, no scrolling above the composer. */
body.atlas-chat-fullpage .chat-page-main {
  height: calc(100dvh - 72px);
  min-height: 500px;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-width: none;
}
body.atlas-chat-fullpage #atlasChatRoot { flex: 1; display: flex; min-height: 0; }

/* Reset the panel chrome inside full-page — no border/radius, just fills. */
body.atlas-chat-fullpage .atlas-chat-page {
  border: 0; border-radius: 0; overflow: visible;
  background: transparent;
  min-height: 0; height: 100%;
  flex: 1;
  width: 100%;
}
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-main {
  min-height: 0; height: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header inside the panel: cleaner, no border, "New chat" is prominent. */
body.atlas-chat-fullpage .atlas-chat-header {
  background: transparent;
  border-bottom: 0;
  padding: 18px 4px 10px;
}

/* ── Grok-style hero empty state ────────────────────────────── */
.atlas-chat-hero-empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px 8px 40px;
  gap: 28px;
  text-align: center;
}
.atlas-chat-hero-empty .eyebrow {
  font: 700 12px 'Inter', sans-serif;
  color: #c084fc;
  letter-spacing: .18em; text-transform: uppercase;
}
.atlas-chat-hero-empty h1 {
  font: 800 clamp(30px, 5vw, 44px) 'Inter', sans-serif;
  color: #f1f5f9;
  letter-spacing: -.03em;
  margin: 0;
  line-height: 1.1;
  max-width: 640px;
}
.atlas-chat-hero-empty h1 .accent {
  background: linear-gradient(135deg, #c084fc, #a855f7);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.atlas-chat-hero-empty .sub {
  font-size: 15.5px; color: #94a3b8; margin: -14px 0 0;
  max-width: 520px; line-height: 1.55;
}

/* Hero composer — a big pill directly in the hero. */
.atlas-chat-hero-composer {
  width: 100%; max-width: 720px;
}
.atlas-chat-hero-composer form {
  display: flex; align-items: center; gap: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 8px 8px 8px 22px;
  transition: border-color .14s, box-shadow .14s;
  box-shadow: 0 12px 34px -14px rgba(0, 0, 0, .55);
}
.atlas-chat-hero-composer form:focus-within {
  border-color: #9333ea;
  box-shadow: 0 12px 34px -12px rgba(147, 51, 234, .35);
}
.atlas-chat-hero-composer textarea {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: #f1f5f9; resize: none;
  font: 400 16px 'Inter', -apple-system, sans-serif;
  padding: 10px 0; min-height: 26px; max-height: 140px;
  line-height: 1.4;
}
.atlas-chat-hero-composer textarea::placeholder { color: #64748b; }
.atlas-chat-hero-composer .send {
  align-self: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: #9333ea; color: #fff; border: 0;
  display: grid; place-items: center;
  cursor: pointer; transition: background .14s, transform .1s;
  flex: none;
}
.atlas-chat-hero-composer .send:hover { background: #a855f7; }
.atlas-chat-hero-composer .send:disabled { background: #334155; cursor: not-allowed; }
.atlas-chat-hero-composer .send svg { width: 20px; height: 20px; }

/* Chip grid under the hero composer. */
.atlas-chat-hero-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%; max-width: 720px;
}
.atlas-chat-hero-chips .chip {
  text-align: left;
  padding: 14px 16px;
  background: rgba(30, 41, 59, .6);
  border: 1px solid #26324a;
  border-radius: 14px;
  color: #cbd5e1;
  font: 500 14px 'Inter', sans-serif;
  cursor: pointer;
  transition: .14s;
  line-height: 1.4;
  display: flex; align-items: flex-start; gap: 10px;
}
.atlas-chat-hero-chips .chip:hover {
  border-color: #9333ea;
  color: #f1f5f9;
  background: rgba(30, 41, 59, .9);
  transform: translateY(-1px);
}
.atlas-chat-hero-chips .chip .chip-emoji {
  font-size: 18px; flex: none; line-height: 1.2;
}
@media (max-width: 640px) {
  .atlas-chat-hero-chips { grid-template-columns: 1fr; }
  .atlas-chat-hero-empty { gap: 22px; padding: 12px 4px 30px; }
}

/* ── Active conversation: composer anchored to bottom ───────── */
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-body {
  flex: 1; min-height: 0;
}
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-messages {
  padding: 20px 4px 24px;
  gap: 18px;
}
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-composer {
  background: rgba(15, 23, 42, .92);
  backdrop-filter: blur(8px);
  border-top: 1px solid #26324a;
  padding: 14px 4px calc(18px + env(safe-area-inset-bottom, 0px));
  position: sticky; bottom: 0;
}
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-composer form {
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
}
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-composer textarea {
  font-size: 15px;
}
body.atlas-chat-fullpage .atlas-chat-page .atlas-chat-composer .send {
  width: 40px; height: 40px; border-radius: 50%;
}

/* ── Prominent "New chat" pill button (replaces pencil icon) ── */
.atlas-chat-newchat-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 999px;
  color: #cbd5e1;
  font: 700 12.5px 'Inter', sans-serif;
  letter-spacing: .01em;
  cursor: pointer;
  transition: .14s;
  flex: none;
}
.atlas-chat-newchat-btn:hover {
  border-color: #9333ea;
  color: #f1f5f9;
  background: rgba(147, 51, 234, .08);
}
.atlas-chat-newchat-btn svg { width: 14px; height: 14px; }
.atlas-chat-newchat-btn .label { font-size: 12.5px; }
@media (max-width: 640px) {
  .atlas-chat-newchat-btn .label { display: none; }
  .atlas-chat-newchat-btn { padding: 7px 10px; }
}

/* When the hero-empty state is active, hide the sticky bottom composer and
   the panel header — the hero owns the whole viewport until the first send. */
body.atlas-chat-fullpage .atlas-chat-main.has-hero .atlas-chat-composer,
body.atlas-chat-fullpage .atlas-chat-main.has-hero > .atlas-chat-header {
  display: none;
}
body.atlas-chat-fullpage .atlas-chat-main.has-hero .atlas-chat-body {
  padding-top: 0;
}

/* ── Compact search-result refs (replaces the old big card grid) ── */
.atlas-chat-refs {
  display: flex; flex-direction: column;
  gap: 2px;
  margin: 4px 0 6px;
  padding: 8px 10px;
  background: rgba(30, 41, 59, .35);
  border: 1px solid #26324a;
  border-radius: 8px;
}
.atlas-chat-refs-lbl {
  font: 700 10.5px 'Inter', sans-serif;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 2px 4px;
}
.atlas-chat-ref {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
  transition: background .12s, color .12s;
}
.atlas-chat-ref:hover {
  background: rgba(147, 51, 234, .10);
  color: #f1f5f9;
}
.atlas-chat-ref .ref-name { flex: 1; min-width: 0; }
.atlas-chat-ref .ref-name strong { color: #f1f5f9; font-weight: 700; }
.atlas-chat-ref .ref-acr { color: #c084fc; font-weight: 600; font-size: 12px; margin-left: 4px; }
.atlas-chat-ref .ref-domain {
  font-size: 11.5px; color: #64748b;
  white-space: nowrap;
}
.atlas-chat-ref .ref-arrow { color: #64748b; font-size: 11px; opacity: 0; transition: opacity .12s; }
.atlas-chat-ref:hover .ref-arrow { opacity: 1; }

/* ── History dropdown (replaces the full-page sidebar) ──────────── */
.atlas-chat-history-wrap { position: relative; }
.atlas-chat-history-btn { padding: 6px 12px; }
.atlas-chat-history-menu {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  min-width: 260px; max-width: 340px; max-height: 60vh;
  overflow-y: auto;
  background: #131c31;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6);
  padding: 6px;
  z-index: 40;
  display: flex; flex-direction: column; gap: 2px;
}
.atlas-chat-history-empty {
  padding: 12px;
  color: #64748b;
  font-size: 12.5px;
  text-align: center;
}
.atlas-chat-history-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px;
  background: transparent;
  border: 0; border-radius: 8px;
  color: #cbd5e1;
  font: 500 13px 'Inter', sans-serif;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .1s;
}
.atlas-chat-history-item:hover { background: #1e293b; color: #f1f5f9; }
