:root {
  --green: #22402f;
  --green-2: #3e6b52;
  --green-soft: #e7efe7;
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #22302a;
  --muted: #6b7a70;
  --line: #e4ded0;
  --bar-bg: #eae4d3;
  --warn: #c07f2a;
  --red: #b4483c;
  --pos: #2e7d4f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(34, 64, 47, 0.08), 0 4px 14px rgba(34, 64, 47, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------- banner ---------- */
.demo-banner {
  background: var(--green);
  color: #f3efe2;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 9px 14px;
}

/* ---------- header ---------- */
.app-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--green); color: #dcead9;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; color: var(--green); line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.household-chip {
  font-size: 12.5px; font-weight: 600; color: var(--green);
  background: var(--green-soft); border: 1px solid #cfdfd0;
  padding: 5px 11px; border-radius: 99px; white-space: nowrap;
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; padding-top: 16px; }
.tab {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 99px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line);
}
.tab:hover { color: var(--green); border-color: var(--green-2); }
.tab.active { background: var(--green); border-color: var(--green); color: #f3efe2; }

/* ---------- views / cards ---------- */
.view { padding: 16px 0 8px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 15px; font-weight: 700; color: var(--green); letter-spacing: 0.01em; margin-bottom: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-head h2 { margin-bottom: 12px; }
.hint { font-size: 12.5px; color: var(--muted); }
.link-btn {
  font: inherit; font-size: 13px; font-weight: 600;
  background: none; border: none; color: var(--green-2); cursor: pointer; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.stack { display: flex; flex-direction: column; }
.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; align-items: start; }
.dash-grid .card { margin-bottom: 14px; }

/* ---------- summary ---------- */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.summary-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
}
.summary-card .label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.summary-card .value { font-size: 24px; font-weight: 800; color: var(--green); margin-top: 4px; letter-spacing: -0.01em; }
.summary-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.summary-card .value.debt { color: var(--red); }

/* ---------- accounts ---------- */
.account-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.account-row:last-child { border-bottom: none; padding-bottom: 2px; }
.account-dot { width: 36px; height: 36px; border-radius: 10px; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: 0 0 auto; }
.account-main { flex: 1; min-width: 0; }
.account-name { font-weight: 650; font-size: 14.5px; }
.account-meta { font-size: 12px; color: var(--muted); }
.account-bal { font-weight: 750; font-size: 15px; text-align: right; white-space: nowrap; }
.account-bal small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.account-bal.owed { color: var(--red); }

/* ---------- transactions ---------- */
.txn-row { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.txn-row:last-child { border-bottom: none; padding-bottom: 2px; }
.txn-main { flex: 1; min-width: 0; }
.txn-desc { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta { font-size: 12px; color: var(--muted); }
.txn-amt { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.txn-amt.pos { color: var(--pos); }
.empty-note { font-size: 13.5px; color: var(--muted); padding: 8px 0 2px; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.filters label, .add-form label { font-size: 12px; font-weight: 650; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }

/* ---------- budgets ---------- */
.budget-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.budget-row:last-child { border-bottom: none; }
.budget-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.budget-name { font-weight: 650; font-size: 14.5px; }
.budget-nums { font-size: 13px; color: var(--muted); white-space: nowrap; }
.budget-nums b { color: var(--ink); }
.bar { height: 10px; background: var(--bar-bg); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green-2); border-radius: 99px; transition: width 0.35s ease; }
.bar.warn > i { background: var(--warn); }
.bar.over > i { background: var(--red); }
.budget-total { margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; }
.budget-total b { color: var(--green); }

/* ---------- alerts ---------- */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  background: #fbf8f0; border: 1px solid var(--line); border-left: 4px solid var(--green-2);
  border-radius: 10px; padding: 11px 12px; margin-bottom: 10px;
}
.alert.warn { border-left-color: var(--warn); }
.alert:last-child { margin-bottom: 2px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 14px; font-weight: 700; }
.alert-text { font-size: 13px; color: var(--muted); margin-top: 1px; }
.alert-x {
  font: inherit; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 17px; line-height: 1; padding: 2px 4px; flex: 0 0 auto;
}
.alert-x:hover { color: var(--ink); }

/* ---------- form ---------- */
.add-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; margin-top: 10px; }
.add-form input, .add-form select, .filters select {
  font: inherit; font-size: 14px; color: var(--ink);
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; width: 100%;
}
.add-form input:focus, .add-form select:focus, .filters select:focus { outline: 2px solid var(--green-2); outline-offset: 0; border-color: var(--green-2); }
.primary-btn {
  font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  background: var(--green); color: #f3efe2; border: none;
  padding: 11px 16px; border-radius: 9px; width: 100%;
}
.primary-btn:hover { background: var(--green-2); }

/* ---------- footer ---------- */
.footer { padding-top: 6px; padding-bottom: 28px; }
.footer p { font-size: 12.5px; color: var(--muted); max-width: 640px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .add-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .add-form { grid-template-columns: 1fr; }
  .summary-card .value { font-size: 20px; }
  .household-chip { display: none; }
  .tabs { flex-wrap: wrap; }
}
