/* ============ MAXBOLSO - UI na roupagem MAXWORKS, acabamento Apple ============
   As cores e o ouro vêm do kit da marca (kit/maxworks-ui.css, carregado antes).
   A tipografia segue a régua da Apple (HIG): caixa normal no conteúdo, escala
   17/15/13, seções pequenas em versalete como no iOS, espaçamento em base 8,
   cantos grandes, material translúcido na barra e no menu, sombras suaves.
   A fonte é a Inter (SIL OFL); em aparelho Apple a pilha resolve para a fonte
   do próprio sistema. SF Pro não pode ser embutida (licença da Apple). */

/* A Inter NAO se declara aqui: ela ja vem embutida no kit da marca
   (kit/maxworks-ui.css, carregado antes deste arquivo). Ate 18/08/2026 a familia
   era entregue DUAS vezes - 96 KB de base64 no kit mais o woff2 deste projeto - e a
   face declarada aqui, por vir depois, cobria a do kit. Uma fonte, um lugar. */

/* ---------- tema claro (padrão) ---------- */
:root {
  --bg: #f5f5f7;            /* o cinza de fundo do site da Apple */
  --surface: #ffffff;
  --strip: #f0f0f2;
  --text: #1d1d1f;
  --text-soft: #6e6e73;
  --border: #e4e4e8;
  --line2: #ececf0;
  --primary: #1d1d1f;
  --primary-soft: #ececf0;
  --ouro: #c9a227;
  --ouro-texto: #7a5d10;
  --positivo: #1e7a43;
  --danger: #b23b34;
  --danger-soft: #f7e9e8;
  --warn-bg: #f6efdc;
  --warn-text: #8a5a00;
  --info-bg: #ececf0;
  --info-text: #6e6e73;
  --good-bg: #e7f1ea;
  --good-text: #1e7a43;
  --radius: 16px;
  --radius-m: 12px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .05);
  --vidro: rgba(255, 255, 255, .72);
  --curva: cubic-bezier(.4, 0, .2, 1);
  /* ---- gráficos: verde = entra, vermelho = sai ---- */
  --s1: #1e7a43;
  --s6: #b23b34;
  --chart-grid: #ececf0;
  --chart-axis: #e4e4e8;
  --chart-muted: #6e6e73;
}
/* ---------- tema escuro (níveis elevados, padrão iOS) ---------- */
:root[data-theme="dark"] {
  --bg: #121214;
  --surface: #1c1c1e;
  --strip: #17171a;
  --text: #ececef;
  --text-soft: #a1a1a8;
  --border: #2c2c2e;
  --line2: #242427;
  --primary: #ececef;
  --primary-soft: #242427;
  --ouro: #c9a227;
  --ouro-texto: #e8cc72;
  --positivo: #3fae72;
  --danger: #e0837b;
  --danger-soft: #2a1917;
  --warn-bg: #2a2115;
  --warn-text: #d9a44a;
  --info-bg: #242427;
  --info-text: #a1a1a8;
  --good-bg: #16281e;
  --good-text: #3fae72;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
  --vidro: rgba(22, 22, 24, .72);
  --s1: #3fae72;
  --s6: #e0837b;
  --chart-grid: #242427;
  --chart-axis: #2c2c2e;
  --chart-muted: #8b8a93;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #1c1c1e;
    --strip: #17171a;
    --text: #ececef;
    --text-soft: #a1a1a8;
    --border: #2c2c2e;
    --line2: #242427;
    --primary: #ececef;
    --primary-soft: #242427;
    --ouro: #c9a227;
    --ouro-texto: #e8cc72;
    --positivo: #3fae72;
    --danger: #e0837b;
    --danger-soft: #2a1917;
    --warn-bg: #2a2115;
    --warn-text: #d9a44a;
    --info-bg: #242427;
    --info-text: #a1a1a8;
    --good-bg: #16281e;
    --good-text: #3fae72;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
    --vidro: rgba(22, 22, 24, .72);
    --s1: #3fae72;
    --s6: #e0837b;
    --chart-grid: #242427;
    --chart-axis: #2c2c2e;
    --chart-muted: #8b8a93;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  /* A Inter vem PRIMEIRO, como manda o kit da marca. Ate 18/08/2026 o
     -apple-system abria a pilha, e no iPhone e no Mac do dono - o aparelho deste
     app - o texto saia em San Francisco: a casa embarcava 144 KB de Inter que
     nunca eram usados. Caixa do dono de 18/08/2026. */
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  text-transform: none;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; text-transform: none; letter-spacing: -0.01em; }
input, select, textarea {
  font-family: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 11px 13px; text-transform: none; letter-spacing: -0.01em;
}
/* --ouro-fundo e o token de FUNDO translucido (13% de opacidade): como outline de
   2px o anel praticamente sumia, e esta regra vence a do kit por especificidade
   (0,1,1 contra 0,1,0 do :focus-visible). O ouro cheio e o que o proprio kit usa. */
input:focus, select:focus { outline: 2px solid var(--ouro); outline-offset: 2px; border-color: var(--ouro); }

/* ---------- peças da marca MAXWORKS ---------- */
.mx-x-ouro { font-style: normal; }
.topbar .mx-tema {
  position: static; top: auto; right: auto; z-index: auto;
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
}
.topbar .mx-tema:hover { color: var(--ouro-texto); border-color: var(--ouro-borda); }
#rodape-marca .mx-assinatura { max-width: 880px; margin: 28px auto 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }

/* ---------- FOIL holográfico da marca ----------
   Técnica própria: arco-íris cônico + realce radial seguindo --mx/--my
   (ponteiro ou giroscópio), misturado por cima da peça escura da marca. */
.foil { position: relative; overflow: hidden; isolation: isolate; }
.foil::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .38), transparent 42%),
    conic-gradient(from calc(var(--mx, 50%) * 3.6deg) at var(--mx, 50%) var(--my, 50%),
      rgba(255, 60, 140, .22), rgba(255, 220, 60, .22), rgba(60, 255, 220, .22),
      rgba(70, 110, 255, .20), rgba(200, 60, 255, .20), rgba(255, 60, 140, .22));
  mix-blend-mode: color-dodge;
  opacity: .75;
  transition: opacity .35s var(--curva);
}
:root[data-theme="light"] .foil::after,
:root:not([data-theme="dark"]) .foil::after { mix-blend-mode: overlay; opacity: .6; }
.foil:hover::after { opacity: 1; }

/* ---------- ícones ---------- */
.ic { width: 18px; height: 18px; flex: none; }
.icf { display: inline-flex; align-items: center; justify-content: center; }
.icf svg { width: 100%; height: 100%; display: block; }
span.inline-ic { display: inline-flex; vertical-align: middle; }
.logo-banco { background: #fff; border-radius: 9px; padding: 5px; border: 1px solid var(--border); width: 38px; height: 38px; }

/* ---------- layout com sidebar ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 244px; flex: none;
  background: var(--vidro);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 16px 12px calc(14px + env(safe-area-inset-bottom));
  z-index: 40;
}
.brand { padding: 4px 6px 18px; }
.brand .mx-logo-nome { font-size: 16px; }
.nav-lateral { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-lateral button {
  display: flex; align-items: center; gap: 12px;
  border: none; background: none; cursor: pointer;
  padding: 10px 12px; border-radius: var(--radius-s);
  font-size: 15px; font-weight: 600;
  color: var(--text); text-align: left;
  transition: background .15s var(--curva);
}
.nav-lateral button .ic { width: 24px; height: 24px; }
.nav-lateral button:hover { background: var(--strip); }
.nav-lateral button.ativo {
  background: var(--ouro-fundo); color: var(--ouro-texto);
  font-weight: 700;
}
.overlay {
  display: none; position: fixed; inset: 0; z-index: 35;
  background: rgba(15, 20, 30, .45);
}

.conteudo { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- topbar (vidro, como o site da Apple) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--vidro);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  width: 36px; height: 36px; flex: none; cursor: pointer; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s var(--curva), color .15s var(--curva);
}
.icon-btn:hover { border-color: var(--ouro-borda); color: var(--ouro-texto); }
.icon-btn .ic { width: 17px; height: 17px; }
.btn-menu { display: none; }
.titulo-tela { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.mes-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.mes-nav span { min-width: 148px; text-align: center; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.badge {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--text); white-space: nowrap;
}
.badge.gravado { background: var(--good-bg); color: var(--good-text); }

/* ---------- telas / painéis ---------- */
main { max-width: 880px; width: 100%; margin: 0 auto; padding: 20px 18px; }
.tela > * + * { margin-top: 16px; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; overflow: hidden;
}
/* faixa de título: versalete pequeno, padrão das listas do iOS */
.panel > h2, .panel > .panel-head {
  margin: -18px -18px 14px; padding: 12px 18px;
  background: none; border-bottom: 1px solid var(--line2);
}
.panel > h2, .panel-head h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ouro-texto); display: flex; align-items: center; gap: 9px;
}
.panel > h2 .ic, .panel-head h2 .ic { width: 18px; height: 18px; color: var(--ouro-texto); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { margin: 0; padding: 0; background: none; border: none; }
.soft { color: var(--text-soft); font-size: 13px; font-weight: 400; margin-bottom: 12px; }
.opt { font-weight: 500; color: var(--text-soft); font-size: 12px; }
.analise-h { font-size: 13px; font-weight: 700; margin: 16px 0 8px; color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 18px;
}
.card .label { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.card .value {
  font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 3px;
  font-variant-numeric: tabular-nums; overflow-wrap: break-word;
}
.card .sub { font-size: 12px; font-weight: 500; color: var(--text-soft); margin-top: 2px; }
/* O cartão destaque é o ladrilho da marca: preto, fio de ouro, número em ouro. */
.card.destaque { background: var(--preto-marca); border-color: var(--ouro-borda); }
.card.destaque .label, .card.destaque .sub { color: #a6a5ae; opacity: 1; }
.card.destaque .value { color: var(--ouro-claro); }
.card .value.neg { color: var(--danger); }
/* saldo negativo na tabela do relatorio: o vermelho do mes ruim aparece em vez
   de virar R$ 0,00 (achado da onda 4) */
td.neg { color: var(--danger); }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 11px 14px; }
.stat .k { color: var(--text-soft); font-size: 12px; font-weight: 500; }
.stat .v { font-weight: 700; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v.ok { color: var(--positivo); }
.stat .v.ruim { color: var(--danger); }

/* ---------- listas ---------- */
.lista { list-style: none; }
.lista li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--line2);
}
.lista li:last-child { border-bottom: none; padding-bottom: 4px; }
.ico-cat {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ico-cat .ic { width: 24px; height: 24px; }
.lista .info { flex: 1; min-width: 0; }
.lista .info .nome { font-weight: 600; font-size: 15px; display: block; overflow-wrap: break-word; }
.lista .info .nome .selo { margin: 0 0 2px 8px; vertical-align: middle; }
.lista .info .det { font-size: 13px; font-weight: 400; color: var(--text-soft); margin-top: 1px; overflow-wrap: break-word; }
.lista .valor { font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lista .valor.renda { color: var(--positivo); }
.selo {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--strip); color: var(--text-soft);
  display: inline-flex; align-items: center; gap: 4px; border: none;
}
.selo.assin { background: var(--info-bg); color: var(--info-text); }
.selo.atraso { background: var(--danger-soft); color: var(--danger); }
.selo.pago { background: var(--good-bg); color: var(--good-text); }
.selo .ic { width: 13px; height: 13px; }
button.selo { cursor: pointer; }
.btn.pagar {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--positivo); border-color: var(--positivo); color: #fff; flex: none;
}
.btn.pagar:hover { opacity: .9; color: #fff; }
.btn.pagar .ic { width: 14px; height: 14px; }
.acoes { display: flex; gap: 2px; }
.acoes button {
  border: none; background: none; cursor: pointer;
  padding: 8px; border-radius: 999px; color: var(--text-soft);
  display: inline-flex;
}
.acoes button .ic { width: 16px; height: 16px; }
.acoes button:hover { background: var(--primary-soft); color: var(--primary); }

/* empty state convidativo */
.vazio {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-soft); font-size: 14px; font-weight: 500; text-align: center;
  padding: 26px 16px; background: var(--strip); border-radius: var(--radius-m);
}
.vazio .ic {
  width: 58px; height: 58px; padding: 13px; border-radius: 999px;
  background: var(--surface); color: var(--primary); box-sizing: border-box;
  box-shadow: var(--shadow);
}
.vazio .btn { margin-top: 2px; }

/* ---------- formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.form-grid label { font-size: 13px; font-weight: 600; color: var(--text-soft); display: block; }
.form-grid input, .form-grid select { width: 100%; margin-top: 6px; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 14px !important; color: var(--text) !important; font-weight: 500; }
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--ouro); }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: border-color .15s var(--curva), color .15s var(--curva), opacity .15s var(--curva), transform .15s var(--curva);
}
.btn:hover { border-color: var(--text-soft); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--preto-marca); border-color: var(--ouro-borda); color: var(--ouro-claro); }
.btn.primary:hover { opacity: 1; color: #f7e49a; border-color: var(--ouro); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.sal-resumo { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; font-size: 15px; }
.sal-resumo .linha { display: flex; justify-content: space-between; padding: 5px 0; font-variant-numeric: tabular-nums; gap: 12px; }
.sal-resumo .linha.total { font-weight: 700; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 11px; }
.sal-resumo .neg { color: var(--danger); }

/* ---------- barras ---------- */
.barra-wrap { margin-top: 12px; }
.barra { height: 8px; border-radius: 999px; background: var(--strip); overflow: hidden; }
.barra > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8a6a14, #d9b13c); transition: width .4s var(--curva); }
.barra > div.estouro { background: var(--danger); }
.barra-leg { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; color: var(--text-soft); margin-top: 6px; }

/* ---------- metas ---------- */
.meta-card {
  border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 15px 17px; margin-bottom: 10px; background: var(--surface);
}
.meta-card .meta-head { display: flex; align-items: center; gap: 12px; }
.meta-card .meta-head .ico-cat { width: 40px; height: 40px; }
.meta-card h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-card .meta-sub { font-size: 13px; font-weight: 400; color: var(--text-soft); margin-top: 1px; }
.meta-card.reserva { border-left: 4px solid var(--ouro); }

/* ---------- dicas ---------- */
.dica {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--radius-m);
  margin-bottom: 8px; font-size: 14px; font-weight: 500; background: var(--strip);
  line-height: 1.5;
}
.dica .d-ico { flex: none; display: inline-flex; margin-top: 1px; }
.dica .d-ico .ic { width: 20px; height: 20px; }
.dica .d-corpo { flex: 1; min-width: 0; }
.dica.critical { background: var(--danger-soft); color: var(--danger); }
.dica.warning  { background: var(--warn-bg); color: var(--warn-text); }
.dica.good     { background: var(--good-bg); color: var(--good-text); }
.dica.info     { background: var(--info-bg); color: var(--info-text); }

/* ---------- orçamentos ---------- */
.orc-item { margin-bottom: 12px; }
.orc-item:last-child { margin-bottom: 0; }
.orc-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; margin-bottom: 5px; gap: 10px; }
.orc-top .rotulo { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.orc-top .rotulo .ic { width: 17px; height: 17px; color: var(--text-soft); }

/* ---------- gravar ---------- */
.gravar-area { text-align: center; padding: 6px 0 2px; }
.btn-gravar {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--preto-marca); color: var(--ouro-claro); border: 1px solid var(--ouro-borda); cursor: pointer;
  font-size: 16px; font-weight: 700; padding: 15px 36px; border-radius: 999px;
  transition: transform .15s var(--curva);
}
.btn-gravar:hover { color: #f7e49a; border-color: var(--ouro); }
.btn-gravar:active { transform: scale(.97); }
.btn-gravar .ic { width: 19px; height: 19px; }
.btn-gravar.reabrir { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-gravar.reabrir:hover { border-color: var(--text-soft); color: var(--text); opacity: 1; }

/* ---------- categorias (chips) ---------- */
.cat-grupo { margin-bottom: 16px; }
.cat-grupo:last-child { margin-bottom: 0; }
.cat-grupo h3 {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-soft);
  display: flex; align-items: center; gap: 8px; margin-bottom: 9px;
}
.cat-grupo h3 .ic { width: 16px; height: 16px; color: var(--text-soft); }
.cat-grupo h3 .contagem {
  background: var(--strip); border-radius: 999px; padding: 1px 8px; font-size: 11px; letter-spacing: 0;
}
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 46px;
  border: 1px solid var(--border); border-radius: var(--radius-m);
  padding: 10px 13px; background: var(--surface); cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text); text-align: left;
  transition: border-color .15s var(--curva), background .15s var(--curva), transform .15s var(--curva);
}
.chip .ic { width: 22px; height: 22px; color: var(--primary); }
.chip .chip-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.chip:active { transform: scale(.98); }
.chip .selo { flex: none; }

/* ---------- contas e cartões ---------- */
.contas-grid .chip.conta-card { min-height: 62px; }
.conta-card .conta-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.conta-card .conta-info .chip-nome { width: 100%; }
.conta-card .conta-info .det { font-size: 12px; color: var(--text-soft); font-weight: 400; white-space: normal; }
.conta-card .conta-saldo { font-size: 17px; font-weight: 700; color: var(--positivo); font-variant-numeric: tabular-nums; overflow-wrap: break-word; }

/* ---------- onboarding ---------- */
.onboarding .passo {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 2px; border-bottom: 1px solid var(--line2);
  font-size: 15px; font-weight: 600;
}
.onboarding .passo:last-child { border-bottom: none; padding-bottom: 2px; }
.onboarding .passo .p-ico { display: inline-flex; color: var(--text-soft); }
.onboarding .passo.feito .p-ico { color: var(--positivo); }
.onboarding .passo.feito .p-txt { text-decoration: line-through; opacity: .55; }
.onboarding .passo .p-txt { flex: 1; min-width: 0; }

/* ---------- dialogs ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text);
  margin: auto; /* o reset geral zera a margem: sem isto a janela cola no canto */
  width: min(500px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  text-transform: none;
}
dialog::backdrop { background: rgba(15, 20, 30, .4); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog form { padding: 18px; }
dialog h3 {
  margin: -18px -18px 16px; padding: 13px 18px;
  background: none; border-bottom: 1px solid var(--line2);
  font-size: 15px; font-weight: 700; color: var(--text);
}
dialog .btn-row { justify-content: flex-end; margin-top: 18px; }
dialog .btn-row .btn.danger { margin-right: auto; }
.icone-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.icone-grid button {
  width: 40px; height: 40px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.icone-grid button .ic { width: 20px; height: 20px; }
.icone-grid button.sel { border-color: var(--ouro); background: var(--ouro-fundo); color: var(--primary); }

/* ---------- charts ---------- */
.chart-box { width: 100%; overflow-x: auto; }
.chart-box svg { display: block; }
.chart-legend { display: flex; align-items: center; gap: 16px; font-size: 13px; font-weight: 500; color: var(--text-soft); margin: 10px 2px 0; }
.chart-legend span { display: inline-flex; align-items: center; }
.chart-legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px;
}
.chart-legend .lg-renda::before { background: var(--s1); }
.chart-legend .lg-custos::before { background: var(--s6); }
.chart-tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 600; padding: 8px 12px; border-radius: var(--radius-s);
  max-width: 260px; white-space: pre-line; text-transform: none;
}
.catbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.catbar-row .cb-label { width: 40%; min-width: 150px; display: inline-flex; gap: 8px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.catbar-row .cb-label .ic { width: 17px; height: 17px; color: var(--text-soft); }
.catbar-row .cb-bar { flex: 1; height: 14px; position: relative; }
.catbar-row .cb-bar > div { height: 100%; border-radius: 0 5px 5px 0; background: var(--primary); min-width: 2px; }
.catbar-row .cb-val { width: 100px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- A PLANILHA DA CASA (decisao 29; numeros selados em
   marca/PADRAO-HARMONIA.md, item 10) ----------
   Linha de 32px cravados em TODA linha, cabecalho incluido; colunas que comecam no
   mesmo x em toda linha; zebra alternada; cabecalho que gruda no topo; conteudo a
   vista, com corte por reticencias em vez de linha que cresce. */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-scroll { overflow-x: auto; overflow-y: auto; margin-top: 10px; }
th, td {
  height: 32px; padding: 0 10px; box-sizing: border-box;
  text-align: right; border-bottom: 1px solid var(--line2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
th:first-child, td:first-child { text-align: left; max-width: 42ch; }
/* zebra: a linha par ganha a faixa, e o cabecalho e o rodape mandam por cima */
tbody tr:nth-child(even) td { background: var(--strip); }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--strip); font-size: 12px; font-weight: 600; color: var(--text-soft);
  box-shadow: inset 0 -1px 0 var(--border);
}
tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; background: var(--strip); }
tfoot { position: sticky; bottom: 0; }

details.como-funciona { margin-top: 14px; font-size: 14px; font-weight: 400; color: var(--text-soft); }
details.como-funciona ol { padding-left: 18px; margin-top: 8px; }
details.como-funciona li { margin-bottom: 3px; }
details summary { cursor: pointer; font-weight: 600; color: var(--primary); font-size: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--text); color: var(--bg);
  padding: 11px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow);
}

/* ---------- responsivo: drawer no mobile ---------- */
@media (max-width: 899px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh;
    transform: translateX(-100%);
    transition: transform .25s var(--curva);
    box-shadow: 0 0 40px rgba(0, 0, 0, .3);
    background: var(--surface);
  }
  .sidebar.aberta { transform: translateX(0); }
  .overlay.visivel { display: block; }
  .btn-menu { display: inline-flex; }
  main { padding: 14px; }
  .tela > * + * { margin-top: 14px; }
  .mes-nav span { min-width: 106px; font-size: 14px; }
  .titulo-tela { display: none; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 10px; }
  .card .value { font-size: 22px; }
  .chips { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); }
}
/* telas de celular: a barra de cima cabe inteira, com o botão de tema no canto */
@media (max-width: 560px) {
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .icon-btn { width: 33px; height: 33px; }
  .mes-nav { gap: 2px; }
  .mes-nav span { min-width: 96px; font-size: 13px; }
  .badge { font-size: 11px; padding: 4px 9px; }
  /* a linha da lista quebra em duas: nome em cima, valor + Pagar embaixo */
  .lista li { gap: 8px; flex-wrap: wrap; row-gap: 4px; }
  .lista .info { flex: 1 1 calc(100% - 46px); }
  .lista .valor { margin-left: 46px; }
  .btn.pagar, button.selo.pago, .lista .acoes { margin-left: auto; }
  .ico-cat { width: 34px; height: 34px; border-radius: 10px; }
  .ico-cat .ic { width: 20px; height: 20px; }
  .acoes button { padding: 5px; }
  .btn.pagar { padding: 6px 11px; font-size: 12px; }
  .catbar-row .cb-label { min-width: 120px; }
  .panel > .panel-head { flex-wrap: wrap; }
  .panel-head h2 { white-space: nowrap; }
  /* painel mais justo: cada pixel a mais vira nome inteiro na lista */
  .panel { padding: 13px; }
  .panel > h2, .panel > .panel-head { margin: -13px -13px 12px; padding: 11px 13px; }
}
