/* BizTrack Malawi - mobile-first styles (NFR-1: one-handed, 44px targets) */
* { box-sizing: border-box; }
:root { color-scheme: light; }
body {
  margin: 0 0 76px; font-family: system-ui, -apple-system, sans-serif;
  background: #f7f7f5; color: #1a1a1a; font-size: 16px;
}
.topbar { background: #1a5c2e; padding: 14px 16px; }
.topbar h1 { color: #fff; font-size: 1.1rem; margin: 0; }
main { padding: 16px; max-width: 520px; margin: 0 auto; }
.card { background: #fff; border: 1px solid #e5e5e0; border-radius: 12px; padding: 20px 16px; }
.stub p { color: #666; text-align: center; margin: 8px 0; }

h2 { font-size: 1rem; margin: 0 0 12px; }

.seg { display: flex; gap: 6px; margin-bottom: 16px; }
.seg-btn {
  flex: 1; min-height: 44px; border: 1px solid #d8d8d0; background: #fff;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; color: #444;
}
.seg-btn.active { background: #1a5c2e; border-color: #1a5c2e; color: #fff; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: #555; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font-size: 1rem;
  border: 1px solid #d8d8d0; border-radius: 8px; background: #fff; font-family: inherit;
}
#amount { font-size: 1.2rem; font-weight: 700; }
.err { color: #b3261e; font-size: 0.8rem; margin: 5px 0 0; }

.link-btn { background: none; border: none; color: #1a5c2e; font-size: 0.8rem; font-weight: 600; padding: 6px 0; cursor: pointer; }
#add-cat-row { display: flex; gap: 8px; margin-top: 6px; }
#add-cat-row input { flex: 1; }

.btn {
  min-height: 48px; border: none; border-radius: 10px; font-size: 1rem;
  font-weight: 700; width: 100%; cursor: pointer;
}
.btn.primary { background: #1a5c2e; color: #fff; }
.btn.small { width: auto; min-height: 44px; padding: 0 18px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.6; }

.banner { background: #fdecea; border: 1px solid #f5c6c0; color: #8a1c11; padding: 10px 12px; border-radius: 8px; font-size: 0.85rem; margin-top: 12px; }

#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #1a5c2e; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; z-index: 50;
}

.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid #eee;
}
.tx-row:last-child { border-bottom: none; }
.badge { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.badge.cash_sale { background: #e7f3e9; color: #1a5c2e; }
.badge.credit_sale { background: #fdf3e2; color: #8a6116; }
.badge.expense { background: #fdecea; color: #8a1c11; }
.who { font-weight: 600; font-size: 0.85rem; }
.note { color: #888; font-size: 0.8rem; display: block; }
.right { text-align: right; }
.amt { font-weight: 700; display: block; }
.date { color: #888; font-size: 0.75rem; }
.muted { color: #888; font-size: 0.9rem; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: #fff; border-top: 1px solid #e5e5e0;
}
.nav-btn {
  flex: 1; min-height: 60px; background: none; border: none; font-size: 0.75rem;
  font-weight: 600; color: #777; cursor: pointer;
}
.nav-btn.active { color: #1a5c2e; }

/* Feature 2: list filters, day groups, edit mode */
.filters { display: grid; gap: 8px; margin-bottom: 14px; }
.filters input, .filters select { width: 100%; min-height: 44px; padding: 8px 10px; font-size: 0.9rem; border: 1px solid #d8d8d0; border-radius: 8px; background: #fff; font-family: inherit; }
.day-head { font-size: 0.75rem; font-weight: 700; color: #1a5c2e; margin: 14px 0 2px; text-transform: uppercase; letter-spacing: 0.03em; }
.tx-row { cursor: pointer; }
.tx-main { flex: 1; min-width: 0; }
.tx-main .amt { display: block; margin-top: 2px; }
.del-btn {
  min-height: 44px; min-width: 60px; background: none; border: none; color: #b3261e;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
}
.btn.plain { background: #fff; color: #1a5c2e; border: 1px solid #d8d8d0; margin-bottom: 10px; }

/* Feature 3: dashboard stats */
.stat { padding: 14px 0; border-bottom: 1px solid #eee; }
.stat:last-of-type { border-bottom: none; }
.stat-label { font-size: 0.8rem; font-weight: 600; color: #555; margin: 0 0 4px; }
.stat-value { font-size: 1.5rem; font-weight: 800; margin: 0; }
.stat-sub { font-size: 0.75rem; color: #888; margin: 4px 0 0; }

/* Feature 4: debt tracking */
.cust-list { list-style: none; margin: 0; padding: 0; }
.cust-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid #eee;
}
.cust-row:last-child { border-bottom: none; }
.cust-row .who { font-weight: 600; display: block; }
.cust-bal { font-size: 0.85rem; font-weight: 700; }
.cust-bal.owes { color: #8a6116; }
.cust-bal.advance { color: #1a5c2e; }
.pay-btn { background: #fff; color: #1a5c2e; border: 1px solid #1a5c2e; }
.badge.payment { background: #e7f3e9; color: #1a5c2e; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 40;
}
.modal-card {
  background: #fff; border-radius: 16px 16px 0 0; padding: 20px 16px 24px;
  width: 100%; max-width: 520px;
}
.modal-card h3 { margin: 0 0 4px; font-size: 1.05rem; }

.modal[hidden] { display: none; }

/* Feature 5: reports */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.week-nav h2 { margin: 0; flex: 1; text-align: center; }
.week-nav button {
  min-width: 44px; min-height: 44px; border: 1px solid #d8d8d0; background: #fff;
  border-radius: 8px; font-size: 1.3rem; color: #1a5c2e; cursor: pointer;
}
.week-nav button:disabled { opacity: 0.35; cursor: default; }
#csv-btn { margin-top: 12px; }
