body {
    font-family: var(--font-sans);
    background: var(--bg-dark);
    color: var(--cream);
    min-height: 100vh;
    overflow: hidden;
}

/* ===== LAYOUT ===== */
.login-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

/* LEFT PANEL - Branding */
.login-brand {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 450px;
}

.brand-logo-large {
    display: block;
    width: 80px;
    margin: 0 auto 2rem;
}

.brand-logo-large .logo-mark {
    width: 80px;
    height: 80px;
    box-shadow: 0 10px 40px -12px rgba(201, 168, 76, 0.45);
}

.brand-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.brand-title span {
    color: var(--gold);
}

.brand-tagline {
    font-size: 1.1rem;
    color: var(--cream);
    opacity: 0.55;
    margin-bottom: 3rem;
    font-weight: 300;
    line-height: 1.6;
}

.brand-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.2rem;
    background: rgba(42, 16, 21, 0.5);
    border: 1px solid rgba(123, 45, 53, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.brand-feature:hover {
    border-color: rgba(201, 168, 76, 0.3);
    background: rgba(42, 16, 21, 0.7);
}

.brand-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(123, 45, 53, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.brand-feature-text {
    font-size: 0.9rem;
    color: var(--cream);
    opacity: 0.7;
}

/* RIGHT PANEL - Form */
.login-form-panel {
    width: 520px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.login-form-panel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(201, 168, 76, 0.2), transparent);
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-header {
    margin-bottom: 2rem;
}

/* Logo con enlace al inicio: solo en móvil, donde el panel de marca no se ve */
.login-movil-logo {
    display: none;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.75rem;
    text-decoration: none;
    color: var(--cream);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
}
.login-movil-logo .logo-mark { width: 40px; height: 40px; }
.login-movil-logo em { color: var(--gold); font-style: italic; }

.login-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--cream);
    opacity: 0.55;
    font-size: 0.95rem;
    font-weight: 300;
}

/* Social Login */
.social-login {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(123, 45, 53, 0.25);
    background: rgba(42, 16, 21, 0.5);
    color: var(--cream);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-sans);
}

.social-btn:hover {
    border-color: rgba(201, 168, 76, 0.4);
    background: rgba(42, 16, 21, 0.8);
    transform: translateY(-1px);
}

.social-btn svg {
    width: 20px;
    height: 20px;
}

/* «Mandarme otro enlace» (paso «Revisa tu correo»): secundario, lo importante es mirar el buzón */
.btn-reenviar { width: 100%; }
.btn-reenviar:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-reenviar.loading span { opacity: 0.6; }
/* Verificación en dos pasos (mejora 58): el código de 6 cifras */
.codigo-input { letter-spacing: 0.35em; font-size: 20px; font-variant-numeric: tabular-nums; }
.codigo-input::placeholder { letter-spacing: 0.35em; }
#pasoCodigo .btn-login { margin-bottom: 12px; }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: rgba(123, 45, 53, 0.25);
}

.divider-text {
    font-size: 0.8rem;
    color: var(--cream);
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Form Fields */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--cream);
    opacity: 0.8;
}

.form-input-wrapper {
    position: relative;
}

.form-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s;
}

.form-input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    background: rgba(42, 16, 21, 0.6);
    border: 1px solid rgba(123, 45, 53, 0.25);
    border-radius: 10px;
    color: var(--cream);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: all 0.3s;
    outline: none;
}

.form-input::placeholder {
    color: var(--cream);
    opacity: 0.55;
}

.form-input:focus {
    border-color: var(--gold);
    background: rgba(42, 16, 21, 0.8);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.08);
}

.form-input:focus ~ .form-input-icon,
.form-input:focus + .form-input-icon {
    opacity: 0.8;
}

.form-input-wrapper:focus-within .form-input-icon {
    opacity: 0.8;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--cream);
    opacity: 0.55;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    transition: opacity 0.3s;
}

.password-toggle:hover {
    opacity: 0.8;
}

/* Remember & Forgot */
.form-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-wrapper input {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1.5px solid rgba(123, 45, 53, 0.4);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.custom-checkbox svg {
    width: 10px;
    height: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.checkbox-wrapper input:checked + .custom-checkbox {
    background: var(--burgundy);
    border-color: var(--burgundy);
}

.checkbox-wrapper input:checked + .custom-checkbox svg {
    opacity: 1;
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--cream);
    opacity: 0.6;
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--gold);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.forgot-link:hover {
    opacity: 1;
}

/* Submit Button */
.btn-login {
    width: 100%;
    padding: 0.95rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--text-dark);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.25);
}

.btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-pale));
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(201, 168, 76, 0.35);
}

.btn-login:hover::before {
    opacity: 1;
}

.btn-login span {
    position: relative;
    z-index: 1;
}

.btn-login:active {
    transform: translateY(0);
}

/* Loading state */
.btn-login.loading span {
    opacity: 0;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid transparent;
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 1;
    top: 50%;
    left: 50%;
    margin: -11px 0 0 -11px;
}

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

/* Sign Up Link */
.signup-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--cream);
    opacity: 0.55;
}

.signup-link a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.signup-link a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Security Badge */
.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--cream);
    opacity: 0.55;
}

.security-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.security-badge { text-align: center; line-height: 1.5; }
.security-badge a { color: inherit; text-decoration: underline; }

/* Form Error States */
.form-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(196, 90, 90, 0.1);
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.4rem;
    display: none;
}

.form-error.visible {
    display: block;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(42, 16, 21, 0.95);
    border: 1px solid rgba(123, 45, 53, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 100;
    /* fuera de la pantalla y oculto: en el móvil, con translateX(120 %) asomaba un trozo */
    transform: translateX(calc(100% + 3rem));
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.toast.show {
    transform: translateX(0);
    visibility: visible;
}

.toast.success {
    border-color: rgba(74, 158, 110, 0.4);
}

.toast.error {
    border-color: rgba(196, 90, 90, 0.4);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--cream);
}

/* En el móvil, el aviso ocupa el ancho con margen a los dos lados (antes tocaba el borde izquierdo). */
@media (max-width: 600px) {
    .toast { top: 1rem; left: 1rem; right: 1rem; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .login-brand {
        display: none;
    }
    .login-form-panel {
        width: 100%;
    }
    .login-form-panel::before {
        display: none;
    }
    .login-movil-logo {
        display: inline-flex;
    }
}

@media (max-width: 480px) {
    .login-form-panel {
        padding: 1.5rem;
    }
    .social-login {
        flex-direction: column;
    }
    .login-header h2 {
        font-size: 1.5rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card > * {
    animation: fadeInUp 0.6s ease-out both;
}

.login-card > *:nth-child(1) { animation-delay: 0.1s; }
.login-card > *:nth-child(2) { animation-delay: 0.15s; }
.login-card > *:nth-child(3) { animation-delay: 0.2s; }
.login-card > *:nth-child(4) { animation-delay: 0.25s; }
.login-card > *:nth-child(5) { animation-delay: 0.3s; }
.login-card > *:nth-child(6) { animation-delay: 0.35s; }
.login-card > *:nth-child(7) { animation-delay: 0.4s; }
.login-card > *:nth-child(8) { animation-delay: 0.45s; }
.login-card > *:nth-child(9) { animation-delay: 0.5s; }
.login-card > *:nth-child(10) { animation-delay: 0.55s; }

.brand-content > * {
    animation: fadeInUp 0.8s ease-out both;
}
.brand-content > *:nth-child(1) { animation-delay: 0.1s; }
.brand-content > *:nth-child(2) { animation-delay: 0.2s; }
.brand-content > *:nth-child(3) { animation-delay: 0.3s; }
.brand-content > *:nth-child(4) { animation-delay: 0.4s; }

/* Recuperar la contraseña (restablecer.html) */
.reset-ok, .reset-error { font-size: 14px; line-height: 1.55; border-radius: 10px; padding: 14px 16px; margin: 4px 0 18px; }
.reset-ok { color: var(--cream); background: rgba(201,168,76,0.10); border: 1px solid rgba(201,168,76,0.45); }
.reset-error { color: var(--danger); background: var(--danger-bg, rgba(208,106,106,0.10)); border: 1px solid var(--danger); }
.login-card .signup-link + .signup-link { margin-top: 10px; }

/* Lo que se oculta con el atributo hidden (paso «Revisa tu correo» del login, verificar.html) */
.login-card [hidden] { display: none !important; }
