* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: #f3f4f6; color: #111827; font-size: 18px;
}
.hidden { display: none !important; }
.screen { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 20px; margin: 8px 0 12px; }
.urdu, .urdu-sm { color: #4b5563; }
.center { text-align: center; }
.muted { color: #6b7280; font-size: 15px; }
.error { color: #b91c1c; min-height: 20px; font-size: 15px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.topbar h1 { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  background: #fff; border-radius: 14px; padding: 16px; margin: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.total-card { background: #14532d; color: #fff; text-align: center; }
.total-card .label { font-size: 16px; opacity: .9; }
.total-card .total { font-size: 38px; font-weight: 800; margin-top: 4px; }
.total-card .muted { color: #d1fae5; }

label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 16px; }
input {
  width: 100%; padding: 14px; font-size: 18px; border: 2px solid #d1d5db;
  border-radius: 10px; background: #fff; min-height: 54px;
}
input:focus { outline: none; border-color: #14532d; }

.btn {
  border: none; border-radius: 12px; cursor: pointer; font-weight: 700;
  padding: 14px 18px; font-size: 17px; color: #fff; background: #374151;
  min-height: 54px; touch-action: manipulation;
}
.btn:active { transform: scale(.98); }
.btn.big { width: 100%; min-height: 62px; font-size: 19px; margin: 8px 0; }
.btn-small { padding: 10px 14px; font-size: 15px; min-height: 46px; }
.btn-green { background: #16a34a; }
.btn-orange { background: #ea580c; }
.btn-blue { background: #2563eb; }
.btn-whatsapp { background: #25d366; color: #063; }

.login-box { text-align: center; padding-top: 48px; }
.login-box .logo { font-size: 64px; }
.login-box input { text-align: center; font-size: 26px; letter-spacing: 6px; }

#search { margin: 6px 0 10px; }

.customer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: #fff; border: none; cursor: pointer;
  border-radius: 14px; padding: 16px; margin: 8px 0; min-height: 72px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); font-size: 18px;
}
.customer-row .c-name { font-weight: 700; }
.customer-row .c-phone { color: #6b7280; font-size: 15px; }
.customer-row .c-balance { font-weight: 800; font-size: 21px; color: #b91c1c; white-space: nowrap; }
.customer-row .c-balance.zero { color: #16a34a; }

.row-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-buttons .btn { width: 100%; }

.item-row { display: grid; grid-template-columns: 1fr 64px 96px 34px; gap: 6px; margin-bottom: 8px; }
.item-row input { padding: 10px; font-size: 16px; min-height: 50px; }
.item-row .row-del { background: #fee2e2; color: #b91c1c; border: none; border-radius: 10px; font-size: 18px; cursor: pointer; }
.item-head { display: grid; grid-template-columns: 1fr 64px 96px 34px; gap: 6px; font-size: 13px; color: #6b7280; font-weight: 700; }
.form-total { font-size: 19px; margin: 10px 0; }

.ledger-title { margin-top: 20px; }
.entry {
  background: #fff; border-radius: 12px; padding: 13px 15px; margin: 8px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.entry-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.entry .amt { font-weight: 800; font-size: 20px; white-space: nowrap; }
.entry .amt.udhaar { color: #ea580c; }
.entry .amt.payment { color: #16a34a; }
.entry .date { color: #6b7280; font-size: 14px; }
.entry .items { color: #374151; font-size: 15px; margin-top: 4px; }
.entry .note { color: #6b7280; font-size: 14px; font-style: italic; }
.entry .del { background: none; border: none; color: #b91c1c; cursor: pointer; font-size: 14px; padding: 6px 0 0; font-weight: 700; }
