:root {
    --app-primary: #0881c8;
    --app-primary-dark: #066aa3;
    --app-bg: #f8fafc;
    --app-surface: #ffffff;
    --app-border: #e2e8f0;
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.05);
    --app-focus-ring: rgba(8, 129, 200, 0.15);
    --auth-gutter: 24px;
    --auth-radius: 20px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: 'Gilroy', sans-serif;
    color: var(--app-text);
    background: var(--app-bg);
    -webkit-font-smoothing: antialiased;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Header --- */
.auth-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1px solid var(--app-border);
}

.auth-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--auth-gutter);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-header__brand {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
}

.auth-header__brand img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.auth-a11y {
    display: flex;
    align-items: center;
    gap: 4px;
}

.auth-a11y__button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--app-primary);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 1.2rem;
}

.auth-a11y__button:hover {
    background: var(--app-bg);
}

.auth-a11y__button:focus-visible {
    outline: 2px solid var(--app-primary);
    outline-offset: 2px;
}

.auth-a11y__font-icon {
    font-family: 'Gilroy', sans-serif;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
}

/* --- Hero --- */
.auth-hero {
    position: relative;
    overflow: hidden;
    background: var(--app-primary);
    display: flex;
    align-items: center;
    padding: 40px var(--auth-gutter) 96px;
}

.pagina-inicial .auth-hero {
    height: 400px;
}

.auth-hero--short {
    padding-bottom: 72px;
}

.auth-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.auth-hero__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-hero__bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(8, 129, 200, 0.8);
    mix-blend-mode: multiply;
}

.auth-hero__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(8, 129, 200, 0.6), rgba(8, 129, 200, 0.9));
}

.auth-hero__content {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: fadeUp 0.6s ease-out forwards;
}

.auth-hero__logo {
    width: min(100%, var(--marca-nexus-login));
    height: auto;
    margin-bottom: 14px;
}

.auth-hero__title {
    display: none;
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}

.auth-hero__subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

/* --- Card grid --- */
.auth-cards {
    max-width: 1200px;
    margin: -64px auto 0;
    padding: 0 var(--auth-gutter) 48px;
    position: relative;
    z-index: 2;
}

.pagina-inicial .auth-cards {
    --auth-radius: 18px;
    margin-top: -80px;
}

.auth-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.auth-card-grid--single {
    max-width: 460px;
    margin: 0 auto;
}

.auth-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--auth-radius);
    box-shadow: var(--app-shadow);
    padding: 32px;
    display: flex;
    flex-direction: column;
    animation: fadeUp 0.6s ease-out forwards;
    align-items: center;
}

.pagina-inicial .auth-card {
    padding: 24px;
}

.auth-card--action {
    align-items: center;
    text-align: center;
}

.auth-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--app-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.pagina-inicial .auth-card__icon {
    width: 58px;
    height: 58px;
}

.auth-card__title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--app-text);
    margin: 0 0 8px;
}

.pagina-inicial .auth-card__title {
    font-size: 20px;
    line-height: 28px;
}

.auth-card__title--login {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-card__title-icon {
    width: 28px;
    height: 28px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--app-primary);
    color: var(--app-surface);
    font-size: 14px;
}

.auth-card__text {
    color: var(--app-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 20px;
}

.pagina-inicial .auth-card__text {
    font-size: 14px;
}

.auth-card__cta {
    margin-top: auto;
    width: 100%;
    height: 46px;
    border: 1px solid var(--app-primary);
    background: transparent;
    color: var(--app-primary);
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagina-inicial .auth-card__cta {
    height: 44px;
    font-size: 14px;
}

.auth-card__cta:hover {
    background: var(--app-primary);
    color: #ffffff;
}

.auth-card__footer-link {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--app-border);
    text-align: center;
}

.auth-link-muted {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--app-muted);
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.auth-link-muted:hover {
    color: var(--app-primary);
}

/* --- Form (Card 1 do login / card único do escopo) --- */
.field-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--app-text);
    font-size: 0.85rem;
    font-weight: 700;
}

.input-shell {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.form-control-custom {
    height: 50px;
    width: 100%;
    padding: 0 16px 0 46px;
    border-radius: 12px;
    border: 1px solid var(--app-border);
    background: #f8fafc;
    color: var(--app-text);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.form-control-custom:focus {
    background: #ffffff;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px var(--app-focus-ring);
    outline: none;
}

.form-control-custom:focus~.input-icon {
    color: var(--app-primary);
}

.form-control-custom:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

select.form-control-custom {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
}

.btn-toggle-password {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-password:hover {
    color: var(--app-primary);
}

.btn-login {
    height: 50px;
    width: 100%;
    border: none;
    border-radius: 12px;
    background: var(--app-primary);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.btn-login:hover {
    background: var(--app-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(8, 129, 200, 0.2);
}

.auth-footer {
    text-align: center;
    padding: 24px var(--auth-gutter) 40px;
}

.auth-footer span {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 500;
}

/* --- Alto contraste --- */
body.high-contrast {
    --app-bg: #000000;
    --app-surface: #000000;
    --app-text: #ffff00;
    --app-muted: #ffff00;
    --app-border: #ffff00;
    --app-primary: #ffff00;
    --app-primary-dark: #ffd400;
}

body.high-contrast .auth-header {
    background: #000000;
    border-bottom-color: #ffff00;
}

body.high-contrast .auth-a11y__button {
    color: #ffff00;
}

body.high-contrast .auth-a11y__button:hover {
    background: #1a1a1a;
}

body.high-contrast .auth-hero__bg::before,
body.high-contrast .auth-hero__bg::after {
    background: rgba(0, 0, 0, 0.85);
}

body.high-contrast .auth-card {
    border-color: #ffff00;
    box-shadow: none;
}

body.high-contrast .form-control-custom {
    background: #000000;
    color: #ffff00;
    border-color: #ffff00;
}

body.high-contrast .form-control-custom::placeholder {
    color: #b8b800;
}

body.high-contrast .btn-login,
body.high-contrast .auth-card__icon {
    background: #ffff00;
    color: #000000;
}

body.high-contrast .auth-card__cta {
    border-color: #ffff00;
    color: #ffff00;
}

body.high-contrast .auth-card__cta:hover {
    background: #ffff00;
    color: #000000;
}

/* --- Responsivo --- */
@media (min-width: 992px) {
    .auth-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 520px) {
    .auth-cards {
        margin-top: -40px;
    }

    .pagina-inicial .auth-cards {
        margin-top: -40px;
    }

    .auth-card {
        padding: 24px;
    }

    .auth-hero {
        padding-top: 32px;
        padding-bottom: 64px;
    }

    .auth-hero__logo {
        width: min(100%, var(--marca-nexus-login-movel));
    }
}

@media (max-width: 767px) {
    .pagina-inicial .auth-card-grid {
        gap: 16px;
    }

    .pagina-inicial .auth-card {
        padding: 16px;
    }
}