@keyframes rot { to { transform: rotate(360deg); } }

:root {
  --primary: #5b6cff;
  --page: #12141c;
  --card: #1b1f2e;
  --bar: #222738;
  --text: #f2f3f8;
  --muted: #9aa0c0;
  --danger: #ef6b7a;
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--muted);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

.theme {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 5; display: flex; align-items: center; gap: 8px;
  background: #1b1f2e; border-radius: 999px; padding: 6px 10px;
  color: #c5c9e8; font-size: 12px; font-weight: 700;
}
.theme button { border: 0; background: #2a3148; color: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; cursor: pointer; }

.wrap {
  min-height: 100vh; padding: 40px 16px 40px;
  display: flex; justify-content: center; align-items: flex-start;
}
.invoice {
  width: min(400px, 100%);
  height: auto;
  align-self: flex-start;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}

.invoice__header {
  background: linear-gradient(180deg, #3a4258 0%, #2c3348 100%);
  position: relative;
}
.invoice__header-top {
  min-height: 56px; padding: 14px 18px 10px; display: flex; align-items: center;
}
.invoice__header-top-left {
  border: 0; background: transparent; color: #fff; font: inherit; font-weight: 700;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; margin-right: auto;
}
.invoice__header-top-left:hover { background: hsla(0,0%,100%,.16); }
.invoice__logo {
  margin-left: auto; position: relative; line-height: 0; flex-shrink: 0;
}
.invoice__logo img {
  height: 38px; width: auto; max-width: 180px; object-fit: contain; display: block;
}
.invoice__logo .verified {
  top: -6px; right: -8px; border-color: transparent;
}

.progress { position: relative; height: 28px; background: linear-gradient(90deg, #6d45eb, #4574eb); color: #fff; }
.progress__line { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(0,0,0,.18); transition: width 1s linear; }
.progress__row {
  position: relative; z-index: 1; height: 100%; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.progress__status { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; }
.progress__timer { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.invoice-info__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 62px; padding: 12px 16px; background: var(--bar);
}
.invoice-info__product {
  color: #fff; font-size: 14px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; line-height: 1.25; max-width: 58%;
  padding: 7px 11px; border-radius: 10px;
  background: hsla(0,0%,100%,.12); border: 1px solid hsla(0,0%,100%,.16);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.invoice-info__shop { display: flex; align-items: center; gap: 10px; min-width: 0; }
.invoice-info__brand { position: relative; flex-shrink: 0; line-height: 0; }
.invoice-info__logo-img {
  height: 32px; width: auto; max-width: 112px; object-fit: contain; display: block;
}
.verified {
  position: absolute; top: -4px; right: -5px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--bar);
  display: grid; place-items: center;
}
.verified svg { width: 7px; height: 7px; fill: #fff; display: block; }
.invoice-info__shop-name { color: var(--text); font-size: 13px; font-weight: 800; max-width: 120px; text-transform: uppercase; letter-spacing: .03em; }
.invoice-info__val { text-align: right; }
.invoice-info__crypto { color: var(--text); font-size: 15px; font-weight: 800; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }
.invoice-info__fiat { color: var(--muted); font-size: 13px; }

.invoice__contentWr { background: var(--card); }
.invoice__content {
  min-height: 0; padding: 16px 14px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  text-align: center;
}
.invoice-title { color: var(--text); font-size: 22px; margin: 0 0 8px; font-weight: 800; }
.invoice-desc { color: var(--muted); font-size: 15px; font-weight: 500; line-height: 1.5; margin: 0 auto 16px; max-width: 320px; }
.invoice-icon { width: 72px; height: 72px; fill: var(--primary); margin-bottom: 14px; }
.invoice-help {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px 16px; font-size: 13px; flex-wrap: wrap;
}
.invoice-help button, .invoice-help span { border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.invoice-help .lang__opt { color: var(--muted); }
.invoice-help .lang__opt.is-on { color: var(--primary); }
.sep { width: 1px; height: 16px; background: #3a415c; }

.help-pop {
  position: fixed; inset: 0; z-index: 40; background: rgba(8,10,18,.62);
  display: grid; place-items: center; padding: 16px;
}
.help-pop__card {
  width: min(360px, 100%); background: #1e2333; border-radius: 18px; padding: 22px 22px 18px;
  text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.45); border: 1px solid #323954;
}
.help-pop__icon {
  width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%;
  background: #2b3350; color: #8ea0ff; font-weight: 800; font-size: 22px;
  display: grid; place-items: center;
}
.help-pop__card h3 { margin: 0 0 10px; color: #f2f3f8; font-size: 18px; font-weight: 800; }
.help-pop__card p { margin: 0 0 12px; color: #9aa0c0; font-size: 14px; line-height: 1.5; font-weight: 600; }
.help-pop__mail {
  display: inline-block; margin-bottom: 16px; color: #8ea0ff; font-weight: 800;
  text-decoration: none; background: #2a3148; padding: 10px 14px; border-radius: 12px;
}
.help-pop__mail:hover { background: #343c58; }

body, .invoice { -webkit-touch-callout: none; }

.step-email { width: 100%; display: flex; flex-direction: column; min-height: 280px; }
.step-email__content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 0 24px; }
.step-email__form { width: 100%; padding: 8px 8px 0; }
.form-group { position: relative; }
.input-icon { position: absolute; left: 14px; top: 14px; width: 16px; height: 16px; fill: var(--muted); }
.input_text {
  width: 100%; height: 46px; border: 0; border-radius: 14px; background: #262b3e;
  color: var(--text); font: inherit; font-weight: 700; padding: 0 14px 0 40px; outline: none;
}
.input_text:focus-visible { outline: 3px solid #a8b2ff; outline-offset: 3px; }
dialog.help-pop { border: 0; margin: 0; max-width: none; max-height: none; width: 100%; height: 100%; color: inherit; }
dialog.help-pop:not([open]) { display: none; }
dialog.help-pop::backdrop { background: rgba(0,0,0,.5); }
dialog.help-pop :is(button,a):focus-visible { outline: 3px solid #a8b2ff; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
  .step-pending > .loader { animation-duration: 2.4s !important; animation-iteration-count: infinite !important; }
  .confetti { display: none; }
}
.step-email__submit {
  margin-top: 12px; width: 100%; height: 48px; border: 0; border-radius: 14px;
  background: var(--primary); color: #fff; font-weight: 800; cursor: pointer;
}

.step-currencies { width: 100%; }
.step-currencies__list { display: flex; flex-wrap: wrap; margin: -6px; }
.step-currencies__item { width: 50%; padding: 6px; }
.invoice-currency {
  width: 100%; min-height: 64px; border: 0; border-radius: 14px;
  background: #24283a; color: inherit; font: inherit; cursor: pointer; text-align: left;
  overflow: hidden;
}
.invoice-currency:hover { background: #2b3148; }
.invoice-currency__content { display: flex; gap: 8px; padding: 10px; min-width: 0; align-items: flex-start; }
.invoice-currency__icon { width: 24px; height: 24px; margin-top: 2px; flex-shrink: 0; }
.invoice-currency__name { color: var(--text); font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invoice-currency__amount {
  display: block; color: var(--muted); font-size: 11px; font-weight: 500; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.invoice-currency__content > span { min-width: 0; overflow: hidden; }
.back-button { margin-top: 18px; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 800; cursor: pointer; }

.step-pay { width: 100%; display: flex; flex-direction: column; align-items: center; }
.step-pay__qr { width: 224px; max-width: 100%; aspect-ratio: 1; padding: 12px; margin: 4px auto 12px; background: #fff; border-radius: 16px; display: grid; place-items: center; cursor: pointer; }
.step-pay__qr svg, .step-pay__qr img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.step-pay__desc strong { color: var(--text); }
.step-pay__address {
  color: var(--text); margin: 12px 8px; word-break: break-all; font-weight: 700; font-size: 13px;
  cursor: pointer; user-select: all; -webkit-user-select: all;
}
.step-pay__address:hover { color: #fff; }
#pay-amt-text { cursor: pointer; }
.step-pay__network-badge {
  margin: 0 auto 12px; background: var(--primary); color: #fff;
  border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.step-pay__clipboards { display: flex; flex-wrap: wrap; justify-content: space-around; width: 100%; }
.clipboard {
  border: 0; background: none; color: var(--primary); font: inherit; font-weight: 800;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px; margin: 8px; font-size: 14px;
}
.clipboard svg { width: 16px; height: 16px; fill: currentColor; }

.step-pending, .step-completed { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.loader {
  width: 72px; height: 72px; margin-bottom: 16px;
  border: 5px solid #2c3350; border-top-color: var(--primary); border-radius: 50%;
  animation: rot .8s linear infinite;
}
.check { width: 80px; height: 80px; fill: var(--primary); margin-bottom: 16px; }
.icon-expired { width: 88px; height: 88px; color: #ef6b7a; margin-bottom: 16px; }
.cta-muted { background: #3a4158 !important; }
.cta {
  margin-top: 16px; display: inline-flex; align-items: center; justify-content: center;
  min-width: 180px; height: 46px; border-radius: 14px; background: var(--primary); color: #fff; font-weight: 800;
}

.err { color: var(--danger); font-size: 13px; min-height: 1.1em; text-align: left; }
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #12141c; padding: 10px 14px; border-radius: 12px; z-index: 40; font-weight: 800;
}
a { color: var(--primary); text-decoration: none; font-weight: 800; }
.fade-up { animation: fadeUp .4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pop { animation: pop .45s cubic-bezier(.2,1.4,.3,1); }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.step-pay__network-badge img { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: .2; }
}
.flag { width: 16px; height: 12px; display: inline-block; vertical-align: -1px; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255,255,255,.2); }
.lang { display: inline-flex; align-items: center; gap: 10px; }
.lang__opt {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 800; cursor: pointer;
  padding: 4px 2px;
}
.lang__opt.is-on { color: var(--primary); }
.help-pop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 70; display: grid; place-items: center; padding: 16px; }
.help-pop__card { background: #1b1f2e; color: #f2f3f8; border-radius: 16px; padding: 20px; max-width: 320px; width: 100%; }


/* Partial payment / underpaid banner on pay step */
.underpaid-notice {
  width: 100%;
  max-width: 360px;
  margin: 0 auto 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(239, 107, 122, 0.12);
  border: 1px solid rgba(239, 107, 122, 0.45);
  color: var(--danger, #ef6b7a);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  box-sizing: border-box;
}
