:root {
  --bg: #f3f4f6; --card: #ffffff; --text: #0f172a; --muted: #6b7280; --faint: #9ca3af; --line: #eceef2;
  --soft: #f5f6f8; --blue: #2563eb; --blue-d: #1e3a8a; --blue-soft: #e8efff; --pink: #f43f5e; --pink-soft: #ffe9ed;
  --green: #16a34a; --green-soft: #e7f6ec; --amber: #b45309; --amber-soft: #fef3c7; --red: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --r: 18px;
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --card: #141a24; --text: #e8ecf3; --muted: #94a3b8; --faint: #64748b; --line: #222b39;
  --soft: #1b2331; --blue: #4f8cff; --blue-d: #2f5fd0; --blue-soft: #18284a; --pink: #fb6f86; --pink-soft: #3a1a24;
  --green: #34c26b; --green-soft: #12301f; --amber: #fbbf24; --amber-soft: #3a2c0a; --red: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.green { color: var(--green); } .red { color: var(--red); } .blue { color: var(--blue); }
.r { text-align: right; } .grow { flex: 1; min-width: 0; } .row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
svg.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; max-width: 1640px; margin: 0 auto; padding: 16px; min-height: 100vh; }
.side { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 12px 12px; display: flex; flex-direction: column; position: sticky; top: 16px; height: calc(100vh - 32px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand b { display: block; font-size: 14px; } .brand span { font-size: 11px; color: var(--muted); }
.duo { display: flex; } .duo i, .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; flex: none; }
.duo i + i { margin-left: -8px; box-shadow: 0 0 0 2px var(--card); }
.bg-p1 { background: var(--blue); } .bg-p2 { background: var(--pink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.side h6 { margin: 14px 10px 6px; font-size: 11px; font-weight: 500; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; color: var(--text); font-size: 13.5px; text-align: left; }
.nav svg { color: var(--muted); } .nav:hover { background: var(--soft); }
.nav.on { background: var(--soft); font-weight: 600; } .nav.on svg { color: var(--blue); }
.side-foot { margin-top: auto; }
.theme { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { padding: 5px 9px; border-radius: 999px; color: var(--muted); font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg.wide { display: flex; border-radius: 12px; } .seg.wide button { flex: 1; justify-content: center; border-radius: 9px; padding: 8px; }
.who { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 10px 4px; border-top: 1px solid var(--line); margin-top: 8px; text-align: left; }
.who b { display: block; font-size: 13px; } .who span { font-size: 11px; color: var(--muted); }

.main { min-width: 0; padding-bottom: 24px; }
.top { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 16px; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; position: sticky; top: 16px; z-index: 5; }
.top h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; cursor: pointer; white-space: nowrap; }
.top h1 span { color: var(--muted); font-weight: 400; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); position: relative; flex: none; }
.icon-btn:hover { background: var(--soft); } .icon-btn.bd { border: 1px solid var(--line); }
.badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.pri { background: var(--blue); color: #fff; border-color: transparent; } .btn.pri:hover { filter: brightness(1.08); background: var(--blue); }
.btn.danger { color: var(--red); } .btn.sm { padding: 6px 10px; font-size: 12px; }
.offline { background: var(--amber-soft); color: var(--amber); border-radius: 12px; padding: 9px 14px; margin-bottom: 12px; font-size: 13px; }
.banner { background: var(--blue-soft); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- cartões de conteúdo ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card h3 { font-size: 14px; font-weight: 600; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.emoji { font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .15)); user-select: none; }
.emoji.lg { font-size: 84px; }
.big { font-weight: 700; letter-spacing: -.03em; font-size: 34px; line-height: 1.1; white-space: nowrap; }
.big .cur { color: var(--muted); font-weight: 600; margin-right: 5px; } .big .cents { font-size: .42em; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.big.xl { font-size: 60px; } .big.md { font-size: 26px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lbl { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.est { background: var(--amber-soft); color: var(--amber); } .pill.ok { background: var(--green-soft); color: var(--green); } .pill.b { background: var(--blue-soft); color: var(--blue); }

.saldo-line { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 26px; }
.saldo-note { border-left: 1px solid var(--line); padding-left: 14px; font-size: 13px; }
.saldo-note b { font-weight: 600; }
.bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--soft); gap: 2px; }
.bar i { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.legend div span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend div b { font-size: 14.5px; font-weight: 600; display: block; margin-top: 3px; white-space: nowrap; }
.legend div b small { font-weight: 400; color: var(--faint); font-size: 11px; }

.chips { display: flex; gap: 8px; margin: 14px 0 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-d { flex: 1 0 54px; padding: 8px 6px 7px; border-radius: 12px; border: 1px solid var(--line); font-weight: 700; font-size: 14px; text-align: center; }
.chip-d small { display: block; height: 6px; line-height: 6px; font-size: 14px; color: var(--faint); letter-spacing: 1px; font-weight: 400; margin-top: 2px; }
.chip-d.on { background: var(--blue); border-color: var(--blue); color: #fff; } .chip-d.on small { color: #fff; }
.list > * { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.list > *:last-child { border-bottom: 0; }
.list .nm { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.list .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.list .val { font-weight: 600; white-space: nowrap; }
.list button.nm:hover { color: var(--blue); }
.done .nm, .done .val { color: var(--faint); text-decoration: line-through; }
.chk-c { width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid var(--faint); display: grid; place-items: center; flex: none; color: transparent; }
.chk-c.on { background: var(--green); border-color: var(--green); color: #fff; } .chk-c svg { width: 12px; height: 12px; stroke-width: 3; }
.empty { padding: 22px 0; text-align: center; color: var(--muted); font-size: 13px; }

.split-h { display: flex; justify-content: space-between; margin: 16px 0 6px; font-size: 12px; color: var(--muted); }
.split-h b { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-top: 2px; }
.split-bar { position: relative; display: flex; height: 26px; border-radius: 7px; overflow: hidden; font-size: 11px; font-weight: 700; color: #fff; }
.split-bar i { display: flex; align-items: center; padding: 0 9px; font-style: normal; min-width: 0; overflow: hidden; }
.split-bar i:last-child { justify-content: flex-end; }
.split-wrap { position: relative; }
.mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 2px; }
.settle { display: flex; align-items: center; gap: 10px; margin: 16px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }

/* cartão de crédito */
.cc-strip { display: flex; gap: 10px; overflow-x: auto; margin: 14px -20px 0; padding: 0 20px 4px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.cc-strip::-webkit-scrollbar { display: none; }
.cc { flex: 0 0 82%; max-width: 330px; aspect-ratio: 1.62; border-radius: 14px; padding: 16px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; text-align: left; scroll-snap-align: start; opacity: .55; transition: opacity .15s; }
.cc.sel { opacity: 1; box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.cc-preto { background: linear-gradient(135deg, #3a3a3d, #111 60%, #2a2a2d); } .cc-laranja { background: linear-gradient(135deg, #fb923c, #ea580c); }
.cc-azul { background: linear-gradient(135deg, #3b82f6, #1e40af); } .cc-roxo { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.cc-verde { background: linear-gradient(135deg, #22c55e, #15803d); } .cc-rosa { background: linear-gradient(135deg, #fb7185, #be123c); }
.cc-cinza { background: linear-gradient(135deg, #94a3b8, #475569); }
.cc-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; }
.cc-top .pill { background: rgba(255, 255, 255, .2); color: #fff; }
.cc-mid { display: flex; align-items: center; gap: 14px; letter-spacing: .3em; font-size: 11px; font-weight: 600; opacity: .9; }
.cc-chip { width: 34px; height: 25px; border-radius: 5px; background: linear-gradient(135deg, #f5f5f5, #c9c9c9); display: inline-block; }
.cc-bot { display: flex; justify-content: space-between; align-items: flex-end; font-weight: 700; font-size: 13px; }
.cc-bot small { display: block; font-size: 8.5px; letter-spacing: .08em; opacity: .7; font-weight: 600; }
.fut { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-top: 10px; }
.fut div { background: var(--soft); border-radius: 10px; padding: 10px 6px; text-align: center; position: relative; height: 150px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border: 1.5px solid transparent; }
.fut div.on { border-color: var(--blue); background: var(--card); }
.fut div u { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(var(--blue-soft), transparent); border-top: 2px solid var(--blue); text-decoration: none; }
.fut div b, .fut div span { position: relative; font-size: 12px; } .fut div span { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.fut div.on span { color: var(--blue); }
.sect { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 20px; }

/* moradia */
.h-bar { position: relative; height: 16px; border-radius: 6px; background: var(--soft); margin: 26px 0 6px; }
.h-bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); max-width: 100%; }
.h-bar i.over { background: var(--red); }
.h-bar .mark span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.h-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; margin-top: 12px; }
.h-grid div { min-width: 0; } .h-grid span { font-size: 11.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .h-grid b { font-size: 13px; }

/* tabelas simples */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.day { width: 34px; height: 34px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.bal { width: 110px; text-align: right; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.progress { height: 12px; background: var(--soft); border-radius: 7px; overflow: hidden; margin: 14px 0 6px; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 7px; }
.menu-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 4px; border-bottom: 1px solid var(--line); font-size: 15px; text-align: left; }
.menu-list button:last-child { border-bottom: 0; } .menu-list svg { color: var(--blue); width: 18px; height: 18px; }
.code-box { font-size: 30px; font-weight: 700; letter-spacing: .2em; }
.url-box { font-size: 17px; font-weight: 600; word-break: break-all; }

/* ---------- modal ---------- */
.ovl { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.sheet { background: var(--card); border-radius: 20px; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.sheet h2 { font-size: 17px; font-weight: 600; }
.sheet .note { color: var(--muted); font-size: 13px; margin-top: 8px; }
.fld { display: block; margin-top: 14px; } .fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.fld input:not([type=checkbox]), .fld select { width: 100%; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--soft); font-size: 16px; outline: none; min-height: 44px; -webkit-appearance: none; appearance: none; }
.fld input:focus, .fld select:focus { border-color: var(--blue); background: var(--card); }
.fld.chk { display: flex; align-items: center; gap: 10px; font-size: 14px; } .fld.chk input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.fld.chk small { display: block; color: var(--muted); font-size: 11.5px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-foot { display: flex; gap: 8px; margin-top: 20px; } .sheet-foot .btn { padding: 12px 14px; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.center-screen .card { max-width: 380px; width: 100%; text-align: center; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 14px; margin-top: 10px; font-size: 16px; font-weight: 600; }
.pick:hover { background: var(--soft); }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: 90vw; }
#toast.on { opacity: 1; }
.tabbar { display: none; }

/* ---------- telas menores ---------- */
@media (max-width: 1180px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .legend { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { display: block; padding: 10px 10px calc(84px + env(safe-area-inset-bottom)); padding-top: calc(10px + env(safe-area-inset-top)); }
  .side { display: none; }
  .top { top: calc(8px + env(safe-area-inset-top)); padding: 8px 10px; gap: 2px; margin-bottom: 10px; }
  .top h1 { font-size: 18px; } .btn .txt { display: none; }
  .two, .three, .tiles { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cols, .col { gap: 10px; } .tiles { margin-bottom: 10px; }
  .card { padding: 16px; } .settle { margin: 16px -16px -16px; padding: 14px 16px; }
  .cc-strip { margin: 14px -16px 0; padding: 0 16px 4px; }
  .big.xl { font-size: 42px; } .big { font-size: 28px; } .emoji { font-size: 40px; } .emoji.lg { font-size: 52px; }
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saldo-note { border-left: 0; padding-left: 0; width: 100%; } .saldo-line { margin: 10px 0 18px; gap: 8px; }
  .bal { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 10.5px; color: var(--muted); }
  .tabbar button svg { width: 21px; height: 21px; } .tabbar button.on { color: var(--blue); font-weight: 600; }
  .ovl { place-items: end center; padding: 0; }
  .sheet { border-radius: 20px 20px 0 0; max-width: none; padding-bottom: calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; max-height: 92dvh; }
}
.saldo-up { margin-top: -36px; }
@media (max-width: 860px) { .saldo-up { margin-top: 4px; } }
.who .av { color: #fff; font-size: 11px; }
.fut.fut6 { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fut.fut6 div { height: 104px; }
@media (max-width: 860px) {
  .banner .grow { flex-basis: 100%; }
  .cols { display: flex; flex-direction: column; }
  .cols > .col { display: contents; }
  .cols .card, .cols .two { order: 3; }
  .cols .two .card { order: 0; }
  .cols .o1 { order: 1; }
  .cols .o2 { order: 2; }
}
