/*
 * app.css — estilos base do painel (fora a barra superior, que tem arquivo
 * proprio). Complementa barra-superior.css.
 */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
}

/* -------------------------------------------------------------------------
   Cabecalho: marca + barra + usuario na mesma faixa
   ------------------------------------------------------------------------- */
.cabecalho {
    display: flex;
    align-items: stretch;
    background: var(--cor-fundo-barra, #0f172a);
    color: var(--cor-texto-barra, #e2e8f0);
}

.marca {
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 15px;
    letter-spacing: .02em;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, .1);
}

.cabecalho .barra-superior {
    flex: 1 1 auto;
    min-width: 0;
}

.usuario-topo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    white-space: nowrap;
    border-left: 1px solid rgba(255, 255, 255, .1);
    font-size: 13px;
}

.nome-usuario { opacity: .85; }

.botao-sair {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .25);
    color: inherit;
    padding: 6px 12px;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.botao-sair:hover {
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .45);
}

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

/* -------------------------------------------------------------------------
   Conteudo
   ------------------------------------------------------------------------- */
.conteudo {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.migalhas {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    margin-bottom: 14px;
}

.cartao {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.cartao h1 { margin: 0 0 12px; font-size: 22px; }
.cartao h2 { margin: 0 0 10px; font-size: 17px; color: #334155; }

.vazio-tela .aviso { color: #b45309; font-weight: 600; margin: 6px 0; }
.vazio-tela .rota    { color: #64748b; font-size: 13px; }

code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* -------------------------------------------------------------------------
   Indicadores do dashboard
   ------------------------------------------------------------------------- */
.indicadores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.indicadores li {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    font-size: 13px;
    color: #64748b;
}

.indicadores b {
    display: block;
    font-size: 28px;
    line-height: 1.2;
    color: #0f172a;
}

/* -------------------------------------------------------------------------
   Tela de login
   ------------------------------------------------------------------------- */
.tela-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0f172a;
    padding: 20px;
}

.tela-login .cartao {
    width: 100%;
    max-width: 380px;
    margin: 0;
    padding: 30px;
}

.tela-login h1 { margin: 0 0 20px; font-size: 20px; text-align: center; }

.tela-login label {
    display: block;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.tela-login input {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font: inherit;
    font-size: 15px;
}

.tela-login input:focus {
    outline: 2px solid var(--cor-ativo, #38bdf8);
    outline-offset: 1px;
    border-color: transparent;
}

.tela-login button[type="submit"] {
    width: 100%;
    padding: 11px;
    margin-top: 6px;
    background: #0284c7;
    color: #fff;
    border: 0;
    border-radius: 7px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.tela-login button[type="submit"]:hover { background: #0369a1; }

.tela-login .erro {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* -------------------------------------------------------------------------
   Listas
   ------------------------------------------------------------------------- */
.topo-lista {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.topo-lista h1 { margin: 0; font-size: 22px; }

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

.tabela thead th {
    background: #f8fafc;
    text-align: left;
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.tabela tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: #f8fafc; }
.tabela a { color: #0369a1; text-decoration: none; }
.tabela a:hover { text-decoration: underline; }

.apagado { color: #94a3b8; }

/* -------------------------------------------------------------------------
   Formularios
   ------------------------------------------------------------------------- */
.formulario h2 {
    font-size: 15px;
    margin: 22px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.campo {
    margin-bottom: 14px;
}

.campo label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
}

.campo input,
.campo select,
.campo textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    font: inherit;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    outline: 2px solid var(--cor-ativo, #38bdf8);
    outline-offset: 1px;
    border-color: transparent;
}

.campo input:disabled {
    background: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
}

.obrigatorio { color: #dc2626; }

.dica {
    font-size: 12px;
    color: #64748b;
    margin: 6px 0 0;
    line-height: 1.45;
}

.acoes-form {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
}

/* -------------------------------------------------------------------------
   Botoes
   ------------------------------------------------------------------------- */
.botao {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.botao:hover { background: #f1f5f9; }

.botao.primario {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
    font-weight: 600;
}

.botao.primario:hover { background: #0369a1; border-color: #0369a1; }

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

/* -------------------------------------------------------------------------
   Avisos e mensagens
   ------------------------------------------------------------------------- */
.erro {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 7px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

.aviso-ok {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: 7px;
    padding: 11px 14px;
    font-size: 13px;
    margin-bottom: 16px;
}

.aviso-info {
    background: #f8fafc;
    border-left: 3px solid #38bdf8;
    padding: 12px 14px;
    font-size: 13px;
    color: #475569;
    border-radius: 6px;
    margin-top: 18px;
    line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Tela de perfis — as caixas de permissao
   ------------------------------------------------------------------------- */
.titulo-bloco {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #0f172a;
    margin: 24px 0 4px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e2e8f0;
}

.titulo-coluna-perm {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #64748b;
    margin: 16px 0 6px;
}

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

.tabela-perm thead th {
    padding: 8px 12px;
}

.tabela-perm thead th:not(:first-child) {
    text-align: center;
    width: 80px;
}

.tabela-perm tbody td {
    padding: 7px 12px;
}

.tabela-perm tbody td.centro {
    text-align: center;
}

.tabela-perm input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.modulo-nome {
    color: #94a3b8;
    font-size: 11px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.nao-se-aplica {
    color: #cbd5e1;
    cursor: help;
}

.acoes-lista {
    display: flex;
    gap: 8px;
    margin: 12px 0 4px;
}

.botao.perigo {
    background: #fff;
    border-color: #fecaca;
    color: #b91c1c;
}

.botao.perigo:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

.acoes-linha {
    white-space: nowrap;
}

/* -------------------------------------------------------------------------
   Seletor de empresa
   Aparece so para quem enxerga mais de uma empresa (concessao ativa).
   ------------------------------------------------------------------------- */
.seletor-empresa {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
}

.rotulo-empresa {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .7;
}

.seletor-empresa select {
    background: rgba(255, 255, 255, .08);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 6px;
    padding: 5px 8px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    max-width: 220px;
}

.seletor-empresa select option {
    background: #0f172a;
    color: #e2e8f0;
}

.seletor-empresa select:focus {
    outline: 2px solid var(--cor-ativo, #38bdf8);
    outline-offset: 1px;
}

/* -------------------------------------------------------------------------
   Rodape com a versao
   ------------------------------------------------------------------------- */
.rodape {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    margin-top: 30px;
    border-top: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
}

.rodape .versao {
    font-weight: 600;
    letter-spacing: .04em;
}

.rodape .link-changelog {
    color: #0369a1;
    text-decoration: none;
}

.rodape .link-changelog:hover { text-decoration: underline; }

/* -------------------------------------------------------------------------
   Changelog
   ------------------------------------------------------------------------- */
.changelog {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
    background: #f8fafc;
}

.changelog h1 { font-size: 20px; margin: 0 0 14px; }
.changelog h2 {
    font-size: 15px;
    margin: 22px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
}
.changelog h3 { font-size: 13px; margin: 16px 0 6px; color: #334155; }
.changelog ul { margin: 6px 0 14px; padding-left: 20px; }
.changelog li { margin: 3px 0; }
.changelog p  { margin: 6px 0; }

.versao-atual {
    color: #475569;
    font-size: 13px;
    margin-bottom: 14px;
}

/* -------------------------------------------------------------------------
   Telas menores
   ------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .cabecalho { flex-wrap: wrap; }
    .marca { padding: 12px 16px; border-right: 0; }
    .usuario-topo {
        border-left: 0;
        padding: 10px 16px;
        order: 3;
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .conteudo { padding: 16px; }
    .rodape { padding: 12px 16px; }
    .seletor-empresa select { max-width: 160px; }
}
