/* ═══════════════════════════════════════════════════════════════
   Invisalign Virtual Consultation — shared stylesheet (SPA)

   SECTIONS
   1. Base / reset            (global)
   2. App shell + view system (global)
   3. Progress bar            (global, shared across all views)
   4. View: Welcome           (#view-welcome …)
   (views 2–5 appended as they are migrated)
   ═══════════════════════════════════════════════════════════════ */

/* ─── 1. Base / reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Disable pull-to-refresh / overscroll reload (touchscreens, precision
   trackpads) — a swipe at the top must never reload mid-consultation. */
html, body { overscroll-behavior: none; }

h1, h2, h3, h4, h5, h6 { font-family: 'Plus Jakarta Sans', sans-serif; }

body {
  font-family: 'Inter', sans-serif;
  background: #eef1f8;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 1.5rem;
}

/* ─── 2. App shell + view system ──────────────────────────────── */
.app-container {
  max-width: 1400px;
  width: 100%;
  height: 715px;
  font-size: 0.875rem;
  background:
    radial-gradient(ellipse 100% 105% at 105% 95%, #ccdbfa 0%, #ccdbfa 20%, #f4f6fc 72%),
    #f4f6fc;
  border-radius: 1.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 40px rgba(0,0,0,0.08);
}

/* Each screen is a .view; only the active one is shown */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; flex-direction: column; }

/* ─── 3. Progress bar (shared, JS-driven) ─────────────────────── */
.progress-bar {
  background: transparent;
  border: none;
  margin: 0;
  padding: 1.75rem 3rem 2rem;
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  flex-shrink: 0;
}

/* Grey track */
.progress-bar::after {
  content: '';
  position: absolute;
  bottom: 0.25rem;
  left: 7%;
  right: 7%;
  height: 1px;
  background: #dde1ea;
  border-radius: 2px;
  z-index: 0;
}

/* Blue progress line — `right` is set per step by app.js */
.progress-underline {
  position: absolute;
  bottom: 0.25rem;
  left: 7%;
  right: 7%;
  height: 4px;
  background: #2563eb;
  border-radius: 2px;
  z-index: 1;
}

.progress-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex: 1;
}

.step-number {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 600;
  flex-shrink: 0;
}

.step-number.completed { background: #2563eb; color: #fff; }
.step-number.active    { background: #2563eb; color: #fff; }
.step-number.inactive  { background: #ebecef; color: #75809b; }

.step-label { font-size: 0.82rem; font-weight: 500; white-space: nowrap; }
.step-label.completed { color: #2563eb; font-weight: 600; }
.step-label.active    { color: #2563eb; font-weight: 600; }
.step-label.inactive  { color: #9ca3af; }

/* ═══════════════════════════════════════════════════════════════
   4. VIEW: WELCOME (Screen 1)
   ═══════════════════════════════════════════════════════════════ */
#view-welcome .main-content {
  display: flex;
  flex: 0 0 auto;
  padding: 2.5rem 3rem 1.75rem;
  gap: 2rem;
  margin-bottom: 1.25rem;
}

#view-welcome .left-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2.35rem;
}

#view-welcome .left-col .section-badge { margin-bottom: -1.25rem; }

#view-welcome .section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid #e2e6f0;
  border-radius: 2rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #374151;
  width: fit-content;
}

#view-welcome .badge-icon { font-size: 0.85rem; }

#view-welcome .hero-heading { line-height: 1.1; }

#view-welcome .hero-heading h1 {
  font-size: clamp(2rem, 3.5vw, 2.9rem);
  font-weight: 900;
  color: #0f172a;
  line-height: 1.15;
}

#view-welcome .hero-heading h1 .highlight { color: #2563eb; font-style: italic; }

#view-welcome .hero-subtext {
  font-size: calc(0.95rem - 1px);
  color: #6b7280;
  line-height: 1.6;
  margin-top: 0.75rem;
  max-width: 45rem;
  padding: 0.4rem 5.5rem 0.4rem 0;
}

#view-welcome .feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 2rem;
}

#view-welcome .feature-item { display: flex; align-items: flex-start; gap: 0.75rem; }

#view-welcome .feature-icon-wrap {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.6rem;
  background: #eff3ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

#view-welcome .feature-icon-wrap.blue-solid { background: #2563eb; color: #fff; }

#view-welcome .feature-text h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.2rem;
}

#view-welcome .feature-text p {
  font-size: 0.77rem;
  color: #6b7280;
  line-height: 1.5;
  max-width: 35ch;
}

#view-welcome .right-col {
  flex: 0 0 42%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#view-welcome .before-after-panel { position: relative; margin-top: 0.75rem; }

#view-welcome .diamond-note { font-size: 0.82rem; }

#view-welcome .ba-badge {
  position: absolute;
  top: -0.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.97);
  border-radius: 2rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #2563eb;
  z-index: 10;
  border: 1px solid #dde5f5;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  white-space: nowrap;
}

#view-welcome .bottom-bar {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-top: none;
  backdrop-filter: blur(8px);
  margin: 0 1.5rem 1.5rem;
  border-radius: 1rem;
  padding: 1.25rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
}

#view-welcome .bottom-cta-text { flex: 0 0 auto; max-width: 16rem; }
#view-welcome .bottom-cta-text h3 {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.3rem;
}
#view-welcome .bottom-cta-text p { font-size: 0.78rem; color: #6b7280; line-height: 1.5; }

#view-welcome .bottom-fields { display: contents; }

#view-welcome .field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-self: stretch;
}
#view-welcome .field-group label { font-size: 0.78rem; font-weight: 600; color: #0f172a; }

#view-welcome .text-input {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1.5px solid #d1d5db;
  border-radius: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  font-size: 0.85rem;
  color: #9ca3af;
  cursor: text;
  flex: 1;
}
#view-welcome .text-input svg { flex-shrink: 0; opacity: 0.45; }
#view-welcome .text-input:focus-within { border-color: #2563eb; }
#view-welcome .text-input input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  min-width: 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #374151;
}
#view-welcome .text-input input::placeholder { color: #9ca3af; }
/* Kill the browser autofill highlight (the blue/yellow bar) — keep the field white. */
#view-welcome .text-input input:-webkit-autofill,
#view-welcome .text-input input:-webkit-autofill:hover,
#view-welcome .text-input input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: #374151;
  caret-color: #374151;
  transition: background-color 9999s ease 0s;
}

#view-welcome .upload-input {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1.5px dashed #d1d5db;
  border-radius: 0.6rem;
  /* reduced vertical padding compensates for the gap added between the two
     text lines below, so the container height is unchanged */
  padding: 0.45rem 0.85rem;
  background: #fafbff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
#view-welcome .upload-icon-wrap { color: #6b7280; font-size: 1.1rem; flex-shrink: 0; }
#view-welcome .upload-text { font-size: 0.8rem; color: #374151; line-height: 1.4; text-align: left; }
#view-welcome .upload-text strong { color: #2563eb; }
#view-welcome .upload-text .upload-hint { display: block; font-size: 0.7rem; color: #9ca3af; margin-top: 0.4rem; }

/* ── Interactive wiring states (capture + validation + loading) ── */
#view-welcome .upload-input.dragover { border-color: #2563eb; background: #eef3ff; }
#view-welcome .upload-input.has-file { border-style: solid; border-color: #93b4fb; background: #f3f7ff; }
/* Once a file is chosen its name replaces "Take a Photo" — show it small + normal
   weight (not the bold title style) and truncate to ONE line with "…" so a long
   filename can never grow the box height. */
#view-welcome .upload-input.has-file .upload-text { min-width: 0; }
#view-welcome .upload-input.has-file .upload-text > span:first-child {
  display: block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#view-welcome .upload-input.has-file .upload-text strong { font-weight: 400; font-size: 0.7rem; }
#view-welcome .upload-input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
#view-welcome .input-error,
#view-welcome .text-input.input-error { border-color: #ef4444 !important; }
#view-welcome .upload-input.input-error { border-color: #ef4444 !important; background: #fef2f2; }
/* Out of flow: an empty error must not change the bar height (it was
   stretching the name field + pushing the button below the security note). */
#view-welcome .form-error {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  text-align: center;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 500;
}
#view-welcome .start-btn:disabled,
#view-welcome .start-btn.is-loading { background: #93b4fb; cursor: progress; }

#view-welcome .start-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.75rem;
  padding: 0.85rem 2.5rem;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
  height: fit-content;
  align-self: flex-end;
}
#view-welcome .start-btn:hover { background: #1d4ed8; }
#view-welcome .start-btn .arrow-circle {
  width: 1.8rem;
  height: 1.8rem;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
#view-welcome .start-btn-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  align-self: flex-end;
}
#view-welcome .security-note {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: #9ca3af;
}

/* ═══════════════════════════════════════════════════════════════
   SHARED: Consultant profile + chat interface
   (used by the Introduction and Consultation views)
   ═══════════════════════════════════════════════════════════════ */
.consultant-profile {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  margin-top: 0.3rem;
  padding: 0.5rem 0 1.25rem;
}
.profile-text { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-img {
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 3px solid #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  display: block;
}
.waveform {
  position: absolute;
  bottom: -0.6rem;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  display: flex;
  align-items: center;
  gap: 2px;
  height: 2.6rem;            /* FIXED — bars grow inside, the pill never resizes */
  box-sizing: border-box;
  padding: 0.3rem 0.6rem;
  background: rgba(255,255,255,0.92);
  border-radius: 1rem;
  box-shadow: 0 3px 10px rgba(37,99,235,0.18);
}
.waveform .bar { width: 3px; border-radius: 2px; background: linear-gradient(to bottom, #93c5fd, #2563eb); }
.consultant-name { font-size: 1.6rem; font-weight: 800; color: #0f172a; line-height: 1.05; }
.clinic-name { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.9rem; font-weight: 700; color: #2563eb; margin-top: 0.45rem; }
.consultant-title { font-size: 0.72rem; color: #6b7280; margin-top: 0.4rem; }

.listening-status { background: #fff; border: 1.5px solid #d1fae5; border-radius: 0.75rem; padding: 0.75rem 1rem; display: flex; align-items: flex-start; gap: 0.6rem; }
.listening-icon { color: #16a34a; font-size: 1rem; margin-top: 0.1rem; flex-shrink: 0; }
.listening-text { font-size: 0.82rem; font-weight: 600; color: #16a34a; }
.listening-sub { font-size: 0.75rem; color: #6b7280; margin-top: 0.15rem; }

/* Chat interface */
.center-col { flex: 1; background: #fff; border-radius: 1.25rem; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 1px 8px rgba(0,0,0,0.06); }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f3f8; flex-shrink: 0; }
.chat-header-left { display: flex; align-items: center; gap: 0.6rem; }
.chat-header-left h2 { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
#view-introduction .chat-header-left h2 { font-size: calc(1.05rem - 0.5px); }
#view-consultation .chat-header-left h2 { font-size: calc(1.05rem - 0.5px); }
.chat-header-right { display: flex; align-items: center; gap: 1rem; }
.question-counter { font-size: 0.78rem; color: #6b7280; white-space: nowrap; }
.question-dots { display: flex; align-items: center; gap: 0; }
.q-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #e2e6f0; flex-shrink: 0; }
.q-dot.filled { background: #2563eb; }
.q-line { width: 1.5rem; height: 2px; background: #e2e6f0; flex-shrink: 0; }
.q-line.filled { background: #2563eb; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.message { display: flex; align-items: flex-start; gap: 0.65rem; }
.message.user-message { flex-direction: row-reverse; }
.msg-avatar { width: 2rem; height: 2rem; border-radius: 50%; background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: #fff; font-family: 'Plus Jakarta Sans', sans-serif; }
.msg-body { display: flex; flex-direction: column; gap: 0.3rem; max-width: 70%; }
.user-message .msg-body { align-items: flex-end; }
.msg-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: #9ca3af; }
.msg-meta .sender { font-weight: 600; color: #374151; }
.bubble { padding: 0.65rem 0.9rem; border-radius: 0.85rem; font-size: calc(0.82rem + 1.5px); line-height: 1.55; }
.bubble-blue { background: #eff4ff; color: #1e3a8a; border-radius: 0.2rem 0.85rem 0.85rem 0.85rem; }
.bubble-grey { background: #f3f4f6; color: #374151; border-radius: 0.2rem 0.85rem 0.85rem 0.85rem; }
.bubble-user { background: #f3f4f6; color: #374151; border-radius: 0.85rem 0.2rem 0.85rem 0.85rem; }
.listening-row { display: flex; align-items: center; gap: 0.65rem; padding: 0.25rem 0; }
.typing-dots { display: flex; align-items: center; gap: 0.25rem; background: #f3f4f6; padding: 0.5rem 0.75rem; border-radius: 1rem; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; display: block; animation: bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
.listening-label { font-size: 0.75rem; color: #9ca3af; }

/* Chat input bar */
.chat-input-bar { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.75rem; border: 1px solid rgba(255,255,255,0.9); background: rgba(255,255,255,0.6); backdrop-filter: blur(8px); border-radius: 0.85rem; margin: 0 0 1.5rem; flex-shrink: 0; }
.mode-toggles { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; flex-shrink: 0; }
.mode-btns-row { display: flex; background: #e4eaf5; border-radius: 2rem; padding: 0.2rem; gap: 0; }
.mode-btn { display: flex; align-items: center; gap: 0.35rem; padding: 0.55rem 1.1rem; border-radius: 2rem; border: none; background: transparent; font-size: 0.95rem; font-weight: 500; color: #8a96b0; cursor: pointer; white-space: nowrap; transition: all 0.15s ease; }
.mode-btn.active { background: #eef2ff; color: #2563eb; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.mode-hint { font-size: 0.65rem; color: #9ca3af; align-self: flex-end; padding-right: 0.5rem; }
.mic-section { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; margin-left: 1.5rem; }
.mic-btn-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.pulse-ring { position: absolute; width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 2px dashed #60A5FA; animation: pulse-ring 1.5s ease-in-out infinite; opacity: 0.6; }
@keyframes pulse-ring { 0% { transform: scale(0.95); opacity: 0.7; } 50% { transform: scale(1.05); opacity: 0.4; } 100% { transform: scale(0.95); opacity: 0.7; } }
.mic-btn { width: 2.75rem; height: 2.75rem; border-radius: 50%; background: #3B82F6; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff; position: relative; z-index: 1; transition: background 0.2s ease; }
.mic-btn.muted { background: #9ca3af; }
.mic-btn.muted + .mic-info strong::after { content: ' (muted)'; color: #9ca3af; font-weight: 400; }
.mic-btn.muted ~ .pulse-ring { display: none; }
.mic-info { display: flex; flex-direction: column; }
.mic-info strong { font-size: 0.8rem; color: #111827; }
.mic-info span { font-size: 0.7rem; color: #9ca3af; }
.voice-waveform { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.voice-waveform .vbar { width: 3px; border-radius: 2px; background: #60A5FA; animation: wave 0.8s ease-in-out infinite alternate; }
.voice-waveform .vbar:nth-child(1) { height: 8px; animation-delay: 0s; }
.voice-waveform .vbar:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.voice-waveform .vbar:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.voice-waveform .vbar:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.voice-waveform .vbar:nth-child(5) { height: 22px; animation-delay: 0.15s; }
.voice-waveform .vbar:nth-child(6) { height: 12px; animation-delay: 0.25s; }
.voice-waveform .vbar:nth-child(7) { height: 18px; animation-delay: 0.05s; }
.voice-waveform .vbar:nth-child(8) { height: 10px; animation-delay: 0.35s; }
@keyframes wave { from { transform: scaleY(0.5); } to { transform: scaleY(1); } }
.or-text { font-size: 0.78rem; color: #9ca3af; flex-shrink: 0; }
.text-answer-input { flex: 0 1 22rem; border: 1.5px solid #e2e6f0; border-radius: 0.6rem; padding: 0.6rem 0.85rem; font-size: 0.82rem; color: #374151; background: #fff; font-family: 'Inter', sans-serif; outline: none; resize: none; line-height: 1.5; }
.text-answer-input::placeholder { color: #9ca3af; }
.send-btn { width: 2.4rem; height: 2.4rem; border-radius: 50%; background: #2563eb; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; color: #fff; }
/* mobile-only control-panel labels (shown via the screen-2 mobile redesign) */
.cp-listening, .cp-type-hint, .cp-send-label { display: none; }
.columns-row { display: flex; flex: 1; gap: 1.25rem; min-height: 0; }

/* ═══════════════════════════════════════════════════════════════
   VIEW: INTRODUCTION (Screen 2)
   ═══════════════════════════════════════════════════════════════ */
#view-introduction .main-content {
  display: flex;
  flex: 1;
  padding: 1.25rem 1.75rem 0;
  gap: 1.25rem;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}
#view-introduction .left-col {
  flex: 0 0 28%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.56rem;
}
#view-introduction .section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid #e2e6f0;
  border-radius: 2rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #374151;
  width: fit-content;
  position: relative;
  top: -0.3rem;
}
#view-introduction .right-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  padding-left: 0.75rem;
}
#view-introduction .agenda-card {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
#view-introduction .agenda-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: calc(0.88rem + 2.5px);
  font-weight: 700;
  color: #111827;
  padding: 0.1rem 0;
}
#view-introduction .agenda-list { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
#view-introduction .agenda-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: calc(0.75rem + 1px);
  color: #4b5563;
  padding: 0.1rem 0;
}
#view-introduction .agenda-icon { flex-shrink: 0; color: #2563eb; }
#view-introduction .time-remaining {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: calc(0.78rem + 1px);
  font-weight: 600;
  color: #16a34a;
  margin-top: 0.25rem;
  padding: 0.1rem 0;
}

/* ═══════════════════════════════════════════════════════════════
   VIEW: HOW IT WORKS (Screen 3)
   ═══════════════════════════════════════════════════════════════ */
#view-how-it-works .main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 2rem 2rem 0;
  gap: 1.1rem;
  min-height: 0;
}
#view-how-it-works .content-row { display: flex; flex: 1; gap: 2rem; min-height: 0; }

/* Video player */
#view-how-it-works .video-col { flex: 1; min-height: 0; }
#view-how-it-works .video-player {
  width: 100%;
  height: 100%;
  border-radius: 1.25rem;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #b8cfe8 0%, #8fb5d4 30%, #a8c8e8 60%, #c8dff0 100%);
  display: flex;
  flex-direction: column;
}
#view-how-it-works .video-content { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; }
#view-how-it-works .video-branding { position: absolute; bottom: 2rem; left: 2rem; display: flex; flex-direction: column; gap: 0.4rem; }
#view-how-it-works .invisalign-logo { display: flex; align-items: center; gap: 0.5rem; }
#view-how-it-works .invisalign-logo-mark { width: 2.2rem; height: 2.2rem; }
#view-how-it-works .invisalign-wordmark { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.3rem; font-weight: 700; color: #1e3a5f; letter-spacing: -0.02em; }
#view-how-it-works .invisalign-wordmark span { font-size: 0.6em; vertical-align: super; }
#view-how-it-works .video-tagline { font-size: 0.82rem; color: #2d5a8a; font-style: italic; }
#view-how-it-works .play-btn { width: 4rem; height: 4rem; border-radius: 50%; background: rgba(30, 40, 60, 0.75); display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(4px); border: none; }
#view-how-it-works .video-controls { background: rgba(15, 25, 40, 0.85); padding: 0.6rem 1rem; display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
#view-how-it-works .ctrl-btn { background: none; border: none; color: #fff; cursor: pointer; display: flex; align-items: center; flex-shrink: 0; }
#view-how-it-works .time-display { font-size: 0.75rem; color: #d1d5db; white-space: nowrap; flex-shrink: 0; }
#view-how-it-works .video-progress { flex: 1; height: 4px; background: rgba(255,255,255,0.25); border-radius: 2px; position: relative; cursor: pointer; }
#view-how-it-works .video-progress-fill { width: 37.5%; height: 100%; background: #2563eb; border-radius: 2px; position: relative; }
#view-how-it-works .video-progress-fill::after { content: ''; position: absolute; right: -5px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border-radius: 50%; background: #fff; }
#view-how-it-works .volume-control { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
#view-how-it-works .volume-bar { width: 3.5rem; height: 3px; background: rgba(255,255,255,0.25); border-radius: 2px; }
#view-how-it-works .volume-bar-fill { width: 60%; height: 100%; background: #2563eb; border-radius: 2px; }

/* Real video — fills the player; first frame acts as the poster behind the
   branding + play button until the user taps to play (with sound). */
#view-how-it-works .how-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; z-index: 0; }
#view-how-it-works .video-branding { z-index: 2; }
#view-how-it-works .play-btn { z-index: 3; transition: opacity 0.25s ease, transform 0.15s ease; }
#view-how-it-works .play-btn:hover { transform: scale(1.06); }
/* Once playing, hide the play overlay; once started, hide the pre-roll branding. */
#view-how-it-works .video-player.playing .play-btn { opacity: 0; pointer-events: none; }
#view-how-it-works .video-player.started .video-branding { opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }

/* Key takeaways */
#view-how-it-works .takeaways-col {
  flex: 0 0 33%;
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}
#view-how-it-works .takeaways-header { display: flex; flex-direction: column; gap: 0.2rem; flex-shrink: 0; }
#view-how-it-works .takeaways-title-row { display: flex; align-items: center; gap: 0.5rem; }
#view-how-it-works .takeaways-title-row h3 { font-size: 1rem; font-weight: 700; color: #0f172a; }
#view-how-it-works .takeaways-subtitle { font-size: 0.75rem; color: #6b7280; padding-left: 0.1rem; }
#view-how-it-works .takeaways-divider { height: 1px; background: #f1f3f8; flex-shrink: 0; }
#view-how-it-works .takeaways-list { display: flex; flex-direction: column; gap: 0; flex: 1; overflow-y: auto; }
#view-how-it-works .takeaway-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.62rem 0; position: relative; border-bottom: 1px solid #f1f3f8; }
#view-how-it-works .takeaway-item:last-child { border-bottom: none; }
#view-how-it-works .takeaway-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #2563eb; flex-shrink: 0; margin-top: 0.35rem; }
#view-how-it-works .takeaway-icon { width: 2.2rem; height: 2.2rem; border-radius: 0.5rem; background: #eff4ff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #2563eb; }
#view-how-it-works .takeaway-body { flex: 1; min-width: 0; }
#view-how-it-works .takeaway-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
#view-how-it-works .takeaway-body h4 { font-size: 0.82rem; font-weight: 700; color: #111827; line-height: 1.3; }
#view-how-it-works .takeaway-timestamp { font-size: 0.72rem; font-weight: 600; color: #2563eb; flex-shrink: 0; margin-top: 0.05rem; }
#view-how-it-works .takeaway-body p { font-size: 0.72rem; color: #6b7280; line-height: 1.45; margin-top: 0.2rem; }
#view-how-it-works .takeaways-footer { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: #2563eb; font-weight: 500; flex-shrink: 0; padding-top: 0.25rem; }
/* Progressive reveal — each takeaway starts hidden and fades in ~0.4s after its
   point lands in the narration (driven by screen3.js on `timeupdate`). They keep
   their layout space so the column doesn't jump as cards appear. */
#view-how-it-works .takeaway-item { opacity: 0; transform: translateY(0.5rem); transition: opacity 0.5s ease, transform 0.5s ease; }
#view-how-it-works .takeaway-item.revealed { opacity: 1; transform: none; }

/* "Smile Simulation Coming Up" teaser — a status row (not a key point), with a
   blue spinner in place of the icon and a subtle highlighted tint. */
#view-how-it-works .takeaway-upcoming .takeaway-icon-loading { background: #eaf1ff; }
#view-how-it-works .takeaway-upcoming .takeaway-spinner {
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 2px solid #c7dbff; border-top-color: #2563eb;
  animation: takeawaySpin 0.8s linear infinite;
}
#view-how-it-works .takeaway-upcoming h4 { color: #2563eb; }
@keyframes takeawaySpin { to { transform: rotate(360deg); } }

/* Bottom bar */
#view-how-it-works .bottom-bar {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  margin: 1.25rem 1.5rem 1.5rem;
  border-radius: 1rem;
  padding: 1.1rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-shrink: 0;
}
#view-how-it-works .ben-return { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
#view-how-it-works .ben-thumb { width: 3.5rem; height: 3.5rem; border-radius: 50%; object-fit: cover; object-position: center top; flex-shrink: 0; }
#view-how-it-works .ben-return-text strong { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.85rem; font-weight: 700; color: #2563eb; display: block; margin-bottom: 0.15rem; }
#view-how-it-works .ben-return-text p { font-size: 0.72rem; color: #6b7280; }
#view-how-it-works .bottom-divider { width: 1px; height: 2.5rem; background: #e2e6f0; flex-shrink: 0; }
#view-how-it-works .next-steps { display: flex; flex: 1; gap: 1.5rem; }
#view-how-it-works .next-step { display: flex; align-items: flex-start; gap: 0.6rem; flex: 1; }
#view-how-it-works .next-step-check { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #2563eb; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 0.05rem; }
#view-how-it-works .next-step-text h4 { font-size: 0.78rem; font-weight: 700; color: #111827; line-height: 1.3; margin-bottom: 0.2rem; }
#view-how-it-works .next-step-text p { font-size: 0.7rem; color: #6b7280; line-height: 1.4; }

/* ═══════════════════════════════════════════════════════════════
   VIEW: CONSULTATION (Screen 4)
   (chat + profile come from the shared section above)
   ═══════════════════════════════════════════════════════════════ */
#view-consultation .main-content {
  display: flex;
  flex: 1;
  padding: 1.25rem 1.75rem 0;
  gap: 0.75rem;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}
#view-consultation .left-col {
  flex: 0 0 32%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  /* Matches the breathing room below the chat input bar on the right, so the
     filled smile-sim card bottom lines up flush with the input bar. */
  padding-bottom: 1.5rem;
  margin-top: -0.2rem;
}
#view-consultation .right-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
  padding-left: 0.9rem;
}

/* Smile simulation card */
#view-consultation .simulation-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #fff;
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 1px 8px rgba(0,0,0,0.03);
  margin-top: 0.7rem;
}
#view-consultation .simulation-header { display: flex; align-items: center; gap: 0.4rem; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.88rem; font-weight: 700; color: #111827; }
#view-consultation .simulation-panel { position: relative; border-radius: 0.85rem; overflow: hidden; cursor: ew-resize; --sim-pos: 50%; user-select: none; touch-action: none; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 45%, #3b82f6 100%); }
/* Both layers fill the panel; the panel's own aspect-ratio holds the box open
   even before any image loads, so the blue gradient shows through as a placeholder. */
#view-consultation .simulation-panel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0.85rem; }
#view-consultation .simulation-panel img.is-empty { display: none; }
/* BEFORE (patient photo) overlays the AFTER (sim), clipped to the divider position.
   Targets the shared class so both the inline (#sim-before) and lightbox
   (#sim-before-lg) overlays clip — otherwise the lightbox before would cover the after. */
#view-consultation .sim-before-clip { clip-path: inset(0 calc(100% - var(--sim-pos)) 0 0); }
#view-consultation .sim-divider-line { position: absolute; top: 0; bottom: 0; left: var(--sim-pos); width: 2px; margin-left: -1px; background: rgba(255,255,255,0.92); box-shadow: 0 0 4px rgba(0,0,0,0.3); z-index: 3; pointer-events: none; }
#view-consultation .sim-label { position: absolute; bottom: 0.6rem; z-index: 3; background: rgba(255,255,255,0.92); border-radius: 0.4rem; padding: 0.2rem 0.55rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; color: #111827; }
#view-consultation .sim-label.before { left: 0.6rem; }
#view-consultation .sim-label.after { right: 0.6rem; background: #2563eb; color: #fff; }
#view-consultation .sim-divider-btn { position: absolute; top: 50%; left: var(--sim-pos); transform: translate(-50%, -50%); z-index: 4; width: 2rem; height: 2rem; background: rgba(255,255,255,0.95); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.15); border: none; cursor: ew-resize; color: #2563eb; font-size: 0.75rem; }
#view-consultation .sim-enlarge { width: 100%; background: none; border: none; font-family: inherit; font-size: 0.72rem; color: #6b7280; display: flex; align-items: center; justify-content: center; gap: 0.3rem; cursor: pointer; padding: 0.15rem; transition: color 0.15s ease; }
#view-consultation .sim-enlarge:hover { color: #2563eb; }
#view-consultation .sim-enlarge svg { color: #2563eb; flex-shrink: 0; }

/* Smile-sim lightbox (enlarged before/after) */
.sim-lightbox[hidden] { display: none; }
.sim-lightbox { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.sim-lightbox-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.62); backdrop-filter: blur(3px); }
.sim-lightbox-body { position: relative; width: auto; }
.sim-lightbox-close { position: absolute; top: -2.6rem; right: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: none; background: rgba(255,255,255,0.92); color: #111827; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.sim-lightbox-close:hover { background: #fff; }
/* Width + height set by JS (openLightbox) to fit the viewport while matching the
   inline card's current ratio. */
#view-consultation .sim-lightbox #sim-lightbox-panel { box-shadow: 0 20px 60px rgba(0,0,0,0.45); }
#view-consultation .sim-lightbox .sim-label { font-size: 0.8rem; padding: 0.3rem 0.7rem; bottom: 0.9rem; }
#view-consultation .sim-lightbox .sim-label.before { left: 0.9rem; }
#view-consultation .sim-lightbox .sim-label.after { right: 0.9rem; }
#view-consultation .sim-lightbox .sim-divider-btn { width: 2.5rem; height: 2.5rem; }
@media (max-width: 640px) { .sim-lightbox-close { top: -2.8rem; } }

/* ═══════════════════════════════════════════════════════════════
   VIEW: SUMMARY (Screen 5)
   ═══════════════════════════════════════════════════════════════ */
#view-summary .main-content { display: flex; flex: 1; padding: 1.7rem 1.75rem 1.5rem; gap: 1.25rem; min-height: 0; }
#view-summary .card { background: #fff; border-radius: 1.5rem; box-shadow: 0 1px 10px rgba(0,0,0,0.05); display: flex; flex-direction: column; min-height: 0; }
#view-summary .summary-left  { flex: 1.55; padding: 1.5rem 1.6rem; gap: 1rem; }
#view-summary .summary-right { flex: 1; padding: 1.5rem 1.6rem; gap: 1.4rem; }

/* Left card header */
#view-summary .summary-header { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
#view-summary .summary-avatar { width: 3.6rem; height: 3.6rem; border-radius: 50%; object-fit: cover; object-position: center top; border: 2px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.12); flex-shrink: 0; }
#view-summary .summary-title h1 { font-size: 1.65rem; font-weight: 800; color: #0f172a; line-height: 1.1; }
#view-summary .summary-title p { font-size: 0.82rem; color: #6b7280; margin-top: 0.2rem; }
#view-summary .date-pill { margin-left: auto; display: flex; align-items: center; gap: 0.55rem; border: 1px solid #e2e6f0; border-radius: 0.8rem; padding: 0.5rem 0.85rem; flex-shrink: 0; }
#view-summary .date-pill .ico { color: #2563eb; flex-shrink: 0; }
#view-summary .date-pill .dp-label { font-size: 0.68rem; color: #6b7280; }
#view-summary .date-pill .dp-value { font-size: 0.82rem; font-weight: 700; color: #0f172a; }

/* Bordered group + cells */
#view-summary .sum-row { display: flex; border: 1px solid #eef1f6; border-radius: 1rem; overflow: hidden; }
#view-summary .sum-cell { padding: 1rem 1.1rem; min-width: 0; }
#view-summary .sum-cell + .sum-cell { border-left: 1px solid #eef1f6; }
/* Center the fixed-height sim vertically so its top/bottom gaps match (the
   findings column next to it is taller and sets the row height). */
#view-summary .cell-wide { flex: 1; display: flex; flex-direction: column; justify-content: center; }
#view-summary .cell-narrow { flex: 1; display: flex; flex-direction: column; }
/* Fill the column height (matches the taller sim cell) and space the 3 findings evenly. */
#view-summary .findings-list { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; gap: 15px; }
#view-summary .sum-row-col { flex-direction: column; }
/* No negative bottom margin: it pulled the investment section up over the row,
   leaving the vertical cell divider poking past the horizontal one. */
#view-summary .sum-toprow { display: flex; }
#view-summary .sum-invest { border-top: 1px solid #eef1f6; }

/* Section heads */
#view-summary .sec-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem; }
#view-summary .sec-head h3 { font-size: 0.92rem; font-weight: 700; color: #0f172a; }
#view-summary .sec-head h3.sm { font-size: calc(0.92rem - 1px); }
#view-summary .sec-ico { flex-shrink: 0; color: #2563eb; display: inline-flex; }
#view-summary .sec-ico-badge { width: 1.6rem; height: 1.6rem; border-radius: 0.5rem; background: #eff4ff; color: #2563eb; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
/* Slightly larger glyphs for the Key Findings heading + the three findings only
   (scoped to the findings column, so the Investment Snapshot icon is untouched). */
#view-summary .cell-narrow .sec-ico-badge svg { width: 16px; height: 16px; }

/* Smile sim — layered before/after with a blue-gradient default (mirrors Screen 4) */
/* Fixed 173px tall, centered in the cell (the Key Findings column sets the
   row height). Width fills the cell, images cover (object-fit). */
#view-summary .sim-panel { position: relative; border-radius: 0.85rem; overflow: hidden; cursor: ew-resize; --sim-pos: 50%; user-select: none; touch-action: none; height: 173px; background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 45%, #3b82f6 100%); }
#view-summary .sim-panel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0.85rem; }
#view-summary .sim-panel img.is-empty { display: none; }
#view-summary .sim-before-clip { clip-path: inset(0 calc(100% - var(--sim-pos)) 0 0); }
#view-summary .sim-divider-line { position: absolute; top: 0; bottom: 0; left: var(--sim-pos); width: 2px; margin-left: -1px; background: rgba(255,255,255,0.92); box-shadow: 0 0 4px rgba(0,0,0,0.3); z-index: 3; pointer-events: none; }
#view-summary .sim-label { position: absolute; bottom: 0.6rem; z-index: 3; background: rgba(255,255,255,0.92); border-radius: 0.4rem; padding: 0.2rem 0.55rem; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em; color: #111827; }
#view-summary .sim-label.before { left: 0.6rem; }
#view-summary .sim-label.after { right: 0.6rem; background: #2563eb; color: #fff; }
#view-summary .sim-divider-btn { position: absolute; top: 50%; left: var(--sim-pos); transform: translate(-50%, -50%); z-index: 4; width: 1.9rem; height: 1.9rem; background: rgba(255,255,255,0.95); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.15); border: none; color: #2563eb; }
#view-summary .provider-note { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 0.7rem; font-size: 0.78rem; font-weight: 600; color: #2563eb; }

/* Key findings */
#view-summary .finding { display: flex; align-items: flex-start; gap: 0.65rem; padding: 0; }
#view-summary .finding-text strong { display: block; font-size: calc(0.82rem - 1.5px); font-weight: 700; color: #111827; }
#view-summary .finding-text p { font-size: calc(0.74rem + 0.5px); color: #6b7280; margin-top: 0.1rem; line-height: 1.4; }
#view-summary .finding-divider { height: 1px; background: #f1f3f8; margin: 0 0 0.5rem; }

/* Investment snapshot */
#view-summary .invest-boxes { display: flex; gap: 0.75rem; }
#view-summary .invest-box { flex: 1; border: 1px solid #eef1f6; background: #fafbff; border-radius: 0.8rem; padding: 0.8rem 0.9rem; }
#view-summary .invest-box .ib-label { font-size: 0.72rem; color: #6b7280; }
#view-summary .invest-box .ib-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.05rem; font-weight: 800; color: #0f172a; margin: 0.15rem 0; white-space: nowrap; }
#view-summary .invest-box .ib-value span { font-size: 0.75rem; font-weight: 600; color: #6b7280; }
#view-summary .invest-box .ib-sub { font-size: 0.68rem; color: #9ca3af; }
#view-summary .invest-disclaimer { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; margin-right: 5px; font-size: 0.68rem; color: #9ca3af; line-height: 1.3; }
#view-summary .invest-disclaimer svg { flex-shrink: 0; }

/* We discussed */
#view-summary .discussed-list { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
#view-summary .discussed-list li { display: flex; align-items: center; gap: 0.55rem; font-size: 0.78rem; color: #374151; }
#view-summary .discussed-list .check { flex-shrink: 0; color: #2563eb; }

/* Next step */
#view-summary .next-step { display: flex; align-items: flex-start; gap: 0.75rem; background: #eef4ff; border-radius: 1rem; padding: 0.95rem 1.1rem; margin-top: 0.9rem; }
#view-summary .next-step .ns-ico { color: #2563eb; flex-shrink: 0; margin-top: 0.1rem; }
#view-summary .next-step strong { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.85rem; font-weight: 700; color: #0f172a; }
#view-summary .next-step p { font-size: 0.76rem; color: #4b5563; line-height: 1.45; margin-top: 0.15rem; }

/* Right card — form */
#view-summary .form-header { position: relative; flex-shrink: 0; text-align: center; margin-bottom: 1.2rem; }
#view-summary .form-header-ico { position: absolute; left: 1.3rem; top: 50%; transform: translateY(-50%); width: 2.6rem; height: 2.6rem; border-radius: 50%; background: #eff4ff; color: #2563eb; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
#view-summary .form-header h2 { font-size: 1.15rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
#view-summary .form-header p { font-size: 0.8rem; color: #6b7280; margin-top: 0.2rem; }
#view-summary .form-row { display: flex; gap: 0.9rem; }
#view-summary .field-group { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
#view-summary .form-row .field-group { flex: 1; }
#view-summary .field-group label { font-size: 0.78rem; font-weight: 600; color: #374151; }
#view-summary .form-input { border: 1.5px solid #e2e6f0; border-radius: 0.6rem; padding: 0.7rem 0.85rem; font-size: 0.85rem; font-family: 'Inter', sans-serif; color: #374151; background: #fff; width: 100%; outline: none; }
#view-summary .form-input::placeholder { color: #9ca3af; }
#view-summary .form-input:focus { border-color: #2563eb; }
#view-summary .form-select {
  width: 100%;
  border: 1.5px solid #e2e6f0;
  border-radius: 0.6rem;
  padding: 0.7rem 2.2rem 0.7rem 0.85rem;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  color: #374151;
  background-color: #fff;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1.1rem;
}
#view-summary .form-select:focus { border-color: #2563eb; }
/* grey "Please select..." until a real option is chosen */
#view-summary .form-select:has(option[value=""]:checked) { color: #9ca3af; }
#view-summary .submit-btn { display: flex; align-items: center; justify-content: center; gap: 0.6rem; background: #2563eb; color: #fff; border: none; border-radius: 0.75rem; padding: 0.95rem; font-size: 0.98rem; font-weight: 700; font-family: 'Plus Jakarta Sans', sans-serif; cursor: pointer; transition: background 0.15s ease; margin-top: 0.25rem; }
#view-summary .submit-btn:hover { background: #1d4ed8; }
#view-summary .submit-note { margin-top: 0.55rem; text-align: center; font-size: calc(0.72rem + 0.5px); font-weight: 600; line-height: 1.35; }
#view-summary .submit-note.is-error { color: #dc2626; }
#view-summary .submit-note.is-info { color: #2563eb; }
#view-summary .secure-note { display: flex; align-items: flex-start; justify-content: center; gap: 0.4rem; font-size: calc(0.72rem - 0.5px); color: #9ca3af; margin-top: auto; padding-top: calc(0.5rem - 3px); text-align: center; }
#view-summary .secure-note svg { flex-shrink: 0; margin-top: 0.15rem; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   Desktop is the default (everything above). Below 1024px the fixed
   715px canvas becomes fluid (height: auto) and multi-column layouts
   stack so the page scrolls instead of clipping.
   ═══════════════════════════════════════════════════════════════ */

/* ─── SMALL SCREENS (≤ 1024px) — shared structural rules (tablet + mobile) ─── */
@media (max-width: 1024px) {
  body { padding: 1rem; align-items: flex-start; }

  /* Fluid height — let content grow and the page scroll */
  .app-container { height: auto; }
  .view { min-height: 0; }

  .progress-bar { padding: 1.5rem 1.5rem 1.75rem; }
  .step-label { font-size: 0.72rem; }

  /* Welcome — stack the two columns */
  #view-welcome .main-content { flex-direction: column; padding: 1.5rem 1.5rem 1rem; }
  #view-welcome .right-col { flex: 0 0 auto; }

  /* Chat screens (Introduction, Consultation) — left profile above chat */
  #view-introduction .main-content,
  #view-consultation .main-content { flex-direction: column; overflow: visible; }
  #view-introduction .left-col,
  #view-consultation .left-col { flex: 0 0 auto; margin-top: 0; padding-bottom: 0; }
  #view-introduction .right-section,
  #view-consultation .right-section { padding-left: 0; }
  #view-introduction .center-col,
  #view-consultation .center-col { min-height: 24rem; }

  /* Screen 2 element order (tablet + mobile): portrait → chat → controls → agenda;
     badge + "Ben is listening" hidden. Flatten left-col/right-section into one flow. */
  #view-introduction .left-col,
  #view-introduction .right-section { display: contents; }
  #view-introduction .consultant-profile { order: 1; }
  #view-introduction .columns-row { order: 2; }
  #view-introduction .chat-input-bar { order: 3; }
  #view-introduction .agenda-card { order: 4; }
  #view-introduction .section-badge { display: none; }
  #view-introduction .listening-status { display: none; }

  /* How It Works — stack video over takeaways */
  #view-how-it-works .content-row { flex-direction: column; }
  /* Keep the video at a real 16:9 shape instead of stretching to a fixed height */
  #view-how-it-works .video-col { flex: 0 0 auto; min-height: 0; }
  #view-how-it-works .video-player { height: auto; }
  #view-how-it-works .video-content { aspect-ratio: 16 / 9; }
  #view-how-it-works .takeaways-col { flex: 0 0 auto; }
  #view-how-it-works .bottom-bar { flex-wrap: wrap; }
  #view-how-it-works .next-steps { flex-wrap: wrap; gap: 0.75rem 1.5rem; }
  #view-how-it-works .next-step { flex: 1 1 45%; }

  /* Summary — stack the two cards */
  #view-summary .main-content { flex-direction: column; }
  #view-summary .summary-left,
  #view-summary .summary-right { flex: 0 0 auto; }
}

/* ─── TABLET ONLY (641–1024px) — cosmetic tweaks that must NOT reach mobile ─── */
@media (min-width: 641px) and (max-width: 1024px) {
  #view-welcome .bottom-bar { flex-wrap: wrap; gap: 2.25rem 1rem; }
  #view-welcome .bottom-cta-text { max-width: 21rem; }
  #view-welcome .hero-heading h1 { font-size: calc(clamp(2rem, 3.5vw, 2.9rem) + 14px); }
  #view-welcome .hero-subtext { font-size: calc(0.95rem + 1px); }
  #view-welcome .feature-text h4 { font-size: calc(0.85rem + 2px); }
  #view-welcome .feature-text p { font-size: calc(0.77rem + 2px); }
  #view-welcome .diamond-note { font-size: calc(0.82rem + 3px); }
  #view-welcome .bottom-cta-text h3 { font-size: calc(1rem + 3px); }
  #view-welcome .bottom-cta-text p { font-size: calc(0.78rem + 3px); }
  #view-welcome .field-group label { font-size: calc(0.78rem + 3px); }
  #view-welcome .text-input input { font-size: calc(0.85rem + 3px); }
  #view-welcome .upload-text { font-size: calc(0.8rem + 3px); }
  #view-welcome .upload-text .upload-hint { font-size: calc(0.7rem + 3px); }
  #view-welcome .security-note { font-size: calc(0.68rem + 3px); }
  #view-welcome .start-btn { font-size: calc(1.02rem + 3px); }

  /* Screen 2 control bar: hide the waveform to free horizontal space */
  #view-introduction .voice-waveform { display: none; }
  /* pull the mic section left and let the type box grow into the space */
  #view-introduction .mic-section { margin-left: 0.5rem; }
  #view-introduction .text-answer-input { flex: 1 1 auto; }

  /* Today's Consultation: more inside padding + lift off the bottom + halve gap to control panel */
  #view-introduction .agenda-card { padding: 1.25rem; }
  #view-introduction .main-content { padding-bottom: 1.5rem; }
  #view-introduction .chat-input-bar { margin-bottom: 0.125rem; }

  /* Screen 4 tablet — match screen 2's control bar tweaks */
  #view-consultation .voice-waveform { display: none; }
  #view-consultation .mic-section { margin-left: 0.5rem; }
  #view-consultation .text-answer-input { flex: 1 1 auto; }
  #view-consultation .main-content { padding-bottom: 1.5rem; }

  /* How It Works — reduce video ↔ takeaways gap (tablet) */
  #view-how-it-works .content-row { gap: 0.8rem; }

  /* Ben box on top of the video: portrait|text row, then 2×2 steps */
  #view-how-it-works .bottom-bar { order: -1; flex-direction: column; align-items: stretch; gap: 1.5rem; margin-bottom: 0.5rem; }
  #view-how-it-works .bottom-divider { display: none; }
  #view-how-it-works .ben-return-text strong { font-size: calc(0.85rem + 2px); }
  #view-how-it-works .ben-return-text p { font-size: calc(0.72rem + 2px); }
  #view-how-it-works .next-steps { flex-wrap: wrap; gap: 0.75rem 1.5rem; }
  #view-how-it-works .next-step { flex: 1 1 45%; }
  /* match video/takeaways width to the Ben box (both inset 1.5rem) + bottom space */
  #view-how-it-works .main-content { padding-top: 0.75rem; padding-left: 1.5rem; padding-right: 1.5rem; padding-bottom: 1.5rem; }
}

/* ─── MOBILE (≤ 640px) ────────────────────────────────────────── */
@media (max-width: 640px) {
  body { padding: 0.5rem; }
  .app-container { border-radius: 1rem; }

  /* Progress bar: circles only (labels would overflow) */
  .progress-bar { padding: 1rem 0.5rem 1.25rem; }
  .step-label { display: none; }
  .step-number { width: 1.9rem; height: 1.9rem; font-size: 0.8rem; }

  /* Ben profile: avatar stacked above the text */
  .consultant-profile { flex-direction: column; gap: 0.85rem; text-align: center; }
  .profile-text { align-items: center; }

  /* Welcome */
  #view-welcome .main-content { padding: 1.25rem 19px; gap: 1.5rem; }
  #view-welcome .hero-heading h1 { font-size: 1.85rem; }
  /* drop the desktop right-padding so the subtext spans full width like the title */
  #view-welcome .hero-subtext { padding-right: 0; }
  #view-welcome .feature-grid { grid-template-columns: 1fr; }
  #view-welcome .bottom-bar { flex-direction: column; align-items: stretch; padding: 1.25rem; gap: 1.5rem; margin: 0 19px 1.5rem; }
  #view-welcome .bottom-cta-text { max-width: none; }   /* full width on mobile (override base 16rem cap) */
  #view-welcome .bottom-fields { display: flex; flex-direction: column; gap: 1.5rem; }
  #view-welcome .field-group { width: 100% !important; min-width: 0 !important; max-width: none !important; gap: 0.55rem; }
  #view-welcome .start-btn-wrap { align-self: stretch; }
  #view-welcome .start-btn { justify-content: center; width: 100%; }

  /* Chat input bar wraps on narrow screens */
  .chat-input-bar { flex-wrap: wrap; gap: 0.75rem; }
  .mic-section { margin-left: 0; }
  .text-answer-input { flex: 1 1 100%; }

  /* Screen 2 mobile-specific spacing (element order/hide now shared at ≤1024) */
  #view-introduction .main-content { padding-left: 19px; padding-right: 19px; padding-bottom: 1.25rem; }
  #view-introduction .consultant-profile { padding-bottom: 0; }

  /* Stack the chat header centered: title → progress dots → "Question 2 of 5" */
  #view-introduction .chat-header { flex-direction: column; align-items: center; gap: 0.9rem; padding-top: 1.5rem; }
  #view-introduction .chat-header-right { flex-direction: column-reverse; align-items: center; gap: 0.45rem; width: 85%; }
  /* progress dots span the full 75% — connector lines stretch to fill */
  #view-introduction .question-dots { width: 100%; }
  #view-introduction .question-dots .q-line { flex: 1; }
  /* Center the title text; person icon pinned to its left (out of the centering) */
  #view-introduction .chat-header-left { position: relative; width: 100%; justify-content: center; }
  #view-introduction .chat-header-left h2 { text-align: center; }
  #view-introduction .chat-header-left svg { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; }

  /* Hold the chat box open at a fixed 65vh from the start (min = max), so it
     doesn't start collapsed and grow as messages arrive. */
  #view-introduction .center-col { max-height: 65vh; min-height: 65vh; }
  #view-introduction .chat-messages { min-height: 0; }
  /* Let bubbles run the full width — right edge mirrors Ben's avatar on the left
     (avatar 2rem + 0.65rem gap). */
  #view-introduction .msg-body { max-width: calc(100% - 2.65rem); }

  /* ── Screen 2 + 4 control panel — mobile (one combined panel of cards) ────── */
  /* The outer panel that holds the inner cards. */
  #view-introduction .chat-input-bar, #view-consultation .chat-input-bar {
    flex-direction: column; align-items: stretch; gap: 0.4rem;
    padding: 0.6rem; margin: -0.75rem 0 0.125rem;   /* negative top cancels most of the flex gap → small gap to the chat box */
    background: #f6f8fc; border: 1px solid #eaeef6; border-radius: 1.4rem;
    box-shadow: 0 10px 28px rgba(40, 60, 100, 0.07); backdrop-filter: none;
  }

  /* Show the control-panel status; hide the portrait copy. */
  #view-introduction .ben-status:not(.cp-status), #view-consultation .ben-status:not(.cp-status) { display: none; }
  #view-introduction .cp-status, #view-consultation .cp-status { display: flex; }

  /* ── Ben's voice card ── */
  #view-introduction .ctl-ben, #view-consultation .ctl-ben {
    width: 100%; justify-content: flex-start; gap: 0.65rem;
    padding: 0.7rem 0.9rem; border-radius: 0.8rem;
    background: #fff; border: 1px solid #edf0f6; box-shadow: 0 1px 2px rgba(20, 40, 80, 0.03);
  }
  #view-introduction .ctl-ben-ico, #view-consultation .ctl-ben-ico {
    width: 2.3rem; height: 2.3rem; border-radius: 50%; background: #eef2fb;
    align-items: center; justify-content: center; flex-shrink: 0;
  }
  #view-introduction .ctl-ben-ico svg, #view-consultation .ctl-ben-ico svg { width: 15px; height: 15px; }
  #view-introduction .ctl-ben .ctl-text, #view-consultation .ctl-ben .ctl-text { flex: 1; }
  #view-introduction .ctl-ben .ctl-text strong, #view-consultation .ctl-ben .ctl-text strong { font-size: 0.85rem; font-weight: 600; }
  #view-introduction .ctl-ben .ctl-sub, #view-consultation .ctl-ben .ctl-sub { font-size: 0.76rem; }
  #view-introduction .ctl-toggle, #view-consultation .ctl-toggle {
    display: block; position: relative; flex-shrink: 0;
    width: 2.7rem; height: 1.5rem; border-radius: 1rem;
    background: #2563eb; transition: background 0.2s ease;
  }
  #view-introduction .ctl-toggle-knob, #view-consultation .ctl-toggle-knob {
    position: absolute; top: 0.18rem; left: 1.35rem;
    width: 1.15rem; height: 1.15rem; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: left 0.2s ease;
  }
  #view-introduction .ctl-ben.off .ctl-toggle, #view-consultation .ctl-ben.off .ctl-toggle { background: #cbd5e1; }
  #view-introduction .ctl-ben.off .ctl-toggle-knob, #view-consultation .ctl-ben.off .ctl-toggle-knob { left: 0.18rem; }

  /* ── Mic card: [ mic ] [ text / waveform ], status box full-width below ── */
  #view-introduction .ctl-mic-group, #view-consultation .ctl-mic-group {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-areas: "mic text wave" "stat stat stat";
    align-items: center; column-gap: 0.85rem; row-gap: 0.2rem;
    width: 100%; background: #fff; border: 1px solid #edf0f6;
    box-shadow: 0 1px 2px rgba(20, 40, 80, 0.03);
    border-radius: 0.8rem; padding: 1rem;
  }
  #view-introduction .ctl-mic-group .ctl-mic, #view-consultation .ctl-mic-group .ctl-mic { grid-area: mic; align-self: center; width: auto; padding: 0; }
  #view-introduction .ctl-mic-text, #view-consultation .ctl-mic-text { grid-area: text; align-self: center; }
  #view-introduction .ctl-mic-text strong, #view-consultation .ctl-mic-text strong { font-size: calc(1rem - 2px); font-weight: 600; }
  #view-introduction .ctl-mic-text .ctl-sub, #view-consultation .ctl-mic-text .ctl-sub { font-size: 0.8rem; }
  #view-introduction .ctl-mic-group .ctl-wave, #view-consultation .ctl-mic-group .ctl-wave {
    grid-area: wave; align-self: center; justify-content: center; width: 100%; height: 1.7rem;
  }
  #view-introduction .ctl-wave span, #view-consultation .ctl-wave span { width: 3px; }

  /* Smaller mic with a clear dashed ring. */
  #view-introduction .ctl-mic-ring, #view-consultation .ctl-mic-ring { width: 4rem; height: 4rem; }
  #view-introduction .ctl-mic-dot, #view-consultation .ctl-mic-dot { width: 3.1rem; height: 3.1rem; }
  #view-introduction .ctl-mic-dot svg, #view-consultation .ctl-mic-dot svg { width: 16px; height: 16px; }

  /* ── Status box inside the mic card ── */
  #view-introduction .cp-status, #view-consultation .cp-status {
    grid-area: stat; margin-top: 1.1rem;
    align-items: flex-start; gap: 0.55rem;
    background: #f4f6fb; border-radius: 0.65rem; padding: 0.7rem 0.85rem;
  }
  #view-introduction .cp-status .ben-status-dot, #view-consultation .cp-status .ben-status-dot {
    width: 0.6rem; height: 0.6rem; border: none; background: #2563eb; margin-top: 0.2rem;
  }
  #view-introduction .cp-status[data-state="speaking"] .ben-status-dot, #view-consultation .cp-status[data-state="speaking"] .ben-status-dot { box-shadow: none; }
  #view-introduction .cp-status .ben-status-text, #view-consultation .cp-status .ben-status-text { font-size: calc(0.85rem - 2px); font-weight: 600; color: #0f172a; }
  #view-introduction .cp-status .ben-status-sub, #view-consultation .cp-status .ben-status-sub { font-size: calc(0.76rem - 1px); font-weight: 400; color: #6b7280; }

  /* ── Text input card with a 0/500 counter ── */
  #view-introduction .ctl-input-wrap, #view-consultation .ctl-input-wrap { display: block; position: relative; width: 100%; }
  #view-introduction .ctl-input, #view-consultation .ctl-input {
    width: 100%; min-height: 4.7rem; padding: 0.85rem 1rem 1.4rem; border-radius: 0.8rem;
    font-size: calc(0.88rem - 1px); border-color: #e6e9f1;
  }
  #view-introduction .ctl-counter, #view-consultation .ctl-counter {
    display: block; position: absolute; right: 0.95rem; bottom: 0.7rem;
    font-size: 0.72rem; color: #9ca3af;
  }

  /* ── Send button — full width with label ── */
  #view-introduction .ctl-send, #view-consultation .ctl-send {
    width: 100%; height: auto; border-radius: 0.8rem; gap: 0.5rem; padding: 0.85rem;
  }
  #view-introduction .ctl-send-ico, #view-consultation .ctl-send-ico { width: 20px; height: 20px; }
  #view-introduction .ctl-send-text, #view-consultation .ctl-send-text {
    display: inline; font-family: 'Plus Jakarta Sans', sans-serif; font-size: calc(0.95rem - 2px); font-weight: 700;
  }

  /* ════ SCREEN 4 (Consultation) — same mobile treatment as screen 2 (order kept) ════ */
  #view-consultation .main-content { padding-left: 19px; padding-right: 19px; padding-bottom: 1.25rem; }
  #view-consultation .consultant-profile { padding-bottom: 0; }

  /* Cap the chat box height + scroll the log */
  #view-consultation .center-col { max-height: 65vh; min-height: 0; }
  #view-consultation .chat-messages { min-height: 0; }

  /* Stacked, centered chat header */
  #view-consultation .chat-header { flex-direction: column; align-items: center; gap: 0.9rem; padding-top: 1.5rem; }
  #view-consultation .chat-header-right { flex-direction: column-reverse; align-items: center; gap: 0.45rem; width: 85%; }
  #view-consultation .question-dots { width: 100%; }
  #view-consultation .question-dots .q-line { flex: 1; }
  #view-consultation .chat-header-left { position: relative; width: 100%; justify-content: center; }
  #view-consultation .chat-header-left h2 { text-align: center; }
  #view-consultation .chat-header-left svg { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; }

  /* Consultation control panel + status now reuse Screen 2's rules (the .ctl-* /
     .cp-status blocks above are dual-scoped to #view-consultation). The old
     mode-toggle / mic-section markup was replaced with the .simple-bar design. */
  #view-consultation .center-col { min-height: 65vh; }
  #view-consultation .msg-body { max-width: calc(100% - 2.65rem); }
  /* Screen 4's layout has no flex gap to cancel, so drop Screen 2's negative top
     margin — gives the panel the same gap to the chat box as the simulation has. */
  #view-consultation .chat-input-bar { margin-top: 0; }

  /* How It Works — match screen 2's outer side padding (19px); trim top gap, add bottom space */
  #view-how-it-works .main-content { padding-left: 19px; padding-right: 19px; padding-top: 0.75rem; padding-bottom: 1.25rem; }
  /* video ↔ key takeaways gap to one-third (2rem → ~0.67rem) */
  #view-how-it-works .content-row { gap: 0.67rem; }
  /* halve the video player's corner rounding */
  #view-how-it-works .video-player { border-radius: 0.625rem; }
  /* hide the blue dots in Key Takeaways */
  #view-how-it-works .takeaway-dot { display: none; }
  /* let the "Ben will return…" block wrap instead of overflowing; hide divider */
  #view-how-it-works .ben-return { flex: 1 1 100%; min-width: 0; }
  #view-how-it-works .ben-return-text p { white-space: normal; }
  #view-how-it-works .bottom-divider { display: none; }
  /* move the "Ben will return…" box above the video + tighten gap + match width (19px sides) */
  #view-how-it-works .bottom-bar { order: -1; margin: 1.25rem 19px 0.25rem; border-radius: 0.625rem; padding: 1.1rem 1rem; }
  #view-how-it-works .takeaways-col { border-radius: 0.625rem; }
  /* next steps: back to a single vertical stack */
  #view-how-it-works .next-steps { flex-direction: column; }
  #view-how-it-works .next-step { flex: 0 0 auto; }
  /* Key Takeaways footer: hide the blue star */
  #view-how-it-works .takeaways-footer svg { display: none; }

  /* Summary: stack cells and form rows; flip the cell divider to horizontal */
  #view-summary .main-content { padding: 1rem 19px; }
  /* more room above the header, no extra space below the group */
  #view-summary .summary-left { padding: 1.25rem 0.8rem 0; }
  /* let the bordered group span the full card width (cancel the card's side padding) */
  #view-summary .sum-row-col { margin-left: -0.8rem; margin-right: -0.8rem; }
  /* header: avatar top-left, date pill top-right, title on a full-width row below */
  #view-summary .summary-header { flex-wrap: wrap; align-items: flex-start; }
  #view-summary .summary-avatar { order: 0; }
  #view-summary .date-pill { order: 1; margin-left: auto; align-self: flex-start; margin-top: -0.25rem; }
  #view-summary .summary-title { order: 2; flex: 1 1 100%; margin-top: 0.75rem; }
  #view-summary .summary-title h1 { font-size: calc(1.65rem - 2.5px); }
  #view-summary .sum-toprow { flex-direction: column; }
  #view-summary .sum-cell + .sum-cell { border-left: none; border-top: 1px solid #eef1f6; }
  #view-summary .invest-boxes { flex-direction: column; }
  #view-summary .form-row { flex-direction: column; gap: 0.9rem; }
  #view-summary .invest-disclaimer { margin-left: 0; }
  /* slightly tighter card padding */
  #view-summary .summary-right { padding: 1.25rem 1.1rem; }
  /* left-aligned header; title on two lines, larger; paper-plane icon top-right; padding above title */
  #view-summary .form-header { text-align: left; padding-top: 0.75rem; margin-bottom: 0.5rem; }
  #view-summary .form-header h2 { font-size: calc(1.15rem + 2px); }
  #view-summary .form-header h2 span { display: block; }
  #view-summary .form-header-ico { position: absolute; top: 0; left: auto; right: 0; transform: none; margin-bottom: 0; }
  /* shrink submit text so it stays on one line */
  #view-summary .submit-btn { font-size: 0.82rem; }
  /* shrink secure note so it fits on one line; tighten gap above it */
  #view-summary .secure-note { font-size: 0.62rem; padding-top: 0; }

  /* Temp dev-nav: shrink so it doesn't crowd small screens */
  #dev-nav { transform: scale(0.8); transform-origin: bottom right; }
}

/* ══════════════════════════════════════════════════════════════
   "Take a Photo" trigger (Welcome) — the inline upload-instead link
   ══════════════════════════════════════════════════════════════ */
#view-welcome .upload-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════
   CAMERA CAPTURE MODAL
   Card on desktop · bottom sheet on mobile. data-state drives what
   shows: loading | live | review | error.
   ══════════════════════════════════════════════════════════════ */
body.camera-open { overflow: hidden; }
.camera-modal[hidden] { display: none; }
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.camera-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.camera-sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 3rem);
  background: #fff;
  border-radius: 1.5rem;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow: auto;
}
.camera-handle { display: none; }
.camera-close {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 0.5rem;
  cursor: pointer;
}
.camera-close:hover { background: #f1f5f9; }

.camera-head { display: flex; align-items: center; gap: 0.9rem; padding-right: 2.5rem; }
.camera-head-icon {
  flex-shrink: 0;
  width: 2.8rem;
  height: 2.8rem;
  background: #eef2ff;
  color: #4f46e5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-head-text h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}
.camera-head-text p { font-size: 0.85rem; color: #64748b; margin-top: 0.15rem; }

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #1e293b;
  border-radius: 1rem;
  overflow: hidden;
}
.camera-video, .camera-review {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Round the media itself: a transformed child (the mirrored video below)
     can escape the parent's border-radius clip, leaving a sliver at each
     corner. Clipping it on its own element fixes that. */
  border-radius: inherit;
}
.camera-video { transform: scaleX(-1); }            /* mirror the selfie preview */
.camera-review[hidden] { display: none; }

/* state-driven visibility */
.camera-modal[data-state="review"] .camera-video,
.camera-modal[data-state="loading"] .camera-video,
.camera-modal[data-state="error"]  .camera-video { display: none; }
.camera-modal[data-state="review"] .camera-overlay,
.camera-modal[data-state="loading"] .camera-overlay,
.camera-modal[data-state="error"]  .camera-overlay { display: none; }
.camera-status { display: none; }
.camera-modal[data-state="loading"] .camera-status,
.camera-modal[data-state="error"]  .camera-status {
  display: flex;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: #e2e8f0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.camera-overlay { position: absolute; inset: 0; pointer-events: none; color: #fff; }
.camera-outline {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  height: auto;
}
.camera-badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.5rem 0.7rem;
  border-radius: 0.6rem;
  font-size: 0.76rem;
  line-height: 1.25;
}
.camera-badge strong { display: block; font-weight: 600; }
.camera-tips {
  position: absolute;
  top: 1rem;
  right: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}
.camera-tip { text-align: center; font-size: 0.7rem; font-weight: 400; }
.camera-tip-ico {
  display: block;
  width: 2.8rem;
  height: 2.8rem;
  margin: 0 auto 0.25rem;
}
.camera-tipbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: rgba(15, 23, 42, 0.55);
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: center;
}

.camera-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}
.cam-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  max-width: 11rem;
  padding: 0.85rem 0.5rem;
  background: #eef2ff;
  color: #4338ca;
  border: none;
  border-radius: 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.cam-btn:hover:not(:disabled) { background: #e0e7ff; }
.cam-btn:disabled { opacity: 0.4; cursor: default; }
.cam-retake { justify-self: start; }
.cam-use { justify-self: end; }
.cam-shutter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: #2563eb;
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px #2563eb;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.cam-shutter:hover:not(:disabled) { transform: scale(1.05); }
.cam-shutter:active:not(:disabled) { transform: scale(0.96); }
.cam-shutter:disabled { opacity: 0.5; cursor: default; }

.camera-upload-fallback {
  align-self: center;
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
}

/* Mobile: bottom sheet, page faded (not blurred) behind */
@media (max-width: 640px) {
  .camera-modal { align-items: flex-end; padding: 0; }
  .camera-backdrop { background: rgba(15, 23, 42, 0.45); backdrop-filter: none; }
  .camera-sheet {
    max-width: none;
    max-height: 92vh;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.25rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
  .camera-handle {
    display: block;
    width: 2.5rem;
    height: 0.3rem;
    margin: -0.35rem auto 0.35rem;
    background: #cbd5e1;
    border-radius: 999px;
  }
  .camera-stage { aspect-ratio: 3 / 4; }

  /* Reshape the oval for the portrait stage: wider + much shorter than the
     desktop default (which looked tall/narrow here) while still clearing the
     right-side tips. Smaller tips + badge too. */
  .camera-outline { width: 84%; height: auto; top: 50%; }
  .camera-tips { top: 0.7rem; right: 0.55rem; gap: 0.8rem; }
  .camera-tip { font-size: 0.6rem; }
  .camera-tip-ico { width: 2.05rem; height: 2.05rem; }
  .camera-badge {
    top: 0.6rem;
    left: 0.6rem;
    gap: 0.4rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.66rem;
  }
  .camera-badge svg { width: 13px; height: 13px; }
}

/* ══════════════════════════════════════════════════════════════
   SCREEN 2 — countdown / connecting overlay (Ben)
   ══════════════════════════════════════════════════════════════ */
.app-container { position: relative; }   /* anchor for the countdown overlay */
.ben-countdown[hidden] { display: none; }
.ben-countdown {
  position: absolute;
  inset: 0;                 /* covers the whole app card (clipped to its rounded corners) */
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(244, 246, 252, 0.85);
  backdrop-filter: blur(4px);
}
.ben-countdown-card { max-width: 22rem; padding: 1.5rem; }
.ben-countdown-num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  color: #2563eb;
}
.ben-countdown-num.pulse { animation: benCountPulse 1s ease-out; }
@keyframes benCountPulse {
  0%   { transform: scale(0.6); opacity: 0; }
  30%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* Spinner for the brief "loading the video" wash on the Screen 2 -> 3 hand-off
   (reuses the takeaway spinner's animation). */
.ben-countdown .vid-load-spinner {
  width: 2.5rem; height: 2.5rem; margin: 0 auto; border-radius: 50%;
  border: 3px solid #c7dbff; border-top-color: #2563eb;
  animation: takeawaySpin 0.8s linear infinite;
}
.ben-countdown-text {
  margin-top: 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.ben-countdown-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
}

/* "Looks like you stepped away — start over?" white-out (inactive end).
   Reuses .ben-countdown for the full-card blurred white wash. */
.ben-away-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
}
.ben-away-text {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.55;
}
.ben-away-btn {
  margin-top: 1.5rem;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ben-away-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 99, 235, 0.36); }
.ben-away-btn:active { transform: translateY(0); box-shadow: 0 6px 14px rgba(37, 99, 235, 0.3); }

/* ── Screen 1 bottom bar — DESKTOP ONLY (≥1025px) ──────────────────
   Roomier inner padding on the photo box (content-sized, not stretched).
   Tablet/mobile untouched. */
@media (min-width: 1025px) {
  /* Desktop: the columns are stretched to equal height, so let the smile-sim
     panel FILL the left column instead of forcing a 4/3 box. That keeps the
     simulation card bottom flush with the chat input bar at any width (a fixed
     ratio overflows past it on wide screens). Scoped to #sim-panel so the
     lightbox keeps its own fixed ratio. */
  #view-consultation .simulation-section { flex: 1 1 auto; min-height: 0; }
  #view-consultation #sim-panel { flex: 1 1 auto; min-height: 0; }

  #view-welcome .upload-input {
    padding-left: 20px;
    padding-right: 35px;
  }
  #view-welcome .upload-icon-wrap svg {
    width: 25px;
    height: 25px;
  }

  /* Desktop only: overlay the control bar on top of the video instead of giving
     it its own row. That lets the video use the full player height — so it scales
     up and gets wider, shrinking the black side-bars on wide screens. The bar is
     translucent (gradient scrim) and auto-hides 1.5s after the pointer leaves the
     player; it reappears instantly on hover. Pure CSS via :hover + transition-delay.
     (≤1024px keeps the stacked 16:9 layout untouched.) */
  #view-how-it-works .video-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    background: linear-gradient(to top,
      rgba(11, 22, 34, 0.9) 0%,
      rgba(11, 22, 34, 0.5) 55%,
      rgba(11, 22, 34, 0) 100%);
    padding: 1.6rem 1rem 0.7rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    transition-delay: 1.5s;          /* fade out 1.5s after the pointer leaves */
  }
  #view-how-it-works .video-player:hover .video-controls {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;            /* appear immediately on hover */
  }

  /* Desktop: fill the player edge-to-edge, cropping the video as needed so there
     are no black strips at all. (≤1024px keeps object-fit: contain in its 16:9 box,
     where the video fits exactly with no cropping.) The matching border-radius
     rounds the video's OWN compositing layer so its corners clip cleanly to the
     player (a parent's overflow:hidden alone doesn't always clip a <video> layer). */
  #view-how-it-works .how-video {
    object-fit: cover;
    border-radius: 1.25rem;
  }
}

/* ══════════════════════════════════════════════════════════════
   SIMPLIFIED CHAT CONTROL BAR (Screen 2)
   Ben's-voice mute · your-mic mute · waveform · text input · send
   ══════════════════════════════════════════════════════════════ */
.simple-bar .ctl-text { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.simple-bar .ctl-text strong { font-size: 0.95rem; font-weight: 700; color: #0f172a; }
.simple-bar .ctl-sub { font-size: 0.78rem; color: #9ca3af; }

/* Ben's voice (output mute) */
.ctl-ben {
  display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0;
  background: #fff; border: 1px solid #e5e9f2; border-radius: 0.85rem;
  padding: 0.65rem 1rem; cursor: pointer;
}
.ctl-ben-ico { color: #2563eb; display: flex; }
.ctl-ben-ico svg { width: 18px; height: 18px; }
.ctl-ben.off { background: #f8fafc; }
.ctl-ben.off .ctl-ben-ico { color: #9ca3af; }

/* Your mic (input mute) */
.ctl-mic {
  display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0;
  background: transparent; border: none; cursor: pointer;
}
.ctl-mic-ring {
  width: 3.4rem; height: 3.4rem; border-radius: 50%;
  border: 2px dashed #93b4fb; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ctl-mic-dot {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; background: #2563eb;
  display: flex; align-items: center; justify-content: center;
}
.ctl-mic-dot svg { width: 18px; height: 18px; }
.ctl-mic.off .ctl-mic-ring { border-color: #e5e9f2; }
.ctl-mic.off .ctl-mic-dot { background: #9ca3af; }

/* waveform */
.ctl-wave { display: flex; align-items: center; gap: 2px; height: 2.4rem; flex-shrink: 0; }
.ctl-wave span { width: 3px; border-radius: 2px; background: linear-gradient(to bottom, #93c5fd, #2563eb); height: 16%; transition: height 0.06s linear, background 0.2s ease; }
.ctl-wave.silent span { background: #cbd5e1; }

/* text input */
.ctl-input {
  flex: 1 1 auto; min-width: 6rem;
  border: 1px solid #e5e9f2; border-radius: 0.85rem;
  padding: 0.7rem 1rem; background: #fff;
  font-family: 'Inter', sans-serif; font-size: calc(0.85rem + 1px); color: #374151; outline: none;
  resize: none; line-height: 1.4; vertical-align: top;
}
.ctl-input:focus { border-color: #2563eb; }
.ctl-input::placeholder { color: #9ca3af; }

/* send */
.ctl-send {
  flex-shrink: 0; width: 2.8rem; height: 2.8rem; border-radius: 50%;
  background: #2563eb; border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s ease;
}
.ctl-send:hover { background: #1d4ed8; }

/* Gentle blue glow ring around Ben's portrait while he speaks. Driven by the same
   1s-held state as the status line, so it fades softly and never strobes at full-stops. */
#view-introduction .avatar-wrap::after, #view-consultation .avatar-wrap::after {
  content: ''; position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 14px 2px rgba(37, 99, 235, 0.3);
  filter: blur(1px);                 /* soften the edge of the line */
  z-index: 1;                        /* sit BEHIND the waveform pill (z-index 2) */
  opacity: 0; transition: opacity 0.6s ease; pointer-events: none;
}
#view-introduction .waveform, #view-consultation .waveform { z-index: 2; background: rgba(255, 255, 255, 0.8); }
#view-introduction .avatar-wrap.speaking::after, #view-consultation .avatar-wrap.speaking::after {
  opacity: 1; animation: benRingGlow 2.8s ease-in-out infinite;
}
@keyframes benRingGlow {
  0%, 100% { box-shadow: 0 0 12px 1px rgba(37, 99, 235, 0.22); border-color: rgba(37, 99, 235, 0.4); }
  50%      { box-shadow: 0 0 18px 3px rgba(37, 99, 235, 0.4);  border-color: rgba(37, 99, 235, 0.62); }
}

/* Ben's portrait waveform — grey + low when idle, blue while he speaks.
   Bar heights are driven per-frame by introduction.js (centre-out motion). */
#view-introduction .waveform .bar, #view-consultation .waveform .bar { background: #cbd5e1; transition: background 0.2s ease; }
#view-introduction .waveform.speaking .bar, #view-consultation .waveform.speaking .bar { background: linear-gradient(to bottom, #93c5fd, #2563eb); }

/* Status line: Connecting / Ben is speaking / Ben is listening + mic subtitle */
.ben-status {
  align-self: flex-start;
  display: inline-flex; align-items: flex-start; gap: 0.45rem;
  padding: 0; background: none; border: none; box-shadow: none;
}
.ben-status-dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-top: 0.18rem;
  border: 2px solid #cbd5e1; box-sizing: border-box; flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.ben-status-body { display: flex; flex-direction: column; gap: 0.1rem; }
.ben-status-text { font-size: calc(0.92rem - 1.5px); font-weight: 500; color: #64748b; transition: color 0.2s ease; }
.ben-status-sub { font-size: calc(0.92rem - 2.5px); font-weight: 400; color: #9ca3af; }
.ben-status[data-state="speaking"] .ben-status-dot {
  background: #2563eb; border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.ben-status[data-state="speaking"] .ben-status-text { color: #2563eb; }
/* gentle pulse while connecting so it reads as "working on it" */
.ben-status[data-state="connecting"] .ben-status-dot { animation: benDotPulse 1s ease-in-out infinite; }
@keyframes benDotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* The control-panel copy of the status is mobile-only. Mobile-only control bits
   (toggle, char counter, send label) are hidden on desktop/tablet, and the
   grouping wrappers stay transparent so the bar remains one horizontal row. */
.cp-status { display: none; }
.ctl-toggle, .ctl-counter, .ctl-send-text { display: none; }
.ctl-mic-group, .ctl-input-wrap { display: contents; }
