:root {
  --brand: #1e1853;
  --brand-soft: #5b56a3;
  --border: rgba(30, 24, 83, 0.12);
  --text: #17142f;
  --text-soft: #6f6e77;
  --surface: #ffffff;
  --surface-alt: #fcfbff;
  --shadow: 0 1px 2px rgba(23, 20, 47, 0.06), 0 24px 48px -24px rgba(30, 24, 83, 0.28);
  --radius: 16px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(30, 24, 83, 0.05), transparent 24%),
    linear-gradient(180deg, var(--surface-alt) 0%, var(--surface) 38%);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: #d4b36b;
  letter-spacing: 0.34em;
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
}

.brand__mark {
  width: 22px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.brand__mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand__mark path {
  fill: #d4b36b;
}

.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.shell {
  width: 100%;
  max-width: 980px;
  min-height: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.headline {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  line-height: 1.15;
  font-weight: 700;
  color: var(--brand);
}

.merchant {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--brand);
}

.type {
  margin: 0.3rem 0 1.2rem;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0 0 1.2rem;
}

.label {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.value {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.45;
}

.amount {
  margin: 0 0 1.2rem;
  font-size: 2.2rem;
  line-height: 1;
  font-weight: 800;
  color: var(--brand);
}

.notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(30, 24, 83, 0.16);
  background: rgba(30, 24, 83, 0.05);
  color: var(--brand);
  font-size: 0.95rem;
  line-height: 1.4;
}

.cta {
  width: 100%;
  min-height: 48px;
  margin-top: 1.2rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #140f4b 0%, #5b56a3 100%);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.cta:hover {
  transform: translateY(-1px);
}

.cta:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.state {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 16px;
}

.state__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--text-soft);
}

.state__title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--brand);
}

.state__merchant {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.state__message {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.state__contact {
  margin: 1.25rem auto 0;
  max-width: 320px;
  text-align: left;
}

.state__contact-value {
  margin-bottom: 0.5rem;
}

.state__summary {
  margin: 1.5rem auto 0;
  max-width: 320px;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.state__summary-amount {
  font-size: 1.7rem;
  margin-bottom: 0;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  text-align: center;
  padding: 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(84, 111, 216, 0.2);
  border-top-color: #546fd8;
  animation: spin 0.85s linear infinite;
}

.retry {
  width: auto;
  padding: 0.75rem 1rem;
  min-height: 42px;
  margin-top: 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 24, 83, 0.24);
  background: transparent;
  color: var(--brand);
  font: inherit;
  cursor: pointer;
}

.inline-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #ffffff;
  animation: spin 0.75s linear infinite;
}

.hidden {
  display: none !important;
}

.payment-page {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 420px);
  gap: 40px;
  align-items: start;
  padding: 24px;
}

.payment-page__summary {
  min-width: 0;
  padding-right: 40px;
  border-right: 1px solid var(--border);
}

.payment-summary {
  max-width: 420px;
  padding-top: 24px;
}

.payment-summary__merchant {
  font-size: 1.9rem;
}

.payment-summary__type {
  margin-bottom: 1rem;
}

.payment-page__module {
  display: flex;
  justify-content: center;
}

.payment-card-box {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fefcff 100%);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
}

.payment-card-box__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--brand);
  font-weight: 700;
}

.payment-card-box__dot {
  width: 14px;
  height: 14px;
  border: 2px solid var(--brand);
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.payment-card-box__dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
}

.payment-card-box__hint {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.payment-card-box__networks {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.payment-card-box__network {
  min-width: 38px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-align: center;
}

.payment-card-box__network--visa {
  background: #2746c7;
}

.payment-card-box__network--mc {
  background: #f06722;
}

.payment-card-box__network--amex {
  background: #1692d0;
}

.card-module-frame {
  width: 100%;
  height: 560px;
  min-height: 560px;
  overflow: visible;
}

.card-module-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
}

.payment-card-box__submit {
  margin-top: 10px;
  min-height: 42px;
  max-width: 320px;
  width: 100%;
  align-self: center;
  background: #1e1853;
  font-size: 0.98rem;
}

.payment-card-box__footer {
  margin-top: 12px;
  padding: 14px 14px 12px;
  background: #f7f4ff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.payment-card-box__disclaimer {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.module-status {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(17, 120, 70, 0.08);
  color: #117846;
  font-size: 0.9rem;
  line-height: 1.4;
}

.module-status--error {
  background: rgba(180, 36, 24, 0.08);
  color: #b42418;
}

.alert {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert--success {
  background: rgba(17, 120, 70, 0.08);
  color: #117846;
  border: 1px solid rgba(17, 120, 70, 0.16);
}

.alert--error {
  background: rgba(180, 36, 24, 0.06);
  color: #b42418;
  border: 1px solid rgba(180, 36, 24, 0.16);
}

.alert__icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.reference {
  margin: 0 0 1.2rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand);
}

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

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .shell {
    padding: 14px;
  }

  .card {
    padding: 20px;
  }

  .merchant {
    font-size: 1.35rem;
  }

  .amount {
    font-size: 1.85rem;
  }
}

@media (max-width: 900px) {
  .shell {
    padding: 0;
  }

  .payment-page {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px;
  }

  .payment-page__summary {
    padding-right: 0;
    padding-bottom: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .payment-summary {
    max-width: none;
    padding-top: 0;
  }
}
