/* Nvense-IQ Mobile — layout: barra superior azul, menu lateral, cartões brancos.
   Mobile-first (uso principal em smartphone), sem fontes externas (CSP). */
:root {
  --barra: #1e3a8a;
  --primaria: #1d4ed8;
  --primaria-escura: #1e40af;
  --primaria-clara: #eff6ff;
  --fundo: #f3f4f6;
  --superficie: #ffffff;
  --texto: #111827;
  --suave: #4b5563;
  --borda: #e5e7eb;
  --grade-cor: #eef0f3;
  --eixo: #d1d5db;
  --ok: #15803d;
  --ok-fundo: #dcfce7;
  --alerta: #b45309;
  --alerta-fundo: #fef3c7;
  --erro: #b91c1c;
  --erro-fundo: #fee2e2;
  /* Séries (paleta validada: legenda + rótulos + tabela compensam o azul-claro) */
  --c1: #1d4ed8; --c2: #d97706; --c3: #38bdf8; --c4: #b91c1c; --c5: #7c3aed; --c6: #0891b2; --c7: #65a30d;
  --raio: 12px;
  --barra-h: 56px;
  --menu-w: 272px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto);
  background: var(--fundo);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--fundo); line-height: 1.45; font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primaria); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem; z-index: 99; }
.skip:focus { left: .5rem; }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.carregando { padding: 3rem 1rem; text-align: center; color: var(--suave); }
.nota { color: var(--suave); font-size: .875rem; margin: .25rem 0; }
.erro { color: var(--erro); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oculto, [hidden] { display: none !important; }  /* o atributo hidden não pode perder para .campo { display: flex } */

/* ---------- Marca Nvense-IQ Mobile (substitui o ícone) ---------- */
.marca-nvense { display: inline-flex; align-items: baseline; gap: .3rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.marca-nvense .nv { color: var(--barra); }
.marca-nvense .iq { color: var(--primaria); background: var(--primaria-clara); border-radius: 6px; padding: 0 .3rem; }
.marca-nvense .mob { font-weight: 600; color: var(--suave); font-size: .8em; text-transform: uppercase; letter-spacing: .08em; }
.marca-nvense.grande { font-size: 2rem; }
.marca-nvense.clara .nv, .marca-nvense.clara .mob { color: #fff; }
.marca-nvense.clara .iq { background: rgba(255,255,255,.16); color: #fff; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .5rem 1rem;
  border-radius: 8px; border: 1px solid var(--primaria); background: var(--superficie); color: var(--primaria);
  font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primaria-clara); }
.btn.primario { background: var(--primaria); color: #fff; }
.btn.primario:hover { background: var(--primaria-escura); }
.btn.perigo { border-color: var(--erro); color: var(--erro); }
.btn.perigo:hover { background: var(--erro-fundo); }
.btn.largo { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-link { background: none; border: 0; color: var(--primaria); font-weight: 600; cursor: pointer; padding: .35rem .25rem; min-height: 36px; text-decoration: none; }
.btn-link.perigo { color: var(--erro); }
.btn-icone { background: none; border: 0; color: inherit; width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 8px; cursor: pointer; }
.btn-icone:hover { background: rgba(255,255,255,.12); }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.campo label { font-weight: 600; font-size: .875rem; }
.campo input, .campo select, .campo textarea { min-height: 44px; padding: .55rem .7rem; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; width: 100%; }
.campo textarea { min-height: 120px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--primaria); outline: 2px solid #bfdbfe; }
.ajuda { color: var(--suave); font-size: .8rem; }
.erro-campo { color: var(--erro); font-size: .8rem; min-height: 0; }
.grade-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 1rem; align-items: start; }
.grade-campos .largo-total { grid-column: 1 / -1; }
.barra-acoes { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filtros { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.filtros .campo { margin-bottom: 0; flex: 1 1 130px; max-width: 220px; }
.inline-cnpj { display: flex; gap: .5rem; align-items: flex-end; }
.inline-cnpj .campo { flex: 1; }
.inline-cnpj .btn { margin-bottom: .9rem; }

/* ---------- Login ---------- */
.tela-login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--barra) 0, var(--barra) 38%, var(--fundo) 38%); }
.tela-login .topo-login { text-align: center; color: #fff; margin-bottom: 1.25rem; }
.tela-login .topo-login p { margin: .35rem 0 0; opacity: .85; }
.cartao-login { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 1.5rem; box-shadow: 0 10px 30px rgba(17,24,39,.12); }
.cartao-login h1 { font-size: 1.2rem; }
.condominio-frente { text-align: center; padding: .75rem; margin-bottom: 1rem; border-radius: 10px; background: var(--primaria-clara); }
.condominio-frente small { display: block; color: var(--suave); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.condominio-frente strong { color: var(--barra); font-size: 1.1rem; text-transform: uppercase; }
.doc-confirmado { font-weight: 600; color: var(--suave); margin: 0 0 .75rem; }
.rodape-login { color: var(--suave); font-size: .8rem; margin-top: 1rem; text-align: center; }
.mostrar-senha { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; margin: -.4rem 0 .6rem; font-size: .9rem; cursor: pointer; }
.mostrar-senha input { width: 20px; height: 20px; }
.regras-senha { margin: -.4rem 0 .9rem; padding-left: 1.1rem; color: var(--suave); font-size: .8rem; }
.regras-senha li.ok { color: var(--ok); }
.regras-senha li.ok::marker { content: "✓ "; }

/* ---------- Shell: barra superior + menu lateral ---------- */
.shell { min-height: 100dvh; }
.barra-topo { position: sticky; top: 0; z-index: 20; height: calc(var(--barra-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  background: var(--barra); color: #fff; display: flex; align-items: center; gap: .25rem; padding-left: max(.25rem, env(safe-area-inset-left)); padding-right: .75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.barra-topo .titulo-cond { font-weight: 800; text-transform: uppercase; letter-spacing: .02em; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.barra-topo .sino { position: relative; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--c4); color: #fff; font-size: .72rem; font-weight: 700; }
.barra-topo .sino .badge { position: absolute; top: 4px; right: 2px; }
.menu-lateral { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(86vw, var(--menu-w)); background: #fff; border-right: 1px solid var(--borda);
  transform: translateX(-102%); transition: transform .2s ease; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.menu-lateral.aberto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
.veu { position: fixed; inset: 0; z-index: 30; background: rgba(17,24,39,.45); }
.menu-topo { padding: 1rem 1rem .75rem; border-bottom: 1px solid var(--borda); }
.menu-topo .usuario { margin-top: .5rem; font-size: .85rem; color: var(--suave); }
.menu-topo .usuario strong { display: block; color: var(--texto); }
.menu-lateral nav { overflow-y: auto; flex: 1; padding: .5rem 0 1rem; }
.menu-secao { padding: .9rem 1.25rem .35rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: #6b7280; text-transform: uppercase; }
.menu-item { display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: .55rem 1.25rem; color: var(--texto); text-decoration: none; border-left: 3px solid transparent; }
.menu-item:hover { background: #f9fafb; }
.menu-item[aria-current="page"] { background: var(--primaria-clara); color: var(--barra); font-weight: 700; border-left-color: var(--primaria); }
.menu-item .badge { margin-left: auto; }
.menu-item.btn-link { font-weight: 400; width: 100%; text-align: left; font-size: inherit; border-radius: 0; }
.menu-item.sair { color: var(--erro); }
.menu-rodape { padding: .75rem 1.25rem; border-top: 1px solid var(--borda); font-size: .75rem; color: var(--suave); }
.conteudo { padding: 1rem max(1rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); max-width: 1280px; margin: 0 auto; }
.rodape-app { text-align: center; padding: 1rem 0 0; color: var(--suave); font-size: .78rem; }
.rodape-app .marca-nvense { font-size: .9rem; }
@media (min-width: 1024px) {
  .menu-lateral { transform: none; top: var(--barra-h); box-shadow: none; padding-top: 0; }
  .menu-lateral .menu-topo { display: none; }
  .veu, .barra-topo .abrir-menu { display: none; }
  .conteudo { margin-left: var(--menu-w); padding: 1.5rem 2rem 2rem; }
  .barra-topo { padding-left: 1.25rem; }
  .barra-topo .marca-nvense { margin-right: 1.5rem; }
}
@media (max-width: 1023px) { .barra-topo .marca-desktop { display: none; } }

/* ---------- Página ---------- */
.cabecalho-pagina { display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cabecalho-pagina h1 { margin: 0; }
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.cartao > h2 { font-size: 1rem; }
.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { min-width: 0; overflow-wrap: anywhere; background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; }
.kpi .rotulo { color: var(--suave); font-size: .85rem; }
.kpi .valor { font-size: 1.5rem; font-weight: 800; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.kpi .valor.neg { color: var(--erro); }
.kpi .detalhe { color: var(--suave); font-size: .8rem; }
.duas-colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 1rem; }

/* ---------- Tabelas ---------- */
.tabela-cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); margin-bottom: 1rem; min-width: 0; }
.tabela-cartao .tabela-topo { display: flex; justify-content: space-between; gap: .75rem; align-items: center; flex-wrap: wrap; padding: 1rem 1.1rem .5rem; }
.tabela-cartao h2 { margin: 0; font-size: 1rem; }
.busca { min-height: 40px; padding: .4rem .7rem; border: 1px solid #d1d5db; border-radius: 8px; width: min(100%, 240px); }
.tabela-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; font-weight: 700; padding: .6rem 1.1rem; border-bottom: 1px solid var(--borda); white-space: nowrap; }
td { padding: .7rem 1.1rem; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th.num { text-align: right; }
.tabela-vazia { padding: 1.25rem 1.1rem; color: var(--suave); }
.acoes-linha { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }

.selo { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.selo-pago, .selo-publicado, .selo-ativo { background: var(--ok-fundo); color: var(--ok); }
.selo-pendente, .selo-rascunho { background: var(--alerta-fundo); color: var(--alerta); }
.selo-vencido, .selo-erro, .selo-inativo { background: var(--erro-fundo); color: var(--erro); }
.selo-cancelado, .selo-vazio { background: #f3f4f6; color: var(--suave); }
.selo-fixa { background: #dbeafe; color: var(--barra); }
.selo-variavel { background: #fef3c7; color: #92400e; }
.selo-sazonal { background: #ede9fe; color: #5b21b6; }

/* ---------- Comunicados / boletos ---------- */
.lista-cartoes { display: grid; gap: .75rem; }
.comunicado { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; }
.comunicado.nao-lido { border-left: 4px solid var(--primaria); }
.comunicado header { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.comunicado h3 { margin: 0; }
.comunicado .corpo { white-space: pre-wrap; margin: .5rem 0 .25rem; }
.boleto { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; }
.boleto .topo-boleto { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.boleto .valor { font-size: 1.4rem; font-weight: 800; margin: .25rem 0; }
.codigo { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; word-break: break-all; background: #f9fafb; border: 1px solid var(--borda); border-radius: 8px; padding: .5rem; margin: .5rem 0; }
.segmentos { display: inline-flex; border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; background: #fff; }
.segmentos button { border: 0; background: none; padding: .45rem .8rem; min-height: 40px; cursor: pointer; font-weight: 600; color: var(--suave); }
.segmentos button[aria-pressed="true"] { background: var(--primaria); color: #fff; }

/* ---------- Importar extrato ---------- */
.mov-extrato { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); padding: .85rem 1rem; }
.mov-topo { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.mov-check { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.mov-check input { width: 20px; height: 20px; }
.mov-valor { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.mov-valor.neg { color: var(--erro); }
.mov-desc { margin: .15rem 0 .35rem; overflow-wrap: anywhere; }
.mov-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: .5rem; margin-top: .5rem; }
.mov-campos label { display: flex; flex-direction: column; gap: .2rem; font-size: .78rem; font-weight: 600; color: var(--suave); }
.mov-campos input, .mov-campos select { min-height: 42px; padding: .4rem .55rem; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; font-size: .95rem; color: var(--texto); }
.mov-campos :disabled { background: #f3f4f6; color: #9ca3af; }
.lista-movs { margin-top: .75rem; }
.matriz td:first-child, .matriz th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.matriz .grupo td { background: #f9fafb; font-weight: 700; }
.matriz .total td { font-weight: 700; border-top: 1px solid var(--borda); }
.matriz th.previsto, .matriz td.previsto { background: #f8fafc; color: #334155; font-style: italic; }
.matriz .neg { color: var(--erro); }

/* ---------- Diálogo, toast ---------- */
dialog.dialogo { border: 0; border-radius: 14px; padding: 1.25rem; width: min(560px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog.dialogo::backdrop { background: rgba(17,24,39,.5); }
dialog.dialogo h2 { margin-top: 0; }
dialog.dialogo .rodape-dialogo { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.lista-dados { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.lista-dados dt { color: var(--suave); }
.lista-dados dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.senha-exibida { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; font-weight: 700; letter-spacing: .08em; background: var(--primaria-clara); padding: .75rem; border-radius: 8px; text-align: center; }
#toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(150%); background: var(--texto); color: #fff;
  padding: .75rem 1rem; border-radius: 10px; max-width: calc(100vw - 2rem); z-index: 100; transition: transform .2s; }
#toast:not(.visivel) { visibility: hidden; transition: transform .2s, visibility 0s .2s; }
#toast.visivel { transform: translateX(-50%); }
#toast.toast-erro { background: var(--erro); } #toast.toast-ok { background: var(--ok); }
.instalar { display: flex; gap: .75rem; align-items: center; justify-content: space-between; background: var(--primaria-clara); border: 1px solid #bfdbfe; border-radius: var(--raio); padding: .75rem 1rem; margin-bottom: 1rem; }

/* ---------- Gráficos (SVG) ---------- */
.grafico { margin: 0 0 1rem; background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; min-width: 0; }
.grafico figcaption h3 { margin: 0; font-size: 1rem; }
.grafico figcaption .nota { margin: .15rem 0 .5rem; font-size: .8rem; }
.grafico-area { position: relative; width: 100%; min-height: 60px; }
.grafico-area svg { display: block; overflow: visible; }
.grafico .vazio { padding: 2rem 0; text-align: center; }
.legenda { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 1rem; padding: 0; margin: 0 0 .5rem; font-size: .82rem; color: var(--texto); }
.legenda li { display: inline-flex; align-items: center; gap: .4rem; }
.legenda .pct { color: var(--suave); }
.chip { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.chip.tracejado { height: 0; border-top: 2px dashed var(--c1); border-radius: 0; width: 16px; }
.chip.s1, .chip.c1 { background: var(--c1); } .chip.s2, .chip.c2 { background: var(--c2); } .chip.c3 { background: var(--c3); }
.chip.c4 { background: var(--c4); } .chip.c5 { background: var(--c5); } .chip.c6 { background: var(--c6); } .chip.c7 { background: var(--c7); }
path.s1, circle.s1, path.c1 { fill: var(--c1); } path.s2, circle.s2, path.c2 { fill: var(--c2); } path.c3 { fill: var(--c3); }
path.c4 { fill: var(--c4); } path.c5 { fill: var(--c5); } path.c6 { fill: var(--c6); } path.c7 { fill: var(--c7); }
path.fatia { stroke: var(--superficie); stroke-width: 2; }
path.linha { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
path.linha.s1 { stroke: var(--c1); } path.linha.s2 { stroke: var(--c2); }
path.linha.tracejada { stroke-dasharray: 6 4; }
circle.ponto { stroke: var(--superficie); stroke-width: 2; }
circle.ponto.vazado { fill: var(--superficie); stroke: var(--c1); }
path.s1.projetado, path.s2.projetado { opacity: .45; }
.grade-linha { stroke: var(--grade-cor); stroke-width: 1; }
.linha-base { stroke: var(--eixo); stroke-width: 1; }
.cruz { stroke: var(--suave); stroke-width: 1; stroke-dasharray: 3 3; }
.eixo-rotulo { fill: var(--suave); font-size: 11px; }
.valor-rotulo { fill: var(--texto); font-size: 11px; font-weight: 600; }
.centro-total { fill: var(--texto); font-size: 15px; font-weight: 800; }
.centro-rotulo { fill: var(--suave); font-size: 11px; }
.alvo { fill: transparent; cursor: pointer; }
.grafico-tooltip { position: absolute; transform: translate(-50%, calc(-100% - 8px)); background: var(--texto); color: #fff; padding: .45rem .6rem;
  border-radius: 8px; font-size: .8rem; pointer-events: none; white-space: nowrap; z-index: 5; }
.grafico-tooltip strong { display: block; margin-bottom: .15rem; }
.tabela-grafico { margin-top: .5rem; font-size: .85rem; }
.tabela-grafico summary { cursor: pointer; color: var(--primaria); font-weight: 600; }
.tabela-grafico table { margin-top: .5rem; }
.tabela-grafico th, .tabela-grafico td { padding: .4rem .5rem; }

/* ---------- Impressão (balancete do síndico) ---------- */
@media print {
  .barra-topo, .menu-lateral, .veu, .nao-imprimir, .rodape-app, #toast { display: none !important; }
  .conteudo { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .cartao, .tabela-cartao, .grafico { border-color: #999; break-inside: avoid; }
  body.sem-impressao #app { display: none !important; }
  body.sem-impressao::after { content: "Conteúdo disponível apenas para visualização no aplicativo Nvense-IQ Mobile."; display: block; padding: 2rem; font: 14px sans-serif; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (forced-colors: active) { .chip { forced-color-adjust: none; } }

/* ---------- Smartphone (vem por último para prevalecer) ---------- */
@media (max-width: 599px) {
  .cartoes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { padding: .75rem .8rem; }
  .kpi .valor { font-size: 1.1rem; }
  .kpi .rotulo, .kpi .detalhe { font-size: .75rem; }
  th { padding: .5rem .6rem; }
  td { padding: .55rem .6rem; white-space: nowrap; }
  .acoes-linha { flex-wrap: nowrap; }
  .tabela-wrap { scroll-snap-type: x proximity; }
  .tabela-cartao .tabela-topo { padding: .8rem .8rem .4rem; }
  .grafico, .cartao { padding: .85rem .8rem; }
  .conteudo { padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
}

/* Categorias de receita/despesa */
.categorias h3 { font-size: .95rem; margin: .25rem 0 .5rem; }
.lista-chips { list-style: none; padding: 0; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-cat { display: inline-flex; align-items: center; gap: .25rem; padding: .3rem .65rem; border-radius: 999px;
  background: #eef2f7; color: #334155; font-size: .85rem; border: 1px solid #e2e8f0; }
.chip-cat.propria { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; font-weight: 600; }
.chip-cat .remover { border: 0; background: transparent; color: #b91c1c; font-size: 1.1rem; line-height: 1;
  cursor: pointer; min-width: 28px; min-height: 28px; border-radius: 50%; }
.chip-cat .remover:hover, .chip-cat .remover:focus-visible { background: #fee2e2; }
.nova-categoria { display: flex; gap: .5rem; }
.nova-categoria input { flex: 1; min-width: 0; padding: .6rem .75rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }

/* Captcha e verificação em duas etapas */
.slot-captcha:not(:empty) { margin: .5rem 0 1rem; min-height: 65px; }
.passos-2fa { padding-left: 1.2rem; margin: 0 0 1rem; display: grid; gap: .35rem; }
.chave-2fa { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0; }
.chave-2fa code { font-size: 1.05rem; letter-spacing: .05em; background: #eef2f7; padding: .5rem .75rem; border-radius: 8px; word-break: break-all; }

/* ---------- Página de erro amigável ---------- */
.pagina-erro { max-width: 460px; margin: 2rem auto; padding: 2rem 1.25rem; text-align: center; background: var(--superficie);
  border: 1px solid var(--borda); border-radius: var(--raio); }
.pagina-erro h1 { font-size: 1.3rem; margin: .75rem 0 .5rem; outline: none; }
.erro-texto { color: var(--suave); margin: 0 auto 1.5rem; max-width: 36ch; }
.erro-ilustracao { display: inline-grid; place-items: center; width: 96px; height: 96px; border-radius: 50%;
  background: var(--primaria-clara); color: var(--primaria); }
.erro-servidor .erro-ilustracao, .erro-generico .erro-ilustracao { background: var(--alerta-fundo); color: var(--alerta); }
.erro-sem-permissao .erro-ilustracao { background: var(--erro-fundo); color: var(--erro); }
.erro-offline .erro-ilustracao { background: var(--fundo); color: var(--suave); }
.erro-acoes { display: flex; flex-direction: column; gap: .6rem; }
.erro-acoes .btn { width: 100%; }
.erro-ref { margin: 1.25rem 0 0; font-size: .8rem; color: var(--suave); }
.erro-ref code { font-family: ui-monospace, Consolas, monospace; background: var(--fundo); padding: .1rem .35rem; border-radius: 4px;
  letter-spacing: .05em; user-select: all; }
.erro-cheia { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 1.5rem 1rem; outline: none; }
.erro-cheia .pagina-erro { margin: 1.25rem auto 0; width: 100%; }
@media (min-width: 520px) { .erro-acoes { flex-direction: row; justify-content: center; } .erro-acoes .btn { width: auto; min-width: 160px; } }

/* Antes do JavaScript: se o app não abrir em ~8 s, aparece uma dica (só CSS, sem script inline). */
.carregando .demorando { display: block; max-width: 34ch; margin: 1.25rem auto 0; font-size: .875rem; opacity: 0;
  animation: aparecer .4s ease 8s forwards; }
@keyframes aparecer { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .carregando .demorando { animation-duration: .01s; } }
