/* COFRE — finanças pessoais do João.
   Visual reaproveitado do ABYSSE CORE (cores, fontes, cantos, refrações, estrela, abertura).
   Layout inspirado na referência que o João mandou (saldo grande, 4 botões, 2 cartões, barra de botões soltos). */
:root {
  --abyss: #0A0A0B; --ink: #141416; --graphite: #232326; --stone: #5A5A5E;
  --ash: #8C8C90; --smoke: #C9C6BF; --bone: #EDEAE3;
  --rubi: #D42B3C; --rubi-escuro: #3A1015;
  --destaque: #D42B3C; --destaque-txt: #fff; --brilho: rgba(212,43,60,0.7);
  --abyss-rgb: 10,10,11; --bone-rgb: 237,234,227; --tinta: 255,255,255;
  --card: rgba(22, 22, 25, 0.82);
  --card-forte: rgba(28, 28, 32, 0.94);
  --tecla: rgba(30, 30, 34, 0.92);
  --folha: #121214; --barra: rgba(14, 14, 16, 0.9); --sombra-folha: rgba(5, 5, 6, 0.6);
  --verde: #7FD69A; --verde-fundo: rgba(127,214,154,0.08); --rubi-txt: #FF8A98; --btn-hover: #fff;
  --c1: #D42B3C; --c2: #EDEAE3; --c3: #A9A6A0; --c4: #7A2530; --c5: #6E6E74; --c6: #C9C6BF; --c7: #45454A; --c8: #E8848F; --c9: #2E2E33;
  --font-display: "Archivo", "Arial Black", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-small: 0.875rem; --fs-label: 0.75rem;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --r-card: 18px; --r-ctl: 14px; --r-pill: 999px;
  --line: 1px solid rgba(var(--tinta), 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 76px;
}
/* ---------- Tema claro: o que é preto vira off-white e vice-versa ---------- */
:root[data-tema="claro"] {
  --abyss: #EDEAE3; --ink: #F6F4EF; --graphite: #D6D3CC; --stone: #A3A09A;
  --ash: #6B6A6E; --smoke: #3A3A3E; --bone: #0A0A0B;
  --abyss-rgb: 237,234,227; --bone-rgb: 10,10,11; --tinta: 10,10,11;
  --card: rgba(255, 255, 255, 0.55); --card-forte: rgba(255, 255, 255, 0.8); --tecla: rgba(255, 255, 255, 0.9);
  --folha: #F4F2ED; --barra: rgba(246, 244, 239, 0.9); --sombra-folha: rgba(10, 10, 11, 0.25);
  --verde: #1E7F45; --verde-fundo: rgba(30,127,69,0.1); --rubi-txt: #B01F30; --btn-hover: #2A2A2E; --brilho: rgba(212,43,60,0.45);
  --c1: #D42B3C; --c2: #0A0A0B; --c3: #6E6E74; --c4: #E8848F; --c5: #A9A6A0; --c6: #3A3A3E; --c7: #C9C6BF; --c8: #7A2530; --c9: #D6D3CC;
}
:root[data-tema="claro"] { color-scheme: light; }
/* Troca de tema: o novo tema entra num círculo que cresce a partir do botão */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 999; }
:root[data-tema="claro"] .fundo { filter: invert(1); }   /* refrações escuras no fundo claro */
:root[data-tema="claro"] .busca-campo .input::-webkit-search-cancel-button { filter: none; }
/* Abertura no claro: mesma animação, invertida (fundo off-white, estrela e nome pretos) */
:root[data-tema="claro"] .ab { filter: invert(1); --abyss: #12151C; --bone: #EDEAE3; --bone-rgb: 237,234,227; --smoke: #C9C6BF; --stone: #5A5A5E; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body, .card, .lista, .grande, .acao, .redondo, .abas, .aba, .folha, .input, .tecla, .cat { transition-property: background-color, border-color, color; transition-duration: 350ms; }
body {
  margin: 0; min-height: 100dvh; background: var(--abyss); color: var(--bone);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.5; -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
svg.ic { width: 22px; height: 22px; display: block; flex: none; }
:focus-visible { outline: 2px solid var(--bone); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Fundo (refrações do CORE) ---------- */
.fundo { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.veu { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--abyss-rgb),0) 0%, rgba(var(--abyss-rgb),0.45) 45%, rgba(var(--abyss-rgb),0.92) 100%); }

.app { max-width: 560px; margin: 0 auto; outline: none;
  padding: calc(var(--s-4) + env(safe-area-inset-top)) 18px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }

/* ---------- Tipografia ---------- */
.label { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ash); margin: 0; }
.disp { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; text-transform: uppercase; letter-spacing: -0.01em; line-height: 0.95; margin: 0; }
.h-tela { font-size: clamp(1.5rem, 7vw, 2rem); }
.h-sec { font-size: 0.9375rem; letter-spacing: 0.02em; }
.apoio { color: var(--ash); font-size: var(--fs-small); margin: var(--s-2) 0 0; }
.vazio { color: var(--ash); font-size: var(--fs-small); margin: 0; }
.mais { color: var(--verde); } .menos { color: var(--bone); } .vermelho { color: var(--rubi); }

/* ---------- Topo ---------- */
.topo { display: flex; align-items: center; gap: var(--s-3); min-height: 52px; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca svg { width: 22px; height: 22px; color: var(--bone); filter: drop-shadow(0 0 8px rgba(var(--bone-rgb),0.5)); }
.marca span { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 0.875rem; letter-spacing: 0.32em; }
.topo__dir { margin-left: auto; display: flex; gap: 10px; }
.redondo { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--card-forte); border: var(--line); color: var(--bone); transition: border-color 250ms var(--ease); }
.redondo:hover { border-color: rgba(var(--tinta),0.22); }
.redondo svg { width: 20px; height: 20px; }
.barra-topo { display: flex; align-items: center; gap: var(--s-3); min-height: 52px; margin-bottom: var(--s-3); }
.barra-topo .disp { flex: 1; }

/* ---------- Saldo (Início) ---------- */
.saldo { margin: var(--s-5) 0 var(--s-5); }
.saldo__v { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.saldo__n { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: clamp(2.2rem, 11vw, 3rem); line-height: 1; letter-spacing: -0.02em; }
.saldo__n small { font-size: 0.45em; color: var(--smoke); margin-right: 6px; letter-spacing: 0; }
.saldo__n.neg { color: var(--rubi); }
.etq { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 0.75rem; font-weight: 600; background: rgba(var(--tinta),0.06); color: var(--smoke); border: var(--line); }
.etq--bom { color: var(--verde); background: var(--verde-fundo); }
.etq--ruim { color: var(--rubi-txt); background: rgba(212,43,60,0.12); }

/* ---------- 4 botões de ação ---------- */
.acoes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.acao { display: grid; justify-items: center; align-content: center; gap: 8px; aspect-ratio: 1 / 1.02; border-radius: var(--r-card);
  background: var(--card-forte); border: var(--line); font-size: 0.8125rem; font-weight: 500; color: var(--bone);
  transition: transform 150ms var(--ease), border-color 250ms var(--ease); }
.acao:active { transform: scale(0.96); }
.acao:hover { border-color: rgba(var(--tinta),0.2); }
.acao svg { width: 24px; height: 24px; }
.acao--rubi { background: var(--destaque); border-color: var(--destaque); color: var(--destaque-txt); box-shadow: 0 10px 30px -12px var(--brilho); }

/* ---------- Cartões ---------- */
.card { background: var(--card); border: var(--line); border-radius: var(--r-card); padding: 18px; margin-top: var(--s-3); }
.card--forte { background: var(--card-forte); }
.card__cab { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.grande { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 168px; padding: 18px; text-align: left;
  border-radius: 22px; background: var(--card-forte); border: var(--line); overflow: hidden; transition: border-color 250ms var(--ease); }
.grande:hover { border-color: rgba(var(--tinta),0.2); }
.grande__seta { position: absolute; top: 10px; right: 10px; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: rgba(var(--tinta),0.05); }
.grande__seta svg { width: 20px; height: 20px; }
.grande--sai .grande__seta { transform: rotate(90deg); }
.grande__t { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: clamp(1.15rem, 5.6vw, 1.5rem); text-transform: uppercase; line-height: 1; }
.grande__v { margin-top: 8px; font-size: 0.875rem; color: var(--ash); }
.grande__estrela { position: absolute; left: -26px; top: -26px; width: 110px; height: 110px; color: rgba(var(--bone-rgb),0.05); }

.secao { display: flex; align-items: baseline; justify-content: space-between; margin: var(--s-6) 0 var(--s-2); }
.secao h2 { font-family: var(--font-body); font-size: 1.25rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.ver { font-size: var(--fs-small); font-weight: 600; color: var(--destaque); }

/* ---------- Lista de lançamentos ---------- */
.lista { background: var(--card-forte); border: var(--line); border-radius: 22px; padding: 6px 8px; }
.item { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 10px 8px; text-align: left; border-radius: 14px; }
.item:hover { background: rgba(var(--tinta),0.03); }
.item + .item { border-top: 1px solid rgba(var(--tinta),0.04); }
.bola { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--tinta),0.05); color: var(--bone); }
.bola svg { width: 20px; height: 20px; }
.bola--entrada { color: var(--verde); background: var(--verde-fundo); }
.item__t { font-size: 0.9375rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__s { font-size: 0.75rem; color: var(--ash); }
.item__v { text-align: right; font-size: 0.9375rem; font-weight: 600; white-space: nowrap; }
.item__v small { display: block; font-size: 0.6875rem; font-weight: 400; color: var(--ash); }
.dia { margin: var(--s-4) 4px var(--s-2); }
.vazio-card { text-align: center; padding: 28px 18px; }
.vazio-card svg { width: 40px; height: 40px; color: var(--destaque); margin: 0 auto 10px; display: block; filter: drop-shadow(0 0 10px var(--brilho)); }

/* ---------- Mês ---------- */
.mes-nav { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; margin-bottom: var(--s-3); }
.mes-nav p { text-align: center; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trio .card { margin: 0; padding: 12px 10px; min-width: 0; }
.trio .label { font-size: 0.625rem; letter-spacing: 0.12em; }
.trio b { display: block; margin-top: 6px; font-size: clamp(0.78rem, 3.6vw, 1rem); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html, body { overflow-x: hidden; }
.abas-int { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; gap: 4px; margin-top: var(--s-4);
  background: rgba(var(--tinta),0.04); border: var(--line); border-radius: var(--r-pill); }
.abas-int button { min-height: 40px; border-radius: var(--r-pill); font-size: 0.8125rem; font-weight: 500; color: var(--ash); }
.abas-int button[aria-pressed="true"] { background: var(--bone); color: var(--abyss); font-weight: 600; }

/* ---------- Caixinhas ---------- */
.cx { display: block; width: 100%; text-align: left; position: relative; overflow: hidden; }
.cx__topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cx__nome { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.05rem; text-transform: uppercase; line-height: 1.1; }
.cx__pct { font-size: 0.8125rem; font-weight: 600; color: var(--smoke); }
.cx__v { margin: 14px 0 10px; font-size: 0.875rem; color: var(--ash); }
.cx__v b { color: var(--bone); font-size: 1.25rem; font-weight: 700; margin-right: 4px; }
.barra { height: 8px; border-radius: 8px; background: rgba(var(--tinta),0.07); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 8px; background: var(--bone); transition: width 700ms var(--ease); }
.barra i.cheia { background: var(--destaque); box-shadow: 0 0 12px var(--brilho); }
.barra--rubi i { background: var(--rubi); box-shadow: 0 0 12px rgba(212,43,60,0.7); }
.cx__estrela { position: absolute; right: -20px; bottom: -30px; width: 100px; height: 100px; color: rgba(var(--bone-rgb),0.05); }
.cx--ok .cx__estrela { color: rgba(212,43,60,0.25); }

/* ---------- Entrar / criar conta ---------- */
.porta { max-width: 420px; margin: 0 auto; padding-top: 6vh; }
.porta__marca { display: grid; justify-items: center; gap: 10px; margin-bottom: 32px; text-align: center; }
.porta__marca svg { width: 44px; height: 44px; color: var(--bone); filter: drop-shadow(0 0 14px rgba(var(--bone-rgb),0.6)); }
.porta__marca .disp { font-size: 2.2rem; letter-spacing: 0.08em; }
.porta .tipo { margin-bottom: 4px; }
.porta .tipo button[aria-pressed="true"] { background: var(--bone); color: var(--abyss); }
.erro { font-size: var(--fs-small); color: var(--bone); border: 1px dashed var(--rubi); border-radius: var(--r-ctl); padding: var(--s-3); margin: 0; }
.erro:empty { display: none; }
.abas[hidden] { display: none; }
.btn[disabled] { opacity: 0.5; cursor: wait; }

/* ---------- Painel do administrador ---------- */
.painel-link { display: flex; align-items: center; gap: 12px; }
.painel-link > svg:first-child, .painel-link > span:first-child svg { width: 22px; height: 22px; }
.painel-link b { font-weight: 600; }
.pessoa { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 12px 8px; }
.pessoa + .pessoa { border-top: 1px solid rgba(var(--tinta), 0.05); }
.pessoa .bola { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1rem; }
.pessoa__acoes { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn--mini { min-height: 40px; padding: 0 12px; font-size: 0.75rem; letter-spacing: 0.06em; }
.senha-nova { margin: 18px 0 8px; padding: 18px; text-align: center; border: 1px dashed rgba(var(--bone-rgb), 0.35); border-radius: var(--r-ctl);
  font: 700 1.6rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: 0.08em; user-select: all; }

/* ---------- Contas (bancos) ---------- */
.nas-contas { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 14px; border: var(--line); border-radius: var(--r-pill);
  background: rgba(var(--tinta), 0.03); font-size: 0.8125rem; color: var(--ash); width: fit-content; max-width: 100%; }
.nas-contas svg { width: 16px; height: 16px; flex: none; }
.nas-contas b { color: var(--bone); font-weight: 600; white-space: nowrap; }
.nas-contas span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conta { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.conta__ic { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; background: rgba(var(--tinta), 0.05); }
.conta__ic svg { width: 20px; height: 20px; }
.conta__nome { display: block; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 0.95rem; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conta__saldo { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.contas-esc { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 4px -18px 0; padding: 0 18px; }
.contas-esc::-webkit-scrollbar { display: none; }
.conta-chip { flex: none; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); border: var(--line); background: rgba(var(--tinta), 0.03);
  font-size: 0.8125rem; font-weight: 500; color: var(--smoke); white-space: nowrap; }
.conta-chip small { color: var(--ash); font-size: 0.6875rem; }
.conta-chip[aria-pressed="true"] { border-color: var(--rubi); background: rgba(212,43,60,0.12); color: var(--bone); }
.conta-chip[disabled] { opacity: 0.3; }
.tipo button[disabled] { cursor: not-allowed; opacity: 0.6; }

/* ---------- Busca ---------- */
.busca-campo { position: relative; display: block; }
.busca-campo svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ash); pointer-events: none; }
.busca-campo .input { padding-left: 46px; min-height: 54px; }
.busca-campo .input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.busca-total { margin-top: 16px; }
.abas-int button { white-space: nowrap; }

/* ---------- Gráficos ---------- */
.rosca { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.rosca svg { width: 150px; height: 150px; display: block; }
.rosca__meio { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; }
.leg { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.leg li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.leg i { width: 10px; height: 10px; border-radius: 3px; }
.leg span:last-child { color: var(--ash); }
.cat-linha { display: grid; gap: 6px; padding: 10px 0; }
.cat-linha + .cat-linha { border-top: 1px solid rgba(var(--tinta),0.05); }
.cat-linha__t { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; }
.cat-linha__t span:first-child { display: flex; align-items: center; gap: 8px; }
.cat-linha__t svg { width: 16px; height: 16px; color: var(--ash); }
.cat-linha__s { font-size: 0.75rem; color: var(--ash); }
.barras { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 170px; padding-top: 10px; }
.barras__col { display: grid; grid-template-rows: 1fr auto; gap: 6px; height: 100%; }
.barras__par { display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.barras__par i { width: 40%; max-width: 16px; border-radius: 5px 5px 2px 2px; min-height: 2px; transition: height 700ms var(--ease); }
.barras__par i:first-child { background: var(--smoke); }
.barras__par i:last-child { background: var(--destaque); }
.barras__col span { text-align: center; font-size: 0.6875rem; color: var(--ash); text-transform: uppercase; letter-spacing: 0.06em; }
.barras__col--atual span { color: var(--bone); font-weight: 600; }
.leg-h { display: flex; gap: 16px; font-size: 0.75rem; color: var(--ash); margin-top: 12px; }
.leg-h i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 54px; padding: 0 24px; border: 1px solid var(--bone); border-radius: var(--r-ctl);
  background: var(--bone); color: var(--abyss); text-decoration: none;
  font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  transition: background-color 250ms var(--ease), color 250ms var(--ease), transform 150ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: var(--btn-hover); }
.btn--sec { background: rgba(var(--tinta),0.03); color: var(--bone); border-color: rgba(var(--tinta),0.22); }
.btn--sec:hover { background: rgba(var(--tinta),0.08); }
.btn--perigo { background: transparent; color: var(--ash); border: 1px dashed var(--stone); }
.btn--perigo:hover { color: var(--bone); background: transparent; }
.btn--vermelho { background: var(--destaque); border-color: var(--destaque); color: var(--destaque-txt); }
.btn--vermelho:hover { background: #e2394a; }
.btn svg { width: 18px; height: 18px; }
.pilha { display: grid; gap: var(--s-3); margin-top: var(--s-4); }
.linha-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.linha-2 .btn { padding: 0 12px; gap: 8px; letter-spacing: 0.06em; white-space: nowrap; }

/* ---------- Formulários ---------- */
.campo { display: grid; gap: var(--s-2); }
.campo > span { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ash); }
.input {
  width: 100%; min-height: 52px; padding: 0 var(--s-4); background: rgba(var(--abyss-rgb),0.7);
  border: 1px solid rgba(var(--tinta),0.14); border-radius: var(--r-ctl); font-size: 1rem;
}
.input:focus { border-color: var(--bone); outline: none; }
.input::placeholder { color: var(--stone); }
.check { display: grid; grid-template-columns: 24px 1fr; gap: var(--s-3); align-items: start; font-size: var(--fs-small); color: var(--smoke); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--destaque); }

/* ---------- Folha de baixo (lançar, editar) ---------- */
.folha-fundo { position: fixed; inset: 0; z-index: 50; background: var(--sombra-folha); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 280ms var(--ease); }
.folha-fundo.on { opacity: 1; }
.folha { position: fixed; left: 50%; bottom: 0; z-index: 51; width: min(560px, 100%); max-height: 94dvh; overflow-y: auto;
  transform: translate(-50%, 100%); transition: transform 380ms var(--ease);
  background: var(--folha); border: var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); }
.folha.on { transform: translate(-50%, 0); }
.folha__puxador { width: 40px; height: 4px; border-radius: 4px; background: rgba(var(--tinta),0.18); margin: 0 auto 12px; }
.folha__cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.tipo { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: rgba(var(--tinta),0.04); border: var(--line); border-radius: var(--r-pill); }
.tipo button { min-height: 42px; border-radius: var(--r-pill); font-size: 0.875rem; font-weight: 600; color: var(--ash); }
.tipo button[aria-pressed="true"] { background: var(--bone); color: var(--abyss); }


.valor { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 14px 0 4px; min-height: 56px; }
.valor small { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.1rem; color: var(--ash); }
.valor b { font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: clamp(2.4rem, 13vw, 3.2rem); line-height: 1; letter-spacing: -0.02em; }
.valor.vazio-v b { color: var(--stone); }

.cats { display: flex; gap: 6px; margin: 12px -18px; padding: 0 18px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 18px; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; width: 76px; scroll-snap-align: start; display: grid; justify-items: center; align-content: center; gap: 6px; padding: 10px 2px 8px; border-radius: var(--r-ctl); border: var(--line); background: rgba(var(--tinta),0.02);
  font-size: 0.6875rem; color: var(--smoke); line-height: 1.15; text-align: center; min-height: 70px; }
.cat svg { width: 20px; height: 20px; color: var(--ash); }
.tipo button[aria-pressed="true"].t-gasto { background: var(--rubi); color: #fff; }
.cat[aria-pressed="true"] { border-color: var(--rubi); background: rgba(212,43,60,0.12); color: var(--bone); }
.cat[aria-pressed="true"] svg { color: var(--bone); }

.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.tecla { min-height: 48px; border-radius: var(--r-ctl); background: var(--tecla); border: var(--line);
  font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 1.25rem; transition: transform 100ms var(--ease), background-color 150ms; }
.tecla:active { transform: scale(0.95); background: rgba(var(--tinta),0.12); }
.tecla svg { width: 22px; height: 22px; margin: auto; }
.mais-campos { display: grid; gap: 10px; }
.linha-data { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Barra de baixo (botões soltos, do meio aceso) ---------- */
.abas {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  width: min(520px, calc(100% - 24px)); height: 72px; padding: 8px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  background: var(--barra); border: var(--line); border-radius: 26px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.aba { display: grid; place-items: center; border-radius: 18px; background: rgba(var(--tinta),0.04); color: var(--stone);
  text-decoration: none; transition: background-color 250ms var(--ease), color 250ms var(--ease), transform 150ms var(--ease); }
.aba:active { transform: scale(0.94); }
.aba[aria-current="page"] { background: rgba(var(--tinta),0.1); color: var(--bone); }
.aba--mais { background: var(--destaque); color: var(--destaque-txt); margin-top: -14px; height: calc(100% + 14px); box-shadow: 0 10px 28px -10px var(--brilho); }
.aba--mais .ic { width: 26px; height: 26px; }
.aba .ic { width: 22px; height: 22px; }

/* ---------- Aviso ---------- */
.aviso {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); z-index: 90; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  width: min(520px, calc(100% - 28px)); padding: 12px 16px; border-radius: var(--r-ctl); background: var(--bone); color: var(--abyss);
  font-size: var(--fs-small); font-weight: 600; text-align: center; transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}
.aviso.on { opacity: 1; transform: translate(-50%, 0); }
.aviso.rubi { background: var(--rubi); color: #fff; }

.entrar-tela { animation: surgir 550ms var(--ease) both; }
@keyframes surgir { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Abertura (do CORE: estrela → feixe → nome pela refração) ---------- */
.ab { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; pointer-events: none; background: var(--abyss); color: var(--bone); --ta: 0.7; }
.abrindo #app, .abrindo #abas { opacity: 0; }
.abriu #app, .abriu #abas { animation: ab-aparece 0.6s ease both; }
.ab__marca { position: relative; width: min(78vw, 380px); display: grid; justify-items: center; transform: translateY(-4vh); }
.ab__caixa { position: relative; width: 100%; height: 70px; display: grid; place-items: center; }
.ab__estrela { position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; color: var(--bone);
  filter: drop-shadow(0 0 6px rgba(var(--bone-rgb),0.9)) drop-shadow(0 0 22px rgba(var(--bone-rgb),0.45)); opacity: 0; transform: scale(0) rotate(-45deg); }
.ab__estrela svg { width: 100%; height: 100%; display: block; }
.ab__halo { position: absolute; top: 50%; left: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--bone-rgb),0.22), rgba(var(--bone-rgb),0.06) 40%, transparent 70%); opacity: 0; transform: scale(0.3); }
.ab__feixe { position: absolute; top: 50%; left: 50%; width: 120%; height: 2px; margin: -1px 0 0 -60%; border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--bone-rgb),0.6) 20%, #fff 50%, rgba(var(--bone-rgb),0.6) 80%, transparent);
  box-shadow: 0 0 12px rgba(var(--bone-rgb),0.8), 0 0 40px rgba(var(--bone-rgb),0.35); opacity: 0; transform: scaleX(0); }
.ab__nome { position: relative; margin: 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: clamp(2.2rem, 12vw, 3.4rem);
  letter-spacing: 0.08em; opacity: 0; filter: blur(10px) brightness(2.2);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: 0% 100%; mask-size: 0% 100%; }
.ab__faixa { position: relative; width: 100%; height: 44px; margin-top: 10px; display: grid; place-items: center; }
.ab__refr { position: absolute; left: -8%; top: 50%; width: 116%; height: 30px; margin-top: -15px; overflow: visible; }
.ab__refr path { fill: none; stroke: url(#abGradRefr); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 60 600; stroke-dashoffset: 60; opacity: 0;
  filter: drop-shadow(0 0 4px rgba(var(--bone-rgb),0.8)); }
.ab__sub { position: relative; display: flex; align-items: center; gap: 14px; margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5em;
  text-transform: uppercase; color: var(--smoke); padding-left: 0.5em; }
.ab__sub::before, .ab__sub::after { content: ""; width: 30px; height: 1px; background: var(--stone); transform: scaleX(0); }
.ab__sub::before { transform-origin: right; } .ab__sub::after { transform-origin: left; }
.ab__sub span { display: inline-block; opacity: 0; filter: blur(6px); }
.ab--rodando .ab__halo    { animation: ab-halo calc(1.6s * var(--ta)) var(--ease) calc(0.3s * var(--ta)) forwards; }
.ab--rodando .ab__estrela { animation: ab-estrela calc(1.35s * var(--ta)) var(--ease) calc(0.3s * var(--ta)) forwards; }
.ab--rodando .ab__feixe   { animation: ab-feixe calc(1.0s * var(--ta)) var(--ease) calc(1.05s * var(--ta)) forwards; }
.ab--rodando .ab__nome    { animation: ab-revela calc(0.95s * var(--ta)) var(--ease) calc(1.23s * var(--ta)) forwards; }
.ab--rodando .ab__refr path { animation: ab-corre calc(1.15s * var(--ta)) cubic-bezier(0.45, 0, 0.2, 1) calc(1.9s * var(--ta)) forwards; }
.ab--rodando .ab__sub::before, .ab--rodando .ab__sub::after { animation: ab-linha calc(0.7s * var(--ta)) var(--ease) calc(2.4s * var(--ta)) forwards; }
.ab--rodando .ab__sub span { animation: ab-letra calc(0.6s * var(--ta)) var(--ease) calc(2.1s * var(--ta)) forwards; }
.ab--sai { animation: ab-sai 0.55s var(--ease) forwards; }
@keyframes ab-aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes ab-sai { to { opacity: 0; } }
@keyframes ab-halo { 0% { opacity: 0; transform: scale(0.3); } 45% { opacity: 1; transform: scale(1); } 75% { opacity: 0.8; transform: scale(1.15); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes ab-estrela {
  0%   { opacity: 0; transform: scale(0) rotate(-45deg); }
  35%  { opacity: 1; transform: scale(1) rotate(0deg); }
  55%  { opacity: 1; transform: scale(0.88) rotate(0deg); }
  72%  { opacity: 1; transform: scale(1.7, 0.5) rotate(0deg); filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 40px rgba(var(--bone-rgb),0.8)) brightness(1.6); }
  100% { opacity: 0; transform: scale(6, 0.04) rotate(0deg); }
}
@keyframes ab-feixe { 0% { opacity: 0; transform: scaleX(0); } 30% { opacity: 1; transform: scaleX(0.55); } 60% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1.08) scaleY(0.5); } }
@keyframes ab-revela {
  0%   { opacity: 1; -webkit-mask-size: 0% 100%; mask-size: 0% 100%; filter: blur(10px) brightness(2.2); }
  60%  { opacity: 1; -webkit-mask-size: 150% 100%; mask-size: 150% 100%; filter: blur(2px) brightness(1.3); }
  100% { opacity: 1; -webkit-mask-size: 200% 100%; mask-size: 200% 100%; filter: blur(0) brightness(1); }
}
@keyframes ab-corre { 0% { opacity: 0; stroke-dashoffset: 60; } 12% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; stroke-dashoffset: -560; } }
@keyframes ab-letra { to { opacity: 1; filter: blur(0); } }
@keyframes ab-linha { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
@media (max-width: 360px) { .acao { font-size: 0.75rem; } .rosca { grid-template-columns: 1fr; justify-items: center; } }
