/* ─────────────────────────────────────────
   Quantra F5 — Production CSS
   ChatGPT-quality dark UI
───────────────────────────────────────── */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
textarea, input { font-family: inherit; }

/* ── Tokens ── */
:root {
  --sw: 260px;

  /* Surface */
  --bg:        #212121;
  --sb-bg:     #171717;
  --sur:       rgba(255,255,255,0.07);
  --sur-hi:    rgba(255,255,255,0.10);
  --sur-press: rgba(255,255,255,0.13);

  /* Border */
  --bd:   rgba(255,255,255,0.08);
  --bd-hi:rgba(255,255,255,0.15);

  /* Text */
  --tx:   #ececec;
  --tx-2: #9b9b9b;
  --tx-3: #585858;

  /* Accent */
  --ac:   #d4a853;
  --ac-hi:#c49a3f;
  --ac-lo:rgba(212,168,83,0.12);
  --ac-glow:rgba(212,168,83,0.15);

  /* State colours */
  --red:    #ef4444;
  --red-lo: rgba(239,68,68,0.12);
  --amber:  #f59e0b;
  --blue:   #3b82f6;
  --violet: #8b5cf6;

  /* Radius */
  --r2:  4px;
  --r4:  6px;
  --r6:  8px;
  --r8:  10px;
  --r12: 14px;
  --pill:9999px;

  /* Motion */
  --fast: 0.10s ease;
  --mid:  0.18s ease;
  --slow: 0.28s cubic-bezier(.4,0,.2,1);

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.05);
  --shadow-md: 0 4px 20px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
}

/* ── Base ── */
html, body {
  height: 100%;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--tx);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════
   SHELL
════════════════════════════════════════ */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  width: var(--sw);
  min-width: var(--sw);
  background: var(--sb-bg);
  border-right: 1px solid var(--bd);
  display: flex;
  flex-direction: column;
  transition: width var(--slow), min-width var(--slow), border-color var(--slow);
  overflow: hidden;
  flex-shrink: 0;
}
.sidebar.hidden {
  width: 0;
  min-width: 0;
  border-right-color: transparent;
}

/* ── Sidebar Header ── */
.sb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px;
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}
.sb-logo {
  width: 26px;
  height: 26px;
  border-radius: var(--r4);
  background: var(--ac);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sb-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  flex: 1;
  overflow: hidden;
}
.sb-hdr-actions { display: flex; gap: 1px; }

/* ── Icon Button ── */
.ib {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--r6);
  background: transparent;
  color: var(--tx-2);
  flex-shrink: 0;
  transition: background var(--fast), color var(--fast);
}
.ib:hover  { background: var(--sur);    color: var(--tx); }
.ib:active { background: var(--sur-hi); color: var(--tx); }

/* ── Nav ── */
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--r6);
  background: transparent;
  color: var(--tx-2);
  font-size: 13.5px;
  font-weight: 450;
  text-align: left;
  width: 100%;
  transition: background var(--fast), color var(--fast);
}
.nav-item:hover  { background: var(--sur);    color: var(--tx); }
.nav-item:active { background: var(--sur-hi); }
.nav-item.active {
  background: var(--sur-hi);
  color: var(--tx);
  font-weight: 500;
}
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; color: var(--ac); }

/* ── Panels ── */
.sb-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.panel {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 14px 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}
.panel.active { display: block; }

/* ── Form fields ── */
.panel-section { margin-bottom: 14px; }

.field-lbl {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tx-3);
  margin-bottom: 6px;
}
.field-inp {
  display: block;
  width: 100%;
  background: var(--sur);
  border: 1px solid var(--bd);
  border-radius: var(--r6);
  color: var(--tx);
  padding: 8px 10px;
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
  -webkit-appearance: none;
}
.field-inp:hover { border-color: var(--bd-hi); }
.field-inp:focus {
  border-color: var(--ac);
  background: var(--ac-lo);
  box-shadow: 0 0 0 3px var(--ac-glow);
}
.field-inp::placeholder { color: var(--tx-3); }
.field-ta {
  resize: vertical;
  min-height: 72px;
  line-height: 1.55;
}

.field-prefix-wrap { position: relative; }
.field-prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tx-2);
  font-size: 13px;
  pointer-events: none;
}
.has-prefix { padding-left: 24px; }

/* ── Info box ── */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 11px;
  background: var(--sur);
  border: 1px solid var(--bd);
  border-radius: var(--r6);
  font-size: 12px;
  color: var(--tx-2);
  line-height: 1.5;
  margin-top: 10px;
}
.info-box svg { flex-shrink: 0; margin-top: 1px; color: var(--ac); }

/* â”€â”€ Auth panel â”€â”€ */
.auth-section {
  padding: 10px 11px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(212,168,83,.18);
  border-radius: var(--r8);
  background:
    radial-gradient(circle at top left, rgba(212,168,83,.15), transparent 42%),
    rgba(255,255,255,0.04);
}
.auth-status {
  font-size: 12px;
  color: var(--tx-2);
  line-height: 1.45;
  margin-bottom: 10px;
}
.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r6);
  background: rgba(0,0,0,.24);
  border: 1px solid var(--bd);
  margin-bottom: 10px;
}
.auth-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,.08);
  flex-shrink: 0;
}
.auth-user-meta { min-width: 0; }
.auth-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-user-email {
  font-size: 12px;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.auth-logout {
  flex: 0 0 auto;
}

/* ── Segmented control ── */
.seg-group {
  display: flex;
  gap: 0;
  background: rgba(0,0,0,.28);
  border: 1px solid var(--bd);
  border-radius: var(--r6);
  padding: 3px;
}
.seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  border: none;
  border-radius: calc(var(--r6) - 2px);
  background: transparent;
  color: var(--tx-2);
  font-size: 12px;
  font-weight: 500;
  transition: background var(--fast), color var(--fast), box-shadow var(--fast);
}
.seg-btn:hover { color: var(--tx); background: var(--sur); }
.seg-btn.on {
  background: var(--sur-hi);
  color: var(--tx);
  box-shadow: var(--shadow-sm);
}
.seg-btn svg { flex-shrink: 0; }

/* ── Action buttons ── */
.mem-actions {
  display: flex;
  gap: 6px;
  margin: 16px 0 14px;
}
.act-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r6);
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), opacity var(--fast), transform var(--fast), box-shadow var(--fast);
  user-select: none;
}
.act-btn:active { transform: scale(.97); }
.act-btn:disabled { opacity: .35; pointer-events: none; }

.act-primary {
  background: var(--ac);
  color: #fff;
  border-color: var(--ac);
}
.act-primary:hover {
  background: var(--ac-hi);
  border-color: var(--ac-hi);
  box-shadow: 0 0 0 3px var(--ac-glow);
}

.act-ghost {
  background: var(--sur);
  color: var(--tx);
  border-color: var(--bd);
}
.act-ghost:hover { background: var(--sur-hi); border-color: var(--bd-hi); }

.act-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(239,68,68,.28);
}
.act-danger:hover { background: var(--red-lo); border-color: rgba(239,68,68,.45); }

/* ── Trace cards ── */
.trace-card {
  background: rgba(0,0,0,.22);
  border: 1px solid var(--bd);
  border-radius: var(--r6);
  overflow: hidden;
  margin-bottom: 8px;
}
.trace-card-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tx-3);
  border-bottom: 1px solid var(--bd);
  background: rgba(0,0,0,.12);
}
.trace-card-label svg { color: var(--ac); opacity: .7; }
.trace-pre {
  padding: 8px 10px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
  line-height: 1.6;
  color: var(--tx-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 130px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ── Drop zones ── */
.drop-zone {
  border: 1.5px dashed var(--bd-hi);
  border-radius: var(--r8);
  padding: 20px 16px 18px;
  text-align: center;
  margin-bottom: 10px;
  transition: border-color var(--mid), background var(--mid);
}
.drop-zone:hover { border-color: var(--ac); background: var(--ac-lo); }

.dz-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.dz-red   { background: rgba(239,68,68,.15);   color: #f87171; }
.dz-green { background: rgba(16,163,127,.15); color: #34d399; }

.dz-title { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.dz-sub   { font-size: 11.5px; color: var(--tx-2); margin-bottom: 12px; }
.dz-fname { font-size: 11.5px; color: var(--ac); margin-top: 8px; word-break: break-all; min-height: 16px; }
.dz-analyze { width: 100%; margin-top: 8px; }

.dz-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--bd-hi);
  background: transparent;
  color: var(--tx);
  font-size: 12.5px;
  font-weight: 500;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.dz-pick:hover {
  background: var(--sur);
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--ac-glow);
}

/* ── Toggle switch ── */
.sw-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  cursor: pointer;
  user-select: none;
}
.sw-wrap {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.sw-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-track {
  position: absolute;
  inset: 0;
  border-radius: var(--pill);
  background: rgba(255,255,255,.14);
  border: 1px solid var(--bd);
  transition: background var(--mid), border-color var(--mid), box-shadow var(--mid);
}
.sw-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: transform var(--mid);
}
.sw-wrap input:checked ~ .sw-track {
  background: var(--ac);
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--ac-glow);
}
.sw-wrap input:checked ~ .sw-track .sw-thumb { transform: translateX(16px); }
.sw-label { font-size: 13px; color: var(--tx-2); }

/* ── Sidebar footer ── */
.sb-footer {
  border-top: 1px solid var(--bd);
  padding: 10px 12px;
  flex-shrink: 0;
}
.agent-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r6);
  background: var(--sur);
  border: 1px solid var(--bd);
  font-size: 12px;
}
.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ac);
  box-shadow: 0 0 6px var(--ac);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}
.agent-model {
  margin-left: auto;
  font-size: 11px;
  color: var(--tx-3);
  font-weight: 500;
}

/* ════════════════════════════════════════
   MAIN
════════════════════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bd);
  background: var(--bg);
  flex-shrink: 0;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

/* ── Welcome ── */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 24px;
  gap: 32px;
  overflow-y: auto;
}

.w-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.w-glyph {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--ac);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1), 0 8px 24px rgba(0,0,0,.4);
  margin-bottom: 4px;
}
.w-heading {
  font-size: clamp(24px, 3.8vw, 34px);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.2;
}
.w-sub {
  font-size: 13.5px;
  color: var(--tx-2);
  letter-spacing: .01em;
}

/* ── Prompt grid ── */
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 580px;
}
.prompt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  background: var(--sur);
  border: 1px solid var(--bd);
  border-radius: var(--r8);
  color: var(--tx);
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.prompt-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.03) 0%, transparent 60%);
  pointer-events: none;
}
.prompt-card:hover {
  background: var(--sur-hi);
  border-color: var(--bd-hi);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.prompt-card:active { transform: translateY(0); box-shadow: none; }

.pc-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pc-emerald { background: rgba(16,163,127,.16); color: #34d399; }
.pc-blue    { background: rgba(59,130,246,.16);  color: #60a5fa; }
.pc-amber   { background: rgba(245,158,11,.16);  color: #fbbf24; }
.pc-violet  { background: rgba(139,92,246,.16);  color: #a78bfa; }

.pc-body { flex: 1; min-width: 0; }
.pc-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-desc  { font-size: 11.5px; color: var(--tx-2); line-height: 1.4; }
.pc-arrow {
  flex-shrink: 0;
  color: var(--tx-3);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--fast), transform var(--fast);
}
.prompt-card:hover .pc-arrow { opacity: 1; transform: translateX(0); }

/* ── Chat log ── */
.chatlog {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

/* message rows */
.msg-row {
  display: flex;
  padding: 4px 20px;
}
.msg-row.user { justify-content: flex-end; }
.msg-row.ai   { justify-content: flex-start; }

.msg-row.ai .msg-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 740px;
  width: 100%;
}
.msg-av {
  width: 28px;
  height: 28px;
  border-radius: var(--pill);
  background: var(--ac);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}
.msg-bbl {
  font-size: 14.5px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
  animation: msgIn .14s ease-out both;
}
.msg-row.user .msg-bbl {
  background: var(--sur-hi);
  border: 1px solid var(--bd);
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
  max-width: min(74%, 640px);
}
.msg-row.ai .msg-bbl { flex: 1; padding: 2px 0; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 6px 2px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tx-2);
  animation: dotBlink 1.3s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .18s; }
.typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes dotBlink {
  0%, 80%, 100% { opacity: .18; transform: translateY(0); }
  40%            { opacity: 1;   transform: translateY(-3px); }
}

/* ── Composer ── */
.composer-shell {
  padding: 10px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: var(--bg);
}
.composer-box {
  width: 100%;
  max-width: 740px;
  background: var(--sur);
  border: 1px solid var(--bd);
  border-radius: var(--r12);
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.composer-box:focus-within {
  border-color: var(--bd-hi);
  box-shadow: 0 0 0 3px rgba(255,255,255,.05);
}
#chatForm { display: flex; flex-direction: column; }

.composer-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--tx);
  font-size: 14.5px;
  line-height: 1.6;
  padding: 13px 16px 8px;
  resize: none;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.composer-input::placeholder { color: var(--tx-3); }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 8px;
  gap: 6px;
}
.composer-tools { display: flex; gap: 2px; }
.composer-right { display: flex; align-items: center; gap: 8px; }

.cmp-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: none;
  border-radius: var(--r4);
  background: transparent;
  color: var(--tx-2);
  font-size: 12.5px;
  font-weight: 450;
  transition: background var(--fast), color var(--fast);
}
.cmp-tool:hover { background: var(--sur-hi); color: var(--tx); }
.cmp-tool:active { background: var(--sur-press); }

.char-hint {
  font-size: 11px;
  color: var(--tx-3);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}
.char-hint.warn { color: var(--amber); }

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--pill);
  border: none;
  background: var(--ac);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--fast), opacity var(--fast), transform var(--fast), box-shadow var(--fast);
}
.send-btn:not(:disabled):hover {
  background: var(--ac-hi);
  transform: scale(1.06);
  box-shadow: 0 0 0 3px var(--ac-glow);
}
.send-btn:not(:disabled):active { transform: scale(.96); }
.send-btn:disabled {
  background: var(--sur-hi);
  color: var(--tx-3);
  cursor: not-allowed;
}

.composer-note {
  font-size: 11.5px;
  color: var(--tx-3);
  text-align: center;
}

/* ── Loading state ── */
body.loading .send-btn     { pointer-events: none; opacity: .45; }
body.loading .cmp-tool     { pointer-events: none; }
body.loading .composer-box { opacity: .7; }

/* ════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: var(--pill); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transform: translateX(0);
    transition: transform var(--slow);
    box-shadow: var(--shadow-md);
  }
  .sidebar.hidden {
    width: var(--sw);
    min-width: var(--sw);
    transform: translateX(calc(-1 * var(--sw)));
  }
  .prompt-grid { grid-template-columns: 1fr; max-width: 400px; }
  .mem-actions { flex-wrap: wrap; }
  .mem-actions .act-btn { flex: none; width: calc(50% - 3px); }
  .mem-actions .act-btn:last-child { width: 100%; }
}

@media (max-width: 560px) {
  .msg-row        { padding: 4px 12px; }
  .composer-shell { padding: 8px 10px 12px; }
  .welcome        { padding: 28px 14px 16px; }
  .w-heading      { font-size: 22px; }
}

/* ── Focus visible ── */
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }

/* ════════════════════════════════════════
   SPLASH SCREEN — Apple-Rolex Edition
═══════════════════════════════════════════ */
:root {
  --gold:       #d4a853;
  --gold-2:     #b8943f;
  --gold-light: #f0d68a;
  --splash-bg:  #000000;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--splash-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.6s cubic-bezier(.25,.1,.25,1), transform 0.6s cubic-bezier(.25,.1,.25,1), filter 0.6s cubic-bezier(.25,.1,.25,1);
}
.splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 15%, rgba(212,168,83,0.04) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 85%, rgba(240,214,138,0.03) 0%, transparent 45%);
  pointer-events: none;
}
.splash.exit {
  opacity: 0;
  transform: scale(1.03);
  filter: blur(4px);
  pointer-events: none;
}
.splash.gone { display: none; }

/* ── Inner content ── */
.splash-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  padding: 0 24px;
  max-width: 640px;
  width: 100%;
}

/* ── Eyebrow ── */
.splash-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeSlideUp 0.6s ease-out 0.3s forwards;
}
.splash-eyebrow-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}
.splash-eyebrow-text {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(212,168,83,0.5);
  font-family: 'Inter', ui-sans-serif, sans-serif;
}

/* ── Label "New Quantra Model" ── */
.splash-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(212,168,83,0.5);
  margin-bottom: 16px;
  min-height: 1.2em;
  line-height: 1.6;
}
.splash-label-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px);
  animation: charReveal 0.4s cubic-bezier(.25,.1,.25,1) forwards;
}
@keyframes charReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Main title ── */
.splash-headline-wrap {
  margin-bottom: 36px;
}
.splash-title {
  font-size: clamp(64px, 12vw, 112px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.9;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.16em;
  margin-bottom: 24px;
}
.splash-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(24px);
}
.splash-word-1 {
  color: #ffffff;
  animation: wordReveal 0.8s cubic-bezier(.25,.1,.25,1) 0.7s forwards;
}
.splash-word-2 {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: wordReveal 0.8s cubic-bezier(.25,.1,.25,1) 0.9s forwards;
}
@keyframes wordReveal {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Sub typewriter ── */
.splash-sub {
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.02em;
  line-height: 1.6;
  min-height: 24px;
  font-family: 'Inter', ui-sans-serif, sans-serif;
}
.splash-sub .cursor {
  display: inline-block;
  width: 1.5px;
  height: 1.1em;
  background: rgba(255,255,255,0.5);
  margin-left: 2px;
  vertical-align: middle;
  animation: cursorBlink 1s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── CTA ── */
.splash-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 34px;
  border: 1px solid rgba(212,168,83,0.3);
  border-radius: 9999px;
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  opacity: 0;
  animation: fadeSlideUp 0.7s ease-out 1.8s forwards;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
  margin-bottom: 32px;
}
.splash-cta:hover {
  border-color: var(--gold);
  background: rgba(212,168,83,0.06);
  transform: translateY(-1px);
}
.splash-cta:active {
  transform: translateY(0) scale(0.98);
}
.splash-cta-icon {
  display: flex;
  color: var(--gold);
  transition: transform 0.2s ease;
}
.splash-cta:hover .splash-cta-icon {
  transform: translateX(3px);
}

/* ── Capability badges ── */
.splash-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeSlideUp 0.6s ease-out 2.1s forwards;
}
.splash-badge {
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.3);
  padding: 5px 14px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9999px;
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}

/* ── Shared animation ── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive splash ── */
@media (max-width: 560px) {
  .splash-title { font-size: clamp(48px, 16vw, 72px); }
  .splash-eyebrow { margin-bottom: 24px; }
  .splash-headline-wrap { margin-bottom: 28px; }
  .splash-cta { padding: 12px 26px; font-size: 13px; }
  .splash-sub { font-size: 13px; }
  .splash-badge { font-size: 10px; }
}