/* =========================================================
   NOSSO COFRE
   Ideia visual: cada pessoa tem uma cor (azul e coral).
   O que é "nosso" é violeta — a mistura das duas.
   Latão = o cofre, as moedas, a ação principal.
   ========================================================= */
:root {
  --bg: #F3F1FA;
  --surface: #FFFFFF;
  --surface-2: #EAE6F6;
  --ink: #1F1B3A;
  --ink-2: #5A5577;
  --ink-3: #8E89A8;
  --line: #DEDAEC;
  --brass: #E3B23C;
  --brass-deep: #B8861A;
  --brass-soft: #FBF0D2;
  --a: #3E7BFA;
  --a-soft: #E3ECFF;
  --b: #FF6B8B;
  --b-soft: #FFE5EB;
  --us: #7A5CFA;
  --us-soft: #ECE6FF;
  --good: #14936B;
  --good-soft: #DDF3EA;
  --bad: #D93D4A;
  --bad-soft: #FBE3E5;
  --vault: #1F1B3A;
  --vault-2: #2C2752;
  --shadow: 0 1px 0 rgba(31, 27, 58, .04), 0 8px 24px -12px rgba(31, 27, 58, .18);
  --r-s: 10px; --r-m: 16px; --r-l: 24px;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --text: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14112A; --surface: #1E1A3A; --surface-2: #2A2550; --ink: #F2EFFF; --ink-2: #B9B3D9; --ink-3: #8781AB;
    --line: #342F5E; --brass-soft: #3A3018; --a-soft: #1D2A55; --b-soft: #4A1F2C; --us-soft: #2E2463;
    --good-soft: #123A2E; --bad-soft: #43191E; --vault: #0E0B20; --vault-2: #221D45;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -14px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14112A; --surface: #1E1A3A; --surface-2: #2A2550; --ink: #F2EFFF; --ink-2: #B9B3D9; --ink-3: #8781AB;
  --line: #342F5E; --brass-soft: #3A3018; --a-soft: #1D2A55; --b-soft: #4A1F2C; --us-soft: #2E2463;
  --good-soft: #123A2E; --bad-soft: #43191E; --vault: #0E0B20; --vault-2: #221D45;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 10px 30px -14px rgba(0,0,0,.6); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text);
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--us); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.02em; line-height: 1.1; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }

/* ---------- casca do app ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar .title { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.02em; flex: 1; }
.month-switch { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.month-switch button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.month-switch button:hover { background: var(--surface-2); }
.month-switch span { min-width: 92px; text-align: center; font-weight: 700; font-size: 15px; text-transform: capitalize; }
.duo { display: inline-flex; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: #fff; border: 2px solid var(--bg); flex: none;
}
.avatar.a { background: var(--a); }
.avatar.b { background: var(--b); }
.avatar.us { background: var(--us); }
.duo .avatar + .avatar { margin-left: -10px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

main.page { max-width: 760px; margin: 0 auto; padding: 4px 16px 0; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a, .link { color: var(--us); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; }
.panel { background: var(--surface); border-radius: var(--r-l); padding: 18px; box-shadow: var(--shadow); }
.panel.flush { padding: 6px 0; }

/* ---------- navegação ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 0; }
.nav button svg { width: 24px; height: 24px; }
.nav button[aria-current="page"] { color: var(--ink); }
.nav .add-btn { position: relative; }
.fab {
  width: 60px; height: 60px; border-radius: 22px; background: var(--brass); color: var(--vault); display: grid; place-items: center;
  margin-top: -26px; box-shadow: 0 10px 22px -8px rgba(184, 134, 26, .7), inset 0 -3px 0 rgba(0,0,0,.12); transition: transform .15s;
}
.fab svg { width: 28px; height: 28px; }
.fab:active { transform: scale(.94); }

@media (min-width: 960px) {
  .shell { padding-bottom: 40px; padding-left: 248px; }
  .nav {
    top: 0; right: auto; width: 248px; height: 100dvh; border-top: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; align-items: stretch; padding: 24px 16px; gap: 4px;
  }
  .nav .brand { display: flex; order: -2; }
  .nav button { flex-direction: row; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 12px; }
  .nav button:hover { background: var(--surface-2); }
  .nav button[aria-current="page"] { background: var(--us-soft); color: var(--us); }
  .nav .add-btn { order: -1; margin: 8px 0 18px; }
  .nav .add-btn .fab { margin: 0; width: 100%; height: 48px; border-radius: 14px; display: flex; gap: 8px; font-weight: 700; font-size: 15px; }
  .nav .add-btn .fab::after { content: 'Lançar'; }
  .nav .add-btn > span:last-child { display: none; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  main.page { padding: 8px 24px 0; }
}
@media (max-width: 959px) { .nav .brand { display: none; } }
.nav .brand { align-items: center; gap: 10px; padding: 0 8px 18px; font-family: var(--display); font-weight: 800; font-size: 20px; }
.nav .brand img { width: 34px; height: 34px; }

/* ---------- O COFRE (destaque da tela inicial) ---------- */
.vault {
  position: relative; background: radial-gradient(120% 90% at 50% 0%, var(--vault-2), var(--vault) 70%); color: #F2EFFF;
  border-radius: 32px; padding: 22px 18px 18px; overflow: hidden; box-shadow: 0 24px 50px -28px rgba(31, 27, 58, .8);
}
.vault-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #BDB6E3; }
.dial-wrap { position: relative; width: min(280px, 78vw); aspect-ratio: 1; margin: 6px auto 4px; }
.dial-wrap svg { width: 100%; height: 100%; display: block; }
.dial-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.dial-center .label { font-size: 14px; color: #BDB6E3; }
.dial-center .big { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 9vw, 40px); letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.dial-center .big.neg { color: #FF8C96; }
.dial-center .sub { font-size: 13px; color: #9C95C6; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 13px; color: #CFC9F0; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.vault-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.vault-stats div { background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px 12px; }
.vault-stats span { display: block; font-size: 12px; color: #A9A2D2; }
.vault-stats b { display: block; white-space: nowrap; font-family: var(--display); font-size: clamp(14px, 4.2vw, 17px); font-weight: 700; font-variant-numeric: tabular-nums; }
.dial-ring { transition: stroke-dasharray .9s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: reduce) { .dial-ring { transition: none; } }

/* ---------- linhas e listas ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; width: 100%; text-align: left; }
button.row:hover { background: var(--surface-2); }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row > svg { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.btn svg, .link svg { width: 18px; height: 18px; flex: none; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ico {
  --c: var(--ink-2); width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; position: relative;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); font-size: 21px;
}
:root[data-theme="dark"] .ico { background: color-mix(in srgb, var(--c) 24%, var(--surface)); color: color-mix(in srgb, var(--c) 55%, #fff); }
.ico.solid { background: var(--c); color: #fff; }
.ico.sm { width: 30px; height: 30px; border-radius: 10px; }
.ico.lg { width: 56px; height: 56px; border-radius: 18px; }
.emo { font-size: 20px; line-height: 1; }
.ico .who { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); }
.who.a { background: var(--a); } .who.b { background: var(--b); } .who.us { background: var(--us); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag.a { background: var(--a-soft); color: var(--a); } .tag.b { background: var(--b-soft); color: #D6466A; } .tag.us { background: var(--us-soft); color: var(--us); }
.tag.good { background: var(--good-soft); color: var(--good); } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.brass { background: var(--brass-soft); color: var(--brass-deep); }
.day-head { font-size: 14px; font-weight: 700; color: var(--ink-2); padding: 18px 4px 8px; display: flex; justify-content: space-between; }

.check {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: transparent; transition: background .15s, border-color .15s;
}
.check.on { background: var(--good); border-color: var(--good); color: #fff; }
.check svg { width: 16px; height: 16px; }

/* barras */
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--us); }
.bar.warn > i { background: var(--brass); } .bar.over > i { background: var(--bad); } .bar.good > i { background: var(--good); }
.budget-row { padding: 14px 18px; display: grid; grid-template-columns: 42px 1fr; gap: 6px 12px; align-items: center; width: 100%; text-align: left; }
.budget-row + .budget-row { border-top: 1px solid var(--line); }
.budget-row .bar { grid-column: 2; }
.budget-row .line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }

/* metas */
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.goal { background: var(--surface); border-radius: var(--r-l); padding: 16px; box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.goal .em { font-size: 30px; line-height: 1; }
.goal .amt { font-family: var(--display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.goal-jar { display: flex; gap: 12px; align-items: center; }
.ring-mini { width: 54px; height: 54px; flex: none; }

/* chips e segmentos */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap;
}
.chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.chip.a[aria-pressed="true"] { border-color: var(--a); color: var(--a); background: var(--a-soft); }
.chip.b[aria-pressed="true"] { border-color: var(--b); color: #D6466A; background: var(--b-soft); }
.chip.us[aria-pressed="true"] { border-color: var(--us); color: var(--us); background: var(--us-soft); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 4px; border-radius: 14px; gap: 4px; }
.seg button { height: 38px; border-radius: 10px; font-weight: 700; font-size: 15px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.out button[aria-pressed="true"] { color: var(--bad); }
.seg.in button[aria-pressed="true"] { color: var(--good); }
.tabs { display: flex; gap: 6px; margin: 4px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 700; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }

/* ---------- botões e formulários ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 22px; border-radius: 16px;
  font-weight: 700; font-size: 16px; background: var(--ink); color: var(--bg); transition: transform .1s, opacity .15s; white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn.brass { background: var(--brass); color: var(--vault); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .lbl { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input {
  height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 14px; width: 100%; font-size: 16px;
}
.input:focus { outline: none; border-color: var(--us); box-shadow: 0 0 0 3px var(--us-soft); }
.input.money { font-family: var(--display); font-weight: 700; font-size: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--ink-3); }

/* ---------- folha (bottom sheet) ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(20, 17, 42, .45); animation: fade .2s ease; }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--bg);
  border-radius: 28px 28px 0 0; padding: 10px 18px calc(18px + var(--safe-b)); animation: up .28s cubic-bezier(.2,.8,.2,1);
}
.sheet .grabber { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 480px; transform: translate(-50%, -50%); border-radius: 28px; animation: pop .22s ease; padding-bottom: 20px; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -46%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none; } }

/* ---------- lançamento rápido ---------- */
.amount-display {
  text-align: center; font-family: var(--display); font-weight: 800; font-size: 48px; letter-spacing: -.03em; line-height: 1;
  padding: 14px 0 6px; font-variant-numeric: tabular-nums;
}
.amount-display .cur { font-size: 24px; color: var(--ink-3); margin-right: 4px; vertical-align: 14px; }
.amount-display.out { color: var(--ink); } .amount-display.in { color: var(--good); }
.amount-display.zero { color: var(--ink-3); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 14px; }
.keypad button { height: 48px; border-radius: 14px; background: var(--surface); font-family: var(--display); font-size: 24px; font-weight: 700; box-shadow: var(--shadow); }
.keypad button:active { background: var(--surface-2); }
.quick-hint { text-align: center; font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-btn { --c: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 16px; background: var(--surface); font-size: 12px; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow); min-height: 78px; line-height: 1.15; text-align: center; }
.cat-btn .e { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); }
:root[data-theme="dark"] .cat-btn .e { background: color-mix(in srgb, var(--c) 24%, var(--surface)); color: color-mix(in srgb, var(--c) 55%, #fff); }
.cat-btn .e.plain { background: var(--surface-2); color: var(--ink-2); }
.cat-btn:active { transform: scale(.96); }
.cat-btn[aria-pressed="true"] { outline: 2px solid var(--us); color: var(--ink); }
.details { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.details .chips { padding-bottom: 2px; }
.details-toggle { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* ---------- gráficos ---------- */
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
@media (max-width: 420px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }
.donut-legend { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.donut-legend div { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend span:nth-child(2) { flex: 1; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .pair i { width: 40%; max-width: 18px; border-radius: 6px 6px 3px 3px; min-height: 3px; }
.bars .pair i.in { background: var(--good); } .bars .pair i.out { background: var(--b); }
.bars .col span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.bars .col.cur span { color: var(--ink); }
.split { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 3px; }
.split i { display: block; height: 100%; }

/* acerto */
.settle { display: flex; align-items: center; gap: 12px; }
.settle .arrow { flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--ink-3) 0 6px, transparent 6px 10px); position: relative; }
.settle .arrow b { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); font-family: var(--display); font-size: 18px; white-space: nowrap; }

/* ---------- avisos ---------- */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--brass-soft); color: var(--ink); font-size: 14px; margin-top: 4px; }
.banner b { font-weight: 700; }
.banner .btn { margin-left: auto; }
.empty { text-align: center; padding: 28px 18px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .em { font-size: 36px; }
.empty-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--us-soft); color: var(--us); }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); transform: translate(-50%, 20px); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; display: flex; gap: 14px; align-items: center;
  width: max-content; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: var(--brass); font-weight: 700; }
@media (min-width: 960px) { #toast { bottom: 28px; left: calc(50% + 124px); } }

/* ---------- boas-vindas e cadastro ---------- */
.welcome {
  min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(130% 70% at 50% 0%, var(--vault-2), var(--vault) 65%); color: #F2EFFF;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 22px calc(24px + var(--safe-b));
}
.welcome .inner { max-width: 440px; width: 100%; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }
.welcome .logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 20px; }
.welcome .logo img { width: 36px; height: 36px; }
.welcome h1 { font-size: clamp(34px, 10vw, 46px); line-height: 1.02; margin: 18px 0 14px; letter-spacing: -.035em; }
.welcome .lead { color: #C9C3EA; font-size: 17px; max-width: 34ch; }
.welcome .hero-dial { width: min(260px, 70vw); margin: 22px auto 10px; }
.welcome .actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.welcome .btn.ghost { background: rgba(255,255,255,.08); color: #F2EFFF; }
.welcome .fine { font-size: 13px; color: #9C95C6; text-align: center; }

.onb { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(18px + env(safe-area-inset-top, 0px)) 20px calc(20px + var(--safe-b)); max-width: 520px; margin: 0 auto; }
.onb .steps { display: flex; gap: 6px; margin-bottom: 26px; }
.onb .steps i { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.onb .steps i.on { background: var(--us); }
.onb h1 { font-size: 28px; margin-bottom: 8px; }
.onb .lead { color: var(--ink-2); margin-bottom: 22px; }
.onb .foot { margin-top: auto; padding-top: 18px; display: flex; gap: 10px; }
.onb .foot .btn { flex: 1; }
.person-card { display: flex; gap: 12px; align-items: center; background: var(--surface); padding: 14px; border-radius: var(--r-m); box-shadow: var(--shadow); margin-bottom: 12px; }
.person-card .input { border: 0; padding: 0; height: 36px; font-size: 18px; font-weight: 600; background: transparent; }
.person-card .input:focus { box-shadow: none; }
.bill-pick { display: grid; grid-template-columns: auto 1fr 120px; gap: 10px; align-items: center; padding: 10px 14px; }
.bill-pick + .bill-pick { border-top: 1px solid var(--line); }
.bill-pick .input { height: 42px; font-size: 16px; }
.reveal { text-align: center; display: flex; flex-direction: column; align-items: center; }

/* paywall */
.paywall { max-width: 460px; margin: 0 auto; padding: 32px 20px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.paywall ul { text-align: left; list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 10px; }
.paywall li { display: flex; gap: 10px; align-items: flex-start; }
.paywall li::before { content: ''; flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; background: var(--good-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314936B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/12px no-repeat; }
.price { font-family: var(--display); font-size: 40px; font-weight: 800; letter-spacing: -.03em; }

.settings .row { padding: 14px 18px; }
.code-box { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 16px; background: var(--us-soft); color: var(--us); }
.stack > * + * { margin-top: 12px; }
.hstack { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }


/* ---------- v1.1 ---------- */
.i { display: block; flex: none; }
.tag .i, .hint .i { display: inline-block; vertical-align: -2px; }
.desk-only { display: none !important; }
@media (min-width: 960px) { .nav .desk-only { display: flex !important; } }

/* conta fixa: Não paga / Paga */
.bill-row { flex-wrap: wrap; row-gap: 10px; }
.bill-row > .grow { min-width: 180px; }
.paid-toggle { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 12px; flex: none; }
.paid-toggle button { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.paid-toggle button.no[aria-pressed="true"] { background: var(--surface); color: var(--bad); box-shadow: var(--shadow); }
.paid-toggle button.yes[aria-pressed="true"] { background: var(--good); color: #fff; }
@media (max-width: 420px) { .bill-row .paid-toggle { width: 100%; } .paid-toggle button { justify-content: center; } }
.repeat-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-top: 14px; padding: 14px 16px; border-radius: var(--r-l);
  background: var(--us-soft); color: var(--ink); border: 1.5px dashed color-mix(in srgb, var(--us) 45%, transparent); }
.check-row { cursor: pointer; }
.check-row input, .bill-pick input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--us); flex: none; }

/* lançamento: data logo abaixo do valor */
.date-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; position: relative; }
.date-row .chips { flex: 1; }
.chip.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.date-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; }
.switch-row span { display: inline-flex; align-items: center; gap: 8px; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--us); }

/* escolher ícone e cor */
.icon-grid { --c: var(--us); display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 196px; overflow: auto; padding: 2px; }
.icon-opt span { height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--ink-2); cursor: pointer; border: 1.5px solid var(--line); }
.icon-opt input:checked + span { background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: var(--c); border-color: var(--c); }
.icon-opt input:focus-visible + span, .swatch input:focus-visible + span { outline: 3px solid var(--us); outline-offset: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--c); }
.seg label { display: contents; }
.seg label span { display: grid; place-items: center; height: 38px; border-radius: 10px; font-weight: 700; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.seg label input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* temas */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 16px; background: var(--surface); border: 2px solid transparent; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.theme-card[aria-pressed="true"] { border-color: var(--us); }
.theme-prev { height: 64px; border-radius: 12px; display: flex; align-items: flex-end; gap: 6px; padding: 10px; }
.theme-prev i { width: 18px; height: 18px; border-radius: 50%; }

.search-box { position: relative; margin: 6px 0 10px; }
.search-box > .i { position: absolute; left: 14px; top: 16px; color: var(--ink-3); }
.search-box .input { padding-left: 40px; }
.bill-pick { grid-template-columns: auto 1fr 110px; }
.sheet-head h2 { font-size: 20px; }
.btn .i { margin: 0; }

/* ---------- v1.2 ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; border-width: 3px; }
.photo-edit { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.photo-edit .btn { cursor: pointer; }
.install-banner { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); margin-top: 10px; font-size: 14px; }

/* planos */
.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.plan { cursor: pointer; display: block; }
.plan-body { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 12px 12px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); height: 100%; color: var(--ink); text-align: left; }
.plan input:checked + .plan-body { border-color: var(--us); box-shadow: 0 0 0 3px var(--us-soft); }
.plan input:focus-visible + .plan-body { outline: 3px solid var(--us); outline-offset: 2px; }
.plan-name { font-weight: 700; font-size: 15px; }
.plan-price { font-size: 22px; font-weight: 800; }
.plan-per { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.plan .tag { align-self: flex-start; }
.plan-flag { position: absolute; top: -10px; right: 10px; background: var(--brass); color: var(--vault); font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.no-plan, .sub-active { display: flex; align-items: center; gap: 12px; }
.paywall .plans { width: 100%; }
.paywall .plan-body { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #F2EFFF; }
.paywall .plan-per { color: #BDB6E3; }

/* senha */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink-3); border-radius: 10px; }

/* guia de instalação */
.isteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.istep { display: flex; gap: 12px; align-items: flex-start; }
.istep-n { width: 28px; height: 28px; border-radius: 50%; background: var(--us); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.istep > div > b { display: block; margin-top: 3px; }
.istep .hint { margin-top: 2px; }
.mock { margin-top: 8px; border-radius: 14px; background: var(--surface-2); padding: 8px; font-size: 13px; color: var(--ink-2); }
.m-top, .m-bottom { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 10px; padding: 6px 8px; }
.m-url { flex: 1; display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 5px 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-bottom { justify-content: space-around; }
.m-menu { display: flex; flex-direction: column; background: var(--surface); border-radius: 10px; padding: 4px; }
.m-menu span { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; }
.m-home { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; font-size: 12px; font-weight: 600; }
.m-home img { width: 48px; height: 48px; border-radius: 12px; }
.mock .hl { color: var(--us); background: var(--us-soft); border-radius: 8px; box-shadow: 0 0 0 2px var(--us); font-weight: 700; padding: 4px 6px; }
.m-dots.hl, .m-bottom .hl { padding: 4px; animation: pulse 1.6s ease-in-out infinite; }
.m-add { margin-left: auto; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--us) 30%, transparent); } }
@media (prefers-reduced-motion: reduce) { .m-dots.hl, .m-bottom .hl { animation: none; } }

/* simuladores */
.sim-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.sim-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; font-size: 13px; line-height: 1.2; text-align: left; color: var(--ink-2); border: 2px solid transparent; }
.sim-tab[aria-pressed="true"] { border-color: var(--us); color: var(--ink); }
.sim-tab .i { color: var(--us); }
.sim-form .field:last-child { margin-bottom: 0; }
.sim-form .chips { margin-top: -6px; margin-bottom: 12px; }
.affix { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.affix:focus-within { border-color: var(--us); box-shadow: 0 0 0 3px var(--us-soft); }
.affix span { padding: 0 12px; color: var(--ink-3); font-weight: 600; font-size: 14px; white-space: nowrap; }
.affix .input { border: 0; box-shadow: none !important; padding-left: 4px; min-width: 0; }
.affix span:first-child + .input { padding-left: 0; }
.sim-result { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.big-result { background: radial-gradient(120% 120% at 50% 0%, var(--vault-2), var(--vault)); color: #F2EFFF; border-radius: 24px; padding: 20px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.big-result span { color: #C9C3EA; font-size: 14px; }
.big-result b { font-size: clamp(28px, 8vw, 38px); font-weight: 800; letter-spacing: -.02em; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-grid > div { background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.result-grid span { font-size: 13px; color: var(--ink-2); }
.result-grid b { font-size: 17px; }
.stack-bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.stack-bars .sb { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 3px; }
.stack-bars i { display: block; width: 100%; }
.stack-bars i.j { background: var(--good); border-radius: 4px 4px 0 0; }
.stack-bars i.v { background: var(--us); }
.line-chart { width: 100%; height: auto; display: block; }
@media (max-width: 420px) { .sim-tab span { font-size: 12px; } }

/* ---------- v1.3: explicações e calendário ---------- */
.sim-intro { color: var(--ink-2); margin-bottom: 16px; }
.help { margin-top: 8px; border-radius: 14px; background: var(--us-soft); }
.help summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; font-weight: 700; color: var(--us); }
.help summary::-webkit-details-marker { display: none; }
.help-body { padding: 0 14px 12px; font-size: 14px; color: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.help-body ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.sim-form .field .chips { margin: 0 0 8px; }
.explain { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.explain .i { color: var(--us); margin-top: 2px; }
.time-card { display: flex; flex-direction: column; gap: 4px; }
.time-card b.num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head b { font-family: var(--display); font-size: 19px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd span { text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 4px 0; }
.cal-day { position: relative; aspect-ratio: 1; border-radius: 14px; font-family: var(--display); font-weight: 700; font-size: 16px; background: var(--surface); color: var(--ink); }
.cal-day:hover { background: var(--surface-2); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--us); color: var(--us); }
.cal-day[aria-pressed="true"] { background: var(--us); color: #fff; box-shadow: none; }
.cal-day[disabled] { opacity: .3; }
.cal-day i { position: absolute; left: 50%; bottom: 6px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--brass); }
.cal-day[aria-pressed="true"] i { background: #fff; }
.dot-hint { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brass); vertical-align: 2px; margin-right: 4px; }

/* ---------- dentro do celular de exemplo da landing ---------- */
.framed, .framed * { scrollbar-width: none; }
.framed ::-webkit-scrollbar { display: none; }
.frame-phone .topbar { padding-top: 46px; }
.frame-phone .sheet { max-height: 86dvh; }
