/* Hábitos Financeiros: visual mobile, barra verde, fundo creme, cards brancos */

:root {
  --green: #19a463;
  --green-strong: #11804c;
  --green-soft: #dcf4e6;
  --green-tint: #eef9f2;
  --bg: #f2f4ef;
  --card: #fffefb;
  --ink: #2c302b;
  --muted: #6c7369;
  --faint: #a1a69e;
  --line: #e7e9e3;
  --chip: #eef0eb;
  --red: #dc4646;
  --red-soft: #fcebeb;
  --blue: #2f6bdf;
  --amber: #e29a12;
  --dark: #2c302b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 40, 30, .05), 0 2px 10px rgba(30, 40, 30, .03);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; flex: none; }
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
b { font-weight: 650; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--green); color: #fff;
  padding: calc(var(--safe-top) + 6px) 6px 6px;
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
}
.brand { display: flex; align-items: center; justify-content: center; }
.brand img { height: 36px; width: auto; display: block; }
.tb-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.tb-btn:active { background: rgba(255, 255, 255, .16); }

main { padding: 12px 12px calc(32px + var(--safe-bottom)); }

/* ---------- cards e textos ---------- */
.card { position: relative; background: var(--card); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-size: 15.5px; font-weight: 650; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1.page { font-size: 20px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.pos { color: var(--green-strong); }
.neg { color: var(--red); }
.blue { color: var(--blue); }
.warn-text { color: var(--amber); font-weight: 600; }
.center { text-align: center; }
.pad { padding: 18px 8px; }
.mt { margin-top: 10px; }
.mt-6 { margin-top: 6px; }
.mb { margin-bottom: 12px; }
.gap { height: 10px; }
.grow { flex: 1; min-width: 0; }
.hint { margin: -6px 0 14px; }
.right { display: flex; flex-direction: column; align-items: flex-end; }

/* ---------- linhas de lista ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row .t { display: flex; align-items: center; gap: 6px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row span.t { display: block; }
.row .grow > .t { display: flex; }
.row .s { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; font-size: 14.5px; }
.chev { color: var(--faint); }
.badge { display: inline-flex; align-items: center; gap: 2px; font-size: 10.5px; line-height: 1; padding: 3px 5px; border-radius: 6px; background: var(--chip); color: var(--muted); font-weight: 650; flex: none; }

.ci { width: 38px; height: 38px; border-radius: 50%; background: var(--c, #999); color: #fff; display: grid; place-items: center; flex: none; }
.ci svg { width: 19px; height: 19px; }
.ci.sm { width: 30px; height: 30px; }
.ci.sm svg { width: 15px; height: 15px; }
.ci.lg { width: 60px; height: 60px; }
.ci.lg svg { width: 28px; height: 28px; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  background: var(--green); color: #fff; font-weight: 650; font-size: 15px;
  transition: filter .15s, transform .1s;
}
.btn:active { filter: brightness(.94); transform: scale(.99); }
.btn:disabled { background: #d5d8d2; color: #8b9088; }
.btn.block { width: 100%; display: flex; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-outline { background: transparent; color: var(--green-strong); box-shadow: inset 0 0 0 1.5px var(--green); }
.btn-soft { background: var(--green-soft); color: var(--green-strong); }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); background: var(--card); flex: none; }
.icon-btn.ghost { box-shadow: none; background: transparent; }
.icon-btn.sm { width: 34px; height: 34px; color: var(--muted); }
.icon-btn.dark { background: var(--dark); color: #fff; box-shadow: none; }
.icon-btn.on { background: var(--green-soft); color: var(--green-strong); box-shadow: none; }
.link, .link-btn { color: var(--blue); font-weight: 550; font-size: 14px; }
.link-btn { display: flex; align-items: center; gap: 4px; margin: 10px auto 0; color: var(--muted); }
.tiny-link { display: block; font-size: 12.5px; margin-top: 2px; padding: 2px 0; text-align: left; }

/* ---------- navegação de mês, abas, segmentos ---------- */
.monthnav { display: flex; align-items: center; justify-content: center; gap: 4px; }
.monthnav .m { font-weight: 650; font-size: 16px; min-width: 150px; text-align: center; padding: 8px 4px; border-radius: 10px; white-space: nowrap; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 12px -16px 12px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { padding: 12px 7px; color: var(--muted); font-weight: 550; font-size: 14px; white-space: nowrap; border-bottom: 2.5px solid transparent; margin-bottom: -1px; flex: 1 0 auto; }
.tabs button.on { color: var(--green-strong); border-color: var(--green); }
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 36px; border-radius: 9px; font-weight: 550; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.seg .count { font-size: 11px; background: var(--red); color: #fff; border-radius: 9px; padding: 1px 6px; }
.type-seg { margin-bottom: 14px; }
.type-seg .t-expense.on { color: var(--red); }
.type-seg .t-income.on { color: var(--green-strong); }
.type-seg .t-transfer.on { color: var(--blue); }

/* ---------- estados vazios ---------- */
.empty { text-align: center; padding: 14px 8px 4px; }
.empty-ic { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; background: var(--dark); color: #8ce3b0; display: grid; place-items: center; box-shadow: 0 0 0 7px #eef0eb; }
.empty h3 { font-size: 16.5px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14px; margin: 0 auto 14px; max-width: 290px; }

/* ---------- visão geral ---------- */
.hello { font-size: 15px; color: var(--muted); }
.hello b { display: block; font-size: 21px; color: var(--ink); margin-top: 2px; }
.kpis { display: flex; gap: 22px; margin: 16px 0; align-items: flex-end; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpis .icon-btn { margin-left: auto; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick button { min-height: 44px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; background: #fff; }
.qi { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); }
.start { background: var(--green-tint); border: 1px solid #cfeedc; border-radius: 14px; padding: 16px; }
.start h3 { font-size: 16px; margin-bottom: 4px; }
.start p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.balance { border-left: 3px solid var(--green); padding-left: 10px; margin-bottom: 14px; }
.balance.red { border-color: var(--red); }
.balance .l { font-size: 13px; color: var(--muted); }
.balance .v { font-size: 21px; font-weight: 700; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.eye { color: var(--muted); padding: 4px; border-radius: 8px; }
.cc { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 4px; cursor: pointer; }
.cc:last-of-type { border-bottom: 0; }
.cc .row { border-bottom: 0; }
.cc-info { background: #f7f8f5; border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.sum-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.sum-line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-size: 14.5px; }
.donut-wrap { display: grid; place-items: center; margin: 6px 0 14px; }
.donut { position: relative; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-c b { font-size: 16px; font-variant-numeric: tabular-nums; }
.budget { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.budget:last-of-type { border-bottom: 0; }
.budget-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.budget-top .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-foot { display: flex; justify-content: space-between; margin-top: 5px; }
.budget-total { background: #f7f8f5; border-radius: 12px; padding: 12px; margin-bottom: 6px; display: grid; gap: 8px; }
.mini-bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: 4px; background: var(--green); transition: width .3s; }
.mini-bar.warn span { background: var(--amber); }
.mini-bar.over span { background: var(--red); }

/* ---------- lançamentos ---------- */
.lhead { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.lhead .monthnav .m { min-width: 0; }
.lhead-side { width: 42px; flex: none; }
.new-tx { margin: 6px 0 4px; }
.sum-toggle { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 550; color: var(--muted); padding: 6px 10px; border-radius: 10px; background: var(--chip); flex: none; }
.filters-on { margin: 6px 0 4px; align-items: center; }
.day { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 16px 0 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.txlist .day:first-child { padding-top: 8px; }
.tx.pending .amt { color: var(--faint); }
.st { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #c9cdc5; display: grid; place-items: center; color: transparent; flex: none; }
.st:hover { color: var(--faint); }
.st.ok { background: var(--green); box-shadow: none; color: #fff; }
.st-space { width: 26px; flex: none; }
.row .st:not(.ok) { color: #c9cdc5; }
.summary { margin: 14px -16px -18px; padding: 12px 16px 14px; background: #f8f9f6; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.sum-main { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.sum-details { margin-bottom: 4px; }
.round-soft { width: 44px; height: 44px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; color: var(--muted); flex: none; }
.round-soft.sm { width: 36px; height: 36px; }
.round-soft.ghost { visibility: hidden; }

/* ---------- formulários ---------- */
.fld { display: block; margin-bottom: 14px; min-width: 0; }
.lbl { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 550; margin-bottom: 6px; }
.inp {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 0 14px; font-size: 16px; outline: none; text-align: left;
  display: flex; align-items: center; gap: 10px; transition: border-color .15s, box-shadow .15s;
}
.inp:focus, .inp:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.inp::placeholder { color: var(--faint); }
textarea.inp { min-height: 84px; padding: 12px 14px; resize: vertical; display: block; }
select.inp, .period-sel {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c7369' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
}
input[type=date].inp { display: block; line-height: 46px; -webkit-appearance: none; appearance: none; min-width: 0; }
input[type=date].inp::-webkit-date-and-time-value { text-align: left; }
.period-sel { border: 1px solid var(--line); border-radius: 10px; padding: 7px 34px 7px 12px; font-size: 14px; font-weight: 550; background-color: #fff; }
.money { position: relative; display: block; }
.money .cur { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 15px; pointer-events: none; }
.money .inp { padding-left: 44px; font-variant-numeric: tabular-nums; }
.money.signed .inp { padding-left: 50px; padding-right: 52px; }
.sign { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.sign.on { background: var(--red-soft); color: var(--red); box-shadow: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #d3d7d0; position: relative; transition: background .2s; flex: none; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: left .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { left: 21px; }
.switch-row { display: flex; align-items: center; gap: 12px; margin: -2px 0 16px; font-size: 14.5px; font-weight: 550; cursor: pointer; }
.pickbtn { cursor: pointer; padding: 0 10px; gap: 8px; }
.pickbtn .grow { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.pickbtn .ph { color: var(--faint); }
.pickbtn > svg { color: var(--faint); }
.sugg { font-size: 10.5px; font-weight: 650; color: var(--green-strong); background: var(--green-soft); border-radius: 6px; padding: 2px 6px; }
.sugg[hidden] { display: none; }
.inv-row { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin: -6px 0 14px; }
.inv-row select { border: 0; background: transparent; color: var(--green-strong); font-weight: 650; font-size: 13.5px; cursor: pointer; }
.card-hint { margin: -8px 0 14px; }
.round-actions { display: flex; justify-content: center; gap: 22px; margin: 2px 0 14px; }
.round { width: 50px; height: 50px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; background: #fff; position: relative; color: var(--muted); }
.round.on { background: var(--green-soft); box-shadow: none; color: var(--green-strong); }
.round .dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.sec { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 15px; cursor: pointer; }
.radio-row input { accent-color: var(--green); width: 20px; height: 20px; }
.info-box { background: #f1f3ee; border-radius: 12px; padding: 12px 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; color: var(--ink); }
.info-box svg { color: var(--muted); margin-top: 1px; }
.txf-foot { display: flex; align-items: center; justify-content: space-around; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 4px; }
.save-big { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(25, 164, 99, .35); transition: transform .1s; }
.save-big:active { transform: scale(.95); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 17px; box-shadow: inset 0 0 0 1px var(--line); background: #fff; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--green-soft); box-shadow: inset 0 0 0 1px #a9e2c2; color: var(--green-strong); font-weight: 550; }
.chip.add { color: var(--muted); }
.icon-preview { display: grid; place-items: center; margin: 2px 0 12px; }
.opt-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
.opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; color: var(--muted); min-width: 84px; }
.opt.on { box-shadow: inset 0 0 0 2px var(--green); color: var(--green-strong); background: var(--green-tint); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 12px; }
.opt-grid .opt { min-width: 0; padding: 10px 0; }
.colors { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; margin-bottom: 18px; }
.color { aspect-ratio: 1; border-radius: 50%; background: var(--c); }
.color.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--c); }

/* ---------- folhas (bottom sheets) ---------- */
.sheet-wrap { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(22, 26, 22, .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 4px 18px calc(18px + var(--safe-bottom));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #dadcd6; margin: 6px auto 4px; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 12px; }
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.sheet-head .icon-btn { margin-right: -8px; }
.sheet-text { margin: -4px 0 14px; font-size: 14.5px; }
.sheet.tall { min-height: 60dvh; }
.stack { display: grid; gap: 10px; }
@media (min-width: 620px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 22px; max-height: 88dvh; padding-bottom: 20px; transform: translateY(20px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet::before { display: none; }
  .sheet-wrap.open .sheet { opacity: 1; }
}

.search { position: relative; margin-bottom: 8px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .inp { padding-left: 42px; }
.pick-group { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 14px 4px 6px; }
.pick-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; border-radius: 12px; text-align: left; }
.pick-item:hover { background: #f5f6f3; }
.pick-item.on { background: var(--green-tint); }
.pick-item.indent { padding-left: 34px; }
.pick-label { font-weight: 550; }
.pick-item small { display: block; color: var(--muted); font-size: 12.5px; }
.pick-check { color: var(--green-strong); }

/* ---------- menu lateral ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 50; visibility: hidden; transition: visibility 0s .25s; }
.drawer-wrap.open { visibility: visible; transition: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(22, 26, 22, .45); opacity: 0; transition: opacity .2s; }
.drawer { position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); background: var(--card); transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); overflow-y: auto; padding-top: var(--safe-top); display: flex; flex-direction: column; }
.drawer-wrap.open .drawer { transform: none; }
.drawer-wrap.open .drawer-backdrop { opacity: 1; }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 24px 20px 18px; border-bottom: 1px solid var(--line); }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--green-soft); color: var(--green-strong); display: grid; place-items: center; font-weight: 700; font-size: 19px; flex: none; }
.dr-name { font-weight: 650; font-size: 17px; }
.dr-email { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dr-logout { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; padding: 12px 20px; font-size: 15px; color: var(--red); text-align: left; }

/* ---------- login ---------- */
body.logged-out { background: #148a53; }
body.logged-out .app, body.logged-out .drawer-wrap { display: none; }
.login {
  min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 28px) 18px calc(var(--safe-bottom) + 18px);
  background: linear-gradient(180deg, var(--green) 0%, #148a53 100%);
}
.login-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fff; padding: 24px 8px 32px; }
.login-logo { width: min(250px, 68vw); height: auto; }
.login-tag { margin-top: 20px; font-size: 16px; line-height: 1.5; opacity: .94; max-width: 310px; }
.login-card { background: var(--card); border-radius: 22px; padding: 24px 20px 18px; box-shadow: 0 12px 32px rgba(0, 0, 0, .14); }
.login-card h1 { font-size: 21px; letter-spacing: -.2px; margin-bottom: 4px; }
.gbtn {
  width: 100%; min-height: 52px; margin-top: 18px; border-radius: 14px; background: #fff; color: #1f1f1f;
  box-shadow: inset 0 0 0 1px #dadce0, 0 1px 2px rgba(0, 0, 0, .06);
  display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 600; font-size: 16px;
}
.gbtn:active { background: #f6f7f5; }
.gbtn:disabled { opacity: .65; cursor: default; }
.login-err { color: var(--red); font-size: 13.5px; text-align: center; margin-top: 10px; }
.login-err[hidden] { display: none; }
.trust { list-style: none; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.trust li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.trust svg { color: var(--green-strong); margin-top: 1px; }
.login .link-btn { margin-top: 14px; font-size: 13px; }
.login-foot { text-align: center; color: rgba(255, 255, 255, .75); font-size: 12px; margin-top: 14px; }
.drawer nav { padding: 8px 0; border-bottom: 1px solid var(--line); }
.drawer nav a { display: block; padding: 12px 20px 12px 17px; font-size: 16px; border-left: 3px solid transparent; }
.drawer nav a.on { color: var(--green-strong); border-left-color: var(--green); font-weight: 650; background: var(--green-tint); }
.drawer nav.sub a { color: var(--muted); font-size: 15px; padding-top: 10px; padding-bottom: 10px; }
.drawer nav.sub a.on { color: var(--green-strong); }
.dr-foot { margin-top: auto; padding: 18px 20px calc(18px + var(--safe-bottom)); font-size: 12.5px; color: var(--faint); }

/* ---------- avisos ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 12px); z-index: 500;
  transform: translate(-50%, -160%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16); padding: 10px 16px 10px 10px; font-size: 14.5px; font-weight: 550;
  max-width: calc(100vw - 32px); width: max-content;
}
.toast.show { transform: translate(-50%, 0); }
.toast-ic { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; flex: none; }
.toast.err .toast-ic { background: var(--red); }

/* ---------- relatórios ---------- */
.chart-box { margin: 4px 0 6px; }
.bars { width: 100%; height: auto; display: block; }
.bar-in { fill: var(--green); }
.bar-out { fill: var(--red); }
.bar-base { stroke: var(--line); stroke-width: 1; }
.bar-l { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.legend { display: flex; justify-content: center; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.lg-in { background: var(--green); }
.lg-out { background: var(--red); }
table.flow { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.flow th { text-align: right; font-weight: 600; color: var(--muted); padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 12px; }
.flow td { text-align: right; padding: 9px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.flow th:first-child, .flow td:first-child { text-align: left; }
.flow tfoot td { font-weight: 700; border-bottom: 0; }
.acc-bar { padding-bottom: 8px; cursor: pointer; }

/* tipos de gasto: "Pra onde foi o dinheiro?" */
.where { border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px 12px; margin-bottom: 18px; }
.where-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 4px 6px; font-size: 15.5px; font-weight: 600; }
.where-head b { font-variant-numeric: tabular-nums; }
.treemap { position: relative; width: 100%; margin: 4px 0 10px; }
.tm-cell { position: absolute; }
.tm-in { position: absolute; inset: 3px; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.tm-name { font-size: 14px; font-weight: 650; line-height: 1.2; }
.tm-val b { display: block; font-size: 32px; font-weight: 750; line-height: 1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tm-val small { display: block; font-size: 13px; opacity: .9; margin-top: 5px; font-variant-numeric: tabular-nums; }
.tm-cell.md .tm-val b { font-size: 22px; }
.tm-cell.sm .tm-in { flex-direction: row; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 10px; }
.tm-cell.sm .tm-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-cell.sm .tm-val b { font-size: 15px; }
.grp-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.grp-row:last-of-type { border-bottom: 0; }
.grp-row > i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.grp-row .t { display: block; font-weight: 600; }
.grp-row .s { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-title { font-size: 15.5px; font-weight: 600; margin: 4px 0 6px; }
.grp-tag { font-size: 10.5px; font-weight: 650; line-height: 1; padding: 3px 6px; border-radius: 6px; color: var(--g); background: color-mix(in srgb, var(--g) 14%, transparent); flex: none; }
.grp-opts { display: grid; gap: 8px; }
.grp-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); text-align: left; background: #fff; }
.grp-opt > i { width: 14px; height: 14px; border-radius: 4px; background: var(--g); margin-top: 3px; flex: none; }
.grp-opt b { display: block; font-size: 14.5px; }
.grp-opt small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.grp-opt.on { box-shadow: inset 0 0 0 2px var(--g); background: color-mix(in srgb, var(--g) 7%, #fff); }
.acc-bar .row { border-bottom: 0; padding-bottom: 6px; }

/* ---------- fatura ---------- */
.inv-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.inv-name { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; border-radius: 6px; padding: 3px 7px; background: var(--chip); color: var(--muted); margin-right: 6px; }
.pill.aberta { background: #e5eefc; color: var(--blue); }
.pill.fechada { background: #fdf1dc; color: #a86b00; }
.pill.paga { background: var(--green-soft); color: var(--green-strong); }
.pill.vencida { background: var(--red-soft); color: var(--red); }
.pill.now { background: var(--dark); color: #fff; }
.inv-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; padding: 14px; background: #f7f8f5; border-radius: 14px; }
.inv-total b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.inv-total > div { min-width: 0; }
.inv-total .btn { white-space: nowrap; flex: none; }
.inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inv-grid div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.inv-grid span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.inv-grid b { font-variant-numeric: tabular-nums; }

/* ---------- categorias, atividades, preferências ---------- */
.cat-row.child { padding-left: 22px; }
.archived { opacity: .7; }
.act-row { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.danger-zone .card-title { color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
