:root {
  --cash-green: #00d632;
  --cash-green-hover: #00b82b;
  --cash-green-light: #ecfdf0;
  --cash-text: #111827;
  --cash-muted: #1f2937;
  --cash-border: #e5e7eb;
  --radius-pill: 9999px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--cash-text);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
[hidden] { display: none !important; }

.pay-frame {
  overscroll-behavior: none;
  width: 100%;
  height: 100dvh;
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) max(.75rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
  background: radial-gradient(120% 80% at 50% 20%, #0f5c2e 0%, #063d1c 42%, #021a0b 100%);
  overflow: hidden;
}
.pay-card {
  background-color: var(--cash-green);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 433px;
  height: min(799px, calc(100dvh - 1.5rem));
  border-radius: 2rem;
  overflow: hidden;
  box-shadow: 0 28px 60px -16px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08);
}
.pay-card-handle {
  display: block;
  flex-shrink: 0;
  width: 2.75rem;
  height: .25rem;
  margin: .625rem auto 0;
  border-radius: 9999px;
  background-color: rgba(0,0,0,.18);
}
.pay-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(.5rem, 1.5dvh, .75rem) 1.25rem clamp(.75rem, 2dvh, 1rem);
  overflow: hidden;
}
.pay-head { flex-shrink: 0; text-align: center; }
.pay-avatar {
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #fff;
  color: var(--cash-green);
  font-weight: 700;
  width: clamp(3rem, 9dvh, 4rem);
  height: clamp(3rem, 9dvh, 4rem);
  font-size: clamp(1.125rem, 3.5dvh, 1.5rem);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.pay-name {
  margin: clamp(.5rem, 1.4dvh, .75rem) 0 0;
  font-weight: 700;
  letter-spacing: -.02em;
  font-size: clamp(1.25rem, 4.2dvh, 1.875rem);
}
.pay-badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  margin-top: clamp(.5rem, 1.4dvh, .75rem);
  padding: .375rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 184, 43, .45);
  font-size: .8125rem;
  font-weight: 500;
}
.pay-badge-icon { width: 1rem; height: 1rem; flex-shrink: 0; }

.pay-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.pay-amount {
  flex-shrink: 0;
  margin: clamp(.75rem, 2.5dvh, 1.5rem) 0 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 9dvh, 3.5rem);
  line-height: 1;
}
.pay-message {
  flex-shrink: 0;
  min-height: 1.25rem;
  margin: .25rem 0 0;
  text-align: center;
  font-size: .8125rem;
  font-weight: 500;
}
.pay-keypad-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: clamp(.25rem, 1.5dvh, 1rem) 0;
  padding-block: clamp(.125rem, .8dvh, .5rem);
}
.pay-keypad {
  display: flex;
  flex-direction: column;
  gap: clamp(.125rem, 1dvh, .5rem);
  user-select: none;
  -webkit-user-select: none;
}
.pay-keypad-row { display: grid; grid-template-columns: repeat(3, 1fr); }
.pay-key {
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(42px, 8.5dvh, 72px);
  color: var(--cash-text);
  font-size: clamp(1.25rem, 4.2dvh, 2.125rem);
  font-weight: 500;
  border-radius: 1rem;
  transition: opacity .15s, background-color .15s;
}
.pay-key:active { background-color: rgba(0,0,0,.08); }
.pay-key-icon { width: 1.5rem; height: 1.5rem; }

.pay-btn {
  touch-action: manipulation;
  flex-shrink: 0;
  width: 100%;
  min-height: clamp(48px, 7.5dvh, 58px);
  margin-top: auto;
  margin-bottom: clamp(.5rem, 1.5dvh, .75rem);
  padding-block: clamp(.75rem, 1.6dvh, 1rem);
  border-radius: var(--radius-pill);
  background: #000;
  color: #fff;
  font-size: clamp(1rem, 2.8dvh, 1.125rem);
  font-weight: 700;
  transition: transform .15s;
}
.pay-btn:active:not(:disabled) { transform: scale(.98); }
.pay-btn + .pay-btn { margin-top: .5rem; }
.pay-btn-light { background: rgba(255,255,255,.92); color: var(--cash-text); }

/* invoice screen */
.pay-invoiceSummary { flex-shrink: 0; text-align: center; margin-top: clamp(.5rem, 2dvh, 1rem); }
.pay-invoiceUsd { margin: 0; font-weight: 700; letter-spacing: -.02em; font-size: clamp(1.75rem, 7dvh, 2.75rem); }
.pay-invoiceBtc { margin: .35rem 0 0; font-size: .9375rem; font-weight: 500; }
.pay-status { margin: .75rem 0 0; display: inline-block; padding: .3rem .9rem; border-radius: var(--radius-pill); background: rgba(0,0,0,.14); font-size: .8125rem; font-weight: 600; }
.pay-expiry { margin: .5rem 0 0; font-size: .75rem; }
.pay-note { margin: .5rem 0 0; text-align: center; font-size: .8125rem; }
.pay-steps { margin: .6rem 0 0; padding-left: 1.25rem; font-size: .8125rem; line-height: 1.5; }
.pay-qr { margin-top: .5rem; font-size: .8125rem; }
.pay-qr summary { cursor: pointer; text-align: center; font-weight: 600; }
.pay-qrBox { display: flex; justify-content: center; padding: .75rem 0 0; }
.pay-qrBox img { border-radius: 1rem; background: #fff; padding: .5rem; }
.pay-invoiceFooter { display: flex; justify-content: space-between; gap: 1rem; margin-top: .5rem; }
.pay-link { font-size: .8125rem; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

#invoice { overflow-y: auto; }
#invoice .pay-btn { margin-top: .5rem; }

@media (max-width: 480px), (max-height: 700px) {
  .pay-frame { padding: 0; }
  .pay-card { max-width: none; height: 100dvh; border-radius: 0; box-shadow: none; }
  .pay-key { min-height: clamp(42px, 9dvh, 72px); }
}
