/* ArjunSheet — customer PWA styles. Green/white theme matching the mockups. */
:root {
  --green: #0f7a3d;
  --green-d: #0a5c2e;
  --green-l: #16a34a;
  --green-soft: #e8f5ee;
  --orange: #f59e0b;
  --orange-soft: #fff4e0;
  --red: #dc2626;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f5;
  --card: #ffffff;
  --veil: rgba(244, 246, 245, .72);
  --radius: 16px;
  --shadow: 0 6px 20px rgba(16, 40, 24, 0.08);
}
[data-theme="dark"] {
  --ink: #e5e7eb; --muted: #9aa3ad; --line: #2b3440;
  --bg: #0f1512; --card: #17201b; --green-soft: #14251b;
  --veil: rgba(15, 21, 18, .72);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: hidden; width: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* Phone frame — centers the app on desktop, full-screen on mobile/PWA */
.phone {
  max-width: 460px; width: 100%; margin: 0 auto; min-height: 100vh;
  background: var(--bg); position: relative; overflow-x: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,0.06);
}

/* ---------- Header ---------- */
.appbar {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-d) 100%);
  color: #fff; padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 4px 16px rgba(15,122,61,0.25);
}
.appbar .title { font-weight: 700; font-size: 18px; letter-spacing: .3px; flex: 1; text-align: center; }
.appbar .icon-btn { color: #fff; background: rgba(255,255,255,.15); width: 38px; height: 38px;
  border-radius: 12px; display: grid; place-items: center; border: none; cursor: pointer; }
.appbar .icon-btn svg { width: 20px; height: 20px; }

.content { flex: 1; padding: 16px; padding-bottom: 96px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px; }
.card.tight { padding: 12px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green); color: #fff; border: none; border-radius: 12px;
  padding: 13px 18px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.outline { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn.orange { background: var(--orange); }
.btn.red { background: var(--red); }
.btn.gray { background: #64748b; }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13px; border-radius: 10px; }
/* Greyed out and unclickable — used for actions that aren't unlocked yet. */
.btn:disabled, .btn[disabled] { background: #94a3b8; color: #f1f5f9; cursor: not-allowed;
  opacity: .75; box-shadow: none; }
.btn:disabled:active, .btn[disabled]:active { transform: none; }
.btn.block { width: 100%; }

/* ---------- Forms ---------- */
label.field { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
.input, select, textarea {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 15px; background: var(--card); color: var(--ink); font-family: inherit;
}
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
.input-group { position: relative; }
.input-group .lead { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; }
.input-group .lead + .input { padding-left: 42px; }
.input-group .trail { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink); background: none; border: none; cursor: pointer; padding: 4px; display: flex; align-items: center; z-index: 2; }
.input-group .lead svg { width: 20px; height: 20px; display: block; }
.input-group .trail svg { width: 22px; height: 22px; display: block; }
.input-group:has(.trail) .input { padding-right: 44px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 6px; margin-bottom: 16px; }
.tabs a { flex: 1; text-align: center; padding: 10px 6px; border-radius: 12px; color: var(--muted);
  font-size: 13px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tabs a.active { background: var(--green-soft); color: var(--green); }
.tabs a svg { width: 20px; height: 20px; }

/* ---------- Bottom nav ---------- */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px; background: var(--card); display: flex;
  border-top: 1px solid var(--line); padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 30; }
.bottom-nav a { flex: 1; text-align: center; color: var(--muted); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px; }
.bottom-nav a.active { color: var(--green); }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav .fab-wrap { flex: 0 0 auto; }

/* ---------- Section headings ---------- */
.sec-title { font-weight: 700; font-size: 16px; margin: 4px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- List rows ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); color: var(--green);
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .sub { font-size: 12px; color: var(--muted); }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { border-radius: 14px; padding: 14px; }
.stat .v { font-size: 20px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.green { background: var(--green-soft); } .stat.green .v { color: var(--green); }
.stat.orange { background: var(--orange-soft); } .stat.orange .v { color: var(--orange); }
.stat.blue { background: #e6f0ff; } .stat.blue .v { color: #2563eb; }
.stat.purple { background: #f0e9ff; } .stat.purple .v { color: #7c3aed; }
[data-theme="dark"] .stat.orange, [data-theme="dark"] .stat.blue, [data-theme="dark"] .stat.purple { background: #1c2620; }

/* ---------- 120 box grid ---------- */
.sheet-head { background: linear-gradient(135deg, var(--green) 0%, var(--green-d) 100%); }
.box-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; background: var(--card);
  border-radius: 12px; padding: 8px; box-shadow: var(--shadow); max-width: 100%; }
.box { aspect-ratio: 1 / 1.15; border: 1px solid #111; border-radius: 6px; display: flex;
  flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
  font-size: 11px; min-width: 0; background: var(--card); overflow: hidden; }
[data-theme="dark"] .box { border-color: #e5e7eb; }
.box .n { font-weight: 700; color: var(--ink); }
/* Loads print black on the plain 01–00 boxes (red on the A/B rows, below). */
.box .amt { font-size: 10px; color: var(--ink); font-weight: 700; min-height: 12px; }
.box.hot { border-color: var(--red); }
.box.hot .n { color: var(--red); }
.box.filled { background: var(--green-soft); }
.box.selected { outline: 2px solid var(--green); outline-offset: -1px; }
/* Last two rows: 101-110 = B (black), 111-120 = A (red) */
/* A and B rows are red throughout — outline, label and load. */
.box.ab-a, .box.ab-b { border-color: var(--red); }
.box.ab-a .n, .box.ab-b .n { color: var(--red); font-size: 10px; letter-spacing: -0.3px; }
.box.ab-a .amt, .box.ab-b .amt { color: var(--red); }
.box-grid.with-totals { grid-template-columns: repeat(10, 1fr) minmax(26px, 34px); }
.row-total { display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--green); overflow: hidden; }
/* Narrow phones: tighten gaps and the label so all 10 columns + totals fit without side-scroll */
@media (max-width: 400px) {
  .box-grid { gap: 2px; padding: 6px; }
  .box { font-size: 10px; }
  .box .n { font-size: 10px; }
  .box .amt { font-size: 9px; }
  .box.ab-a .n, .box.ab-b .n { font-size: 8px; letter-spacing: -0.5px; }
  .box-grid.with-totals { grid-template-columns: repeat(10, 1fr) 24px; }
}
.grand-total { display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding: 10px 16px; border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow); font-weight: 800; color: var(--red); }
.grand-total span:last-child { font-size: 18px; }

/* ---------- Laddi modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 380px; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head .del { color: var(--muted); background: none; border: none; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; }

.multi-row { display: grid; grid-template-columns: 30px repeat(10, 1fr); gap: 3px; margin-top: 4px; }
.multi-row .tag { background: var(--green); color: #fff; border-radius: 6px; display: grid; place-items: center; font-weight: 700; }
.multi-row .tag.b { background: var(--red); }
.multi-row .cell { border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; padding: 6px 0; font-weight: 600; }
.multitext-btn { margin-top: 8px; }

/* Equal-width button/field rows. Usable in any card, not just the entry panel. */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* One-tap UPI buttons on the payment page. Neutral card background so the brand
   badge carries the colour — a purple PhonePe mark on a purple button vanishes. */
.pay-app { text-decoration: none; font-size: 14px; padding: 11px 8px; gap: 7px;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line); font-weight: 700; }
.pay-app svg { width: 22px; height: 22px; flex: none; }

/* Laddi modal: each input mode boxed off so it's clear either one is optional. */
.laddi-sec { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 10px 0; }
.laddi-sec-t { font-weight: 700; font-size: 13px; margin-bottom: 4px; }

/* ---------- Entry panel ---------- */
.entry-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.entry-table th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.entry-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
.entry-table .del { color: var(--red); cursor: pointer; background: none; border: none; }
.entry-table .del svg { width: 16px; height: 16px; }
#clientTable td:last-child { font-weight: 700; color: var(--green); }
.entry-details { margin-top: 12px; }
.entry-details summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 6px 0; list-style: revert; }

/* ---------- Flash ---------- */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.flash.success { background: var(--green-soft); color: var(--green); }
.flash.error { background: #fdecea; color: var(--red); }

/* ---------- Landing ---------- */
.landing { min-height: 100vh; color: #fff;
  background: linear-gradient(160deg, var(--green) 0%, var(--green-d) 60%, #063d1e 100%);
  display: flex; flex-direction: column; }
.landing .wrap { max-width: 460px; margin: 0 auto; padding: 32px 24px 40px; width: 100%; flex: 1;
  display: flex; flex-direction: column; }
.landing .logo { width: 120px; height: 120px; margin: 24px auto 12px; color: #fff; }
.landing h1 { text-align: center; font-size: 30px; margin: 4px 0; letter-spacing: 1px; }
.landing .tag { text-align: center; opacity: .9; margin-bottom: 28px; }
.landing .feature { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.landing .feature .ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.15);
  display: grid; place-items: center; flex: 0 0 auto; }
.landing .feature .ic svg { width: 22px; height: 22px; }
.landing .feature .ft { font-weight: 700; }
.landing .feature .fs { opacity: .85; font-size: 13px; }
.landing .cta { margin-top: auto; padding-top: 24px; display: grid; gap: 12px; }
.landing .btn-light { background: #fff; color: var(--green); }
.landing .btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1.5px solid rgba(255,255,255,.4); }

/* Minimal landing: logo + name centered, install button, copyright */
.landing-min .wrap { justify-content: center; align-items: center; text-align: center; }
.landing-min .brand-block { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.landing-min .cta { margin-top: 0; width: 100%; max-width: 320px; }
.landing-min .copyright { opacity: .75; font-size: 12.5px; margin-top: 28px; }

/* iOS "Add to Home Screen" banner (no programmatic install prompt on iOS) */
.ios-install-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200;
  background: #1b1b1b; color: #fff; border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.ios-install-banner svg { flex: none; vertical-align: -3px; }
.ios-install-banner button { margin-left: auto; flex: none; background: none; border: none; color: #fff;
  opacity: .7; font-size: 20px; line-height: 1; padding: 4px; cursor: pointer; }

/* Splash */
.splash { position: fixed; inset: 0; z-index: 100; background: #fff; display: grid; place-items: center;
  transition: opacity .5s; }
.splash .logo { width: 130px; color: var(--green); }
.splash h1 { color: var(--green); letter-spacing: 2px; margin-top: 8px; }
.splash .loading { color: var(--muted); font-size: 13px; margin-top: 8px; }
.wave { position: absolute; bottom: 0; left: 0; width: 100%; }

/* Navigation loader ------------------------------------------------------
   Every screen is a full page load, so on a slow connection the page you tapped
   from just sits there and the only sign anything is happening is the browser's
   own progress bar. This is the app's answer: it covers the page you are
   leaving, so a tap always feels acknowledged.

   Hidden by default and revealed by .on — app.js adds that only after a short
   delay, so a fast navigation never flashes it. */
.nav-loader {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: var(--veil); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .18s ease;
}
.nav-loader.on { opacity: 1; visibility: visible; }
.nav-loader .ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3.5px solid var(--line); border-top-color: var(--green);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Respect the OS "reduce motion" setting: keep the loader, drop the spin. */
@media (prefers-reduced-motion: reduce) {
  .nav-loader .ring { animation: none; border-top-color: var(--green); }
  .nav-loader { transition: none; }
}

/* Plans */
.plan { border: 2px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; position: relative; }
.plan.best { border-color: var(--green); }
.plan .badge { position: absolute; top: -10px; right: 14px; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.plan .price { font-size: 26px; font-weight: 800; color: var(--green); }
.plan .pname { font-weight: 700; font-size: 16px; }
.plan ul { margin: 10px 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

.chip { display: inline-block; background: var(--green-soft); color: var(--green); font-size: 11px;
  font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.chip.active { background: var(--green); color: #fff; }

/* Onboarding plan cards (green, price + Buy Now) */
.plan-card { background: var(--green-l); color: #fff; border-radius: 16px; padding: 18px 18px;
  margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 6px 18px rgba(15,122,61,.18); }
.plan-card .pc-price { font-size: 24px; font-weight: 800; }
.plan-card .pc-sub { opacity: .9; font-size: 13px; margin-top: 2px; }
.plan-card .pc-buy { background: rgba(255,255,255,.18); color: #fff; font-weight: 700;
  padding: 12px 20px; border-radius: 12px; white-space: nowrap; }

/* Payment QR + key-value rows */
.qr { width: 220px; max-width: 78%; height: auto; border-radius: 12px; background: #fff;
  padding: 8px; border: 1px solid var(--line); }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); text-align: left; }
.kv:last-child { border-bottom: none; }
.badge-wait { font-size: 40px; line-height: 1; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: none;
  align-items: flex-end; justify-content: center; }
.modal-bg.open { display: flex; }
.modal { background: var(--card); width: 100%; max-width: 460px; border-radius: 20px 20px 0 0;
  padding: 20px; animation: slideup .25s ease; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h3 { margin: 0 0 12px; }

.list-actions { display: flex; gap: 8px; align-items: center; }
.list-actions form { margin: 0; display: inline-flex; }
.icon-link { color: var(--green); background: none; border: none; cursor: pointer; padding: 6px;
  display: inline-flex; align-items: center; justify-content: center; }
.icon-link svg { width: 20px; height: 20px; }
.icon-link.red { color: var(--red); }

/* Inline icon inside a text link (e.g. WhatsApp Support) — keep it text-sized
   so the SVG doesn't expand to fill the container. */
.wa-inline svg { width: 16px; height: 16px; vertical-align: -3px; }

.report-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.report-item:last-child { border-bottom: none; }
.report-item .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--green-soft);
  color: var(--green); display: grid; place-items: center; flex: 0 0 auto; }
.report-item .ic svg { width: 18px; height: 18px; }
.report-item > svg { margin-left: auto; color: var(--muted); width: 18px; height: 18px; flex: 0 0 auto; }

.settings-item { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.settings-item:last-child { border-bottom: none; }
.settings-item .ic { color: var(--green); flex: 0 0 auto; display: inline-flex; }
.settings-item .ic svg { width: 22px; height: 22px; }
.settings-item .chev { margin-left: auto; color: var(--muted); display: inline-flex; flex: 0 0 auto; }
.settings-item .chev svg { width: 18px; height: 18px; }

.whatsapp-fab { position: fixed; bottom: 84px; right: max(16px, calc(50% - 214px)); width: 52px; height: 52px;
  border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(37,211,102,.4); z-index: 25; }
