/* Legit agent MVP — mobile-first chat UI.
   Layout: centered column, max-width ~480px, thumb-friendly composer. */

:root {
  --bg: #0b1020;
  --bg-soft: #111832;
  --panel: #151d3a;
  --ink: #eef1fb;
  --ink-dim: #a7b0cc;
  --agent: #1b2547;
  --agent-border: #2c3870;
  --user: #2456e0;
  --accent: #6ea8ff;
  --chip: #182144;
  --danger: #ff7a7a;
  --success: #57d98d;
  --radius: 16px;
  --maxw: 480px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: #060a16;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid #1a2340;
  border-right: 1px solid #1a2340;
}

/* ---------- header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-bottom: 1px solid #1d2750;
  flex: 0 0 auto;
}

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

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2456e0, #6ea8ff);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
}

.topbar h1 { font-size: 18px; margin: 0; letter-spacing: .2px; }
.tagline { margin: 0; font-size: 12px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tier-badge {
  font-size: 12px; font-weight: 600;
  background: #0e2f1c; color: var(--success);
  border: 1px solid #1f5c3a;
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}

/* ---- Legit Sessions ---- */
.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.book-btn {
  font-size: 13px; font-weight: 700;
  background: linear-gradient(135deg, #c9a227, #a88420);
  color: #0b1020; border: 0; border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(201, 162, 39, .35);
  white-space: nowrap;
}
.book-btn:active { transform: scale(.97); }
.tier-badge.paid { background: #2a2105; color: #e7c65a; border-color: #8a6d1f; }

.session-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 16px; flex: 0 0 auto;
  background: #101a3a; border-bottom: 1px solid #2a3a7a;
}
.session-banner[hidden] { display: none; }
.session-info { display: flex; align-items: baseline; gap: 10px; font-size: 13px; }
.session-info strong { color: #e7c65a; }
.session-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.session-msgs { color: var(--ink-dim); font-size: 12px; }
.session-actions { display: flex; gap: 8px; }
.session-btn {
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: #1d2750; color: var(--ink); border: 1px solid #2a3a7a;
  border-radius: 8px; padding: 7px 12px;
}
.session-btn.danger { background: #3a1420; border-color: #7a2438; color: #f0a8b8; }

.doc-panel {
  padding: 14px 16px; flex: 0 0 auto;
  background: var(--bg-soft); border-bottom: 1px solid #1d2750;
}
.doc-panel h3 { margin: 0 0 4px; font-size: 15px; }
.doc-panel .hint { margin: 0 0 10px; font-size: 12px; color: var(--ink-dim); }
.doc-panel label { display: block; font-size: 12px; color: var(--ink-dim); margin: 8px 0; }
.doc-panel input, .doc-panel select {
  display: block; width: 100%; margin-top: 4px;
  background: #0b1020; color: var(--ink);
  border: 1px solid #2a3a7a; border-radius: 8px; padding: 9px 10px; font-size: 14px;
}
.doc-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.doc-kinds button {
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: #c9a227; color: #0b1020; border: 0; border-radius: 8px; padding: 9px 12px;
}
.doc-kinds button:disabled { opacity: .5; cursor: wait; }

/* ---------- chat log ---------- */
.chat-wrap {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  min-height: 0;
  position: relative;
}

.chat {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.row { display: flex; }
.row.user { justify-content: flex-end; }
.row.agent { justify-content: flex-start; }

.bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: var(--radius);
  overflow-wrap: break-word;
  white-space: pre-wrap;
  font-size: 15.5px;
}

.row.agent .bubble {
  background: var(--agent);
  border: 1px solid var(--agent-border);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}

.row.user .bubble {
  background: var(--user);
  border-bottom-right-radius: 4px;
  color: #fff;
}

.bubble .name-result-title { font-weight: 700; margin-bottom: 4px; }
.bubble small, .fine-print { color: var(--ink-dim); font-size: 13px; }

/* disclaimer bubble (name results) */
.row.agent.disclaimer .bubble {
  background: #241a10;
  border: 1px dashed #8a6a2f;
  color: #f2d8a0;
  font-size: 13.5px;
}

/* nudge bubble */
.row.agent.nudge .bubble {
  background: #10231c;
  border: 1px solid #1f5c3a;
}

/* guided-check card */
.card {
  background: var(--panel);
  border: 1px solid var(--agent-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  max-width: 92%;
  font-size: 15px;
}
.card h3 { margin: 0 0 6px; font-size: 15.5px; }
.card p { margin: 6px 0; }
.card .official-link {
  display: inline-block;
  margin: 8px 0;
  padding: 10px 14px;
  background: #0e3a24;
  color: #c9f2d8;
  border: 1px solid #2a7a4d;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
}
.card .type-this {
  background: #0d1330;
  border: 1px solid #2c3870;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  margin: 6px 0;
  word-break: break-word;
}
.card .hint { color: var(--ink-dim); font-size: 13.5px; }

/* email capture card */
.email-form { display: flex; flex-direction: column; gap: 8px; }
.email-row { display: flex; gap: 8px; }
.email-row input {
  flex: 1 1 auto;
  font-size: 16px; /* ≥16px prevents iOS auto-zoom */
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid #2c3870;
  background: #0d1330;
  color: var(--ink);
}
.email-row button {
  font-size: 15px; font-weight: 700;
  padding: 11px 16px;
  border: 0; border-radius: 10px;
  background: var(--user); color: #fff;
  min-height: 46px;
}
.email-error { color: var(--danger); font-size: 13.5px; min-height: 18px; }

/* checkout summary card */
.summary-line { display: flex; justify-content: space-between; padding: 3px 0; }
.summary-line.total { font-weight: 800; border-top: 1px solid #2c3870; margin-top: 6px; padding-top: 8px; }
.policy {
  background: #0d1330;
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--ink-dim);
  border-radius: 0 8px 8px 0;
  margin: 10px 0;
}
.cta-btn {
  display: block; width: 100%;
  font-size: 16px; font-weight: 800;
  padding: 13px 16px;
  border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #2456e0, #4f7ef0);
  color: #fff;
  min-height: 50px;
}
.cta-btn:disabled { opacity: .55; }

/* typing indicator */
.typing {
  display: flex; gap: 5px;
  padding: 6px 18px 2px;
  align-items: center;
}
.typing .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-dim);
  animation: blink 1.2s infinite;
}
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- quick-reply chips ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 12px 10px;
  flex: 0 0 auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }

.chip {
  flex: 0 0 auto;
  font-size: 14px; font-weight: 600;
  padding: 9px 14px;
  min-height: 42px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--accent);
  border: 1px solid #33407f;
  cursor: pointer;
  white-space: nowrap;
}
.chip:active { transform: scale(.97); }
.chip.primary {
  background: #0e3a24;
  color: #c9f2d8;
  border-color: #2a7a4d;
}

/* ---------- composer ---------- */
.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-soft);
  border-top: 1px solid #1d2750;
}

.composer input {
  flex: 1 1 auto;
  font-size: 16px; /* ≥16px prevents iOS auto-zoom */
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid #2c3870;
  background: #0d1330;
  color: var(--ink);
  min-width: 0;
}
.composer input.listening {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 122, 122, .35);
}

.icon-btn {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid #2c3870;
  background: var(--agent);
  color: var(--ink-dim);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn.listening {
  background: #3a1218;
  border-color: var(--danger);
  color: var(--danger);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,122,122,.4); }
  50% { box-shadow: 0 0 0 8px rgba(255,122,122,0); }
}

.send-btn {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--user);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.send-btn:active { transform: scale(.95); }

/* interim transcript pill */
.interim {
  flex: 0 0 auto;
  padding: 4px 14px 0;
  font-size: 13px;
  font-style: italic;
  color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- optional Google sign-in (never required) ---------- */
.auth-row {
  flex: 0 0 auto;
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px;
  padding: 6px 12px 2px;
  background: #060a16;
}
.google-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid #232c55;
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  cursor: pointer;
}
.google-btn:active { transform: scale(.97); }
.google-btn:disabled { opacity: .65; cursor: default; }
.footer-note { font-size: 11px; color: #5d6684; }

/* ---------- footer ---------- */
.disclaimer-footer {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  column-gap: 8px; row-gap: 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  color: #6d7694;
  padding: 2px 12px calc(6px + env(safe-area-inset-bottom));
  background: #060a16;
}
.voice-note:not([hidden]) { display: inline; color: #8a6a2f; }

/* desktop: keep the phone-column look */
@media (min-width: 560px) {
  .bubble { font-size: 16px; }
}

/* ---------------- promo hero video ---------------- */
.hero-video {
  position: relative;
  max-width: 720px;
  margin: 12px auto 4px;
  padding: 0 16px;
}
.hero-video[hidden] { display: none; }

/* Mobile: app first — the promo video never takes first-paint space,
 * and the top bar stays one slim row on narrow screens. */
@media (max-width: 640px) {
  .hero-video { display: none; }
  .book-btn { font-size: 12px; padding: 7px 10px; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; }
  .topbar h1 { font-size: 17px; }
}
.hero-video video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #000;
  border: 1px solid #2a3a7a;
}
.hero-caption {
  margin: 8px 2px 4px;
  font-size: 13px;
  color: #9aa7d0;
  text-align: center;
}
.hero-dismiss {
  position: absolute;
  top: 6px; right: 22px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid #2a3a7a;
  background: rgba(11, 16, 32, .85);
  color: #9aa7d0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
