/* Sistema PIB — cores da identidade e páginas públicas (login, erros). Telas internas: interno.css; página inicial: painel.css */
:root {
    --sp-vermelho: #e8403f;
    --sp-laranja: #f39a1e;
    --sp-amarelo: #f5e31b;
    --sp-azul: #3fbfef;
    --sp-verde: #6ab42d;
    --sp-primary: #1f6fd1;
    --sp-primary-dark: #1757a6;
    --sp-ink: #1b2433;
    --sp-muted: #667085;
    --sp-line: #dfe3ea;
    --sp-danger: #c62f2f;
    --sp-danger-bg: #fdecec;
    --bs-primary: var(--sp-primary);
    --bs-body-color: var(--sp-ink);
}

body { -webkit-font-smoothing: antialiased; }

/* ---------- Páginas públicas (login, erros) ---------- */
.sp-publico {
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(90% 70% at 0% 0%, #2c3a52 0%, rgba(44, 58, 82, 0) 60%),
        radial-gradient(120% 90% at 100% 100%, #0e141f 0%, rgba(14, 20, 31, 0) 55%),
        linear-gradient(160deg, #263247 0%, #1b2433 55%, #111824 100%);
    background-attachment: fixed;
}

/* Anel colorido decorativo (cores do logo) */
.sp-ring {
    position: fixed;
    width: 900px; height: 900px;
    right: -330px; top: -260px;
    border-radius: 50%;
    background: conic-gradient(from 200deg,
        var(--sp-vermelho) 0 17%, transparent 17% 19%,
        var(--sp-laranja) 19% 36%, transparent 36% 38%,
        var(--sp-amarelo) 38% 55%, transparent 55% 70%,
        var(--sp-azul) 70% 82%, transparent 82% 84%,
        var(--sp-verde) 84% 98%, transparent 98% 100%);
    -webkit-mask: radial-gradient(circle, transparent 62%, #000 62.3%, #000 70%, transparent 70.3%);
            mask: radial-gradient(circle, transparent 62%, #000 62.3%, #000 70%, transparent 70.3%);
    opacity: .16;
    pointer-events: none;
}

.sp-wrap {
    position: relative;
    min-height: 100vh;
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 16px;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    gap: 32px;
}
@media (min-width: 900px) {
    .sp-wrap { grid-template-columns: 1.1fr 1fr; padding: 48px 32px; }
}

.sp-hero { color: #eef2f8; max-width: 440px; display: none; }
@media (min-width: 900px) { .sp-hero { display: block; } }
.sp-hero .sp-tag {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #c8d2e2; background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    padding: 6px 12px; border-radius: 999px;
}
.sp-hero h1 { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: 20px 0 16px; }
.sp-hero h1 span {
    background: linear-gradient(90deg, var(--sp-laranja), var(--sp-amarelo) 35%, var(--sp-verde) 65%, var(--sp-azul));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sp-hero p { font-size: 17px; line-height: 1.6; color: #b4bfd0; margin: 0 0 28px; }
.sp-hero ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sp-hero li { display: flex; align-items: center; gap: 12px; color: #d5ddea; font-size: 15px; }
.sp-hero li i {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .08); font-size: 14px;
}
.sp-hero li:nth-child(1) i { color: var(--sp-laranja); }
.sp-hero li:nth-child(2) i { color: var(--sp-verde); }
.sp-hero li:nth-child(3) i { color: var(--sp-azul); }

.sp-card {
    position: relative;
    width: 100%; max-width: 410px;
    background: #fff;
    border-radius: 22px;
    padding: 36px 32px 30px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
    overflow: hidden;
}
@media (max-width: 420px) { .sp-card { padding: 28px 20px 24px; border-radius: 18px; } }
.sp-card .sp-logo { display: block; width: 210px; max-width: 70%; height: auto; margin: 0 auto 22px; }
.sp-card h2 { font-size: 22px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.sp-card .sp-sub { color: var(--sp-muted); font-size: 14px; margin: 0 0 22px; }

.sp-alert {
    display: flex; gap: 10px; align-items: flex-start;
    background: var(--sp-danger-bg); color: var(--sp-danger);
    border: 1px solid #f6c9c9; border-radius: 12px;
    padding: 11px 14px; margin: 0 0 18px;
    font-size: 14px; font-weight: 600; line-height: 1.45;
}
.sp-alert i { margin-top: 2px; }
.sp-alert[hidden] { display: none; }
.sp-shake { animation: sp-shake .45s ease-in-out; }
@keyframes sp-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-7px); }
    40%, 80% { transform: translateX(7px); }
}
@media (prefers-reduced-motion: reduce) { .sp-shake { animation: none; } }

.sp-field { margin-bottom: 16px; }
.sp-field label { display: block; font-size: 13px; font-weight: 700; margin: 0 0 6px; color: #344054; }
.sp-input { position: relative; }
.sp-input > i.sp-ico {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: #98a2b3; font-size: 15px; pointer-events: none;
}
.sp-input input {
    width: 100%; height: 50px;
    padding: 0 46px 0 42px;
    font: inherit; font-size: 16px; color: var(--sp-ink);
    background: #f8fafc;
    border: 1.5px solid var(--sp-line); border-radius: 12px;
    outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.sp-input input:focus { border-color: var(--sp-primary); background: #fff; box-shadow: 0 0 0 4px rgba(31, 111, 209, .14); }
.sp-field.is-invalid .sp-input input { border-color: var(--sp-danger); background: #fff; }
.sp-field.is-invalid .sp-input input:focus { box-shadow: 0 0 0 4px rgba(198, 47, 47, .14); }
.sp-eye {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border: 0; border-radius: 10px;
    background: transparent; color: #667085; cursor: pointer; font-size: 15px;
}
.sp-eye:hover, .sp-eye:focus-visible { background: #eef2f6; color: var(--sp-ink); outline: none; }
.sp-caps { display: none; margin-top: 6px; font-size: 12px; font-weight: 600; color: #b54708; }
.sp-caps.show { display: block; }

.sp-btn {
    width: 100%; height: 52px; margin-top: 8px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: 12px;
    background: var(--sp-primary); color: #fff;
    font: inherit; font-size: 16px; font-weight: 700;
    cursor: pointer; transition: background .15s, transform .05s;
}
.sp-btn:hover { background: var(--sp-primary-dark); color: #fff; }
.sp-btn:active { transform: translateY(1px); }
.sp-btn:focus-visible { outline: 3px solid rgba(31, 111, 209, .35); outline-offset: 2px; }
.sp-btn[disabled] { opacity: .75; cursor: progress; }

.sp-help { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--sp-muted); line-height: 1.5; }

/* Faixa colorida no rodapé do cartão (identidade do sistema) */
.sp-colorbar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; display: flex; }
.sp-colorbar span { flex: 1; }
.sp-colorbar span:nth-child(1) { background: var(--sp-vermelho); }
.sp-colorbar span:nth-child(2) { background: var(--sp-laranja); }
.sp-colorbar span:nth-child(3) { background: var(--sp-amarelo); }
.sp-colorbar span:nth-child(4) { background: var(--sp-azul); }
.sp-colorbar span:nth-child(5) { background: var(--sp-verde); }

.sp-footer { grid-column: 1 / -1; text-align: center; font-size: 12px; color: #8592a6; margin: 0; }

/* ---------- Tela de carregamento padrão (element carregando + js/carregando.js) ---------- */
.sp-carregando {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(17, 24, 36, .82);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}
.sp-carregando.ativo { opacity: 1; visibility: visible; }
.sp-carregando-caixa { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; text-align: center; }
.sp-carregando-anel { width: 96px; height: 96px; animation: sp-girar 1.1s linear infinite; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35)); }
.sp-carregando-anel path { stroke-linecap: butt; }
.sp-carregando-marca {
    margin: 14px 0 0; font-family: 'Source Sans 3', 'Plus Jakarta Sans', sans-serif;
    font-size: 22px; font-weight: 300; letter-spacing: .18em; color: #e6eaf1;
}
.sp-carregando-marca b { font-weight: 700; }
.sp-carregando-texto { margin: 6px 0 0; font-size: 14px; font-weight: 600; letter-spacing: .04em; color: #b9c3d3; }
.sp-carregando-pontos::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: sp-pontos 1.2s steps(4, end) infinite; }
@keyframes sp-girar { to { transform: rotate(360deg); } }
@keyframes sp-pontos { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75%, 100% { content: '...'; } }
@media (prefers-reduced-motion: reduce) {
    .sp-carregando-anel { animation-duration: 3s; }
    .sp-carregando-pontos::after { animation: none; content: '...'; }
}

/* ── SELETOR DE IDIOMA (topo, login, páginas públicas) ── */
.erp-idioma { position: relative; }
.erp-idioma > summary { list-style: none; }
.erp-idioma > summary::-webkit-details-marker { display: none; }
.erp-idioma-btn {
    display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 10px; cursor: pointer;
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .88);
    font-size: 12px; font-weight: 700; white-space: nowrap; user-select: none;
}
.erp-idioma-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.erp-idioma-btn .fi { width: 20px; line-height: 15px; border-radius: 2px; }
.erp-idioma-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1080; min-width: 200px; margin: 0; padding: 6px;
    background: #fff; border: 1px solid rgba(0, 0, 0, .12); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.erp-idioma-item {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
    background: none; color: #1b2433; font-size: 14px; text-align: left; cursor: pointer;
}
.erp-idioma-item:hover { background: #eef2f8; }
.erp-idioma-item.ativo { background: #1b2433; color: #fff; font-weight: 600; }
.erp-idioma-flutuante { position: fixed; top: 12px; right: 12px; z-index: 1080; }
.erp-idioma-flutuante .erp-idioma-btn { background: rgba(27, 36, 51, .75); color: #fff; }
@media (max-width: 420px) { .erp-idioma-sigla { display: none; } }
