:root {
    --brand-color: var(--primary-color, #004a7c);
    --brand-mid: var(--primary-mid, #0069b0);
    --brand-light: var(--primary-light, #0ea5e9);
    --brand-gradient: linear-gradient(160deg, var(--brand-color) 0%, var(--brand-mid) 48%, var(--brand-light) 100%);
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
}

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

body.login-page {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-primary);
    background: #041527;
    -webkit-font-smoothing: antialiased;
}

.login-shell {
    min-height: 100dvh;
}

/* —— Hero full-bleed —— */
.login-hero {
    position: relative;
    isolation: isolate;
    min-height: 100dvh;
    overflow: hidden;
    color: #fff;
}

.login-hero-media {
    position: absolute;
    inset: -3%;
    z-index: 0;
    background-color: var(--brand-color);
    background-image:
        var(--login-hero-image),
        radial-gradient(ellipse 90% 70% at 18% 28%, rgba(255, 255, 255, 0.14) 0%, transparent 55%),
        radial-gradient(ellipse 70% 55% at 88% 78%, rgba(14, 165, 233, 0.28) 0%, transparent 60%),
        linear-gradient(145deg, #021a2e 0%, var(--brand-color) 42%, var(--brand-mid) 72%, #0b3a5c 100%);
    background-size: cover, auto, auto, auto;
    background-position: center, center, center, center;
    background-repeat: no-repeat;
    transform: translate3d(var(--hero-shift-x, 0px), var(--hero-shift-y, 0px), 0) scale(1.04);
    will-change: transform;
}

.login-hero-media::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.18;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.35) 1px, transparent 0);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 88%);
    pointer-events: none;
}

.login-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(115deg, rgba(2, 18, 34, 0.82) 0%, rgba(2, 26, 48, 0.55) 42%, rgba(0, 74, 124, 0.38) 100%),
        linear-gradient(180deg, rgba(2, 14, 28, 0.35) 0%, transparent 38%, rgba(2, 14, 28, 0.55) 100%);
}

.login-hero-scrim {
    display: none;
}

.login-hero-layout {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    min-height: 100dvh;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 3rem);
}

.login-brand {
    max-width: 34rem;
    animation: loginFadeIn 0.7s ease both;
}

.login-brand--mark-only .login-brand-logo-wrap {
    margin-bottom: 1rem;
}

.login-brand-kicker {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.login-brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 1.15rem;
    margin-bottom: 1.75rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.login-brand-logo {
    height: 44px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

.login-brand-logo-wrap--light {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.92);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
    padding: 1.15rem 1.6rem;
}

.login-brand-logo-wrap--light .login-brand-logo {
    height: 64px;
    max-width: 320px;
}

.login-brand-logo-wrap--dark {
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
}

.login-brand-logo-wrap--dark .login-brand-logo {
    height: 72px;
    width: auto;
    max-width: min(420px, 90vw);
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.45));
}

.login-brand-logo-wrap--dark.login-brand-logo-wrap--tall .login-brand-logo {
    height: 112px;
    max-width: min(540px, 92vw);
}

.login-brand-logo-wrap--dark.login-brand-logo-wrap--wide .login-brand-logo {
    height: auto;
    max-height: 96px;
    max-width: min(560px, 92vw);
}

.login-brand-logo-wrap--light.login-brand-logo-wrap--tall {
    padding: 1.1rem 1.5rem;
}

.login-brand-logo-wrap--light.login-brand-logo-wrap--tall .login-brand-logo {
    height: 84px;
    max-width: 300px;
}

.login-brand-logo-wrap--light.login-brand-logo-wrap--wide {
    padding: 1rem 1.5rem;
    max-width: 100%;
}

.login-brand-logo-wrap--light.login-brand-logo-wrap--wide .login-brand-logo {
    height: auto;
    max-height: 64px;
    width: auto;
    max-width: min(360px, 100%);
}

.login-brand-title {
    font-size: clamp(2.35rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0 0 0.85rem;
    letter-spacing: -0.035em;
    text-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.login-brand-tagline {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.55;
    opacity: 0.92;
    margin: 0;
    max-width: 34ch;
    font-weight: 400;
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

/* —— Formulário glass —— */
.login-form-panel {
    display: flex;
    justify-content: flex-end;
    animation: loginSlideIn 0.75s ease both;
    animation-delay: 0.08s;
}

.login-form-card {
    width: 100%;
    max-width: 440px;
    padding: clamp(1.35rem, 3vw, 1.85rem);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow:
        0 24px 64px rgba(2, 14, 28, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    color: var(--text-primary);
}

.login-form-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.login-form-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 74, 124, 0.1) 0%, rgba(14, 165, 233, 0.12) 100%);
    color: var(--brand-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    border: 1px solid rgba(0, 74, 124, 0.08);
}

.login-title {
    font-weight: 800;
    font-size: 1.45rem;
    color: var(--text-primary);
    margin: 0 0 0.3rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

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

.login-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.input-group-custom {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.2rem 0.55rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group-custom:focus-within {
    border-color: var(--brand-mid);
    box-shadow: 0 0 0 4px rgba(0, 105, 176, 0.1);
}

.input-group-custom.error {
    border-color: #fca5a5;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-group-custom.success {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.08);
}

.input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    color: #94a3b8;
    font-size: 1rem;
    flex-shrink: 0;
}

.input-group-custom:focus-within .input-icon {
    color: var(--brand-color);
}

.form-control-custom {
    border: none;
    height: 48px;
    flex: 1;
    min-width: 0;
    padding: 0;
    font-size: 0.94rem;
    color: #1e293b;
    background: transparent;
    outline: none;
}

.form-control-custom::placeholder {
    color: #94a3b8;
}

.btn-toggle-pass {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    border-radius: 6px;
}

.btn-toggle-pass:hover {
    color: var(--brand-color);
    background: #f1f5f9;
}

.caps-warning {
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    color: #f59e0b;
    font-size: 0.85rem;
    display: none;
}

.feedback-text {
    font-size: 0.72rem;
    margin: 0.3rem 0 0 0.15rem;
    min-height: 0;
    display: none;
}

.feedback-text.show {
    display: block;
}

.feedback-text.error { color: #ef4444; }
.feedback-text.success { color: #10b981; }
.feedback-text.loading { color: var(--brand-mid); }

.feedback-inline-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 500;
}

.feedback-spinner {
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid rgba(0, 74, 124, 0.18);
    border-top-color: var(--brand-mid);
    border-radius: 50%;
    animation: loginSpin 0.7s linear infinite;
    flex-shrink: 0;
}

.input-group-custom.is-loading {
    border-color: rgba(0, 105, 176, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 105, 176, 0.1);
}

.login-form--submitting .recaptcha-shell,
.login-form--submitting .login-options {
    opacity: 0.72;
    pointer-events: none;
}

.btn-login.is-loading {
    pointer-events: none;
    opacity: 0.92;
}

.btn-login.is-loading .bi-arrow-right {
    animation: loginSpin 0.7s linear infinite;
}

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

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes loginSlideIn {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.25rem 0 1.35rem;
}

.login-options .form-check-label {
    font-size: 0.84rem;
    color: var(--text-muted);
}

.login-forgot {
    font-size: 0.84rem;
    color: var(--brand-mid);
    text-decoration: none;
    font-weight: 600;
}

.login-forgot:hover {
    color: var(--brand-color);
    text-decoration: underline;
}

.login-forgot-btn {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.login-forgot-modal {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.login-forgot-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-mid);
}

.login-forgot-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.login-forgot-lead {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.55;
}

.login-forgot-steps {
    margin: 0 0 1.25rem;
    padding-left: 1.15rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.login-forgot-steps li + li {
    margin-top: 0.55rem;
}

.login-forgot-support {
    display: grid;
    gap: 0.65rem;
}

.login-forgot-support-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 0.95rem;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}

.login-forgot-support-link:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--brand-mid);
}

.btn-login--compact {
    min-height: 44px;
    padding-inline: 1.25rem;
}

.form-check-input:checked {
    background-color: var(--brand-color);
    border-color: var(--brand-color);
}

.recaptcha-shell {
    margin-bottom: 1.35rem;
    padding: 0.85rem;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    background: rgba(248, 250, 252, 0.92);
}

.recaptcha-box {
    display: flex;
    justify-content: center;
    transform-origin: center top;
}

.btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    background: var(--brand-gradient);
    border: none;
    border-radius: 12px;
    height: 52px;
    width: 100%;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 24px -10px rgba(0, 74, 124, 0.55);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -10px rgba(0, 74, 124, 0.6);
}

.btn-login:disabled {
    opacity: 0.75;
    cursor: wait;
}

.btn-login i {
    font-size: 1.1rem;
    transition: transform 0.2s;
}

.btn-login:hover:not(:disabled) i {
    transform: translateX(3px);
}

.login-form-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    text-align: center;
}

.login-trust {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.login-credits {
    font-size: 0.78rem;
    color: #94a3b8;
}

.login-credits a {
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 700;
}

.login-copy {
    font-size: 0.72rem;
    color: #94a3b8;
}

.login-privacy-link {
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 600;
}

.login-privacy-link:hover {
    text-decoration: underline;
}

.login-copy-sep {
    color: #cbd5e1;
}

.alert-custom {
    border: none;
    border-radius: 12px;
    font-size: 0.86rem;
    animation: slideInDown 0.35s ease-out;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* —— Loading —— */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.98);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    text-align: center;
    max-width: 320px;
    padding: 1rem;
}

.spinner-premium {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.spinner-circle {
    width: 100%;
    height: 100%;
    border: 3px solid #e2e8f0;
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.spinner-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--brand-color);
}

.loading-message {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.loading-submessage {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.steps-indicator {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.25s ease;
}

.step-dot.active {
    width: 22px;
    border-radius: 4px;
    background: var(--brand-mid);
}

.step-dot.completed {
    background: #10b981;
}

/* —— Mobile: form sobre o hero com scrim —— */
@media (max-width: 1024px) {
    .login-hero-layout {
        grid-template-columns: 1fr;
        align-content: center;
        justify-items: center;
        gap: 1.5rem;
        padding-top: 2rem;
        padding-bottom: 2.5rem;
    }

    .login-brand {
        text-align: center;
        max-width: 28rem;
    }

    .login-brand-tagline,
    .login-brand-kicker {
        margin-inline: auto;
    }

    .login-form-panel {
        width: 100%;
        justify-content: center;
    }

    .login-form-card {
        max-width: 460px;
        margin-inline: auto;
    }

    .login-hero-scrim {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 1;
        pointer-events: none;
        background: linear-gradient(
            180deg,
            rgba(2, 14, 28, 0.45) 0%,
            rgba(2, 18, 34, 0.62) 42%,
            rgba(2, 18, 34, 0.78) 100%
        );
    }
}

@media (max-width: 420px) {
    .login-hero-layout {
        padding: 1.25rem 1rem 2rem;
    }

    .login-form-card {
        padding: 1.15rem;
        border-radius: 18px;
    }

    .login-form-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .login-brand-title {
        font-size: 2.1rem;
    }

    .recaptcha-box {
        transform: scale(0.9);
    }

    .recaptcha-shell {
        padding: 0.65rem 0.35rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-brand,
    .login-form-panel,
    .alert-custom,
    .spinner-circle,
    .btn-login {
        animation: none !important;
        transition: none !important;
    }

    .login-hero-media {
        transform: none;
        will-change: auto;
    }
}

.form-control-custom:focus,
.btn-login:focus,
.form-check-input:focus,
.btn-toggle-pass:focus {
    outline: 2px solid var(--brand-mid);
    outline-offset: 2px;
}
