/* Nunito (Google Fonts, SIL Open Font License 1.1), variable 400–800, subconjunto latino. Alojada en /fonts. */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/fonts/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Sistema ───────────────────────────────────────────────────────────────────────────────────
   Color  navy #0f3b52 (texto) · teal #0a7f93 (acción) · teal profundo #06606f (cupón) · menta #22b9a3 (avance, del logo)
          verde #1f8a5b (selección) · lienzo #eef6f7 · línea #d3e4e9
   Tipo   Nunito. 14 / 16 / 18 / 22 / 28 / 46 px. Pesos 400, 600, 800. Todo en minúsculas de oración.
   Forma  píldoras y círculos, como el logo. Radio 14 en campos, 24 en la hoja.
   Foco   el cupón del 5 % es lo único llamativo; el resto es sobrio.                                   */
:root {
  color-scheme: light;
  --ink: #0f3b52;
  --muted: #4f6b7a;
  --teal: #0a7f93;
  --teal-dark: #06606f;
  --mint: #22b9a3;
  --leaf: #1f8a5b;
  --canvas: #eef6f7;
  --soft: #f4f9fa;
  --line: #d3e4e9;
  --field: #c3d8df;
  --error: #b53434;
  --shadow: 0 1px 2px #0f3b520d, 0 16px 36px -20px #0f3b5238;
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #f9fdfd 0, var(--canvas) 440px); }
button, input, select, textarea { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea, a { outline-offset: 4px; }
:focus-visible { outline: 3px solid #0795af; }

/* ── Cabecera y portada ─────────────────────────────────────────────────────────────────────── */
.site-header { max-width: 808px; margin: auto; padding: 20px 24px 10px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; flex-shrink: 0; text-decoration: none; }
.brand-logo { display: block; width: 180px; height: auto; }
.header-caption { font-size: .875rem; line-height: 1.5; text-align: right; color: var(--muted); }
.header-caption strong { font-weight: 800; color: var(--ink); }
main { padding: 0 24px; }
.hero { max-width: 760px; margin: 16px auto 24px; }
h1 { font-size: clamp(2.1rem, 4.6vw, 2.875rem); line-height: 1.1; letter-spacing: -.025em; margin: 6px 0 12px; font-weight: 800; max-width: 22ch; text-wrap: balance; }
.hero > p { color: var(--muted); font-size: 1.125rem; line-height: 1.5; margin: 0; max-width: 46ch; }

/* Cupón del 5 %: muescas a los lados y línea troquelada. */
.benefit-note {
  --notch: 13px;
  margin-top: 18px; display: grid; grid-template-columns: auto 1fr; align-items: center; max-width: 520px;
  background: var(--teal-dark); color: #fff; border-radius: 16px;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--notch) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle var(--notch) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
}
.benefit-amount { display: block; flex-shrink: 0; font-size: 3.25rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; white-space: nowrap; color: #fff; padding: 12px 18px 12px 28px; }
.benefit-text { min-width: 0; padding: 12px 28px 12px 18px; border-left: 2px dashed #ffffff73; font-size: .9375rem; line-height: 1.5; color: #e3f2f4; }
.benefit-text strong { display: block; font-size: 1.125rem; color: #fff; font-weight: 800; }

/* ── Identificación ─────────────────────────────────────────────────────────────────────────── */
.survey-layout { max-width: 760px; margin: auto; }
.card { padding: 26px 32px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.section-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.section-heading h2 { font-size: 1.125rem; letter-spacing: -.01em; margin: 0 0 3px; font-weight: 800; }
.section-heading p { margin: 0; color: var(--muted); font-size: .9375rem; }
.section-icon { width: 46px; height: 46px; border-radius: 50%; background: #e3f3f5; color: var(--teal); display: grid; place-items: center; flex-shrink: 0; }
.section-icon svg { width: 25px; height: 25px; }
.field-label { display: block; font-size: .9375rem; margin-bottom: 10px; font-weight: 800; }
.required { color: #b63c38; }
.dni-row { display: flex; align-items: stretch; gap: 12px; }
input[type=text], select, textarea { width: 100%; min-width: 0; border: 1.5px solid var(--field); border-radius: 14px; background: #fcfefe; padding: 15px 18px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #667f8c; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--error); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 999px; padding: 15px 26px; font-weight: 800; min-height: 54px; transition: background .15s, transform .15s; }
.primary { background: var(--teal); color: #fff; }
.primary:hover:not(:disabled) { background: var(--teal-dark); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.button svg { width: 20px; height: 20px; flex-shrink: 0; }
#identify-button { flex-shrink: 0; }
.field-hint { font-size: .875rem; line-height: 1.5; margin: 10px 0 0; color: var(--muted); }
.verified-badge { padding: 5px 12px; border-radius: 999px; background: #dff3e8; color: #1c6e45; font-size: .875rem; font-weight: 800; margin-left: auto; }
.patient-welcome { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.patient-welcome > span { color: var(--muted); font-size: 1.125rem; }
.patient-welcome > strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.text-button { background: none; border: none; padding: 4px 0; text-decoration: underline; text-underline-offset: 4px; color: var(--teal-dark); font-size: .875rem; font-weight: 800; }
.patient-welcome .text-button { margin-left: auto; }
select { appearance: none; padding-right: 42px; 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='%230f3b52' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; line-height: 1.5; }
.attendance-details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; padding: 0; }
.attendance-details > div { background: var(--soft); border-radius: 16px; padding: 12px 16px; }
.attendance-details dt { color: var(--muted); font-size: .875rem; }
.attendance-details dd { margin: 2px 0 0; font-weight: 800; }
.locked-message { text-align: center; padding: 40px 20px 20px; color: #5d7a88; }
.locked-message svg { width: 27px; height: 27px; color: #789da8; }
.locked-message p { margin: 11px 0; font-size: .9375rem; line-height: 1.65; }
.locked-message strong { font-weight: 600; }

/* ── Avance fijo ────────────────────────────────────────────────────────────────────────────── */
.progress-wrap { position: sticky; top: 0; z-index: 5; margin: 20px -24px 0; padding: 12px 24px 10px; background: #eef6f7f5; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.progress-heading { display: flex; justify-content: space-between; gap: 12px; font-size: .875rem; margin: 0 2px 8px; color: var(--muted); }
#progress-label { white-space: nowrap; font-weight: 800; color: var(--teal-dark); }
progress { display: block; width: 100%; height: 10px; border: 0; border-radius: 999px; appearance: none; background: #d9e8ec; overflow: hidden; }
progress::-webkit-progress-bar { background: #d9e8ec; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--mint); border-radius: 999px; transition: width .25s; }
progress::-moz-progress-bar { background: var(--mint); border-radius: 999px; }
.required-note { color: var(--muted); font-size: .875rem; margin: 10px 2px 16px; }

/* ── Hoja de preguntas: una sola superficie, marcador numerado por pregunta y línea que se llena al responder ── */
.sheet { counter-reset: q; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 38px 36px 6px; box-shadow: var(--shadow); }
.question { counter-increment: q; position: relative; padding: 0 0 40px 64px; }
.question::before {
  content: counter(q); position: absolute; left: 0; top: 0; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.0625rem; background: #e3f1f3; color: var(--teal-dark);
  transition: background-color .2s, color .2s;
}
.question[data-done]::before {
  content: ''; background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 22px no-repeat;
}
.question::after { content: ''; position: absolute; left: 20px; top: 52px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--line); transition: background-color .3s; }
.question[data-done]::after { background: var(--mint); }
.question:not(:has(~ .question:not([hidden])))::after { display: none; }
.question h2 { margin: 0; padding-top: 6px; font-size: 1.375rem; font-weight: 800; line-height: 1.3; letter-spacing: -.015em; }
.question-description { font-size: .9375rem; color: var(--muted); line-height: 1.55; margin: 8px 0 0; }
.optional-badge { display: inline-block; vertical-align: 3px; margin-left: 6px; font-size: .8125rem; font-weight: 600; letter-spacing: 0; color: #4f6b7a; background: #e8f0f3; padding: 3px 11px; border-radius: 999px; }
#recommendation-options, #admission-options, #facility-options, #doctor-options { margin-top: 20px; }

/* Calificaciones */
.rating-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.rating-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.rating-option { display: flex; align-items: stretch; flex-direction: column; position: relative; min-width: 0; cursor: pointer; }
.rating-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.rating-surface { width: 100%; padding: 14px 6px 12px; border: 2px solid transparent; background: var(--soft); border-radius: 18px; display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 8px; height: 100%; transition: background-color .15s, border-color .15s; }
.rating-option:hover .rating-surface { background: #e8f3f5; }
.rating-option input:focus-visible + .rating-surface { outline: 3px solid var(--teal); outline-offset: 3px; }
.rating-option input:checked + .rating-surface { border-color: var(--leaf); background: #e2f4ea; }
.face-icon { width: clamp(40px, 6vw, 56px); height: auto; display: block; flex-shrink: 0; transition: transform .18s, filter .18s, opacity .18s; }
.rating-option input:checked + .rating-surface .face-icon { transform: scale(1.12); }
/* Al elegir una carita, las demás se apagan para que la respuesta se lea de un vistazo. */
.rating-options:has(input:checked) input:not(:checked) + .rating-surface .face-icon { filter: grayscale(.75); opacity: .5; }
.rating-options:has(input:checked) .rating-option:hover input:not(:checked) + .rating-surface .face-icon { filter: none; opacity: 1; }
.rating-label { font-size: .875rem; color: #456170; font-weight: 600; line-height: 1.25; text-align: center; }
.rating-option input:checked + .rating-surface .rating-label { color: #14573e; font-weight: 800; }
.rating-group.nps .rating-options { grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 6px; }
.nps .rating-surface { min-height: 54px; padding: 10px 0; border: 1.5px solid var(--field); border-radius: 16px; font-size: 1.125rem; font-weight: 800; background: #fff; }
.nps .rating-option:hover .rating-surface { border-color: var(--teal); background: #f1f9fa; }
.nps .rating-option input:checked + .rating-surface { border-color: var(--teal); background: var(--teal); color: #fff; }
.scale-endpoints { display: flex; justify-content: space-between; gap: 20px; margin-top: 12px; font-size: .875rem; color: var(--muted); }

/* Cómo nos conociste: etiquetas en píldora */
.channel-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.channel-option { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px 10px 14px; border: 1.5px solid var(--field); border-radius: 999px; background: #fff; cursor: pointer; font-size: 1rem; font-weight: 600; min-height: 48px; line-height: 1.3; transition: background-color .15s, border-color .15s; }
.channel-option:hover { border-color: var(--teal); }
.channel-option:has(input:checked) { background: #e4f4f6; border-color: var(--teal); color: var(--teal-dark); }
.channel-option:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 3px; }
.channel-option input { appearance: none; flex-shrink: 0; width: 22px; height: 22px; margin: 0; border: 1.5px solid #8fa9b5; border-radius: 50%; position: relative; background: #fff; }
.channel-option input:checked { border-color: var(--teal); background: var(--teal); }
.channel-option input:checked::after { content: ''; display: block; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.2px 2.2px 0; transform: rotate(45deg); position: absolute; left: 6.5px; top: 3px; }
.other-channel-field { margin-top: 20px; }

/* Personas evaluadas */
.person-block + .person-block { margin-top: 22px; }
.person-header { display: flex; gap: 14px; align-items: center; background: var(--soft); border-radius: 20px; padding: 14px 18px; margin-bottom: 14px; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; opacity: 0; transition: opacity .2s; }
.avatar img.loaded { opacity: 1; }
.avatar { position: relative; overflow: hidden; width: 56px; height: 56px; border-radius: 50%; background: #d4eaef; color: #1f566b; font-size: 1.125rem; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 0 0 3px #fff; }
.person-header h3 { font-size: 1.0625rem; margin: 0 0 4px; font-weight: 800; line-height: 1.3; }
.person-role { display: inline-block; color: var(--teal-dark); background: #dcf0f3; font-size: .8125rem; font-weight: 800; padding: 2px 11px; border-radius: 999px; }
.person-service { font-size: .875rem; line-height: 1.5; color: var(--muted); margin: 4px 0 0; }
.facility-block + .facility-block { margin-top: 26px; }
.facility-block h3 { font-size: 1.0625rem; margin: 0 0 12px; font-weight: 800; }
.facility-block .face-icon { width: clamp(36px, 5vw, 46px); }
.facility-block .rating-label { font-size: .8125rem; }

textarea { resize: vertical; min-height: 132px; line-height: 1.6; display: block; margin-top: 18px; border-radius: 18px; }
.character-count { font-size: .875rem; color: var(--muted); display: block; text-align: right; margin-top: 8px; }

/* Errores y envío */
.error-message { font-size: .875rem; font-weight: 600; color: var(--error); line-height: 1.5; margin: 12px 0 0; }
.rating-group[aria-invalid=true] .rating-options { border-radius: 14px; outline: 2px solid var(--error); outline-offset: 5px; }
.submit-error { border: 1px solid #efc6c4; background: #fff5f4; color: #92312f; border-radius: 16px; padding: 16px 18px; font-size: .9375rem; margin: 20px 0 0; line-height: 1.5; }
.submit-button { width: 100%; font-size: 1.1875rem; min-height: 62px; margin-top: 22px; }
.submit-note { color: var(--muted); text-align: center; font-size: .875rem; margin: 14px 0 0; }

/* ── Pantalla final ─────────────────────────────────────────────────────────────────────────── */
.completion { text-align: center; margin-top: 24px; padding: 44px 32px 36px; }
.success-icon { background: #dff5ef; border-radius: 50%; width: 76px; height: 76px; display: grid; place-items: center; color: var(--leaf); margin: 0 auto 22px; box-shadow: 0 0 0 10px #eef9f6; }
.success-icon svg { width: 40px; height: 40px; }
.completion h2 { font-size: 1.875rem; letter-spacing: -.025em; line-height: 1.2; margin: 0 auto 12px; max-width: 18ch; text-wrap: balance; font-weight: 800; }
.completion > p { color: var(--muted); line-height: 1.6; margin: 0 auto; max-width: 42ch; }
.completion .benefit-note { margin: 26px auto 18px; text-align: left; max-width: 460px; }

/* ── Pie ────────────────────────────────────────────────────────────────────────────────────── */
.site-footer { max-width: 760px; margin: 44px auto 0; border-top: 1px solid var(--line); padding: 24px 24px 34px; text-align: center; }
.footer-brand { display: block; width: 116px; height: auto; margin: 0 auto; }
.site-footer p { margin: 9px 0; font-size: .9375rem; color: var(--muted); }
.site-footer > span:last-child { color: #5e7985; font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Celular ────────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { padding: 18px 20px 8px; }
  .brand-logo { width: 150px; }
  main { padding: 0 16px; }
  .hero { margin: 14px auto 22px; }
  h1 { font-size: 2.1rem; }
  .hero > p { font-size: 1.0625rem; }
  .benefit-note { --notch: 11px; margin-top: 22px; }
  .benefit-amount { padding: 14px 14px 14px 24px; font-size: 3rem; }
  .benefit-text { padding: 12px 22px 12px 14px; font-size: .875rem; }
  .benefit-text strong { font-size: 1.125rem; }
  .card { padding: 22px 20px; border-radius: 20px; }
  .section-icon { width: 40px; height: 40px; }
  .dni-row { flex-direction: column; gap: 10px; }
  input[type=text], select, textarea { padding: 14px 16px; }
  .button { min-height: 54px; }
  .attendance-details { grid-template-columns: 1fr; gap: 8px; }
  .patient-welcome > strong { flex-basis: calc(100% - 48px); font-size: 1.375rem; }
  .patient-welcome .text-button { margin: 5px 0 0; }
  .progress-wrap { margin: 16px -16px 0; padding: 10px 16px 8px; }
  .progress-heading { margin-bottom: 7px; }
  /* Sin riel lateral: el marcador va sobre el título y toda la hoja queda para las respuestas. */
  .sheet { padding: 28px 20px 4px; border-radius: 20px; }
  .question { padding: 0 0 34px; }
  .question::before { position: static; margin-bottom: 12px; width: 36px; height: 36px; font-size: 1rem; }
  .question[data-done]::before { background-size: 19px; }
  .question::after { display: none; }
  .question h2 { padding-top: 0; font-size: 1.25rem; }
  .rating-group.nps .rating-options { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .nps .rating-surface { min-height: 48px; }
  .rating-options { gap: 4px; }
  .rating-surface { padding: 11px 2px 9px; border-radius: 14px; gap: 7px; }
  .face-icon { width: 40px; }
  .facility-block .face-icon { width: 36px; }
  .rating-label, .facility-block .rating-label { font-size: .75rem; }
  .person-header { padding: 12px 14px; }
  .completion { padding: 34px 20px 28px; }
  .completion h2 { font-size: 1.625rem; }
  .completion .benefit-note { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
