/* ============================================================
   CUSTOM CHECKOUT — Palantir / ops-tech visual language
   ============================================================ */

body.cpay-open {
  overflow: hidden;
}

.cpay-overlay {
  --cpay-bg: #07090c;
  --cpay-panel: #0b0e11;
  --cpay-raised: #0e1217;
  --cpay-line: #21262d;
  --cpay-line-strong: #39424d;
  --cpay-text: #f0f6fc;
  --cpay-muted: #8b949e;
  --cpay-dim: #4b5563;
  --cpay-accent: #58a6ff;
  --cpay-green: #3fb950;
  --cpay-red: #f85149;
  --cpay-gold: #d29922;
  --cpay-mono: ui-monospace, SFMono-Regular, "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;

  position: fixed;
  inset: 0;
  z-index: 12000;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--cpay-bg);
  color: var(--cpay-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.cpay-overlay *,
.cpay-overlay *::before,
.cpay-overlay *::after {
  box-sizing: border-box;
}

.cpay-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(88, 166, 255, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, .055) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 20%, transparent 78%);
  mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, #000 20%, transparent 78%);
}

.cpay-scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(255, 255, 255, .018) 3px,
    rgba(255, 255, 255, .018) 4px
  );
}

.cpay-bracket {
  position: fixed;
  width: 26px;
  height: 26px;
  pointer-events: none;
  border-color: var(--cpay-line-strong);
  border-style: solid;
  opacity: .8;
}
.cpay-bracket--tl { top: 22px; left: 22px; border-width: 1px 0 0 1px; }
.cpay-bracket--tr { top: 22px; right: 22px; border-width: 1px 1px 0 0; }
.cpay-bracket--bl { bottom: 22px; left: 22px; border-width: 0 0 1px 1px; }
.cpay-bracket--br { bottom: 22px; right: 22px; border-width: 0 1px 1px 0; }

.cpay-shell {
  position: relative;
  width: min(1080px, calc(100vw - 96px));
  margin: 6.5vh auto;
  background: rgba(11, 14, 17, .94);
  border: 1px solid var(--cpay-line);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .015) inset;
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  animation: cpay-in .35s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes cpay-in {
  from { opacity: 0; transform: translateY(12px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cpay-shell::before,
.cpay-shell::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  pointer-events: none;
  border: 1px solid var(--cpay-accent);
  opacity: .65;
  z-index: 2;
}
.cpay-shell::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.cpay-shell::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* ---------- top bar ---------- */

.cpay-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 10px 18px 10px 20px;
  border-bottom: 1px solid var(--cpay-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent);
}

.cpay-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  font-family: var(--cpay-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cpay-brand-name em {
  color: var(--cpay-dim);
  font-style: normal;
  font-weight: 500;
}
.cpay-mark {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--cpay-accent);
  background: rgba(88, 166, 255, .08);
  color: var(--cpay-accent);
  font-family: var(--cpay-mono);
  font-size: 10px;
  letter-spacing: .04em;
}

.cpay-channel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--cpay-muted);
  font-family: var(--cpay-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.cpay-channel i {
  width: 6px;
  height: 6px;
  display: block;
  background: var(--cpay-green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(63, 185, 80, .12);
  animation: cpay-pulse 2.4s ease-out infinite;
}
@keyframes cpay-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, .35); }
  70% { box-shadow: 0 0 0 7px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

.cpay-close {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cpay-line);
  background: transparent;
  color: var(--cpay-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.cpay-close:hover { color: var(--cpay-text); border-color: var(--cpay-line-strong); background: rgba(255, 255, 255, .03); }
.cpay-close .material-icons-round { font-size: 17px; }
.cpay-close:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- layout ---------- */

.cpay-body {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
}

.cpay-summary {
  position: relative;
  padding: 38px 38px 30px;
  border-right: 1px solid var(--cpay-line);
  background:
    linear-gradient(145deg, rgba(88, 166, 255, .035), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, .012), transparent 70%);
  overflow: hidden;
}
.cpay-summary::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 240px;
  height: 240px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(88, 166, 255, .12), transparent 68%);
}

.cpay-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cpay-muted);
  font-family: var(--cpay-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.cpay-kicker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--cpay-line-strong);
  color: var(--cpay-accent);
  font-size: 8px;
  letter-spacing: 0;
}

.cpay-summary h2 {
  margin: 20px 0 8px;
  font-size: clamp(24px, 3vw, 33px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.035em;
  color: var(--cpay-text);
}

.cpay-sub {
  margin: 0 0 28px;
  max-width: 39ch;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--cpay-muted);
}

.cpay-lines {
  border-top: 1px solid var(--cpay-line);
}

.cpay-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--cpay-line);
}
.cpay-line > div { min-width: 0; }
.cpay-line b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--cpay-text);
  overflow-wrap: anywhere;
}
.cpay-line small {
  display: block;
  margin-top: 4px;
  color: var(--cpay-dim);
  font-family: var(--cpay-mono);
  font-size: 8.5px;
  letter-spacing: .12em;
}
.cpay-line > span {
  flex: 0 0 auto;
  font-family: var(--cpay-mono);
  font-size: 12px;
  color: var(--cpay-text);
  white-space: nowrap;
}

.cpay-line--skeleton {
  height: 46px;
  border-bottom: 1px solid var(--cpay-line);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .035), transparent);
  background-size: 200% 100%;
  animation: cpay-skeleton 1.4s linear infinite;
}
@keyframes cpay-skeleton {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.cpay-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--cpay-line);
}
.cpay-total span {
  color: var(--cpay-muted);
  font-family: var(--cpay-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}
.cpay-total strong {
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.cpay-meta {
  display: grid;
  gap: 8px;
  padding: 18px 0 24px;
}
.cpay-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--cpay-mono);
  font-size: 9.5px;
  letter-spacing: .08em;
}
.cpay-meta-row span { color: var(--cpay-dim); }
.cpay-meta-row b {
  color: var(--cpay-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 64%;
}

.cpay-security {
  display: grid;
  gap: 13px;
  padding-top: 22px;
  border-top: 1px solid var(--cpay-line);
}
.cpay-security-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.cpay-security-item > .material-icons-round {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 15px;
  color: var(--cpay-green);
}
.cpay-security-item b {
  display: block;
  margin-bottom: 2px;
  font-family: var(--cpay-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--cpay-text);
}
.cpay-security-item p {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--cpay-dim);
}

/* ---------- payment panel ---------- */

.cpay-panel {
  position: relative;
  padding: 38px 36px 26px;
  background: rgba(7, 9, 12, .48);
}
.cpay-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, rgba(88, 166, 255, .28), transparent);
  opacity: .3;
}

.cpay-method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0 18px;
  padding: 14px 15px;
  border: 1px solid var(--cpay-line);
  background: var(--cpay-raised);
}
.cpay-method b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
}
.cpay-method small {
  display: block;
  margin-top: 3px;
  color: var(--cpay-muted);
  font-size: 10.5px;
}
.cpay-cards {
  display: flex;
  gap: 5px;
}
.cpay-cards span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 33px;
  height: 21px;
  padding: 0 5px;
  border: 1px solid var(--cpay-line-strong);
  color: var(--cpay-muted);
  font-family: var(--cpay-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .06em;
}

.cpay-payment-box {
  position: relative;
  min-height: 160px;
  padding: 15px;
  border: 1px solid var(--cpay-line);
  background: #080b0e;
}
.cpay-payment-box::before {
  content: "SECURE INPUT / TOKENIZED";
  position: absolute;
  top: -7px;
  right: 12px;
  padding: 0 5px;
  background: var(--cpay-panel);
  color: var(--cpay-dim);
  font-family: var(--cpay-mono);
  font-size: 7.5px;
  letter-spacing: .14em;
}

#cpay-payment {
  min-height: 128px;
}

.cpay-loading {
  position: absolute;
  inset: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #080b0e;
  color: var(--cpay-muted);
  font-family: var(--cpay-mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  transition: opacity .25s, visibility .25s;
}
.cpay-loading.is-ready {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.cpay-spinner {
  width: 13px;
  height: 13px;
  display: block;
  border: 1px solid var(--cpay-line-strong);
  border-top-color: var(--cpay-accent);
  border-radius: 50%;
  animation: cpay-spin .8s linear infinite;
}
@keyframes cpay-spin { to { transform: rotate(360deg); } }

.cpay-error {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 2px solid var(--cpay-red);
  background: rgba(248, 81, 73, .07);
  color: #ffb4ae;
  font-size: 11.5px;
  line-height: 1.5;
}
.cpay-error.is-visible { display: block; }

.cpay-submit {
  position: relative;
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid var(--cpay-accent);
  background: var(--cpay-accent);
  color: #04121f;
  font-family: var(--cpay-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.cpay-submit .material-icons-round { font-size: 16px; }
.cpay-submit-arrow {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}
.cpay-submit:hover:not(:disabled) {
  background: #79b8ff;
  border-color: #79b8ff;
}
.cpay-submit:disabled {
  opacity: .48;
  cursor: not-allowed;
}
.cpay-submit.is-busy {
  color: transparent;
}
.cpay-submit.is-busy::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 1px solid rgba(4, 18, 31, .25);
  border-top-color: #04121f;
  border-radius: 50%;
  animation: cpay-spin .8s linear infinite;
}
.cpay-submit.is-busy .cpay-submit-arrow { display: none; }

.cpay-legal {
  margin: 14px 0 0;
  color: var(--cpay-dim);
  font-size: 10px;
  line-height: 1.65;
}
.cpay-legal b { color: var(--cpay-muted); font-weight: 600; }

.cpay-footnote {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--cpay-line);
}
.cpay-footnote span {
  padding: 3px 6px;
  border: 1px solid var(--cpay-line);
  color: var(--cpay-dim);
  font-family: var(--cpay-mono);
  font-size: 7.5px;
  letter-spacing: .12em;
}

/* ---------- success ---------- */

.cpay-success {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}
.cpay-success[hidden] { display: none; }
.cpay-success-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cpay-green);
  background: rgba(63, 185, 80, .07);
  color: var(--cpay-green);
}
.cpay-success-mark .material-icons-round { font-size: 26px; }
.cpay-success-mark.is-pending {
  border-color: var(--cpay-gold);
  background: rgba(210, 153, 34, .07);
  color: var(--cpay-gold);
}
.cpay-success h3 {
  margin: 20px 0 9px;
  font-size: 27px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.035em;
}
.cpay-success p {
  max-width: 37ch;
  margin: 0;
  color: var(--cpay-muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.cpay-success-ref {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--cpay-line);
  background: var(--cpay-raised);
  font-family: var(--cpay-mono);
  font-size: 9px;
  letter-spacing: .12em;
}
.cpay-success-ref span { color: var(--cpay-dim); }
.cpay-success-ref b { color: var(--cpay-text); font-weight: 600; }
.cpay-success .cpay-submit { margin-top: 22px; max-width: 260px; }

/* ---------- footer ---------- */

.cpay-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 20px;
  border-top: 1px solid var(--cpay-line);
  background: rgba(255, 255, 255, .012);
  color: var(--cpay-dim);
  font-family: var(--cpay-mono);
  font-size: 8px;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.cpay-footer em { color: var(--cpay-line-strong); font-style: normal; }
#cpay-footer-status[data-tone="success"] { color: var(--cpay-green); }
#cpay-footer-status[data-tone="pending"] { color: var(--cpay-gold); }
#cpay-footer-status[data-tone="error"] { color: var(--cpay-red); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .cpay-shell {
    width: calc(100vw - 32px);
    margin: 16px auto;
  }
  .cpay-body {
    grid-template-columns: 1fr;
  }
  .cpay-summary {
    padding: 28px 24px 24px;
    border-right: none;
    border-bottom: 1px solid var(--cpay-line);
  }
  .cpay-summary h2 { margin-top: 15px; }
  .cpay-sub { margin-bottom: 20px; }
  .cpay-security { grid-template-columns: 1fr 1fr; gap: 14px; }
  .cpay-panel { padding: 28px 24px 24px; }
  .cpay-panel::before { display: none; }
  .cpay-success { min-height: 320px; }
}

@media (max-width: 560px) {
  .cpay-bracket { display: none; }
  .cpay-shell {
    width: 100%;
    margin: 0;
    min-height: 100dvh;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
  .cpay-topbar { padding: 9px 14px; }
  .cpay-brand-name em { display: none; }
  .cpay-channel span { display: none; }
  .cpay-summary { padding: 24px 18px 20px; }
  .cpay-panel { padding: 24px 18px 22px; }
  .cpay-summary h2 { font-size: 26px; }
  .cpay-total { align-items: flex-start; flex-direction: column; gap: 7px; }
  .cpay-total strong { font-size: 30px; }
  .cpay-security { grid-template-columns: 1fr; }
  .cpay-meta-row { align-items: flex-start; flex-direction: column; gap: 3px; }
  .cpay-meta-row b { max-width: 100%; }
  .cpay-footer { flex-direction: column; align-items: flex-start; gap: 5px; }
  .cpay-success { min-height: 300px; }
}
