:root {
    --navy-950:   #0B1720;
    --navy-900:   #101E29;
    --navy-800:   #16293A;
    --accent:     #2E6FDB;
    --accent-600: #2560C4;
    --accent-100: #E8F0FD;
    --ink-900:    #0F1A24;
    --ink-600:    #4B5768;
    --ink-400:    #8793A2;
    --border:     #E1E5EA;
    --surface:    #F6F7F9;
    --danger:     #C0362C;
    --danger-bg:  #FBEBE9;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--ink-900);
    background: var(--surface);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- Painel de identidade (esquerda) ---------- */

.painel {
    background: linear-gradient(165deg, var(--navy-950), var(--navy-800));
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
}

.painel__topo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.painel__logo {
    height: 75px;
    width: auto;
}

.painel__marca {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    color: #fff;
}

.painel__meio {
    max-width: 380px;
}

.painel__titulo {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.75rem;
}

.painel__descricao {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    margin: 0;
}

.painel__unidade {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0.5rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
}

.painel__unidade::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ADE80;
    flex-shrink: 0;
}

.painel__contato {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.5rem;
    font-size: 0.82rem;
}

.painel__contato a {
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
}

.painel__contato a:hover {
    color: #fff;
    text-decoration: underline;
}

.painel__rodape {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.6;
}

/* ---------- Painel do formulário (direita) ---------- */

.form-painel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: #fff;
}

.form-container {
    width: 100%;
    max-width: 360px;
}

.form-container__logo-mobile {
    display: none;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.form-container__logo-mobile img {
    height: 45px;
    width: auto;
}

.form-container__cabecalho {
    margin-bottom: 2rem;
}

.form-container__titulo {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
    color: var(--ink-900);
}

.form-container__subtitulo {
    font-size: 0.88rem;
    color: var(--ink-600);
    margin: 0;
}

/* ---------- Campos ---------- */

.field {
    position: relative;
    margin-bottom: 1.1rem;
}

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-900);
    margin-bottom: 0.4rem;
}

.field input,
.field select {
    width: 100%;
    height: 42px;
    padding: 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 0.92rem;
    color: var(--ink-900);
    background: #fff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238793A2' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.2rem;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-100);
}

.field--senha input {
    padding-right: 2.6rem;
}

.field--senha .toggle-senha {
    position: absolute;
    right: 0.7rem;
    top: 2.15rem;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--ink-400);
    border-radius: 6px;
}

.field--senha .toggle-senha:hover {
    background: var(--surface);
    color: var(--ink-600);
}

.linha-auxiliar {
    display: flex;
    justify-content: flex-end;
    margin: -0.5rem 0 1.1rem;
}

.link-acao {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
}

.link-acao:hover { color: var(--accent-600); }

/* ---------- Botão ---------- */

.btn-acessar {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background-color 0.12s ease;
    margin-top: 0.3rem;
}

.btn-acessar:hover { background: var(--accent-600); }

.btn-acessar[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-senha:focus-visible,
.link-acao:focus-visible,
.btn-acessar:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Alerta sem conexão ---------- */

.alerta-conexao {
    padding: 0.9rem 1rem;
    border-radius: 8px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 0.86rem;
    line-height: 1.5;
}

.alerta-conexao a {
    color: var(--danger);
    font-weight: 600;
}

/* ---------- Rodapé do formulário ---------- */

.form-rodape {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--ink-400);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-rodape__redes {
    display: flex;
    gap: 0.75rem;
}

.form-rodape__redes img {
    height: 16px;
    opacity: 0.55;
}

.form-rodape__redes img:hover { opacity: 0.9; }

/* ---------- Modais ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 23, 32, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal-backdrop.is-open { display: flex; }

.modal-box {
    background: #fff;
    border-radius: 12px;
    max-width: 360px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 45px -15px rgba(11, 23, 32, 0.35);
}

.modal-box__header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink-900);
}

.modal-box__close {
    background: none;
    border: none;
    color: var(--ink-400);
    font-size: 1.05rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem;
}

.modal-box__close:hover { color: var(--ink-900); }

.modal-box__body {
    padding: 1.25rem;
    font-size: 0.88rem;
    color: var(--ink-900);
    line-height: 1.55;
}

.modal-box__footer {
    padding: 0 1.25rem 1.25rem;
}

.modal-aguarde-conteudo {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: girar 0.8s linear infinite;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2s; }
}

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

.btn-secundario {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink-900);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-secundario:hover { background: var(--surface); }

/* ---------- Responsivo ---------- */

@media (max-width: 860px) {
    body { grid-template-columns: 1fr; }
    .painel { display: none; }
    .form-painel { padding: 2.5rem 1.25rem; }
    .form-container__logo-mobile { display: flex; }
}