/* ==========================================================================
   COTIZADOR GASTOS MÉDICOS MAYORES — estilos
   Mobile first · fondo blanco · azul profundo principal · un solo acento (ámbar)
   ========================================================================== */
:root {
  --azul-900: #0B2545;      /* texto principal y títulos */
  --azul-700: #13407A;      /* botones y selección */
  --azul-600: #1B5299;
  --azul-100: #E6EEF8;
  --azul-50: #F3F7FC;
  --acento: #F2A516;        /* ámbar: lo que pagas tú */
  --acento-suave: #FFF4DC;
  --texto: #1D2733;
  --texto-2: #52606D;       /* contraste AA sobre blanco */
  --linea: #DCE3EB;
  --blanco: #FFFFFF;
  --error: #B42318;
  --radio: 16px;
  --radio-lg: 22px;
  --sombra: 0 1px 2px rgba(11, 37, 69, 0.06), 0 8px 24px -12px rgba(11, 37, 69, 0.18);
  --fuente: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --curva: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--blanco);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--azul-700); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
h1:focus, h1:focus-visible { outline: none; }

.app {
  min-height: 100vh;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

/* ---------- Barra superior y progreso ---------- */
.barra-superior {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  grid-template-areas: "atras marca ." "progreso progreso progreso";
  align-items: center;
  row-gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 0 12px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.btn-atras {
  grid-area: atras;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--azul-50);
  color: var(--azul-900);
}
.btn-atras:hover { background: var(--azul-100); }
.marca {
  grid-area: marca;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--azul-900);
}
.progreso { grid-area: progreso; display: grid; gap: 6px; }
.progreso-texto { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.progreso-pista { height: 6px; border-radius: 99px; background: var(--azul-100); overflow: hidden; }
.progreso-relleno { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--azul-700); transition: width 0.4s var(--curva); }

/* ---------- Pantallas ---------- */
.pantalla { flex: 1; padding: 12px 0 24px; }
.pantalla.entra { animation: entra 0.35s var(--curva); }
@keyframes entra {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.pregunta {
  margin: 8px 0 16px;
  font-size: clamp(24px, 6.4vw, 30px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--azul-900);
  text-wrap: balance;
}
.ayuda { margin: -6px 0 16px; color: var(--texto-2); font-size: 15px; }
.nota { margin: 14px 0 0; font-size: 14px; color: var(--texto-2); }
.error { min-height: 1.5em; margin: 12px 0 0; color: var(--error); font-size: 15px; font-weight: 600; }
.subtitulo { margin: 28px 0 12px; font-size: 18px; color: var(--azul-900); }

/* ---------- Opciones como tarjetas ---------- */
.opciones { display: grid; gap: 10px; }
.opcion {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 14px 16px;
  border: 2px solid var(--linea);
  border-radius: var(--radio);
  background: var(--blanco);
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--curva);
  -webkit-tap-highlight-color: transparent;
}
.opcion:hover { border-color: var(--azul-600); }
.opcion:active { transform: scale(0.99); }
.opcion[aria-checked="true"] { border-color: var(--azul-700); background: var(--azul-50); }
.opcion-marca {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid #9AA8B6;
  border-radius: 50%;
  transition: border 0.2s, background 0.2s;
}
.opcion[aria-checked="true"] .opcion-marca { border: 7px solid var(--azul-700); }
.opcion-texto { display: flex; flex-direction: column; gap: 2px; }
.opcion-etiqueta { font-weight: 700; color: var(--azul-900); }
.opcion-detalle { font-size: 14px; color: var(--texto-2); }

/* ---------- Personas ---------- */
.personas { margin-top: 24px; display: grid; gap: 12px; }
.personas .ayuda { margin: 0; }
.persona {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--azul-50);
}
.persona legend { padding: 0 6px; font-weight: 700; color: var(--azul-900); }
.campo-edad { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--texto-2); }
.campo-edad input {
  width: 96px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1.5px solid var(--linea);
  border-radius: 12px;
  background: var(--blanco);
  font-size: 18px;
  font-weight: 700;
  -moz-appearance: textfield;
}
.campo-edad input::-webkit-outer-spin-button,
.campo-edad input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sexo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sexo button {
  min-height: 48px;
  border: 1.5px solid var(--linea);
  border-radius: 12px;
  background: var(--blanco);
  font-weight: 700;
  color: var(--azul-900);
}
.sexo button[aria-checked="true"] { border-color: var(--azul-700); background: var(--azul-700); color: var(--blanco); }
.quitar {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--texto-2);
}
.quitar:hover { background: var(--azul-100); }

/* ---------- Campos ---------- */
.campos { display: grid; gap: 16px; }
.campo { display: grid; gap: 6px; font-weight: 600; color: var(--azul-900); font-size: 15px; }
.campo input, .campo select, .con-prefijo {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--linea);
  border-radius: 14px;
  background: var(--blanco);
  font-size: 17px;
  font-weight: 500;
  color: var(--texto);
}
.campo input:focus, .campo select:focus { border-color: var(--azul-700); outline: none; box-shadow: 0 0 0 4px rgba(19, 64, 122, 0.15); }
.con-prefijo { display: flex; align-items: center; gap: 10px; padding: 0 0 0 14px; }
.con-prefijo > span { font-weight: 700; color: var(--texto-2); }
.con-prefijo input { border: 0; min-height: 48px; padding-left: 0; box-shadow: none !important; }
.con-prefijo:focus-within { border-color: var(--azul-700); box-shadow: 0 0 0 4px rgba(19, 64, 122, 0.15); }
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radio);
  background: var(--azul-50);
  font-size: 15px;
  cursor: pointer;
}
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--azul-700); }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 22px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s var(--curva);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primario { background: var(--azul-700); color: var(--blanco); }
.btn-primario:hover { background: var(--azul-900); }
.btn-secundario { background: var(--azul-50); color: var(--azul-700); border: 1.5px dashed #9FB6D3; }
.btn-grande { width: 100%; min-height: 58px; margin-top: 20px; font-size: 18px; }
.enlace { display: block; margin: 24px auto 0; border: 0; background: none; color: var(--azul-700); font-weight: 600; text-decoration: underline; }

/* ---------- Portada ---------- */
.portada { display: flex; flex-direction: column; justify-content: center; min-height: 62vh; gap: 16px; }
.portada-titulo {
  margin: 0;
  font-size: clamp(34px, 9.5vw, 48px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--azul-900);
  text-wrap: balance;
}
.portada-sub { margin: 0; font-size: 19px; color: var(--texto-2); max-width: 36ch; }
.portada-sub .acento { color: var(--azul-900); font-weight: 700; }
.saludo-texto { margin: -4px 0 12px !important; color: var(--texto-2); }

/* ---------- Capa 1 ---------- */
.capa1 { display: grid; gap: 16px; }
.techo-card {
  padding: 26px 22px;
  border-radius: var(--radio-lg);
  background: var(--azul-900);
  color: var(--blanco);
  box-shadow: var(--sombra);
}
.techo-titulo { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.35; }
.techo-monto {
  margin: 10px 0 6px;
  font-size: clamp(48px, 15vw, 72px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--acento);
  font-variant-numeric: tabular-nums;
}
.techo-desglose { margin: 0; font-size: 14px; color: #C9D6E6; }
.resto { margin: 0; font-weight: 600; color: var(--azul-900); }

/* ---------- Capa 2 ---------- */
.capa2 { display: grid; gap: 14px; }
.bloque {
  padding: 20px 18px;
  border: 1px solid var(--linea);
  border-radius: var(--radio-lg);
  background: var(--blanco);
}
.bloque h1, .bloque h2 { margin: 0 0 12px; color: var(--azul-900); line-height: 1.2; }
.bloque h1 { font-size: 26px; font-weight: 800; }
.bloque h2 { font-size: 20px; font-weight: 800; }
.bloque p { margin: 0 0 10px; }
.bloque p:last-child { margin-bottom: 0; }
.saludo { background: var(--azul-50); border-color: transparent; }
.resumen { display: grid; gap: 8px; margin: 0; }
.resumen div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linea); }
.resumen dt { color: var(--texto-2); }
.resumen dd { margin: 0; font-weight: 700; color: var(--azul-900); text-align: right; font-variant-numeric: tabular-nums; }
.resumen .resumen-techo { border-bottom: 0; align-items: baseline; }
.resumen .resumen-techo dd { font-size: 24px; color: var(--azul-700); }

.escenarios { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.escenario-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.escenario-cab strong { color: var(--azul-900); }
.escenario-total { font-weight: 800; color: var(--azul-900); white-space: nowrap; font-variant-numeric: tabular-nums; }
.barra-reparto { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--azul-700); }
.parte-cliente { background: var(--acento); }
.parte-aseguradora { flex: 1; }
.escenario-pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 8px; font-size: 14px; color: var(--texto-2); }
.escenario-pie strong { color: var(--texto); font-variant-numeric: tabular-nums; }
.punto { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; vertical-align: 0; }
.punto-cliente { background: var(--acento); }
.punto-aseguradora { background: var(--azul-700); }
.escenario-nota { margin: 8px 0 0 !important; padding: 10px 12px; border-radius: 12px; background: var(--acento-suave); font-size: 14px; }
.fuente { margin-top: 14px !important; font-size: 13px; color: var(--texto-2); }

.hitos { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.hito { position: relative; display: grid; gap: 2px; padding: 0 0 16px 22px; border-left: 2px solid var(--azul-100); margin-left: 6px; }
.hito:last-child { padding-bottom: 0; border-left-color: transparent; }
.hito::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blanco);
  border: 3px solid var(--azul-700);
}
.hito-fecha { font-size: 13px; font-weight: 700; color: var(--azul-700); }
.hito-titulo { color: var(--azul-900); }
.hito-items { font-size: 14px; color: var(--texto-2); }

.bloque-ruta { background: var(--acento-suave); border-color: transparent; }
.lista { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.lista li { position: relative; padding-left: 28px; }
.lista li::before { position: absolute; left: 0; top: 0; font-weight: 800; }
.lista-si li::before { content: "✓"; color: var(--azul-700); }
.lista-no li::before { content: "✕"; color: var(--texto-2); }

.cierre { border: 2px solid var(--azul-700); }
.calendario { display: block; width: 100%; height: 700px; margin-top: 8px; border: 0; border-radius: 12px; background: var(--azul-50); }
.enlace-calendario { display: inline-block; margin-top: 12px; font-weight: 700; }

.legal { margin: 8px 4px 0; font-size: 12px; line-height: 1.5; color: var(--texto-2); }

/* ---------- Filtro de edad ---------- */
.filtro p { color: var(--texto-2); }

/* ---------- Pie ---------- */
.pie {
  padding: 16px 0 8px;
  border-top: 1px solid var(--linea);
  font-size: 12px;
  line-height: 1.5;
  color: var(--texto-2);
  text-align: center;
}
.sin-js { max-width: 640px; margin: 24px auto; padding: 0 16px; }

@media (min-width: 640px) {
  .app { padding-left: 24px; padding-right: 24px; }
  .opciones-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opciones-3 .opcion { align-items: flex-start; }
  .persona { grid-template-columns: auto 1fr; align-items: center; }
  .persona legend { grid-column: 1 / -1; }
  .calendario { height: 760px; }
}

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