:root {
  --azul-50: #f0f8ff;
  --azul-100: #e0f1fe;
  --azul-200: #bae3fd;
  --azul-300: #7ccdfb;
  --azul-400: #38b2f5;
  --azul-500: #0e98e1;
  --azul-600: #0279c0;
  --azul-900: #0c3a5c;
  --texto: #10304a;
  --texto-suave: #5a7690;
  --borde: #cfe6f7;
  --blanco: #ffffff;
  --error: #d64545;
  --ok: #1d9a6c;
  --whatsapp: #25d366;
  --gmail: #ea4335;
  --radio: 14px;
  --sombra: 0 20px 50px -20px rgba(14, 152, 225, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Lo que lleva el atributo hidden no se ve, aunque su clase le dé otro display */
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--texto);
  background: linear-gradient(135deg, var(--azul-50) 0%, var(--azul-100) 45%, var(--azul-200) 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Fondo con códigos de barras flotando ---------- */
.fondo-barras {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.fondo-barras .mini {
  position: absolute;
  bottom: -80px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 46px;
  opacity: 0;
  animation: subir linear infinite;
}
.fondo-barras .mini i { display: block; background: var(--azul-400); border-radius: 1px; }

@keyframes subir {
  0%   { transform: translateY(0) rotate(var(--rot)); opacity: 0; }
  10%  { opacity: .18; }
  90%  { opacity: .18; }
  100% { transform: translateY(-115vh) rotate(var(--rot)); opacity: 0; }
}

/* ---------- Layout ---------- */
.contenedor {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

/* ---------- Marca ---------- */
/* Logo: un ojo vigilante cuyo iris es un código de barras, con láser que escanea, parpadeo y brillo */
.logo { display: flex; align-items: center; gap: 14px; }
a.logo { text-decoration: none; width: fit-content; }
.logo-icono {
  width: 64px; height: 64px; flex: none;
  border-radius: 18px;
  display: grid; place-items: center;
  box-shadow: 0 14px 30px -10px rgba(14, 152, 225, .6), 0 0 0 1px rgba(255, 255, 255, .4) inset;
  animation: logoEntra .8s cubic-bezier(.2, 1.4, .4, 1) both, logoFlota 5s ease-in-out 1s infinite;
  transition: transform .25s;
}
.logo:hover .logo-icono { transform: rotate(-6deg) scale(1.06); }
.logo-svg { width: 100%; height: 100%; display: block; }
/* Logo propio de Vigia (subido en Administración › Configuración de Vigia) */
.logo-propio { width: 100%; height: 100%; display: block; object-fit: contain; }
.logo-svg * { transform-box: view-box; }
.logo-ojo { transform-origin: 32px 32px; animation: logoParpadeo 6s ease-in-out 1.2s infinite; }
.logo-iris { transform-origin: 32px 32px; animation: logoMira 6s ease-in-out 1.2s infinite; }
.logo-laser { filter: drop-shadow(0 0 2px #8ff3ff) drop-shadow(0 0 4px #38b2f5); animation: logoLaser 2.2s ease-in-out infinite alternate; }
.logo-destello { animation: logoDestello 5s ease-in-out 1.5s infinite; }
@keyframes logoEntra { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
@keyframes logoFlota { 50% { transform: translateY(-3px); } }
@keyframes logoParpadeo { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.06); } }
@keyframes logoMira { 0%, 20%, 100% { transform: translateX(0); } 28%, 38% { transform: translateX(-4px); } 60%, 72% { transform: translateX(4px); } 80% { transform: translateX(0); } }
@keyframes logoLaser { from { transform: translateY(-13px); } to { transform: translateY(13px); } }
@keyframes logoDestello { 0%, 60% { transform: rotate(20deg) translateX(0); } 85%, 100% { transform: rotate(20deg) translateX(120px); } }

.logo-texto {
  font-size: 2.8rem; font-weight: 700; letter-spacing: -1px; line-height: 1;
  background: linear-gradient(100deg, var(--azul-900) 0%, var(--azul-600) 40%, var(--azul-400) 50%, var(--azul-600) 60%, var(--azul-900) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: logoTextoEntra .7s ease .15s both, logoTextoBrillo 6s ease-in-out 1.5s infinite;
}
@keyframes logoTextoEntra { from { opacity: 0; transform: translateX(-10px); } }
@keyframes logoTextoBrillo { 0%, 55% { background-position: 100% 0; } 85%, 100% { background-position: 0 0; } }

.lema { margin-top: 10px; font-size: 1.12rem; color: var(--texto-suave); animation: logoTextoEntra .7s ease .35s both; }
.lema-fuerte { color: var(--azul-600); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .logo-icono, .logo-ojo, .logo-iris, .logo-laser, .logo-destello, .logo-texto, .lema { animation: none; }
}

/* Escáner animado */
.escaner {
  position: relative;
  margin-top: 36px;
  padding: 26px 30px 16px;
  background: var(--blanco);
  border-radius: 18px;
  box-shadow: var(--sombra);
  max-width: 400px;
  overflow: hidden;
}
.codigo {
  display: flex;
  align-items: stretch;
  gap: 3px;
  height: 120px;
}
.codigo i {
  display: block;
  background: var(--azul-900);
  border-radius: 1px;
  transform: scaleY(0);
  transform-origin: bottom;
  animation: crecer .5s cubic-bezier(.2, .8, .3, 1.2) forwards;
}
@keyframes crecer { to { transform: scaleY(1); } }

.digitos {
  margin-top: 10px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--azul-900);
}

.laser {
  position: absolute;
  left: 14px; right: 14px;
  top: 26px;
  height: 3px;
  border-radius: 3px;
  background: var(--azul-400);
  box-shadow: 0 0 12px 3px rgba(56, 178, 245, .75), 0 0 30px 8px rgba(56, 178, 245, .35);
  animation: escanear 2.4s ease-in-out infinite alternate;
}
@keyframes escanear {
  from { top: 22px; }
  to   { top: 146px; }
}
.escaner.leido { animation: destello .6s; }
@keyframes destello {
  0%, 100% { box-shadow: var(--sombra); }
  40% { box-shadow: 0 0 0 4px var(--azul-300), var(--sombra); }
}

/* ---------- Tarjeta ---------- */
.tarjeta {
  background: var(--blanco);
  border-radius: 22px;
  padding: 28px 32px;
  box-shadow: var(--sombra);
  border: 1px solid var(--borde);
}

.pestanas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--azul-50);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.pestana {
  font: inherit;
  font-weight: 500;
  border: 0;
  background: transparent;
  color: var(--texto-suave);
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.pestana.activa { background: var(--blanco); color: var(--azul-600); box-shadow: 0 2px 8px rgba(14, 152, 225, .15); }

.formulario { display: none; flex-direction: column; gap: 14px; }
.formulario.activo { display: flex; animation: aparecer .35s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }

.formulario h1 { font-size: 1.5rem; color: var(--azul-900); }
.sub { color: var(--texto-suave); font-size: .92rem; margin-top: -10px; margin-bottom: 4px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 500; }

input, select {
  font: inherit;
  font-size: .95rem;
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--borde);
  border-radius: 10px;
  background: var(--azul-50);
  color: var(--texto);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, select:focus {
  border-color: var(--azul-400);
  background: var(--blanco);
  box-shadow: 0 0 0 4px rgba(56, 178, 245, .18);
}
input[readonly] { color: var(--azul-600); font-weight: 600; text-align: center; }
input.invalido { border-color: var(--error); }

.campo-pass { position: relative; display: block; }
.campo-pass input { padding-right: 44px; }
.ver-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  font-size: 1rem; opacity: .5; padding: 4px;
}
.ver-pass:hover, .ver-pass.on { opacity: 1; }

.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fila-tel { grid-template-columns: 92px 1fr; }

.mensaje { min-height: 1.2em; font-size: .85rem; color: var(--error); }
.mensaje.ok { color: var(--ok); }

.btn-principal {
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  border: 0;
  border-radius: 12px;
  padding: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--azul-400), var(--azul-500));
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(14, 152, 225, .7);
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
.btn-principal:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px rgba(14, 152, 225, .8); }
.btn-principal:disabled { opacity: .6; cursor: wait; transform: none; }

/* Aceptación de términos en el registro */
label.acepta { flex-direction: row; align-items: flex-start; gap: 10px; font-size: .8rem; font-weight: 400; color: var(--texto-suave); line-height: 1.4; cursor: pointer; }
label.acepta input { width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; padding: 0; flex: none; accent-color: var(--azul-500); }
label.acepta input.invalido { outline: 2px solid var(--error); outline-offset: 2px; }
label.acepta a { color: var(--azul-600); font-weight: 600; }
.pie a { color: inherit; }
.cambio { text-align: center; font-size: .88rem; color: var(--texto-suave); }
.cambio a { color: var(--azul-600); font-weight: 600; text-decoration: none; }
.cambio.nota { font-size: .78rem; }

/* Botón «Soy contador» (inicio de sesión) y selector negocio / contador (registro) */
.btn-contador {
  display: block; text-align: center; text-decoration: none; font-weight: 600; font-size: .92rem;
  color: var(--azul-600); background: var(--azul-50); border: 1.5px dashed var(--azul-300);
  border-radius: 12px; padding: 11px; transition: background .2s, border-color .2s;
}
.btn-contador:hover { background: var(--azul-100); border-color: var(--azul-500); }
.fila-recordar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: -6px; }
.fila-recordar .olvido { margin: 0; color: var(--azul-600); font-weight: 600; text-decoration: none; }
.fila-recordar .olvido:hover { text-decoration: underline; }
.recordar { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-size: .85rem; font-weight: 500; color: var(--texto); cursor: pointer; }
.recordar input { width: 17px; height: 17px; margin: 0; accent-color: var(--azul-500); }
.captcha { display: flex; justify-content: center; min-height: 65px; }
.captcha[hidden] { display: none; }
.mensaje a { color: var(--azul-600); font-weight: 700; }
.olvido { text-align: right; font-size: .82rem; margin-top: -6px; }
.olvido a { color: var(--azul-600); font-weight: 600; text-decoration: none; }
.olvido a:hover, .cambio a:hover { text-decoration: underline; }
.prueba-gratis { color: var(--ok); }
.invitacion { margin: -6px 0 4px; padding: 10px 12px; border-radius: 12px; background: #eafaf2; border: 1px solid #bfe9d3; color: #146c47; font-size: .85rem; font-weight: 500; }

/* Página para crear la contraseña nueva */
.contenedor-simple { grid-template-columns: minmax(0, 440px); justify-content: center; }
.logo-chico { justify-content: center; margin-bottom: 18px; }
.logo-chico .logo-icono { width: 44px; height: 44px; border-radius: 12px; animation: none; overflow: hidden; }
.logo-chico .logo-icono img { display: block; }
.logo-chico .logo-texto { font-size: 2rem; }

/* ---------- Soporte ---------- */
.soporte {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .88rem;
  color: var(--texto-suave);
}
.soporte-botones { display: flex; gap: 10px; }
.btn-soporte {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .85rem; font-weight: 600;
  text-decoration: none;
  border: 1.5px solid;
  transition: background .2s, color .2s;
}
.btn-soporte svg { width: 18px; height: 18px; fill: currentColor; }
.btn-soporte.whatsapp { color: #128c4b; border-color: var(--whatsapp); }
.btn-soporte.whatsapp:hover { background: var(--whatsapp); color: #fff; }
.btn-soporte.gmail { color: var(--gmail); border-color: var(--gmail); }
.btn-soporte.gmail:hover { background: var(--gmail); color: #fff; }

.pie { position: relative; z-index: 1; text-align: center; padding: 16px; font-size: .8rem; color: var(--texto-suave); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .contenedor { grid-template-columns: 1fr; gap: 28px; padding: 24px 16px; }
  .marca { text-align: center; }
  .logo { justify-content: center; }
  .escaner { margin: 24px auto 0; padding: 18px 20px 12px; }
  .codigo { height: 80px; }
  @keyframes escanear { from { top: 14px; } to { top: 98px; } }
  .tarjeta { padding: 22px 18px; }
}
@media (max-width: 420px) {
  .fila { grid-template-columns: 1fr; }
  .fila-tel { grid-template-columns: 84px 1fr; }
  .soporte { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .laser { display: none; }
}
