/* Scoped to login page only — loaded via login.html, not global custom.css */
body.login-page {
    width: 100%;
    max-width: none;
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1f2937;
    background: #ffffff;
    min-height: 100vh;
}

.login-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Left panel: Integral branding ── */
.login-brand {
    flex: 1.05;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 3rem;
    background: linear-gradient(165deg, #faf5ff 0%, #f5f0ff 35%, #ffffff 100%);
    border-right: 1px solid #ede9fe;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -60px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, transparent 68%);
    pointer-events: none;
}

.login-brand::after {
    content: "";
    position: absolute;
    bottom: 10%;
    left: -80px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.brand-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.brand-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.brand-logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

.brand-logo-text span {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #7c3aed;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-top: 0.1rem;
}

.brand-badge {
    align-self: flex-start;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.85);
    color: #7c3aed;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid #ddd6fe;
}

.brand-copy {
    flex-shrink: 0;
}

.brand-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
    margin: 0 0 0.65rem;
}

.brand-heading .accent-line {
    display: block;
    width: 44px;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 2px;
    margin-bottom: 0.85rem;
}

.brand-description {
    color: #6b7280;
    font-size: 0.925rem;
    margin: 0;
    line-height: 1.65;
    max-width: 440px;
}

.brand-callout {
    padding: 1.25rem 1.5rem;
    border: 2px solid #7c3aed;
    border-radius: 4px;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.65;
    background: rgba(255, 255, 255, 0.7);
}

.brand-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.brand-feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-feature-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.brand-feature-title {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
    margin: 0 0 0.25rem;
}

.brand-feature-text {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.55;
}

/* ── Right panel: Sign-in form ── */
.login-form-panel {
    flex: 0.95;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #f9fafb;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
}

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

.login-card-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.35rem;
}

.login-card-header p {
    color: #6b7280;
    font-size: 0.9rem;
    margin: 0;
}

.login-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.login-alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.login-alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.login-field {
    margin-bottom: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.4rem;
}

.login-field input[type="email"],
.login-field input[type="password"],
.login-field input[type="text"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.login-field input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
}

.password-toggle:hover {
    color: #6b7280;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.login-submit {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.login-submit-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: login-spin 0.7s linear infinite;
}

.login-submit.is-loading .login-submit-spinner {
    display: inline-block;
}

.login-submit.is-loading,
.login-submit:disabled {
    opacity: 0.85;
    cursor: wait;
}

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

.login-submit:hover {
    opacity: 0.92;
}

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

.login-errors {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.login-errors li {
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.login-footer {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}

.login-footer a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* ── MFA verification (integral2024 OTP style inside login card) ── */
.login-card-mfa {
    text-align: center;
}

.login-card-mfa .integral-otp-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #3b82f6;
}

.integral-otp-icon-wrap svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.integral-otp-title {
    margin: 0 0 0.5rem;
    color: #0f172a;
    font-size: 1.45rem;
    font-weight: 700;
}

.integral-otp-subtitle {
    margin: 0 0 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

.integral-otp-subtitle strong {
    color: #334155;
    font-weight: 600;
}

.integral-otp-field {
    text-align: left;
}

.integral-otp-label {
    display: block;
    margin-bottom: 0.45rem;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 600;
}

.integral-otp-input-wrap {
    position: relative;
}

.integral-otp-input-icon {
    position: absolute;
    top: 50%;
    left: 0.95rem;
    transform: translateY(-50%);
    color: #3b82f6;
    pointer-events: none;
    display: flex;
    align-items: center;
}

.integral-otp-input-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.integral-otp-input {
    width: 100%;
    height: 52px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 0 1rem 0 2.6rem;
    color: #0f172a;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.45rem;
    text-align: center;
    background: #ffffff;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.integral-otp-input::placeholder {
    color: #cbd5e1;
    letter-spacing: 0.45rem;
    font-weight: 500;
}

.integral-otp-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.integral-otp-input.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

.integral-otp-hint,
.integral-otp-error {
    margin: 0.55rem 0 0;
    font-size: 0.82rem;
    line-height: 1.4;
}

.integral-otp-hint {
    color: #94a3b8;
    text-align: center;
}

.integral-otp-error {
    display: none;
    color: #dc2626;
    text-align: center;
}

.integral-otp-error.is-visible {
    display: block;
}

.integral-otp-submit {
    width: 100%;
    height: 52px;
    margin-top: 1.35rem;
    border: 0;
    border-radius: 12px;
    background: #60a5fa;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.integral-otp-submit:hover,
.integral-otp-submit:focus {
    background: #3b82f6;
}

.integral-otp-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.integral-otp-footer {
    margin-top: 1.35rem;
    padding-top: 1.1rem;
    border-top: 1px solid #e2e8f0;
}

.integral-otp-footer-text {
    margin: 0 0 0.45rem;
    color: #64748b;
    font-size: 0.88rem;
}

.integral-otp-footer-text .integral-otp-footer-link {
    margin-left: 0.25rem;
    display: inline;
}

.integral-otp-resent {
    margin: 0 0 0.55rem;
    color: #15803d;
    font-size: 0.82rem;
    font-weight: 600;
}

.integral-otp-footer-link {
    display: block;
    margin: 0.15rem 0;
    color: #3b82f6;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
}

.integral-otp-footer-link:hover,
.integral-otp-footer-link:focus {
    color: #2563eb;
    text-decoration: underline;
}

.mfa-sent-banner {
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.85rem;
    line-height: 1.45;
    text-align: left;
}

.mfa-sent-banner strong {
    color: #1e3a8a;
}

/* ── MFA overlay on login page ── */
.integral-otp-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.integral-otp-overlay.is-visible {
    display: flex;
}

.integral-otp-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 2rem 2rem 1.5rem;
    border: 1px solid #93c5fd;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    text-align: center;
}

.integral-otp-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 5;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
}

.integral-otp-close:hover,
.integral-otp-close:focus {
    background: #f1f5f9;
    color: #64748b;
}

.integral-otp-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #3b82f6;
}

/* ── Responsive ── */
@media (max-width: 960px) {
    .login-layout {
        flex-direction: column;
    }

    .login-brand {
        flex: none;
        padding: 2.5rem 2rem 2rem;
        border-right: none;
        border-bottom: 1px solid #ede9fe;
    }

    .brand-content {
        max-width: 560px;
        margin: 0 auto;
    }

    .brand-heading {
        font-size: 1.5rem;
    }

    .login-form-panel {
        padding: 2rem 1.25rem 3rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 961px) and (max-height: 780px) {
    .login-brand {
        padding: 1.75rem 2.5rem;
    }

    .brand-content {
        gap: 1.1rem;
    }

    .brand-heading {
        font-size: 1.5rem;
    }
}
