/* ui_tokens_both.css — compatível com body.theme-dark / body.theme-light
   Mantém seu layout, melhora contraste do dark, não mexe em .btn-*.
*/

:root{
  --bg:#f5f7fb; --surface:#ffffff; --card:#ffffff;
  --text:#0d1b2a; --muted:#5b6b84; --border:rgba(13,27,42,.12);
  --accent:#3b82f6; --success:#22c55e; --warning:#f59e0b; --danger:#ef4444;
}

/* ---------------- LIGHT ---------------- */
body.theme-light{ background:var(--bg)!important; color:var(--text); }
body.theme-light .header{ background:var(--surface); border-bottom:1px solid var(--border); }
body.theme-light .sidebar{ background:var(--surface); border-right:1px solid var(--border); }
body.theme-light .card, body.theme-light .modal-content{ background:var(--card)!important; border:1px solid var(--border)!important; color:var(--text); }

body.theme-light .table{ --bs-table-bg:transparent; color:#212529!important; background:transparent!important; }
body.theme-light .table thead th{ color:#6c757d!important; background:transparent!important; border-bottom:1px solid var(--border)!important; text-transform:uppercase; font-size:12px; letter-spacing:.04em; }
body.theme-light .table th, body.theme-light .table td{ color:#212529!important; border-color:var(--border)!important; }
body.theme-light .table-striped>tbody>tr:nth-of-type(odd){ background-color:rgba(0,0,0,.03)!important; }
body.theme-light .table-hover tbody tr:hover{ background-color:rgba(0,0,0,.06)!important; }

/* ---------------- DARK ---------------- */
body.theme-dark{
  --bg:#0b1220; --surface:#0e1626; --card:#101a2e;
  --text:#e6edf7; --muted:#9fb1cf; --border:rgba(255,255,255,.08);
  --accent:#60a5fa; --success:#34d399; --warning:#fbbf24; --danger:#f87171;
  background:var(--bg)!important; color:var(--text);
}
body.theme-dark .header{ background:var(--surface)!important; border-bottom:1px solid var(--border)!important; }
body.theme-dark .sidebar{ background:var(--surface)!important; border-right:1px solid var(--border)!important; }
body.theme-dark .card, body.theme-dark .modal-content{ background:var(--card)!important; border:1px solid var(--border)!important; color:var(--text)!important; }

/* Tabelas legíveis no dark */
body.theme-dark .table{ --bs-table-bg:transparent; color:var(--text)!important; background:transparent!important; }
body.theme-dark .table thead th{ color:var(--muted)!important; background:transparent!important; border-bottom:1px solid var(--border)!important; text-transform:uppercase; font-size:12px; letter-spacing:.04em; }
body.theme-dark .table th, body.theme-dark .table td{ color:var(--text)!important; border-color:var(--border)!important; }
body.theme-dark .table-striped>tbody>tr:nth-of-type(odd){ background-color:rgba(255,255,255,.05)!important; }
body.theme-dark .table-hover tbody tr:hover{ background-color:rgba(255,255,255,.08)!important; }

/* Neutraliza fundos brancos forçados sem tocar no layout */
body.theme-dark .bg-white,
body.theme-dark .table.bg-white, body.theme-dark .table .bg-white,
body.theme-dark .grid, body.theme-dark .data-grid,
body.theme-dark .list-group-item,
body.theme-dark .ag-theme-alpine, body.theme-dark .ag-root-wrapper,
body.theme-dark .ag-root, body.theme-dark .ag-body-viewport, body.theme-dark .ag-center-cols-viewport, body.theme-dark .ag-header{
  background:transparent!important; color:var(--text)!important; border-color:var(--border)!important;
}

/* Links / tipografia secundária (não altera .btn-*) */
a{ color:var(--accent); } a:hover{ text-decoration:underline; }
body.theme-dark .text-muted, body.theme-dark .muted{ color:var(--muted)!important; }
body.theme-dark .text-dark, body.theme-dark .link-dark{ color:var(--text)!important; }

/* Pequenas melhorias responsivas (sem mudar estrutura) */
@media (max-width: 991.98px){
  .main{ padding:12px; }
  .header{ padding-left:12px!important; padding-right:12px!important; }
  .table-responsive{ overflow-x:auto; }
}

/* Utilitário de espaçamento */
.row.g-3>*{ padding-top:8px; padding-bottom:8px; }
