/* Red de Médicos por la Verdad · formulario (conciudadanos.net)
   Colores y tipografía del Manual de Identidad Corporativo (enero 2022). */
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-var.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
/* Banderas de países. Windows no trae emojis de banderas: esta fuente las dibuja solo para esos
   caracteres (unicode-range); el resto del texto sigue en Montserrat.
   Arte: Twemoji (Twitter, Inc. y colaboradores), CC BY 4.0 · fuente: country-flag-emoji-polyfill (MIT). */
@font-face {
  font-family: "Banderas";
  src: url("../fonts/banderas-twemoji.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
  font-display: swap;
}
:root {
  --azul: #0033A1;          /* Pantone 286 C */
  --azul-oscuro: #00257A;
  --azul-claro: #B8D8EB;    /* complementario */
  --azul-suave: #EEF4FA;
  --amarillo: #FFC557;
  --naranja-texto: #C23A00; /* naranja oficial oscurecido para texto (contraste 4.9:1) */
  --tinta: #14213D;
  --tinta-2: #44506A;
  --borde: #C9D3E3;
  --fondo: #F4F6FA;
  --blanco: #FFFFFF;
  --error: #B42318;
  --error-fondo: #FEF3F2;
  --ok: #157F3B;
  --radio: 12px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--tinta); background: var(--fondo); line-height: 1.55; font-size: 1rem; }
img { display: block; max-width: 100%; }
a { color: var(--azul); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; border-radius: 4px; }
.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; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--blanco); color: var(--azul); padding: .75rem 1rem; font-weight: 600; border-radius: 6px; }
.skip-link:focus { top: 1rem; }

/* ── Cabecera azul ── */
.cabecera { background: var(--azul); color: var(--blanco); padding: 1rem clamp(1rem, 4vw, 2rem) 4.5rem; }
.cabecera-in, .cabecera-titulo { max-width: 48rem; margin-inline: auto; }
.cabecera-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.volver { color: var(--blanco); text-decoration: none; font-size: .875rem; font-weight: 500; padding: .5rem 0; }
.volver:hover { text-decoration: underline; }
.cabecera-logo { width: 84px; height: auto; }
.cabecera-titulo { margin-top: 1.25rem; }
.eyebrow { margin: 0 0 .35rem; font-size: .72rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--amarillo); }
h1 { margin: 0; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); font-weight: 300; line-height: 1.15; }

.contenedor { max-width: 48rem; margin: -3.25rem auto 0; padding: 0 clamp(.75rem, 3vw, 1.5rem) 2rem; position: relative; }

/* ── Progreso ── */
.progreso { background: var(--blanco); border-radius: var(--radio) var(--radio) 0 0; padding: 1rem clamp(1rem, 4vw, 2.25rem) 0; position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 var(--borde); }
.progreso + .tarjeta { border-top-left-radius: 0; border-top-right-radius: 0; }
.progreso-texto { margin: 0 0 .6rem; font-size: .8rem; color: var(--tinta-2); }
.progreso-texto strong { color: var(--tinta); font-weight: 600; }
/* Una columna por sección activa (las apagadas quedan con [hidden]) */
.progreso-barra { list-style: none; margin: 0; padding: 0 0 1rem; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.progreso-barra li { height: 6px; border-radius: 3px; background: #DDE4EF; transition: background-color .3s; }
.progreso-barra li.hecho { background: var(--azul); }
.progreso-barra li.actual { background: linear-gradient(90deg, var(--azul) 50%, var(--azul-claro) 50%); }

/* ── Tarjeta ── */
.tarjeta { background: var(--blanco); border-radius: var(--radio); box-shadow: 0 10px 30px rgba(0, 37, 122, .08); padding: clamp(1.25rem, 4vw, 2.25rem); }
.paso h2 { display: flex; align-items: center; gap: .75rem; margin: 0 0 1.25rem; font-size: clamp(1.25rem, 1.1rem + .8vw, 1.6rem); font-weight: 600; color: var(--azul); line-height: 1.25; }
.paso h2:focus { outline: none; }
.num { flex: none; display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--azul); color: var(--blanco); font-size: 1rem; }
h3 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 600; color: var(--tinta); }
.intro { margin: 0 0 1.25rem; color: var(--tinta-2); }
.descripcion { margin: -.5rem 0 1.5rem; color: var(--tinta-2); font-size: .925rem; white-space: pre-line; }
.intro, .ayuda { white-space: pre-line; }
.grupo { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid #E4E9F2; }
.subgrupo { margin: -.25rem 0 1.25rem; padding: 1rem 1rem .25rem; background: var(--azul-suave); border-radius: 10px; border-left: 3px solid var(--azul-claro); }

.datos-rapidos { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.datos-rapidos li { background: var(--azul-suave); color: var(--tinta); border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; }
.aviso-privacidad { border: 1px solid var(--borde); border-radius: 10px; padding: 1rem 1.25rem; margin: 0 0 1.25rem; font-size: .875rem; color: var(--tinta-2); max-height: 15rem; overflow: auto; }
.aviso-privacidad h3 { font-size: .95rem; margin-bottom: .5rem; }
.aviso-privacidad p { margin: 0 0 .65rem; }

/* ── Campos ── */
.campo { margin: 0 0 1.25rem; min-width: 0; }
fieldset.campo { border: 0; padding: 0; }
label, legend, .etiqueta { display: block; font-weight: 600; font-size: .925rem; margin: 0 0 .4rem; color: var(--tinta); padding: 0; }
legend strong { color: var(--azul); }
.ayuda, .ayuda-inline { font-weight: 400; font-size: .8rem; color: var(--tinta-2); }
.ayuda { margin: -.15rem 0 .5rem; }
.req { font-weight: 400; color: var(--tinta-2); font-size: .8rem; }
.opc { font-weight: 400; color: var(--tinta-2); font-size: .8rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--tinta); background: var(--blanco);
  border: 1.5px solid var(--borde); border-radius: 8px; padding: .7rem .8rem; min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 7rem; }
select, select option { font-family: "Banderas", var(--font); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230033A1' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; padding-right: 2.25rem; }
select:disabled, input:disabled { background-color: #F1F3F7; color: #7A8499; }
input:hover, select:hover, textarea:hover { border-color: #9AABC8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(0, 51, 161, .18); }
.con-error input, .con-error select, .con-error textarea { border-color: var(--error); }
.error { margin: .35rem 0 0; font-size: .8rem; font-weight: 500; color: var(--error); }
.error:empty { display: none; }
.error::before { content: "⚠ "; }
.contador { margin: .25rem 0 0; font-size: .75rem; color: var(--tinta-2); text-align: right; }
.sugerencia { margin: .35rem 0 0; font-size: .85rem; color: var(--tinta-2); }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
/* Campos lado a lado alineados aunque una etiqueta ocupe dos líneas: la etiqueta crece y la caja queda abajo */
.fila-2:not(:has(> fieldset)) > div.campo { display: flex; flex-direction: column; }
.fila-2:not(:has(> fieldset)) > div.campo > label { flex: 1 0 auto; }
.fila-2:has(> fieldset) { align-items: start; }
.telefono { display: grid; grid-template-columns: minmax(9rem, 40%) 1fr; gap: .5rem; }

/* Foto */
.foto { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.foto-vista { flex: none; width: 112px; height: 112px; object-fit: cover; border-radius: 12px; border: 2px solid var(--azul-claro); background: var(--azul-suave); }
.foto-acciones { flex: 1 1 14rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; min-width: 0; }
input[type="file"] { max-width: 100%; font: inherit; font-size: .875rem; color: var(--tinta-2); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; font-size: .875rem; color: var(--azul); background: var(--blanco); border: 1.5px solid var(--azul); border-radius: 999px; padding: .55rem 1.1rem; min-height: 44px; margin-right: .75rem; cursor: pointer; transition: background-color .15s; }
input[type="file"]::file-selector-button:hover { background: var(--azul-suave); }
input[type="file"]:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }
.boton-quitar-foto { min-height: 44px; padding: .5rem 1rem; font-size: .875rem; }
.foto-estado { flex-basis: 100%; margin: 0; font-size: .78rem; color: var(--tinta-2); }
.foto-estado:empty { display: none; }
.con-error input[type="file"]::file-selector-button { border-color: var(--error); }

/* Opciones (tarjetas seleccionables) */
.opciones { display: grid; gap: .5rem; }
.opciones-linea { display: flex; flex-wrap: wrap; }
.opciones-rejilla { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.opcion { position: relative; display: flex; align-items: center; gap: .65rem; margin: 0; font-weight: 500; font-size: .925rem; cursor: pointer;
  border: 1.5px solid var(--borde); border-radius: 10px; padding: .7rem .9rem; min-height: 48px; background: var(--blanco); transition: border-color .15s, background-color .15s; }
.opciones-linea .opcion { padding-right: 1.25rem; flex: 1 1 8.5rem; }
.opcion:hover { border-color: #9AABC8; }
.opcion input { flex: none; width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--azul); }
.opcion:has(input:checked) { border-color: var(--azul); background: var(--azul-suave); }
.opcion:has(input:focus-visible) { outline: 3px solid var(--amarillo); outline-offset: 2px; }
.opcion small { display: block; font-weight: 400; color: var(--tinta-2); font-size: .8rem; }
.con-error .opcion { border-color: #F0B4AE; }
.casilla { display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; font-size: .9rem; line-height: 1.5; cursor: pointer; padding: .85rem 1rem; border: 1.5px solid var(--borde); border-radius: 10px; }
.casilla input { flex: none; width: 1.25rem; height: 1.25rem; margin: .1rem 0 0; accent-color: var(--azul); }
.casilla:has(input:checked) { border-color: var(--azul); background: var(--azul-suave); }

/* Repetidores */
.items { display: grid; gap: .75rem; }
.item { position: relative; border: 1px solid var(--borde); border-radius: 10px; padding: 1rem 1rem .1rem; background: #FBFCFE; }
.item-simple { display: flex; gap: .5rem; align-items: center; border: 0; padding: 0; background: none; }
.item-simple .combo, .item-simple > input { flex: 1; }
.item-titulo { margin: -.25rem 0 .6rem; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--azul); }
.quitar { position: absolute; top: .4rem; right: .4rem; width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 0; background: transparent; color: var(--tinta-2); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.item-simple .quitar { position: static; flex: none; width: 44px; height: 44px; }
.quitar:hover { background: var(--error-fondo); color: var(--error); }
.boton-agregar { margin-top: .6rem; }

/* Buscador */
.combo { position: relative; }
.combo-lista { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: .35rem; list-style: none; background: var(--blanco); border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 12px 28px rgba(20, 33, 61, .16); max-height: 18rem; overflow: auto; }
.combo-lista li { padding: .55rem .7rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.combo-lista li small { display: block; color: var(--tinta-2); font-size: .75rem; }
.combo-lista li[aria-selected="true"], .combo-lista li[role="option"]:hover { background: var(--azul-suave); }
.combo-lista .combo-libre { cursor: default; color: var(--tinta-2); font-size: .78rem; border-top: 1px solid #E4E9F2; margin-top: .25rem; border-radius: 0; }

/* ── Botones ── */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .7rem 1.4rem; border-radius: 999px; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; border: 1.5px solid transparent; transition: background-color .15s, color .15s, border-color .15s, transform .1s; }
.boton:active { transform: translateY(1px); }
.boton-principal { background: var(--azul); color: var(--blanco); }
.boton-principal:hover { background: var(--azul-oscuro); }
.boton-principal:disabled { opacity: .6; cursor: progress; }
.boton-secundario, .boton-agregar { background: var(--blanco); color: var(--azul); border-color: var(--azul); }
.boton-secundario:hover, .boton-agregar:hover { background: var(--azul-suave); }
.boton-agregar { min-height: 44px; padding: .5rem 1rem; font-size: .875rem; }
.enlace { background: none; border: 0; padding: 0; font: inherit; color: var(--azul); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 600; }
.acciones { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #E4E9F2; }
.acciones [data-siguiente] { margin-left: auto; min-width: 9rem; }
.guardado { font-size: .78rem; color: var(--tinta-2); }

/* ── Avisos ── */
.aviso { border-radius: 10px; padding: .85rem 1rem; font-size: .9rem; margin: 0 0 1.25rem; }
.aviso-info { background: var(--azul-suave); color: var(--tinta); border-left: 4px solid var(--azul); }
.aviso-error { background: var(--error-fondo); color: var(--error); border-left: 4px solid var(--error); margin-top: 1.25rem; }
.sin-autorizacion { border: 1px dashed var(--borde); border-radius: 10px; padding: 1.25rem; color: var(--tinta-2); }
.sin-autorizacion p { margin: 0 0 1rem; }
.borrador-aviso { font-size: .85rem; color: var(--tinta-2); margin: 1rem 0 0; }
.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ── Revisión ── */
.resumen { display: grid; gap: 1rem; }
.resumen-seccion { border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.resumen-cab { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--azul-suave); }
.resumen-cab h3 { margin: 0; font-size: .925rem; color: var(--azul); }
.resumen dl { margin: 0; }
.resumen dl > div { display: grid; grid-template-columns: 12rem 1fr; gap: .25rem 1rem; padding: .6rem 1rem; border-top: 1px solid #EEF1F6; font-size: .875rem; }
.resumen dt { color: var(--tinta-2); }
.resumen dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.resumen dd span { display: block; }

/* ── Resultado ── */
.resultado { text-align: center; padding-block: clamp(2rem, 6vw, 3.5rem); }
.resultado:focus { outline: none; }
.resultado h2 { margin: .75rem 0 .5rem; color: var(--azul); font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2rem); }
.resultado p { margin: 0 auto .75rem; max-width: 32rem; color: var(--tinta-2); }
.resultado-icono svg { width: 76px; height: 76px; margin: 0 auto; }
.resultado-icono circle { fill: var(--azul-suave); stroke: var(--azul); stroke-width: 2; }
.resultado-icono path { fill: none; stroke: var(--azul); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: trazo .6s var(--ease) .2s forwards; }
.codigo { font-size: clamp(1.75rem, 1.3rem + 2.5vw, 2.6rem); font-weight: 700; letter-spacing: .06em; color: var(--tinta) !important; background: var(--azul-suave); border: 2px dashed var(--azul-claro); border-radius: 12px; padding: .6rem 1.25rem; display: inline-block; margin: .25rem 0 1rem !important; user-select: all; font-variant-numeric: tabular-nums; }
.cuenta { margin-top: 2rem; padding-top: 1.75rem; border-top: 1px solid #E4E9F2; }
.cuenta-numero { font-size: 4rem; font-weight: 300; line-height: 1; color: var(--azul) !important; margin: 0 auto .25rem !important; font-variant-numeric: tabular-nums; }
.cuenta-numero.late { animation: late .9s var(--ease); }
.cuenta-texto { font-weight: 600; color: var(--tinta) !important; }
.cuenta-acciones { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1rem; }
@keyframes trazo { to { stroke-dashoffset: 0; } }
@keyframes late { from { transform: scale(1.25); opacity: .4; } to { transform: none; opacity: 1; } }

/* ── Pie ── */
.pie { text-align: center; font-size: .8rem; color: var(--tinta-2); padding: 0 1rem 2rem; }
.pie p { margin: 0; }
.pie .credito { margin-top: .35rem; font-size: .7rem; opacity: .8; }

/* ── Móvil ── */
@media (max-width: 640px) {
  .fila-2 { grid-template-columns: 1fr; }
  .telefono { grid-template-columns: 1fr; }
  .opciones-rejilla { grid-template-columns: 1fr; }
  .opciones-linea .opcion { flex: 1 1 auto; }
  .resumen dl > div { grid-template-columns: 1fr; }
  .acciones { position: sticky; bottom: 0; background: var(--blanco); margin-inline: calc(-1 * clamp(1.25rem, 4vw, 2.25rem)); padding: .75rem clamp(1.25rem, 4vw, 2.25rem); box-shadow: 0 -6px 16px rgba(20, 33, 61, .06); }
  .guardado { display: none; }
  .cabecera-logo { width: 64px; }
  .foto { align-items: flex-start; }
  .foto-vista { width: 88px; height: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .resultado-icono path { stroke-dashoffset: 0; }
}

/* ── Aviso de privacidad ── */
.texto-legal h2 { font-size: 1.05rem; color: var(--azul); margin: 1.75rem 0 .5rem; }
.texto-legal h2:first-of-type { margin-top: .75rem; }
.texto-legal p, .texto-legal li { color: var(--tinta-2); font-size: .95rem; }
.texto-legal ul { padding-left: 1.25rem; }

/* Tras enviar: cabecera compacta para que el código y la cuenta regresiva quepan en pantalla */
.enviado .cabecera { padding-bottom: 3.5rem; }
.enviado .cabecera-titulo { display: none; }
.enviado .resultado { padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.enviado .resultado-icono svg { width: 60px; height: 60px; }
.enviado .cuenta { margin-top: 1.25rem; padding-top: 1.25rem; }
