/* =============================================================================
   Painel — estilo base
   Neutro, uma única cor de destaque (--destaque), cantos arredondados,
   sem gradiente, sem sombra pesada. Sem build: CSS puro.
   ============================================================================= */

:root {
    --fundo: #f6f7f9;
    --superficie: #ffffff;
    --borda: #e5e7eb;
    --borda-forte: #d1d5db;
    --texto: #111827;
    --texto-suave: #6b7280;
    --destaque: #2f5bd3;
    --destaque-fundo: #eef2fc;
    --sucesso: #15803d;
    --sucesso-fundo: #ecfdf3;
    --erro: #b42318;
    --erro-fundo: #fef3f2;

    --raio: 12px;
    --raio-pequeno: 8px;
    --espaco: 1rem;
    --fonte: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fonte-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--fundo);
    color: var(--texto);
    font: 14px/1.55 var(--fonte);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1rem; margin-bottom: 0.75rem; }
p { margin: 0 0 0.5rem; }
a { color: var(--destaque); text-decoration: none; }
a:hover { text-decoration: underline; }

.texto-suave { color: var(--texto-suave); }
.mono { font-family: var(--fonte-mono); font-size: 0.92em; }
.sem-quebra { white-space: nowrap; }
.alinhar-direita { text-align: right; }

/* ---------- Estrutura ---------- */

.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.barra-lateral {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--superficie);
    border-right: 1px solid var(--borda);
}

.marca { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; padding: 0 0.625rem; }
.marca-grande { font-size: 1.25rem; padding: 0; margin-bottom: 0.25rem; }

.nav, .nav-rodape { display: flex; flex-direction: column; gap: 2px; }
.nav-rodape { margin-top: auto; border-top: 1px solid var(--borda); padding-top: 1rem; }

.nav a, .nav-rodape a, .link-botao {
    display: block; width: 100%;
    padding: 0.5rem 0.625rem;
    border-radius: var(--raio-pequeno);
    color: var(--texto); font: inherit; text-align: left;
}
.nav a:hover, .nav-rodape a:hover, .link-botao:hover { background: var(--fundo); text-decoration: none; }
.nav a.ativo, .nav-rodape a.ativo { background: var(--destaque-fundo); color: var(--destaque); font-weight: 600; }
.link-botao { border: 0; background: none; cursor: pointer; color: var(--texto-suave); }

.usuario-atual { display: flex; flex-direction: column; padding: 0 0.625rem 0.5rem; font-size: 0.875rem; }

.topo-movel { display: none; }

.conteudo { padding: 2rem 2.5rem 3rem; max-width: 1200px; width: 100%; }

.cabecalho-pagina {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
    margin-bottom: 1.5rem;
}
.cabecalho-pagina p { margin: 0.25rem 0 0; }
.voltar { display: inline-block; font-size: 0.8125rem; color: var(--texto-suave); margin-bottom: 0.375rem; }

/* ---------- Cartões e grades ---------- */

.cartao {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio);
    padding: 1.25rem;
}
.cartao-tabela { padding: 0; overflow: hidden; }
.cartao-tabela .vazio { padding: 1.25rem; }
.cartao-estreito { max-width: 440px; }
.cartao-cabecalho { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.cartao-cabecalho h2 { margin: 0; }

.pilha { display: flex; flex-direction: column; gap: 1rem; }
.pilha-horizontal { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 0.5rem; }

.grade-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grade-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.kpi { display: flex; flex-direction: column; gap: 0.125rem; }
.kpi-rotulo { font-size: 0.75rem; font-weight: 500; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-valor { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-nota { font-size: 0.8125rem; color: var(--texto-suave); }

.lista-simples { list-style: none; margin: 0; padding: 0; }
.lista-simples li {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: 0.625rem 0; border-bottom: 1px solid var(--borda);
}
.lista-simples li:last-child { border-bottom: 0; }

.vazio { color: var(--texto-suave); margin: 0.5rem 0; }

/* ---------- Tabelas ---------- */

.tabela-rolagem { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabela th, .tabela td { padding: 0.75rem 1.25rem; text-align: left; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela th { font-size: 0.75rem; font-weight: 500; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.04em; background: #fafbfc; }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr:hover { background: #fafbfc; }
.cartao .tabela th:first-child, .cartao .tabela td:first-child { padding-left: 1.25rem; }
.tabela-topo td { vertical-align: top; }
.diff { font-size: 0.8125rem; max-width: 280px; word-break: break-word; }
.diff-antes { color: var(--texto-suave); }

/* ---------- Etiquetas ---------- */

.etiqueta {
    display: inline-block; padding: 0.125rem 0.5rem;
    border-radius: 999px; font-size: 0.75rem; font-weight: 500;
    background: var(--fundo); color: var(--texto-suave); border: 1px solid var(--borda);
}
.etiqueta-neutra { background: var(--superficie); color: var(--texto); }
.etiqueta-destaque { background: var(--destaque-fundo); color: var(--destaque); border-color: transparent; }
.etiqueta-sucesso { background: var(--sucesso-fundo); color: var(--sucesso); border-color: transparent; }

/* ---------- Botões ---------- */

.botao {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
    padding: 0.5rem 0.875rem; min-height: 36px;
    border-radius: var(--raio-pequeno); border: 1px solid transparent;
    font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.botao:hover { text-decoration: none; }
.botao:focus-visible, input:focus-visible, select:focus-visible, .link-botao:focus-visible {
    outline: 2px solid var(--destaque); outline-offset: 2px;
}
.botao-primario { background: var(--destaque); color: #fff; }
.botao-primario:hover { background: #274db5; }
.botao-secundario { background: var(--superficie); color: var(--texto); border-color: var(--borda-forte); }
.botao-secundario:hover { background: var(--fundo); }
.botao-fantasma { background: transparent; color: var(--texto-suave); padding: 0.375rem 0.625rem; min-height: 32px; }
.botao-fantasma:hover { background: var(--fundo); color: var(--texto); }
.botao-bloco { width: 100%; }

.acoes-form { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ---------- Formulários ---------- */

.grade-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; margin-bottom: 0.5rem; }

.campo { display: flex; flex-direction: column; gap: 0.375rem; }
.campo label { font-weight: 500; font-size: 0.8125rem; }
.campo input, .campo select {
    width: 100%; min-height: 38px; padding: 0.5rem 0.75rem;
    font: inherit; color: var(--texto);
    background: var(--superficie);
    border: 1px solid var(--borda-forte); border-radius: var(--raio-pequeno);
}
.campo input:focus, .campo select:focus { border-color: var(--destaque); outline: none; box-shadow: 0 0 0 3px var(--destaque-fundo); }
.ajuda { font-size: 0.8125rem; color: var(--texto-suave); margin: 0; }
.erro-campo { font-size: 0.8125rem; color: var(--erro); margin: 0; }
.campo-invalido input, .campo-invalido select { border-color: var(--erro); }

.checkbox { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.checkbox input, .tabela input[type="radio"] { width: 16px; height: 16px; accent-color: var(--destaque); }

.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; padding: 1rem 1.25rem; }
.filtros .campo { min-width: 180px; }

/* ---------- Alertas e erros ---------- */

.alerta { padding: 0.75rem 1rem; border-radius: var(--raio-pequeno); margin-bottom: 1rem; border: 1px solid transparent; }
.alerta-sucesso { background: var(--sucesso-fundo); color: var(--sucesso); }
.alerta-erro { background: var(--erro-fundo); color: var(--erro); }

.erro-pagina { margin: 3rem auto; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.erro-detalhe { max-width: 100%; overflow: auto; font-size: 0.75rem; background: var(--fundo); padding: 0.75rem; border-radius: var(--raio-pequeno); }

.paginacao { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }

/* ---------- Login ---------- */

.corpo-simples { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.centro { width: 100%; max-width: 380px; }
.cartao-login { padding: 2rem; }
.cartao-login form { margin-top: 1.25rem; }

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

@media (max-width: 1024px) {
    .grade-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .app { grid-template-columns: 1fr; }
    .topo-movel {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; z-index: 10;
        padding: 0.75rem 1rem; background: var(--superficie); border-bottom: 1px solid var(--borda);
    }
    .topo-movel .marca { padding: 0; }
    .barra-lateral { display: none; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--borda); }
    .barra-lateral.aberta { display: flex; }
    .barra-lateral > .marca { display: none; }
    .conteudo { padding: 1.25rem 1rem 2rem; }
    .cabecalho-pagina { flex-direction: column; align-items: stretch; }
    .grade-2, .grade-form { grid-template-columns: 1fr; }
    .kpi-valor { font-size: 1.5rem; }
    .tabela th, .tabela td { padding: 0.625rem 0.875rem; }
}
