/* 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; }
/* bloco do cartão no lançamento: aparece em destaque abaixo da forma de pagamento */
.card-panel { scroll-margin: 12px 0 28px; margin: 2px 0 16px; padding: 14px; border: 1.5px solid var(--green); border-radius: 16px; background: #f3fbf6; animation: cp-in .25s ease-out; }
@keyframes cp-in { from { opacity: 0; transform: translateY(-6px); } }
.cp-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.cp-head b { display: block; font-size: 15px; }
.cp-head small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; margin-top: 1px; }
.card-panel .inst-box { margin: 0; }
.card-panel .fld:last-child, .card-panel .info-box { margin-bottom: 0; }
.inv-row { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin: 0 0 12px; }
.inv-row select { border: 0; background: transparent; color: var(--green-strong); font-weight: 650; font-size: 13.5px; cursor: pointer; }
.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-bottom { margin-top: auto; padding: 8px 12px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); }
.dr-logout { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--red); text-align: left; }
.dr-logout:hover { background: var(--red-soft); }

/* ---------- login ---------- */
body.logged-out { background: #fefdf9; }
body.logged-out .app, body.logged-out .drawer-wrap { display: none; }
.login {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(900px 420px at 85% 0%, #e3f6ea 0%, rgba(227, 246, 234, 0) 60%), #fefdf9;
}
.login-bar { background: var(--green); padding: calc(var(--safe-top) + 12px) 16px 12px; display: flex; justify-content: center; }
.login-bar img { height: 36px; width: auto; }
.login-body { flex: 1; width: 100%; max-width: 460px; margin: 0 auto; padding: 32px 20px calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; justify-content: center; }
.login-badge { align-self: flex-start; display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; font-weight: 650; color: var(--green-strong); background: var(--green-soft); border-radius: 999px; padding: 5px 12px; }
.login-badge b { background: var(--green); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.login-title { font-family: "Plus Jakarta Sans", var(--font); font-size: clamp(27px, 7.5vw, 34px); line-height: 1.1; letter-spacing: -.8px; font-weight: 800; margin: 14px 0 10px; }
.login-title.sm { font-size: 24px; margin-top: 0; }
.login-lead { color: var(--muted); font-size: 16px; line-height: 1.5; margin-bottom: 20px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px 18px 18px; box-shadow: 0 18px 40px rgba(15, 61, 40, .08); }
.login-steps { list-style: none; display: flex; gap: 8px; margin-bottom: 16px; }
.login-steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--chip); border-radius: 10px; padding: 8px 10px; line-height: 1.2; }
.login-steps i { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11.5px; font-weight: 800; background: #fff; color: var(--muted); }
.login-steps li.on { background: var(--green-soft); color: var(--green-strong); }
.login-steps li.on i { background: var(--green); color: #fff; }
/* botão no padrão do Google: fundo branco, borda cinza, "G" colorido */
.gbtn {
  width: 100%; min-height: 50px; border-radius: 999px; background: #fff; color: #1f1f1f;
  border: 1px solid #747775; display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; font-weight: 500; font-size: 16px; letter-spacing: .1px;
}
.gbtn:hover { background: #f8faf8; }
.gbtn:active { background: #f1f3f1; }
.gbtn:disabled { opacity: .65; cursor: default; }
/* entrada com cara de cadastro: abas Criar conta / Entrar e, no computador, painel verde ao lado */
.auth { flex: 1; display: flex; }
.auth-side { display: none; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 20px calc(var(--safe-bottom) + 20px); }
.auth-main-in { width: 100%; max-width: 440px; }
.auth-card { padding: 18px 18px 16px; }
.auth-tabs { margin-bottom: 18px; }
.auth-tabs button { min-height: 40px; font-weight: 650; }
.auth-card .login-title { font-size: clamp(25px, 7vw, 30px); margin: 0 0 6px; }
.auth-card .login-lead { font-size: 15px; margin-bottom: 16px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (min-width: 900px) {
  .login-bar { display: none; }
  /* as duas metades ficam na mesma linha da grade: o topo da logo e o topo do cadastro se alinham, e o conjunto fica no meio da tela */
  .auth { position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: start; align-content: center; }
  .auth::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 50%; background: radial-gradient(700px 400px at 20% 0%, rgba(255, 255, 255, .14) 0%, rgba(255, 255, 255, 0) 60%), linear-gradient(160deg, #19a463 0%, #0f3d28 100%); }
  .auth-side { position: relative; display: flex; justify-content: center; padding: 48px 56px; color: #fff; }
  .auth-side-in { width: 100%; max-width: 440px; }
  .auth-logo { display: block; height: 48px; width: auto; margin-bottom: 36px; }
  .auth-side h2 { font-family: "Plus Jakarta Sans", var(--font); font-size: 40px; line-height: 1.08; letter-spacing: -1px; font-weight: 800; max-width: 460px; }
  .auth-side h2 em { font-style: normal; color: #8fe3b4; }
  .auth-side ul { list-style: none; display: grid; gap: 12px; margin-top: 28px; }
  .auth-side li { display: flex; gap: 10px; align-items: center; font-size: 16px; color: #e3f4ea; }
  .auth-side li svg { color: #8fe3b4; flex: none; }
  .auth-main { align-items: flex-start; padding: 48px 56px; }
}
.login-note { font-size: 12.5px; line-height: 1.45; color: var(--muted); text-align: center; margin-top: 12px; }
.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; display: grid; gap: 10px; padding: 0 4px; }
.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: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 22px; }
.login-foot a { color: var(--green-strong); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
/* menu lateral: seções com título, itens com ícone e o item atual destacado */
.dnav { padding: 6px 12px 4px; }
.dnav + .dnav { margin-top: 2px; }
.dnav-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); padding: 12px 12px 6px; }
.dnav a { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; font-size: 15.5px; font-weight: 550; color: var(--ink); }
.dnav a svg { color: var(--muted); flex: none; }
.dnav a:active { background: var(--chip); }
.dnav a.on { background: var(--green-soft); color: var(--green-strong); font-weight: 700; }
.dnav a.on svg { color: var(--green-strong); }
.dr-foot { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px 0; font-size: 12.5px; line-height: 1.4; color: var(--faint); }
.dr-foot svg { flex: none; margin-top: 1px; color: var(--green-strong); }

/* ---------- 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; }
/* Blocos do gráfico "Pra onde foi o dinheiro?". O texto nunca passa do bloco: o tamanho da letra acompanha a largura e a altura
   do próprio bloco (cqw/cqh), os estreitos mostram só a %, e os minúsculos ficam só com a cor (a lista abaixo diz o nome e o valor). */
.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; container-type: size; }
.tm-name { font-size: min(14px, 13cqw); font-weight: 650; line-height: 1.2; overflow: hidden; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.tm-val { white-space: nowrap; overflow: hidden; }
.tm-val b { display: block; font-size: min(32px, 26cqw, 30cqh); font-weight: 750; line-height: 1; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.tm-val small { display: block; font-size: min(13px, 11cqw); opacity: .9; margin-top: 5px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.tm-cell.md .tm-val b { font-size: min(22px, 26cqw, 30cqh); }
.tm-cell.md .tm-name { -webkit-line-clamp: 1; overflow-wrap: normal; word-break: break-all; }
.tm-cell.sm .tm-in { padding: 6px 8px; justify-content: center; gap: 2px; }
.tm-cell.sm .tm-name, .tm-cell.xs .tm-name { font-size: min(12px, 12cqw); display: block; white-space: nowrap; text-overflow: ellipsis; overflow-wrap: normal; }
.tm-cell.sm .tm-val b { font-size: min(15px, 28cqw, 40cqh); }
.tm-cell.xs .tm-in { justify-content: center; gap: 0; padding: 2px 7px; }
.tm-cell.xs .tm-name { font-size: min(10.5px, 12cqw); }
.tm-cell.xs .tm-val b { font-size: min(13px, 28cqw, 45cqh); }
/* estas regras ficam por último para valer sobre as de tamanho */
.tm-cell.narrow .tm-name { display: none; }
.tm-cell.narrow .tm-in { justify-content: center; align-items: center; padding: 2px; }
.tm-cell.narrow .tm-val b { font-size: min(13px, 34cqw, 40cqh); letter-spacing: 0; }
.tm-cell.narrow .tm-val small { display: none; }
.tm-cell.tiny .tm-name, .tm-cell.tiny .tm-val { display: none; }
.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.tap, .tm-cell[data-act] { cursor: pointer; }
.grp-row .link-text { color: var(--blue); font-weight: 550; }
.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; }
.pill.prevista { background: #eef0eb; color: var(--muted); }
.pill.parcial, .pill.naopaga { background: #fdf1dc; color: #a86b00; }
/* avisos do cartão na Visão geral */
.notice { border: 1px solid #cfe9da; }
.notice-text { margin: 6px 0 12px; }
.notice-actions { display: flex; gap: 8px; }
.hint-row { display: flex; gap: 6px; align-items: center; }
.hint-row svg { flex: none; }
.inline-link { display: inline; color: var(--green-strong); font-weight: 650; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* próximas faturas do cartão */
.next-inv { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; }
.ni { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 12px; background: transparent; min-width: 0; }
.ni.on { background: var(--green-soft); }
.ni-bar { height: 84px; width: 22px; border-radius: 7px; background: #eef0eb; display: flex; align-items: flex-end; overflow: hidden; }
.ni-bar i { display: block; width: 100%; background: var(--green); border-radius: 7px; min-height: 3px; }
.ni:not(.on) .ni-bar i { background: #9fd8b9; }
.ni b { font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ni span:last-child { font-size: 11.5px; color: var(--muted); }
/* parcelas da compra no cartão */
.inst-box { margin: 4px 0 2px; }
.inst-seg { width: 100%; }
.inst-seg button { min-height: 40px; }
.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; }
}
