/* RA-PORTAL BUILD 20260912b */
/* ============================================================
   Red Apple — Customer Portal
   Mobile-first, built for mandi customers on modest phones:
   very large tap targets, few words, big numbers, strong icons.
   No CSS framework, no build step. One font family, swap-safe.
   ============================================================ */

:root {
  --red:        #C62828;
  --red-dark:   #8E1F1F;
  --red-soft:   #FDECEA;
  --green:      #2E7D32;
  --green-soft: #E8F5E9;
  --amber:      #F57C00;
  --amber-soft: #FFF3E0;
  --ink:        #1A1A1A;
  --muted:      #6B6B6B;
  --line:       #E4E4E4;
  --bg:         #F6F6F7;
  --card:       #FFFFFF;
  --r:          16px;
  --shadow:     0 2px 10px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 28px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin-bottom: 16px;
}

/* ---------- Brand header ---------- */
.brand {
  background: linear-gradient(135deg, #C62828 0%, #A31D1D 100%);
  color: #fff;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.brand-left { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-logo {
  width: 42px; height: 42px;
  background: #fff;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

.brand-name { font-size: 19px; font-weight: 700; line-height: 1.15; }
.brand-sub   { font-size: 12px; opacity: 0.85; font-weight: 500; }

.brand-action {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.45);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  flex: none;
}
.brand-action:active { background: rgba(255,255,255,0.28); }

/* ---------- Typography ---------- */
h1.title {
  font-size: 25px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

p.lead {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 22px;
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 26px 0 10px;
}

/* ---------- Big illustrated icon ---------- */
.hero-icon {
  width: 76px; height: 76px;
  border-radius: 22px;
  background: var(--red-soft);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}

/* ---------- Inputs ---------- */
.field { margin-bottom: 18px; }

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.phone-row {
  display: flex;
  align-items: stretch;
  border: 2px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s;
}
.phone-row:focus-within { border-color: var(--red); }

.phone-prefix {
  display: flex; align-items: center;
  padding: 0 14px;
  background: #F2F2F3;
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  border-right: 2px solid var(--line);
}

input.big {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  padding: 18px 14px;
  font-family: inherit;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--ink);
  background: #fff;
  min-width: 0;
  -webkit-appearance: none;
}
input.big::placeholder { color: #BDBDBD; font-weight: 500; letter-spacing: 1px; }

input.otp {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 14px;
  outline: none;
  padding: 18px 14px;
  font-family: inherit;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 12px;
  text-align: center;
  color: var(--ink);
  background: #fff;
  -webkit-appearance: none;
}
input.otp:focus { border-color: var(--red); }
input.otp::placeholder { letter-spacing: 8px; color: #D5D5D5; font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 58px;
  padding: 16px 20px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, background 0.15s;
}
.btn:active { transform: scale(0.985); }

.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(198,40,40,0.28); }
.btn-primary:active { background: var(--red-dark); }
.btn-primary:disabled { background: #D9AFAF; box-shadow: none; cursor: not-allowed; }

.btn-green { background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(46,125,50,0.26); }
.btn-green:active { background: #24632A; }

.btn-outline {
  background: #fff;
  color: var(--red);
  border: 2px solid var(--red);
  min-height: 52px;
  font-size: 16px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--red);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  width: 100%;
  cursor: pointer;
}
.btn-text:disabled { color: var(--muted); cursor: default; }

/* ---------- Messages ---------- */
.alert {
  display: none;
  align-items: flex-start;
  gap: 9px;
  background: var(--red-soft);
  color: var(--red-dark);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
}
.alert.show { display: flex; }

.note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-top: 14px;
  justify-content: center;
  text-align: center;
}

.sent-to {
  background: var(--green-soft);
  color: #1B5E20;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 18px;
}

/* ---------- Ads ---------- */
.ad {
  background: linear-gradient(135deg, #FFF6E6 0%, #FFE9C7 100%);
  border: 1px solid #FFD79A;
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
  text-align: center;
}

.ad-text {
  font-size: 16px;
  font-weight: 600;
  color: #6E4200;
  margin-bottom: 14px;
  line-height: 1.45;
}

.ad .btn { min-height: 50px; font-size: 16px; }

.ad-dots { display: flex; gap: 6px; justify-content: center; margin-top: 12px; }
.ad-dot { width: 7px; height: 7px; border-radius: 50%; background: #E0BE86; }
.ad-dot.on { background: var(--amber); width: 20px; border-radius: 4px; }

/* ---------- App download block ---------- */
.appblock {
  background: linear-gradient(160deg, #1F1F22 0%, #2E2124 100%);
  color: #fff;
  border-radius: var(--r);
  padding: 24px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.appblock h2 {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 6px;
  text-align: center;
}
.appblock .appsub {
  font-size: 15px;
  color: #C9C6C7;
  text-align: center;
  margin: 0 0 20px;
}

.feat {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.feat:last-of-type { border-bottom: none; margin-bottom: 8px; }

.feat-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.10);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.feat-text { font-size: 15.5px; font-weight: 500; line-height: 1.4; }

/* ---------- Lists (shops / bills) ---------- */
.row-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.08s;
}
.row-card:active { transform: scale(0.99); background: #FCFCFC; }

.row-avatar {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--red-soft);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  flex: none;
}

.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.row-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.row-arrow { color: #C4C4C4; flex: none; }

.bill-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  border-left: 5px solid transparent;
}
.bill-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bill-date { font-size: 14px; color: var(--muted); font-weight: 500; }
.bill-amt { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.bill-amt.due { color: var(--red); }
.bill-amt.clear { color: var(--green); }
.bill-foot { font-size: 13px; color: var(--muted); margin-top: 6px; }

.bill-new { border-left-color: var(--green); animation: flashin 2s ease-out; }
@keyframes flashin {
  0% { background: var(--green-soft); }
  100% { background: var(--card); }
}

.tag-new {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
  margin-left: 7px;
  letter-spacing: 0.4px;
  vertical-align: middle;
}

/* ---------- Live bar ---------- */
.livebar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 4px 0 14px;
}
.livedot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.7s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(46,125,50,0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(46,125,50,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }
}
.live-updated {
  margin-left: auto;
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}

/* ---------- Back link ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--red);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 0;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

/* ---------- Empty / loading ---------- */
.empty, .loading {
  text-align: center;
  color: var(--muted);
  padding: 36px 18px;
  font-size: 15.5px;
}
.empty-icon { margin-bottom: 12px; }

.spinner {
  width: 26px; height: 26px;
  border: 3px solid #E4E4E4;
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bill detail ---------- */
.detail-head { text-align: center; padding-bottom: 16px; border-bottom: 2px dashed var(--line); margin-bottom: 16px; }
.detail-shop { font-size: 21px; font-weight: 700; }
.detail-city { font-size: 14px; color: var(--muted); }
.detail-date { font-size: 14px; color: var(--muted); margin-top: 4px; }

table.items { width: 100%; border-collapse: collapse; font-size: 15px; margin-bottom: 18px; }
table.items th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--line);
}
table.items td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
table.items td:last-child, table.items th:last-child { text-align: right; font-weight: 600; }

/* Nug / Wt. / Rate / Amount — sab number wale column daayein taraf, taaki
   ginti aankh se milaana aasan ho. Phone par 5 column tang na lagein isliye
   font thoda chhota aur padding kam. */
table.items th.n, table.items td.n { text-align: right; white-space: nowrap; }
table.items td:first-child, table.items th:first-child { text-align: left; }
table.items .per { font-size: 11px; color: var(--muted, #777); margin-left: 2px; }
@media (max-width: 420px) {
  table.items { font-size: 13px; }
  table.items th, table.items td { padding: 8px 3px; }
}

.sumrow {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 16px;
}
.sumrow span:last-child { font-weight: 600; }
.sumrow.grand {
  border-bottom: none; border-top: 2px solid var(--ink);
  margin-top: 6px; padding-top: 14px; font-size: 19px; font-weight: 700;
}
.sumrow.grand span:last-child { font-weight: 700; }

.actions { display: flex; gap: 10px; margin-top: 8px; }
.actions .btn { flex: 1; }

/* ---------- Footer ---------- */
.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 26px 16px 34px;
  line-height: 1.7;
}
.foot a { color: var(--red); text-decoration: none; font-weight: 600; }

.help-fab {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: #25D366; color: #fff;
  border-radius: 14px; padding: 14px;
  font-weight: 700; font-size: 16px; text-decoration: none;
  margin-bottom: 16px;
}

/* ---------- Print ---------- */
@media print {
  .brand, .ad, .actions, .back, .livebar, .appblock, .foot, .help-fab, .no-print {
    display: none !important;
  }
  body { background: #fff; font-size: 13pt; }
  .wrap { max-width: 100%; padding: 0; }
  .card { box-shadow: none; padding: 0; border-radius: 0; }
}

/* Small phones (360px and below) */
@media (max-width: 360px) {
  body { font-size: 16px; }
  h1.title { font-size: 22px; }
  input.big { font-size: 21px; }
  input.otp { font-size: 27px; letter-spacing: 9px; }
}

/* ---- Parchi ka neeche wala hisaab (Old Bal / Receipts / Net Bal / Crates) ----
   Bill ke total se alag dikhna chahiye — ye "is bill ka" nahi, "poore khaate
   ka" hisaab hai. Isliye upar ek lakeer aur halka background. */
.ledger, .crates {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}
.ledger .sumrow, .crates .sumrow { border-bottom: none; padding: 7px 0; }
.sumrow.netbal {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-weight: 700;
  font-size: 17px;
}
.crates { margin-top: 12px; }
.crates-head {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.crates-marka {
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}
