/* ============================================================
   FIN — visual
   Mobile primeiro. Verde-dinheiro, números grandes, cartões claros.
   ============================================================ */
:root {
  --verde: #0b7a4b;
  --verde-claro: #e3f3ea;
  --verde-escuro: #075c38;
  --vermelho: #c0392b;
  --vermelho-claro: #fdecea;
  --ambar: #b26a00;
  --ambar-claro: #fff4e0;
  --fundo: #f4f6f3;
  --cartao: #ffffff;
  --texto: #1d2a24;
  --suave: #5f6f67;
  --linha: #e1e7e3;
  --sombra: 0 1px 2px rgba(20, 40, 30, .06), 0 2px 8px rgba(20, 40, 30, .05);
  --raio: 14px;
  --barra: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --verde: #3fbf7f;
    --verde-claro: #143326;
    --verde-escuro: #7fe0ae;
    --vermelho: #ff7a6b;
    --vermelho-claro: #3a1d1a;
    --ambar: #ffb74d;
    --ambar-claro: #3a2c12;
    --fundo: #0f1512;
    --cartao: #18201c;
    --texto: #e6eee9;
    --suave: #9aaba2;
    --linha: #2a3530;
    --sombra: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  padding-bottom: calc(var(--barra) + env(safe-area-inset-bottom) + 16px);
}
a { color: var(--verde); }
h1 { font-size: 1.35rem; margin: .4rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.num, td, .valor { font-variant-numeric: tabular-nums; }

/* ---------- topo ---------- */
.barra-topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
  background: var(--cartao); border-bottom: 1px solid var(--linha);
}
.marca { display: flex; align-items: center; gap: .45rem; font-weight: 700; text-decoration: none; color: var(--texto); font-size: 1.1rem; }
.logo {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--verde); color: #fff; font-weight: 800; font-size: 1rem;
}
.sair { margin-left: auto; font-size: .85rem; color: var(--suave); text-decoration: none; }
.conteudo { max-width: 760px; margin: 0 auto; padding: 1rem; }

/* ---------- barra de abas ---------- */
.barra-abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--barra) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--cartao); border-top: 1px solid var(--linha);
}
.aba {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--suave); font-size: .72rem; font-weight: 600;
}
.aba .icone { font-size: 1.25rem; line-height: 1; }
.aba[data-destaque] .icone {
  display: grid; place-items: center; width: 40px; height: 40px; margin-top: -14px;
  border-radius: 50%; background: var(--verde); color: #fff; font-size: 1.6rem; box-shadow: var(--sombra);
}
body[data-aba="painel"] .aba-painel, body[data-aba="ano"] .aba-ano, body[data-aba="lancar"] .aba-lancar,
body[data-aba="cartoes"] .aba-cartoes, body[data-aba="contas"] .aba-contas { color: var(--verde); }

/* ---------- blocos ---------- */
.cartao, .cartao-form {
  background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra);
  border: 1px solid var(--linha); padding: 1rem; margin-bottom: 1rem;
}
.msg { padding: .7rem 1rem; border-radius: 10px; background: var(--verde-claro); color: var(--verde-escuro); margin: 0 0 1rem; }
.msg.erro { background: var(--vermelho-claro); color: var(--vermelho); }
.vazio { color: var(--suave); text-align: center; padding: 1rem 0; }
.suave { color: var(--suave); font-size: .85rem; }
.negativo { color: var(--vermelho); }
.positivo { color: var(--verde); }

/* ---------- seletor de mês ---------- */
.seletor-mes { display: flex; align-items: center; justify-content: space-between; margin: 0 0 1rem; }
.seletor-mes a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--cartao); border: 1px solid var(--linha); text-decoration: none; color: var(--texto);
}
.seletor-mes strong { font-size: 1.1rem; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.kpi { background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio); padding: .75rem .6rem; box-shadow: var(--sombra); }
.kpi .rotulo { font-size: .75rem; color: var(--suave); font-weight: 600; }
.kpi .valor { font-size: 1.05rem; font-weight: 750; display: block; margin: .15rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .pago { font-size: .7rem; color: var(--suave); }

/* ---------- listas ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: .6rem; padding: .65rem 0; border-bottom: 1px solid var(--linha); }
.lista li:last-child { border-bottom: 0; }
.lista .nome { flex: 1; min-width: 0; }
.lista .nome small { display: block; color: var(--suave); font-size: .8rem; }
.lista .valor { font-weight: 700; white-space: nowrap; }
.lista form { margin: 0; }
.selo { font-size: .7rem; font-weight: 700; padding: .15rem .45rem; border-radius: 99px; background: var(--verde-claro); color: var(--verde-escuro); }
.selo.atrasado { background: var(--vermelho-claro); color: var(--vermelho); }
.selo.previsto { background: var(--ambar-claro); color: var(--ambar); }

/* ---------- formulários ---------- */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--suave); margin-bottom: .75rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem; font: inherit; color: var(--texto);
  background: var(--fundo); border: 1px solid var(--linha); border-radius: 10px;
}
input:focus, select:focus { outline: 2px solid var(--verde); outline-offset: 0; }
.linha-campos { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1rem; font: inherit; font-weight: 650; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--linha); background: var(--cartao); color: var(--texto); text-decoration: none;
}
.botao.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.botao.perigo { color: var(--vermelho); }
.botao.pequeno { padding: .3rem .6rem; font-size: .8rem; }
.botao.grande { width: 100%; padding: .9rem; font-size: 1.05rem; }
.alternar { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.alternar input { display: none; }
.alternar label {
  margin: 0; text-align: center; padding: .85rem; border-radius: 12px; border: 2px solid var(--linha);
  background: var(--cartao); font-size: 1rem; color: var(--texto); cursor: pointer;
}
.alternar input:checked + label.saiu { border-color: var(--vermelho); background: var(--vermelho-claro); color: var(--vermelho); }
.alternar input:checked + label.entrou { border-color: var(--verde); background: var(--verde-claro); color: var(--verde-escuro); }
.valor-grande { font-size: 1.8rem !important; font-weight: 750; text-align: center; }
details.mais { margin-bottom: .75rem; }
details.mais summary { cursor: pointer; color: var(--verde); font-weight: 600; margin-bottom: .6rem; }

/* ---------- grade do ano ---------- */
.grade-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1rem; padding: 0 1rem; }
table.grade { border-collapse: separate; border-spacing: 0; font-size: .82rem; min-width: 100%; }
.grade th, .grade td { padding: .45rem .55rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--linha); background: var(--cartao); }
.grade th:first-child, .grade td:first-child {
  position: sticky; left: 0; z-index: 2; text-align: left; max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid var(--linha); font-weight: 600;
}
.grade thead th { position: sticky; top: 0; z-index: 3; color: var(--suave); font-size: .75rem; text-transform: uppercase; }
.grade thead th:first-child { z-index: 4; }
.grade tr.bloco td { background: var(--fundo); color: var(--suave); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.grade tr.total td { font-weight: 700; background: var(--verde-claro); }
.grade tr.rodape td { font-weight: 750; }
.grade td.atual, .grade th.atual { box-shadow: inset 2px 0 0 var(--verde), inset -2px 0 0 var(--verde); }
.grade td a { color: inherit; text-decoration: none; display: block; }
.grade td.pago a::after { content: " ✓"; color: var(--verde); font-size: .7rem; }
.grade td.vazio-c { color: var(--linha); }

/* ---------- gráficos ---------- */
.grafico svg { width: 100%; height: auto; display: block; }
.legenda { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .3rem; font-size: .85rem; }
.legenda li { display: flex; align-items: center; gap: .5rem; }
.legenda .cor { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legenda .valor { margin-left: auto; font-weight: 650; }

/* ---------- login ---------- */
.tela-login { padding-bottom: 0; }
.login { max-width: 380px; margin: 0 auto; padding: 3rem 1.25rem; }
.login-marca { text-align: center; margin-bottom: 1.5rem; }
.login-marca .logo { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 16px; }
.login-marca h1 { margin: .6rem 0 .2rem; }
.login-marca p { color: var(--suave); margin: 0; }

/* ---------- boas-vindas ---------- */
.atalhos { display: grid; gap: .6rem; }
.atalhos a { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; border-radius: 12px; background: var(--verde-claro); color: var(--verde-escuro); text-decoration: none; font-weight: 650; }

@media (min-width: 640px) {
  .kpi .valor { font-size: 1.35rem; }
  h1 { font-size: 1.6rem; }
}

/* ---------- cores das séries (validadas: dataviz validate_palette, claro e escuro) ---------- */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --linha-graf: #0b7a4b; }
@media (prefers-color-scheme: dark) {
  :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --linha-graf: #3fbf7f; }
}
.s1 { fill: var(--s1); stroke: var(--s1); background: var(--s1); }
.s2 { fill: var(--s2); stroke: var(--s2); background: var(--s2); }
.s3 { fill: var(--s3); stroke: var(--s3); background: var(--s3); }
.s4 { fill: var(--s4); stroke: var(--s4); background: var(--s4); }
.s5 { fill: var(--s5); stroke: var(--s5); background: var(--s5); }
.s6 { fill: var(--s6); stroke: var(--s6); background: var(--s6); }
svg .fatia { stroke: var(--cartao); stroke-width: 2; }
svg.rosca circle { fill: none; }
.grafico-rosca { display: grid; grid-template-columns: 130px 1fr; gap: 1rem; align-items: center; }
.grafico-rosca svg { width: 130px; }
.centro-rotulo { font-size: 10px; fill: var(--suave); }
.centro-valor { font-size: 13px; font-weight: 700; fill: var(--texto); }
svg.linha polyline { fill: none; stroke: var(--linha-graf); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.linha polyline.previsto { opacity: .55; }
svg.linha .zero { stroke: var(--vermelho); stroke-width: 1; stroke-dasharray: 2 3; opacity: .6; }
svg.linha .base { stroke: var(--linha); stroke-width: 1; }
svg.linha .ponto { fill: var(--linha-graf); stroke: var(--cartao); stroke-width: 2; }
svg.linha .ponto.futuro { fill: var(--cartao); stroke: var(--linha-graf); stroke-width: 1.5; }
svg.linha .ponto.neg { fill: var(--vermelho); }
svg.linha .ponto.futuro.neg { fill: var(--cartao); stroke: var(--vermelho); }
svg.linha .eixo { font-size: 10px; fill: var(--suave); }
svg.linha .rotulo { font-size: 11px; font-weight: 700; fill: var(--texto); }
svg .alvo:hover circle.ponto { r: 5; }
.atalhos a span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--verde); color: #fff; font-size: .85rem; flex: none; }

/* ---------- ajustes para 360px ---------- */
.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
.kpi { min-width: 0; padding: .65rem .5rem; }
.kpi .valor { font-size: .95rem; }
.kpi .pago { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grafico-rosca { grid-template-columns: 110px minmax(0, 1fr); gap: .75rem; }
.grafico-rosca svg { width: 110px; }
.legenda li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; column-gap: .45rem; row-gap: 0; }
.legenda li > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legenda li .suave { grid-column: 2; font-size: .75rem; }
.legenda li .valor { grid-column: 3; grid-row: 1; white-space: nowrap; margin-left: 0; }
@media (min-width: 640px) { .kpi .valor { font-size: 1.3rem; } }

/* ---------- painel direto ---------- */
.destaque { text-align: center; padding: 1.25rem 1rem; }
.rotulo-grande { display: block; font-size: .9rem; font-weight: 650; color: var(--suave); }
.numero-grande { display: block; font-size: 2.3rem; font-weight: 800; line-height: 1.15; margin: .2rem 0 .5rem; font-variant-numeric: tabular-nums; }
.numero-medio { display: block; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.entrou-saiu { display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap; color: var(--suave); font-size: .9rem; }
.entrou-saiu b { color: var(--texto); }
.contas-mes .marca, .lista .marca { width: 1.4rem; flex: none; text-align: center; font-weight: 800; color: var(--suave); }
.contas-mes li.paga .marca { color: var(--verde); }
.contas-mes li.paga .valor { color: var(--suave); font-weight: 600; }
.status-ok { margin: .75rem 0 0; padding: .6rem .8rem; border-radius: 10px; background: var(--verde-claro); color: var(--verde-escuro); font-weight: 650; text-align: center; }
.status-falta { margin: .75rem 0 0; padding: .6rem .8rem; border-radius: 10px; background: var(--ambar-claro); color: var(--ambar); text-align: center; }
.alerta { border-color: var(--vermelho); background: var(--vermelho-claro); }
.alerta summary { cursor: pointer; color: var(--vermelho); }
.alerta .lista { margin-top: .5rem; }
.dica { margin: .75rem 0 0; padding: .6rem .8rem; border-radius: 10px; background: var(--fundo); font-size: .88rem; }
details.cartao > summary { cursor: pointer; }

/* ---------- combinados ---------- */
.barra { display: block; height: 10px; border-radius: 99px; background: var(--linha); overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--verde); border-radius: 99px; }
.barra.fina { height: 6px; margin-top: .35rem; }
.resumo-comb li { padding: .4rem 0; }
.pagar-comb { margin-top: .75rem; }
.atalho-comb { display: block; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 12px; background: var(--cartao);
  border: 1px solid var(--linha); text-decoration: none; color: var(--texto); }
.falta-comb { font-weight: 800; }

/* ============ painel em cartões (v2) ============ */
.heroi {
  position: relative; overflow: hidden; text-align: center; color: #fff;
  padding: 1.5rem 1.25rem 1.25rem; margin-bottom: 1.1rem; border-radius: 22px;
  background: radial-gradient(120% 140% at 0% 0%, #19a565 0%, #0b7a4b 55%, #075c38 100%);
  box-shadow: 0 10px 30px rgba(11, 122, 75, .28);
}
.heroi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.08); }
.heroi-neg { background: radial-gradient(120% 140% at 0% 0%, #e0644f 0%, #b83a2a 60%, #8e2a1e 100%); box-shadow: 0 10px 30px rgba(184,58,42,.25); }
.heroi-rotulo { display: block; font-size: .85rem; font-weight: 600; opacity: .85; letter-spacing: .02em; }
.heroi-valor { display: block; font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: .25rem 0 .8rem; font-variant-numeric: tabular-nums; }
.heroi-chips { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 99px; background: rgba(255,255,255,.15); font-size: .85rem; }
.chip b { font-weight: 750; }
.chip .seta { font-weight: 800; opacity: .9; }
.heroi-progresso { margin-top: 1rem; font-size: .8rem; opacity: .95; }
.heroi-barra { height: 8px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; margin-bottom: .35rem; }
.heroi-barra span { display: block; height: 100%; background: #fff; border-radius: 99px; }

.bloco { margin-bottom: 1.25rem; }
.bloco-titulo { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.bloco-titulo h2 { margin: 0; font-size: 1.05rem; }
.link-bloco { font-size: .85rem; font-weight: 600; text-decoration: none; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  --cor: var(--s1); --cor-fundo: color-mix(in srgb, var(--cor) 14%, transparent);
  display: flex; flex-direction: column; gap: .15rem; min-width: 0;
  padding: .85rem; border-radius: 16px; background: var(--cartao); border: 1px solid var(--linha);
  box-shadow: var(--sombra); text-decoration: none; color: var(--texto); position: relative;
}
.tile::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cor); }
.tile-fixa { --cor: var(--s1); }
.tile-cartao { --cor: var(--s2); }
.tile-combinado { --cor: var(--s4); }
.tile-diaadia { --cor: var(--s5); }
.tile-entrada { --cor: var(--verde); }
.tile.pago { opacity: .78; }
.tile.atrasado { border-color: var(--vermelho); }
.tile.vazio { grid-column: 1 / -1; text-align: center; color: var(--suave); }
.tile-topo { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .35rem; }
.icone-tile { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--cor-fundo); color: var(--cor); font-size: 1.05rem; font-weight: 800; flex: none; }
.tile h4 { margin: 0; font-size: .92rem; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile-sub { margin: 0; font-size: .75rem; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-rodape { margin-top: auto; padding-top: .45rem; display: flex; align-items: center; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
.tile-valor { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile form { margin: 0; }
.mini-barra { height: 5px; border-radius: 99px; background: var(--linha); overflow: hidden; margin-top: .35rem; }
.mini-barra span { display: block; height: 100%; background: var(--cor); border-radius: 99px; }

.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .18rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.pill-ok { background: var(--verde-claro); color: var(--verde-escuro); }
.pill-falta { background: var(--ambar-claro); color: var(--ambar); }
.pill-atraso { background: var(--vermelho-claro); color: var(--vermelho); }
.pill-neutro { background: var(--fundo); color: var(--suave); }
.bloco-titulo .pill { font-size: .8rem; padding: .3rem .7rem; }

.aviso-atraso { margin-bottom: 1.1rem; padding: .8rem 1rem; border-radius: 16px; background: var(--vermelho-claro); border: 1px solid var(--vermelho); color: var(--vermelho); }
.aviso-atraso summary { cursor: pointer; }
.aviso-atraso summary span { opacity: .7; font-size: .8rem; }
.aviso-atraso .tiles { margin-top: .75rem; }

.duplas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.1rem; }
.stat { padding: .9rem; border-radius: 16px; background: var(--cartao); border: 1px solid var(--linha); box-shadow: var(--sombra); min-width: 0; }
.stat-rotulo { display: block; font-size: .78rem; font-weight: 700; color: var(--suave); margin-bottom: .45rem; text-transform: capitalize; }
.stat-valor { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-linha { display: flex; justify-content: space-between; gap: .4rem; font-size: .85rem; padding: .15rem 0; }
.stat-linha b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .dica { margin-top: .5rem; font-size: .75rem; padding: .45rem .55rem; }
@media (max-width: 380px) { .heroi-valor { font-size: 2.2rem; } .tile-valor { font-size: .95rem; } }

/* ============ cartões de crédito visuais ============ */
.cartao-visual {
  position: relative; overflow: hidden; color: #fff; border-radius: 20px; padding: 1rem 1.1rem 1.05rem;
  aspect-ratio: 1.75 / 1; max-height: 230px; display: flex; flex-direction: column;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}
.cartao-visual::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.cv-0 { background: linear-gradient(135deg, #3a1c71 0%, #6d2fb0 60%, #9b4dca 100%); }
.cv-1 { background: linear-gradient(135deg, #b3410e 0%, #eb6834 60%, #f59e3f 100%); }
.cv-2 { background: linear-gradient(135deg, #0d3b66 0%, #2a78d6 65%, #48a0f0 100%); }
.cv-3 { background: linear-gradient(135deg, #0f4c3a 0%, #138a5f 60%, #1baf7a 100%); }
.cv-topo { display: flex; justify-content: space-between; align-items: center; }
.cv-chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f6e27a, #c9a227); opacity: .9; }
.cv-editar { position: relative; z-index: 1; color: #fff; text-decoration: none; font-size: .82rem; font-weight: 700; padding: .3rem .7rem; border-radius: 99px; background: rgba(255,255,255,.2); }
.cv-nome { margin-top: auto; font-size: 1.15rem; font-weight: 800; letter-spacing: .01em; }
.cv-dono { font-size: .8rem; opacity: .85; }
.cv-rodape { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; margin-top: .5rem; position: relative; z-index: 1; }
.cv-rotulo { display: block; font-size: .7rem; opacity: .8; text-transform: uppercase; letter-spacing: .05em; }
.cv-valor { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cv-datas { font-size: .72rem; opacity: .85; text-align: right; line-height: 1.35; }
.cv-acoes { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 .7rem; }
.cv-acoes form { margin: 0; }
.tile-editar { color: var(--suave); font-size: .9rem; }

/* ============ demais telas em cartões ============ */
.tile-novo { --cor: var(--verde); align-items: center; justify-content: center; text-align: center; border-style: dashed; box-shadow: none; min-height: 120px; }
.tile-novo::before { display: none; }
.tile-novo h4 { color: var(--verde); }
.tile-botoes { display: inline-flex; gap: .3rem; }
.tile-botoes form { margin: 0; }
.stat-rotulo { text-transform: none; }
.comb-topo { display: flex; gap: .7rem; align-items: center; margin-bottom: .75rem; }
.comb-topo .pill { margin-top: .25rem; }
.comb-numeros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin-bottom: .7rem; }
.comb-numeros div { padding: .55rem .6rem; border-radius: 12px; background: var(--fundo); min-width: 0; }
.comb-numeros span { display: block; font-size: .72rem; color: var(--suave); font-weight: 600; }
.comb-numeros b { display: block; font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comb-falta { background: var(--ambar-claro) !important; }
.comb-falta b { color: var(--ambar); }
.atalho-comb { border-radius: 16px; box-shadow: var(--sombra); }
/* grade do ano mais suave */
.grade-rolagem.cartao { border-radius: 18px; overflow-x: auto; }
.grade tr.bloco td { color: var(--verde); }
.grade tbody tr:not(.bloco):not(.total):not(.rodape):hover td { background: var(--fundo); }
.grade tr.rodape td { background: var(--cartao); }
.grade tr.rodape:last-child td { background: var(--verde-claro); color: var(--verde-escuro); }

/* ============ correções celular ============ */
.linha-campos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
input, select { min-width: 0; max-width: 100%; }
html, body { overflow-x: hidden; }

/* ============ computador: tela inteira, menu lateral ============ */
@media (min-width: 1024px) {
  :root { --lateral: 232px; }
  body { padding-bottom: 2rem; padding-left: var(--lateral); }
  .barra-topo { margin-left: calc(-1 * var(--lateral)); padding-left: 1.5rem; padding-right: 2rem; }
  .barra-abas {
    top: 0; bottom: 0; right: auto; width: var(--lateral); height: auto; z-index: 15;
    grid-template-columns: 1fr; grid-auto-rows: 52px; align-content: start; gap: .25rem;
    padding: 76px .9rem 1rem; border-top: 0; border-right: 1px solid var(--linha);
  }
  .aba { flex-direction: row; justify-content: flex-start; gap: .8rem; padding: 0 .9rem; border-radius: 12px; font-size: .95rem; }
  .aba .icone { width: 22px; text-align: center; }
  .aba:hover { background: var(--fundo); color: var(--texto); }
  body[data-aba="painel"] .aba-painel, body[data-aba="ano"] .aba-ano, body[data-aba="lancar"] .aba-lancar,
  body[data-aba="cartoes"] .aba-cartoes, body[data-aba="contas"] .aba-contas { background: var(--verde-claro); }
  .aba[data-destaque] { order: -1; margin-bottom: .6rem; background: var(--verde); color: #fff !important; justify-content: center; }
  .aba[data-destaque] .icone { width: auto; height: auto; margin: 0; background: none; box-shadow: none; font-size: 1.3rem; }
  .conteudo { max-width: 1480px; padding: 1.75rem 2.25rem; }
  h1 { font-size: 1.7rem; }

  /* painel em duas colunas */
  .painel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
  .painel-lateral { position: sticky; top: 84px; display: flex; flex-direction: column; }
  .painel-lateral .tiles { grid-template-columns: 1fr; }
  .painel-lateral .duplas { grid-template-columns: 1fr; }
  .heroi { text-align: left; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .5rem 2rem; padding: 1.75rem 2rem; }
  .heroi-rotulo { grid-column: 1; }
  .heroi-valor { grid-column: 1; font-size: 3.2rem; margin: .1rem 0 0; }
  .heroi-chips { grid-column: 2; grid-row: 1 / span 2; flex-direction: column; align-items: stretch; justify-content: end; }
  .chip { font-size: .95rem; padding: .5rem .9rem; }
  .heroi-progresso { grid-column: 1 / -1; }
  .seletor-mes { max-width: 420px; }

  .tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
  .tile { padding: 1rem; }
  .duplas { gap: .8rem; }

  /* cartões: grade de cartões + formulários lado a lado */
  .grade-cartoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.5rem; }
  .grade-cartoes .tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .formularios { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.5rem; align-items: start; margin-top: .5rem; }
  .cartao-form { max-width: 720px; }

  /* lançar: formulário à esquerda, lançamentos à direita */
  .lado-a-lado { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 1.75rem; align-items: start; }
  .coluna-form { position: sticky; top: 84px; }

  /* contas e combinados */
  body[data-aba="contas"] .conteudo > .cartao-form, body[data-aba="contas"] .conteudo > details { max-width: 820px; }
  .combinado { max-width: 720px; }
}
@media (min-width: 1500px) {
  .painel-grid { grid-template-columns: minmax(0, 1fr) 400px; }
}

@media (min-width: 1024px) { .barra-topo { z-index: 30; } .barra-abas { padding-top: 84px; } }

/* ============ uma tela para cada uso ============ */
.voltar { display: inline-block; margin-bottom: .6rem; font-weight: 600; text-decoration: none; color: var(--suave); }
.voltar:hover { color: var(--verde); }
.botoes-topo { display: inline-flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.tela-config { max-width: 720px; }
.coluna-form { max-width: 560px; }

/* ============ estilos de cartão ============ */
.cartao-visual { color: #fff; }
.cartao-visual .cv-editar { color: inherit; }
.previa-cartao { max-width: 360px; margin-bottom: .75rem; }
.galeria-temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.tema-opcao { margin: 0; cursor: pointer; display: flex; flex-direction: column; gap: .3rem; font-size: .72rem; color: var(--suave); }
.tema-opcao input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tema-amostra { display: grid; place-items: center; aspect-ratio: 1.6 / 1; border-radius: 10px; font-weight: 800; font-size: .95rem; border: 2px solid transparent; box-shadow: var(--sombra); }
.tema-auto { background: repeating-linear-gradient(45deg, var(--fundo), var(--fundo) 6px, var(--linha) 6px, var(--linha) 12px); color: var(--texto); }
.tema-opcao input:checked + .tema-amostra { border-color: var(--verde); outline: 3px solid color-mix(in srgb, var(--verde) 35%, transparent); }
.tema-opcao input:focus-visible + .tema-amostra { outline: 3px solid var(--verde); }
.tema-nome { line-height: 1.2; }

@media (max-width: 640px) {
  .bloco-titulo .botoes-topo { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .bloco-titulo .botoes-topo .pill { grid-column: 1 / -1; justify-self: start; }
  .bloco-titulo .botoes-topo .botao { justify-content: center; }
}

/* ============ formulário guiado (entradas e contas fixas) ============ */
.form-guiado { max-width: 640px; }
.passo { position: relative; padding: 0 0 1rem 2.4rem; margin-bottom: 1rem; border-bottom: 1px dashed var(--linha); }
.passo:last-of-type { border-bottom: 0; }
.passo-n { position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--verde); color: #fff; font-weight: 800; font-size: .85rem; }
.passo label { color: var(--texto); font-size: .95rem; }
.passo-titulo { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .5rem; }
.passo .suave { margin: -.35rem 0 .6rem; font-size: .8rem; }
.chips-sugestao { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: -.3rem; }
.chip-sugestao { font: inherit; font-size: .8rem; padding: .35rem .7rem; border-radius: 99px; border: 1px solid var(--linha); background: var(--fundo); color: var(--texto); cursor: pointer; }
.chip-sugestao:hover, .chip-sugestao.ativo { border-color: var(--verde); color: var(--verde); }
.opcoes-dia { display: grid; gap: .5rem; margin-bottom: .75rem; }
.opcao-dia { display: flex; gap: .6rem; align-items: flex-start; margin: 0; padding: .7rem .8rem; border: 2px solid var(--linha); border-radius: 12px; cursor: pointer; }
.opcao-dia input { width: auto; margin: .2rem 0 0; accent-color: var(--verde); }
.opcao-dia small { display: block; color: var(--suave); font-weight: 400; font-size: .78rem; }
.opcao-dia:has(input:checked) { border-color: var(--verde); background: var(--verde-claro); }
.check-linha { display: flex !important; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.check-linha input { width: auto; margin: 0; accent-color: var(--verde); }
.frase-conferencia { margin: .25rem 0 1rem; padding: .8rem 1rem; border-radius: 12px; background: var(--verde-claro); color: var(--verde-escuro); font-weight: 600; }
.frase-conferencia:empty { display: none; }

[hidden] { display: none !important; }

/* ============ notificações ============ */
.lista-simples { padding-left: 0; list-style: none; display: grid; gap: .4rem; margin: .5rem 0 1rem; }
.botoes-notif { display: grid; gap: .5rem; }

/* ============ Dia a dia + IA ============ */
@media (max-width: 1023px) { .barra-abas { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 380px) { .aba { font-size: .64rem; } }
body[data-aba="dia"] .aba-dia { color: var(--verde); }
@media (min-width: 1024px) { body[data-aba="dia"] .aba-dia { background: var(--verde-claro); } }
.ia-caixa { border: 2px solid color-mix(in srgb, var(--verde) 45%, var(--linha)); }
.ia-titulo { font-size: 1.05rem; font-weight: 750; color: var(--texto) !important; margin-bottom: .4rem; }
.ia-caixa textarea { font-size: 1.05rem; resize: vertical; min-height: 3.2rem; }
.ia-acoes { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.ia-acoes .botao { flex: 1; }
.ia-foto { cursor: pointer; margin: 0; color: var(--texto); }
.ia-foto.tem-foto { border-color: var(--verde); color: var(--verde); }
.ia-dica { margin: .6rem 0 0; font-size: .8rem; }
.confere { border: 2px solid var(--verde); }
.citacao { font-style: italic; margin-top: -.3rem; }
.chips-cat { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-cat { padding: .4rem .75rem; border-radius: 99px; background: var(--cartao); border: 1px solid var(--linha); font-size: .85rem; }
#ia-enviar[disabled] { opacity: .6; }

/* entre 1024 e 1279px: painel numa coluna só (o resumo da direita desce), bloco verde sem apertar */
@media (min-width: 1024px) and (max-width: 1279px) {
  .painel-grid { grid-template-columns: 1fr; }
  .painel-lateral { position: static; }
  .painel-lateral .tiles, .painel-lateral .duplas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heroi { display: block; text-align: center; }
  .heroi-valor { margin: .25rem 0 .8rem; }
  .heroi-chips { flex-direction: row; justify-content: center; }
}

/* ============ painel do dono ============ */
.link-dono { margin-left: auto; font-size: .85rem; font-weight: 700; text-decoration: none; padding: .3rem .7rem; border-radius: 99px; background: var(--verde-claro); color: var(--verde-escuro); }
.link-dono + .sair { margin-left: .75rem; }
.cliente { display: grid; gap: .5rem; }
.cliente-topo { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.cliente h3 { margin: 0; color: var(--texto); text-transform: none; letter-spacing: 0; font-size: 1rem; }
.cliente-dados { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .82rem; color: var(--suave); }
.cliente-acoes { display: flex; flex-wrap: wrap; gap: .4rem; }
.cliente-acoes form { margin: 0; }
.mensagem-pronta { white-space: pre-wrap; background: var(--fundo); border: 1px dashed var(--linha); border-radius: 12px; padding: .8rem; font-size: .88rem; }
.senha-grande { font-size: 1.4rem; font-weight: 800; letter-spacing: .06em; font-family: ui-monospace, monospace; }
.pill-bloq { background: var(--vermelho-claro); color: var(--vermelho); }

.aviso-senha { display: block; margin-bottom: 1rem; padding: .85rem 1rem; border-radius: 14px; background: var(--ambar-claro); color: var(--ambar); text-decoration: none; border: 1px solid var(--ambar); }

/* ============ reservas ============ */
body[data-aba="reservas"] .aba-reservas { color: var(--verde); }
@media (min-width: 1024px) { body[data-aba="reservas"] .aba-reservas { background: var(--verde-claro); } }
.heroi-guardou { margin-top: .7rem; font-size: .88rem; opacity: .95; }
.heroi-guardou b { font-weight: 800; }
.atalho-ano { display: block; margin: 0 0 1.1rem; padding: .8rem 1rem; border-radius: 14px; background: var(--cartao); border: 1px solid var(--linha); text-decoration: none; color: var(--texto); font-weight: 600; }
.reserva { display: grid; gap: .35rem; }
.reserva-topo { display: flex; gap: .7rem; align-items: center; }
.reserva-icone { font-size: 1.7rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--verde-claro); flex: none; }
.reserva h3 { margin: 0; text-transform: none; letter-spacing: 0; color: var(--texto); font-size: 1.05rem; }
.reserva-saldo { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.barra-reserva { height: 12px; border-radius: 99px; background: var(--linha); overflow: hidden; }
.barra-reserva span { display: block; height: 100%; background: linear-gradient(90deg, #19a565, #0b7a4b); border-radius: 99px; }
.reserva-acoes { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .3rem; }
.reserva-acoes .botao { flex: 1; }
.icones-reserva { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.icones-reserva label { margin: 0; }
.icones-reserva input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icones-reserva span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; font-size: 1.5rem; border: 2px solid var(--linha); background: var(--fundo); cursor: pointer; }
.icones-reserva input:checked + span { border-color: var(--verde); background: var(--verde-claro); }

@media (min-width: 1024px) { .grade-reservas { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1rem; } .grade-reservas .cartao { margin: 0; } }
.heroi-guardou b { white-space: nowrap; }
.heroi-alerta { display: block; margin-top: .3rem; font-size: .8rem; font-weight: 700; }

/* ============ reservas estilo cofrinho ============ */
.reservas-topo { padding: .3rem 0 1rem; }
.rt-rotulo { display: block; font-size: 1.15rem; font-weight: 700; }
.rt-valor { display: block; font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.rt-rendeu { display: block; margin-top: .2rem; color: var(--suave); }
.rt-rendeu b { color: var(--verde); }
.rt-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.reserva-card { margin-bottom: 1.1rem; }
.reserva-capa { position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: .15rem; min-height: 170px; padding: 1rem 1.1rem;
  border-radius: 18px; color: #fff; text-decoration: none; background-size: cover; background-position: center; overflow: hidden; box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.reserva-capa.rc-0 { background-image: linear-gradient(135deg, #0f4c3a, #138a5f 60%, #1baf7a); }
.reserva-capa.rc-1 { background-image: linear-gradient(135deg, #3a1c71, #6d2fb0 60%, #9b4dca); }
.reserva-capa.rc-2 { background-image: linear-gradient(135deg, #0d3b66, #2a78d6 65%, #48a0f0); }
.reserva-capa.rc-3 { background-image: linear-gradient(135deg, #b3410e, #eb6834 60%, #f59e3f); }
.rc-nome { position: absolute; top: .9rem; left: 1.1rem; right: 1.1rem; font-weight: 700; font-size: 1rem; }
.rc-sub { position: absolute; top: 2.3rem; left: 1.1rem; right: 1.1rem; font-size: .78rem; opacity: .85; }
.rc-valor { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rc-linha { font-size: .82rem; opacity: .92; min-height: 1em; }
.rc-barra { display: block; height: 6px; border-radius: 99px; background: rgba(255,255,255,.25); overflow: hidden; margin-top: .35rem; }
.rc-barra span { display: block; height: 100%; background: #fff; border-radius: 99px; }
.rc-dica { margin: .5rem .2rem .4rem; }
.reserva-card .reserva-acoes .botao { flex: 1; padding: .55rem .4rem; }
.rt-botoes .botao { text-align: center; justify-content: center; font-size: 1rem; padding: .8rem .5rem; }
