:root {
  --bg: #0f1d45;
  --surface: #ffffff;
  --surface-soft: #f7fbfa;
  --ink: #1f2a2c;
  --muted: #637779;
  --accent: #f27a6a;
  --accent-dark: #df6958;
  --teal: #1b9f95;
  --ok-bg: #ebf9ef;
  --ok-fg: #0b6e2f;
  --warn-bg: #eaf8f6;
  --warn-fg: #19635e;
  --err-bg: #fff1f2;
  --err-fg: #b4232f;
  --shadow-main: 0 8px 26px rgba(16, 22, 37, 0.08);
  --shadow-soft: 0 4px 14px rgba(16, 22, 37, 0.06);
  --focus: #1b9f95;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

body.overlay-active {
  overflow: hidden;
}

.layout {
  width: min(100%, 620px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.panel {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-main);
  padding: 16px;
}

.portal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 2px 4px;
}

.panel-checkout h1,
.panel-checkout h2,
.panel-checkout h3,
.policy-panel h2 {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 24px;
  margin-top: 4px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 54px;
  max-width: 220px;
  aspect-ratio: auto;
  object-fit: contain;
  box-shadow: none;
}

.brandtext-wrap {
  display: grid;
  gap: 4px;
}

.brandtext {
  font-weight: 600;
  font-size: 14px;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d6eff4;
  background: rgba(23, 137, 145, 0.28);
}

.lead {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-weight: 600;
}

.alert-error {
  background: var(--err-bg);
  color: var(--err-fg);
}

.alert-success {
  background: var(--ok-bg);
  color: var(--ok-fg);
}

.alert-pending {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.invoice-hero,
.invoice-card,
.gateway-section,
.checkout-rules,
.next-steps,
.fold {
  background: var(--surface-soft);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(16, 22, 37, 0.05);
}

.invoice-hero {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.amount-big {
  font-size: 28px;
  line-height: 1.05;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-weight: 600;
}

.status-stack {
  display: grid;
  gap: 8px;
}

.invoice-card {
  margin-top: 10px;
  padding: 14px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.invoice-card.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.invoice-card.compact-grid .invoice-field-full {
  grid-column: 1 / -1;
}

.status-grid {
  margin-top: 8px;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

.value {
  font-size: 14px;
  font-weight: 600;
}

.strong {
  color: #1d2434;
}

.gateway-section {
  margin-top: 10px;
  padding: 14px;
}

.gateway-cards {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.gateway-card {
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  background: #fff;
  box-shadow: var(--shadow-soft);
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.gateway-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(16, 22, 37, 0.1);
}

.gateway-card input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.gateway-card-title {
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.gateway-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.gateway-icon-square {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  background: #f5f7fb;
  box-shadow: inset 0 0 0 1px rgba(16, 22, 37, 0.08);
  overflow: hidden;
}

.gateway-icon-square-mfaisaa {
  background: #e9f8f6;
}

.gateway-icon-square-bml {
  background: #fff1ed;
}

.gateway-icon-img {
  display: block;
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.gateway-card.is-selected {
  background: #fff;
  box-shadow:
    0 0 0 2px rgba(27, 159, 149, 0.28),
    0 10px 22px rgba(27, 159, 149, 0.16);
}

.gateway-card-brand {
  margin: 10px -12px -12px;
  display: none;
  width: calc(100% + 24px);
  height: auto;
  aspect-ratio: auto;
  max-width: none;
  border-radius: 0 0 12px 12px;
}

.gateway-card.is-selected .gateway-card-brand {
  display: block;
}

.checkout-rules {
  margin-top: 10px;
  padding: 14px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 600;
}

.check-row input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.actions {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.btn {
  appearance: none;
  border-radius: 10px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 12px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  box-shadow: 0 8px 16px rgba(242, 122, 106, 0.28);
}

.btn-ghost {
  background: #fff;
  color: #2f3647;
  box-shadow: var(--shadow-soft);
}

.fold {
  margin-top: 10px;
  overflow: hidden;
}

.invoice-fold .invoice-card {
  margin-top: 0;
  box-shadow: none;
}

.fold summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-weight: 600;
}

.fold summary::-webkit-details-marker {
  display: none;
}

.fold summary::after {
  content: "+";
  float: right;
  color: #646c7b;
}

.fold[open] summary::after {
  content: "-";
}

.fold-body {
  padding: 0 14px 12px;
  color: #333d51;
}

.invoice-details-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.fold-body p,
.fold-body li {
  margin: 0 0 8px;
}

.next-steps {
  margin-top: 10px;
  padding: 14px;
}

.next-steps ul,
.policy-panel ul {
  margin: 0;
  padding-left: 20px;
}

.policy-panel section {
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  box-shadow: inset 0 0 0 1px rgba(16, 22, 37, 0.05);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.redirect-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20, 24, 34, 0.52);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.redirect-overlay-card {
  width: min(100%, 440px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(10, 16, 30, 0.2);
  padding: 18px 16px;
  display: grid;
  gap: 10px;
}

.redirect-overlay-card h2 {
  margin: 0;
  font-size: 22px;
}

.redirect-overlay-card p {
  margin: 0;
}

.redirect-overlay-note {
  color: #1b6660;
  background: #eaf8f6;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}

.redirect-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #d3ece8;
  border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
}

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

.btn:focus-visible,
.gateway-card:focus-within,
a:focus-visible,
select:focus-visible,
input:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (min-width: 720px) {
  .layout {
    width: min(100%, 760px);
    padding: 20px;
  }

  .panel {
    padding: 20px;
  }

  .invoice-hero {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .invoice-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gateway-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}
