/* =========================================================
   PROSPERIDADE — estilos
   Cores da marca ficam nas variáveis abaixo (:root).
   ========================================================= */
:root {
  color-scheme: light;
  --bg: #faf7f9;
  --surface: #ffffff;
  --surface-2: #f5f0f4;
  --ink: #1d1720;
  --ink-2: #4f4554;
  --muted: #7d7282;
  --line: #ece4ea;
  --primary: #8b3a6b;
  --primary-2: #5f2a6e;
  --primary-ink: #ffffff;
  --primary-soft: #f6e9f1;
  --track: #efe5ec;
  --good: #13805a;
  --good-soft: #e5f5ee;
  --danger: #c93838;
  --danger-soft: #fdeceb;
  --warn: #9a5c00;
  --warn-soft: #fff3df;
  --info-soft: #eef0fb;
  --c-income: #1baf7a;
  --c-expense: #eb6834;
  --shadow: 0 1px 2px rgba(60, 20, 50, .04), 0 6px 24px rgba(60, 20, 50, .06);
  --shadow-lg: 0 12px 48px rgba(40, 10, 35, .18);
  --radius: 20px;
  --radius-sm: 14px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #17131a; --surface: #211b25; --surface-2: #2a2330; --ink: #f4eef6; --ink-2: #cfc4d3; --muted: #9d92a3; --line: #352c3b;
    --primary: #dc93bd; --primary-2: #a861b8; --primary-ink: #2a0f20; --primary-soft: #3a2434; --track: #3a3040;
    --good: #4cc795; --good-soft: #17322a; --danger: #f27b7b; --danger-soft: #3a1f22; --warn: #f0b14f; --warn-soft: #3a2c16; --info-soft: #262840;
    --c-income: #199e70; --c-expense: #d95926;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 48px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17131a; --surface: #211b25; --surface-2: #2a2330; --ink: #f4eef6; --ink-2: #cfc4d3; --muted: #9d92a3; --line: #352c3b;
  --primary: #dc93bd; --primary-2: #a861b8; --primary-ink: #2a0f20; --primary-soft: #3a2434; --track: #3a3040;
  --good: #4cc795; --good-soft: #17322a; --danger: #f27b7b; --danger-soft: #3a1f22; --warn: #f0b14f; --warn-soft: #3a2c16; --info-soft: #262840;
  --c-income: #199e70; --c-expense: #d95926;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 48px rgba(0, 0, 0, .5);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 700; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
b, strong { font-weight: 700; }
.ic { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.txt-good { color: var(--good); }
.txt-danger { color: var(--danger); }
.txt-strong { color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.stack-8 > * + * { margin-top: 8px; } .stack-12 > * + * { margin-top: 12px; } .stack-16 > * + * { margin-top: 16px; }
.row-8 { display: flex; align-items: center; gap: 8px; } .row-12 { display: flex; gap: 12px; } .row-16 { display: flex; align-items: center; gap: 16px; }
.grow { flex: 1; min-width: 0; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 8px; }

/* ---------- layout ---------- */
#app { min-height: 100dvh; }
.view { padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); max-width: 640px; margin: 0 auto; }
.page.enter { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
#sidebar { display: none; }

/* menu inferior */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
#tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 0; }
#tabbar a.on { color: var(--primary); }
#tabbar a.on .ic { stroke-width: 2.3; }
.fab {
  justify-self: center; width: 58px; height: 58px; border-radius: 20px; margin-top: -26px;
  background: linear-gradient(140deg, var(--primary), var(--primary-2)); color: var(--primary-ink);
  display: grid; place-items: center; box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 45%, transparent);
  transition: transform .15s ease;
}
.fab:active { transform: scale(.94); }
.is-onb #tabbar, .is-onb #sidebar { display: none !important; }

/* ---------- cabeçalhos ---------- */
.home-head, .page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.page-head h1 { font-size: 22px; }
.page-head p { font-size: 13px; margin-top: 2px; }
.hello { font-size: 22px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 34px; height: 34px; }
.back-btn { margin-left: -8px; }

.month-switch { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px; margin-bottom: 14px; }
.month-label { font-weight: 700; font-size: 15px; padding: 8px 12px; border-radius: 10px; }

/* ---------- cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; display: block; width: 100%; text-align: left; }
.card-flush { padding: 4px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.link-btn { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 13px; color: var(--primary); padding: 6px 0; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 8px; }

/* herói (saldo) */
.hero-card {
  position: relative; overflow: hidden; border-radius: 24px; padding: 20px; margin-bottom: 14px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #b45c8f 0%, transparent 55%), linear-gradient(140deg, #8b3a6b, #4e2560);
  box-shadow: 0 14px 34px rgba(95, 42, 110, .28);
}
.hero-card::after { content: ''; position: absolute; width: 220px; height: 220px; right: -80px; bottom: -110px; border-radius: 50%; background: rgba(255, 255, 255, .07); pointer-events: none; }
.hero-label { font-size: 13px; font-weight: 600; opacity: .85; }
.hero-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0 12px; font-variant-numeric: tabular-nums; }
.hero-value.sm { font-size: 26px; margin: 2px 0; }
.hero-bar { height: 6px; background: rgba(255, 255, 255, .22); border-radius: 99px; overflow: hidden; }
.hero-bar i { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .6s ease; }
.hero-sub { font-size: 12px; opacity: .85; margin-top: 6px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.hero-stat { display: flex; flex-direction: column; gap: 6px; background: rgba(255, 255, 255, .12); border-radius: 14px; padding: 10px; text-align: left; color: #fff; min-width: 0; }
.hero-stat small { display: block; font-size: 11px; opacity: .85; }
.hero-stat b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); }
.hero-soft { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero-soft::after { display: none; }
.hero-soft .hero-label, .hero-soft .hero-sub { opacity: 1; color: var(--muted); }
.inv-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; z-index: 1; }
.inv-split div { background: rgba(255, 255, 255, .12); border-radius: 12px; padding: 10px; min-width: 0; }
.inv-split small { display: block; font-size: 11px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-split b { font-size: 13px; font-variant-numeric: tabular-nums; }

/* mensagem inteligente */
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; margin-bottom: 14px; font-size: 14px; font-weight: 500; }
.insight .ic { margin-top: 1px; }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--primary-soft); color: var(--primary); }
.insight p { color: var(--ink); }

/* atalhos */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 12px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; transition: transform .12s; }
.qa:active { transform: scale(.96); }
.qa-ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; }
.qa-ic.out, .hs-ic.out { color: var(--danger); background: var(--danger-soft); }
.qa-ic.in, .hs-ic.in { color: var(--good); background: var(--good-soft); }
.qa-ic.fix { color: var(--primary); background: var(--primary-soft); }
.qa-ic.par { color: var(--warn); background: var(--warn-soft); }
.hero-card .hs-ic { color: #fff; background: rgba(255, 255, 255, .2); }

/* ---------- listas de lançamentos ---------- */
.tx-list { display: flex; flex-direction: column; }
.tx { display: flex; align-items: center; gap: 4px; position: relative; }
.card-flush .tx { padding: 0 8px 0 4px; }
.card-flush .tx + .tx::before, .card-flush .list-row + .list-row::before { content: ''; position: absolute; top: 0; left: 60px; right: 12px; border-top: 1px solid var(--line); }
.tx-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 6px; text-align: left; border-radius: 14px; }
.tx-btn:not(.static):hover { background: var(--surface-2); }
.tx-ico { width: 40px; height: 40px; border-radius: 13px; background: var(--surface-2); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; color: var(--primary); }
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tx-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amt { text-align: right; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.tx-amt b { font-weight: 700; white-space: nowrap; }
.tx-amt.income b { color: var(--good); }
.tx-amt.invest b { color: var(--primary); }
.tx-amt small { font-size: 11px; }
.is-pending .tx-amt b { opacity: .75; }
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex-shrink: 0; margin-left: 4px; transition: all .15s; }
.check:hover { border-color: var(--primary); }
.check.on { background: var(--good); border-color: var(--good); color: #fff; animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.18); } }
.tx-list:not(.card-flush) .tx { margin: 0 -6px; }

.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; position: relative; }
.list-row:hover { background: var(--surface-2); }
.list-row.danger, .list-row.danger .tx-ico { color: var(--danger); }

.day-group { margin-bottom: 4px; }
.day-title { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 6px 6px; font-variant-numeric: tabular-nums; }
.day-title span:first-child::first-letter { text-transform: uppercase; }
.day-title span:first-child { display: inline-block; }

.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; }
.summary-strip div { padding: 10px 12px; min-width: 0; }
.summary-strip div + div { border-left: 1px solid var(--line); }
.summary-strip small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.summary-strip b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; color: var(--muted); margin-bottom: 10px; }
.search input { flex: 1; border: 0; background: none; padding: 12px 0; outline: none; color: var(--ink); min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 2px 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- barras e categorias ---------- */
.bar { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.over i { background: var(--danger); }
.bar-lg { height: 10px; }
.cat-list { display: flex; flex-direction: column; gap: 12px; }
.cat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cat-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-val { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-row small { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.kv-list { list-style: none; margin: 0; padding: 0; }
.kv-list li { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.kv-list li + li { border-top: 1px solid var(--line); }
.kv-list span { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }

.budget-row { padding: 12px 16px; position: relative; }
.budget-row + .budget-row { border-top: 1px solid var(--line); }
.budget-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.budget-input input { width: 128px; text-align: right; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-weight: 700; font-variant-numeric: tabular-nums; outline: none; }
.budget-input input:focus { border-color: var(--primary); background: var(--surface); }
.budget-row small { font-size: 12px; }

/* ---------- metas ---------- */
.ring-text { font-size: 13px; font-weight: 800; fill: var(--ink); font-family: var(--font); }
.hero-card:not(.hero-soft) .ring-text { fill: #fff; }
.goal-scroll { display: flex; flex-direction: column; gap: 8px; }
.goal-mini { display: flex; align-items: center; gap: 12px; text-align: left; padding: 6px; border-radius: 14px; margin: 0 -6px; }
.goal-mini:hover { background: var(--surface-2); }
.goal-mini .ring-text { font-size: 12px; }
.goal-mini b { display: block; font-size: 14px; font-weight: 600; }
.goal-mini small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.goal-grid { display: grid; gap: 0; }
.goal-card { cursor: pointer; transition: transform .12s; }
.goal-card:active { transform: scale(.99); }
.goal-top { display: flex; align-items: center; gap: 12px; }
.goal-emoji { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); display: grid; place-items: center; font-size: 22px; }
.goal-info { flex: 1; min-width: 0; }
.goal-info b { display: block; font-size: 15px; }
.goal-info small { font-size: 12px; }
.goal-pct { font-weight: 800; color: var(--primary); }
.goal-card .bar { margin: 14px 0 8px; }
.goal-nums { font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.goal-detail { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 4px 0 16px; }
.goal-detail .ring-text { font-size: 22px; }
.goal-detail .note { margin-top: 10px; }
.add-contrib { display: flex; align-items: flex-end; gap: 10px; }
.add-contrib .field { flex: 1; }

/* ---------- gráfico de barras ---------- */
.bchart { position: relative; height: calc(var(--h) + 28px); }
.bc-grid { position: absolute; inset: 0 0 28px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.bc-grid span { border-top: 1px dashed var(--line); position: relative; height: 0; }
.bc-grid span:last-child { border-top: 1px solid var(--line); }
.bc-grid span[data-v]::after { content: attr(data-v); position: absolute; left: 0; top: -15px; font-size: 10px; color: var(--muted); font-weight: 600; }
.bchart { margin-top: 14px; }
.bc-col.is-future .bc-bar { opacity: .4; }
.table-wrap { overflow-x: auto; }
.table-note { padding: 8px 12px 6px; }
.bc-cols { position: absolute; inset: 0; display: flex; }
.bc-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; border-radius: 10px; }
.bc-bars { flex: 1; width: 100%; display: flex; justify-content: center; align-items: flex-end; gap: 2px; height: var(--h); max-height: var(--h); }
.bc-bar { display: block; width: min(14px, 34%); border-radius: 4px 4px 0 0; transition: height .6s cubic-bezier(.2, .8, .2, 1), opacity .15s; }
.bc-label { font-size: 11px; color: var(--muted); height: 28px; line-height: 28px; font-weight: 600; }
.bc-col.is-current .bc-label { color: var(--ink); font-weight: 800; }
.bc-col.active { background: var(--surface-2); }
.bchart:has(.bc-col.active) .bc-col:not(.active) .bc-bar { opacity: .45; }
.chart-tip { position: absolute; top: -8px; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); border-radius: 12px; padding: 8px 12px; font-size: 12px; min-width: 160px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 5; box-shadow: var(--shadow-lg); }
.chart-tip.show { opacity: 1; }
.chart-tip strong { display: block; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tip-row i { width: 8px; height: 8px; border-radius: 3px; }
.tip-row b { margin-left: auto; padding-left: 10px; }
.tip-extra { border-top: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); margin-top: 4px; padding-top: 4px; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { margin: 0; padding: 14px; }
.stat small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; font-weight: 700; }
.table td { text-align: right; padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-current td:first-child { font-weight: 800; color: var(--primary); }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line); }
@media (max-width: 420px) { .table th, .table td { padding: 10px 6px; font-size: 12px; } .table th:first-child, .table td:first-child { padding-left: 12px; } }

/* ---------- menu "Mais" ---------- */
.menu-grid { display: grid; gap: 0; }
.menu-item { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.menu-item b { display: block; }
.menu-item small { font-size: 12px; }
.menu-item > span:nth-child(2) { flex: 1; }
.menu-ic { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }

/* ---------- vazio ---------- */
.empty { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-emoji { font-size: 44px; width: 88px; height: 88px; border-radius: 28px; background: var(--primary-soft); display: grid; place-items: center; margin-bottom: 6px; }
.empty p { max-width: 320px; margin-bottom: 10px; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 15px; transition: transform .12s, filter .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-lg { height: 54px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(140deg, var(--primary), var(--primary-2)); color: var(--primary-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost-danger { color: var(--danger); background: var(--danger-soft); }

/* ---------- formulários ---------- */
.field { display: block; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field input[type=month], .field input[type=number], .field .money-input {
  width: 100%; height: 50px; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 0 14px; font-size: 16px; outline: none; transition: border-color .15s, background .15s; -webkit-appearance: none; appearance: none;
}
.field input:focus { border-color: var(--primary); background: var(--surface); }
.field-money-big .money-input { height: 64px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; text-align: center; background: var(--surface); }
.field-money-big .field-label { text-align: center; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.emoji-field { width: 80px; }
.emoji-field input { text-align: center; font-size: 22px !important; }

.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 40px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-kind button.on.out { color: var(--danger); }
.seg-kind button.on.in { color: var(--good); }
.seg-sm button { height: 36px; font-size: 13px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .12s; color: var(--ink-2); }
.pick em { font-style: normal; }
.pick input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--ink); }
.pick input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pick-emoji span { width: 100%; justify-content: center; font-size: 22px; padding: 8px 0; }

.stepper { display: flex; align-items: center; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; height: 50px; }
.stepper button { width: 44px; height: 100%; font-size: 22px; font-weight: 600; color: var(--primary); }
.field .stepper input { border: 0; background: none; text-align: center; height: 100%; padding: 0; width: 100%; min-width: 0; font-weight: 700; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.inst-box { background: var(--surface-2); border-radius: 16px; padding: 12px; }
.inst-box .stepper, .inst-box .seg { background: var(--surface); }
.inst-box .seg button.on { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.inst-box .field-label { font-size: 12px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch-row span b { display: block; font-weight: 600; }
.switch-row small { font-size: 12px; display: block; }
.switch { -webkit-appearance: none; appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--track); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }

.note { display: block; position: relative; font-size: 13px; padding: 10px 12px 10px 36px; border-radius: 12px; background: var(--primary-soft); color: var(--ink-2); text-align: left; }
.note .ic { color: var(--primary); position: absolute; left: 12px; top: 11px; }
.note.good { background: var(--good-soft); }
.note.good .ic { color: var(--good); }

/* ---------- gaveta (bottom sheet) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 8, 20, .45); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 94dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .9, .25, 1);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 8px auto 0; flex-shrink: 0; cursor: pointer; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 4px 20px; flex-shrink: 0; }
.sheet-head h2 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { overflow-y: auto; padding: 8px 20px 20px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex-shrink: 0; background: var(--surface); border-radius: 0 0 26px 26px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all .25s;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); width: max-content;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-btn { color: var(--primary-soft); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
:root[data-theme="dark"] .toast-btn { color: var(--primary-2); }

/* ---------- boas-vindas ---------- */
.onb { max-width: 420px; margin: 0 auto; min-height: calc(100dvh - 40px); display: flex; flex-direction: column; justify-content: center; padding: 24px 4px; }
.onb > * + * { margin-top: 14px; }
.onb h1 { font-size: 32px; letter-spacing: -.03em; }
.onb-lead { font-size: 17px; color: var(--ink-2); }
.onb-art { display: flex; gap: 12px; margin-bottom: 18px; }
.onb-art span { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; font-size: 30px; background: var(--primary-soft); animation: float 3s ease-in-out infinite; }
.onb-art span:nth-child(2) { animation-delay: .4s; background: var(--good-soft); }
.onb-art span:nth-child(3) { animation-delay: .8s; background: var(--warn-soft); }
@keyframes float { 50% { transform: translateY(-6px); } }
.onb-list { list-style: none; padding: 0; margin: 18px 0 10px; display: flex; flex-direction: column; gap: 10px; font-weight: 600; }
.onb-list li { display: flex; gap: 10px; align-items: center; }
.onb-list .ic { color: var(--good); background: var(--good-soft); border-radius: 8px; padding: 3px; width: 26px; height: 26px; }
.onb-step { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; }

.hide-mobile { display: none; }

/* =========================================================
   EMPRESA × PESSOAL
   A empresa tem um tom azul-petróleo; o pessoal, o ameixa da marca.
   Assim a pessoa sempre sabe em qual "bolso" está.
   ========================================================= */
:root { --emp: #17607a; --emp-2: #0f3a52; --emp-soft: #e3f1f5; --emp-ink: #ffffff; --brand: #8b3a6b; --brand-soft: #f6e9f1; }
:root[data-theme="dark"] { --emp: #5fb3cf; --emp-2: #2b7a96; --emp-soft: #16323b; --emp-ink: #06202b; --brand: #dc93bd; --brand-soft: #3a2434; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --emp: #5fb3cf; --emp-2: #2b7a96; --emp-soft: #16323b; --emp-ink: #06202b; --brand: #dc93bd; --brand-soft: #3a2434; } }
/* No bolso Empresa, a cor principal do app inteiro vira azul-petróleo */
body[data-space="empresa"] { --primary: var(--emp); --primary-2: var(--emp-2); --primary-soft: var(--emp-soft); --primary-ink: var(--emp-ink); }

.space-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.space-switch button { height: 44px; border-radius: 12px; font-weight: 700; font-size: 15px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .15s; }
.space-switch button.on { background: var(--surface); box-shadow: var(--shadow); }
.space-switch .sp-empresa.on { color: var(--emp); box-shadow: inset 0 -3px 0 var(--emp), var(--shadow); }
.space-switch .sp-pessoal.on { color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand), var(--shadow); }

.hero-empresa { background: radial-gradient(120% 140% at 100% 0%, #2b8aa8 0%, transparent 55%), linear-gradient(140deg, #17607a, #0d2f45); box-shadow: 0 14px 34px rgba(13, 47, 69, .28); }
body[data-space="empresa"] .fab { background: linear-gradient(140deg, #1d7593, #0f3a52); box-shadow: 0 8px 22px rgba(15, 58, 82, .4); }

.space-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 99px; }
.space-tag.sp-empresa { background: var(--emp-soft); color: var(--emp); }
.space-tag.sp-pessoal { background: var(--brand-soft); color: var(--brand); }
.space-line { align-items: center; }
.flow { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }

.pill-good { background: var(--good-soft); color: var(--good); }
.tx-ico.tr { background: var(--emp-soft); }
.tx-amt.transfer b { color: var(--emp); }
.is-mixed .tx-amt.transfer b { color: var(--warn); }
.check-spacer { width: 28px; margin-left: 4px; flex-shrink: 0; }

.pro-card .pro-nums { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.pro-card .pro-nums small { display: block; font-size: 12px; }
.pro-card .pro-nums b { font-size: 18px; }
.pro-card .pro-nums .right { text-align: right; }
.mix-alert { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.mix-alert p { color: var(--ink); }
.note.warn { background: var(--warn-soft); }
.note.warn .ic { color: var(--warn); }

.pick-btn { padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--ink-2); border: 1.5px solid var(--line); }
.pick-btn:active { transform: scale(.97); }

.guide { border: 1.5px dashed var(--emp); background: linear-gradient(180deg, var(--emp-soft), var(--surface) 70%); }
.guide h2 { display: flex; align-items: center; gap: 8px; color: var(--emp); }
.guide-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.guide-list li { display: flex; gap: 12px; align-items: flex-start; }
.guide-list b { display: block; font-size: 14px; }
.guide-list small { display: block; color: var(--muted); font-size: 13px; }
.g-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--emp); color: #fff; flex-shrink: 0; }
.guide-list li.done .g-num { background: var(--good); }
.guide-list li.done b { text-decoration: line-through; color: var(--muted); }
.guide-done { border-style: solid; }
.guide-done .g-num { background: var(--good); }
.guide-done b { display: block; }
.guide-done small { display: block; font-size: 13px; }

.faq { padding: 0; margin: 0; }
.faq summary { list-style: none; cursor: pointer; padding: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq[open] summary .ic { transform: rotate(90deg); }
.faq p { padding: 0 16px 16px; font-size: 14px; }
/* ---------- login ---------- */
.auth { max-width: 420px; margin: 0 auto; min-height: calc(100dvh - 40px); display: flex; flex-direction: column; justify-content: center; padding: 16px 0; }
.auth-brand { text-align: center; margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.auth-brand h1 { font-size: 28px; letter-spacing: -.03em; }
.brand-mark.big { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #8b3a6b, #4e2560); box-shadow: 0 10px 26px rgba(95, 42, 110, .3); margin-bottom: 6px; }
.auth-card { padding: 20px; }
.auth-tabs { margin-bottom: 18px; }
.auth-title { font-size: 20px; margin-bottom: 6px; }
.auth-msg { font-size: 14px; padding: 10px 12px; border-radius: 12px; display: flex; gap: 8px; align-items: flex-start; }
.auth-msg.error { background: var(--danger-soft); color: var(--danger); }
.auth-msg.ok { background: var(--good-soft); color: var(--good); }
.auth-legal { text-align: center; }
.auth a, .page a.inline, .center a { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.auth-sent { text-align: center; display: flex; flex-direction: column; align-items: center; }
.auth-sent .empty-emoji { margin-bottom: 12px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px !important; }
.field input[type=email], .field input[type=password] { width: 100%; height: 50px; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 0 14px; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
.field input[type=email]:focus, .field input[type=password]:focus { border-color: var(--primary); background: var(--surface); }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 10px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3.5px solid var(--track); border-top-color: var(--primary); animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 20px; height: 20px; border-width: 2.5px; border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn:disabled { opacity: .8; cursor: wait; }
.sync-badge { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--good); }
.sync-badge.s-saving { color: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
.sync-badge.s-offline, .sync-badge.s-error { color: var(--warn); }
@keyframes pulse { 50% { opacity: .4; } }

.list-row.boxed { border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface-2); }

/* =========================================================
   DESKTOP / TABLET
   ========================================================= */
@media (min-width: 960px) {
  body { font-size: 15px; }
  #app:not(.is-onb) { display: grid; grid-template-columns: 260px 1fr; }
  #sidebar {
    display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh; padding: 22px 16px;
    border-right: 1px solid var(--line); background: var(--surface);
  }
  .brand { display: flex; align-items: center; gap: 10px; font-size: 19px; padding: 0 8px; letter-spacing: -.02em; }
  .brand-mark { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(140deg, var(--primary), var(--primary-2)); color: var(--primary-ink); display: grid; place-items: center; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; font-weight: 600; color: var(--ink-2); }
  .side-nav a:hover { background: var(--surface-2); }
  .side-nav a.on { background: var(--primary-soft); color: var(--primary); }
  .side-nav hr { border: 0; border-top: 1px solid var(--line); margin: 10px 4px; width: auto; }
  .side-foot { padding: 0 8px; }
  #tabbar { display: none; }
  .view { max-width: 1120px; padding: 28px 40px 48px; margin: 0; width: 100%; }
  .page:not(.page-inicio) { max-width: 760px; }
  .hide-mobile { display: inline-flex; }
  .home-head .hello { font-size: 28px; }
  .page-head h1 { font-size: 28px; }
  .month-switch { max-width: 380px; }
  .grid-home { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .hero-value { font-size: 42px; }
  .goal-grid, .menu-grid { grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  #toast { bottom: 28px; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; max-height: 88dvh; border-radius: 26px; transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform .25s ease, opacity .2s; }
  .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-sm { width: 420px; }
  .sheet-handle { display: none; }
  .sheet-head { padding-top: 14px; }
}
@media (min-width: 640px) and (max-width: 959px) {
  .goal-grid, .menu-grid { grid-template-columns: 1fr 1fr; gap: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
