/* Painel Financeiro — tema executivo (claro/escuro) */

:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef1f5;
  --border: #e3e7ed;
  --border-strong: #cfd6df;
  --ink: #0e1a2b;
  --ink-2: #475467;
  --muted: #7b8698;
  --brand: #1b365d;
  --brand-ink: #ffffff;
  --brand-soft: #e8eef6;
  --spark: #1f3a5f;
  --grid: #e8ebf0;
  --axis: #c9d0da;

  --good: #0b7a4b;
  --good-bg: #e7f5ee;
  --good-border: #b7e2cb;
  --bad: #c2541b;
  --bad-bg: #fdf0e7;
  --bad-border: #f5c9ad;
  --crit: #b42318;
  --crit-bg: #fdecea;
  --crit-border: #f4bcb6;
  --warn: #9a5b00;
  --warn-bg: #fff6e0;
  --warn-border: #f3d48a;

  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #4a3aa7;
  --s8: #e34948;

  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0f17;
    --surface: #111925;
    --surface-2: #151f2d;
    --surface-3: #1b2636;
    --border: #223044;
    --border-strong: #2e3f57;
    --ink: #edf1f7;
    --ink-2: #b3bdcb;
    --muted: #7f8ca0;
    --brand: #8fb4e6;
    --brand-ink: #0a0f17;
    --brand-soft: #1a2a42;
    --spark: #8fb4e6;
    --grid: #1e2a3b;
    --axis: #2e3f57;
    --good: #43c98a;
    --good-bg: #0f2a1f;
    --good-border: #1c4a35;
    --bad: #f0915a;
    --bad-bg: #2d1a10;
    --bad-border: #57321d;
    --crit: #f07167;
    --crit-bg: #2e1513;
    --crit-border: #5a2622;
    --warn: #f2c14e;
    --warn-bg: #2b2210;
    --warn-border: #4e3d17;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
    --s7: #9085e9;
    --s8: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f17;
  --surface: #111925;
  --surface-2: #151f2d;
  --surface-3: #1b2636;
  --border: #223044;
  --border-strong: #2e3f57;
  --ink: #edf1f7;
  --ink-2: #b3bdcb;
  --muted: #7f8ca0;
  --brand: #8fb4e6;
  --brand-ink: #0a0f17;
  --brand-soft: #1a2a42;
  --spark: #8fb4e6;
  --grid: #1e2a3b;
  --axis: #2e3f57;
  --good: #43c98a;
  --good-bg: #0f2a1f;
  --good-border: #1c4a35;
  --bad: #f0915a;
  --bad-bg: #2d1a10;
  --bad-border: #57321d;
  --crit: #f07167;
  --crit-bg: #2e1513;
  --crit-border: #5a2622;
  --warn: #f2c14e;
  --warn-bg: #2b2210;
  --warn-border: #4e3d17;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #008300;
  --s7: #9085e9;
  --s8: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.crit { color: var(--crit); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.nav { display: flex; gap: 2px; }
.nav a {
  text-decoration: none; color: var(--ink-2); font-weight: 500;
  padding: 8px 12px; border-radius: 8px;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--brand-soft); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.mes-switch {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  height: 38px;
}
.mes-switch button {
  border: 0; background: transparent; width: 34px; height: 100%;
  display: grid; place-items: center; color: var(--ink-2);
}
.mes-switch button:hover { color: var(--ink); background: var(--surface-3); }
.mes-switch button:first-child { border-radius: 10px 0 0 10px; }
.mes-switch button:last-child { border-radius: 0 10px 10px 0; }
.mes-switch .mes-label {
  min-width: 132px; text-align: center; font-weight: 600; font-size: 13.5px;
  border: 0; background: transparent; padding: 0 6px; height: 100%;
}
.mes-switch input[type="month"] { position: absolute; opacity: 0; pointer-events: none; width: 1px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-3); }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.12); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--crit); border-color: var(--crit-border); background: transparent; }
.btn-danger:hover { background: var(--crit-bg); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; }
:root[data-theme="dark"] .link-btn { color: var(--brand); }

/* ---------- Layout ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 24px 28px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-flush { padding: 0; }
.card-flush .card-head { padding: 18px 20px 0; }

/* ---------- KPI (estilo cartão com sparkline e comparativos) ---------- */
.kpi { display: flex; flex-direction: column; padding: 18px 18px 16px; }
.kpi-head { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.kpi-head .badge { margin-left: auto; }
.kpi-tag {
  font-size: 11px; font-weight: 800; letter-spacing: 0.02em;
  padding: 3px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink);
}
.kpi-head h3 { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge.good { background: var(--good-bg); color: var(--good); border-color: var(--good-border); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.badge.crit { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-border); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.kpi-valor { font-size: 30px; font-weight: 800; letter-spacing: -0.025em; margin: 12px 0 10px; white-space: nowrap; }
.kpi-comp { margin: 0; display: grid; gap: 4px; }
.kpi-comp div { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.kpi-comp dt { min-width: 0; }
.kpi-comp dd { white-space: nowrap; }
.kpi-comp dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-spark { height: 46px; margin: 12px 0 10px; position: relative; }
.kpi-foot { display: flex; justify-content: space-between; gap: 4px 10px; font-size: 12.5px; color: var(--ink-2); margin-top: auto; flex-wrap: wrap; }
.kpi-foot b { color: var(--ink); font-weight: 700; }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Filtros ---------- */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.input, .select {
  height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  padding: 0 12px; min-width: 0; outline: none;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-busca { width: 260px; }

/* ---------- Listas / tabelas ---------- */
.tabela { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabela th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tabela td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela tbody tr.clicavel { cursor: pointer; }
.tabela tbody tr.clicavel:hover { background: var(--surface-2); }
.tabela-wrap { overflow-x: auto; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.lista-item:last-child { border-bottom: 0; }
button.lista-item { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; padding: 11px 4px; border-radius: 0; }
button.lista-item:hover { background: var(--surface-2); }
.li-titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-valor { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.li-icone {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 800;
}
.dia-grupo { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 14px 4px 4px; display: flex; justify-content: space-between; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.tag-parcela { font-size: 11.5px; font-weight: 700; color: var(--ink-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; }

.vazio { text-align: center; color: var(--muted); padding: 32px 12px; }
.vazio strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- Barras horizontais (categorias) ---------- */
.hbars { display: grid; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.hbar-row .nome { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-row .nome span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .valor { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.hbar-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-3); position: relative; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); max-width: 100%; }
.hbar-fill.over { background: var(--bad); }
.hbar-meta { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
.hbar-info { grid-column: 1 / -1; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
button.hbar-row { border: 0; background: none; padding: 6px; margin: -6px; border-radius: 8px; text-align: left; width: calc(100% + 12px); }
button.hbar-row:hover { background: var(--surface-2); }
button.hbar-row[aria-pressed="true"] { background: var(--brand-soft); }

.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.meter > i.warn { background: var(--warn); }
.meter > i.crit { background: var(--crit); }

/* ---------- Faturas ---------- */
.fatura { border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; }
.fatura + .fatura { margin-top: 10px; }
.fatura-top { display: flex; align-items: center; gap: 10px; }
.fatura-top .nome { font-weight: 700; flex: 1; min-width: 0; }
.fatura-top .valor { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.fatura-linhas { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.fatura-linhas b { color: var(--ink-2); font-weight: 700; }
.card-swatch { width: 26px; height: 18px; border-radius: 4px; flex: none; }

/* ---------- Gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .key-line { width: 14px; height: 2px; border-radius: 1px; }
.legend .key-box { width: 10px; height: 10px; border-radius: 3px; }
.tt {
  position: absolute; z-index: 20; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  padding: 9px 11px; font-size: 12.5px; min-width: 150px; opacity: 0; transition: opacity 0.08s;
}
.tt.on { opacity: 1; }
.tt-titulo { font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-top: 3px; }
.tt-row .k { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.tt-row .k i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.tt-row .k i.box { height: 8px; width: 8px; border-radius: 2px; }
.tt-row b { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- Tiles simples ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.tile .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tile .val { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; white-space: nowrap; }
.tile .det { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ---------- Timeline (alívio) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .quando { font-weight: 700; }
.timeline .oque { color: var(--ink-2); font-size: 13px; }
.timeline .quanto { font-weight: 700; color: var(--good); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Modal / Sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(9, 14, 23, 0.48);
  display: grid; place-items: center; padding: 20px; animation: fade 0.12s ease-out;
}
.sheet {
  width: min(560px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: hidden;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: subir 0.16s ease-out;
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { margin: 0; font-size: 16px; flex: 1; }
.sheet-body { padding: 18px; overflow-y: auto; flex: 1; }
.sheet-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet-foot .esq { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(12px); opacity: 0; } }

.campo { display: grid; gap: 6px; margin-bottom: 14px; }
.campo label, .campo .lbl { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.campo .ajuda { font-size: 12px; color: var(--muted); }
.campo .input, .campo .select { height: 42px; width: 100%; }
.campos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* Wizard */
.wiz-prog { display: flex; gap: 4px; padding: 0 18px; margin-top: 12px; }
.wiz-prog i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.wiz-prog i.on { background: var(--brand); }
.wiz-titulo { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.wiz-sub { color: var(--muted); margin: 0 0 18px; }
.valor-grande { display: flex; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--brand); padding: 8px 2px; }
.valor-grande span { font-size: 22px; font-weight: 700; color: var(--muted); }
.valor-grande input { border: 0; outline: none; background: none; font-size: 40px; font-weight: 800; letter-spacing: -0.03em; width: 100%; min-width: 0; font-variant-numeric: tabular-nums; }
.opcoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opcao {
  display: flex; align-items: center; gap: 10px; text-align: left;
  min-height: 52px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
}
.opcao:hover { border-color: var(--border-strong); background: var(--surface-2); }
.opcao[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.opcao .t { font-weight: 600; display: block; line-height: 1.25; }
.opcao .s { font-size: 12px; color: var(--muted); display: block; }
.sugestoes { display: grid; gap: 4px; margin-top: 8px; }
.sugestao {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2);
}
.sugestao:hover, .sugestao.ativa { border-color: var(--brand); background: var(--brand-soft); }
.sugestao .s { font-size: 12px; color: var(--muted); }
.parcelas-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.parcelas-row button { min-width: 48px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; }
.parcelas-row button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.revisao { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.revisao-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.revisao-row:last-child { border-bottom: 0; }
button.revisao-row.lista-item { padding: 11px 14px; border-radius: 0; }
.revisao-row .k { color: var(--muted); font-size: 13px; }
.revisao-row .v { font-weight: 600; text-align: right; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow-lg); animation: subir 0.15s ease-out; }
.toast.erro { background: var(--crit); color: #fff; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); }
.login-card h1 { font-size: 20px; margin: 18px 0 4px; letter-spacing: -0.02em; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
.erro-msg { color: var(--crit); font-size: 13px; font-weight: 600; min-height: 18px; margin: 6px 0 10px; }

.skeleton { color: var(--muted); padding: 60px 0; text-align: center; }

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .grid-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .grid-main, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .nav { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .bottom-nav a, .bottom-nav button.bn-item {
    display: grid; justify-items: center; gap: 2px; text-decoration: none; font-size: 11px; font-weight: 600;
    color: var(--muted); border: 0; background: none; padding: 6px 0;
  }
  .bottom-nav a[aria-current="page"] { color: var(--brand); }
  .bottom-nav .icon { width: 21px; height: 21px; }
  .bn-mais {
    justify-self: center; width: 52px; height: 52px; border-radius: 16px; border: 0;
    background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; margin-top: -18px;
    box-shadow: var(--shadow-lg);
  }
  .bn-mais .icon { width: 24px; height: 24px; stroke-width: 2.2; }
  .so-desktop { display: none !important; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .brand-nome { display: none; }
  .mes-switch .mes-label { min-width: 112px; }
  .page { padding: 16px 16px 32px; }
  .page-head h1 { font-size: 19px; }
  /* KPIs viram carrossel horizontal no celular: a Visão geral fica curta. */
  .grid-kpi {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px;
    margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none;
  }
  .grid-kpi::-webkit-scrollbar { display: none; }
  .grid-kpi > .kpi { flex: 0 0 86%; scroll-snap-align: center; }
  .kpi-valor { font-size: 28px; }
  .card { padding: 16px; border-radius: 14px; }
  .input-busca { width: 100%; }
  .tiles { gap: 10px; }
  .tile { padding: 12px; }
  .tile .val { font-size: 17px; white-space: normal; }
  .filtros .select { flex: 1; }
  .overlay { padding: 0; place-items: end stretch; }
  .sheet { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .sheet-foot .btn { flex: 1; }
  .sheet-foot .esq { flex: 0 0 auto; }
  .opcoes { grid-template-columns: 1fr 1fr; }
  .campos-2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tabela .ocultar-mobile { display: none; }
  .timeline li { grid-template-columns: 72px minmax(0, 1fr); }
  .timeline .quanto { grid-column: 2; }
  .toasts { bottom: 90px; }
}
@media (min-width: 1081px) {
  .so-mobile { display: none !important; }
}
