:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.62);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: rgba(17, 17, 17, 0.08);
  --border-strong: rgba(17, 17, 17, 0.12);
  --accent: #111111;
  --accent-soft: #2a2a2d;
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.12);
  --success: #1f8f5f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.10), 0 2px 16px rgba(0, 0, 0, 0.04);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.06);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at 50% -5%, rgba(0, 113, 227, 0.12), transparent 28%),
    radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.75), transparent 24%),
    linear-gradient(180deg, #fafafc, var(--bg));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, a { font: inherit; -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.82), transparent 30%),
    radial-gradient(circle at 90% 5%, rgba(0,113,227,.08), transparent 24%);
}

.app-shell {
  position: relative;
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(20px + var(--st)) 18px calc(34px + var(--sb));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand-mark, .top-icon-button, .result-close, .result-more {
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft);
}
.brand-mark svg { width: 22px; }
.brand-text { display: grid; }
.brand-text strong {
  font-size: 17px;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.brand-text small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}
.top-icon-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft);
}
.top-icon-button svg { width: 20px; }
.top-icon-button:active { transform: scale(.98); }

main { padding-top: 22px; }
.hero-card,
.composer-card,
.recent-section,
.setup-dialog form,
.action-menu,
.qr-ticket {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.84);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
}
.hero-card {
  padding: 24px 22px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.80), rgba(255,255,255,.68));
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  color: #475467;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(17,17,17,.05);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,113,227,.12);
}
.hero-card h1 {
  margin: 16px 0 10px;
  font-size: clamp(2.35rem, 8vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
  font-weight: 750;
}
.hero-card p {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.composer-card {
  margin-top: 16px;
  padding: 22px;
  border-radius: var(--radius-xl);
}
.composer-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}
.section-label {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.composer-head h2,
.section-title-row h2,
.dialog-heading h2,
.result-content h2 {
  margin: 6px 0 0;
  letter-spacing: -0.04em;
}
.composer-head h2 { font-size: 26px; }
.mini-profile {
  min-width: 170px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 14px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 18px;
  cursor: pointer;
  background: rgba(255,255,255,.74);
  border: 1px solid var(--border);
}
.profile-avatar, .payee-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #2b2b2f, #0d0d0f);
  color: #fff;
  font-weight: 700;
}
.profile-avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
}
.profile-copy { min-width: 0; text-align: left; }
.profile-copy strong,
.profile-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-copy strong { font-size: 12px; }
.profile-copy small { margin-top: 2px; font-size: 11px; color: var(--muted); }
.mini-profile svg { width: 14px; color: #8a8a90; }

.amount-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 128px;
  margin-top: 10px;
  border-radius: 24px;
  cursor: text;
}
.currency {
  margin-right: 6px;
  color: #5c5c60;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.amount-input {
  width: 1.15ch;
  min-width: 1.15ch;
  max-width: min(80vw, 420px);
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(4.25rem, 17vw, 6.5rem);
  font-weight: 750;
  line-height: .95;
  letter-spacing: -0.08em;
  text-align: center;
  caret-color: var(--blue);
}
.amount-input::placeholder { color: rgba(29,29,31,.14); }
.amount-helper {
  min-height: 18px;
  margin-top: -8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.amount-helper.error { color: #c53b30; }
.quick-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.quick-chip {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.64);
  color: #333337;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}
.quick-chip.active {
  background: #111111;
  color: #fff;
  border-color: #111111;
}
.quick-chip:active { transform: scale(.985); }
.note-field {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.64);
  border: 1px solid var(--border);
}
.note-icon svg { width: 20px; color: #7b7b80; }
.note-copy { min-width: 0; display: grid; gap: 3px; }
.note-label {
  color: #7b7b80;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.note-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}
.note-field input::placeholder { color: #9a9aa1; }
.note-count { color: #9a9aa1; font-size: 12px; }
.note-helper {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.primary-button {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding: 0 10px 0 18px;
  border-radius: 18px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #2d2d31, #141416);
  box-shadow: 0 12px 28px rgba(0,0,0,.20);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.primary-button:active { transform: scale(.995); }
.button-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.10);
}
.button-icon svg { width: 20px; }

.recent-section {
  margin-top: 16px;
  padding: 18px;
  border-radius: 24px;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-title-row h2 { font-size: 18px; }
.section-title-row button {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.recent-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.recent-list::-webkit-scrollbar { display: none; }
.recentitem {
  min-width: 138px;
  padding: 14px;
  border-radius: 18px;
  text-align: left;
  cursor: pointer;
  background: rgba(255,255,255,.68);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.recentitem strong, .recentitem small { display: block; }
.recentitem strong { font-size: 17px; letter-spacing: -0.03em; }
.recentitem small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
  color: #8f8f96;
  font-size: 12px;
}
footer i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #bdbdc2;
}

.result-view {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(0,113,227,.12), transparent 28%),
    linear-gradient(180deg, #fafafc, #f3f3f5);
  transition: opacity .24s ease, transform .28s ease, visibility .28s ease;
  transform: translateY(10px);
}
.result-view.show {
  visibility: visible;
  opacity: 1;
  transform: none;
}
.result-header {
  position: sticky;
  top: 0;
  z-index: 3;
  width: min(100%, 720px);
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  padding: calc(18px + var(--st)) 18px 8px;
  background: linear-gradient(180deg, rgba(245,245,247,.96), rgba(245,245,247,.72) 70%, transparent);
}
.result-close,
.result-more {
  min-height: 42px;
  border-radius: 14px;
  cursor: pointer;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft);
}
.result-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
}
.result-close svg { width: 18px; }
.result-more {
  width: 42px;
  display: grid;
  place-items: center;
}
.result-more svg { width: 18px; }
.result-content {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 6px 18px calc(26px + var(--sb));
}
.success-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.success-kicker span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(31,143,95,.12);
}
.success-kicker svg { width: 12px; }
.result-content h2 {
  margin: 12px 0 8px;
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 750;
}
.result-content > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.qr-ticket {
  margin-top: 18px;
  padding: 18px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.90), rgba(255,255,255,.78));
}
.ticket-topline,
.ticket-payee,
.result-actions,
.setup-trust {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ticket-topline {
  color: #6f6f76;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ticket-brand {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-transform: none;
}
.ticket-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.ticket-live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(31,143,95,.10);
}
.ticket-amount {
  margin-top: 18px;
}
.ticket-amount small,
.ticket-note span,
.ticket-payee small {
  display: block;
  color: #7a7a81;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ticket-amount strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(2.7rem, 10vw, 4rem);
  line-height: .96;
  letter-spacing: -0.07em;
  font-weight: 750;
}
.ticket-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(245,245,247,.78);
  border: 1px solid rgba(17,17,17,.06);
}
.ticket-note strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.qr-stage {
  margin-top: 16px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(245,245,247,.72);
  border: 1px solid rgba(17,17,17,.05);
}
.qr-code {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}
.qr-code svg { width: 100%; height: 100%; display: block; }
.ticket-payee {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(245,245,247,.78);
  border: 1px solid rgba(17,17,17,.06);
}
.payee-avatar {
  width: 42px;
  height: 42px;
  font-size: 16px;
  flex: 0 0 auto;
}
.ticket-payee div { flex: 1; min-width: 0; }
.ticket-payee strong {
  display: block;
  margin-top: 4px;
  font-size: 19px;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.verified-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--blue);
}
.verified-mark svg { width: 20px; }
.ticket-footer {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.result-actions {
  margin-top: 16px;
}
.action-button {
  min-height: 56px;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 18px;
  cursor: pointer;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  font-size: 15px;
  font-weight: 600;
}
.action-button svg { width: 19px; }
.action-primary {
  color: #fff;
  background: linear-gradient(180deg, #2d2d31, #141416);
  border-color: transparent;
}
.result-trust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,.66);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}
.trust-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.trust-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(17,17,17,.04);
  color: #5f5f65;
}
.trust-icon svg { width: 16px; }
.trust-item span:last-child { min-width: 0; }
.trust-item strong,
.trust-item small {
  display: block;
}
.trust-item strong {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.trust-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.action-menu {
  position: fixed;
  right: 18px;
  top: calc(74px + var(--st));
  z-index: 60;
  min-width: 220px;
  padding: 10px;
  border-radius: 20px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.action-menu.show {
  visibility: visible;
  opacity: 1;
  transform: none;
}
.action-menu button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
}
.action-menu button:hover { background: rgba(17,17,17,.04); }
.action-menu svg { width: 18px; }

.setup-dialog {
  width: min(100%, 520px);
  border: 0;
  padding: 0;
  background: transparent;
}
.setup-dialog::backdrop { background: rgba(0,0,0,.22); backdrop-filter: blur(8px); }
.setup-dialog form {
  padding: 18px 18px 16px;
  border-radius: 28px;
}
.dialog-drag {
  width: 48px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(17,17,17,.12);
}
.dialog-heading p,
.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.field-label {
  display: block;
  margin-top: 14px;
  color: #444449;
  font-size: 14px;
  font-weight: 600;
}
.field-label input,
.upi-input-wrap {
  margin-top: 8px;
}
.field-label input,
.upi-input-wrap {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.7);
}
.field-label input {
  outline: 0;
  font-size: 15px;
}
.upi-input-wrap {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  padding-right: 8px;
}
.upi-input-wrap input {
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}
.upi-input-wrap button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(17,17,17,.06);
  font-size: 13px;
  font-weight: 600;
}
.form-error {
  min-height: 18px;
  margin-top: 10px;
  color: #c53b30;
  font-size: 13px;
}
.setup-save { margin-top: 8px; }
.text-button {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
  color: var(--muted);
  border-radius: 16px;
  cursor: pointer;
}
.setup-trust {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--sb));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  color: #fff;
  background: rgba(24,24,27,.92);
  box-shadow: 0 18px 40px rgba(0,0,0,.24);
  transform: translate(-50%, 20px);
  opacity: 0;
  visibility: hidden;
  transition: .2s ease;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.toast-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.toast-icon svg { width: 14px; }

@media (max-width: 430px) {
  .composer-card, .hero-card, .qr-ticket, .recent-section { border-radius: 26px; }
  .quick-row { gap: 8px; }
  .quick-chip { font-size: 13px; }
  .result-actions { flex-direction: row; }
  .result-trust {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (min-width: 721px) {
  .action-menu { right: max(18px, calc(50vw - 340px)); }
}
