/* Painel Financeiro – Acampe
   Paleta PROVISÓRIA (handoff 6.2). Quando a logo oficial chegar, extraia as cores dela,
   troque --brand / --brand-ink / --accent abaixo e confirme com a equipe. */
:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --ink: #1d2b25;
  --ink-2: #4a5a52;
  --ink-3: #5f6d66;
  --line: #e2e2d9;
  --brand: #1f4d3a;        /* verde-floresta */
  --brand-ink: #ffffff;
  --brand-soft: #e3ece7;
  --sand: #e9dcc3;         /* areia */
  --accent: #e07a3f;       /* laranja-pôr-do-sol: só destaques e alertas */
  --accent-soft: #fbeadf;
  --neg: #b3261e;
  --neg-soft: #f8e1df;
  --pos: #2e7d4f;
  --pos-soft: #e1f0e6;
  --data: #a3aaa5;         /* cinza dos gráficos */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(29,43,37,.06), 0 4px 16px rgba(29,43,37,.06);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
a { color: var(--brand); }
.num, td.v, .kpi-valor, .valor { font-variant-numeric: tabular-nums; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pular { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.pular:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- topo ---------- */
.topo { position: sticky; top: 0; z-index: 20; background: rgba(245,245,240,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: env(safe-area-inset-top) 16px 0; }
.topo-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1180px; margin: 0 auto; min-height: 56px; }
.topo-periodo { min-height: 48px; padding-bottom: 8px; }
.marca { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.marca-nome { font-weight: 800; font-size: 1.3rem; color: var(--brand); letter-spacing: -.02em; }
.marca-app { color: var(--ink-2); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-acoes { display: flex; gap: 8px; align-items: center; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: .82rem; cursor: pointer; }
.status-ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--data); }
.status[data-estado="ok"] .status-ponto { background: var(--pos); }
.status[data-estado="sincronizando"] .status-ponto { background: var(--accent); animation: pulsar 1s infinite; }
.status[data-estado="offline"] .status-ponto { background: var(--accent); }
.status[data-estado="erro"] .status-ponto { background: var(--neg); }
@keyframes pulsar { 50% { opacity: .3; } }
.btn-icone { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.abas { display: none; gap: 4px; overflow-x: auto; }
.abas a { padding: 10px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.abas a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.abas a:hover:not([aria-current]) { background: var(--brand-soft); }
.periodo { display: flex; gap: 8px; margin-left: auto; }
.periodo select { width: auto; min-width: 92px; padding-right: 28px; }

/* ---------- barra inferior (celular) ---------- */
.barra-inferior { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.barra-inferior a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; text-decoration: none; color: var(--ink-3); font-size: .75rem; font-weight: 600; }
.barra-inferior svg { width: 24px; height: 24px; fill: currentColor; }
.barra-inferior a[aria-current="page"] { color: var(--brand); }
@media (min-width: 900px) {
  .abas { display: flex; }
  .barra-inferior { display: none; }
  body { padding-bottom: 32px; }
}

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 16px; outline: none; }
.secao-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.secao-topo h1 { margin: 0; }
.grade { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.duas { grid-template-columns: 1fr; }
@media (min-width: 900px) { .duas { grid-template-columns: 1fr 1fr; } }
.cartao { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.grade > .cartao { margin-top: 0 !important; }
.cartao + .cartao, .grade + .cartao, .cartao + .grade, .grade + .grade, .aviso + .grade, .aviso + .cartao { margin-top: 12px; }
.cartao h2 { display: flex; align-items: center; gap: 6px; }
.sub { color: var(--ink-2); font-size: .88rem; margin: -2px 0 10px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-rotulo { color: var(--ink-2); font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.kpi-valor { font-size: 1.35rem; font-weight: 750; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi-extra { color: var(--ink-2); font-size: .82rem; }
.kpi.largo { grid-column: span 2; }
.kpi-valor > span.neg, .kpi-valor > span.pos { white-space: nowrap; }
@media (max-width: 420px) { .kpi-valor { font-size: 1.15rem; } .cartao { padding: 14px; } }
.neg { color: var(--neg); } .pos { color: var(--pos); }
.selo { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.selo.neg { background: var(--neg-soft); color: var(--neg); }
.selo.pos { background: var(--pos-soft); color: var(--pos); }
.selo.alerta { background: var(--accent-soft); color: #8a3f12; }
.selo.neutro { background: #efefe9; color: var(--ink-2); }
.barra-prog { height: 10px; background: #ecece5; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.barra-prog > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border-left: 4px solid var(--data); box-shadow: var(--shadow); font-size: .92rem; }
.aviso + .aviso { margin-top: 8px; }
.aviso.critico { border-left-color: var(--neg); }
.aviso.atencao { border-left-color: var(--accent); }
.aviso.info { border-left-color: var(--brand); }
.aviso .acao-link { margin-left: auto; white-space: nowrap; }
.alertas { margin-top: 12px; }
.vazio { text-align: center; color: var(--ink-2); padding: 32px 16px; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; }
.btn:hover { background: #fafaf6; }
.btn.prim { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.prim:hover { background: #193f30; }
.btn.perigo { color: var(--neg); border-color: #e9c3bf; }
.btn.pequeno { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }
label { font-weight: 600; font-size: .85rem; color: var(--ink-2); display: block; margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid #cfd2c8; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
input[aria-invalid="true"] { border-color: var(--neg); }
.campo { min-width: 0; }
.campos { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.campos .inteiro { grid-column: 1 / -1; }
.ajuda { font-size: .8rem; color: var(--ink-3); margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid #cfd2c8; background: #fff; font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.sugerido:not([aria-pressed="true"]) { border-color: var(--accent); border-style: dashed; }
.segmentado { display: inline-flex; background: #ecece5; padding: 3px; border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.segmentado button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 650; font-size: .88rem; color: var(--ink-2); cursor: pointer; }
.segmentado button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.selos-calc { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sugestao { font-size: .85rem; background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.mais-opcoes summary { cursor: pointer; font-weight: 650; color: var(--brand); min-height: 40px; display: flex; align-items: center; }
.btn-info { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #c2c7bd; background: #fff; color: var(--ink-2); font: 700 .72rem/1 var(--font); cursor: pointer; padding: 0; display: inline-grid; place-items: center; flex: none; position: relative; }
.btn-info::after { content: ""; position: absolute; inset: -11px; }

/* ---------- filtros e listas ---------- */
.filtros { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.filtros .busca { grid-column: 1 / -1; }
@media (min-width: 900px) { .filtros { grid-template-columns: 2fr repeat(5, 1fr); } .filtros .busca { grid-column: auto; } }
.totais { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--ink-2); margin: 10px 2px; }
.totais strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.lista { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 56px; }
.item:last-child { border-bottom: 0; }
.item:hover { background: #fafaf6; }
.item-corpo { flex: 1; min-width: 0; }
.item-titulo { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { color: var(--ink-2); font-size: .82rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.item-valor { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.mais-itens { display: block; margin: 12px auto 0; }

/* ---------- tabelas ---------- */
.tabela-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; max-width: 260px; white-space: normal; min-width: 170px; }
@media (max-width: 480px) { th:first-child, td:first-child { min-width: 132px; max-width: 150px; } }
thead th { font-weight: 700; color: var(--ink-2); background: #fafaf6; }
thead th:first-child { background: #fafaf6; }
tr.sub-t td { font-weight: 700; background: #f7f7f2; }
tr.sub-t td:first-child { background: #f7f7f2; }
tr.res td { font-weight: 800; background: var(--brand-soft); }
tr.res td:first-child { background: var(--brand-soft); }
tr.sec td { font-weight: 800; color: var(--brand); text-align: left; padding-top: 14px; font-size: .78rem; letter-spacing: .04em; }
tr.info-t td { color: var(--ink-2); }
td.v button { all: unset; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
td.v button:hover { background: var(--sand); }
td.v button:focus-visible { outline: 3px solid var(--accent); }
td.total, th.total { font-weight: 750; border-left: 1px solid var(--line); }

/* ---------- gráficos ---------- */
.grafico-h svg { max-width: 720px; }
.grafico svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafico .eixo { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.grafico .grade-l { stroke: #ecece6; stroke-width: 1; }
.grafico .base { stroke: #b9bdb5; stroke-width: 1; }
.grafico .rotulo { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; fill: var(--ink); font-size: 11px; font-weight: 650; font-family: var(--font); font-variant-numeric: tabular-nums; }
.grafico [data-tip] { cursor: default; }
.grafico [data-tip]:hover { opacity: .85; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); margin-top: 6px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legenda i.linha { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; width: 16px; vertical-align: 3px; }
#tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .8rem; font-variant-numeric: tabular-nums; max-width: 240px; box-shadow: var(--shadow); }

/* ---------- veículos ---------- */
.veic-cartao .linha-dupla { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.veic-cartao .linha-dupla:last-child { border-bottom: 0; }
.veic-cartao .linha-dupla span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.veiculos-grade { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- modal ---------- */
dialog#modal { border: 0; padding: 0; border-radius: 20px 20px 0 0; width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0; background: var(--surface); color: var(--ink); box-shadow: 0 -8px 40px rgba(0,0,0,.2); }
@media (min-width: 700px) { dialog#modal { border-radius: 20px; margin: auto; max-height: 88vh; } }
dialog#modal::backdrop { background: rgba(20,30,25,.45); }
.modal-corpo { padding: 16px 16px 8px; overflow-y: auto; max-height: calc(92vh - 76px); }
.modal-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 12px 0 16px; }
.modal-topo h2 { margin: 0; }
.modal-rodape { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); position: sticky; bottom: 0; }
.modal-rodape .btn.prim { flex: 1; }
.modal-rodape .esq { margin-right: auto; }
.auditoria { font-size: .8rem; color: var(--ink-3); margin-top: 10px; }
.auditoria li { margin: 2px 0; }
.erro-form { color: var(--neg); font-weight: 600; font-size: .88rem; min-height: 1.2em; margin: 6px 0 0; }

/* ---------- login / toast ---------- */
.login { max-width: 420px; margin: 8vh auto; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; transition: .2s; z-index: 80; max-width: calc(100vw - 32px); }
#toast.ver { opacity: 1; transform: translateX(-50%); }
#toast.erro { background: var(--neg); }
@media (min-width: 900px) { #toast { bottom: 24px; } }
.mais-menu a { display: flex; align-items: center; min-height: 52px; padding: 0 12px; border-radius: 12px; text-decoration: none; font-weight: 650; color: var(--ink); }
.mais-menu a:hover { background: var(--brand-soft); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
