:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-2: #1f232c;
  --line: #2a2f3a;
  --text: #eef0f4;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --owe: #ff6b6b;
  --ok: #3ecf8e;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button, input, select { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; background: rgba(15,17,21,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 14px 16px 0; }
.brand { display: flex; gap: 12px; align-items: center; max-width: 760px; margin: 0 auto; }
.logo { font-size: 30px; }
h1 { font-size: 19px; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; max-width: 760px; margin: 12px auto 0; }
.tab { flex: 1; background: none; border: 0; padding: 10px 0 12px; color: var(--muted);
  border-bottom: 2px solid transparent; cursor: pointer; font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px 60px; }
.view { display: none; }
.view.active { display: block; }

.hero { background: linear-gradient(135deg, #1d2a4a, #182032); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; border: 1px solid #26365c; }
.hero-label { margin: 0; color: #aab7d6; font-size: 14px; }
.hero-amount { margin: 4px 0 0; font-size: 32px; font-weight: 700; letter-spacing: -.5px; }

.cards { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; width: 100%;
  background: none; border: 0; text-align: left; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; background: var(--card-2); flex-shrink: 0; }
.who { flex: 1; min-width: 0; }
.who b { display: block; }
.who small { color: var(--muted); }
.amt { font-weight: 700; white-space: nowrap; }
.amt.owe { color: var(--owe); }
.amt.ok { color: var(--ok); }
.amt.zero { color: var(--muted); font-weight: 500; }
.chev { color: var(--muted); transition: transform .15s; }
.card.open .chev { transform: rotate(90deg); }
.detail { display: none; border-top: 1px solid var(--line); padding: 6px 16px 12px; }
.card.open .detail { display: block; }
.dline { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0;
  border-bottom: 1px dashed var(--line); font-size: 14px; }
.dline:last-child { border-bottom: 0; }
.dline span:first-child { color: var(--muted); }
.dline .plus { color: var(--ok); }
.dline .minus { color: var(--owe); }
.section-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
  margin: 22px 4px 8px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.toolbar input, .toolbar select { background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; }
.toolbar input { flex: 1; min-width: 0; }
.count { color: var(--muted); font-size: 13px; margin: 4px 4px 0; }
.month { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: capitalize;
  margin: 18px 4px 8px; display: flex; justify-content: space-between; }
.tx { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; overflow: hidden; }
.tx-head { display: flex; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer;
  width: 100%; background: none; border: 0; text-align: left; }
.ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--card-2); font-size: 18px; flex-shrink: 0; }
.tx-main { flex: 1; min-width: 0; }
.tx-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { color: var(--muted); font-size: 13px; }
.tx-amt { text-align: right; white-space: nowrap; }
.tx-amt b { display: block; }
.tx-amt small { color: var(--muted); font-size: 12px; }
.tx.remb .tx-amt b { color: var(--ok); }
.tx .detail { display: none; }
.tx.open .detail { display: block; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
