:root { --v: #7c5cf0; --vs: #f1edfe; --navy: #0d0b16; --ink: #1c1830; --soft: #5d5873; --border: #e7e4ef; }
* { box-sizing: border-box; }
.auth-body { margin: 0; font-family: 'General Sans', sans-serif; color: var(--ink); }
.auth-split { position: relative; min-height: 100vh; }

/* Panel del formulario: flota POR ENCIMA del canvas (que ocupa toda la pantalla);
   los campos van en una card glass para legibilidad sobre los hilos. */
.auth-pane { position: relative; z-index: 1; color: #f2f0fa; padding: 40px 48px; min-height: 100vh; display: flex; flex-direction: column; }
.auth-brand { align-self: flex-start; }
.auth-brand img { height: 34px; }
/* Anclado desde el header: top fijo + bottom auto → al cambiar de tab los campos
   nuevos crecen hacia abajo, el form no se recentra ni "salta". */
.auth-formwrap { margin: clamp(40px, 9vh, 88px) 0 auto; width: 100%; max-width: 400px;
  background: linear-gradient(155deg, rgb(255 255 255 / .05), rgb(255 255 255 / .1)), rgb(13 11 22 / 80%);
  backdrop-filter: blur(30px) saturate(100%); -webkit-backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid rgb(255 255 255 / .14); border-radius: 22px; padding: 32px 28px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .14), inset 0 0 0 1px rgb(255 255 255 / .02),
    0 30px 80px -28px rgb(0 0 0 / .75); }
.auth-title { font-family: 'Switzer', sans-serif; font-size: 28px; margin: 18px 0 6px; }
.auth-sub { color: rgb(242 240 250 / .6); margin: 0 0 22px; font-size: 14px; }
.auth-error { background: rgb(179 38 30 / .15); color: #ffb4ab; padding: 10px 14px; border-radius: 10px; font-size: 13px; }

/* Toggle */
.auth-toggle { display: inline-flex; gap: 4px; background: rgb(255 255 255 / .06); padding: 4px; border-radius: 999px; }
.auth-tab { border: 0; background: none; color: rgb(242 240 250 / .6); padding: 8px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; }
.auth-tab.active { background: var(--v); color: #fff; font-weight: 600; }

/* Social */
.auth-social { display: flex; gap: 10px; }
.auth-oauth { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 12px; border: 1px solid rgb(242 240 250 / .18); background: rgb(255 255 255 / .04); color: #f2f0fa; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; }
.auth-oauth:hover { background: rgb(255 255 255 / .1); }
.auth-oauth[hidden] { display: none; }  /* display:flex pisaría al [hidden] del UA */
.auth-oauth-logo { width: 18px; height: 18px; flex-shrink: 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: rgb(242 240 250 / .4); font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgb(242 240 250 / .12); }

/* Campos */
.auth-fields { display: flex; flex-direction: column; gap: 14px; }
.auth-fields input, .auth-fields select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgb(242 240 250 / .18); background: rgb(255 255 255 / .04); color: #f2f0fa; font: inherit; font-size: 14px; }
.auth-fields input::placeholder { color: rgb(242 240 250 / .4); }
.auth-fields input:focus, .auth-fields select:focus { outline: none; border-color: var(--v); }
/* Mostrar/ocultar contraseña */
.auth-input-wrap { position: relative; }
.auth-input-wrap input { padding-right: 44px; }
.auth-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  background: none; border: 0; padding: 6px; border-radius: 8px; color: rgb(242 240 250 / .5); cursor: pointer; }
.auth-eye:hover { color: #f2f0fa; }
.auth-eye .eye { width: 18px; height: 18px; display: block; }
.auth-eye .eye-off { display: none; }
.auth-eye.is-on .eye-on { display: none; }
.auth-eye.is-on .eye-off { display: block; }
/* Checkbox custom para términos */
.auth-terms { display: flex; gap: 10px; align-items: flex-start; color: rgb(242 240 250 / .62); font-size: 12.5px; line-height: 1.45; cursor: pointer; user-select: none; padding: 2px 0; }
.auth-terms input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px;
  border: 1px solid rgb(242 240 250 / .3); background: rgb(255 255 255 / .04);
  display: grid; place-items: center; transition: background .15s, border-color .15s, box-shadow .15s; }
.auth-check::after { content: ''; width: 5px; height: 9px; margin-top: -1px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0);
  transition: transform .16s cubic-bezier(.2,.9,.3,1.4); }
.auth-terms input:checked + .auth-check { background: linear-gradient(135deg, #a78bfa, #f0abfc); border-color: transparent; }
.auth-terms input:checked + .auth-check::after { transform: rotate(45deg) scale(1); }
.auth-terms input:focus-visible + .auth-check { box-shadow: 0 0 0 3px rgb(167 139 250 / .4); }
.auth-link { color: #f0abfc; text-decoration: none; border-bottom: 1px solid rgb(240 171 252 / .35); }
.auth-link:hover { border-bottom-color: #f0abfc; }
.auth-submit { margin-top: 6px; padding: 13px; border: 0; border-radius: 12px;
  background: linear-gradient(95deg, #9b5de5, #e072a4 42%, #f3957e 72%, #f4b36c);
  color: #fff; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 8px 26px -8px rgb(224 114 164 / .55), 0 0 0 1px rgb(255 255 255 / .08);
  transition: filter .15s, transform .05s; }
.auth-submit:hover { filter: brightness(1.07); }
.auth-submit:active { transform: translateY(1px); }
.auth-alt { margin-top: 18px; font-size: 13px; color: rgb(242 240 250 / .6); }
.auth-alt a, .auth-sub a { color: #a78bfa; }

/* Lienzo: ocupa TODA la pantalla, fijo, por debajo del formulario (z-index 0).
   Orbes de gradiente que flotan y pulsan (puro CSS, sin WebGL). */
.auth-visual { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--navy); }
/* hilos three.js sobre los orbes (canvas transparente) */
.auth-visual canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); will-change: transform; pointer-events: none; }
.orb-1 { width: 60vmax; height: 60vmax; top: -16%; left: -12%; opacity: .55;
  background: radial-gradient(circle, #7c5cf0 0%, #3a1d6e 42%, transparent 70%); animation: orbFloat1 17s ease-in-out infinite; }
.orb-2 { width: 50vmax; height: 50vmax; top: 6%; right: -18%; opacity: .5;
  background: radial-gradient(circle, #e072a4 0%, #7c5cf0 34%, transparent 70%); animation: orbFloat2 20s ease-in-out infinite; }
.orb-3 { width: 46vmax; height: 46vmax; bottom: 4%; left: 14%; opacity: .42;
  background: radial-gradient(circle, #f0abfc 0%, #b06bd6 30%, transparent 65%); animation: orbFloat3 23s ease-in-out infinite; }
.orb-4 { width: 38vmax; height: 38vmax; top: 34%; left: 42%; opacity: .26;
  background: radial-gradient(circle, #fdba74 0%, #f4b36c 24%, transparent 60%); animation: orbFloat4 26s ease-in-out infinite; }
.orb-5 { width: 42vmax; height: 42vmax; bottom: -14%; right: -8%; opacity: .45;
  background: radial-gradient(circle, #a78bfa 0%, #5b3bc4 36%, transparent 70%); animation: orbFloat5 19s ease-in-out infinite; }
.orb-glow { position: absolute; width: 52vmax; height: 52vmax; top: -6%; left: 50%; transform: translateX(-50%);
  filter: blur(60px); pointer-events: none;
  background: radial-gradient(circle, rgb(167 139 250 / .35) 0%, rgb(240 171 252 / .14) 32%, transparent 62%);
  animation: orbGlowPulse 9s ease-in-out infinite; }
/* viñeta suave para legibilidad del form */
.auth-visual-fade { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 85% at 45% 35%, transparent 38%, rgb(8 7 15 / .55) 100%); }
@keyframes orbFloat1 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(8vw,5vh) scale(1.05)} 66%{transform:translate(-3vw,-4vh) scale(.95)} }
@keyframes orbFloat2 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(-10vw,8vh) scale(1.08)} 66%{transform:translate(5vw,-3vh) scale(.93)} }
@keyframes orbFloat3 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(6vw,-8vh) scale(1.1)} 66%{transform:translate(-8vw,4vh) scale(.92)} }
@keyframes orbFloat4 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-5vw,-6vh) scale(1.15)} }
@keyframes orbFloat5 { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(-6vw,-7vh) scale(1.06)} 66%{transform:translate(4vw,3vh) scale(.97)} }
@keyframes orbGlowPulse { 0%,100%{opacity:.6; transform:translateX(-50%) scale(1)} 50%{opacity:1; transform:translateX(-50%) scale(1.1)} }

/* Mascota gata-perro-caja: columna derecha, centrada (solo desktop) */
.auth-mascot { display: none; }

/* Desktop: izquierda = columna de inputs, derecha = mascota centrada */
@media (min-width: 901px) {
  .auth-formwrap { margin-left: clamp(48px, 8vw, 160px); }
  /* logo alineado con el borde izquierdo del form */
  .auth-brand { margin-left: clamp(48px, 8vw, 160px); }
  .auth-mascot { display: flex; position: fixed; top: 0; right: 0; width: 60%; height: 100vh;
    z-index: 1; align-items: center; justify-content: center; pointer-events: none; }
  .auth-mascot video { width: min(58%, 500px); height: auto; display: block; }
}

/* Responsive: el form se centra y el logo flota arriba a la izquierda */
@media (max-width: 900px) {
  .auth-pane { justify-content: center; align-items: center; padding: 24px 16px; }
  .auth-formwrap { max-width: 440px; padding: 28px 22px; }
  .auth-brand { position: absolute; top: 20px; left: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .orb, .orb-glow { animation: none !important; }
}

/* Toasts */
#toast-stack { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px 12px 16px; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 500;
  color: #fff; min-width: 240px; max-width: 90vw; box-shadow: 0 14px 34px -12px rgb(0 0 0 / .6);
  opacity: 0; transform: translateY(-12px); transition: opacity .25s, transform .25s; }
.toast.in { opacity: 1; transform: translateY(0); }
.toast.out { opacity: 0; transform: translateY(-12px); }
.toast-success { background: linear-gradient(120deg, #16a34a, #15803d); }
.toast-error { background: linear-gradient(120deg, #e11d48, #b91c1c); }
.toast-msg { flex: 1; }
.toast-x { background: none; border: 0; color: rgb(255 255 255 / .8); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px; }
.toast-x:hover { color: #fff; }

/* Validación inline */
.auth-fields input.is-invalid { border-color: #f43f5e; }
.auth-field-error { display: block; margin-top: 6px; color: #fda4af; font-size: 12px; }
.auth-field-error:empty { display: none; }
/* Medidor de fuerza de contraseña: oculto hasta que se empieza a escribir */
.pw-meter { display: none; margin-top: 10px; --pw-color: #f43f5e; }
.pw-meter.is-shown { display: block; }
.pw-meter-bars { display: flex; gap: 6px; }
.pw-meter-bars span { flex: 1; height: 5px; border-radius: 3px; background: rgb(242 240 250 / .12); transition: background .3s ease; }
.pw-meter[data-score="1"] { --pw-color: #f43f5e; }  /* rojo */
.pw-meter[data-score="2"] { --pw-color: #f59e0b; }  /* ámbar */
.pw-meter[data-score="3"] { --pw-color: #84cc16; }  /* lima */
.pw-meter[data-score="4"] { --pw-color: #22c55e; }  /* verde */
.pw-meter[data-score="1"] .pw-meter-bars span:nth-child(-n+1),
.pw-meter[data-score="2"] .pw-meter-bars span:nth-child(-n+2),
.pw-meter[data-score="3"] .pw-meter-bars span:nth-child(-n+3),
.pw-meter[data-score="4"] .pw-meter-bars span:nth-child(-n+4) { background: var(--pw-color); }
.pw-meter-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; font-size: 12px; }
.pw-meter-hint { color: rgb(242 240 250 / .5); }
.pw-meter-label { font-weight: 600; color: var(--pw-color); white-space: nowrap; }

/* Confetti (la regla vive en app-shell.css, que no carga en auth) */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* Login/registro OTP passwordless: pasos (email→código) y campo de código.
   El paso "código" arranca con [hidden]; al enviar, el JS intercambia los pasos
   (el campo de correo se reemplaza por el de código, no se apilan). */
.auth-step { display: flex; flex-direction: column; gap: 14px; }
.auth-step[hidden] { display: none; }
.auth-code { letter-spacing: .55em; text-align: center; font-size: 22px; font-weight: 700; padding-left: .55em; }
.auth-resend { border: 0; background: none; color: var(--v); font: inherit; font-size: 13px; cursor: pointer; padding: 2px 0; align-self: center; }
.auth-resend:disabled { color: rgb(242 240 250 / .4); cursor: default; }
.auth-nit-razon { display: block; margin-top: -8px; font-size: 12px; color: #22c55e; }
.auth-nit-razon[hidden] { display: none; }

/* Modal de éxito tras el registro */
.success-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  padding: 24px; background: rgb(8 7 15 / .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.success-modal[hidden] { display: none; }
.success-card { width: 100%; max-width: 420px; text-align: center; color: #f2f0fa;
  background: linear-gradient(160deg, rgb(255 255 255 / .08), rgb(255 255 255 / .03)), rgb(13 11 22 / .94);
  border: 1px solid rgb(255 255 255 / .14); border-radius: 24px; padding: 32px 28px;
  box-shadow: 0 40px 100px -30px rgb(0 0 0 / .8);
  animation: successPop .35s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes successPop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.success-img { width: 150px; height: 150px; object-fit: contain; display: block; margin: 0 auto 4px;
  filter: drop-shadow(0 16px 30px rgb(124 92 240 / .35)); }
.success-title { font-family: 'Switzer', sans-serif; font-size: 24px; margin: 6px 0 8px; }
.success-sub { color: rgb(242 240 250 / .65); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }
.success-cta { display: block; padding: 13px; border-radius: 12px; text-decoration: none; color: #fff;
  font-weight: 700; font-size: 15px;
  background: linear-gradient(95deg, #9b5de5, #e072a4 42%, #f3957e 72%, #f4b36c);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 8px 26px -8px rgb(224 114 164 / .55);
  transition: filter .15s, transform .05s; }
.success-cta:hover { filter: brightness(1.07); }
.success-cta:active { transform: translateY(1px); }
