:root {
    --azul: #213880;
    --azul-hover: #162760;
    --ciano: #8cc7db;
    --cinza: #6b7280;
    --texto: #374151;
    --texto-muted: #4b5563;
    --erro: #c00;
    --erro-bg: #ffdde1;
    --erro-fg: #600;
    --borda: #dde3ee;
    --btn-bg: var(--azul);
    --btn-bg-hover: var(--azul-hover);
    --radius: 12px;
    --shell-max: 420px;
    --shell-wide: 520px;
}

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

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1em;
    color: #1f2937;
}

#all {
    border-top: 25px solid var(--azul);
    border-bottom: 10px solid var(--ciano);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 24px 40px;
    background-image:
        url("../images/bg-login-left-zn8wzlY.png"), url("../images/bg-login-right-6b1muXX.png");
    background-position:
        left top,
        right top;
    background-repeat: repeat-y;
}

#all.internas {
    justify-content: flex-start;
    padding-top: 48px;
}

.auth-page--com-rodape {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-page--com-rodape #all {
    flex: 1 1 auto;
    min-height: 0;
    border-bottom: none;
}

.auth-shell {
    width: 100%;
    max-width: var(--shell-max);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.auth-shell--wide {
    max-width: var(--shell-wide);
}

.logo-container {
    width: 170px;
    max-width: 50%;
    display: flex;
}

.logo-container h1 {
    text-indent: -99999px;
    overflow: hidden;
    background: transparent url("../images/logo-egam-login-ZHehfKj.png") no-repeat
        center center;
    background-size: contain;
    height: 96px;
    width: 100%;
    margin: 0;
}

h2 {
    color: var(--azul);
    margin: 0 0 8px;
    font-size: 1.35em;
}

.title-err {
    color: #a00;
}

label {
    color: var(--azul);
    font-weight: bold;
    font-size: 0.9em;
}

.form .required,
.cad-req {
    color: var(--erro);
}

/* Controles */
:where(
    input[type="text"],
    input[type="password"],
    input[type="button"],
    input[type="submit"],
    select,
    button[type="submit"]
) {
    width: 100%;
    border-radius: var(--radius);
    font-size: 1em;
}

:where(input[type="text"], input[type="password"], select) {
    padding: 11px 14px;
    border: 1px solid #b0b7c3;
}

:where(
    input[type="text"],
    input[type="password"],
    input[type="button"],
    input[type="submit"],
    select,
    button[type="submit"]
):focus {
    outline: none;
    border-color: var(--azul);
    box-shadow: 0 0 0 2px rgba(33, 56, 128, 0.2);
}

:where(
    input[type="button"],
    input[type="submit"],
    button[type="submit"],
    .auth-btn,
    .cad-btn-verificar,
    .autocadastro a
) {
    border: none;
    border-radius: var(--radius);
    background: var(--btn-bg);
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

:where(
    input[type="button"],
    input[type="submit"],
    button[type="submit"],
    .auth-btn,
    .cad-btn-verificar,
    .autocadastro a
):hover {
    background: var(--btn-bg-hover);
}

:where(input[type="button"], input[type="submit"], button[type="submit"]) {
    padding: 12px;
    margin-top: 6px;
}

.auth-btn--outline,
.cad-btn-verificar {
    border: 1px solid var(--azul);
    background: #fff;
    color: var(--azul);
}

:is(.auth-btn--outline, .cad-btn-verificar):hover {
    background: var(--azul);
    color: #fff;
}

.loading {
    position: relative;
    color: rgba(255, 255, 255, 0.65);
    cursor: wait;
    background: var(--azul-hover);
}

:where(.loading, #statusExistencia.load)::before {
    content: "";
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading::before {
    position: absolute;
    left: 12px;
    top: 50%;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}

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

/* Card */
.auth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
    padding: 28px 26px 24px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e5e9f2;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(33, 56, 128, 0.1);
}

.auth-icone {
    font-size: 2.2rem;
    margin-bottom: 10px;
    line-height: 1;
}

:is(.auth-icone--ok, .auth-icone--err, .auth-icone--cliente) {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--d, 52px);
    height: var(--d, 52px);
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

.auth-icone--ok {
    background: var(--azul);
}
.auth-icone--err {
    background: #c44;
}

.auth-descricao {
    color: var(--texto-muted);
    font-size: 0.92em;
    line-height: 1.5;
    margin: 0 0 18px;
}

.auth-form,
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.auth-form {
    margin-bottom: 14px;
}
.login-form {
    gap: 14px;
}

.campo,
.cad-step {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form .auth-link {
    text-align: center;
    margin-top: 2px;
}

.auth-link {
    font-size: 0.9em;
    color: var(--azul);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 12px 28px;
}

.auth-btn--outline {
    margin-top: 16px;
    padding: 10px 20px;
    font-size: 0.9em;
}

/* Login */
#statusExistencia {
    display: none;
    font-size: 0.85em;
    margin-top: 4px;
    text-align: left;
}

#statusExistencia:is(.er, .wa, .ok) {
    display: block;
}
#statusExistencia.er {
    color: var(--erro);
}
#statusExistencia.wa {
    color: #660;
}
#statusExistencia.ok {
    color: #0a0;
}

#statusExistencia.load {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #999;
}

#statusExistencia.load::before {
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: var(--azul);
}

#formCompleto {
    display: none;
}

/* Rodapé */
.auth-page--com-rodape .rodape {
    flex: 0 0 auto;
}

.rodape {
    text-align: center;
    background: #d7ebf3;
    border-top: 10px solid var(--ciano);
    padding: 22px 20px 28px;
    color: var(--texto);
}

.rodape :where(a) {
    color: var(--azul);
    font-weight: 600;
}

.rodape :where(p) {
    margin: 8px auto 0;
    max-width: 560px;
    font-size: 0.9em;
    line-height: 1.45;
}

.autocadastro {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.autocadastro a {
    color: #fff;
    padding: 8px 18px;
    font-size: 0.95em;
}

.chamada-guia-rapido {
    margin-top: 12px;
    font-size: 0.88em;
}

/* Avisos */
.msg_err,
.alerta-obrigatorio {
    width: 100%;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9em;
    text-align: left;
}

.msg_err {
    background: var(--erro-bg);
    color: var(--erro-fg);
    margin: 0 0 8px;
}

.msg_err--lista {
    padding-left: 28px;
}

.alerta-obrigatorio {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    margin-bottom: 16px;
}

/* Cadastro */
.cad-form,
.cad-form-verifica {
    width: 100%;
    text-align: left;
}

.cad-form-completo {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e8ecf5;
    margin-top: 18px;
    padding-top: 18px;
}

.cad-step {
    gap: 5px;
    margin-bottom: 14px;
}

.cad-label {
    font-size: 0.88em;
}
.cad-hint {
    font-size: 0.8em;
    color: var(--cinza);
    margin-top: 2px;
}

.cad-readonly {
    background: #f3f4f6;
    color: var(--cinza);
    cursor: default;
}

.cad-cod-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.cad-cod-row input {
    flex: 1;
}

.cad-btn-verificar {
    width: auto;
    flex: 0 0 auto;
    padding: 0 16px;
    font-size: 0.9em;
    white-space: nowrap;
    margin-top: 0;
}

.cad-step-row {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    align-items: flex-start;
}

.cad-step-row .cad-step {
    margin-bottom: 0;
}
.cad-step--flex {
    flex: 1;
}
.cad-step--tipo {
    flex: 0 0 150px;
}

.cad-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: var(--texto);
    cursor: pointer;
    margin-top: 6px;
    font-weight: normal;
}

.cad-radio input {
    accent-color: var(--azul);
    cursor: pointer;
}

.cad-radio-group {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.cad-confirmacao {
    background: #e8eef8;
    border: 1px solid #c5d0e8;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.cad-btn-submit {
    padding: 13px;
    margin: 0 0 12px;
}

@media (max-width: 600px) {
    #all {
        padding: 24px 16px 32px;
        background-image: none;
    }

    .auth-card {
        padding: 22px 18px 20px;
    }

    .cad-step-row {
        flex-direction: column;
        gap: 0;
    }

    .cad-step--tipo {
        flex: unset;
    }
    .cad-cod-row {
        flex-direction: column;
    }

    .cad-btn-verificar {
        width: 100%;
        padding: 11px 16px;
    }
}

/* Variante cliente */
.auth-card--cliente {
    --btn-bg: linear-gradient(135deg, #2a47a3, var(--azul));
    --btn-bg-hover: linear-gradient(135deg, var(--azul), var(--azul-hover));
    padding: 34px 32px 28px;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(33, 56, 128, 0.14);
}

.auth-card--cliente h2 {
    font-size: 1.5em;
    margin-bottom: 22px;
}

.auth-icone--cliente {
    --d: 64px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #e8eefc, #d3e9f2);
    font-size: 1.8rem;
}

.auth-card--cliente .auth-form {
    gap: 6px;
    margin-bottom: 18px;
}

.auth-card--cliente label {
    margin-top: 10px;
    font-size: 0.78em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--cinza);
}

.auth-card--cliente :where(input[type="text"], select) {
    background-color: #f7f9fc;
    border: 1.5px solid var(--borda);
    height: 48px;
    padding: 0 16px;
    font: inherit;
    font-size: 0.95em;
    line-height: 1.4;
    color: #1f2937;
    transition:
        border-color 0.15s,
        box-shadow 0.15s,
        background-color 0.15s;
}

.auth-card--cliente select {
    appearance: none;
    padding-right: 44px;
    cursor: pointer;
}

.auth-card--cliente :where(input[type="text"], select):hover {
    border-color: #b8c4dc;
}

.auth-card--cliente :where(input[type="text"], select):focus {
    background-color: #fff;
    border-color: var(--azul);
    box-shadow: 0 0 0 4px rgba(33, 56, 128, 0.12);
}

.auth-card--cliente button[type="submit"] {
    margin-top: 18px;
    padding: 14px;
    box-shadow: 0 6px 16px rgba(33, 56, 128, 0.28);
    transition:
        transform 0.15s,
        box-shadow 0.15s;
}

.auth-card--cliente button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(33, 56, 128, 0.34);
}

.auth-card--cliente ::placeholder {
    color: #8a94a6;
    opacity: 1;
}

.combo-cliente,
.combo-cliente-campo,
.select-modo {
    position: relative;
}

.combo-cliente-campo {
    display: flex;
}

.combo-cliente-campo input {
    flex: 1;
    padding-right: 44px;
}

.combo-cliente-campo button {
    position: absolute;
    inset: 0 0 0 auto;
    width: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--azul);
    font-size: 1.1em;
    cursor: pointer;
}

.select-modo i {
    position: absolute;
    top: 50%;
    right: 0;
    width: 44px;
    text-align: center;
    transform: translateY(-50%);
    color: var(--azul);
    font-size: 1.1em;
    pointer-events: none;
}

#listaClientes {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    max-height: 40vh;
    overflow: auto;
    margin: 6px 0 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(33, 56, 128, 0.18);
    text-align: left;
}

#listaClientes a {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--texto);
    font-size: 0.95em;
    text-decoration: none;
}

#listaClientes a:hover,
#listaClientes a.nav-ativa {
    background: #e8eefc;
    color: var(--azul);
}

#listaClientes .selected a {
    background: var(--azul);
    color: #fff;
}
