:root {
  --bg: #0a1218;
  --surface: #101c25;
  --surface-2: #162630;
  --line: #1f3340;
  --text: #e8f1f2;
  --muted: #86a0a8;
  --mint: #4fe3b0;
  --mint-ink: #04241a;
  --coral: #ff7a6b;
  --amber: #ffc15a;
  --radius: 20px;
  --nav-h: 68px;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
svg { display: block; }

/* ---------- estrutura ---------- */
#shell { max-width: 620px; margin: 0 auto; padding: 0 18px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(20px + env(safe-area-inset-top)) 0 16px; }
.topbar h2 { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.sair { background: var(--surface); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 40px; }
.sair:hover { color: var(--text); }

.titulo-sec { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 26px 2px 12px; display: flex; align-items: baseline; justify-content: space-between; }
.titulo-sec a, .titulo-sec button { color: var(--mint); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }

/* ---------- menu inferior ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1fr 84px 1fr 1fr; align-items: center;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  background: rgba(10, 18, 24, .94); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; padding: 8px 0; border-radius: 14px; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--mint); }
.tabs a.on svg { filter: none; }
.fab {
  justify-self: center; width: 60px; height: 60px; margin-top: -26px; border-radius: 50%; border: 4px solid var(--bg);
  background: var(--mint); color: var(--mint-ink); cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(79, 227, 176, .28);
}
.fab svg { width: 28px; height: 28px; }
.fab:active { transform: scale(.95); }

/* ---------- cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 12px; }
.card-lista { padding: 4px 16px; }

.hero { padding: 22px 20px 18px; background: linear-gradient(180deg, #132531 0%, var(--surface) 100%); }
.hero .rot { color: var(--muted); font-size: 15px; font-weight: 500; }
.saldo { font-family: var(--display); font-size: 50px; font-weight: 700; letter-spacing: -.035em; line-height: 1.05; margin: 4px 0 18px; }
.saldo.neg { color: var(--coral); }
.pilulas { display: flex; gap: 10px; margin-top: 18px; }
.pilula { flex: 1; background: var(--surface-2); border-radius: 14px; padding: 11px 14px; }
.pilula small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.pilula b { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.pilula.in b { color: var(--mint); }
.pilula.out b { color: var(--coral); }

.barras { display: flex; align-items: flex-end; gap: 3px; height: 76px; }
.barra { position: relative; flex: 1; min-width: 0; height: calc(var(--h, 0) * 1%); min-height: 4px; border-radius: 4px; background: var(--coral); opacity: .55; transform-origin: bottom; animation: sobe .7s cubic-bezier(.2, .7, .2, 1) both; }
.barra.vazia { background: var(--line); opacity: 1; }
.barra.futuro { background: var(--line); opacity: .45; min-height: 3px; }
.barra.hoje { opacity: 1; }
.barra.entrada::before { content: ''; position: absolute; left: 50%; top: -9px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--mint); }
.eixo { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 8px; }
@keyframes sobe { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .barra { animation: none; } * { transition: none !important; } }

/* ---------- linhas de lista ---------- */
.lista { display: flex; flex-direction: column; }
.linha { display: flex; align-items: center; gap: 13px; padding: 14px 0; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit; font: inherit; text-align: left; }
.linha:first-child { border-top: 0; }
button.linha { cursor: pointer; }
.linha .corpo { flex: 1; min-width: 0; }
.linha .tit { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 14px; margin-top: 2px; }
.valor { font-family: var(--display); font-weight: 600; font-size: 17px; white-space: nowrap; letter-spacing: -.01em; }
.valor.in { color: var(--mint); }
.valor.out { color: var(--text); }

.avatar { flex: none; width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 16%, transparent); }
.avatar svg { width: 22px; height: 22px; }
.cat-salario, .cat-receitas { --c: #4fe3b0; }
.cat-moradia { --c: #7aa7ff; }
.cat-mercado { --c: #ffc15a; }
.cat-transporte { --c: #b79cff; }
.cat-saude { --c: #ff8fa3; }
.cat-lazer { --c: #6fe0ff; }
.cat-contas { --c: #ffa86b; }
.cat-dividas { --c: #ff7a6b; }
.cat-outros { --c: #9fb4bb; }

.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.logo { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.chip.atraso { background: color-mix(in srgb, var(--coral) 16%, transparent); color: var(--coral); }
.chip.ok { background: color-mix(in srgb, var(--mint) 16%, transparent); color: var(--mint); }

.vazio { color: var(--muted); padding: 22px 0; text-align: center; }
.dia-cab { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 4px 8px; }
.dia-cab b { font-family: var(--display); font-size: 17px; font-weight: 600; }
.dia-cab span { color: var(--muted); font-size: 14px; }

/* ---------- agenda em linha do tempo ---------- */
.tempo { position: relative; padding-left: 4px; }
.evento { display: flex; gap: 14px; padding: 12px 0; align-items: flex-start; width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; }
button.evento { cursor: pointer; }
.hora { flex: none; width: 52px; color: var(--muted); font-size: 14px; font-weight: 600; padding-top: 2px; }
.ponto { flex: none; width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 18%, transparent); }
.evento.feito .ponto { background: var(--line); box-shadow: none; }
.evento.feito .tit { color: var(--muted); text-decoration: line-through; }
.evento .corpo { flex: 1; min-width: 0; }
.evento .tit { font-weight: 600; }

/* ---------- dívidas ---------- */
.anel { flex: none; width: 56px; height: 56px; }
.anel circle { fill: none; stroke-width: 4; }
.anel .fundo { stroke: var(--surface-2); }
.anel .frente { stroke: var(--mint); stroke-linecap: round; }
.anel text { fill: var(--text); font-family: var(--display); font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.cartao-divida { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }

/* ---------- controles ---------- */
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; font: inherit; font-size: 15px; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 11px 14px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.barra-ferr { display: flex; gap: 10px; margin-bottom: 4px; align-items: center; }
.barra-ferr input { flex: 1; }

.btn { font: inherit; font-weight: 700; font-size: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 12px 18px; cursor: pointer; min-height: 48px; }
.btn.primary { background: var(--mint); color: var(--mint-ink); border-color: var(--mint); }
.btn.danger { color: var(--coral); }
.btn.small { padding: 8px 16px; font-size: 14px; border-radius: 12px; min-height: 40px; }
.btn.block { width: 100%; font-size: 17px; min-height: 54px; }
.btn:disabled { opacity: .5; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
input, select { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; min-height: 52px; }
input:focus, select:focus, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; accent-color: var(--mint); flex: none; }
.check { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-weight: 600; }

/* ---------- gaveta (formulários) ---------- */
.sheet-fundo { position: fixed; inset: 0; background: rgba(2, 8, 12, .7); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 620px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
.sheet h3 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 18px; }
.sheet .acoes { display: flex; gap: 10px; margin-top: 6px; }
.sheet .acoes .btn { flex: 1; }
.menu { display: grid; gap: 10px; }
.menu button { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; font-size: 17px; }
.erro { color: var(--coral); font-size: 14px; min-height: 20px; margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 38px); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--coral); color: #2a0a06; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-family: var(--display); font-size: 40px; font-weight: 700; letter-spacing: -.03em; margin: 20px 0 4px; }
.login-box form { margin-top: 28px; }
.logo-mark { width: 60px; height: 60px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: center; gap: 5px; padding: 15px; }
.logo-mark i { width: 7px; background: var(--mint); border-radius: 3px; display: block; }
.logo-mark i:nth-child(1) { height: 40%; opacity: .55; }
.logo-mark i:nth-child(2) { height: 65%; opacity: .8; }
.logo-mark i:nth-child(3) { height: 100%; }

button.corpo { background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 0; cursor: pointer; }
.espaco { height: 12px; }
.card.cartao-divida { padding: 18px; }

.direita { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.chip { white-space: nowrap; }
.linha .tit { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
