*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* ══ IZQUIERDA ══ */
.left {
  width: 50%;
  height: 100vh;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.left-img {
  position: absolute;
  inset: 0;
  /* Ahora el navegador la busca en tu propia carpeta, así que el guardia la deja pasar */
  background-image: url('fondo-login.jpg');
  background-size: cover;
  background-position: center top;
}

.left-content {
  position: relative;
  z-index: 2;
  padding: 32px 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.left-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.left-brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: white;
  padding: 3px;
}

.left-brand span {
  color: white;
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.left-hero {
  margin-top: 40px;
}

.left-hero h1 {
  font-size: 56px;
  font-weight: 900;
  color: white;
  line-height: 1.0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  text-transform: uppercase;
}

.left-badge {
  display: inline-block;
  background: #f59e0b;
  color: white;
  font-size: 24px;
  font-weight: 900;
  padding: 6px 20px;
  border-radius: 8px;
  margin-top: 10px;
  text-transform: uppercase;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ══ DERECHA ══ */
.right {
  flex: 1;
  height: 100vh;
  background: white;
  display: flex;
  flex-direction: column;
}

.right-topbar {
  padding: 18px 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.right-topbar img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: contain;
}

.right-topbar span {
  font-size: 15px;
  font-weight: 800;
  color: #0a1628;
}

.right-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.right-form {
  width: 100%;
  max-width: 400px;
}

.form-logo {
  text-align: center;
  margin-bottom: 32px;
}

.form-logo-name {
  font-size: 40px;
  font-weight: 900;
  color: #0a1628;
  letter-spacing: -1px;
}

.form-logo-name span {
  color: #1aab9b;
}

.form-welcome {
  font-size: 14px;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 6px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 6px;
}

.field label span {
  color: #ef4444;
}

.input-wrap {
  position: relative;
}

.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f0f6ff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field input:focus {
  border-color: #1aab9b;
  box-shadow: 0 0 0 3px rgba(26, 171, 155, 0.1);
  background: white;
}

.eye-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #94a3b8;
}

.error-msg {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  display: none;
  align-items: center;
  gap: 8px;
}

.error-msg.show {
  display: flex;
}

.btn-login {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #0f3460;
  color: white;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 6px;
}

.btn-login:hover {
  background: #1a4a8a;
}

.btn-login:active {
  transform: scale(0.99);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.right-footer {
  padding: 20px 40px;
  border-top: 1px solid #f1f5f9;
}

.footer-version {
  text-align: center;
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 600;
  margin-bottom: 8px;
}

.footer-notes {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.8;
}

/* Trial */
.login-trial-root {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1f3c, #1a3aad, #8b1a1a);
  font-family: 'Nunito', sans-serif;
}

.login-trial-inner {
  background: white;
  border-radius: 20px;
  padding: 48px 44px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.3);
  position: relative;
}

.login-trial-accent {
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 3px;
  background: linear-gradient(90deg, #1a3aad, #c42020);
  border-radius: 0 0 4px 4px;
}

.login-trial-emoji {
  font-size: 52px;
  margin-bottom: 16px;
}

.login-trial-title {
  color: #1a2840;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-trial-body {
  color: #6b8399;
  font-size: 14px;
  line-height: 1.6;
}

.login-trial-retry {
  margin-top: 20px;
  background: #1a3aad;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}

.login-trial-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(90deg, #c42020, #e63a3a);
  color: white;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-trial-banner-msg {
  flex: 1;
}

.login-trial-banner-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.login-welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99998;
}

.login-welcome-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 16px;
  padding: 36px 40px;
  text-align: center;
  z-index: 99999;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: 'Nunito', sans-serif;
  max-width: 360px;
  width: 90%;
}

.login-welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.login-welcome-title {
  color: #1a2840;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-welcome-text {
  color: #6b8399;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.login-welcome-strong {
  color: #1a3aad;
}

.login-welcome-btn {
  background: linear-gradient(135deg, #1a3aad, #c42020);
  border: none;
  border-radius: 8px;
  color: white;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 768px) {
  .left {
    display: none;
  }
}

/* ══════════════════════════════════════════
   2FA — Paso 2: panel de código TOTP
   ══════════════════════════════════════════ */

/* Animación de transición del formulario */
#loginForm {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Cabecera del paso 2FA */
.twofa-header {
  text-align: center;
  margin-bottom: 28px;
}

.twofa-icon {
  font-size: 46px;
  margin-bottom: 10px;
  animation: twofa-bounce 0.5s ease;
}

@keyframes twofa-bounce {
  0%   { transform: scale(0.4); opacity: 0; }
  70%  { transform: scale(1.12); }
  100% { transform: scale(1);   opacity: 1; }
}

.twofa-title {
  font-size: 20px;
  font-weight: 900;
  color: #0a1628;
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}

.twofa-subtitle {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.55;
}

/* Campo de código TOTP */
.totp-input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: 'Nunito', monospace, sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 10px;
  color: #0a1628;
  background: #f0f6ff;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  caret-color: #1aab9b;
}

.totp-input:focus {
  border-color: #1aab9b;
  box-shadow: 0 0 0 4px rgba(26, 171, 155, 0.12);
  background: white;
}

.totp-input::placeholder {
  color: #cbd5e1;
  letter-spacing: 8px;
  font-size: 22px;
}

/* Botón volver */
.btn-back {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  text-align: center;
  border-radius: 8px;
  transition: color 0.18s, background 0.18s;
}

.btn-back:hover {
  color: #0f3460;
  background: #f1f5f9;
}