/* Base: tokens (claro/escuro), reset, tipografia e componentes compartilhados
   entre o painel e a importação. */

:root {
  color-scheme: light dark;

  --bg: #EEF1F6;
  --surface: #FFFFFF;
  --ink: #14213D;
  --muted: #5B6782;
  --line: #DCE2EC;
  --accent: #2E5BFF;
  --soft: #E6ECFF;
  --chart-grid: #E4E8F0;

  /* Cores dos cartões; --c5 também é a cor de erro. */
  --c1: #1F3B8C; --c2: #0E7C66; --c3: #C2410C; --c4: #7C3AED;
  --c5: #B91C1C; --c6: #EA7A00; --c7: #0F766E; --c8: #475569;
  --erro: var(--c5);

  --fonte-texto: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fonte-titulo: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;

  --raio-sm: 8px;
  --raio: 10px;
  --raio-lg: 14px;

  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D1424;
    --surface: #16203A;
    --ink: #E8EDF7;
    --muted: #9AA6C2;
    --line: #26324F;
    --accent: #7C9BFF;
    --soft: #1E2B4D;
    --chart-grid: #243051;
    --c1: #6F8EF0; --c2: #2FBF9B; --c3: #F08A4B; --c4: #A98BFA;
    --c5: #F2777A; --c6: #FFAA4D; --c7: #4FD1C5; --c8: #94A3B8;
  }
}

/* ---------- Reset e tipografia ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--fonte-texto);
}

h1, h2, h3, .num { font-family: var(--fonte-titulo); }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 12px; }

.hint { color: var(--muted); font-size: 13px; }
.nowrap { white-space: nowrap; }
.nada { color: var(--muted); }

/* Bolinha colorida do cartão; a cor vem em --cor. */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--cor);
}

/* ---------- Controles ---------- */

:where(button, select, input, summary):where(:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:where(select, input[type="search"], input[type="password"]) {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--raio-sm);
}

.vbtn, .btn {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--raio);
  cursor: pointer;
}

.btn { font-weight: 600; padding: 8px 14px; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.pill {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--soft);
  border: 0;
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
}

/* ---------- Mensagens ---------- */

.msg { margin: -8px 0 20px; font-size: 13.5px; color: var(--muted); }
.msg.erro { color: var(--erro); }
.empty { color: var(--muted); padding: 20px; text-align: center; }

/* ---------- Painéis e indicadores ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--raio-lg);
  padding: 18px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.kpi span { color: var(--muted); font-size: 13px; }
.kpi .num { display: block; margin-top: 2px; font-size: 24px; font-weight: 700; }
.kpi em {
  display: block;
  font-style: normal;
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tbl { overflow-x: auto; margin-top: 12px; }

table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13.5px; }

th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
