:root {
  color-scheme: light;
  --bg: #f4f3f0; --surface-1: #fcfcfb; --surface-2: #f0efec; --border: #e2e0da;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #7a7974;
  --series-1: #2a78d6; --series-2: #eb6834; --grid: #e7e6e1;
  --good: #1f7a3f; --good-bg: #e3f3e8; --bad: #b42318; --bad-bg: #fbe7e5; --warn: #8a5a00; --warn-bg: #fdf1d6;
  --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
    --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c29;
    --good: #5fcf86; --good-bg: #17301f; --bad: #ff8a80; --bad-bg: #3a1a17; --warn: #f1c25b; --warn-bg: #352a10;
    --accent: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8f8e86;
  --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c29;
  --good: #5fcf86; --good-bg: #17301f; --bad: #ff8a80; --bad-bg: #3a1a17; --warn: #f1c25b; --warn-bg: #352a10;
  --accent: #3987e5;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text-primary);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px 48px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 10px; flex-wrap: wrap; }
header h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
header h1 span { color: var(--text-muted); font-weight: 500; }
.meta { color: var(--text-muted); font-size: 12px; display: flex; gap: 14px; align-items: center; }
.meta a { color: var(--text-secondary); }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 0 14px; position: sticky; top: 0;
  background: var(--bg); z-index: 5; }
select, input[type=date], button { font: inherit; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; border-radius: 0; padding: 10px 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 600; }
.aviso { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.kpi .rot { color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .val { font-size: 26px; font-weight: 650; margin: 4px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .cmp { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 2px; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.painel h2 { font-size: 15px; margin: 0 0 4px; }
.painel .sub { color: var(--text-muted); font-size: 12px; margin: 0 0 12px; }
.chart { position: relative; height: 300px; }
.chart.alto { height: 420px; }
.duas { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
@media (max-width: 860px) { .duas { grid-template-columns: 1fr; } }
.tabela { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--surface-1); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.desc { white-space: normal; min-width: 220px; }
tr:hover td { background: var(--surface-2); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-secondary); }
.badge.A { background: var(--good-bg); color: var(--good); } .badge.B { background: var(--warn-bg); color: var(--warn); }
.st { font-weight: 600; } .st.bad { color: var(--bad); } .st.warn { color: var(--warn); }
.mb { margin-bottom: 16px; }
.vazio { color: var(--text-muted); padding: 18px 0; text-align: center; }
.carregando { padding: 80px 0; text-align: center; color: var(--text-muted); }
.login { max-width: 340px; margin: 12vh auto; }
.login input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-1); color: var(--text-primary); margin: 6px 0 12px; }
.login button { width: 100%; background: var(--accent); color: #fff; border: 0; padding: 10px; font-weight: 600; cursor: pointer; }
.erro { color: var(--bad); margin-bottom: 10px; }
@media (max-width: 520px) { .kpi .val { font-size: 22px; } .chart { height: 240px; } }
