:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --surface: #f1f1f3;
  --text: #0d0d0d;
  --muted: #6e6e80;
  --faint: #a0a0ad;
  --border: #e6e6eb;
  --primary: #0d0d0d;
  --primary-text: #ffffff;
  --pos: #0f8a5f;
  --neg: #d93025;
  --warn: #b26a00;
  --warn-bg: #fff6e5;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --card: #1f1f1f;
    --surface: #2a2a2a;
    --text: #ececec;
    --muted: #a1a1aa;
    --faint: #71717a;
    --border: #2e2e2e;
    --primary: #ececec;
    --primary-text: #161616;
    --pos: #34d399;
    --neg: #f87171;
    --warn: #fbbf24;
    --warn-bg: #2a2214;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; letter-spacing: -0.005em;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- botões e campos ---------- */
.btn {
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: opacity .15s, background .15s;
}
.btn:active { opacity: .8; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.danger { color: var(--neg); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, .select {
  height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); outline: none; width: 100%;
}
.input:focus, .select:focus { border-color: var(--text); }
.input.big { height: 60px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--surface); padding: 4px; border-radius: 12px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: none; font-weight: 550; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 14px; }
.chip.on { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.mark { border-radius: 14px; }
.login h1 { margin: 18px 0 2px; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.sub { margin: 0 0 26px; color: var(--muted); }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login input { height: 50px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); outline: none; }
.login input:focus { border-color: var(--text); }
.login .btn { height: 50px; }
.error { color: var(--neg); min-height: 1.4em; margin: 0; font-size: 14px; }
.secure { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; color: var(--muted); font-size: 12.5px; }

/* ---------- estrutura ---------- */
.app { height: 100dvh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 10px 8px 20px; background: var(--bg);
}
.top h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.top-actions { position: relative; display: flex; gap: 2px; }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:active, .icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; background: var(--card);
  border: 1px solid var(--border); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.menu-pop button { background: none; border: 0; text-align: left; padding: 11px 12px; border-radius: 9px; font-size: 14.5px; }
.menu-pop button:hover { background: var(--surface); }
.menu-pop .danger { color: var(--neg); }

.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow-y: auto; padding: 4px 16px 110px; overscroll-behavior: contain; }
.view > * { max-width: 720px; margin-inline: auto; }

.tabbar {
  display: flex; justify-content: space-around; background: var(--card); border-top: 1px solid var(--border);
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
}
.tabbar button {
  position: relative; flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 550; color: var(--faint); padding: 4px 0;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar button.active { color: var(--text); }
.badge {
  position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--neg); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center;
}
.fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 78px); z-index: 20; width: 56px; height: 56px;
  border-radius: 18px; border: 0; background: var(--primary); color: var(--primary-text); display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.fab:active { transform: scale(.96); }

/* ---------- cartões ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 small { font-weight: 450; color: var(--muted); font-size: 13px; }
.hero .label { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.hero .big { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; margin: 4px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface); border-radius: 12px; padding: 10px 12px; min-width: 0; border: 0; text-align: left; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr 1fr; } }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.month-grid div span { display: block; font-size: 12px; color: var(--muted); }
.month-grid div b { font-size: 17px; font-weight: 650; }
.alert {
  display: flex; align-items: center; gap: 12px; background: var(--warn-bg); color: var(--warn); border-radius: 14px; padding: 12px 14px;
  margin-bottom: 14px; border: 0; width: 100%; text-align: left; font-weight: 550;
}
.alert svg { flex: none; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row .bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.bar-row .bar-head span:first-child { display: flex; align-items: center; gap: 8px; }
.bar-row small { color: var(--muted); font-size: 12px; }
.track { position: relative; height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; width: 0; border-radius: 4px; background: var(--c, var(--text)); transition: width .5s ease; }
.fill.over { background: var(--neg); }
.marker { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .45; }
.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--muted)); flex: none; }

.cols { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 8px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.col .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.col .in, .col .out { width: 42%; max-width: 16px; border-radius: 4px 4px 2px 2px; min-height: 2px; }
.col .in { background: var(--pos); opacity: .85; }
.col .out { background: var(--text); opacity: .75; }
.col small { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.legend .li { background: var(--pos); }
.legend .lo { background: var(--text); opacity: .75; }

/* ---------- extrato ---------- */
.filters { position: sticky; top: -4px; z-index: 5; background: var(--bg); padding: 4px 0 10px; display: flex; flex-direction: column; gap: 8px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav b { font-size: 16px; font-weight: 600; text-transform: capitalize; }
.filter-row { display: grid; grid-template-columns: 1fr 140px; gap: 8px; }
.filter-row .input, .filter-row .select { height: 40px; font-size: 14px; }
.summary-line { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.day { margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tx { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; background: none; border: 0; text-align: left; }
.tx + .tx { border-top: 1px solid var(--border); }
.tx:active { background: var(--surface); }
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 14%, transparent);
}
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amt { font-weight: 600; white-space: nowrap; text-align: right; }
.tx-amt small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 5px; background: var(--surface); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.empty-state { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty-state b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- atenção ---------- */
.att { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.att-q { font-weight: 550; margin: 10px 0 12px; }
.att-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- plano ---------- */
.score { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.score-num { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; font-weight: 700; background: var(--surface); flex: none; }
.proposal { padding: 14px 0; border-top: 1px solid var(--border); }
.proposal:first-of-type { border-top: 0; padding-top: 4px; }
.proposal-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.proposal-head b { font-weight: 600; }
.saving { flex: none; font-size: 12.5px; font-weight: 650; color: var(--pos); background: color-mix(in srgb, var(--pos) 12%, transparent); padding: 2px 8px; border-radius: 999px; }
.proposal p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.goal { padding: 12px 0; border-top: 1px solid var(--border); }
.goal:first-of-type { border-top: 0; padding-top: 0; }
.goal-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- chat ---------- */
.chat-view { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-view > * { width: 100%; max-width: none; margin-inline: 0; } /* senão o compositor encolhe */
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 18px 20px; display: flex; flex-direction: column; gap: 26px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.messages > * { width: 100%; max-width: 720px; margin-inline: auto; }

.chat-empty { margin-block: auto; padding: 8px 0 12px; }
.chat-hello { text-align: center; margin-bottom: 26px; }
.chat-hello img { width: 52px; height: 52px; border-radius: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.chat-hello h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.025em; margin: 16px 0 6px; }
.chat-hello p { margin: 0 auto; color: var(--muted); font-size: 14.5px; max-width: 300px; }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.suggest button {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column;
  gap: 8px; text-align: left; min-width: 0; transition: transform .12s, background .15s;
}
.suggest button:active { transform: scale(.98); background: var(--surface); }
.suggest .s-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.suggest strong { font-size: 14px; font-weight: 600; line-height: 1.25; }
.suggest span { color: var(--muted); font-size: 12.5px; line-height: 1.3; }

.msg { overflow-wrap: anywhere; animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--primary); color: var(--primary-text); padding: 10px 16px; border-radius: 22px 22px 6px 22px;
  max-width: 82%; white-space: pre-wrap; font-size: 15.5px; line-height: 1.45;
}
.msg.bot .who { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.msg.bot .who img { width: 22px; height: 22px; border-radius: 7px; }
.msg.bot .bubble { font-size: 15.5px; line-height: 1.62; }
.bubble p { margin: 0 0 12px; }
.bubble p:last-child, .bubble ul:last-child, .bubble ol:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 12px; padding-left: 20px; }
.bubble li { margin: 4px 0; padding-left: 2px; }
.bubble li::marker { color: var(--faint); }
.bubble h3 { margin: 18px 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.bubble strong { font-weight: 650; }
.bubble em { color: var(--muted); }
.bubble code { background: var(--surface); padding: 1px 6px; border-radius: 6px; font-size: 14px; }
.bubble table { border-collapse: collapse; margin: 4px 0 12px; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; }
.bubble th, .bubble td { border-bottom: 1px solid var(--border); padding: 7px 14px 7px 0; text-align: left; white-space: nowrap; }
.bubble th { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.msg-tools { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--faint); font-size: 12px; }
.msg-tools button { background: none; border: 0; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--faint); }
.msg-tools button:active { background: var(--surface); color: var(--text); }
.msg.err .bubble { color: var(--neg); }
.actions-done { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.actions-done span {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 5px 11px 5px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--pos) 12%, transparent); color: var(--pos);
}
.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; }
.thinking .orb { width: 10px; height: 10px; border-radius: 50%; background: var(--text); animation: orb 1.1s infinite ease-in-out; }
.thinking .label { background: linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes orb { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }

.composer-wrap { padding: 6px 14px 8px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.composer {
  display: flex; align-items: flex-end; gap: 6px; margin: 0 auto; max-width: 720px; background: var(--card);
  border: 1px solid var(--border); border-radius: 26px; padding: 6px; box-shadow: var(--shadow); transition: border-color .15s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 150px; padding: 9px 4px; border: 0; background: none; outline: none; font-size: 16px; line-height: 1.4;
}
.composer textarea::placeholder { color: var(--faint); }
.composer-icon { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface); color: var(--text); display: grid; place-items: center; }
.composer .send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--primary); color: var(--primary-text); transition: opacity .15s, transform .12s; }
.composer .send:disabled { opacity: .2; }
.composer .send:not(:disabled):active { transform: scale(.92); }
.composer-note { text-align: center; color: var(--faint); font-size: 11.5px; margin: 6px 0 0; }
body.on-chat .fab { display: none; }
body.typing-kb .tabbar { display: none; }
body.typing-kb .composer-note { display: none; }

.chat-item { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.chat-item button.open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 13px 2px; }
.chat-item .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.chat-item small { display: block; color: var(--muted); font-size: 12px; }
.chat-item.current .t::before { content: "● "; color: var(--pos); }

/* ---------- painel inferior ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 8px 18px calc(env(safe-area-inset-bottom) + 18px); animation: up .25s ease;
  max-width: 560px; margin: 0 auto;
}
.sheet-handle { width: 38px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 16px; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.sheet .sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet .sheet-actions .btn { flex: 1; }
.sheet .txinfo { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.sheet textarea.input { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translateX(-50%); z-index: 50;
  background: var(--primary); color: var(--primary-text); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; animation: up .2s ease;
}

@media (min-width: 900px) {
  .view { padding-left: 24px; padding-right: 24px; }
}

/* utilitários (sem estilo inline por causa da CSP) */
.mt10 { margin-top: 10px; }
.mt14 { margin-top: 14px; }
.small { font-size: 13px; }
.note { font-size: 12.5px; margin: 8px 0 0; }
.note.center { text-align: center; margin: 4px 0 8px; }
.intro { margin: 4px 0 14px; font-size: 14.5px; }
.hint { font-size: 12.5px; margin: -6px 0 14px; }
.sheet-intro { margin: -8px 0 16px; font-size: 14px; }
.tx.flat { padding: 0; }
.tx.flat:active { background: none; }

/* ---------- sensação de app nativo no iPhone ---------- */
html, body { overflow: hidden; overscroll-behavior: none; width: 100%; }
body { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.login { height: 100dvh; overflow-y: auto; }
.view { overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.top, .tabbar, .fab, .btn, .chip, .stat, .seg, .icon-btn, .tx, .suggest button, .update-bar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select, textarea, .input, .select { font-size: 16px; } /* < 16px faz o iPhone dar zoom ao tocar */
.input.big { font-size: 28px; }
.filter-row { grid-template-columns: minmax(0, 1fr) 132px; }
.filter-row .input, .filter-row .select { font-size: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.month-grid b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(14px, 4.3vw, 17px); }
.row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bar-head { min-width: 0; }
.bar-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-head > span:last-child { flex: none; }
.card, .list, .att { max-width: 100%; }
.tx-main, .tx-title, .tx-sub { min-width: 0; }
.stat:active, .tx:active, .cat-row:active { background: var(--surface); }

/* ---------- linhas clicáveis de categoria ---------- */
.cat-row { display: block; width: 100%; background: none; border: 0; padding: 0; text-align: left; border-radius: 10px; }
.cat-row .chev { color: var(--faint); margin-left: 4px; }

/* ---------- painel da categoria ---------- */
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cat-head .avatar { width: 44px; height: 44px; border-radius: 14px; }
.cat-head h3 { margin: 0; }
.cat-head small { color: var(--muted); font-size: 13px; }
.cat-big { font-size: 32px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.pill.up { color: var(--neg); background: color-mix(in srgb, var(--neg) 12%, transparent); }
.pill.down { color: var(--pos); background: color-mix(in srgb, var(--pos) 12%, transparent); }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.kpis div { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.kpis span { display: block; font-size: 11.5px; color: var(--muted); }
.kpis b { display: block; font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-section { margin: 18px 0 8px; font-size: 12.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mini-cols { display: flex; align-items: flex-end; gap: 8px; height: 96px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 12px 8px; }
.mini-cols .col .bar { width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; background: var(--c); opacity: .35; min-height: 3px; }
.mini-cols .col.now .bar { opacity: 1; }
.mini-cols .col b { font-size: 10.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.place { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.place + .place { border-top: 1px solid var(--border); }
.place .tx-main { flex: 1; }
.sheet-cta { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }

/* ---------- reservas ---------- */
.res-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; background: none; border: 0; text-align: left; }
.res-item + .res-item { border-top: 1px solid var(--border); }
.res-item .tx-main small { color: var(--muted); font-size: 12px; }

/* ---------- aviso de nova versão ---------- */
.update-bar {
  position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 10px); z-index: 60; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); animation: down .3s ease;
}
.update-bar b { display: block; font-size: 14.5px; }
.update-bar small { display: block; color: var(--muted); font-size: 12.5px; }
@keyframes down { from { transform: translateY(-20px); opacity: 0; } }

/* ---------- período dos gastos por categoria ---------- */
.cat-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 12px; }
.chip.sm { height: 32px; padding: 0 12px; font-size: 13.5px; font-weight: 550; background: var(--surface); border-color: transparent; }
.chip.sm i { font-style: normal; color: var(--muted); margin-left: 2px; }
.cat-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 14px; }
.cat-total b { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.cat-total span { font-size: 13px; }
.fill.over-soft { background: color-mix(in srgb, var(--c) 70%, var(--neg)); }
.span2 { grid-column: 1 / -1; }
.res-item b { color: var(--pos); }

/* ---------- aba Investir ---------- */
.tabbar button span { font-size: 10.5px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 480px) { .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; } .stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .stats.three .stat:last-child { grid-column: auto; } }
.sticky-seg { position: sticky; top: -4px; z-index: 5; margin-top: 2px; }
.alloc { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.alloc i { display: block; height: 100%; background: var(--c); }
.flat-list { border: 0; border-radius: 0; background: none; margin: 0 -4px; }
.tx-amt small.pos { color: var(--pos); } .tx-amt small.neg { color: var(--neg); }
.small-empty { padding: 20px 8px; font-size: 14px; }
.chart { width: 100%; height: 120px; display: block; }
.chart polyline { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .ln-total { stroke: var(--pos); }
.chart .ln-inv { stroke: var(--muted); stroke-dasharray: 4 4; }
.range { width: 100%; accent-color: var(--primary); height: 28px; }
.sim-big { font-size: 32px; font-weight: 650; letter-spacing: -0.03em; margin: 2px 0 4px; }
.sim-cols { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 4px; }
.sim-cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.sim-cols .stack { flex: 1; width: 100%; max-width: 22px; display: flex; flex-direction: column; justify-content: flex-end; }
.sim-cols .gain { display: block; background: var(--pos); border-radius: 4px 4px 0 0; }
.sim-cols .put { display: block; background: var(--text); opacity: .7; border-radius: 0 0 2px 2px; }
.sim-cols small { font-size: 10.5px; color: var(--muted); }
.answer { min-height: 46px; display: flex; align-items: center; font-size: 16px; font-weight: 650; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; }
.steps li::marker { font-weight: 700; color: var(--muted); }
.risk-badge { flex: none; font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px; }
.risk-badge.r1 { color: var(--pos); background: color-mix(in srgb, var(--pos) 12%, transparent); }
.risk-badge.r2 { color: #0d9488; background: color-mix(in srgb, #0d9488 12%, transparent); }
.risk-badge.r3 { color: var(--warn); background: var(--warn-bg); }
.risk-badge.r4, .risk-badge.r5 { color: var(--neg); background: color-mix(in srgb, var(--neg) 12%, transparent); }
.dots { letter-spacing: 1px; font-size: 12px; }
.dots i { font-style: normal; opacity: .2; }
.concept { padding: 0 14px; }
.concept + .concept { border-top: 1px solid var(--border); }
.concept summary { padding: 13px 0; font-weight: 550; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.concept summary::-webkit-details-marker { display: none; }
.concept summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.concept[open] summary::after { content: "–"; }
.concept p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.pc { margin: 0 0 6px; padding-left: 20px; font-size: 14.5px; }
.pc li { margin: 4px 0; }
.pc.pros li::marker { content: "✓  "; color: var(--pos); }
.pc.cons li::marker { content: "!  "; color: var(--neg); font-weight: 700; }

@media (min-width: 481px) { .hero .stats:not(.three) { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.row2 { align-items: end; }
