/* Wallet app — layout modelled on common Nepali wallet apps (green header, balance card,
   service grid, bottom bar with a raised Scan button). Own names and colours, no third-party branding. */
:root {
  --brand: #3d9a3d;
  --brand-dark: #2b7a2b;
  --brand-soft: #e7f4e5;
  --brand-ink: #ffffff;
  --bg: #f2f4f3;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #6c746f;
  --line: #e5e9e6;
  --ok: #1e8a46;
  --ok-bg: #e2f5e8;
  --warn: #a35f00;
  --warn-bg: #fff3dc;
  --bad: #c62f2f;
  --bad-bg: #fde8e8;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(16, 40, 24, .08);
  color-scheme: light;
}
:root[data-wallet="payb"] { --brand: #5c2d91; --brand-dark: #45206f; --brand-soft: #efe7f8; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; }
#app.tabs { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
#app.sub { padding-bottom: 24px; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea { font: inherit; color: inherit; }
.ic-svg { display: block; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad-x { padding: 0 16px; }

/* ---------- headers ---------- */
.hero {
  background: linear-gradient(160deg, var(--brand), var(--brand-dark));
  color: var(--brand-ink);
  padding: calc(env(safe-area-inset-top) + 14px) 16px 74px;
}
.hero-row { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: rgba(255,255,255,.22); color: #fff; font-weight: 800; font-size: 15px; border: 2px solid rgba(255,255,255,.5);
}
.card .avatar, .who .avatar { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; }
.greet { flex: 1; min-width: 0; line-height: 1.2; }
.greet small { opacity: .85; font-size: 12px; display: block; }
.greet strong { font-size: 16px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); color: #fff; }

.net-pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.95); color: var(--ok);
}
.net-pill.off { color: var(--bad); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
}
.topbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; }
.tb-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.tb-btn:active { background: rgba(255,255,255,.18); }
.tb-gap { width: 4px; }

/* ---------- balance card ---------- */
.balance {
  background: var(--card); margin: -58px 16px 0; border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); position: relative;
}
.bal-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bal-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.bal-amount { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.eye { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); }

.vault-strip {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--brand-soft); color: var(--ink);
}
.vs-ic { color: var(--brand); }
.vs-text { flex: 1; font-size: 13px; color: var(--muted); }
.vs-text b { color: var(--ink); font-size: 14px; margin-left: 4px; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 14px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-align: center; padding: 4px 0; }
.qa-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; }
.qa:active .qa-ic { background: var(--brand-dark); }

/* ---------- notices / promo ---------- */
.notice { display: flex; align-items: center; gap: 12px; margin: 14px 16px 0; padding: 12px 14px; border-radius: 14px; font-size: 13px; }
.notice > div { flex: 1; min-width: 0; }
.notice b { display: block; font-size: 14px; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.offline { background: #20262a; color: #fff; }
.notice.offline span { color: #c9d1cc; }
.notice.slim { margin: 0 0 12px; padding: 10px 12px; }
.mini-btn { background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; }

.promo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  margin: 14px 16px 0; padding: 14px 16px; border-radius: var(--radius); width: calc(100% - 32px);
  background: linear-gradient(120deg, #1f2b24, #2f4a38); color: #fff;
}
:root[data-wallet="payb"] .promo { background: linear-gradient(120deg, #26193a, #43296b); }
.promo b { display: block; font-size: 17px; margin: 2px 0; }
.promo span { font-size: 13px; color: #d5e2da; }
.promo-tag { display: inline-block; background: #ffcf3f; color: #2a2100 !important; font-size: 10px !important; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.promo-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #ffcf3f !important; flex: none; }

/* ---------- services ---------- */
.services { margin: 14px 16px 0; background: var(--card); border-radius: var(--radius); padding: 14px 8px 8px; box-shadow: var(--shadow); }
.sec-title { font-size: 15px; font-weight: 700; margin: 0 8px 10px; }
.sec-title.pad-x { margin: 18px 16px 8px; padding: 0; }
.svc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.svc { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: 12px; font-size: 12px; text-align: center; }
.svc:active { background: var(--bg); }
.svc-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 10;
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.05);
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 4px 0; }
.bn-item.on { color: var(--brand); font-weight: 700; }
.bn-scan { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--brand); margin-top: -26px; }
.bn-scan .ic-svg { width: 60px; height: 60px; padding: 15px; border-radius: 50%; background: var(--brand); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 45%, transparent); border: 4px solid var(--card); box-sizing: border-box; }

/* ---------- cards & lists ---------- */
.card { background: var(--card); border-radius: var(--radius); margin: 14px 16px 0; box-shadow: var(--shadow); }
.card.pad { padding: 18px 16px; }
.card-title { margin: 0 0 4px; font-size: 17px; }
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.row:last-child { border-bottom: 0; }
.row.link:active { background: var(--bg); }
.row.warn .row-title, .row.warn .row-ic { color: var(--bad); }
.row-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); flex: none; }
.row-ic.in { background: var(--ok-bg); color: var(--ok); }
.row-ic.out { background: var(--brand-soft); color: var(--brand); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.row-amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-amt.pos { color: var(--ok); }
.row-amt.void { color: var(--muted); text-decoration: line-through; }
.empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--bg); color: var(--muted); vertical-align: 1px; }
.mono .row-title { font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 500; }
.ev.fraud .row-title { color: var(--bad); font-weight: 700; }
.ev.settle .row-title { color: var(--ok); }

.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-top: 4px; white-space: nowrap; }
.chip.pending { background: var(--warn-bg); color: var(--warn); }
.chip.settled { background: var(--ok-bg); color: var(--ok); }
.chip.fraud { background: var(--bad-bg); color: var(--bad); }
.chip.muted { background: var(--bg); color: var(--muted); }
.vault-strip .chip { margin-top: 0; }

.filters { display: flex; gap: 8px; padding: 14px 16px 0; overflow-x: auto; }
.filters button { padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.filters button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Offline Pay tab ---------- */
.vault-card { margin: 14px 16px 0; padding: 18px; border-radius: var(--radius); color: #fff; background: linear-gradient(140deg, var(--brand), var(--brand-dark)); box-shadow: var(--shadow); }
.vc-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .95; }
.vc-top > span:first-child { display: inline-flex; gap: 6px; align-items: center; }
.vc-top .chip { margin: 0; }
.vc-amount { font-size: 32px; font-weight: 800; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.vc-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.25); overflow: hidden; }
.vc-bar span { display: block; height: 100%; background: #fff; border-radius: 999px; }
.vc-meta { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; opacity: .9; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 16px 0; }
.big-act { background: var(--card); border-radius: var(--radius); padding: 16px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 16px; }
.big-act > span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; margin-bottom: 4px; }
.big-act small { font-weight: 500; color: var(--muted); font-size: 12px; }
.intro { text-align: center; }
.intro h2 { margin: 10px 0 6px; }
.intro-ic { width: 76px; height: 76px; border-radius: 50%; margin: 4px auto 0; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.steps { text-align: left; margin: 14px 0 4px; padding-left: 22px; color: var(--muted); }
.steps li { margin: 6px 0; }
.steps b { color: var(--ink); }

details.demo { margin: 14px 16px 24px; background: var(--card); border-radius: var(--radius); padding: 12px 16px; border: 1px dashed var(--bad); }
details.demo summary { display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--bad); cursor: pointer; list-style: none; }
details.demo summary::-webkit-details-marker { display: none; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 14px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--bad); }

/* ---------- forms & buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border-radius: 12px; padding: 14px; font-weight: 700; background: var(--brand); color: #fff; margin-top: 12px; }
.btn:active { background: var(--brand-dark); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.link-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 12px; color: var(--brand); font-weight: 700; margin-top: 4px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, textarea { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fbfcfb; outline: none; }
.field input:focus, textarea:focus { border-color: var(--brand); background: #fff; }
.field input.amount { font-size: 26px; font-weight: 800; }
.presets { display: flex; gap: 8px; margin: -4px 0 4px; flex-wrap: wrap; }
.presets button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 13px; font-weight: 600; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; cursor: pointer; color: var(--muted); }
.choice input { display: none; }
.choice:has(input:checked) { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 700; }
.bank-pick { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg); margin-bottom: 14px; color: var(--brand); }
.bank-pick b { display: block; color: var(--ink); font-size: 14px; }
.bank-pick small { color: var(--muted); }

/* ---------- payment screens ---------- */
.qr-wrap { background: #fff; border-radius: 16px; padding: 12px; margin: 10px auto 0; max-width: 300px; border: 1px solid var(--line); }
.qr-wrap svg { width: 100%; height: auto; display: block; }
.big-amt { font-size: 30px; font-weight: 800; margin: 8px 0; font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: 10px; justify-content: center; text-align: left; margin-top: 6px; }
.who b { display: block; }
.who small { color: var(--muted); }
.who.col { flex-direction: column; text-align: center; }
.pay-from { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin: 6px 0 10px; text-align: left; }
.pay-from span { flex: 1; color: var(--ink); font-size: 14px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 6px; }
.stepper span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--bg); color: var(--muted); }
.stepper span.on { background: var(--brand); color: #fff; }
.stepper span.done { background: var(--ok-bg); color: var(--ok); }
.stepper i { width: 36px; height: 2px; background: var(--line); }
.result .res-ic { display: grid; place-items: center; margin: 4px 0; }
.result.ok .res-ic { color: var(--ok); }
.result.bad .res-ic { color: var(--bad); }
.result h2 { margin: 6px 0; }
.result.ok h2 { color: var(--ok); }
.result.bad h2 { color: var(--bad); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 16px; }
.stats .card { margin: 12px 0 0; }
.stat { padding: 14px; }
.stat b { display: block; font-size: 17px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.bad b { color: var(--bad); }

.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h2 { margin: 0; font-size: 18px; }
.profile-head p { margin: 2px 0 0; font-size: 13px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 16px 8px; }

/* ---------- auth & setup ---------- */
.auth, .setup { min-height: 100vh; }
.auth-hero, .setup-hero {
  background: linear-gradient(160deg, var(--brand), var(--brand-dark)); color: #fff; text-align: center;
  padding: calc(env(safe-area-inset-top) + 36px) 16px 80px; position: relative;
}
.setup-hero { background: linear-gradient(160deg, #24302a, #3b4a42); }
.auth-hero h1, .setup-hero h1 { margin: 10px 0 2px; font-size: 26px; }
.auth-hero p, .setup-hero p { margin: 0; opacity: .85; }
.auth-gear { position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 10px); }
.logo-badge { width: 68px; height: 68px; margin: 0 auto; border-radius: 22px; display: grid; place-items: center; background: #fff; color: var(--brand); box-shadow: 0 6px 18px rgba(0,0,0,.15); }
.logo-badge.neutral { color: #2f3d35; }
.logo-badge.sm { width: 44px; height: 44px; border-radius: 14px; margin: 0; box-shadow: none; }
.auth-card, .setup .card { margin-top: -56px; position: relative; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.seg button { padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.wallet-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 6px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px; border-radius: 16px; color: #fff; }
.pick.paya { background: linear-gradient(150deg, #3d9a3d, #2b7a2b); }
.pick.payb { background: linear-gradient(150deg, #5c2d91, #45206f); }
.pick .logo-badge { color: inherit; background: rgba(255,255,255,.2); }
.pick b { font-size: 18px; }
.pick small { opacity: .85; }
.pick.cur { outline: 3px solid #ffcf3f; outline-offset: 2px; }
details.advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.advanced summary { color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }

/* ---------- onboarding ---------- */
.onb { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: calc(env(safe-area-inset-top) + 40px) 28px 32px; background: var(--card); position: relative; }
.onb-skip { position: absolute; right: 16px; top: calc(env(safe-area-inset-top) + 14px); color: var(--muted); font-weight: 700; padding: 8px; }
.onb-ic { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.onb-step { margin-top: 26px; color: var(--brand); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.onb h1 { font-size: 24px; margin: 8px 0; }
.onb p { color: var(--muted); max-width: 340px; }
.dots { display: flex; gap: 6px; margin: 18px 0 10px; }
.dots span { width: 8px; height: 8px; border-radius: 999px; background: var(--line); }
.dots span.on { width: 22px; background: var(--brand); }
.onb .btn { max-width: 340px; }

/* ---------- scanner ---------- */
.scanner { position: fixed; inset: 0; background: #0b0d0c; z-index: 30; display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) 16px 24px; gap: 14px; overflow-y: auto; color: #fff; }
.scan-top { width: 100%; max-width: 460px; display: flex; align-items: center; gap: 10px; font-size: 17px; }
.scan-close { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.1); }
.scan-frame { position: relative; width: min(82vw, 340px); aspect-ratio: 1; border-radius: 22px; overflow: hidden; background: #000; margin-top: 18px; }
.scan-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.corner { position: absolute; width: 38px; height: 38px; border: 4px solid var(--brand); }
:root[data-wallet="paya"] .corner { border-color: #6ad16a; }
.corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; }
.corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-radius: 0 12px 0 0; }
.corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-radius: 0 0 0 12px; }
.corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-radius: 0 0 12px 0; }
.scan-hint { color: #d4dad6; text-align: center; margin: 0; max-width: 340px; }
.scan-paste { width: 100%; max-width: 460px; color: #d4dad6; }
.scan-paste summary { text-align: center; cursor: pointer; font-size: 13px; }
.scan-paste textarea { margin-top: 10px; min-height: 90px; font-size: 12px; font-family: ui-monospace, monospace; background: #171b19; color: #fff; border-color: #2c322f; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #1d2320; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 40; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
