:root {
    --azul: #213880;
    --azul-hover: #162760;
    --ciano: #8CC7DB;
    --cinza: #6b7280;
    --texto-muted: #4b5563;
    --erro-bg: #ffdde1;
    --erro-fg: #600;
    --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-page--com-rodape .rodape {
    flex: 0 0 auto;
}

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

h2.title-err { color: #a00; }

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

input:where([type="text"], [type="password"]),
select,
button[type="submit"],
input:where([type="button"], [type="submit"]) {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid #b0b7c3;
    font-size: 1em;
}

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

button[type="submit"],
input:where([type="button"], [type="submit"]) {
    border: none;
    background: var(--azul);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}

button[type="submit"]:hover,
input:where([type="button"], [type="submit"]):hover {
    background: var(--azul-hover);
}

.form .required,
.cad-req { color: #c00; }

/* 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-card h2 { margin-bottom: 8px; }

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

.auth-icone--ok,
.auth-icone--err {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 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 {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.auth-form label {
    text-align: left;
}

.auth-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
}

.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;
    border-radius: var(--radius);
    border: none;
    background: var(--azul);
    color: #fff;
    font-weight: bold;
    font-size: 1em;
    text-decoration: none;
    cursor: pointer;
}

.auth-btn:hover { background: var(--azul-hover); }

.auth-btn--outline {
    margin-top: 16px;
    padding: 10px 20px;
    border: 1px solid var(--azul);
    background: #fff;
    color: var(--azul);
    font-size: 0.9em;
}

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

/* Login */
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.login-form .campo {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form button[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
}

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

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

.loading::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

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

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

#statusExistencia.er { color: #c00; display: block; }
#statusExistencia.wa { color: #660; display: block; }
#statusExistencia.ok { color: #0a0; display: block; }
#statusExistencia.load {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #999;
}

#statusExistencia.load::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ccc;
    border-top-color: var(--azul);
    animation: spin 0.8s linear infinite;
}

#formCompleto { display: none; }

/* Rodapé login */
.rodape {
    text-align: center;
    background: #d7ebf3;
    border-top: 10px solid var(--ciano);
    padding: 22px 20px 28px;
    color: #374151;
}

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

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

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

.autocadastro a {
    background: var(--azul);
    color: #fff !important;
    border-radius: var(--radius);
    padding: 8px 18px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95em;
}

.autocadastro a:hover { background: var(--azul-hover); }

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

.msg_err {
    width: 100%;
    background: var(--erro-bg);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--erro-fg);
    font-size: 0.9em;
    text-align: left;
    margin: 0 0 8px;
}

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

.alerta-obrigatorio {
    width: 100%;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 10px 14px;
    color: #856404;
    font-size: 0.88em;
    text-align: left;
    margin-bottom: 16px;
}

/* Cadastro */
.cad-form { 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 {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.cad-label { font-size: 0.88em; }
.cad-hint { font-size: 0.8em; color: #6b7280; margin-top: 2px; }

.cad-readonly {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: default;
}

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

.cad-btn-verificar {
    padding: 0 16px;
    border-radius: var(--radius);
    border: 1px solid var(--azul);
    background: #fff;
    color: var(--azul);
    font-weight: bold;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
}

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

.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: #374151;
    cursor: pointer;
    margin-top: 6px;
    font-weight: normal;
}

.cad-radio input[type="radio"] {
    accent-color: var(--azul);
    width: auto;
    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 {
    width: 100%;
    padding: 13px;
    border-radius: var(--radius);
    border: none;
    background: var(--azul);
    color: #fff;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    margin-bottom: 12px;
}

.cad-btn-submit:hover { background: var(--azul-hover); }

@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 {
        padding: 11px 16px;
    }
}
