:root {
  --bg: #000;
  --text: #f2f2f2;
  --text-2: #b8b8b8;
  --muted: #7c7c7c;
  --glass: #161616;
  --pill: #161616;
  --gold: #d8b77f;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.home {
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 22px 140px;
}

.home-top { display: flex; justify-content: space-between; padding-top: 8px; }
.btn-glass {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .15s, background .2s;
}
.btn-glass:hover { background: #222; }
.btn-glass:active { transform: scale(.94); }
.btn-glass svg { width: 24px; height: 24px; }

.saldo { margin-top: 72px; text-align: center; }
.saldo-label { font-size: clamp(26px, 7.5vw, 34px); font-weight: 600; color: var(--text-2); letter-spacing: -0.03em; }
.saldo-valor {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  width: 100%;
  margin-top: 2px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.saldo-valor .moeda { font-size: clamp(30px, 9vw, 44px); color: var(--muted); letter-spacing: -0.03em; }
#saldo { font-size: clamp(56px, 18vw, 92px); line-height: 1.1; }
.saldo-valor.negativo #saldo { color: #f0a3a3; }

/* meta em foco */
.meta-linha {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 14px auto 0; max-width: 320px;
  font-size: 15px; color: var(--muted);
}
.meta-linha b { color: var(--gold); font-weight: 600; }
.meta-linha:hover #metaTexto { color: var(--text-2); }
.meta-barra { width: 100%; height: 4px; border-radius: 2px; background: #1c1c1c; overflow: hidden; }
.meta-barra[hidden] { display: none; }
.meta-barra i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 2px; transition: width .6s ease; }

/* despesas fixas do mês */
.fixos-linha {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 14px auto 0; padding: 8px 14px; border-radius: 20px;
  background: #161616; border: 1px solid #262626;
  font-size: 14px; color: var(--text-2);
}
.fixos-linha[hidden] { display: none; }
.fixos-linha b { color: #f0a3a3; font-weight: 600; }
.fixos-linha b.ok { color: #7fcf9a; }
.fixos-linha .ponto { width: 8px; height: 8px; border-radius: 50%; background: #f0a3a3; flex-shrink: 0; }
.fixos-linha .ponto.ok { background: #7fcf9a; }

.chips-linha { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chips-linha .fixos-linha { margin: 0; }
.fixos-linha.transf { color: var(--gold); border-color: rgba(216,183,127,.35); }
.fixos-linha .ponto.cc { background: var(--text-2); }

/* saúde financeira: escala vermelho → verde com marcador */
.saude { display: block; width: 100%; max-width: 320px; margin: 18px auto 0; padding: 12px 14px; border-radius: 16px; background: #0f0f0f; border: 1px solid #1f1f1f; text-align: left; }
.saude[hidden] { display: none; }
.saude-topo { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--text-2); }
.saude-topo b { font-size: 15px; font-variant-numeric: tabular-nums; }
.saude-escala { position: relative; display: block; height: 6px; margin: 10px 0 4px; border-radius: 3px; background: linear-gradient(90deg, hsl(0,70%,55%), hsl(45,85%,55%) 50%, hsl(130,60%,50%)); }
.saude-escala i { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid #000; transform: translate(-50%, -50%); transition: left .6s ease; }
.top-dir .btn-glass { width: 50px; height: 50px; }
@media (max-width: 380px) { .top-dir { gap: 6px; } .top-dir .btn-glass { width: 44px; height: 44px; } }

/* lista que vai sumindo */
.gastos {
  list-style: none;
  margin-top: 40px;
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
}
.gastos li a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 8px 0;
  font-size: 20px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--text-2);
  transition: color .15s;
}
.gastos li a:hover { color: var(--text); }
.gastos .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gastos .valor { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gastos li:nth-child(1) a, .gastos li:nth-child(2) a { padding: 3px 0; }
.gastos li:nth-child(2) a { padding-bottom: 10px; }
.gastos .vazio { color: var(--muted); font-size: 17px; padding: 8px 0; }

.link-hist {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 26px; font-size: 15px; font-weight: 600; color: var(--muted);
}
.link-hist:hover { color: var(--text); }
.link-hist svg { width: 16px; height: 16px; }

/* barra inferior */
.acoes {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 14px;
  padding: 14px 16px max(24px, env(safe-area-inset-bottom));
  background: #000;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 26px;
  background: var(--pill); color: var(--text);
  font-size: 17px; font-weight: 500;
  transition: background .15s, transform .15s;
}
.pill:hover { background: #222; }
.pill-add { background: var(--gold); color: #1a1408; font-weight: 700; }
.pill-add:hover { background: #e6c48a; }
.pill-add svg { stroke-width: 2.4; }
.top-dir { display: flex; gap: 10px; }
/* botões menores da barra inferior (cartão / transferir) */
.pill-mini { height: 44px; padding: 0 13px; gap: 6px; font-size: 14px; border-radius: 22px; color: var(--text-2); }
.pill-mini svg { width: 17px; height: 17px; }
.acoes { align-items: center; gap: 8px; }

/* dica de instalação (iPhone) */
.instalar {
  position: fixed; left: 50%; bottom: calc(max(24px, env(safe-area-inset-bottom)) + 76px); z-index: 30;
  transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 448px;
  display: flex; align-items: center; gap: 12px;
  background: #161616; border: 1px solid #262626; border-radius: 18px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
  animation: fade .3s;
}
.instalar[hidden] { display: none; }
.instalar img { border-radius: 10px; flex-shrink: 0; }
.instalar p { flex: 1; font-size: 14px; line-height: 1.4; color: var(--text-2); }
.instalar p > b:first-child { display: block; color: var(--text); font-size: 15px; }
.instalar p b.inl { color: var(--text); }
.instalar p svg { width: 16px; height: 16px; vertical-align: -3px; color: #4ea1ff; }
.instalar button { color: var(--muted); padding: 6px; font-size: 16px; }
.pill:active { transform: scale(.96); }
.pill svg { width: 20px; height: 20px; }

/* ---------- Painel de registros ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 50;
  transform: translateX(-50%);
  width: 100%; max-width: 480px; height: 86vh;
  display: flex; flex-direction: column;
  background: #0d0d0d; border-radius: 26px 26px 0 0;
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 10px 18px max(18px, env(safe-area-inset-bottom));
  animation: sobe .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes sobe { from { transform: translate(-50%, 100%); } }
.sheet[hidden], .overlay[hidden] { display: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: #333333; margin: 0 auto 10px; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
.sheet-fechar { width: 38px; height: 38px; border-radius: 50%; background: #1a1a1a; display: grid; place-items: center; color: var(--text-2); }
.sheet-fechar svg { width: 18px; height: 18px; }

.busca {
  display: flex; align-items: center; gap: 10px;
  background: #161616; border: 1px solid #262626; border-radius: 14px; padding: 0 14px;
}
.busca:focus-within { border-color: #555555; }
.busca svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.busca input {
  flex: 1; min-width: 0; height: 48px; background: none; border: 0; outline: none;
  color: var(--text); font: inherit; font-size: 16px;
}
.busca input::placeholder { color: var(--muted); }

.filtros { display: flex; gap: 8px; margin: 12px 0 6px; overflow-x: auto; scrollbar-width: none; }
.filtros button {
  flex-shrink: 0; padding: 8px 14px; border-radius: 20px;
  background: #161616; color: var(--text-2); font-size: 14px; font-weight: 600;
}
.filtros button.ativo { background: #f2f2f2; color: #000000; }

.sel-todos { display: flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 14px; color: var(--muted); cursor: pointer; }
.sel-todos span { margin-left: auto; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: #7fcf9a; cursor: pointer; flex-shrink: 0; }

.registros { list-style: none; flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.reg {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid #1a1a1a;
}
.reg.sel { background: rgba(240,163,163,.06); }
.reg-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.reg-desc { font-size: 16px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reg-meta { font-size: 13px; color: var(--muted); }
.reg-valor { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.reg-valor.entrada { color: #7fcf9a; }
.reg-valor.saida, .reg-valor.diario, .reg-valor.fixo { color: var(--text-2); }
.reg-valor.meta { color: var(--gold); }
.reg-del { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.reg-del:hover { color: #f0a3a3; background: rgba(240,163,163,.1); }
.reg-del svg { width: 18px; height: 18px; }
.registros .vazio { color: var(--muted); text-align: center; padding: 40px 0; font-size: 15px; }

.sheet-rodape { padding-top: 12px; flex-shrink: 0; }
.btn-excluir {
  width: 100%; height: 52px; border-radius: 16px;
  background: #e5484d; color: #fff; font-size: 16px; font-weight: 700;
  transition: opacity .2s;
}
.btn-excluir:disabled { opacity: .3; cursor: not-allowed; }

.toast {
  position: fixed; left: 50%; bottom: 100px; z-index: 90;
  transform: translate(-50%, 20px); opacity: 0;
  width: calc(100% - 32px); max-width: 448px;
  background: #161616; border-radius: 22px; padding: 20px 24px;
  font-size: 16px; color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* telas de celular: cartão/transferir só com ícone para tudo caber em uma linha */
@media (max-width: 540px) {
  .pill-mini { width: 44px; padding: 0; justify-content: center; gap: 0; flex-shrink: 0; }
  .pill-mini .rot { display: none; }
  .pill-mini svg { width: 19px; height: 19px; }
}
@media (max-width: 390px) {
  .acoes { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .pill { padding: 0 13px; font-size: 15px; height: 48px; }
  .pill-mini { height: 44px; width: 44px; padding: 0; }
  .gastos li a { font-size: 18px; }
}

/* saúde financeira no topo: anel preenchido conforme a nota (0–100), vermelho → verde */
.saude-btn { padding: 0; }
.saude-anel { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #2a2a2a; }
.saude-anel b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #161616; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
@media (max-width: 380px) { .saude-anel { width: 36px; height: 36px; } .saude-anel b { width: 29px; height: 29px; font-size: 13px; } }

/* fatura do cartão na barra inferior (no lugar do antigo Salvar) */
.pill-fatura { gap: 9px; padding: 0 16px 0 14px; text-align: left; }
.pill-fatura .fat-txt { display: flex; flex-direction: column; line-height: 1.1; }
.pill-fatura small { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.pill-fatura b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 390px) { .pill-fatura { padding: 0 12px 0 11px; gap: 7px; } .pill-fatura b { font-size: 15px; } .pill-fatura small { font-size: 10px; } }
@media (max-width: 420px) { .pill-fatura > svg { display: none; } .pill-fatura { padding: 0 14px; } }
@media (max-width: 340px) { .acoes { gap: 5px; padding-left: 8px; padding-right: 8px; } .pill-add { padding: 0 11px; gap: 4px; font-size: 14px; } .pill-fatura { padding: 0 10px; } .pill-mini { width: 40px; height: 40px; } }

/* Lançamento menor: mesma altura dos outros botões da barra */
.pill-add { height: 44px; padding: 0 16px 0 13px; gap: 6px; font-size: 15px; border-radius: 22px; }
.pill-add svg { width: 17px; height: 17px; }
.pill-fatura { height: 44px; border-radius: 22px; }
@media (max-width: 390px) { .pill-add { height: 44px; padding: 0 13px 0 11px; font-size: 14px; } .pill-fatura { height: 44px; } }
@media (max-width: 340px) { .pill-add { padding: 0 10px 0 9px; font-size: 13px; gap: 4px; } }
