:root {
    --brand-color: #004a7c;
    --brand-mid: #0069b0;
    --brand-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;
    --panel-dark: #032d4d;
}

*,
*::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: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    min-height: 100dvh;
}

/* —— Painel da marca —— */
.login-brand-panel {
    position: relative;
    overflow: hidden;
    background: var(--brand-gradient);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 4vw, 3.5rem) clamp(2rem, 5vw, 4rem);
}

.login-brand-grid {
    position: absolute;
    inset: 0;
    opacity: 0.38;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 48px 48px, 48px 48px, 48px 48px;
    background-position:
        calc(var(--grid-shift-x, 0px)) calc(var(--grid-shift-y, 0px)),
        calc(var(--grid-shift-x, 0px)) calc(var(--grid-shift-y, 0px)),
        calc(var(--grid-shift-x, 0px)) calc(var(--grid-shift-y, 0px));
    mask-image: linear-gradient(180deg, #000 0%, transparent 92%);
    pointer-events: none;
    will-change: background-position;
}

.login-brand-spotlight {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    background: radial-gradient(
        520px circle at var(--spot-x, 50%) var(--spot-y, 40%),
        rgba(255, 255, 255, 0.14) 0%,
        rgba(255, 255, 255, 0.05) 38%,
        transparent 68%
    );
}

.login-brand-panel--interactive .login-brand-spotlight {
    opacity: 1;
}

.login-brand-glow {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    top: -180px;
    right: -120px;
    background: radial-gradient(circle, rgba(255,255,255,0.22) 0%, transparent 68%);
    pointer-events: none;
    transform: translate3d(var(--glow-shift-x, 0px), var(--glow-shift-y, 0px), 0);
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    .login-brand-grid,
    .login-brand-glow,
    .login-brand-spotlight {
        transition: none !important;
        will-change: auto;
    }
}

.login-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

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

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

/* Logo com cores escuras/verdes (ex.: Granorte) — fundo sólido no painel azul */
.login-brand-logo-wrap--light {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.92);
    backdrop-filter: none;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
    padding: 0.95rem 1.35rem;
}

.login-brand-logo-wrap--light .login-brand-logo {
    height: 48px;
    max-width: 260px;
}

.login-brand-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.8;
    margin: 0 0 0.65rem;
}

.login-brand-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.08;
    margin: 0 0 0.85rem;
    letter-spacing: -0.03em;
}

.login-brand-tagline {
    font-size: 1.02rem;
    line-height: 1.6;
    opacity: 0.9;
    margin: 0 0 2.25rem;
    max-width: 38ch;
    font-weight: 400;
}

.login-feature-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.login-feature-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    transition: background 0.2s ease, transform 0.2s ease;
}

.login-feature-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(4px);
}

.login-feature-icon {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.login-feature-icon i {
    font-size: 1.45rem;
    line-height: 1;
    display: block;
}

.login-feature-copy strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.login-feature-copy > span {
    display: block;
    font-size: 0.78rem;
    line-height: 1.45;
    opacity: 0.88;
    font-weight: 400;
}

.login-brand-footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.85;
    padding-top: 2rem;
}

.login-brand-footer span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* —— Painel do formulário —— */
.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    background:
        radial-gradient(circle at 100% 0%, rgba(0, 105, 176, 0.06) 0%, transparent 42%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

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

.login-mobile-brand {
    display: none;
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-mobile-brand img {
    height: 42px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

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

.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.5rem;
    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: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08);
}

.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);
}

.input-group-custom.error {
    border-color: #fca5a5;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 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); }
}

.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: #f8fafc;
}

.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: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    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;
}

@media (max-width: 1024px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand-panel {
        display: none;
    }

    .login-mobile-brand {
        display: block;
    }

    .login-form-panel {
        min-height: 100dvh;
        align-items: flex-start;
        padding-top: 2.5rem;
    }
}

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

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

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

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

@media (prefers-reduced-motion: reduce) {
    .spinner-circle,
    .alert-custom,
    .btn-login,
    .login-feature-card {
        animation: none;
        transition: none;
    }
}

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