:root {
  --navy: #173b7a;
  --navy-deep: #0e2859;
  --yellow: #ffdc2e;
  --ink: #152033;
  --muted: #657184;
  --line: #d9e0eb;
  --paper: #fffdf8;
  --white: #ffffff;
  --danger: #aa2635;
  --success: #16734a;
  --shadow: 0 24px 70px rgba(14, 40, 89, 0.13);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #eef3f8; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 220, 46, 0.24), transparent 30rem),
    linear-gradient(145deg, #f6f8fb 0%, #edf2f8 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(2px);
  opacity: 0.6;
}

.ambient-one { width: 20rem; height: 20rem; right: -11rem; top: 30%; background: rgba(23, 59, 122, 0.09); }
.ambient-two { width: 12rem; height: 12rem; left: -7rem; bottom: 5%; background: rgba(255, 220, 46, 0.16); }

[hidden] { display: none !important; }

.site-header {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 2;
}

.brand-lockup { display: flex; align-items: center; gap: 0.7rem; color: var(--navy-deep); }
.brand-lockup span { display: grid; gap: 0.1rem; line-height: 1.05; }
.brand-lockup strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }
.brand-lockup small { color: var(--muted); font-size: 0.67rem; letter-spacing: 0.08em; text-transform: uppercase; }
.brand-mark { width: 48px; height: 48px; border-radius: 9px; display: block; }

.save-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.save-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #9aa6b5; transition: background 180ms ease; }
.save-indicator.is-saving .save-dot { background: var(--yellow); }
.save-indicator.is-saved .save-dot { background: var(--success); }
.save-indicator.is-error .save-dot { background: var(--danger); }

.progress-shell {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto 0.75rem;
  position: relative;
  z-index: 2;
}

.progress-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.35rem; }
.progress-track { height: 5px; background: rgba(23, 59, 122, 0.11); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--navy), #3c67ae); border-radius: inherit; transition: width 300ms ease; }

.app-shell {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto 3rem;
  min-height: 610px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid rgba(23, 59, 122, 0.11);
  border-radius: 28px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.global-error {
  margin: 1rem 1.4rem 0;
  padding: 0.85rem 1rem;
  color: #7e1724;
  background: #fff0f1;
  border: 1px solid #f1c4ca;
  border-radius: 12px;
  font-size: 0.9rem;
}

#intakeForm { min-height: inherit; display: flex; flex-direction: column; }

.step {
  display: none;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.35rem, 6vw, 4.25rem) 2rem;
  opacity: 0;
  transform: translateX(22px);
}

.step.is-active {
  display: block;
  opacity: 1;
  transform: translateX(0);
  animation: step-in 280ms cubic-bezier(.2,.8,.2,1);
}

@keyframes step-in {
  from { opacity: 0; transform: translateX(22px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-language { min-height: 610px; text-align: center; padding-top: clamp(4rem, 12vw, 7rem); }
.step-complete { text-align: center; min-height: 610px; padding-top: 5rem; }

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--navy);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  color: var(--navy-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(2.8rem, 8vw, 4.6rem); line-height: 1; }
h2 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; max-width: 17ch; }
.language-prompt, .lead { color: var(--muted); margin: 0.9rem 0 1.6rem; }
.lead { max-width: 55ch; }

[data-lang] { display: none; }
html[lang="es"] [data-lang="es"], html[lang="en"] [data-lang="en"] { display: inline; }
p[data-lang], h2[data-lang], strong[data-lang], small[data-lang] { display: none; }
html[lang="es"] p[data-lang="es"], html[lang="en"] p[data-lang="en"],
html[lang="es"] h2[data-lang="es"], html[lang="en"] h2[data-lang="en"],
html[lang="es"] strong[data-lang="es"], html[lang="en"] strong[data-lang="en"],
html[lang="es"] small[data-lang="es"], html[lang="en"] small[data-lang="en"] { display: block; }
label span[data-lang], button span[data-lang], a span[data-lang] { display: none; }
html[lang="es"] label span[data-lang="es"], html[lang="en"] label span[data-lang="en"],
html[lang="es"] button span[data-lang="es"], html[lang="en"] button span[data-lang="en"],
html[lang="es"] a span[data-lang="es"], html[lang="en"] a span[data-lang="en"] { display: inline; }

.choice-stack { display: grid; gap: 0.8rem; max-width: 440px; margin: 2rem auto 0; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.choice-button {
  display: grid;
  gap: 0.2rem;
  text-align: left;
  padding: 1.1rem 1.3rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.choice-button strong { color: var(--navy); font-size: 1.08rem; }
.choice-button span { color: var(--muted); font-size: 0.86rem; }
.choice-button:hover, .choice-button:focus-visible { transform: translateY(-2px); border-color: var(--navy); box-shadow: 0 14px 28px rgba(23,59,122,.11); outline: none; }

.intro-list { display: grid; gap: 0.8rem; margin: 2rem 0; }
.intro-list > div { display: flex; align-items: center; gap: 0.9rem; }
.intro-list p { margin: 0; }
.intro-number { flex: 0 0 auto; width: 2.15rem; height: 2.15rem; display: grid; place-items: center; border-radius: 50%; color: var(--navy); background: var(--yellow); font-weight: 800; }
.privacy-note { padding: 0.95rem 1rem; background: #f2f5fa; border-left: 4px solid var(--navy); border-radius: 0 12px 12px 0; color: #4f5d72; font-size: 0.88rem; }

.field-grid { display: grid; gap: 1rem; margin-top: 1.7rem; }
.field-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0.75rem; }

label { display: grid; gap: 0.42rem; margin-top: 1rem; color: #26344b; font-weight: 700; font-size: 0.84rem; }
label small, legend small { color: var(--muted); font-weight: 500; }
.field-help, .fieldset-help { color: var(--muted); font-size: 0.78rem; font-weight: 500; line-height: 1.45; }
.fieldset-help { margin: 0.25rem 0 0.4rem; }

input, select, textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.78rem 0.9rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #cbd5e2;
  border-radius: 13px;
  outline: none;
  box-shadow: 0 5px 16px rgba(14,40,89,.035);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea { resize: vertical; min-height: 92px; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(23,59,122,.12); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(170,38,53,.1); }

fieldset { margin: 1.8rem 0 0; padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px; }
legend { padding: 0 0.45rem; color: var(--navy); font-weight: 800; }

.conditional[hidden] { display: none !important; }

.inline-question { margin-top: 1.5rem; padding: 1rem; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem; background: #f4f6fa; border-radius: 15px; }
.segmented { display: flex; gap: 0.45rem; }
.segmented button { min-width: 72px; padding: 0.65rem 0.9rem; border: 1px solid #cbd5e2; border-radius: 11px; background: white; font-weight: 800; }
.segmented button.is-selected { color: white; background: var(--navy); border-color: var(--navy); }

.passport-guide { margin: 1.5rem 0; display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 1.2rem; color: var(--muted); }
.passport-shape { height: 96px; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #f7f1de; border: 2px solid var(--navy); border-radius: 10px; transform: rotate(-1deg); box-shadow: 7px 7px 0 rgba(255,220,46,.62); }
.passport-shape span { border: 1px dashed rgba(23,59,122,.45); border-radius: 4px; background: linear-gradient(#dfe8f6 35%, transparent 35%); }
.passport-guide p { margin: 0; }

.upload-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.upload-zone { position: relative; margin: 0; padding: 0.9rem; min-height: 98px; display: grid; grid-template-columns: 2.3rem 1fr; grid-template-rows: auto auto; column-gap: 0.75rem; align-items: center; background: white; border: 1px dashed #aab7ca; border-radius: 15px; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.upload-zone:hover, .upload-zone:focus-within { border-color: var(--navy); background: #f7f9fd; }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.upload-zone .upload-icon { grid-row: 1 / 3; width: 2.3rem; height: 2.3rem; display: grid; place-items: center; color: white; background: var(--navy); border-radius: 50%; font-size: 1.3rem; }
.upload-zone strong { grid-column: 2; color: var(--navy-deep); }
.upload-zone small { grid-column: 2; color: var(--muted); }
.upload-required { border-style: solid; border-color: rgba(23,59,122,.55); }
.compact-upload { margin-top: 1.2rem; max-width: 420px; }

.uploaded-files { margin: 1rem 0; display: grid; gap: 0.5rem; }
.uploaded-file { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 0.72rem 0.85rem; background: #eef7f2; border-radius: 11px; font-size: 0.82rem; }
.uploaded-file strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploaded-file button { color: var(--danger); background: none; border: 0; font-weight: 800; }
.returns-table { margin-top: 1.4rem; display: grid; gap: 0.7rem; }
.return-row { display: grid; grid-template-columns: 120px 1fr; gap: 0.75rem; }

.consent-row { grid-template-columns: auto 1fr; align-items: start; gap: 0.8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; font-weight: 600; }
.consent-row input { width: 1.3rem; height: 1.3rem; min-height: auto; margin-top: 0.18rem; accent-color: var(--navy); }

.signature-wrap { margin-top: 1.2rem; padding: 1rem; background: white; border: 1px solid var(--line); border-radius: 16px; }
#signatureCanvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.signature-line { height: 1px; background: #9aa6b5; margin: 0 0 0.5rem; }
.text-button { padding: 0.35rem; color: var(--navy); background: transparent; border: 0; font-weight: 800; }

.review-content { display: grid; gap: 1rem; margin-top: 1.5rem; }
.review-group { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.review-group header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.review-group h3 { margin: 0; color: var(--navy); font-size: 1rem; }
.review-group button { color: var(--navy); background: transparent; border: 0; font-weight: 800; }
.review-group dl { display: grid; grid-template-columns: minmax(130px, .7fr) 1.3fr; gap: 0.35rem 1rem; margin: 0.7rem 0 0; font-size: 0.84rem; }
.review-group dt { color: var(--muted); }
.review-group dd { margin: 0; word-break: break-word; }
.final-notice { margin-top: 1.4rem; padding: 1rem; background: #fff8d6; border-radius: 14px; }
.final-notice p { margin: 0.3rem 0 0; }

.complete-mark { width: 4.5rem; height: 4.5rem; display: grid; place-items: center; margin: 0 auto 1.4rem; color: white; background: var(--success); border-radius: 50%; font-size: 2.4rem; box-shadow: 0 0 0 12px rgba(22,115,74,.11); }
.step-complete h2 { margin-inline: auto; }
.receipt-id { margin: 2rem auto; display: grid; gap: 0.25rem; max-width: 330px; padding: 1rem; color: var(--muted); background: #f2f5f9; border-radius: 13px; }
.receipt-id strong { color: var(--navy); font-size: 1.1rem; letter-spacing: .05em; }
.contact-actions { display: flex; justify-content: center; gap: 0.7rem; margin: 1.4rem 0; }
.contact-actions a { padding: 0.7rem 1rem; color: var(--navy); background: white; border: 1px solid var(--line); border-radius: 11px; text-decoration: none; font-weight: 800; }
.secondary-button { padding: 0.8rem 1rem; color: var(--navy); background: transparent; border: 1px solid var(--navy); border-radius: 12px; font-weight: 800; }

.form-actions { margin-top: auto; padding: 1rem clamp(1.35rem, 6vw, 4.25rem) 1.4rem; display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid rgba(23,59,122,.09); background: rgba(255,255,255,.64); backdrop-filter: blur(12px); }
.primary-button, .back-button { min-height: 52px; padding: 0.78rem 1.2rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; border-radius: 13px; font-weight: 800; }
.primary-button { min-width: 180px; color: white; background: var(--navy); border: 1px solid var(--navy); box-shadow: 0 12px 22px rgba(23,59,122,.2); }
.primary-button:hover { background: var(--navy-deep); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.back-button { color: var(--navy); background: transparent; border: 0; }
.back-button:hover { background: rgba(23,59,122,.07); }

@media (max-width: 720px) {
  .site-header { padding-top: 0.8rem; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-lockup strong { font-size: 0.95rem; }
  .save-indicator span:not(.save-dot) { display: none !important; }
  .app-shell { width: 100%; margin: 0; min-height: calc(100svh - 82px); border-radius: 24px 24px 0 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .progress-shell { width: calc(100% - 2rem); }
  .step { padding: 2rem 1.2rem 1.5rem; }
  .field-grid-two, .field-grid-three, .field-grid-four { grid-template-columns: 1fr; gap: 0; }
  .upload-list { grid-template-columns: 1fr; }
  .passport-guide { grid-template-columns: 115px 1fr; gap: 0.9rem; }
  .passport-shape { height: 76px; }
  .form-actions { position: sticky; bottom: 0; padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom)); }
  .primary-button { flex: 1; }
  .return-row { grid-template-columns: 90px 1fr; }
  .review-group dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .review-group dd { margin-bottom: 0.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
