:root {
  --bg: #0D0A1A;
  --surface: #17122B;
  --surface-2: #211A3D;
  --border: #2E2652;
  --text: #F4F1FF;
  --muted: #A79FC9;
  --purple: #7C4DFF;
  --lime: #C6F432;
  --green: #4ADE80;
  --red: #FF6B6B;
  --grad: linear-gradient(135deg, #7C4DFF 0%, #C6F432 100%);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
a { color: var(--lime); }
button { font: inherit; cursor: pointer; }

.topbar, .view, .foot { width: 100%; max-width: 440px; padding: 0 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; padding-bottom: 6px; }
.brand { display: flex; gap: 8px; align-items: center; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .5px; font-size: 18px; }
.brand img { border-radius: 8px; }
.lang { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }

.view { flex: 1; padding-top: 8px; padding-bottom: 24px; }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding-bottom: 20px; }

h1 { font-size: 28px; line-height: 1.15; margin: 18px 0 8px; }
h2 { font-size: 20px; margin: 4px 0 12px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.hero { background: linear-gradient(160deg, #2A1D5C 0%, #17122B 70%); }

.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 16px; font-weight: 700; font-size: 17px; text-align: center; text-decoration: none; }
.btn-primary { background: var(--grad); color: #0D0A1A; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn + .btn { margin-top: 10px; }
.role-btn { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; }
.role-btn .ico { font-size: 28px; }
.role-btn small { display: block; font-weight: 500; font-size: 13px; opacity: .8; }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; margin-bottom: 12px; }
.steps .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--lime); }

.merchant-head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 48px; height: 48px; border-radius: 14px; background: var(--grad); display: grid; place-items: center; font-size: 24px; }
.merchant-head .name { font-weight: 700; }
.merchant-head .sub { color: var(--muted); font-size: 13px; }

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.chip { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px 0; font-weight: 700; }
.chip.on { border-color: var(--lime); color: var(--lime); }

.split { display: grid; gap: 8px; margin: 6px 0 16px; }
.split .row { display: flex; justify-content: space-between; font-size: 15px; }
.split .row b { font-variant-numeric: tabular-nums; }
.split .row.loan { color: var(--lime); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.big { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0; }
.label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }

.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 999px; transition: width .6s ease; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.feed li:last-child { border-bottom: 0; }
.feed .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.feed .loan { color: var(--lime); font-size: 12px; }
.new { animation: flash 1.2s ease; }
@keyframes flash { from { background: rgba(198, 244, 50, .18); } to { background: transparent; } }

.done { text-align: center; padding: 26px 18px; }
.done .check { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 32px; color: #0D0A1A; }
.badge { display: inline-block; background: rgba(198, 244, 50, .12); color: var(--lime); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font: inherit; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 12px 16px; border-radius: 12px; max-width: calc(100% - 32px); font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Payment screen (wallet-style) ---------- */
.center { text-align: center; }
.pay-top { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 12px; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.shop { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.shop-info { flex: 1; min-width: 0; }
.shop .name { font-weight: 700; }
.shop .sub { color: var(--muted); font-size: 13px; }
.verified { width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #0D0A1A; display: grid; place-items: center; font-size: 13px; font-weight: 900; flex: none; }
.amount-box { text-align: center; padding: 22px 0 10px; }
.amount { font-size: 54px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.amount .cur { font-size: 26px; color: var(--muted); margin-right: 6px; vertical-align: 14px; font-weight: 700; }
.usd { margin-top: 2px; min-height: 18px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.key { background: transparent; color: var(--text); border: 0; border-radius: 14px; padding: 14px 0; font-size: 24px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.key:active { background: var(--surface-2); }
.pay-btn { position: sticky; bottom: 12px; box-shadow: 0 10px 30px rgba(124, 77, 255, .35); }

.overlay { position: fixed; inset: 0; background: rgba(13, 10, 26, .92); display: grid; place-content: center; justify-items: center; gap: 16px; z-index: 10; font-weight: 600; }
.overlay[hidden] { display: none; }
.ring { width: 64px; height: 64px; border-radius: 50%; border: 5px solid var(--surface-2); border-top-color: var(--lime); animation: spin .9s linear infinite; }

/* ---------- Receipt ---------- */
/* Voucher in the style of payment apps: brand header, check on the edge, perforated stub */
.voucher { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; margin-bottom: 14px; text-align: center; overflow: hidden; animation: rise .35s ease; }
.v-head { background: var(--grad); height: 92px; display: flex; align-items: flex-start; padding: 16px 18px; }
.v-brand { display: flex; align-items: center; gap: 8px; color: #0D0A1A; font-weight: 900; font-size: 20px; letter-spacing: .5px; }
.v-brand img { border-radius: 8px; box-shadow: 0 2px 8px rgba(13, 10, 26, .25); }
.v-check { width: 84px; height: 84px; margin: -42px auto 0; border-radius: 50%; background: var(--surface); display: grid; place-items: center; position: relative; }
.v-check .check { width: 68px; height: 68px; }
.v-body { padding: 4px 18px 18px; }
.v-body h2 { margin: 4px 0 0; font-size: 21px; }
.v-amount { font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1.15; }
.v-amount .cur { font-size: 24px; font-weight: 700; color: var(--muted); margin-right: 4px; vertical-align: 14px; }
.v-payee { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; text-align: left; }
.v-payee b, .v-payee span { display: block; }
.v-payee b { font-size: 17px; }
.v-cut { position: relative; height: 0; border-top: 2px dashed var(--border); margin: 4px 22px; }
.v-cut::before, .v-cut::after { content: ""; position: absolute; top: -13px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); }
.v-cut::before { left: -36px; }
.v-cut::after { right: -36px; }
.v-rows { padding: 14px 20px 6px; display: grid; gap: 10px; font-size: 15px; text-align: left; }
.v-rows .row { display: flex; justify-content: space-between; gap: 12px; }
.v-rows .row span { color: var(--muted); }
.v-rows .row b { font-variant-numeric: tabular-nums; }
.v-foot { padding: 12px 18px 18px; display: grid; gap: 10px; justify-items: center; }
.v-tagline { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 17px; }
.check { width: 72px; height: 72px; }
.check circle { fill: none; stroke: var(--green); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .5s ease forwards; }
.check path { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .45s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.big-ico { font-size: 44px; }
@media (prefers-reduced-motion: reduce) { .check circle, .check path { animation: none; stroke-dashoffset: 0; } .voucher { animation: none; } }
.slogan { font-size: 18px; font-weight: 700; margin: 0 0 10px; }

/* ---------- QR scan (simulated) ---------- */
.scanner { position: relative; width: 240px; height: 240px; margin: 18px auto 14px; border-radius: 22px; background: #fff; padding: 26px; overflow: hidden; }
.qr { width: 100%; height: 100%; fill: #0D0A1A; }
.scan-line { position: absolute; left: 12px; right: 12px; height: 3px; background: var(--lime); box-shadow: 0 0 14px var(--lime); top: 12px; animation: scan 1.4s ease-in-out infinite alternate; }
@keyframes scan { to { top: calc(100% - 15px); } }
.corner { position: absolute; width: 28px; height: 28px; border: 4px solid var(--purple); }
.corner.tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.corner.tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.corner.bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.corner.br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }

/* ---------- Rosa: live sales ---------- */
.session { margin-bottom: 12px; }
.session-total { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--green); }
.sale-alert { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 408px; background: var(--green); color: #0D0A1A; border-radius: 16px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; font-size: 18px; box-shadow: 0 12px 30px rgba(74, 222, 128, .35); z-index: 20; }
.sale-alert[hidden] { display: none; }
.sale-alert { gap: 12px; padding: 12px 14px; }
.sale-alert img { border-radius: 10px; flex: none; background: #0D0A1A; }
.sa-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sa-text b { font-size: 16px; }
.sa-text small { font-size: 12px; opacity: .8; }
.sa-amt { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 19px; white-space: nowrap; }
.sound-btn { margin-bottom: 14px; padding: 12px; font-size: 15px; }
.sale-alert.show { animation: drop .35s ease; }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .scan-line, .sale-alert.show { animation: none; } }
.feed .amt { white-space: nowrap; }
