.app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 20px 24px;
}

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }

/* ── Progress dots ── */
.progress-dots { display: flex; gap: 6px; justify-content: center; padding: 4px 0 20px; }
.progress-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-md); transition: background 0.2s; }
.progress-dots .dot.active { background: var(--terracotta); }
.progress-dots .dot.done { background: var(--sage); }

/* ── WELCOME SCREEN ── */
.welcome-hero { text-align: center; padding: 20px 4px 8px; }
.welcome-hero h1 { font-size: clamp(26px, 6vw, 34px); font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; margin-bottom: 12px; }
.welcome-hero h1 span { color: var(--terracotta); }
.welcome-hero p { font-size: 14.5px; color: var(--muted); line-height: 1.7; max-width: 480px; margin: 0 auto; }

.upload-hero {
  margin-top: 28px;
  border: 2px dashed var(--border-md);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-hero:hover { border-color: var(--terracotta); background: var(--terracotta-dim); }
.upload-hero input[type="file"] { display: none; }

.upload-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--terracotta-dim);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--terracotta);
}
.upload-icon svg { width: 30px; height: 30px; }

.upload-hero .primary-cta { font-family: 'Quicksand', sans-serif; font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.upload-hero .secondary-note { font-size: 13px; color: var(--muted); }

.preview-thumb { max-width: 100%; border-radius: var(--radius); margin-top: 16px; display: none; }
.preview-thumb.visible { display: block; }

.trust-row {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin-top: 20px; font-size: 12.5px; color: var(--muted);
}
.trust-row svg { width: 14px; height: 14px; color: var(--sage); flex-shrink: 0; }

/* ── ANALYZING SCREEN ── */
.analyzing-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 40px 20px; }
.pulse-ring {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--terracotta-dim);
  border-top-color: var(--terracotta);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.analyzing-screen p { color: var(--muted); font-size: 14.5px; max-width: 280px; }

/* ── TRANSLATION / QUESTIONS SCREENS ── */
.screen-header { padding: 6px 0 18px; max-width: 640px; }
.screen-header h2 { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.screen-header p { font-size: 13.5px; color: var(--muted); }

.summary-card { padding: 20px; font-size: 14.5px; line-height: 1.75; margin-bottom: 20px; max-width: 640px; }

.question-card { padding: 16px 18px; margin-bottom: 12px; }
.question-card .q-text { font-size: 14.5px; font-weight: 700; margin-bottom: 5px; }
.question-card .q-why { font-size: 13px; color: var(--muted); }

.steps-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.step-item { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; }
.step-item svg { width: 16px; height: 16px; color: var(--sage); flex-shrink: 0; margin-top: 2px; }
.step-item span { font-size: 13.5px; line-height: 1.6; }

.nav-btn-row { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }
.primary-btn, .secondary-btn {
  flex: 1; border-radius: var(--radius); padding: 14px 20px; font-size: 14.5px; font-weight: 700;
  cursor: pointer; border: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Quicksand', sans-serif;
}
.primary-btn { background: var(--terracotta); color: #fff; }
.primary-btn:hover { opacity: 0.92; }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.secondary-btn { background: var(--surface); color: var(--ink); border: 1px solid var(--border-md); }
.secondary-btn:hover { border-color: var(--terracotta); }

/* ── CONVERSATION LOOP SCREEN ── */
.chat-thread { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; overflow-y: auto; }

.bubble { max-width: 640px; padding: 13px 16px; border-radius: var(--radius); font-size: 14px; line-height: 1.6; }
.bubble.ai { background: var(--surface); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.user { background: var(--terracotta); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble .bubble-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.65; margin-bottom: 4px; }
.bubble .nudge-note { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(46,42,36,0.15); font-size: 12.5px; color: var(--amber-flag); font-weight: 600; }

.loop-input-row { display: flex; gap: 8px; padding-top: 10px; }
.loop-input-row textarea {
  flex: 1; min-height: 52px; max-height: 140px; resize: vertical;
  background: var(--surface); border: 1px solid var(--border-md); border-radius: var(--radius);
  padding: 12px 14px; font-family: 'Nunito', sans-serif; font-size: 14px; outline: none;
}
.loop-input-row textarea:focus { border-color: var(--terracotta); }
.send-btn {
  width: 48px; flex-shrink: 0; border: none; border-radius: var(--radius); background: var(--terracotta); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn svg { width: 18px; height: 18px; }

.round-indicator { text-align: center; font-size: 11.5px; color: var(--muted); padding-bottom: 6px; }

/* ── Reference panel — keeps questions visible during the loop ── */
.reference-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 14px; overflow: hidden;
}
.reference-panel summary {
  padding: 12px 16px; font-size: 13px; font-weight: 700; color: var(--terracotta);
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px;
  font-family: 'Quicksand', sans-serif;
}
.reference-panel summary::-webkit-details-marker { display: none; }
.reference-panel summary::before { content: '▸'; font-size: 11px; transition: transform 0.15s; }
.reference-panel[open] summary::before { transform: rotate(90deg); }
.reference-panel[open] summary { border-bottom: 1px solid var(--border); }
#loopReferenceContent { padding: 4px 16px 14px; }
#loopReferenceContent .ref-group-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin: 10px 0 6px;
}
#loopReferenceContent .ref-group-label:first-child { margin-top: 4px; }
#loopReferenceContent .ref-item { font-size: 12.5px; line-height: 1.6; padding: 4px 0; }
#loopReferenceContent .ref-item strong { display: block; color: var(--ink); }
#loopReferenceContent .ref-item span { color: var(--muted); }

/* ── HANDOFF SCREEN ── */
.handoff-banner {
  background: var(--sage-dim); border: 1px solid rgba(111,146,113,0.3); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px; display: flex; gap: 12px; align-items: flex-start;
}
.handoff-banner svg { width: 20px; height: 20px; color: var(--sage); flex-shrink: 0; margin-top: 1px; }
.handoff-banner p { font-size: 13.5px; line-height: 1.6; }
.handoff-banner strong { display: block; margin-bottom: 3px; font-family: 'Quicksand', sans-serif; }

.emergency-banner {
  background: var(--amber-flag-dim); border: 1px solid rgba(216,154,62,0.35); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px; display: flex; gap: 12px; align-items: flex-start;
}
.emergency-banner svg { width: 20px; height: 20px; color: var(--amber-flag); flex-shrink: 0; margin-top: 1px; }
.emergency-banner p { font-size: 13.5px; line-height: 1.6; }
.emergency-banner strong { display: block; margin-bottom: 3px; font-family: 'Quicksand', sans-serif; color: #A66B1E; }

.helpline-card { padding: 18px; margin-bottom: 18px; display: flex; align-items: center; gap: 14px; }
.helpline-card .phone-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--terracotta-dim); display: flex; align-items: center; justify-content: center; color: var(--terracotta); flex-shrink: 0; }
.helpline-card .phone-icon svg { width: 20px; height: 20px; }
.helpline-card .phone-label { font-size: 12px; color: var(--muted); }
.helpline-card .phone-number { font-family: 'Quicksand', sans-serif; font-size: 19px; font-weight: 700; }

.summary-box { padding: 18px; margin-bottom: 16px; font-size: 14px; line-height: 1.75; }
.ask-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ask-item { display: flex; gap: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; }
.ask-item .ask-num {
  width: 20px; height: 20px; border-radius: 50%; background: var(--terracotta-dim); color: var(--terracotta);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.error-bar {
  background: var(--amber-flag-dim); border: 1px solid rgba(216,154,62,0.35); border-radius: var(--radius);
  padding: 12px 16px; font-size: 13px; color: #8A5A1A; margin-top: 14px; display: none;
}

@media (max-width: 420px) {
  .app-shell { padding: 0 16px 20px; }
}
