/* Shop Khata mobile app - simple, big, high contrast (many users have weak eyesight) */
:root {
  --navy: #14213d; --ink: #0b1220; --muted: #46526a; --bg: #eef1f6; --card: #fff;
  --line: #8b94a7; --line2: #cfd5e1; --accent: #1d4ed8;
  --get: #b91c1c; --get-bg: #fdecec;      /* money you will GET (customer owes you) */
  --give: #047857; --give-bg: #e6f6ef;    /* money you will GIVE / received */
  --warn: #b45309; --warn-bg: #fff4e5;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 var(--font); }
body.ur { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", var(--font); line-height: 1.9; }
body.ur .num, body.ur input, body.ur .amt { font-family: var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px; min-height: 58px; }
.top h1 { font-size: 19px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { background: none; border: 0; color: #fff; font-size: 26px; padding: 0 6px; line-height: 1; cursor: pointer; }
.top .chip { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.45); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 14px; cursor: pointer; }
.net { background: var(--warn); color: #fff; text-align: center; font-size: 14px; padding: 4px; font-weight: 700; }

main { padding: 14px 14px 110px; max-width: 760px; margin: 0 auto; }

/* bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 2px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.nav button { background: none; border: 0; padding: 8px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.nav button .i { font-size: 22px; line-height: 1.1; }
.nav button.on { color: var(--accent); }
.nav .plus .i { background: var(--accent); color: #fff; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; margin-top: -22px; box-shadow: 0 4px 12px rgba(29,78,216,.4); border: 3px solid #fff; }

/* cards */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.big { font-size: 26px; font-weight: 800; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.get { color: var(--get); }
.give { color: var(--give); }
.warn { color: var(--warn); }

.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tot { border-radius: var(--radius); padding: 12px 14px; border: 2px solid; }
.tot span { display: block; font-size: 13.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.tot b { display: block; font-size: 24px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tot.get { background: var(--get-bg); border-color: var(--get); }
.tot.give { background: var(--give-bg); border-color: var(--give); }
.tot.plain { background: #fff; border-color: var(--line); color: var(--ink); }
body.ur .tot span { text-transform: none; letter-spacing: 0; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.act { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 14.5px; cursor: pointer; text-align: center; }
.act .i { font-size: 26px; }
.act:active { transform: scale(.97); }

/* lists */
.list { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line2); cursor: pointer; background: #fff; width: 100%; text-align: inherit; border-left: 0; border-right: 0; border-top: 0; }
.item:last-child { border-bottom: 0; }
.item:active { background: #f3f6fb; }
.item .t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .r { text-align: end; flex-shrink: 0; }
.item .r b { display: block; font-size: 17px; }
.item .r small { font-size: 12.5px; font-weight: 700; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: #dfe6f3; color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.empty { padding: 26px 14px; text-align: center; color: var(--muted); }

/* tabs / chips */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex-shrink: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 15px; font-weight: 700; font-size: 15px; cursor: pointer; }
.tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* forms */
.search { width: 100%; height: 50px; border: 2px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 17px; background: #fff; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-weight: 800; font-size: 14.5px; color: var(--muted); }
.field input, .field select, .field textarea { height: 50px; border: 2px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 17px; background: #fff; width: 100%; }
.field textarea { height: 76px; padding: 10px 14px; resize: none; }
.field input:focus, .field select:focus, .search:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(29,78,216,.18); }
.amount-input { height: 72px !important; font-size: 34px !important; font-weight: 800; text-align: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn { border: 2px solid var(--line); background: #fff; border-radius: 12px; min-height: 50px; padding: 0 18px; font-weight: 800; font-size: 16.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.got { background: var(--give); border-color: var(--give); color: #fff; }
.btn.gave { background: var(--get); border-color: var(--get); color: #fff; }
.btn.wa { background: #128c3e; border-color: #128c3e; color: #fff; }
.btn:disabled { opacity: .5; }
.sticky-save { position: fixed; left: 0; right: 0; bottom: 64px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); z-index: 25; }
.sticky-save .inner { max-width: 760px; margin: 0 auto; }

/* party page */
.hero { border-radius: var(--radius); padding: 16px; border: 2px solid; margin-bottom: 12px; text-align: center; }
.hero.get { background: var(--get-bg); border-color: var(--get); }
.hero.give { background: var(--give-bg); border-color: var(--give); }
.hero.zero { background: #fff; border-color: var(--line); }
.hero .lbl { font-weight: 800; font-size: 15px; }
.hero .amt { font-size: 36px; font-weight: 900; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }

.line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line2); align-items: center; }
.line:last-child { border-bottom: 0; }
.line .d { font-size: 13px; color: var(--muted); }
.line .ty { font-weight: 800; }
.line .ds { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line .c { text-align: end; min-width: 76px; font-weight: 800; font-variant-numeric: tabular-nums; }
.line .bal { text-align: end; min-width: 84px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.line.pending { background: var(--warn-bg); }
.colhead { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 8px 14px; background: #f5f7fb; border-bottom: 1.5px solid var(--line); font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.colhead span:nth-child(2) { min-width: 76px; text-align: end; }
.colhead span:nth-child(3) { min-width: 84px; text-align: end; }

/* status badges */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: 12.5px; font-weight: 800; border: 1.5px solid; white-space: nowrap; }
.badge.pending { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.badge.done { color: var(--give); border-color: var(--give); background: var(--give-bg); }
.badge.failed { color: var(--get); border-color: var(--get); background: var(--get-bg); }
.badge.local { color: var(--muted); border-color: var(--line); background: #f3f4f7; }
.badge.cancelled { color: var(--muted); border-color: var(--line); background: #f3f4f7; text-decoration: line-through; }

/* sale cart */
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .nm { font-weight: 800; }
.cart-line .ctl { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; align-items: end; }
.cart-line .ctl label { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.cart-line .ctl input, .cart-line .ctl select { height: 44px; border: 2px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 17px; width: 100%; background: #fff; }
.x { background: none; border: 0; color: var(--get); font-size: 24px; font-weight: 900; cursor: pointer; height: 44px; }
.sumrow { display: flex; justify-content: space-between; padding: 6px 2px; font-size: 16px; }
.sumrow.total { font-size: 21px; font-weight: 900; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 10px; }

/* sheet (add menu / pickers) */
.sheet-bg { position: fixed; inset: 0; background: rgba(11,18,32,.45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: #fff; border-radius: 20px 20px 0 0; padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); max-height: 82vh; overflow-y: auto; max-width: 760px; margin: 0 auto; }
.sheet h3 { margin: 4px 0 12px; font-size: 19px; text-align: center; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line2); margin: 0 auto 8px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; max-width: calc(100% - 28px); box-shadow: 0 6px 20px rgba(0,0,0,.25); text-align: center; }
.toast.bad { background: var(--get); }

/* login */
.login { max-width: 420px; margin: 8vh auto 0; padding: 0 16px; }
.login .logo { width: 84px; height: 84px; border-radius: 22px; display: block; margin: 0 auto 12px; }
.login h1 { text-align: center; margin: 0 0 4px; font-size: 26px; }
.login p { text-align: center; margin: 0 0 22px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 14px; }
.check input { width: 22px; height: 22px; }
.err { background: var(--get-bg); color: var(--get); border: 1.5px solid var(--get); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin-bottom: 12px; }
.info { background: #eaf1ff; color: var(--navy); border: 1.5px solid var(--accent); border-radius: 12px; padding: 10px 12px; font-size: 15px; margin-bottom: 12px; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 16px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bars i { display: block; width: 100%; max-width: 30px; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; }
.bars span { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.kv:last-child { border-bottom: 0; }
.kv b { font-variant-numeric: tabular-nums; }

@media (min-width: 640px) { .actions { grid-template-columns: repeat(6, 1fr); } }
a.btn { text-decoration: none; white-space: nowrap; }
/* Urdu: words in Nastaliq, numbers and amounts in the clear system font */
body.ur b, body.ur .num, body.ur .amt, body.ur .big, body.ur input, body.ur select, body.ur .tot b, body.ur .c, body.ur .bal, body.ur .badge { font-family: var(--font); }

/* ═══ polish v2: line icons + softer, cleaner surfaces (layout unchanged) ═══ */
:root {
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .05);
  --blue: #1d4ed8; --blue-bg: #e8efff; --green: #047857; --green-bg: #e3f5ec; --red: #b91c1c; --red-bg: #fdeaea;
  --amber: #b45309; --amber-bg: #fff1dc; --purple: #6d28d9; --purple-bg: #f0e9ff; --teal: #0f766e; --teal-bg: #def5f2; --gray-bg: #eceff4;
}
.ic { width: 1.2em; height: 1.2em; flex-shrink: 0; vertical-align: -0.22em; }
[dir="rtl"] .back .ic, [dir="rtl"] .chev .ic { transform: scaleX(-1); }

/* top bar */
.top { box-shadow: 0 2px 10px rgba(11, 18, 32, .18); }
.top .back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; padding: 0; }
.top .back .ic { width: 26px; height: 26px; }
.top .back:active { background: rgba(255,255,255,.12); }
.top .chip.icon { width: 42px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 12px; }
.top .chip.icon .ic { width: 21px; height: 21px; }
.net { display: flex; align-items: center; justify-content: center; gap: 6px; }

/* bottom navbar: icons with a soft pill on the active tab */
.nav { border-top: 1px solid var(--line2); box-shadow: 0 -2px 14px rgba(15, 23, 42, .08); }
.nav button { gap: 3px; padding-top: 7px; }
.nav button .i { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 16px; transition: background .15s; }
.nav button .i .ic { width: 23px; height: 23px; }
.nav button.on .i { background: var(--blue-bg); }
.nav button.on { color: var(--blue); }
.nav button .lb { font-size: 12px; font-weight: 800; }
.nav .plus .i { width: 54px; height: 54px; border-radius: 18px; margin-top: -24px; background: var(--blue); }
.nav .plus .i .ic { width: 28px; height: 28px; stroke-width: 2.6; }
.nav .plus.on .i { background: var(--blue); }

/* coloured round icons (tiles, avatars) */
.c-blue { background: var(--blue-bg) !important; color: var(--blue) !important; }
.c-green { background: var(--green-bg) !important; color: var(--green) !important; }
.c-red { background: var(--red-bg) !important; color: var(--red) !important; }
.c-amber { background: var(--amber-bg) !important; color: var(--amber) !important; }
.c-purple { background: var(--purple-bg) !important; color: var(--purple) !important; }
.c-teal { background: var(--teal-bg) !important; color: var(--teal) !important; }
.c-gray { background: var(--gray-bg) !important; color: var(--muted) !important; }

/* action tiles */
.act { border-color: var(--line2); box-shadow: var(--shadow); gap: 8px; padding: 14px 6px 12px; color: var(--ink); }
.act .i { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 0; }
.act .i .ic { width: 25px; height: 25px; }

/* cards, lists, totals */
.card, .list { border-color: var(--line2); box-shadow: var(--shadow); }
.tot { box-shadow: var(--shadow); border-width: 1.5px; }
.tot.plain { border-color: var(--line2); }
.avatar .ic { width: 21px; height: 21px; }
.chev .ic { width: 20px; height: 20px; }
.item .t .tag, .tag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--blue-bg); color: var(--blue); vertical-align: -4px; margin-inline-start: 4px; }
.tag .ic { width: 14px; height: 14px; }

/* buttons + badges */
.btn .ic { width: 20px; height: 20px; }
.btn.block .ic { width: 22px; height: 22px; }
.btn:active, .act:active, .item:active { transform: scale(.985); }
.badge .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border-color: var(--line2); }
.tabs button .ic { width: 18px; height: 18px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px #dcfce7; margin-inline-end: 3px; vertical-align: 1px; }
.small .ic { width: 16px; height: 16px; }
.hero { box-shadow: var(--shadow); }

/* ── bill screen (sale / purchase), DigiKhata-style ── */
.party-card { width: 100%; display: flex; align-items: center; gap: 12px; text-align: start; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; cursor: pointer; }
.party-card .avatar { width: 46px; height: 46px; flex: none; }
.party-card .pc-label { display: block; font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.party-card .pc-name { display: block; font-size: 19px; font-weight: 800; }
.party-card .pc-sub { display: block; font-size: 14px; font-weight: 700; color: var(--get); }
.party-card .pc-chev { font-size: 20px; color: var(--muted); }
body.ur .party-card .pc-label { text-transform: none; letter-spacing: 0; }

.sec-hdr { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 8px; font-weight: 800; color: var(--muted); }
.sec-hdr b { background: var(--navy); color: #fff; border-radius: 999px; min-width: 26px; text-align: center; padding: 1px 8px; font-size: 14px; }

.li { background: #fff; border: 1.5px solid var(--line2); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(20,33,61,.06); }
.li-top { display: flex; align-items: flex-start; gap: 8px; }
.li-name { flex: 1; font-weight: 800; font-size: 17px; }
.li-x { border: 0; background: #f1f3f8; color: var(--get); width: 32px; height: 32px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }
.li-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.stepper { display: flex; align-items: center; border: 2px solid var(--accent); border-radius: 12px; overflow: hidden; flex: none; }
.stepper button { width: 38px; height: 42px; border: 0; background: #e8efff; color: var(--accent); font-size: 24px; font-weight: 800; cursor: pointer; }
.stepper input { width: 52px; height: 42px; border: 0; text-align: center; font-size: 18px; font-weight: 800; background: #fff; padding: 0; }
.li-x2 { color: var(--muted); font-weight: 800; }
.li-rate { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.li-rate input { height: 42px; border: 2px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 17px; width: 100%; background: #fff; text-align: center; }
.li-rate small, .li-rate select { font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; border: 0; background: none; padding: 0; height: auto; }
.li-amt { min-width: 74px; text-align: end; font-weight: 800; font-size: 17px; }
.li-stock { margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.li-stock.bad { color: var(--get); }
.li-empty { text-align: center; padding: 22px 10px; color: var(--muted); background: #fff; border: 2px dashed var(--line2); border-radius: var(--radius); margin-bottom: 10px; font-weight: 700; }
.add-item { width: 100%; min-height: 52px; border: 2px dashed var(--accent); background: #f3f7ff; color: var(--accent); border-radius: var(--radius); font-weight: 800; font-size: 17px; cursor: pointer; margin-bottom: 14px; }

.bill { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.bill-total { display: flex; justify-content: space-between; align-items: baseline; }
.bill-total span { font-weight: 700; opacity: .85; }
.bill-total b { font-size: 30px; }
.bill-disc { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.bill-disc span { font-weight: 700; opacity: .85; }
.bill-disc input { width: 130px; height: 42px; border: 0; border-radius: 10px; padding: 0 12px; text-align: end; font-size: 17px; color: var(--ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-top: 12px; background: rgba(255,255,255,.12); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: transparent; color: #fff; min-height: 42px; border-radius: 9px; font-weight: 800; font-size: 14.5px; cursor: pointer; padding: 0 4px; }
.seg button.on { background: #fff; color: var(--navy); }
.bill .field > span { color: #fff; opacity: .85; }
.bill-due { margin-top: 10px; background: rgba(255,255,255,.14); border-radius: 10px; padding: 8px 12px; font-weight: 800; color: #ffd9d9; }

/* ═══════════════ v3: modern khata-app design (overrides the rules above) ═══════════════ */
:root {
  --navy: #12205a; --bg: #f2f5fb; --card: #fff; --radius: 18px;
  --line: #c3ccdd; --line2: #e4e9f3; --accent: #1f4fe0;
  --shadow: 0 1px 2px rgba(18, 32, 90, .06), 0 6px 18px rgba(18, 32, 90, .07);
  --grad: linear-gradient(135deg, #12205a 0%, #1d3fb8 55%, #2f6bff 100%);
}
body { background: var(--bg); }

/* header: gradient with rounded bottom */
.top { background: var(--grad); border-radius: 0 0 24px 24px; padding: 14px 16px 16px; min-height: 64px; box-shadow: 0 6px 18px rgba(18, 32, 90, .25); }
.top h1 { font-size: 20px; letter-spacing: .01em; }
main { padding-top: 18px; }

/* surfaces: softer borders + depth */
.card, .list { border: 1px solid var(--line2); border-radius: var(--radius); box-shadow: var(--shadow); }
.item { padding: 14px 16px; border-bottom: 1px solid #eef1f7; }
.item:active { background: #f5f8ff; }
.avatar { width: 46px; height: 46px; font-size: 17px; }
.field input, .field select, .field textarea, .search { border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.search { height: 52px; padding-inline-start: 18px; box-shadow: var(--shadow); border-color: var(--line2); border-radius: 999px; }
.btn { border: 1.5px solid var(--line); border-radius: 14px; }
.btn.primary { background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px rgba(31, 79, 224, .3); }
.tabs button { border: 0; background: #fff; box-shadow: var(--shadow); padding: 9px 17px; }
.tabs button.on { background: var(--accent); color: #fff; }

/* home hero card */
.hero-card { background: var(--grad); color: #fff; border-radius: 22px; padding: 18px 16px 10px; margin-bottom: 14px; box-shadow: 0 12px 28px rgba(31, 79, 224, .32); position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; background: rgba(255, 255, 255, .07); top: -70px; inset-inline-end: -50px; }
.hc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.hc-col { background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .22); border-radius: 16px; padding: 12px; color: #fff; text-align: start; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.hc-col b { font-size: 21px; font-weight: 800; }
.hc-lbl { font-size: 13px; font-weight: 700; opacity: .9; }
.hc-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #fff; }
.hc-ic .ic { width: 18px; height: 18px; }
.hc-ic.get { color: var(--get); }
.hc-ic.give { color: var(--give); }
.hc-foot { position: relative; z-index: 1; display: block; margin: 8px auto 0; background: none; border: 0; color: #fff; font-weight: 800; font-size: 14px; padding: 8px 14px; cursor: pointer; opacity: .95; }

/* today stats */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; text-align: start; cursor: pointer; }
.stat span { display: block; font-size: 13px; font-weight: 800; color: var(--muted); }
.stat b { display: block; font-size: 20px; margin-top: 2px; }

/* quick actions: round icons, no boxes */
.actions { gap: 6px 4px; margin-bottom: 16px; }
.act { background: none; border: 0; box-shadow: none; padding: 6px 2px; gap: 7px; font-size: 13px; }
.act .i { width: 58px; height: 58px; border-radius: 50%; box-shadow: var(--shadow); }
.act .i .ic { width: 27px; height: 27px; }
@media (max-width: 639px) { .actions { grid-template-columns: repeat(3, 1fr); } }

/* khata summary tiles */
.totals .tot { border: 0; border-radius: 16px; }
.tot.get { background: linear-gradient(135deg, #fff1f1, #fdeaea); }
.tot.give { background: linear-gradient(135deg, #eafaf2, #e3f5ec); }
.tot.plain { background: #fff; border: 1px solid var(--line2); }

/* party page: balance card + sticky You gave / You got bar */
.hero { border: 0; border-radius: 22px; padding: 20px 16px; box-shadow: 0 10px 24px rgba(18, 32, 90, .12); }
.hero.get { background: linear-gradient(135deg, #fff3f3, #fddede); }
.hero.give { background: linear-gradient(135deg, #effbf5, #d8f3e6); }
.hero .amt { font-size: 40px; }
.pair.chips .btn { min-height: 46px; font-size: 15px; background: #fff; box-shadow: var(--shadow); border-color: var(--line2); }
.pair.chips .btn.wa { background: #128c3e; border-color: #128c3e; }
.party-bar { position: fixed; left: 0; right: 0; bottom: 64px; z-index: 26; padding: 10px 14px; background: linear-gradient(transparent, var(--bg) 35%); }
.party-bar .inner { max-width: 760px; margin: 0 auto; }
.party-bar .pair { margin: 0; gap: 12px; }
.party-bar .btn { min-height: 56px; font-size: 18px; border-radius: 16px; box-shadow: 0 8px 18px rgba(18, 32, 90, .22); border: 0; }
.colhead { background: #f6f8fd; border-bottom: 1px solid var(--line2); }
.line { padding: 13px 16px; border-bottom: 1px solid #eef1f7; }

/* bottom nav */
.nav { border-top: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -6px 22px rgba(18, 32, 90, .12); }
.nav .plus .i { background: var(--grad); box-shadow: 0 8px 18px rgba(31, 79, 224, .4); }
.nav button.on .i { background: #e6edff; }

/* bill screen refresh */
.party-card, .li, .stat, .bill { border-radius: 18px; }
.party-card { border: 1px solid var(--line2); box-shadow: var(--shadow); }
.li { border: 1px solid var(--line2); box-shadow: var(--shadow); }
.bill { background: var(--grad); box-shadow: 0 12px 26px rgba(31, 79, 224, .3); }
.sec-hdr b { background: var(--accent); }

/* login */
body { -webkit-font-smoothing: antialiased; }
.login { margin-top: 6vh; background: #fff; border-radius: 24px; padding: 26px 20px 22px; box-shadow: var(--shadow); border: 1px solid var(--line2); }
.login .logo { box-shadow: 0 10px 24px rgba(31, 79, 224, .3); }

/* sheets and toast */
.sheet { border-radius: 26px 26px 0 0; }
.toast { border-radius: 16px; }
.badge { border-width: 1px; }

/* wide screens (laptop browser): keep the app in a centred column */
@media (min-width: 900px) {
  .top { padding-inline: max(16px, calc((100% - 760px) / 2)); }
  .nav { max-width: 760px; margin: 0 auto; border-radius: 22px 22px 0 0; }
  main { padding-top: 24px; }
  body { background: linear-gradient(#e9eefb, #f6f8fd); }
}

/* barcode scanner */
.scan-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.scan-row .search { margin-bottom: 0; flex: 1; min-width: 0; }
.scan-btn { flex: none; height: 52px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; box-shadow: 0 6px 14px rgba(31, 79, 224, .3); }
.scan-btn .ic { width: 22px; height: 22px; }
.scanner { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(78vw, 360px); height: 150px; border: 3px solid #fff; border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55); }
.scan-msg { position: absolute; left: 14px; right: 14px; bottom: 120px; text-align: center; color: #fff; font-weight: 800; font-size: 17px; background: rgba(0, 0, 0, .6); border-radius: 14px; padding: 10px 12px; }
.scan-msg.ok { background: rgba(4, 120, 87, .92); }
.scan-msg.bad { background: rgba(185, 28, 28, .92); }
.scan-done { position: absolute; left: 14px; right: 14px; bottom: calc(34px + env(safe-area-inset-bottom)); }
