:root {
  --bg: #0f1115; --card: #181b22; --card2: #20242d; --line: #2a2f3a; --text: #e8eaef; --muted: #8b93a3;
  --accent: #4f8cff; --in: #34c47c; --out: #ff6b6b; --warn: #f5b942; --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f5f8; --card: #fff; --card2: #f0f2f6; --line: #e2e5eb; --text: #151821; --muted: #667085; color-scheme: light; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
#app { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 13px; }
.in { color: var(--in); } .out { color: var(--out); } .warn { color: var(--warn); }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats .card { margin: 0; }
.monthbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.monthbar button { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 10px; width: 40px; height: 36px; font-size: 18px; }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; }
.list .item { display: flex; gap: 12px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list .item:last-child { border-bottom: 0; }
.dot { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; flex: none; color: #fff; font-size: 13px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.pill.paid { background: rgba(52,196,124,.15); color: var(--in); }
.pill.overdue { background: rgba(255,107,107,.15); color: var(--out); }
.pill.due_soon { background: rgba(245,185,66,.15); color: var(--warn); }
.pill.new { background: rgba(79,140,255,.18); color: var(--accent); }
.banner { background: rgba(79,140,255,.12); border: 1px solid rgba(79,140,255,.35); color: var(--text); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.date-h { font-size: 12px; color: var(--muted); margin: 14px 2px 2px; font-weight: 600; }
button, .btn { font: inherit; cursor: pointer; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; width: 100%; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--out); border: 1px solid var(--out); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btns { display: flex; gap: 8px; margin-top: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--card2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 9px; font-weight: 600; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.amount-input { font-size: 30px; font-weight: 700; text-align: center; }
nav#nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around; align-items: center;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
nav#nav button { background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; font-size: 11px; gap: 2px; min-width: 60px; }
nav#nav button span { font-size: 20px; line-height: 1; }
nav#nav button.on { color: var(--accent); }
#fab { width: 54px !important; min-width: 54px !important; height: 54px; border-radius: 50%; background: var(--accent) !important; color: #fff !important; font-size: 28px !important; margin-top: -26px; box-shadow: 0 6px 18px rgba(79,140,255,.45); }
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
#sheet .sheet-body { background: var(--card); width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); background: #222832; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: 90vw; }
.login { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.login .logo { font-size: 46px; font-weight: 800; letter-spacing: -.04em; color: var(--accent); }
pre.sms { white-space: pre-wrap; font-size: 12px; background: var(--card2); padding: 10px; border-radius: 10px; margin: 6px 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
