/* Painel Financeiro — Padrão Executivo Contínuo (adaptado para celular).
   Fundo contínuo; só dado vira cartão; cor só com significado.
   Tokens definidos uma vez por tema: o tema.js sempre define data-theme. */

:root {
  color-scheme: light;
  /* Superfícies */
  --bg: #eaeff5;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-3: #e9eef5;
  --input-bg: #ffffff;
  /* Texto */
  --text: #213b52;
  --text-2: #3b5469;
  --muted: #5a7286;
  --soft: #7c8fa1;
  /* Marca */
  --blue: #2c5372;
  --blue-2: #5d86a5;
  --blue-soft: rgba(44, 83, 114, 0.09);
  --on-blue: #ffffff;
  /* Linhas */
  --line: rgba(44, 83, 114, 0.12);
  --line-strong: rgba(44, 83, 114, 0.22);
  --line-soft: rgba(44, 83, 114, 0.07);
  /* Tons (direção boa / atenção / crítico) */
  --ok: #1f8c80;
  --ok-bg: rgba(31, 140, 128, 0.11);
  --warn: #b8692c;
  --warn-fill: #d4874e;
  --warn-bg: rgba(212, 135, 78, 0.14);
  --bad: #d2303f;
  --bad-fill: #e83948;
  --bad-bg: rgba(232, 57, 72, 0.1);
  /* Paleta categórica (ordem fixa) e escala ordinal */
  --cat-1: #2c5372;
  --cat-2: #1f8c80;
  --cat-3: #c7b475;
  --cat-4: #7fb6d6;
  --cat-5: #8a6d9f;
  --cat-6: #d4874e;
  --cat-7: #5d86a5;
  --cat-8: #9db5c8;
  --ord-0: #cbd5df;
  --ord-1: #a9bacb;
  --ord-2: #87a0b7;
  --ord-3: #6585a3;
  --ord-4: #4a6c8c;
  --ord-5: #325372;
  --ord-6: #1b3a55;
  /* Forma */
  --shadow: 0 1px 2px rgba(44, 83, 114, 0.06), 0 2px 8px rgba(44, 83, 114, 0.04);
  --shadow-lg: 0 18px 40px rgba(20, 45, 70, 0.18);
  --r: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* Tipografia e espaçamento */
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs: 13px;
  --fs-md: 15px;
  --fs-lg: 20px;
  --fs-xl: 28px;
  --e1: 4px;
  --e2: 8px;
  --e3: 12px;
  --e4: 16px;
  --e5: 24px;
  --e6: 32px;
  --nav-h: 64px;
  --pad-x: clamp(16px, 2vw, 30px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1b2a;
  --surface: #13304d;
  --surface-2: #1a3d60;
  --surface-3: #214a73;
  --input-bg: #102b44;
  --text: #f2f7fc;
  --text-2: #d6e3ef;
  --muted: #bcd0e2;
  --soft: #8ea6bc;
  --blue: #8fbee0;
  --blue-2: #a6c8e2;
  --blue-soft: rgba(143, 190, 224, 0.14);
  --on-blue: #0b1b2a;
  --line: rgba(143, 190, 224, 0.16);
  --line-strong: rgba(143, 190, 224, 0.28);
  --line-soft: rgba(143, 190, 224, 0.09);
  --ok: #4cc2b3;
  --ok-bg: rgba(76, 194, 179, 0.14);
  --warn: #eda36b;
  --warn-fill: #e59a62;
  --warn-bg: rgba(229, 154, 98, 0.16);
  --bad: #ff6b78;
  --bad-fill: #ff4555;
  --bad-bg: rgba(255, 69, 85, 0.14);
  --cat-1: #8fbee0;
  --cat-2: #4cc2b3;
  --cat-3: #d9c88a;
  --cat-4: #5d9fc9;
  --cat-5: #b597cb;
  --cat-6: #e59a62;
  --cat-7: #6f9cc0;
  --cat-8: #b8cada;
  --ord-0: #25507c;
  --ord-1: #3a6690;
  --ord-2: #557fa6;
  --ord-3: #7499bb;
  --ord-4: #97b5d0;
  --ord-5: #bad0e3;
  --ord-6: #dce8f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.ink2 { color: var(--text-2); }
.ok, .good { color: var(--ok); }
.warn { color: var(--warn); }
.bad, .crit { color: var(--bad); }
.forte { color: var(--text); font-weight: 700; }
.r { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.caption { font-size: var(--fs-sm); color: var(--muted); }
.mt { margin-top: var(--e4); }
.mt-lg { margin-top: var(--e5); }
.empilha { display: grid; gap: var(--e2); }
.linha { display: flex; align-items: center; gap: var(--e2); min-width: 0; }
.linha-entre { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); min-width: 0; }

/* ---------- Topbar (sem superfície: o fundo é contínuo) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--nav-h);
  display: flex; align-items: center; gap: var(--e5);
  padding: 0 var(--pad-x);
  background: var(--bg);
  box-shadow: 0 1px 0 var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--blue); color: var(--on-blue);
  display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: 0.02em;
}
.nav { display: flex; gap: 2px; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: var(--fs);
  padding: 8px 12px; border-radius: var(--r-sm);
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--e2); }

/* Seletor de mês: o único lugar onde o mês selecionado aparece. */
.mes-switch {
  position: relative;
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  height: 38px; box-shadow: var(--shadow);
}
.mes-switch button {
  border: 0; background: transparent; width: 36px; height: 100%;
  display: grid; place-items: center; color: var(--muted); border-radius: 999px;
}
.mes-switch button:hover { color: var(--text); }
.mes-switch .mes-label {
  width: auto; min-width: 136px; text-align: center; font-weight: 700; font-size: var(--fs);
  padding: 0 6px; color: var(--text);
}

.icon-btn {
  width: 38px; height: 38px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--line); }
.icon-btn-sm { width: 30px; height: 30px; }
.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: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 700; font-size: var(--fs); white-space: nowrap; text-decoration: none;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { border-color: var(--blue-2); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn-primary:hover { filter: brightness(1.1); border-color: var(--blue); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: transparent; background: var(--blue-soft); }
.btn-danger { color: var(--bad); border-color: var(--bad-bg); background: transparent; }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-lg { height: 46px; padding: 0 20px; font-size: 14px; 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(--blue); font-weight: 700; }

/* ---------- Página ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: var(--e4) var(--pad-x) 56px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); margin: var(--e2) 0 var(--e4); flex-wrap: wrap; min-height: 36px; }
.page-head h1 { font-size: 22px; letter-spacing: -0.015em; font-weight: 800; }
.actions { display: flex; gap: var(--e2); flex-wrap: wrap; align-items: center; }

/* Título de seção: fica no fundo, sem cartão. */
.secao { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--e3); margin: var(--e6) 0 var(--e3); flex-wrap: wrap; }
.secao h2 { font-size: var(--fs-md); font-weight: 800; letter-spacing: -0.01em; }
.secao p { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }

/* ---------- Grades: nunca esticam os cartões ---------- */
.grade { display: grid; gap: 14px; align-items: start; }
.grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
.grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.bloco { margin-top: 14px; }
/* Linha de cartões com a mesma altura: o conteúdo flexível (gráfico, barras) preenche o espaço. */
.grade-iguais { align-items: stretch; }
.grade-iguais > .card { display: flex; flex-direction: column; }
.grade-iguais > .card > .hbars { flex: 1; align-content: space-between; }
.empilha-cartoes { display: grid; gap: 14px; }

/* ---------- Cartão de dados ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0;
  transition: border-color 0.15s var(--ease);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--e3); margin-bottom: 14px; min-height: 30px; }
.card-head h2 { font-size: var(--fs); font-weight: 800; letter-spacing: -0.005em; }
.card-head .sub { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.card-head .total { font-weight: 800; font-size: var(--fs-md); white-space: nowrap; }
.card-flush { padding: 0; }
.card-flush > .card-head { padding: 16px 20px 0; }
.card-flush > .vazio { margin: 0 20px 18px; }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: var(--fs-sm); color: var(--muted); }
.card-foot b { color: var(--text); }

/* ---------- Número em destaque (KPI e resumos) ---------- */
.stat { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 14px; }
.stat-rotulo {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; min-height: 20px; min-width: 0;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.stat-rotulo .tag { margin-left: auto; text-transform: none; letter-spacing: 0; }
.stat-ponto { width: 7px; height: 7px; border-radius: 50%; background: var(--soft); flex: none; }
.stat-ponto.ok { background: var(--ok); }
.stat-ponto.warn { background: var(--warn-fill); }
.stat-ponto.bad { background: var(--bad-fill); }
/* Com centavos o número pode ficar longo: ajustarValores() (comum.js) reduz a fonte só quando não cabe. */
.stat-valor { font-size: clamp(24px, 2.2vw, 30px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.15; white-space: nowrap; }
.stat-delta { font-size: var(--fs-sm); color: var(--muted); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.stat-delta b { font-weight: 800; }
/* margin-top: auto prende o minigráfico no rodapé: cartões com uma linha a mais (ex.: Saldo) não o empurram para baixo dos vizinhos. */
.stat-spark { height: 40px; margin-top: auto; position: relative; }
/* KPI compacto: o mesmo molde em todas as telas (Gastos, Renda, Análises, faturas).
   Rótulo (1 linha) → número (1 linha) → detalhe (1 linha, corta com "…") → barra no rodapé.
   Mesma altura mínima em todo lugar; o texto longo nunca empurra o cartão. */
.stat.compacto { padding: 14px 16px 13px; gap: 5px; min-height: 108px; }
.stat.compacto .stat-rotulo { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.stat.compacto .stat-rotulo::after { display: none; }
.stat.compacto .stat-rotulo > span:not(.tag) { overflow: hidden; text-overflow: ellipsis; }
.stat.compacto .stat-valor { font-size: 22px; letter-spacing: -0.025em; overflow: hidden; text-overflow: ellipsis; }
.stat.compacto .stat-delta { font-size: var(--fs-sm); min-height: 20px; align-items: center; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.compacto .stat-delta > * { flex: none; }
.stat .meter { margin-top: auto; }
.stat.compacto .meter { margin-top: auto; padding-top: 0; }

/* ---------- Tags (neutras; cor só em alerta) ---------- */
.tag, .badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; line-height: 1.5;
}
.tag.ok, .badge.good { background: var(--ok-bg); color: var(--ok); }
.tag.warn, .badge.warn, .badge.bad { background: var(--warn-bg); color: var(--warn); }
.tag.bad, .badge.crit { background: var(--bad-bg); color: var(--bad); }

/* ---------- Abas / segmentado ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--e4); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 700; color: var(--muted); font-size: var(--fs);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.seg { display: inline-flex; border-radius: 999px; padding: 3px; background: var(--surface-3); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: var(--fs-sm); color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Filtros (no fundo, só os campos são superfície) ---------- */
.filtros { display: flex; gap: var(--e2); flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.input, .select {
  height: 38px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--input-bg);
  padding: 0 12px; min-width: 0; outline: none; font-size: var(--fs);
}
.input:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.input-busca { width: 260px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--fs); }

/* ---------- Tabelas ---------- */
.tabela-wrap { overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tabela th {
  text-align: left; font-weight: 800; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tabela td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela th:first-child, .tabela td:first-child { padding-left: 20px; }
.tabela th:last-child, .tabela td:last-child { padding-right: 20px; }
.tabela .r { text-align: right; white-space: nowrap; }
.tabela .forte { font-weight: 700; }
.tabela tbody tr.clicavel { cursor: pointer; }
.tabela tbody tr.clicavel:hover { background: var(--surface-2); }
.tabela .sub-celula { display: block; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Listas ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--e5); }
.lista-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.lista > .lista-item:last-child { border-bottom: 0; }
.lista-2col > .lista-item:nth-last-child(-n + 2):nth-child(odd),
.lista-2col > .lista-item:last-child { border-bottom: 0; }
button.lista-item { width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); background: none; text-align: left; padding: 10px 6px; border-radius: 8px; }
button.lista-item:hover { background: var(--surface-2); }
div.lista-item.abatimento { padding: 10px 6px; }
.li-texto { min-width: 0; display: block; }
.li-titulo { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-titulo .tag { margin-left: 4px; vertical-align: 1px; }
.li-sub { display: block; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-valor { font-weight: 700; text-align: right; white-space: nowrap; }
.li-ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; box-shadow: 0 0 0 1px var(--line); }
.li-icone {
  width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none;
  background: var(--blue-soft); color: var(--blue); font-size: var(--fs-sm); font-weight: 800;
}
.dia-grupo {
  font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 16px 6px 4px; display: flex; justify-content: space-between;
}
.dia-grupo:first-child { padding-top: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; box-shadow: 0 0 0 1px var(--line); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.card-swatch { width: 22px; height: 15px; border-radius: 4px; flex: none; display: inline-block; }
.tag-parcela { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }

/* Estado vazio: tracejado, nunca um gráfico vazio. */
.vazio {
  text-align: center; color: var(--muted); padding: 22px 16px; font-size: var(--fs);
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
}
.vazio strong { display: block; color: var(--text); margin-bottom: 2px; font-weight: 700; }
.vazio .acao { margin-top: 12px; }

/* ---------- Barras horizontais (categorias) ---------- */
.hbars { display: grid; gap: 14px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 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; text-align: right; white-space: nowrap; }
.hbar-row .valor small { font-weight: 600; color: var(--muted); font-size: var(--fs-xs); margin-left: 6px; }
.hbar-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); position: relative; }
.hbar-fill { height: 100%; border-radius: 3px; background: var(--blue); max-width: 100%; }
.hbar-fill.over { background: var(--bad-fill); }
.hbar-meta { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; opacity: 0.7; }
button.hbar-row { border: 0; background: none; padding: 6px; margin: -6px; border-radius: var(--r-sm); text-align: left; width: calc(100% + 12px); }
button.hbar-row:hover { background: var(--surface-2); }
button.hbar-row[aria-pressed="true"] { background: var(--blue-soft); }
button.hbar-row[data-apagado] { opacity: 0.5; }
span.hbar-track, span.hbar-fill { display: block; }
.hbars button.hbar-row { margin: 0 -6px; }

/* Filtro cruzado: o que está filtrando a tela, com "×" para tirar */
.filtros-ativos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filtros-ativos:empty { display: none; }
.cats-corpo { flex: 1; display: flex; flex-direction: column; }
.cats-corpo > .hbars { flex: 1; align-content: space-between; }
.chip-filtro {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--blue); background: var(--blue-soft); color: var(--text); font-weight: 700; font-size: var(--fs-sm);
}
.chip-filtro span { color: var(--muted); font-size: 15px; line-height: 1; }
.chip-filtro:hover span { color: var(--text); }

.meter { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--blue); border-radius: 2px; }
.meter > i.ok { background: var(--ok); }
.meter > i.warn { background: var(--warn-fill); }
.meter > i.crit, .meter > i.bad { background: var(--bad-fill); }

/* ---------- Faturas (linhas com divisória; sem caixa dentro de caixa) ---------- */
.fat-lista { display: grid; }
.fat-linha { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.fat-linha:first-child { padding-top: 0; }
.fat-linha:last-child { border-bottom: 0; padding-bottom: 0; }
.fat-linha .nome { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fat-linha .det { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.fat-linha .valor { font-weight: 800; white-space: nowrap; }
.fat-linha .meter { grid-column: 2 / -1; }
.fat-linha[data-fatura] { cursor: pointer; }
.fatura-pag { margin: 4px 0 12px; }
.fat-linha .det .tag { margin-left: 0; }

/* ---------- Faturas em KPIs e treemap (Visão geral) ---------- */
.secao-curta { margin-top: var(--e5); }
/* auto-fit: os cartões esticam até a ponta da fileira. Mesma estrutura em todos: selo/vencimento numa linha
   de altura fixa e a barra do limite no rodapé (invisível quando o cartão não tem limite). */
/* Faturas em carrossel infinito (carrossel.js): 4 por vez no computador, 2 no tablet, 1 no celular.
   Com poucos cartões, fileira comum ocupando a largura toda. */
.faturas-car { display: flex; gap: 14px; }
.faturas-car > .stat { flex: 1 1 0; min-width: 0; }
.faturas-car.car-ativo { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 8px; }
.car-janela { overflow: hidden; touch-action: pan-y; cursor: grab; border-radius: var(--r); }
.car-janela:active { cursor: grabbing; }
.car-trilho { display: flex; gap: 14px; will-change: transform; user-select: none; }
.car-trilho > .stat { flex: 0 0 calc((100% - 14px * (var(--por-vista) - 1)) / var(--por-vista)); min-width: 0; }
.car-seta {
  width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--text-2); cursor: pointer;
}
.car-seta:hover { border-color: var(--blue); color: var(--text); }
.car-prox .icon { transform: rotate(180deg); }
.car-pontos { grid-column: 1 / -1; display: flex; justify-content: center; gap: 6px; margin-top: 2px; }
.car-pontos i { width: 6px; height: 6px; border-radius: 3px; background: var(--line-strong); transition: width 0.2s, background 0.2s; }
.car-pontos i[aria-current="true"] { width: 18px; background: var(--blue); }
.faturas-car .stat-delta { min-height: 22px; align-items: center; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.faturas-car .stat .meter { margin-top: auto; }
@media (max-width: 720px) { .faturas-car.car-ativo { grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 4px; } .car-seta { width: 28px; height: 28px; } }
.meter:has(> i.sem-barra) { visibility: hidden; }
.top5 { height: 300px; flex: none; display: flex; flex-direction: column; margin-top: 4px; }
.top5 > .hbars { flex: 1; align-content: space-around; }
.treemap[hidden], .top5[hidden] { display: none; }
.stat[data-fatura] { cursor: pointer; transition: border-color 0.12s; }
.stat[data-fatura]:hover, .stat[data-fatura]:focus-visible { border-color: var(--blue); }
/* Análises › Categorias: detalhe da categoria (histórico à esquerda, locais e compras à direita) */
.detalhe-cat { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--e5); margin-top: var(--e4); }
.detalhe-cat .subtitulo:first-child { margin-top: 0; }
.tabela tr[aria-selected="true"] td { background: var(--blue-soft); }
/* Histórico da categoria em barras laterais: um mês por linha, ocupando a coluna toda */
.meses-cat-box { display: flex; flex-direction: column; }
.meses-cat { display: grid; gap: 4px; }
.mc-linha {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) 76px; align-items: center; gap: 10px;
  border: 0; background: none; padding: 6px 8px; border-radius: var(--r-sm); text-align: left; color: var(--text); cursor: pointer;
}
.mc-linha:hover { background: var(--surface-2); }
.mc-linha[aria-pressed="true"] { background: var(--blue-soft); }
.mc-mes { font-weight: 700; font-size: var(--fs-sm); }
.mc-trilho { position: relative; height: 12px; border-radius: 4px; background: var(--surface-3); }
.mc-barra { display: block; height: 100%; border-radius: 4px; background: var(--mc-cor, var(--blue)); opacity: 0.75; }
.mc-linha[aria-pressed="true"] .mc-barra { opacity: 1; }
.mc-barra.over { background: var(--bad-fill); }
.mc-media, .mc-orc { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--soft); }
.mc-orc { border-left-color: var(--bad-fill); }
.mc-valor { text-align: right; font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mc-key-media { background: repeating-linear-gradient(90deg, var(--soft) 0 4px, transparent 4px 7px); }
.mc-key-orc { background: repeating-linear-gradient(90deg, var(--bad-fill) 0 4px, transparent 4px 7px); }
.tabela.mapa td.sem-dado { background: transparent; }
@media (max-width: 1080px) { .detalhe-cat { grid-template-columns: minmax(0, 1fr); } }
.grade-iguais > .card > .ponte { flex: 1; align-content: space-evenly; }
/* Treemap e Top 5 com a mesma altura fixa: trocar de modo não muda a linha (e a Ponte acompanha). */
.treemap { position: relative; height: 300px; flex: none; margin-top: 4px; }
.tm-caixa {
  position: absolute; box-sizing: border-box; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  padding: 8px 10px; border: 2px solid var(--surface); border-radius: 10px; text-align: left; color: var(--text);
  background: color-mix(in srgb, var(--tm-cor) 34%, var(--surface-2)); box-shadow: inset 3px 0 0 var(--tm-cor);
}
button.tm-caixa { cursor: pointer; }
button.tm-caixa:hover, button.tm-caixa:focus-visible { background: color-mix(in srgb, var(--tm-cor) 52%, var(--surface-2)); outline: none; }
.tm-nome { font-weight: 800; font-size: var(--fs-sm); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tm-valor { font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.tm-valor small { color: var(--text-2); font-weight: 600; margin-left: 2px; }
.tm-caixa.media .tm-valor small { display: none; }
.tm-caixa.linha1 { padding: 6px 8px; justify-content: center; }
.tm-caixa.linha1 .tm-valor { display: none; }
.tm-caixa.linha1 .tm-nome { -webkit-line-clamp: 1; white-space: nowrap; display: block; }
.ferramentas-cat { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.vazio-cat { height: 300px; display: grid; place-items: center; }
.vazio-cat[hidden] { display: none; }
.tm-caixa.mini { padding: 4px 6px; }
.tm-caixa.mini .tm-valor, .tm-caixa.mini .tm-nome { display: none; }

/* ---------- Faixa de indicadores econômicos (Visão geral) ---------- */
.indicadores {
  position: relative; overflow: hidden; margin: 0 0 var(--e4); min-height: 40px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 32px), transparent);
}
.indicadores:not(.pronto) { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: brilho 1.4s linear infinite; }
.ind-trilho { display: flex; width: max-content; animation: rolar var(--ind-duracao, 48s) linear infinite; }
.indicadores:hover .ind-trilho, .indicadores:focus-within .ind-trilho { animation-play-state: paused; }
.ind-grupo { display: flex; }
.ind-item { display: inline-flex; align-items: baseline; gap: 8px; padding: 11px 18px; white-space: nowrap; border-right: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.ind-item b { font-weight: 800; color: var(--text); }
.ind-valor { color: var(--text-2); font-variant-numeric: tabular-nums; }
.ind-var { font-weight: 700; color: var(--muted); }
.ind-var.sobe { color: var(--ok); }
.ind-var.desce { color: var(--bad); }
@keyframes rolar { to { transform: translateX(-50%); } }
@keyframes brilho { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .ind-trilho { animation: none; }
  .ind-grupo[aria-hidden] { display: none; }
  .indicadores { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
}

/* ---------- Gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart.preencher { flex: 1 1 auto; min-height: 170px; }
.chart.preencher svg { position: absolute; inset: 0; height: 100%; }
.chart text { fill: var(--soft); font-size: 11px; font-family: var(--font); }
.chart text.rotulo-valor { fill: var(--text); font-size: 10.5px; font-weight: 700; }
.chart text.rotulo-eixo2 { font-size: 10.5px; font-weight: 700; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.card-head .legend { margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .key-line { width: 14px; height: 3px; border-radius: 2px; }
.legend .key-box { width: 10px; height: 10px; border-radius: 3px; }
/* Tooltip padrão: o mesmo visual nos gráficos (.tt) e nas dicas de qualquer elemento (.dica, ver dicas.js). */
.tt, .dica {
  pointer-events: none; z-index: 200;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12.5px; line-height: 1.45;
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s;
}
.tt { position: absolute; min-width: min(190px, 100%); max-width: 100%; left: 0; top: 0; }
.tt:not(.on) { visibility: hidden; }
.tt.on, .dica.on { opacity: 1; transform: none; }
.tt-titulo { font-weight: 800; color: var(--text); padding-bottom: 7px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.tt-row { display: flex; align-items: center; gap: 14px; justify-content: space-between; margin-top: 4px; }
.tt-row .k { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 600; }
.tt-row .k i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.tt-row .k i.box { height: 9px; width: 9px; border-radius: 3px; }
.tt-row b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tt-row:not(.resumo) + .tt-row.resumo { border-top: 1px solid var(--line-soft); padding-top: 6px; margin-top: 6px; }
.dica { position: fixed; max-width: min(320px, calc(100vw - 24px)); font-weight: 600; }
.nota { font-size: var(--fs-sm); color: var(--muted); margin-top: 12px; }
.nota b { color: var(--text); }

/* ---------- Métricas em linha (dentro de um cartão, sem caixas) ---------- */
.metricas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--e3); padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.metricas span { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.metricas b { display: block; font-size: var(--fs-md); font-weight: 800; margin-top: 2px; white-space: nowrap; }
.subtitulo { font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 20px 0 6px; }
.campo-rotulo { font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); }
.dot-g { width: 10px; height: 10px; }
.col-barra { width: 22%; }
details.historico summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.historico summary::-webkit-details-marker { display: none; }
details.historico summary::before { content: "›"; display: inline-block; transition: transform 0.15s var(--ease); font-size: 15px; line-height: 1; }
details.historico[open] summary::before { transform: rotate(90deg); }
details.historico .tabela-wrap { margin: 8px -20px -4px; }

/* ---------- Linha do tempo (alívio) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .quando { font-weight: 800; }
.timeline .oque { color: var(--text-2); font-size: var(--fs); }
.timeline .oque small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.timeline .quanto { font-weight: 800; color: var(--ok); white-space: nowrap; }

/* ---------- Modal / Sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(6, 16, 26, 0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; animation: fade 0.12s ease-out;
}
.sheet {
  width: min(560px, 100%); max-height: min(780px, calc(100vh - 40px)); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: subir 0.18s var(--ease);
}
.sheet.sheet-sm { width: min(420px, 100%); }
.sheet-head { display: flex; align-items: center; gap: 6px; min-height: 60px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--line); }
.sheet-head .icon-btn:not([hidden]):first-child { margin-left: -10px; }
.sheet-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 800; letter-spacing: -0.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { padding: 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sheet-foot .esq { margin-right: auto; }
.sheet-msg { margin: 0; font-size: var(--fs-md); line-height: 1.5; color: var(--text-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(12px); opacity: 0; } }

/* align-content: start — lado a lado (.campos-2), o campo mais baixo não estica as linhas do vizinho. */
.campo { display: grid; gap: 6px; margin-bottom: 16px; align-content: start; }
.campo label, .campo .lbl { font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); }
.campo .ajuda { font-size: var(--fs-sm); color: var(--muted); }
.campo .input, .campo .select { height: 42px; width: 100%; }
.campos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.sheet .subtitulo:first-child { margin-top: 0; }

/* Opção ligar/desligar em cartão (substitui o checkbox solto nos formulários). */
.alternar-lista { display: grid; gap: 8px; margin-bottom: 16px; }
.alternar {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.campo .alternar { font-weight: 400; font-size: var(--fs); color: var(--text); }
.alternar:hover { border-color: var(--line-strong); background: var(--surface-2); }
.alternar:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.alternar input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--blue); cursor: pointer; }
.alternar .t { display: block; font-weight: 700; line-height: 1.3; }
.alternar .s { display: block; font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.alternar-extra { padding: 12px 14px 2px; margin-top: -4px; border: 1px solid var(--blue); border-top: 0; border-radius: 0 0 12px 12px; background: var(--blue-soft); }
.alternar:has(+ .alternar-extra:not([hidden])) { border-radius: 12px 12px 0 0; }
.texto-intro { margin: 0 0 14px; color: var(--muted); }
.texto-intro b { color: var(--text); }

/* Lançamento em etapas */
.wiz-prog { display: flex; gap: 4px; padding: 0 20px; margin-top: 14px; }
.wiz-prog i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.wiz-prog i.on { background: var(--blue); }
.wiz-titulo { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.wiz-sub { color: var(--muted); margin: 0 0 18px; }
.wiz-passo { display: block; padding: 8px 20px 0; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.valor-grande { display: flex; align-items: baseline; gap: 8px; border-bottom: 2px solid var(--blue); 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; }
.opcoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opcoes.uma { grid-template-columns: minmax(0, 1fr); }
.opcao {
  display: flex; align-items: center; gap: 10px; text-align: left;
  min-height: 52px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
}
.opcao:hover { border-color: var(--line-strong); background: var(--surface-2); }
.opcao[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.opcao .t { font-weight: 700; display: block; line-height: 1.25; }
.opcao .s { font-size: var(--fs-sm); 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: var(--r-sm); border: 1px solid transparent; background: var(--surface-2);
}
.sugestao:hover, .sugestao.ativa { border-color: var(--blue); background: var(--blue-soft); }
.sugestao .s { font-size: var(--fs-sm); 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: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; }
.parcelas-row button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.revisao { border: 1px solid var(--line); 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(--line-soft); }
.revisao-row:last-child { border-bottom: 0; }
button.revisao-row.lista-item { display: flex; padding: 11px 14px; border-radius: 0; }
.revisao-row .k { color: var(--muted); font-size: var(--fs); }
.revisao-row .v { font-weight: 700; text-align: right; margin-left: auto; }
button.revisao-row::after { content: "›"; color: var(--soft); font-size: 18px; line-height: 1; margin-left: 2px; }
button.revisao-row:hover { background: var(--surface-2); }

/* ---------- Seletor de mês e data (substitui o calendário nativo) ---------- */
.seletor {
  position: fixed; z-index: 150; width: 280px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  animation: subir 0.14s var(--ease);
}
.seletor-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.seletor-topo strong { font-size: var(--fs); font-weight: 800; text-transform: capitalize; }
.seletor-grade { display: grid; gap: 4px; }
.seletor-grade.meses { grid-template-columns: repeat(4, 1fr); }
.seletor-grade.dias { grid-template-columns: repeat(7, 1fr); }
.seletor-grade .sem { text-align: center; font-size: 10.5px; font-weight: 800; color: var(--soft); padding: 4px 0; }
.seletor-grade button {
  height: 36px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
  font-weight: 700; font-size: var(--fs); color: var(--text);
}
.seletor-grade.dias button { height: 32px; font-size: var(--fs-sm); }
.seletor-grade button:hover { background: var(--blue-soft); }
.seletor-grade button.hoje { border-color: var(--line-strong); }
.seletor-grade button.sel { background: var(--blue); color: var(--on-blue); border-color: var(--blue); }
.seletor-pe { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.campo-data { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; cursor: pointer; }
.campo-data .icon { color: var(--muted); width: 16px; height: 16px; }
.campo-data-nativo { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.campo { position: relative; }

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

/* ---------- Navegação inferior (celular) ---------- */
.bottom-nav { display: none; }

/* ---------- Login / consentimento ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 24px; }
.login-card h1 { font-size: var(--fs-lg); font-weight: 800; margin: 18px 0 4px; letter-spacing: -0.02em; }
.login-card p { color: var(--muted); margin: 0 0 16px; }
.login-card form, .login-card [data-etapa] { display: block; }
.login-card [data-etapa][hidden] { display: none; }
.login-marca { width: 40px; height: 40px; font-size: 15px; border-radius: 11px; }
.input-pin { font-size: 22px !important; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
.link-sutil { border: 0; background: none; padding: 0; margin: -6px 0 12px; color: var(--blue); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.passos-2fa { margin: 0 0 14px; padding-left: 18px; color: var(--text-2); display: grid; gap: 6px; }
.qr-2fa { width: min(220px, 100%); margin: 0 auto 8px; padding: 8px; background: #fff; border-radius: 12px; }
.qr-2fa svg { display: block; width: 100%; height: auto; }
.chave-2fa { text-align: center; word-break: break-all; margin-bottom: 10px !important; }
.chave-2fa b { color: var(--text); font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.06em; }
.codigos-rec { list-style: none; margin: 0 0 12px; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px;
  background: var(--surface-2); border-radius: 12px; font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: 0.06em; text-align: center; }
.erro-msg { color: var(--bad); font-size: var(--fs); font-weight: 700; min-height: 18px; margin: 6px 0 10px; }

/* ---------- Carregando (esqueleto) ---------- */
.esqueleto { display: grid; gap: 14px; }
.esqueleto i { display: block; border-radius: var(--r); background: var(--surface); opacity: 0.7; animation: pulsar 1.2s ease-in-out infinite alternate; }
.esqueleto .e-titulo { height: 28px; width: 180px; border-radius: 8px; }
.esqueleto .e-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.esqueleto .e-kpis i { height: 132px; }
.esqueleto .e-grafico { height: 300px; }
@keyframes pulsar { to { opacity: 0.35; } }

/* ---------- Padrão do Painel de Estoque: tabela com cabeçalho que ordena e linha de total ---------- */
.tabela-wrap.rolavel { max-height: 640px; }
.tabela thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); height: 38px; }
.tabela th.ord { cursor: pointer; user-select: none; }
.tabela th.ord:hover { color: var(--text); }
.tabela th.ord::after { content: "↕"; margin-left: 5px; opacity: 0.35; font-size: 10px; }
.tabela th.ord[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--blue); }
.tabela th.ord[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--blue); }
.tabela th.ord:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: -3px; }
.tabela tfoot td {
  position: sticky; bottom: 0; z-index: 1; font-weight: 800; padding: 11px 12px;
  background: color-mix(in srgb, var(--blue) 10%, var(--surface)); border-top: 1px solid var(--line-strong);
}
.tabela tfoot td:first-child { text-transform: uppercase; letter-spacing: 0.08em; font-size: 10.5px; box-shadow: inset 3px 0 0 var(--blue); }
.nota-h2 { font-weight: 500; color: var(--muted); font-size: var(--fs-xs); margin-left: 6px; }
.meter.mini { width: 56px; margin-top: 4px; }

/* Grades que preenchem a linha (cartões alinhados) e colunas independentes */
.grade-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.grade-auto.grade-iguais > .card { height: 100%; }
.colunas-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.lateral-fixa { position: sticky; top: calc(var(--nav-h) + 12px); align-self: start; }
.lista-rolavel { max-height: 360px; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.grade-iguais > .card > .chart.preencher { flex: 1 1 auto; }

/* Fatura: composição em uma barra e grupos por tipo de cobrança */
.pilha { display: flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; margin-top: 14px; background: var(--surface-3); }
.pilha i { display: block; min-width: 4px; }
.grupos-fatura { margin-top: 6px; }
.grupos-fatura .dia-grupo:first-child { padding-top: 14px; }

/* Número em destaque com duas comparações (mês anterior e mesmo mês do ano anterior) */
.stat-linhas { display: grid; gap: 2px; margin-top: 2px; }
.stat-linha { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 8px; font-size: 11px; color: var(--muted); min-height: 20px; }
.stat-linha .quem { white-space: nowrap; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.delta.ok { background: var(--ok-bg); color: var(--ok); }
.delta.warn { background: var(--warn-bg); color: var(--warn); }
.delta .seta { font-size: 8px; }

/* Leitura do mês: frases geradas dos números, com ponto de tom */
.leitura { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.leitura li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-weight: 600; font-size: 12.5px; }
.leitura .ponto { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--soft); }
.leitura .ponto.ok { background: var(--ok); }
.leitura .ponto.warn { background: var(--warn-fill); }
.leitura .ponto.bad { background: var(--bad-fill); }

/* Mapa de calor: categoria × mês */
.mapa td.q { text-align: right; white-space: nowrap; font-weight: 600; }
.mapa td.q.alto { background: color-mix(in srgb, var(--warn-fill) 22%, transparent); }
.mapa td.q.muito-alto { background: color-mix(in srgb, var(--bad-fill) 22%, transparent); }
.mapa td.q.baixo { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.mapa td.q.zero { color: var(--soft); font-weight: 500; }
.mapa th.mes-atual, .mapa td.mes-atual { box-shadow: inset 2px 0 0 var(--blue), inset -2px 0 0 var(--blue); }

/* Ponte: da renda à sobra, barras divergentes a partir do eixo */
.ponte { display: grid; gap: 4px; }
.ponte-linha { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 96px; gap: 12px; align-items: center; padding: 5px 0; }
.ponte-linha .nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ponte-linha .valor { text-align: right; font-weight: 800; white-space: nowrap; }
.ponte-trilho { position: relative; height: 20px; border-radius: 6px; background: var(--surface-2); }
.ponte-eixo { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.ponte-barra { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; }
.ponte-barra.mais { left: 50%; background: var(--ok); }
.ponte-barra.menos { right: 50%; background: var(--warn-fill); }
.ponte-linha.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; }
.ponte-linha.total .nome, .ponte-linha.total .valor { font-weight: 800; }

/* Editor de reembolsos atrelados à compra / assinatura */
.reemb { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.reemb-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.reemb-topo .ajuda { display: block; font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.reemb-linha { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 96px 32px; gap: 8px; align-items: center; }
.reemb-linha .input, .reemb-linha .select { height: 38px; width: 100%; }
.reemb-dica { grid-column: 1 / -1; margin-top: -4px; }
.reemb-regras { grid-column: 1 / -1; display: grid; gap: 6px; justify-items: start; padding-left: 10px; border-left: 2px solid var(--line-soft); }
.reemb-regra { display: grid; grid-template-columns: auto minmax(0, 1fr) 96px 32px; gap: 8px; align-items: center; width: 100%; }
.reemb-regra .input { height: 36px; width: 100%; }

/* Tabela dentro do cartão: ferramentas do cabeçalho */
.card-head .ferramentas { display: flex; align-items: center; gap: 4px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .grade-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .grade-4, .esqueleto .e-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-3, .grade-2, .grade-main, .colunas-2 { grid-template-columns: minmax(0, 1fr); }
  .lateral-fixa { position: static; }
  .lista-2col { grid-template-columns: minmax(0, 1fr); }
  .lista-2col > .lista-item:nth-last-child(-n + 2):nth-child(odd) { border-bottom: 1px solid var(--line-soft); }
  .nav { display: none; }
  .so-desktop { display: none !important; }
  body { padding-bottom: calc(72px + 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(--line);
  }
  .bottom-nav a, .bottom-nav button.bn-item {
    display: grid; justify-items: center; gap: 2px; text-decoration: none; font-size: 10.5px; font-weight: 700;
    color: var(--soft); border: 0; background: none; padding: 6px 0;
  }
  .bottom-nav a[aria-current="page"] { color: var(--blue); }
  .bottom-nav .icon { width: 21px; height: 21px; }
  .bn-mais {
    justify-self: center; width: 52px; height: 52px; border-radius: 16px; border: 0;
    background: var(--blue); color: var(--on-blue); display: grid; place-items: center; margin-top: -18px;
    box-shadow: var(--shadow-lg);
  }
  .bn-mais .icon { width: 24px; height: 24px; stroke-width: 2.2; }
}
@media (max-width: 720px) {
  :root { --fs: 13.5px; --nav-h: 58px; }
  .topbar { gap: var(--e2); }
  .brand-nome { display: none; }
  .mes-switch .mes-label { min-width: 92px; }
  .page { padding-top: var(--e3); }
  .page-head h1 { font-size: var(--fs-lg); }
  .grade-4 { gap: 10px; }
  .stat { padding: 13px 14px 12px; }
  .stat-valor { font-size: 22px; }
  .stat-rotulo { letter-spacing: 0.05em; }
  .stat-rotulo::after { content: ""; flex-basis: 100%; order: 2; }
  .stat-rotulo .tag { margin-left: 0; order: 3; }
  .stat-spark { height: 32px; }
  .card { padding: 16px; }
  .card-flush > .card-head { padding: 14px 16px 0; }
  .tabela th:first-child, .tabela td:first-child { padding-left: 16px; }
  .tabela th:last-child, .tabela td:last-child { padding-right: 16px; }
  .input-busca { width: 100%; }
  .filtros .select { flex: 1; }
  .overlay { padding: 0; place-items: end stretch; }
  .sheet { width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 18px 18px 0 0; border-width: 1px 0 0; }
  .sheet.sheet-sm { width: 100%; }
  .sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto -4px; flex: none; }
  .sheet-body { padding: 18px 16px; }
  .sheet-head { padding-left: 16px; }
  .wiz-prog { padding: 0 16px; }
  .wiz-passo { padding: 8px 16px 0; }
  .sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .sheet-foot .btn { flex: 1; }
  .sheet-foot .esq { flex: 0 0 auto; }
  .opcoes { grid-template-columns: 1fr 1fr; }
  .opcoes.uma { grid-template-columns: minmax(0, 1fr); }
  .campos-2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tabela .ocultar-mobile { display: none; }
  .stat-linha .soft { display: none; }
  .ponte-linha { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 84px; gap: 8px; }
  .reemb-linha { grid-template-columns: minmax(0, 1fr) 100px 32px; }
  .reemb-linha [data-k="descricao"] { grid-column: 1 / -1; }
  .timeline li { grid-template-columns: 64px minmax(0, 1fr); }
  .timeline .quanto { grid-column: 2; }
  .toasts { bottom: 90px; }
  .secao { margin-top: var(--e5); }
}
/* iOS dá zoom ao focar campo com fonte < 16px e não volta: em tela de toque os campos ficam com 16px. */
@media (max-width: 720px), (pointer: coarse) {
  .input, .select, textarea, input:where(:not([type="checkbox"], [type="radio"], [type="range"])) { font-size: 16px; }
}
@media (min-width: 1081px) {
  .so-mobile { display: none !important; }
}

/* ---------- Demonstração (dados fictícios, somente leitura) ---------- */
.faixa-demo {
  background: var(--blue); color: var(--on-blue);
  text-align: center; font-size: var(--fs-sm); font-weight: 700;
  padding: 6px var(--pad-x); letter-spacing: 0.01em;
}
[data-demo] [data-lancar], [data-demo] .bn-mais,
[data-demo] [data-novo], [data-demo] [data-reaj], [data-demo] [data-enc], [data-demo] [data-edit],
[data-demo] [data-del-regra], [data-demo] [data-mov], [data-demo] [data-res-edit],
[data-demo] [data-acao="gasto"], [data-demo] [data-acao="renda"], [data-demo] [data-acao="lancar"], [data-demo] [data-acao="fonte"],
[data-demo] [data-acao="reserva"], [data-demo] [data-acao="aporte"], [data-demo] [data-acao="padrao"] { display: none !important; }
[data-demo] .bottom-nav { grid-template-columns: repeat(4, 1fr); }
[data-demo] .clicavel { cursor: default; }
.login-demo { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: var(--fs-sm); color: var(--muted); }
.login-demo b { color: var(--text); letter-spacing: 0.12em; }
