:root {
  --g1: #016248; --g2: #06BD8C; --ink: #12201b; --muted: #61706a; --line: #e3e9e6;
  --bg: #f4f7f6; --card: #fff; --red: #c62828; --amber: #b26a00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
[hidden] { display: none !important; }
.sandbox-bar { background: #fff4d6; color: #7a5200; font-size: 11px; font-weight: 600; text-align: center; padding: 4px; letter-spacing: .03em; }
.install { display: flex; align-items: center; gap: 10px; background: #fff; margin: 8px 12px 0; padding: 10px 8px 10px 12px; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.install img { width: 40px; height: 40px; border-radius: 10px; }
.install-text { flex: 1; min-width: 0; }
.install .btn.primary { padding: 8px 14px; }
.view { padding: 16px 16px 120px; min-height: calc(100dvh - 22px); }
.view.dark { background: #0d1512; color: #fff; padding-bottom: 24px; }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; min-height: 40px; }
.muted { color: var(--muted); } .dark .muted { color: #a9b7b1; }
.small { font-size: 13px; } .strong { font-weight: 650; } .center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
h1 { font-size: 22px; margin: 8px 0; } h2 { font-size: 16px; margin: 24px 0 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px;
  padding: 14px 18px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; color: inherit; background: #e9efec; }
.btn.block { width: 100%; }
.btn.primary { background: linear-gradient(90deg, var(--g1), var(--g2)); color: #fff; }
.btn.primary:disabled { opacity: .5; }
.btn.outline { background: transparent; border: 1.5px solid var(--g1); color: var(--g1); }
.btn.ghost { background: transparent; padding: 8px 10px; }
.btn.small { font-size: 14px; }
.btn.light { background: rgba(255,255,255,.12); color: #fff; }
.btn.ghost.light { background: transparent; }

.card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); margin-bottom: 12px; }
.balance { background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; }
.balance-amount { font-size: 32px; font-weight: 750; margin: 4px 0 16px; letter-spacing: -.01em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(255,255,255,.16); color: #fff;
  border: 0; border-radius: 12px; padding: 12px; font: inherit; font-weight: 650; cursor: pointer; }
.act .ico { font-size: 22px; line-height: 1; }

.tx-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 16px; overflow: hidden; }
.tx-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tx-list li:last-child { border-bottom: 0; }
.tx-title { font-weight: 600; } .tx-sub { font-size: 12px; color: var(--muted); }
.tx-amt { font-weight: 700; white-space: nowrap; text-align: right; }
.tx-amt.in { color: var(--g1); } .tx-amt.fail { color: var(--muted); text-decoration: line-through; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: #eee; color: var(--muted); }
.badge.failed { background: #fdecea; color: var(--red); } .badge.processing { background: #fff4d6; color: var(--amber); }

.login { text-align: center; padding-top: 18vh; }
.login-logo { width: 72px; height: 72px; }
.alert { background: #fdecea; color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

.camera { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3/4; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame { position: absolute; inset: 18% 14%; border: 3px solid var(--g2); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.cam-msg { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 14px; margin: 0; padding: 0 12px; }
.scan-tools { display: grid; gap: 10px; margin-top: 14px; }
.paste summary { cursor: pointer; padding: 10px 0; color: #cfe; }
.paste textarea { width: 100%; border-radius: 10px; border: 0; padding: 10px; font: 13px ui-monospace, monospace; margin-bottom: 8px; }

.merchant { font-size: 18px; font-weight: 650; margin-top: 4px; }
.amount { font-size: 30px; font-weight: 750; margin: 6px 0; }
.rows { margin: 0; padding: 4px 16px; }
.rows > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { color: var(--muted); font-size: 14px; } .rows dd { margin: 0; text-align: right; font-weight: 600; }
.rows select { font: inherit; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); }
.bottom { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg); display: grid; gap: 8px; }

.result { text-align: center; padding-top: 12vh; }
.r-icon { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-size: 40px; color: #fff; }
.r-icon.ok { background: linear-gradient(135deg, var(--g1), var(--g2)); } .r-icon.bad { background: var(--red); }

.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-card { background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.money-input { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; }
.money-input:focus-within { border-color: var(--g2); }
.money-input span { font-weight: 700; color: var(--muted); }
.money-input input { border: 0; outline: 0; font: 700 24px system-ui, sans-serif; padding: 12px 0; width: 100%; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 0; font: inherit; font-weight: 600; cursor: pointer; }

.busy { position: fixed; inset: 0; background: rgba(255,255,255,.8); display: grid; place-content: center; justify-items: center; gap: 12px; z-index: 20; font-weight: 600; }
.spinner { width: 40px; height: 40px; border: 4px solid #cfe; border-top-color: var(--g1); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: 90%; }
