
/* Layout: app de uma coluna (max 520px), cabeçalho com mês, conteúdo rolável, barra de abas fixa embaixo e botão de lançar flutuante */
:root {
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-2: #e3e9e7;
  --ink: #15211e;
  --muted: #5d6c68;
  --line: #d3dcd9;
  --accent: #0d6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #d4ebe5;
  --in: #0d7a4f;
  --out: #c2412d;
  --warn: #b7791f;
  --warn-soft: #f8ecd4;
  --out-soft: #f7ddd7;
  --shadow: 0 1px 2px rgba(15, 40, 35, .06), 0 8px 24px rgba(15, 40, 35, .08);
  --f-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --f-num: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1513; --surface: #16201d; --surface-2: #1f2b28; --ink: #e6efec; --muted: #94a5a0; --line: #2a3734;
    --accent: #4fc2a8; --accent-ink: #062520; --accent-soft: #163a33; --in: #5fd39a; --out: #f08a72; --warn: #e3b05a;
    --warn-soft: #3a2f1a; --out-soft: #3d221c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1513; --surface: #16201d; --surface-2: #1f2b28; --ink: #e6efec; --muted: #94a5a0; --line: #2a3734;
  --accent: #4fc2a8; --accent-ink: #062520; --accent-soft: #163a33; --in: #5fd39a; --out: #f08a72; --warn: #e3b05a;
  --warn-soft: #3a2f1a; --out-soft: #3d221c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f-body); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.app { max-width: 520px; margin: 0 auto; min-height: 100%; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 120px; }

/* cabeçalho */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px 10px; }
.brand { font: 800 22px/1 var(--f-display); letter-spacing: -.03em; display: flex; align-items: center; gap: 8px; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.month { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.month button { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.month button:hover { background: var(--surface-2); color: var(--ink); }
.month span { min-width: 92px; text-align: center; font-weight: 600; font-size: 14px; text-transform: capitalize; }

.banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--warn-soft); color: var(--ink); border-radius: var(--r); padding: 10px 14px; font-size: 13px; margin-bottom: 12px; }
.banner button { border: 0; background: var(--ink); color: var(--bg); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 13px; }

.view { display: flex; flex-direction: column; gap: 14px; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h2 { font: 700 17px/1.2 var(--f-display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0; }

/* saldo */
.hero { background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 18px 18px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.hero .label { color: inherit; opacity: .78; }
.hero .big { font: 700 34px/1.05 var(--f-num); letter-spacing: -.04em; margin-top: 4px; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; border-top: 1px solid color-mix(in srgb, var(--accent-ink) 22%, transparent); padding-top: 12px; }
.hero-row div { min-width: 0; }
.hero-row .v { font: 600 14px/1.2 var(--f-num); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* donut */
.donut-wrap { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; }
.donut { position: relative; width: 132px; height: 132px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut .c b { font: 700 15px/1.1 var(--f-num); }
.donut .c small { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.legend div { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend b { font: 500 12px var(--f-num); color: var(--muted); }

/* listas */
.list { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font: 700 13px var(--f-display); color: #fff; }
.row .t { min-width: 0; }
.row .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t small { color: var(--muted); font-size: 12px; }
.amt { font: 600 14px var(--f-num); text-align: right; white-space: nowrap; }
.amt.in { color: var(--in); }
.amt.out { color: var(--ink); }
.row.clickable { cursor: pointer; }
.row.clickable:hover .t b { color: var(--accent); }
.day { font-size: 12px; font-weight: 700; color: var(--muted); padding: 14px 0 2px; display: flex; justify-content: space-between; text-transform: capitalize; }
.pay { border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 13px; }
.pay:hover { background: var(--accent); color: var(--accent-ink); }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.late { background: var(--out-soft); color: var(--out); }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 8px; }

/* orçamento */
.bud { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.bud:first-child { border-top: 0; }
.bud-h { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.bud-h b { font-weight: 600; }
.bud-h span { font: 500 13px var(--f-num); color: var(--muted); white-space: nowrap; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s ease; }
.bud.warn .bar i { background: var(--warn); }
.bud.over .bar i { background: var(--out); }
.bud small { font-size: 12px; color: var(--muted); }
.bud.over small { color: var(--out); font-weight: 600; }
.bud.warn small { color: var(--warn); font-weight: 600; }

/* abas */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 9px; font-size: 11px; font-weight: 600; color: var(--muted); }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="true"] { color: var(--accent); }
.fab { justify-self: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); display: grid; place-items: center; transform: translateY(-14px); }
.fab svg { width: 26px; height: 26px; }

/* folha de lançamento */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(5, 15, 12, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: calc(100% - 24px); overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px max(18px, env(safe-area-inset-left, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 14px; animation: up .22s ease; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .bar i { transition: none; } }
.grab { width: 40px; height: 4px; border-radius: 9px; background: var(--line); margin: 4px auto 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 9px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg button[aria-pressed="true"][data-v="saida"] { color: var(--out); }
.seg button[aria-pressed="true"][data-v="entrada"] { color: var(--in); }
.valor { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.valor:focus-within { border-color: var(--accent); }
.valor span { font: 600 20px var(--f-num); color: var(--muted); }
.valor input { border: 0; background: transparent; outline: none; width: 100%; font: 700 36px/1.1 var(--f-num); letter-spacing: -.03em; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .field select { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.repeat { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border-radius: 12px; padding: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.btn { border: 0; border-radius: 12px; padding: 13px; font-weight: 700; background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--out-soft); color: var(--out); }
.btns { display: flex; gap: 8px; }
.err { color: var(--out); font-size: 13px; font-weight: 600; }

/* mais */
.opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.opt:first-child { border-top: 0; }
.opt .t { min-width: 0; }
.opt small { display: block; color: var(--muted); font-size: 12px; }
.mini { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 7px 12px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.inline-form { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; }
.inline-form input { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 10px; min-width: 0; }
textarea.backup { width: 100%; min-height: 90px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px; font: 12px var(--f-num); resize: vertical; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (max-width: 380px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } .legend { width: 100%; } .hero .big { font-size: 28px; } }

/* login */
.auth { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-brand .ms-logo { width: 72px; height: 72px; object-fit: contain; }
.auth-brand h1 { font: 800 26px/1.1 var(--f-display); letter-spacing: -.03em; margin: 0; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 14px; max-width: 32ch; }
.auth-form { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); }
.ok { color: var(--in); font-size: 13px; font-weight: 600; }
.legal { font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.legal a, .auth-alt a { color: var(--accent); font-weight: 600; }
.plan-badge { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.plan-badge.pro { background: var(--accent); color: var(--accent-ink); }
.pro-card { background: var(--accent-soft); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pro-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.syncing { font-size: 12px; color: var(--muted); }
.btn[disabled] { opacity: .6; cursor: wait; }

/* realizado x a realizar */
.pill.pend { background: var(--warn-soft); color: var(--warn); }
.amt.pend { color: var(--muted); }
.row.has-act { grid-template-columns: 36px 1fr auto 34px; }
.ok-btn { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); display: grid; place-items: center; padding: 0; }
.ok-btn svg { width: 18px; height: 18px; }
.ok-btn:hover { background: var(--accent); color: var(--accent-ink); }
.ok-btn[disabled] { opacity: .5; }
.status-check { background: var(--bg); border-radius: 12px; padding: 12px; }
.neg { color: var(--out) !important; }
.hero .v.neg { color: inherit !important; text-decoration: underline wavy; }
.muted-s { font-size: 13px; color: var(--muted); text-transform: capitalize; }
.flow-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.flow-sum > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow-sum b { font-size: 16px; }
.flow-sum b.in { color: var(--in); }
.flow-sum small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.flow-chart { width: 100%; height: auto; display: block; }
.flow-chart .area { fill: var(--accent-soft); }
.flow-chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.flow-chart .zero { stroke: var(--out); stroke-dasharray: 4 4; stroke-width: 1; }
.flow-chart .hoje { stroke: var(--muted); stroke-dasharray: 2 3; stroke-width: 1; }
.flow-chart .end { fill: var(--accent); }
.flow-chart .lbl { fill: var(--muted); font: 600 10px var(--f-body); }
.alerta { margin: 0; background: var(--out-soft); color: var(--out); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.assinatura { text-align: center; font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.assinatura b { color: var(--ink); font-weight: 700; }
