/* ============ tokens ============ */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --ink: #1d1d24;
  --ink-2: #5d5d6e;
  --ink-3: #9a9aac;
  --line: #ececf0;
  --brand-1: #6a3ff5;
  --brand-2: #00c08b;
  --brand-3: #8b5cff;
  --grad: linear-gradient(120deg, var(--brand-1), var(--brand-3) 55%, var(--brand-2));
  --user-bubble: linear-gradient(135deg, #6a3ff5, #8b5cff);
  --ok: #12b886;
  --warn: #f59f00;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20,20,40,.04), 0 6px 20px rgba(20,20,40,.05);
  --shadow-lg: 0 18px 50px rgba(20,20,40,.12);
  --font: "Inter", system-ui, sans-serif;
  --font-display: "Sora", var(--font);
  --font-serif: "Newsreader", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: #fafafa;
  -webkit-font-smoothing: antialiased;
}
.app { height: 100dvh; display: flex; flex-direction: column; }

/* ============ topbar ============ */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; gap: 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; background: var(--grad);
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 16px;
  display: grid; place-items: center; box-shadow: 0 4px 12px rgba(106,63,245,.22); flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ok); background: rgba(18,184,134,.1); padding: 5px 10px; border-radius: 999px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(18,184,134,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(18,184,134,.5)} 70%{box-shadow:0 0 0 7px rgba(18,184,134,0)} 100%{box-shadow:0 0 0 0 rgba(18,184,134,0)} }

.btn-ghost { font: 500 13px var(--font); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; transition: .15s; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.btn-ghost:hover { color: var(--ink); border-color: #cdd1e8; }
.btn-ghost.small { padding: 6px 10px; font-size: 12px; }
.icon-btn { font-size: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; transition: .15s; }
.icon-btn[aria-pressed="true"] { background: rgba(106,63,245,.12); border-color: var(--brand-1); }

/* ============ layout ============ */
.layout { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 0 20px 16px; min-height: 0; max-width: 1440px; margin: 0 auto; width: 100%; }

/* Embed mode: chat-only, full-bleed for iframe on the homepage. */
.app.embed { height: 100dvh; }
.layout.solo { grid-template-columns: 1fr; gap: 0; padding: 0; max-width: none; }
.app.embed .chat-panel { border: none; border-radius: 0; box-shadow: none; }
.chat-panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 26px 8px; scroll-behavior: smooth; }

/* hero */
.hero { text-align: center; padding: 40px 24px 26px; animation: rise .5s ease; }
.hero-badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--brand-1); background: rgba(106,63,245,.08); border: 1px solid rgba(106,63,245,.18); padding: 6px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-family: var(--font-serif); font-weight: 400; font-size: 40px; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 14px; }
.grad-text { font-style: italic; color: var(--brand-1); -webkit-background-clip: initial; background-clip: initial; }
.hero p { color: var(--ink-2); max-width: 500px; margin: 0 auto 22px; line-height: 1.6; font-size: 15px; }
.hero-chips, .suggestions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.chip { font: 500 13.5px var(--font); background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 9px 15px; cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--brand-1); color: var(--brand-1); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(106,63,245,.16); }

/* messages */
.msg { display: flex; margin: 14px 0; animation: rise .25s ease; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 76%; padding: 12px 16px; border-radius: 16px; line-height: 1.55; font-size: 14.5px; }
.msg.assistant { flex-direction: column; align-items: flex-start; }
.msg.assistant .bubble { background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 5px; }
.msg.user .bubble { background: var(--user-bubble); color: #fff; border-top-right-radius: 5px; box-shadow: 0 8px 20px rgba(106,63,245,.28); }
.msg-tools { margin: 5px 0 0 2px; }
.msg-play { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); cursor: pointer; display: inline-grid; place-items: center; transition: .15s; }
.msg-play:hover { color: var(--brand-1); border-color: var(--brand-1); }
.msg-play.playing { color: var(--brand-1); border-color: var(--brand-1); background: rgba(106,63,245,.08); }
.msg-play .lucide { width: 15px; height: 15px; }
.err { color: #c92a2a; display: inline-flex; align-items: center; gap: 6px; }
.err .lucide { width: 16px; height: 16px; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 20px; } .bubble li { margin: 3px 0; }
.bubble strong { font-weight: 700; }
.bubble code { background: rgba(106,63,245,.1); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.typing { display: inline-flex; gap: 4px; padding: 3px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.3s infinite; }
.typing span:nth-child(2){animation-delay:.18s} .typing span:nth-child(3){animation-delay:.36s}
@keyframes blink { 0%,60%,100%{opacity:.3;transform:translateY(0)} 30%{opacity:1;transform:translateY(-3px)} }

/* capture / signup / callback cards */
.io-card { max-width: 88%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; border-top-left-radius: 5px; box-shadow: var(--shadow); overflow: hidden; }
.io-head { padding: 14px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.io-head h3 { margin: 0; font: 700 15px var(--font-display); }
.io-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.io-body { padding: 16px 18px; display: grid; gap: 10px; }
.io-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select { font: 500 14px var(--font); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); outline: none; transition: .15s; }
.field input:focus, .field select:focus { border-color: var(--brand-1); background: #fff; box-shadow: 0 0 0 3px rgba(106,63,245,.12); }
.btn-primary { font: 600 14px var(--font); color: #fff; background: var(--brand-1); border: none; border-radius: 11px; padding: 12px 16px; cursor: pointer; transition: .15s; box-shadow: 0 4px 12px rgba(106,63,245,.22); }
.btn-primary:hover { transform: translateY(-1px); background: #5b32e0; box-shadow: 0 8px 18px rgba(106,63,245,.3); }
.btn-primary:disabled { opacity: .6; cursor: default; transform: none; }
.io-note { font-size: 11.5px; color: var(--ink-3); text-align: center; }

.success-card { max-width: 88%; background: linear-gradient(135deg, #0f1c3f, #142a5c); color: #fff; border-radius: 16px; border-top-left-radius: 5px; padding: 20px; box-shadow: var(--shadow-lg); }
.success-card h3 { margin: 0 0 6px; font: 800 18px var(--font-display); }
.success-card .sc-sub { opacity: .8; font-size: 13px; margin-bottom: 14px; }
.cred { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; background: rgba(255,255,255,.08); border-radius: 9px; margin-bottom: 6px; font-size: 13px; }
.cred b { font-family: var(--font-display); }
.sc-cta { margin-top: 14px; }

/* composer */
.composer { padding: 12px 18px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.suggestions { margin-bottom: 10px; }
.input-row { display: flex; align-items: flex-end; gap: 8px; }
#chat-input { flex: 1; min-width: 0; resize: none; font: 500 15px var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; max-height: 140px; overflow-y: auto; outline: none; transition: .15s; }
#chat-input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-input:focus { border-color: var(--brand-1); background: #fff; box-shadow: 0 0 0 3px rgba(106,63,245,.1); }
.mic-btn, #send-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center; transition: .15s; }
.mic-btn { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.mic-btn:hover { color: var(--brand-1); border-color: var(--brand-1); }
.mic-btn.listening { background: #ffe3e3; color: #e03131; border-color: #ffc9c9; animation: pulse-mic 1.2s infinite; }
@keyframes pulse-mic { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }
#send-btn { background: var(--brand-1); color: #fff; box-shadow: 0 4px 12px rgba(106,63,245,.25); }
#send-btn:disabled { opacity: .5; }
.composer-foot { text-align: center; font-size: 11px; color: var(--ink-3); margin-top: 8px; }

/* rail */
.rail { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; }
.card-title { font: 700 12px var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.journey { display: flex; flex-direction: column; gap: 2px; }
.jstep { display: flex; align-items: center; gap: 11px; padding: 7px 0; position: relative; }
.jdot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 11px; color: var(--ink-3); flex: none; transition: .25s; z-index: 1; }
.jstep.done .jdot { background: var(--ok); border-color: var(--ok); color: #fff; }
.jstep.current .jdot { border-color: var(--brand-1); color: var(--brand-1); box-shadow: 0 0 0 4px rgba(106,63,245,.14); }
.jstep::before { content: ""; position: absolute; left: 10px; top: 22px; width: 2px; height: 18px; background: var(--line); }
.jstep:last-child::before { display: none; }
.jstep.done::before { background: var(--ok); }
.jlabel { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.jstep.current .jlabel, .jstep.done .jlabel { color: var(--ink); font-weight: 600; }

.status-body { display: flex; flex-direction: column; gap: 8px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.status-ico { font-size: 15px; }
.seg-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.seg-smb { background: rgba(0,192,139,.12); color: #0c8f6b; }
.seg-ent { background: rgba(106,63,245,.12); color: var(--brand-1); }
/* Social proof / stats card (fullscreen rail) */
.stats { display: flex; flex-direction: column; gap: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font: 800 22px var(--font-display); line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.stat-sub { color: var(--ink-3); }

.trust-card { background: var(--surface); }
.trust-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.trust-list li { font-size: 13px; color: var(--ink-2); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ lucide icons ============ */
.lucide { width: 16px; height: 16px; stroke-width: 2; vertical-align: middle; flex: none; }
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn-primary .lucide { width: 17px; height: 17px; }
.btn-ghost .lucide { width: 15px; height: 15px; }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .lucide { width: 16px; height: 16px; }
.mic-btn .lucide, #send-btn .lucide { width: 20px; height: 20px; }
.io-head h3, .success-card h3 { display: inline-flex; align-items: center; gap: 8px; }
.io-head h3 .lucide { width: 18px; height: 18px; color: var(--brand-1); }
.success-card h3 .lucide { width: 19px; height: 19px; }
.io-note { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.io-note .lucide { width: 13px; height: 13px; }
.status-ico { display: inline-flex; }
.status-ico .lucide { width: 15px; height: 15px; color: var(--brand-1); }
.jdot .lucide { width: 13px; height: 13px; }
.trust-list li { display: flex; align-items: center; gap: 9px; }
.trust-list .lucide { color: var(--brand-1); }

/* ============ mobile ============ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 0 10px 10px; gap: 10px; }
  /* Rail drops below the chat as full-width stacked cards (no horizontal scroll). */
  .rail { flex-direction: column; overflow: visible; gap: 10px; }
  .rail .card { min-width: 0; flex: none; }
  .trust-card { display: none; }
  .chat-panel { border-radius: 18px; }
  .hero { padding: 26px 16px 18px; }
  .hero h1 { font-size: 24px; }
  .bubble, .io-card, .success-card { max-width: 92%; }
  .brand-sub, .composer-foot { display: none; }
  .chat-scroll { padding: 16px 14px 8px; }

  /* "Your journey" becomes a compact horizontal stepper across the card width. */
  .journey { flex-direction: row; justify-content: space-between; gap: 4px; }
  .jstep { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; gap: 6px; padding: 2px 0; text-align: center; }
  .jstep::before { left: 50%; right: auto; top: 10px; width: 100%; height: 2px; }
  .jlabel { font-size: 10.5px; line-height: 1.25; text-align: center; }

  /* Status reads as compact inline chips instead of a tall stack. */
  .status-body { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
}
@media (max-width: 480px) {
  .io-row { grid-template-columns: 1fr; }
  .topbar { padding: 10px 12px; }
  .live-pill { display: none; }
  .jdot { width: 20px; height: 20px; }
  .jstep::before { top: 9px; }
  .jlabel { font-size: 10px; }
}
