/* Formulario de alta de Sinkroniza Pass (fase 3a-2). Tokens y recetas: skill marca-sinkroniza-pass
   (references/tokens.md, componentes.md, formulario-alta.md). Sin nada en línea: la CSP es default-src 'self'. */

:root {
  --pass-verde: #43BF92;
  --sk-azul: #0400DC;
  --sk-cian: #0FEAE3;
  --degradado-escenario: linear-gradient(135deg, var(--sk-cian), var(--sk-azul));
  --verde-texto: #147A55;
  --verde-texto-hover: #0F6344;
  --verde-boton-1: #15805A;
  --verde-boton-2: #137552;
  --degradado-boton: linear-gradient(100deg, var(--verde-boton-1), var(--verde-boton-2));
  --verde-profundo: #1E5E46;
  --verde-tinte: #E8F7F1;
  --verde-tinte-borde: #CDEBDD;
  --verde-elegido: #F3FBF8;         /* fondo de una tarjeta de opción elegida (portada) */
  --foco: 0 0 0 2px var(--fondo), 0 0 0 4px var(--verde-texto);
  --foco-escenario: 0 0 0 2px var(--fondo), 0 0 0 4px rgba(2, 10, 90, .6);
  --tinta: #000223;
  --texto-2: #5A6B78;
  --texto-tenue: #637480;
  --fondo: #FFFFFF;
  --fondo-sutil: #F6F9FA;
  --borde: #E3EAEE;
  --borde-campo: #7F919C;
  --aviso-fondo: #FBF3E0;  --aviso-texto: #8A5A00;
  --error-fondo: #FDECEA;  --error-texto: #B3261E;  --error-borde: #F6D4D1;
  --radio-control: 9px;
  --radio-tarjeta: 10px;
  --radio-acceso: 16px;
  --sombra-acceso: 0 12px 40px rgba(2, 10, 90, .22);
  --sombra-hover: 0 4px 14px rgba(2, 10, 90, .08);
  --capa-escenario: rgba(2, 10, 90, .35);
  --fuente: 'Archia', 'Montserrat', system-ui, sans-serif;  /* Archia cuando haya licencia para este dominio */
  --transicion: .15s ease-out;
}

/* Montserrat (OFL, fuentes/OFL.txt), alojada aquí: la CSP no deja cargar fuentes de fuera y a Google no se le pregunta
   por cada visitante. Archia va delante en la pila para cuando haya licencia del dominio (skill marca-sinkroniza-pass). */
@font-face {
  font-family: 'Montserrat'; src: url('/estaticos/fuentes/montserrat-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--fuente); color: var(--tinta); background: var(--sk-azul); }

.solo-lectores {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* Escenario + tarjeta de acceso (variante ancha) */
.escenario {
  min-height: 100vh; min-height: 100svh; background: var(--degradado-escenario);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px;
}
.tarjeta-acceso {
  width: 100%; max-width: 640px; background: var(--fondo); border-radius: var(--radio-acceso);
  box-shadow: var(--sombra-acceso); padding: 36px 32px;
}
.tarjeta-acceso.estrecha { max-width: 440px; }
.logo { display: block; margin: 0 auto 22px; width: 200px; height: auto; }
h1 { font-size: 22px; font-weight: 700; text-align: center; margin: 0 0 6px; line-height: 1.3; }
h1:focus { outline: 2px solid transparent; }
.subtitulo { font-size: 16px; color: var(--texto-2); text-align: center; margin: 0 0 24px; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
p { margin: 0 0 12px; }

a { color: var(--verde-texto); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--verde-texto-hover); }
a:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--foco); border-radius: 3px; }

/* Bloques y campos */
fieldset { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
legend { font-size: 18px; font-weight: 700; padding: 0; margin: 0 0 14px; }
.leyenda { font-size: 15px; color: var(--texto-2); margin: 0 0 20px; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.campo { margin-bottom: 16px; }
.campo label { display: block; font: 600 15px/1.3 var(--fuente); margin-bottom: 6px; }
.campo input {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--borde-campo); border-radius: var(--radio-control);
  background: var(--fondo); color: var(--tinta); font: 400 16px var(--fuente);
  transition: border-color var(--transicion), box-shadow var(--transicion);
}
.campo input:focus-visible {
  outline: 2px solid transparent; outline-offset: 2px; border-color: var(--verde-texto); box-shadow: var(--foco);
}
.campo input[aria-invalid="true"] { border-color: var(--error-texto); }
.ayuda { font-size: 15px; color: var(--texto-2); margin: 6px 0 0; }
.error { font-size: 15px; color: var(--error-texto); margin: 6px 0 0; font-weight: 600; }
.obligatorio::after { content: " *"; content: " *" / ""; color: var(--error-texto); }  /* el lector no dice «asterisco»: ya hay required */

/* Casillas legales: 22 px y la etiqueta entera clicable (objetivo ≥ 44 px) */
.casilla { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; cursor: pointer; }
.casilla input { accent-color: var(--verde-boton-2); width: 22px; height: 22px; flex: none; margin: 0; }
.casilla input:focus-visible { outline: 2px solid var(--verde-texto); outline-offset: 2px; }  /* Safari no pinta sombras en casillas nativas */
.casilla-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.casilla-fila .error { flex-basis: 100%; margin-top: 0; }
.casilla-fila > a { font-size: 15px; display: inline-flex; align-items: center; min-height: 44px; }

/* Precio */
.precio {
  background: var(--fondo-sutil); border: 1px solid var(--borde); border-radius: var(--radio-tarjeta);
  padding: 14px 16px; margin-top: 4px;
}
.precio .total { font-size: 20px; font-weight: 700; }
.precio .detalle { font-size: 15px; color: var(--texto-2); margin: 4px 0 0; }

/* Tabla de planes (tarifa 2026) */
.planes { margin-top: 12px; }
.planes summary { cursor: pointer; font-size: 15px; font-weight: 600; color: var(--verde-texto); padding: 11px 0; }
.planes summary:focus-visible { outline: 2px solid transparent; box-shadow: var(--foco); border-radius: 4px; }
.planes .detalle { font-size: 15px; color: var(--texto-2); margin: 4px 0 8px; }
.planes-tabla { max-height: 320px; overflow-y: auto; border: 1px solid var(--borde); border-radius: var(--radio-tarjeta); }
.planes table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.planes th, .planes td { padding: 6px 12px; text-align: right; border-bottom: 1px solid var(--borde); }
.planes th:first-child, .planes td:first-child { text-align: left; }
.planes thead th { position: sticky; top: 0; background: var(--fondo-sutil); }
.planes-tabla:focus-visible { outline: 2px solid transparent; box-shadow: var(--foco); }
.planes tr.actual th, .planes tr.actual td { font-weight: 700; background: var(--fondo-sutil); }

/* Resumen de errores y avisos */
.resumen-errores {
  background: var(--error-fondo); border: 1px solid var(--error-borde); border-radius: var(--radio-tarjeta);
  padding: 14px 16px; margin: 0 0 24px; color: var(--error-texto);
}
.resumen-errores h2 { color: var(--error-texto); font-size: 16px; }
.resumen-errores h2:focus { outline: 2px solid transparent; }
.resumen-errores ul { margin: 0; padding-left: 20px; }
.resumen-errores a { color: var(--error-texto); }
.aviso {
  background: var(--aviso-fondo); color: var(--aviso-texto); border-radius: var(--radio-tarjeta);
  padding: 12px 16px; margin: 0 0 16px; font-weight: 600;
}
.aviso:empty { display: none; }
.aviso-ok { background: var(--verde-tinte); color: var(--verde-profundo); }
.aviso-error { background: var(--error-fondo); color: var(--error-texto); border: 1px solid var(--error-borde); }
.total-final { font-weight: 700; text-align: center; margin: 0 0 12px; }
.estado h2:focus { outline: 2px solid transparent; }
.cargando { text-align: center; color: var(--texto-2); }

/* Botón primario */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radio-control); font: 600 16px/1.2 var(--fuente); cursor: pointer;
  transition: filter var(--transicion);
}
.boton:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--foco); }
.boton-primario { background: var(--degradado-boton); border: 1px solid var(--verde-boton-2); color: var(--fondo); }
.boton-primario:not([disabled]):not([aria-busy="true"]):hover { filter: brightness(.94); }  /* aclarar bajaba a 4,45:1 */
.boton-primario.ancho { width: 100%; min-height: 48px; }
.boton[aria-busy="true"] { cursor: progress; }   /* cargando: opacidad 1, el texto se lee */
.girando {
  width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: var(--fondo); border-radius: 50%;
  animation: girar .8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.confianza { font-size: 15px; color: var(--texto-2); text-align: center; margin: 16px 0 0; }

/* Campo trampa: fuera de la vista (no display:none, que algunos bots detectan) */
.trampa { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Pie fuera de la tarjeta, sobre el degradado, con la capa (≥ 7,5:1) */
.pie {
  margin-top: 24px; padding: 6px 12px; border-radius: var(--radio-control); background: var(--capa-escenario);
  color: var(--fondo); font-size: 15px; text-align: center;
}
.pie a { color: var(--fondo); }
.pie a:focus-visible { box-shadow: var(--foco-escenario); }

@media (max-width: 480px) {
  .escenario { padding: 16px; }
  .tarjeta-acceso { padding: 28px 20px; }
  .fila { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Bloque 4, cond. 5: lo inyecta el servidor con textos legales de borrador (api/main.py, AVISO_PRUEBAS). */
/* En el flujo y arriba (no fija): con zoom o en 320 px crece y empuja el contenido, nunca lo tapa (WCAG 1.4.4, 2.4.11). */
body[data-pruebas] { justify-content: flex-start; padding-top: 0; }
.aviso-pruebas { position: relative; z-index: 2; align-self: stretch; box-sizing: border-box; margin: 0 -20px 32px; padding: 10px 16px;
  background: #FFF4CC; color: #3D2E00; border-bottom: 2px solid #B38600; font-weight: 400; text-align: center; }
@media (max-width: 480px) { .aviso-pruebas { margin: 0 -16px 16px; } }

/* ---- Portada y formulario con la firma de Pass (🎯 Pablo, 11/10: «más Sinkroniza Pass») ----
   Tarjeta blanca sobre el degradado de escenario (como el login de la app), verde Pass en iconos, selección y botón. */
.fondo-adornos { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }  /* nunca ensancha la página */
.adorno { position: absolute; border-radius: 50%; }
.adorno-1 { left: -160px; bottom: -220px; width: 560px; height: 560px; border: 70px solid rgba(67, 191, 146, .35); }
.adorno-2 { right: -120px; top: -140px; width: 420px; height: 420px; background: rgba(2, 10, 90, .18); }
.tarjeta-acceso { position: relative; z-index: 1; }
.pie { position: relative; z-index: 1; }
.tarjeta-acceso.portada { max-width: 760px; padding: 40px 48px 30px; }
.tarjeta-acceso.ancha { max-width: 1120px; padding: 32px 40px 40px; }

.cabecera-alta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 26px; }
.logo-cabecera { margin: 0; width: 160px; }
.paso-pastilla {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 12px; border-radius: 999px;
  background: var(--verde-tinte); color: var(--verde-profundo); font-size: 13px; font-weight: 600;
}
.paso-pastilla .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--pass-verde); }
.portada h1, .ancha h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.12; text-align: left; margin: 0 0 8px; }
.portada .subtitulo, .ancha .subtitulo { text-align: left; font-size: 17px; margin: 0 0 24px; }

/* Las dos tarjetas de tipo: el radio real, oculto a la vista pero no al teclado ni al lector */
.opciones-tipo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 16px; }
.opciones-tipo .error { grid-column: 1 / -1; margin: 0; }
.opcion-tipo {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px; min-height: 210px; cursor: pointer;
  border: 1px solid var(--borde); border-radius: 14px; background: var(--fondo);
  transition: border-color var(--transicion), background var(--transicion), box-shadow var(--transicion);
}
.opcion-tipo:hover { border-color: var(--verde-tinte-borde); box-shadow: var(--sombra-hover); }
/* El radio real es el círculo que se ve: foco y marca no dependen de :has() ni de sombras (alto contraste de Windows) */
.opcion-tipo input {
  appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 0; cursor: pointer;
  border: 2px solid var(--borde-campo); border-radius: 50%; background: var(--fondo);
}
.opcion-tipo input:checked { border-color: var(--verde-boton-2); background: radial-gradient(var(--verde-boton-2) 0 5px, transparent 6px); }
.opcion-tipo input:focus-visible { outline: 2px solid var(--verde-texto); outline-offset: 2px; }
.opcion-tipo:has(input:checked) { border: 2px solid var(--verde-boton-2); background: var(--verde-elegido); padding: 21px; }
.opcion-cabeza { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.opcion-icono { width: 56px; height: 56px; border-radius: 50%; background: var(--verde-tinte); display: grid; place-items: center; }
@media (forced-colors: active) {
  .opcion-tipo input:checked { background: Highlight; border-color: Highlight; forced-color-adjust: none; }
}
.opcion-titulo { font-size: 19px; font-weight: 700; line-height: 1.25; }
.opcion-texto { font-size: 15px; line-height: 1.45; color: var(--texto-2); }
.opcion-etiqueta {
  align-self: flex-start; margin-top: auto; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  color: var(--verde-profundo); background: var(--verde-tinte); padding: 4px 10px; border-radius: 999px;
}
.nota-pais { font-size: 14px; line-height: 1.5; color: var(--texto-2); background: var(--fondo-sutil); border-radius: var(--radio-tarjeta); padding: 12px 14px; margin: 0 0 16px; }
.portada .boton-primario.ancho { min-height: 54px; font-size: 17px; font-weight: 700; }

/* Garantías con su marca verde */
.garantias { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--texto-2); }
.garantias li { display: flex; align-items: center; gap: 8px; }
.garantias li::before { content: ""; width: 16px; height: 16px; flex: none; background: var(--verde-texto); clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 37% 70%); }
.garantias li.sin-marca::before { display: none; }
.garantias.en-fila { flex-direction: row; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--borde); font-size: 13px; }

/* Formulario: pasos, etiqueta del tipo, bloques con icono y resumen a la derecha */
.pasos { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--texto-2); flex-wrap: wrap; }
.pasos li { display: flex; align-items: center; gap: 8px; }
.pasos li + li::before { content: ""; width: 28px; height: 2px; background: var(--borde); }
.pasos .paso-num { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--borde); display: grid; place-items: center; font-size: 13px; }
.pasos .hecho { color: var(--verde-texto); }
.pasos .hecho .paso-num { background: var(--verde-boton-2); border-color: var(--verde-boton-2); color: var(--fondo); }
.pasos [aria-current="step"] { color: var(--tinta); }
.pasos [aria-current="step"] .paso-num { background: var(--verde-tinte); border-color: var(--verde-boton-2); color: var(--verde-profundo); }
.chip-tipo { display: inline-block; margin: 0 0 10px; padding: 5px 12px; border-radius: 999px; background: var(--verde-tinte); color: var(--verde-profundo); font-size: 13px; font-weight: 700; }

.alta-columnas { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.bloque { border: 1px solid var(--borde); border-radius: 14px; padding: 24px; margin: 0 0 20px; }
.bloque legend { display: flex; align-items: center; gap: 12px; float: left; width: 100%; margin: 0 0 18px; font-size: 19px; }
.bloque legend + * { clear: both; }
.bloque legend.obligatorio::after { margin-left: -8px; }
.bloque legend + .ayuda { margin-bottom: 14px; }
.icono-bloque { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--verde-tinte); display: grid; place-items: center; }
.alta-resumen { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }
.resumen-tarjeta { border-radius: 14px; overflow: hidden; border: 1px solid var(--borde); box-shadow: var(--sombra-acceso); padding: 22px 22px 24px; border-top: 8px solid var(--pass-verde); }
.resumen-titulo { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-tenue); margin: 0 0 10px; }
.resumen-tarjeta .precio { background: transparent; border: 0; padding: 0; margin: 0 0 14px; }
.resumen-tarjeta .precio .total { font-size: 24px; font-weight: 800; color: var(--verde-texto); }
.resumen-tarjeta .total-final { display: none !important; }  /* el total ya está arriba, en el precio */
.ancha .boton-primario.ancho { min-height: 54px; font-size: 17px; font-weight: 700; }

@media (max-width: 900px) {
  .alta-columnas { grid-template-columns: minmax(0, 1fr); }
  .alta-resumen { position: static; }
}
@media (max-width: 640px) {
  .tarjeta-acceso.portada, .tarjeta-acceso.ancha { padding: 26px 18px 22px; }
  .portada h1, .ancha h1 { font-size: 26px; }
  .opciones-tipo { grid-template-columns: minmax(0, 1fr); }
  .opcion-tipo { min-height: 0; }
  .garantias.en-fila { flex-direction: column; }
  .bloque { padding: 18px 16px; }
  .fila { grid-template-columns: minmax(0, 1fr); }
  .casilla-fila > a { margin-left: 32px; margin-top: -8px; }
  .pasos li:not([aria-current]) .paso-texto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .pasos li + li::before { width: 16px; }
  .adorno-1 { width: 360px; height: 360px; border-width: 48px; left: -120px; bottom: -150px; }
}

/* Textos legales (D5, 15/10): ancho de lectura, jerarquía de títulos y tablas. Las marcas .r-* solo existen mientras
   el texto está en revisión (Pablo y la abogada) y se quitan antes de publicar la versión. */
.tarjeta-acceso.texto-legal { max-width: 760px; padding: 36px 44px 40px; line-height: 1.6; }
.texto-legal h1 { margin-bottom: 4px; }
.texto-legal .fecha-legal { text-align: center; color: var(--texto-2); margin: 0 0 24px; font-size: 14px; }
.texto-legal h2 { margin: 28px 0 8px; }
.texto-legal h3 { font-size: 16px; font-weight: 700; margin: 20px 0 6px; }
.texto-legal p, .texto-legal li { font-size: 16px; }
.texto-legal ul, .texto-legal ol { padding-left: 22px; }
.texto-legal a { color: var(--verde-texto); }
.texto-legal .tabla-legal { width: 100%; overflow-x: auto; }
/* En móvil la tabla se desliza: con foco de teclado (tabindex en el HTML) y su contorno (accessibility-review de D5, 25/10). */
.texto-legal .tabla-legal:focus-visible { outline: 2px solid var(--verde-texto); outline-offset: 2px; }
.texto-legal table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 16px; }
.texto-legal th, .texto-legal td { border: 1px solid var(--borde); padding: 8px 10px; text-align: left; vertical-align: top; }
.texto-legal th { background: var(--fondo-sutil); }
.texto-legal .indice { background: var(--fondo-sutil); border-radius: var(--radio-tarjeta); padding: 12px 18px; }
.revision-banner { background: var(--aviso-fondo); color: var(--aviso-texto); border-radius: var(--radio-tarjeta); padding: 12px 16px; margin: 0 0 20px; font-size: 15px; }
.r-nuevo { background: #E8F0FF; color: inherit; border-bottom: 2px solid #4A63D9; }
.r-pregunta { background: var(--aviso-fondo); color: var(--aviso-texto); font-weight: 600; }
.r-pregunta::before { content: "❓ "; }
@media (max-width: 640px) {
  .tarjeta-acceso.texto-legal { padding: 26px 18px 28px; }
}
