:root {
  color-scheme: light dark;
  --bg: #0b0f0e;
  --card: #151b1a;
  --border: #2a3332;
  --text: #eef2f1;
  --muted: #9fb0ac;
  --accent: #1e9e6f;
  --red: #e5484d;
  --yellow: #d4a017;
  --green: #2fb872;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px;
}

a { color: inherit; }

.topbar {
  padding: 16px 16px 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.topbar h1 { font-size: 15px; margin: 0 0 4px; color: var(--muted); font-weight: 500; }
.balance { font-size: 34px; font-weight: 700; }
.balance.negative { color: var(--red); }

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  max-width: 480px;
  margin: 0 auto;
}
.tabs button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 4px 14px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tabs button .icon { font-size: 18px; }
.tabs button.active { color: var(--accent); }

.view { padding: 8px 16px 16px; flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }

.row .dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }
.dot.gray { background: var(--muted); }
.dot.blue { background: #4a90d9; }

.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: 14px; }
.row .sub { font-size: 12px; color: var(--muted); }
.row .amount { font-weight: 700; font-size: 14px; white-space: nowrap; }

button.btn {
  background: var(--accent);
  color: #04140d;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 14px;
}
button.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
button.btn.danger { background: var(--red); color: #fff; }
button.btn.small { padding: 6px 10px; font-size: 12px; }
button.btn.full { width: 100%; }

input, select, textarea {
  width: 100%;
  background: #0b100f;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  margin-bottom: 10px;
}
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 18px 0 8px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
}

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card { width: 100%; max-width: 320px; }
.login-card h1 { text-align: center; margin-bottom: 20px; }

.fab {
  position: fixed;
  bottom: 82px;
  right: calc(50% - 240px + 16px);
  background: var(--accent);
  color: #04140d;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 26px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
@media (max-width: 512px) {
  .fab { right: 16px; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.modal {
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 28px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h2 { margin-top: 0; font-size: 17px; }
.modal .actions { display: flex; gap: 8px; margin-top: 14px; }
.modal .actions button { flex: 1; }

.muted { color: var(--muted); font-size: 12px; }
.error-text { color: var(--red); font-size: 13px; margin: -4px 0 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.checkbox-row input { width: auto; margin: 0; }
