/* =====================================================================
   Portal de acceso · Gestión de Compras
   Login, activación de cuenta y "Mi cuenta". Se carga DESPUÉS de marca.css y usa su identidad:
   fondo azul de marca con sello de agua, encabezado con logos, etiqueta roja, tarjetas blancas
   con borde rojo superior (igual que las herramientas). Animaciones suaves; respeta "reducir movimiento".
   Sin estilos en línea (la página usa una CSP estricta).
   ===================================================================== */
:root {
  --verde-ok: #2e8f2a;
  --ambar: #b7791f;
  --campo: #f7f9fc;
}

* { box-sizing: border-box; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font: 14px/1.5 var(--corp-font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
.oculto { display: none !important; }
.solo-lector {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Red animada sobre el fondo de marca ---------- */
.escena { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.escena canvas { width: 100%; height: 100%; }
.corp-header, .portal, .corp-footer { position: relative; z-index: 1; }

/* ---------- Contenedor central ---------- */
.portal {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 36px 16px 8px;
}
.portal > div { display: grid; justify-items: center; width: 100%; min-width: 0; }

/* ---------- Tarjeta (misma familia que las de las herramientas) ---------- */
.tarjeta {
  position: relative;
  width: min(440px, 100%);
  padding: 32px 32px 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(20, 33, 61, .06), 0 24px 60px rgba(8, 20, 50, .35);
}
.tarjeta.ancha { width: min(560px, 100%); }
/* Franja superior con los colores del grupo, con un brillo que la recorre */
.tarjeta::before {
  position: absolute; inset: 0 0 auto 0; height: 5px; content: "";
  background: var(--marca-franja);
}
.tarjeta::after {
  position: absolute; top: 0; left: 0; width: 40%; height: 5px; content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
  animation: brilloFranja 3.6s ease-in-out infinite;
}
@keyframes brilloFranja { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(260%); } }
.tarjeta.temblor { animation: temblor .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes temblor {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- Encabezado de la tarjeta ---------- */
.marca { display: grid; justify-items: center; gap: 4px; margin-bottom: 22px; text-align: center; }
.emblema {
  position: relative;
  display: grid; place-items: center;
  width: 58px; height: 58px;
  margin-bottom: 10px;
  color: var(--freevac-azul);
  background: var(--freevac-azul-suave);
  border-radius: 16px;
}
.emblema svg { width: 28px; height: 28px; }
/* Anillo que late alrededor del candado */
.emblema::after {
  position: absolute; inset: -5px; content: "";
  border: 2px solid rgba(27, 61, 143, .25);
  border-radius: 20px;
  animation: latidoAnillo 2.6s ease-out infinite;
}
@keyframes latidoAnillo { from { transform: scale(.92); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
.titulo {
  margin: 10px 0 0;
  color: var(--freevac-azul-oscuro);
  font-size: clamp(24px, 5vw, 28px);
  line-height: 1.2;
  letter-spacing: -.03em;
}
.titulo::after {
  display: block;
  width: 48px; height: 4px;
  margin: 12px auto 0;
  background: var(--fibro-rojo);
  border-radius: 4px;
  content: "";
  animation: crecer .7s .3s cubic-bezier(.2, .7, .2, 1) backwards;
}
@keyframes crecer { from { width: 0; } }
.subtitulo { margin: 8px 0 0; color: var(--ink-soft); min-height: 1.5em; }
.cursor-escribe::after {
  display: inline-block;
  width: 2px; height: 1em;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--fibro-rojo);
  content: "";
  animation: parpadeo 1s steps(1) infinite;
}
@keyframes parpadeo { 50% { opacity: 0; } }

/* ---------- Pasos (transición lateral) ---------- */
.paso { display: grid; gap: 16px; }
.paso.entra { animation: entraPaso .45s cubic-bezier(.2, .7, .2, 1) both; }
.paso.sale { animation: salePaso .25s ease both; }
@keyframes entraPaso { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes salePaso { to { opacity: 0; transform: translateX(-28px); } }

/* ---------- Campos con etiqueta flotante ---------- */
.campo { position: relative; display: block; }
.campo input {
  width: 100%;
  height: 54px;
  padding: 20px 44px 6px 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--campo);
  color: var(--ink);
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.campo input::placeholder { color: transparent; }
.campo .etiqueta {
  position: absolute;
  left: 44px; top: 50%;
  color: var(--ink-soft);
  font-size: 15px;
  transform: translateY(-50%);
  transform-origin: left center;
  transition: transform .2s ease, color .2s, top .2s ease;
  pointer-events: none;
}
.campo input:focus + .etiqueta,
.campo input:not(:placeholder-shown) + .etiqueta {
  top: 15px;
  color: var(--freevac-azul);
  transform: translateY(-50%) scale(.78);
}
.campo .icono {
  position: absolute;
  left: 14px; top: 50%;
  width: 19px; height: 19px;
  color: #8a97ad;
  transform: translateY(-50%);
  transition: color .2s;
}
.campo:focus-within .icono { color: var(--freevac-azul); }
.campo input:focus {
  border-color: var(--freevac-azul);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(27, 61, 143, .12);
}
/* Línea roja que crece bajo el campo activo */
.campo::after {
  position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; content: "";
  border-radius: 2px;
  background: var(--fibro-rojo);
  transform: scaleX(0);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.campo:focus-within::after { transform: scaleX(1); }

.ver-clave {
  position: absolute;
  right: 7px; top: 50%;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8a97ad;
  cursor: pointer;
  transform: translateY(-50%);
}
.ver-clave:hover { color: var(--freevac-azul); background: var(--freevac-azul-suave); }
.ver-clave:focus-visible { outline: 2px solid var(--freevac-azul); }
.ver-clave svg { width: 19px; height: 19px; }
.aviso-mayus { margin: -8px 0 0; color: var(--ambar); font-size: 12.5px; }

/* ---------- Botones (mismo estilo que los botones de las herramientas) ---------- */
.boton {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 50px;
  padding: 0 22px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--freevac-azul);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(27, 61, 143, .7);
  transition: background .2s, transform .15s, box-shadow .2s;
}
.boton::before {
  position: absolute; inset: 0; content: "";
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, .25) 45%, transparent 65%);
  transform: translateX(-120%);
  transition: transform .7s ease;
}
.boton:hover { background: var(--freevac-azul-oscuro); box-shadow: 0 12px 26px -8px rgba(27, 61, 143, .8); }
.boton:hover::before { transform: translateX(120%); }
.boton:active { transform: scale(.98); }
.boton:focus-visible { outline: 3px solid var(--freevac-azul); outline-offset: 3px; }
.boton[disabled] { cursor: progress; opacity: .8; }
.boton .flecha { transition: transform .2s ease; }
.boton:hover .flecha { transform: translateX(4px); }
.boton.completo { width: 100%; }
.boton.secundario {
  height: 44px;
  color: var(--freevac-azul);
  background: var(--freevac-azul-suave);
  box-shadow: none;
  font-size: 14px;
}
.boton.secundario:hover { color: #fff; background: var(--freevac-azul); }
.boton.peligro { background: var(--fibro-rojo); box-shadow: 0 8px 20px -8px rgba(226, 35, 26, .7); }
.boton.peligro:hover { background: var(--fibro-rojo-oscuro); }
.boton.exito-btn { background: var(--freevac-verde); box-shadow: 0 8px 20px -8px rgba(58, 170, 53, .7); }
.boton.exito-btn:hover { background: var(--verde-ok); }
.boton .giro {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
.enlace-boton {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--freevac-azul);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.enlace-boton:hover { color: var(--fibro-rojo); }
.fila-enlaces { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Mensajes ---------- */
.alerta {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid #f5c2bf;
  border-left: 4px solid var(--fibro-rojo);
  border-radius: 10px;
  background: var(--fibro-rojo-suave);
  color: #8f1610;
  font-size: 13.5px;
  animation: entraPaso .3s ease both;
}
.alerta.info { border-color: #c9d6f0; border-left-color: var(--freevac-azul); background: var(--freevac-azul-suave); color: var(--freevac-azul-oscuro); }
.alerta.ok { border-color: #c4e6c2; border-left-color: var(--freevac-verde); background: var(--freevac-verde-suave); color: #23661f; }
.alerta.advertencia { border-color: #f3dca8; border-left-color: #e0a100; background: #fff7e3; color: #7a5200; }
.alerta svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* ---------- Código 2FA ---------- */
.escudo {
  position: relative;
  display: grid; place-items: center;
  width: 64px; height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--freevac-azul-suave);
  color: var(--freevac-azul);
}
.escudo svg { width: 30px; height: 30px; }
.escudo::before, .escudo::after {
  position: absolute; inset: 0; content: "";
  border: 2px solid rgba(27, 61, 143, .3);
  border-radius: 50%;
  animation: onda 2.4s ease-out infinite;
}
.escudo::after { animation-delay: 1.2s; }
@keyframes onda { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.paso-texto { margin: 0; color: var(--ink-soft); text-align: center; }
.paso-texto b { color: var(--ink); }

.digitos { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.digito {
  width: 100%;
  height: 56px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--campo);
  color: var(--freevac-azul-oscuro);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  caret-color: var(--fibro-rojo);
  transition: border-color .15s, box-shadow .2s, transform .15s, background .2s;
}
.digito:focus { border-color: var(--freevac-azul); background: #fff; box-shadow: 0 0 0 4px rgba(27, 61, 143, .12); transform: translateY(-2px); }
.digito.lleno { border-color: var(--freevac-azul); background: var(--freevac-azul-suave); animation: pulsoDigito .22s ease; }
@keyframes pulsoDigito { 50% { transform: scale(1.08); } }
.digitos.error .digito { border-color: var(--fibro-rojo); background: var(--fibro-rojo-suave); }

/* Reloj de 30 s */
.reloj { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-soft); font-size: 12.5px; }
.reloj svg { width: 24px; height: 24px; transform: rotate(-90deg); }
.reloj .pista { fill: none; stroke: var(--line); stroke-width: 3; }
.reloj .avance { fill: none; stroke: var(--freevac-verde); stroke-width: 3; stroke-linecap: round; transition: stroke .3s; }
.reloj.poco .avance { stroke: var(--fibro-rojo); }

/* ---------- Éxito ---------- */
.exito { display: grid; justify-items: center; gap: 10px; padding: 8px 0 4px; text-align: center; }
.exito svg { width: 92px; height: 92px; }
.exito .circulo { fill: var(--freevac-verde-suave); stroke: var(--freevac-verde); stroke-width: 3; stroke-dasharray: 290; stroke-dashoffset: 290; animation: trazo .8s cubic-bezier(.2, .7, .2, 1) forwards; }
.exito .check { fill: none; stroke: var(--freevac-verde); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 70; stroke-dashoffset: 70; animation: trazo .45s .6s ease forwards; }
@keyframes trazo { to { stroke-dashoffset: 0; } }
.exito h2 { margin: 0; color: var(--freevac-azul-oscuro); font-size: 22px; letter-spacing: -.02em; }
.exito p { margin: 0; color: var(--ink-soft); }
/* Salida hacia la app: el azul de marca cubre la pantalla desde el botón */
.destello {
  position: fixed; inset: 0; z-index: 50;
  background: var(--fondo-marca);
  clip-path: circle(0 at var(--x, 50%) var(--y, 50%));
  animation: expandir .65s cubic-bezier(.7, 0, .3, 1) forwards;
  pointer-events: none;
}
@keyframes expandir { to { clip-path: circle(150% at var(--x, 50%) var(--y, 50%)); } }

/* ---------- Sellos de seguridad ---------- */
.sellos {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.sello {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  color: var(--freevac-azul);
  background: var(--freevac-azul-suave);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.sello .punto { width: 6px; height: 6px; border-radius: 50%; background: var(--freevac-verde); animation: latido 2s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .3; } }

/* ---------- Activación: indicador de pasos ---------- */
.etapas { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 22px; padding: 0; list-style: none; counter-reset: etapa; }
.etapa { position: relative; display: grid; justify-items: center; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 600; text-align: center; }
.etapa::before {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 12px;
  counter-increment: etapa;
  content: counter(etapa);
  transition: all .35s ease;
}
.etapa + .etapa::after {
  position: absolute; top: 14px; right: 50%; z-index: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--freevac-azul), var(--freevac-verde)) left / 0% 100% no-repeat, var(--line);
  content: "";
  transition: background-size .6s ease;
}
.etapa.activa { color: var(--freevac-azul-oscuro); }
.etapa.activa::before { border-color: var(--freevac-azul); background: var(--freevac-azul); color: #fff; box-shadow: 0 0 0 4px rgba(27, 61, 143, .15); }
.etapa.hecha::before { border-color: var(--freevac-verde); background: var(--freevac-verde); color: #fff; content: "✓"; }
.etapa.activa::after, .etapa.hecha::after { background-size: 100% 100%; }

/* Fuerza de la contraseña */
.fuerza { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: -6px; }
.fuerza span { height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.fuerza[data-nivel="1"] span:nth-child(-n+1) { background: var(--fibro-rojo); }
.fuerza[data-nivel="2"] span:nth-child(-n+2) { background: #e0a100; }
.fuerza[data-nivel="3"] span:nth-child(-n+3) { background: var(--freevac-azul); }
.fuerza[data-nivel="4"] span { background: var(--freevac-verde); }
.requisitos { display: grid; gap: 4px; margin: -4px 0 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: 12.5px; }
.requisitos li { display: flex; align-items: center; gap: 8px; transition: color .25s; }
.requisitos li::before {
  display: grid; place-items: center;
  width: 16px; height: 16px;
  border: 1.5px solid #c3ccda;
  border-radius: 50%;
  font-size: 10px;
  content: "";
  transition: all .25s ease;
}
.requisitos li.ok { color: var(--ink); }
.requisitos li.ok::before { border-color: var(--freevac-verde); background: var(--freevac-verde); color: #fff; content: "✓"; }

/* QR */
.qr-marco {
  position: relative;
  justify-self: center;
  width: 204px; height: 204px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--corp-shadow);
}
.qr-marco img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.qr-marco::after {
  position: absolute; left: 0; right: 0; top: 0; height: 36px; content: "";
  background: linear-gradient(to bottom, transparent, rgba(226, 35, 26, .22), transparent);
  animation: escanear 2.6s ease-in-out infinite;
}
@keyframes escanear { 0%, 100% { transform: translateY(-36px); } 50% { transform: translateY(204px); } }
.secreto {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  border: 1px dashed #c3ccda;
  border-radius: 10px;
  background: var(--campo);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  letter-spacing: .06em;
  word-break: break-all;
}
details.manual summary { color: var(--freevac-azul); font-size: 13px; font-weight: 600; cursor: pointer; }
details.manual[open] summary { margin-bottom: 8px; }

/* Códigos de respaldo */
.codigos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.codigos li {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--campo);
  color: var(--freevac-azul-oscuro);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .1em;
  text-align: center;
  animation: entraPaso .35s ease both;
}
.acciones { display: flex; gap: 10px; flex-wrap: wrap; }
.acciones > * { flex: 1 1 140px; }
.casilla { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); cursor: pointer; }
.casilla input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--freevac-verde); }

/* ---------- Avisos flotantes ---------- */
.avisos { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--freevac-verde);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 40px -12px rgba(8, 20, 50, .45);
  animation: entraPaso .35s ease both;
}
.toast.error { border-left-color: var(--fibro-rojo); }
.toast.sale { animation: salePaso .3s ease both; }

@media (max-width: 480px) {
  .tarjeta { padding: 26px 18px 20px; }
  .digitos { gap: 6px; }
  .digito { height: 50px; font-size: 21px; }
  .codigos li { font-size: 13px; letter-spacing: .05em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
