/* =====================================================
   SEGUINDO EM FRENTE - estilo baseado no INFOAPAC
===================================================== */

:root {
    --fundo: #32a9d8;
    --topo: #e6e6e6;
    --destaque: #0b5e7a;
    --destaque-escuro: #083f52;
    --verde: #5a8f29;
    --texto: #333;
    --borda: #c9c9c9;
    --perigo: #b3261e;
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--fundo);
    color: var(--texto);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--destaque);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

/* ===== MENU SUPERIOR ===== */

.topo {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--topo);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 999;
    gap: 12px;
}

.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-topo {
    height: 44px;
    width: auto;
    display: block;
    border-radius: 8px;
    mix-blend-mode: multiply;
}

.menu-toggle {
    display: none;
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: #444;
}

.menu-centro {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    flex: 1;
}

.menu-btn {
    display: inline-block;
    background: #f5f5f5;
    color: #444;
    font-size: 14px;
    font-family: inherit;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.menu-btn:hover,
.menu-btn.ativo {
    background: var(--destaque);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.menu-direita {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}

.usuario-logado {
    font-size: 13px;
    color: #555;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-sair {
    margin: 0;
}

@media (max-width: 1100px) {
    .menu-toggle {
        display: block;
    }

    .menu-centro {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--topo);
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        display: none;
        box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .menu-centro.active {
        display: flex;
    }

    .menu-btn {
        text-align: left;
        width: 100%;
    }

    .menu-direita {
        margin: 8px 0 0;
        flex-direction: column;
        align-items: stretch;
    }

    .form-sair .menu-btn {
        width: 100%;
    }
}

/* ===== CONTEÚDO ===== */

.conteudo {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 90px 20px 30px;
    flex: 1;
}

.titulo {
    text-align: center;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    margin: 10px 0 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.subtitulo {
    font-size: 18px;
    color: var(--destaque);
    margin: 0 0 12px;
}

.caixa {
    background: linear-gradient(#ffffff, #ececec);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    padding: 22px 26px;
    margin-bottom: 20px;
}

.caixa > :last-child {
    margin-bottom: 0;
}

.rodape {
    text-align: center;
    color: #fff;
    font-size: 12px;
    padding: 14px;
    opacity: 0.9;
}

.pagina-impressao {
    background: #fff;
}

.pagina-impressao .conteudo {
    padding-top: 20px;
}

.pagina-impressao .rodape {
    color: #555;
}

/* ===== ABAS (submenu) ===== */

.abas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.aba {
    background: rgba(255, 255, 255, 0.85);
    color: var(--destaque);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.aba:hover,
.aba.ativa {
    background: var(--destaque);
    color: #fff;
    text-decoration: none;
}

/* ===== CARDS DE NAVEGAÇÃO ===== */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.card {
    display: block;
    background: #e8e8e8;
    border-radius: 50px;
    padding: 22px 30px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.card small {
    display: block;
    font-weight: normal;
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

a.card:hover {
    background: #fff;
    color: var(--destaque);
    text-decoration: none;
    transform: translateY(-2px);
}

.numeros {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.numero {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.numero strong {
    display: block;
    font-size: 30px;
    color: var(--destaque);
}

.numero span {
    font-size: 13px;
    color: #555;
}

/* ===== FORMULÁRIOS ===== */

.form-grade {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px 18px;
}

.campo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.campo-largo {
    grid-column: 1 / -1;
}

label,
.rotulo {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

input[type=text],
input[type=password],
input[type=email],
input[type=tel],
input[type=date],
input[type=datetime-local],
input[type=number],
input[type=search],
input[type=file],
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #aaa;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--fundo);
    border-color: var(--fundo);
}

fieldset {
    border: 1px solid var(--borda);
    border-radius: 12px;
    padding: 14px 18px 18px;
    margin: 0 0 18px;
}

legend {
    font-weight: bold;
    color: var(--destaque);
    padding: 0 6px;
}

.opcoes-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-weight: normal;
}

.opcoes-inline label {
    font-weight: normal;
}

.acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
}

.form-inline {
    display: inline;
    margin: 0;
}

.busca {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.busca .campo {
    flex: 1;
    min-width: 180px;
}

.ajuda {
    font-size: 13px;
    color: #666;
    font-weight: normal;
}

/* ===== BOTÕES ===== */

.botao {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 20px;
    background: var(--fundo);
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}

.botao:hover {
    background: #238eb8;
    color: #fff;
    text-decoration: none;
}

.botao-secundario {
    background: #f5f5f5;
    color: #444;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.botao-secundario:hover {
    background: var(--destaque);
}

.botao-perigo {
    background: var(--perigo);
}

.botao-perigo:hover {
    background: #8c1d17;
}

.botao-pequeno {
    padding: 5px 12px;
    font-size: 13px;
}

/* ===== TABELAS ===== */

.tabela-wrap {
    overflow-x: auto;
}

.tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.tabela th {
    background: var(--destaque);
    color: #fff;
    text-align: left;
    padding: 10px;
    font-weight: bold;
}

.tabela td {
    padding: 9px 10px;
    border-bottom: 1px solid #e2e2e2;
    vertical-align: top;
}

.tabela tr:nth-child(even) td {
    background: #f7f9fa;
}

.tabela tr:hover td {
    background: #eaf6fb;
}

.tabela .num {
    text-align: right;
    white-space: nowrap;
}

.tabela .acoes-linha {
    white-space: nowrap;
    text-align: right;
}

.tabela .acoes-linha > * {
    margin-left: 4px;
}

.vazio {
    text-align: center;
    color: #666;
    padding: 18px;
}

.selo {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    background: #e0e0e0;
    color: #444;
}

.selo-ok {
    background: #d8f0c6;
    color: #2f5d12;
}

.selo-alerta {
    background: #fde3c0;
    color: #8a4b00;
}

/* ===== ALERTAS ===== */

.alerta {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.alerta-sucesso {
    background: #e4f6d8;
    color: #2f5d12;
}

.alerta-erro {
    background: #fde2e0;
    color: var(--perigo);
}

.alerta-aviso {
    background: #fff3cd;
    color: #7a5a00;
}

.senha-temporaria {
    font-family: Consolas, monospace;
    font-size: 22px;
    letter-spacing: 2px;
    background: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 6px;
}

/* ===== LOGIN / PÁGINA INICIAL ===== */

.pagina-login .conteudo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-login {
    width: 100%;
    max-width: 420px;
    padding: 25px;
    border-radius: 14px;
    background: linear-gradient(#ffffff, #d7d7d7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.modal-login .logo-login {
    display: block;
    margin: 0 auto 14px;
    max-width: 260px;
    mix-blend-mode: multiply;
}

.modal-login h2 {
    margin-top: 0;
    text-align: center;
    font-size: 20px;
    color: #333;
}

.campo-login {
    margin-bottom: 15px;
}

.campo-login label {
    display: block;
    margin-bottom: 5px;
}

.campo-senha {
    position: relative;
}

.campo-senha input {
    padding-right: 44px;
}

.botao-ver-senha {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
}

.recaptcha-area {
    margin: 15px 0;
    display: flex;
    justify-content: center;
}

.botao-login {
    width: 100%;
    padding: 11px 15px;
    border: none;
    border-radius: 20px;
    background: var(--fundo);
    color: #fff;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
}

.botao-login:hover {
    background: #238eb8;
}

.links-login {
    text-align: center;
    font-size: 14px;
    margin-top: 12px;
}

.dados-fbac {
    margin-top: 15px;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    color: #333;
}

@media (max-width: 600px) {
    .conteudo {
        padding: 85px 12px 20px;
    }

    .caixa {
        padding: 16px;
    }

    .titulo {
        font-size: 22px;
    }

    .recaptcha-area {
        transform: scale(0.88);
        transform-origin: center;
    }

    .card {
        border-radius: 30px;
        font-size: 16px;
        padding: 18px 22px;
    }
}

/* ===== FICHA / FOTO ===== */

.ficha-topo {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.foto-egresso {
    width: 160px;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    background: #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dados-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px 18px;
    margin: 0;
}

.dados-lista div {
    border-bottom: 1px dotted #ccc;
    padding: 4px 0;
}

.dados-lista dt {
    font-size: 12px;
    color: #666;
}

.dados-lista dd {
    margin: 0;
    font-weight: bold;
}

/* ===== GRÁFICOS DE BARRAS (estatísticas) ===== */

.barras {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.barra-linha {
    display: grid;
    grid-template-columns: 1fr 78px;
    gap: 2px 10px;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
}

/* Rótulo em cima, barra e número embaixo: cabe nos cards estreitos. */
.barra-linha > span:first-child {
    grid-column: 1 / -1;
}

.barra-fundo {
    background: #e3e3e3;
    border-radius: 6px;
    height: 16px;
    overflow: hidden;
}

.barra-valor {
    background: var(--fundo);
    height: 100%;
    border-radius: 6px;
}

.barra-linha .num {
    text-align: right;
    font-weight: bold;
}

/* Quadros da mesma linha têm a mesma altura: o gráfico fica centralizado
   na vertical e a nota de "não informado" vai para o rodapé. */
.grafico {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.grafico-corpo {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.grafico-nota {
    margin: 14px 0 0;
    text-align: center;
}

/* Colunas verticais */
.colunas {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 230px;
    padding-top: 6px;
    border-bottom: 2px solid #cfcfcf;
}

.coluna {
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.coluna-valor {
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.coluna-area {
    flex: 1;
    width: 100%;
    max-width: 56px;
    display: flex;
    align-items: flex-end;
}

.coluna-barra {
    width: 100%;
    min-height: 2px;
    border-radius: 6px 6px 0 0;
}

.coluna-rotulo {
    height: 34px;
    margin-bottom: -40px;
    padding-top: 4px;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    color: #555;
    overflow: hidden;
    overflow-wrap: normal;
    hyphens: auto;
}

.colunas + .grafico-nota,
.colunas:last-child {
    margin-bottom: 0;
}

.grafico .colunas {
    margin-bottom: 42px;
}

/* Pizza */
.pizza-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.pizza {
    width: 170px;
    height: 170px;
    flex-shrink: 0;
}

.legenda {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    font-size: 14px;
}

.legenda li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.legenda-cor {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

@media print {
    .grafico {
        break-inside: avoid;
    }

    .barra-valor,
    .coluna-barra,
    .legenda-cor,
    .pizza path,
    .pizza circle {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

.grade-estatisticas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* ===== IMPRESSÃO ===== */

.so-impressao {
    display: none;
}

@media print {
    body {
        background: #fff;
    }

    .topo,
    .abas,
    .rodape,
    .nao-imprimir,
    .acoes,
    .busca {
        display: none !important;
    }

    .so-impressao {
        display: block;
    }

    .conteudo {
        padding: 0;
        max-width: none;
    }

    .titulo {
        color: #000;
        text-shadow: none;
    }

    .caixa {
        box-shadow: none;
        background: #fff;
        padding: 0;
    }

    .tabela th {
        background: #ddd;
        color: #000;
    }
}

/* =====================================================
   CELULAR
===================================================== */

/* Botões soltos sobre o fundo azul (fora das caixas brancas) ficam brancos para aparecer. */
.conteudo > .acoes .botao:not(.botao-secundario):not(.botao-perigo) {
    background: #fff;
    color: var(--destaque);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.conteudo > .acoes .botao:not(.botao-secundario):not(.botao-perigo):hover {
    background: var(--destaque);
    color: #fff;
}

@media (max-width: 700px) {
    /* Campos com 16px: abaixo disso o iPhone dá zoom sozinho ao tocar no campo. */
    input[type=text],
    input[type=password],
    input[type=email],
    input[type=tel],
    input[type=date],
    input[type=number],
    input[type=search],
    select,
    textarea {
        font-size: 16px;
    }

    .coluna-rotulo {
        font-size: 10px;
    }

    .colunas {
        gap: 6px;
    }

    /* Tabelas viram cartões: um registro por cartão, com o nome da coluna ao lado do valor
       (o app.js coloca o nome em data-rotulo). */
    .tabela-responsiva,
    .tabela-responsiva tbody,
    .tabela-responsiva tr,
    .tabela-responsiva td {
        display: block;
        width: 100%;
    }

    .tabela-responsiva {
        background: transparent;
        border-radius: 0;
        overflow: visible;
    }

    .tabela-responsiva .tabela-cabecalho {
        display: none;
    }

    .tabela-responsiva tr {
        background: #fff;
        border: 1px solid #e2e2e2;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 6px 12px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }

    .tabela-responsiva tr:nth-child(even) td,
    .tabela-responsiva tr:hover td {
        background: transparent;
    }

    .tabela-responsiva td {
        border-bottom: 1px dotted #ddd;
        padding: 7px 0;
        text-align: left;
    }

    .tabela-responsiva td:last-child {
        border-bottom: none;
    }

    .tabela-responsiva td[data-rotulo]::before {
        content: attr(data-rotulo);
        display: block;
        font-size: 11px;
        font-weight: bold;
        color: #777;
        text-transform: uppercase;
        margin-bottom: 2px;
    }

    .tabela-responsiva td:empty {
        display: none;
    }

    .tabela-responsiva .num {
        text-align: left;
    }

    .tabela-responsiva .acoes-linha {
        white-space: normal;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .tabela-responsiva .acoes-linha::before {
        display: none !important;
    }

    .tabela-responsiva .acoes-linha > * {
        margin-left: 0;
    }

    .tabela-responsiva .acoes-linha .botao-pequeno {
        padding: 8px 14px;
        font-size: 14px;
    }

    .tabela-wrap {
        overflow-x: visible;
    }

    /* Botões mais fáceis de tocar */
    .acoes .botao,
    .busca .botao {
        padding: 11px 18px;
    }

    .busca .botao {
        width: 100%;
    }

    .abas {
        gap: 6px;
    }

    .aba {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media print {
    .tabela-responsiva .tabela-cabecalho {
        display: table-row;
    }
}

/* ===== RELATÓRIO DE INDICADORES (tabela mês a mês) ===== */

.tabela-matriz {
    font-size: 13px;
}

.tabela-matriz td:first-child,
.tabela-matriz th:first-child {
    min-width: 220px;
}

.tabela-matriz .linha-secao td {
    background: #dceef6 !important;
    color: var(--destaque);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
}

.tabela-matriz .linha-total td {
    font-weight: bold;
    background: #f1f7fa !important;
}

.tabela-matriz .linha-apacs td {
    color: #777;
    font-style: italic;
}

@media (max-width: 700px) {
    .pagina-indicadores .tabela-wrap {
        overflow-x: auto;
    }
}

@media print {
    .pagina-indicadores {
        font-size: 10px;
    }

    @page {
        size: landscape;
        margin: 10mm;
    }

    .tabela-matriz {
        font-size: 9px;
    }

    .tabela-matriz td,
    .tabela-matriz th {
        padding: 3px 4px;
    }

    .tabela-matriz .linha-secao td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
