:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #1d1b16;
  --muted: #6b665c;
  --line: #e6e1d6;
  --yellow: #f9b233;
  --yellow-soft: #fff3d6;
  --blue: #2a6fdb;
  --blue-soft: #e3edfc;
  --black: #1d1b16;
  --ok: #1e8e4e;
  --ok-soft: #e2f5ea;
  --err: #c2372c;
  --err-soft: #fbe6e4;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412; --surface: #1f1d1a; --text: #f3f0e8; --muted: #a39d90; --line: #34312b;
    --yellow-soft: #3a2f16; --blue-soft: #18263d; --black: #f3f0e8;
    --ok-soft: #15301f; --err-soft: #3a1b18; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #151412; --surface: #1f1d1a; --text: #f3f0e8; --muted: #a39d90; --line: #34312b;
    --yellow-soft: #3a2f16; --blue-soft: #18263d; --black: #f3f0e8;
    --ok-soft: #15301f; --err-soft: #3a1b18; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: Rubik, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding-block: 0 96px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 10px; gap: 8px; }
.brand { font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.chip-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.demo-banner {
  background: var(--yellow-soft); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px;
}

/* tabs */
.tabs {
  position: fixed; inset: auto 0 0 0; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 5;
}
.tabs-inner { display: flex; width: 100%; max-width: 560px; }
.tab {
  flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; color: var(--muted);
}
.tab .ic { font-size: 22px; line-height: 1; }
.tab.on { color: var(--text); font-weight: 500; background: var(--bg); }

/* cards & blocks */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
h2 { font-size: 18px; margin: 4px 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; }
.row + .row { border-top: 1px dashed var(--line); }
.num { font-variant-numeric: tabular-nums; font-weight: 500; direction: ltr; unicode-bidi: isolate; }
.big { font-size: 34px; font-weight: 700; line-height: 1.1; }

.card-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.card-pick {
  border: 2px solid transparent; border-radius: var(--radius); padding: 14px; cursor: pointer; text-align: start;
  background: var(--surface); box-shadow: var(--shadow);
}
.card-pick .dot { width: 34px; height: 22px; border-radius: 5px; display: inline-block; margin-bottom: 6px; }
.card-pick.yellow .dot { background: var(--yellow); }
.card-pick.blue .dot { background: var(--blue); }
.card-pick.on.yellow { border-color: var(--yellow); background: var(--yellow-soft); }
.card-pick.on.blue { border-color: var(--blue); background: var(--blue-soft); }
.card-pick .label { font-weight: 500; display: block; }
.card-pick .bal { font-size: 20px; font-weight: 700; }

.meter { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.meter > i { display: block; height: 100%; background: var(--text); border-radius: 99px; }

label.field { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.amount {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 24px;
  background: var(--bg); direction: ltr; text-align: center; font-variant-numeric: tabular-nums;
}
.amount:focus { outline: none; border-color: var(--text); }
.quick { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.quick button { flex: 1; min-width: 64px; }
.pay-line { display: flex; justify-content: space-between; margin: 14px 0; padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.btn {
  width: 100%; border: 0; border-radius: 14px; padding: 14px; font-size: 17px; font-weight: 500; cursor: pointer;
  background: var(--text); color: var(--bg);
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn + .btn { margin-top: 8px; }
.note { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-top: 10px; }
.note.err { background: var(--err-soft); color: var(--err); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.warn { background: var(--yellow-soft); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }
.status-dot.on { background: var(--ok); }
.status-dot.off { background: var(--err); }

/* search */
.search {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 17px;
  background: var(--surface); box-shadow: var(--shadow);
}
.search:focus { outline: none; border-color: var(--text); }
.results { margin-top: 12px; }
.merchant { padding: 14px 0; border-bottom: 1px solid var(--line); }
.merchant:last-child { border-bottom: 0; }
.merchant .name { font-weight: 500; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: 13px; padding: 3px 10px; border-radius: 999px; font-weight: 500; }
.badge.yellow { background: var(--yellow); color: #1d1b16; }
.badge.blue { background: var(--blue); color: #fff; }
.badge.black { background: #1d1b16; color: #fff; }
.badge.none { background: var(--line); color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }

/* progress */
.steps { list-style: none; padding: 0; margin: 8px 0 0; }
.steps li { padding: 6px 0; color: var(--muted); }
.steps li.done { color: var(--ok); }
.steps li.now { color: var(--text); font-weight: 500; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-inline-end: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* bit box */
.bit { text-align: center; }
.bit .big { margin: 6px 0; }
.phone { font-size: 22px; font-weight: 700; letter-spacing: .03em; direction: ltr; }

/* admin */
.owes { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.hist { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist td, .hist th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: start; }
.hist th { color: var(--muted); font-weight: 500; }
.paid-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 13px; }
.paid-btn.yes { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* login */
.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.login .logo { font-size: 44px; font-weight: 700; margin-bottom: 4px; }
.login .cards3 { display: flex; justify-content: center; gap: 8px; margin: 20px 0 28px; }
.login .cards3 span { width: 56px; height: 36px; border-radius: 6px; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface); color: var(--text); border: 1.5px solid var(--line); }
.demo-users { display: grid; gap: 8px; margin-top: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px);
}
