/* =====================================================
   LOGIN · ScrapeX
   Tarjeta centrada en dos columnas (formulario + panel de marca).
   Paleta A · grafito y cian (la misma de la aplicación).
   ===================================================== */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  --bg: #0b0f14;
  --head: #11161d;
  --cont: #161c24;
  --card: #1d252f;
  --cian: #22d3ee;
  --cian-2: #67e8f9;
  --tx: #e8eef7;
  --mut: #a3b0c4;    /* subido para mejor contraste sobre fondo oscuro */
  --mut2: #8a96a9;
  --line: rgba(255, 255, 255, .08);
  --danger: #ff7d92;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { background: #0b0f14; color-scheme: dark; }
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tx);
  background: #0b0f14;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Fondo: grafito en degradado suave, con un toque de luz cian en la esquina ---------- */
.login {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(clamp(20px, 5vw, 56px), env(safe-area-inset-top)) clamp(16px, 4vw, 48px) max(clamp(20px, 5vw, 56px), env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse 60% 55% at 92% 96%, rgba(34, 211, 238, .13), transparent 68%),
    radial-gradient(ellipse 70% 60% at 8% 4%, rgba(255, 255, 255, .06), transparent 62%),
    linear-gradient(155deg, #1a222c 0%, #121820 48%, #0b0f14 100%);
}

.login_wrap { width: min(960px, 100%); display: grid; gap: 22px; justify-items: center; }

/* ---------- Tarjeta ---------- */
.login_card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  overflow: hidden;
  background: var(--head);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 24px;
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .75), 0 0 0 1px rgba(0, 0, 0, .35);
  animation: subir .7s var(--ease) both;
}

/* ---------- Izquierda: formulario ---------- */
.login_panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(26px, 5vh, 40px);
  padding: clamp(28px, 4vw, 48px);
}
/* Marca principal: [logo de Scala en pastilla clara] Scala Perú Ingenieros (sin cliente, el logo de ScrapeX) */
.marca { display: flex; align-items: center; min-width: 0; }
.marca > svg { display: block; flex: none; height: 30px; width: auto; }
.marca_socio { display: inline-flex; align-items: center; gap: 0; min-width: 0; }
.marca_chip {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  background: linear-gradient(160deg, #f4f7fb, #d9e2ee);   /* pastilla clara: el logo de Scala se ve en fondo oscuro */
  border-radius: 12px;
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 255, 255, .5);
}
.marca_socio_logo { display: block; flex: none; height: 56px; width: auto; max-width: 120px; object-fit: contain; margin-right: -10px; }
.marca_socio_nombre {
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -.025em;
  line-height: 1.1;
  color: #fff;
}

.login_eyebrow {
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--cian);
}
.login_title { font-size: clamp(1.65rem, 3vw, 2rem); font-weight: 650; letter-spacing: -.025em; line-height: 1.15; }
.login_sub { margin-top: 8px; font-size: .95rem; color: var(--mut); }

.login_form { display: grid; gap: 16px; margin-top: 26px; }
.campo { display: grid; gap: 8px; }
.campo label { font-size: .86rem; font-weight: 500; color: #c3cddb; }

.campo input[type="email"],
.campo input[type="password"],
.campo input[type="text"] {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font: inherit;
  font-size: .98rem;
  color: var(--tx);
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 12px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.campo input::placeholder { color: var(--mut2); }
.campo input:hover { border-color: rgba(255, 255, 255, .32); }
.campo input:focus {
  outline: none;
  border-color: var(--cian);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .18);
}
.campo input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 125, 146, .12); }

.campo_clave { position: relative; }
.campo_clave input { padding-right: 52px; }
.ver_clave {
  position: absolute;
  top: 0; right: 0;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  color: var(--mut);
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: color .2s ease;
}
.ver_clave:hover { color: var(--tx); }
.ver_clave[aria-pressed="true"] { color: var(--cian); }
.ojo_tachado { opacity: 0; transition: opacity .2s ease; }
.ver_clave[aria-pressed="true"] .ojo_tachado { opacity: 1; }

/* Casilla "Recordar" */
.recordar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  font-size: .9rem;
  color: #b4bfce;
  cursor: pointer;
  user-select: none;
}
.recordar input { position: absolute; opacity: 0; width: 0; height: 0; }
.recordar_caja {
  position: relative;
  flex: none;
  width: 20px; height: 20px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, .3);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.recordar_caja::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 5px; height: 10px;
  border: solid #04141a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .2s var(--ease);
}
.recordar:hover .recordar_caja { border-color: rgba(255, 255, 255, .4); }
.recordar input:checked + .recordar_caja { background: var(--cian); border-color: var(--cian); }
.recordar input:checked + .recordar_caja::after { transform: rotate(45deg) scale(1); }
.recordar input:focus-visible + .recordar_caja { box-shadow: 0 0 0 3px rgba(34, 211, 238, .3); }

.login_error {
  padding: 10px 12px;
  font-size: .88rem;
  line-height: 1.45;
  color: #ffb3bd;
  background: rgba(255, 125, 146, .08);
  border: 1px solid rgba(255, 125, 146, .25);
  border-radius: 10px;
}

/* Botón principal: cian sólido con texto oscuro (más contraste) */
.btn_login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: #04141a;
  background: var(--cian);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 12px 28px -12px rgba(34, 211, 238, .65);
  transition: background .2s ease, transform .2s var(--ease), box-shadow .2s ease;
}
.btn_login:hover { background: var(--cian-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 14px 32px -12px rgba(34, 211, 238, .8); }
.btn_login:active { transform: translateY(1px); }
.btn_login .arrow { transition: transform .3s var(--ease); }
.btn_login:hover .arrow { transform: translateX(4px); }
.btn_login:disabled { cursor: progress; opacity: .75; }
.btn_login:disabled .arrow { display: none; }
.btn_login.cargando .btn_texto::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 10px;
  vertical-align: -2px;
  border: 2px solid rgba(4, 20, 26, .3);
  border-top-color: #04141a;
  border-radius: 50%;
  animation: girar .7s linear infinite;
}
.btn_login:focus-visible,
.ver_clave:focus-visible,
.mfa_volver:focus-visible { outline: 2px solid var(--cian); outline-offset: 3px; }

.login_nota { margin-top: 18px; text-align: center; font-size: .88rem; line-height: 1.4; color: var(--mut); }
.login_nota > span { display: block; }

/* ---------- Derecha: robot dentro de la tarjeta ---------- */
.login_aside {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  background:
    radial-gradient(72% 52% at 50% 36%, rgba(34, 211, 238, .20), rgba(20, 48, 90, .18) 48%, transparent 76%),
    linear-gradient(165deg, var(--card), var(--cont));
  border-left: 1px solid var(--line);
  animation: aparecer 1.2s ease .2s both;
}
.aside_grid {
  position: absolute;
  inset: 0;
  opacity: .55;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 72% 60% at 50% 38%, #000 5%, transparent 76%);
          mask-image: radial-gradient(ellipse 72% 60% at 50% 38%, #000 5%, transparent 76%);
  pointer-events: none;
}
.visual_parallax {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 20% 0);   /* recorte inferior en %: oculta la marca de Spline en cualquier alto de tarjeta */
  -webkit-mask-image: linear-gradient(to bottom, #000 68%, transparent 80%);
          mask-image: linear-gradient(to bottom, #000 68%, transparent 80%);
}
/* El visor es más ancho que el panel y va centrado: así los brazos del robot no se cortan */
.visual_parallax spline-viewer {
  position: absolute;
  top: 0; left: 50%;
  display: block;
  width: 150%; height: 100%;
  transform: translateX(-50%) scale(.92);   /* ajusta el .92 para hacer el robot más grande o más pequeño */
  transform-origin: 50% 18%;
}
.aside_fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 44%;
  background: linear-gradient(0deg, var(--cont) 6%, rgba(22, 28, 36, .86) 42%, transparent 100%);
  pointer-events: none;
}
.aside_cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 clamp(24px, 3vw, 36px) clamp(24px, 3vw, 34px); }
.aside_title { font-size: clamp(1.3rem, 2.3vw, 1.75rem); font-weight: 650; letter-spacing: -.025em; line-height: 1.12; }
.aside_linea { display: block; width: fit-content; padding-bottom: .04em; }
.aside_alt {
  background: linear-gradient(100deg, var(--cian-2) 0%, var(--cian) 55%, #0ea5c6 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* Etiquetas técnicas sobre el robot */
.visual_notes { position: absolute; inset: 0; z-index: 2; list-style: none; pointer-events: none; }
.nota {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: flex;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nota_dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(34, 211, 238, .2); }
.nota_line { flex: none; background: rgba(103, 232, 249, .45); }
.nota_txt i, .nota_txt span { display: inline-block; font-style: normal; }
.nota_txt i { margin-right: .9em; color: var(--cian); }
.nota_txt span { color: #d3dbe8; }
.nota--h { align-items: center; transform: translate(-4px, -50%); }
.nota--h .nota_line { width: var(--len); height: 1px; transform-origin: left center; }
.nota--h .nota_txt { padding-left: 10px; }
.nota--v { flex-direction: column; align-items: center; height: var(--h); transform: translate(-50%, -4px); }
.nota--v .nota_line { flex: 1 1 auto; min-height: 12px; width: 1px; transform-origin: center top; }
.nota--v .nota_txt { padding-top: 10px; }
.nota_dot, .nota_txt { animation: aparecer .8s ease var(--d) both; }
.nota--h .nota_line { animation: notaLineX .8s var(--ease) var(--d) both; }
.nota--v .nota_line { animation: notaLineY .8s var(--ease) var(--d) both; }

/* ---------- Créditos (fuera de la tarjeta) ---------- */
.login_pie { width: 100%; display: grid; gap: 8px; justify-items: center; text-align: center; }
.pie_credito {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: .86rem;
  color: var(--mut);
}
.pie_credito strong { font-weight: 600; color: #dde4ee; }
.pie_sep { color: var(--mut2); }
.pie_credito a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dde4ee;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s ease;
}
.pie_credito a svg { flex: none; width: 1.15em; height: 1.15em; }
.pie_credito a:hover { color: var(--cian); }
.pie_copy { font-size: .8rem; line-height: 1.45; color: var(--mut2); }
.pie_redes { display: flex; justify-content: center; gap: 4px; list-style: none; }
.pie_redes a {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  color: var(--mut);
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
}
.pie_redes a:hover { color: var(--tx); background: rgba(255, 255, 255, .08); }
.login_pie a:focus-visible { outline: 2px solid var(--cian); outline-offset: 2px; border-radius: 6px; }

/* ---------- Animaciones ---------- */
@keyframes subir { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes notaLineX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes notaLineY { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------- Tablet y celular: una sola columna (se oculta el panel de marca) ---------- */
@media (max-width: 860px) {
  .login_wrap { width: min(440px, 100%); }
  .login_card { grid-template-columns: minmax(0, 1fr); border-radius: 20px; }
  .login_aside { display: none; }
  .login_panel { padding: 28px 22px 26px; }
}
@media (max-width: 380px) {
  .marca_socio { gap: 0; }
  .marca_socio_logo { height: 46px; }
  .marca_socio_nombre { font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .campo input[type="email"], .campo input[type="password"], .campo input[type="text"] { font-size: 16px; } /* evita el zoom en iPhone */
}

@media (prefers-reduced-motion: reduce) {
  .login_card, .login_aside, .nota_dot, .nota_txt, .nota_line { animation: none; }
  .btn_login, .btn_login .arrow { transition: none; }
  .btn_login.cargando .btn_texto::after { animation-duration: 1.6s; }
}

/* Captcha (Turnstile): ocupa 0 de alto mientras es invisible y se abre solo si Cloudflare pide un clic */
.captcha { height: 0; margin-top: -16px; overflow: visible; }
.captcha.is-visible { height: auto; margin-top: 0; }

/* ---------- 2FA (verificación en dos pasos) ---------- */
.login_form[hidden] { display: none; }
#mfaForm { gap: 20px; }
.mfa_texto { font-size: .92rem; line-height: 1.5; color: #b4bfce; }
.mfa_qr { display: grid; place-items: center; }
.mfa_qr img { width: 168px; height: 168px; padding: 8px; background: #fff; border-radius: 12px; }
.mfa_secreto { font-family: var(--font-mono); font-size: .76rem; line-height: 1.5; color: var(--mut); word-break: break-all; }
.mfa_ayuda { font-size: .84rem; line-height: 1.5; color: var(--mut); text-align: center; }
.mfa_volver {
  justify-self: center;
  background: none;
  border: 0;
  color: var(--mut);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .2s ease;
}
.mfa_volver:hover { color: var(--tx); }

/* Código de 6 dígitos en cajas separadas */
.campo .otp { display: flex; align-items: center; justify-content: center; gap: 8px; }
.campo .otp input.otp_caja {
  flex: 1 1 0;
  min-width: 0;
  max-width: 54px;
  height: 56px;
  padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--tx);
  caret-color: var(--cian);
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo .otp input.otp_caja.is-lleno { border-color: rgba(34, 211, 238, .55); }
.campo .otp input.otp_caja:hover { border-color: rgba(255, 255, 255, .22); }
.campo .otp input.otp_caja:focus { outline: none; border-color: var(--cian); box-shadow: 0 0 0 3px rgba(34, 211, 238, .18); }
.campo .otp input.otp_caja[aria-invalid="true"] { border-color: var(--danger); }
.otp_sep { flex: 0 0 10px; height: 2px; margin: 0 2px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
/* Requisitos de la nueva contraseña (se marcan en vivo) */
.clave_reglas { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0 0 2px; font-size: .8rem; color: var(--mut2); }
.clave_reglas li { display: flex; align-items: center; gap: 7px; transition: color .2s ease; }
.clave_reglas li::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .7; transition: all .2s ease; }
.clave_reglas li.ok { color: var(--cian-2); }
.clave_reglas li.ok::before { background: var(--cian) center / 8px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%230b0f14' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2 5 8.7l4.5-5'/%3E%3C/svg%3E"); border-color: var(--cian); opacity: 1; }
@media (max-width: 380px) { .clave_reglas { grid-template-columns: 1fr; } }