:root {
  --brand: #135e4c;
  --brand-ring: rgba(19, 94, 76, .16);
  --text: #101828;
  --muted: #667085;
  --border: #d0d5dd;
  --line: #eaecf0;
  --bg: #f2f4f7;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --wait: #175cd3;
  --wait-bg: #eff8ff;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.testbar {
  position: fixed; top: 0; left: 0; right: 0;
  padding: 6px 12px; text-align: center;
  background: #fef0c7; color: #93370d; font-size: 12px; font-weight: 600; letter-spacing: .04em;
}

.card {
  width: 100%; max-width: 420px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 24px; box-shadow: 0 12px 32px rgba(16, 24, 40, .07);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand.center { justify-content: center; margin-bottom: 18px; }
.logo {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 700;
}
h1 { font-size: 16px; margin: 0; }
.muted { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.field { margin-bottom: 14px; min-width: 0; }
label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #344054; }

input, select, .hosted {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text); font: inherit; font-size: 16px;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.field.invalid input, .field.invalid select, .field.invalid iframe { border-color: var(--bad); }
.field.invalid label { color: var(--bad); }

.amount { position: relative; }
.amount input { padding-right: 56px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.amount .unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; font-weight: 700;
}
.hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

button {
  width: 100%; height: 48px; margin-top: 8px;
  border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; font: inherit; font-size: 16px; font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }

#status { min-height: 20px; margin: 12px 0 0; font-size: 14px; line-height: 1.5; }
#status.error { color: var(--bad); }
#status.info { color: var(--muted); }

.secure {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; line-height: 1.5;
}
.secure svg { flex: none; margin-top: 2px; color: var(--brand); }

/* result page */
.result { text-align: center; }
.icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; font-weight: 700;
}
.success .icon { background: var(--ok-bg); color: var(--ok); }
.failure .icon { background: var(--bad-bg); color: var(--bad); }
.pending .icon { background: var(--wait-bg); color: var(--wait); }
h2 { margin: 0 0 6px; font-size: 19px; }
.sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.big-amount { margin: 0 0 16px; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

.details { margin: 0 0 18px; padding: 2px 14px; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.details div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.details div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }

.actions { display: flex; justify-content: center; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none;
}

.spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid #d1e0ff; border-top-color: var(--wait);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* checkout link page */
.invoice { margin: -4px 0 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f9fafb; }
.invoice-amount { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.invoice-amount span { font-size: 15px; color: var(--muted); font-weight: 700; }
.invoice .details { margin: 0; background: #fff; }
.cancel { margin-top: 12px; text-align: center; }
.tries { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; line-height: 1.5; }
.tries p { margin: 0; }
.tries-title { font-weight: 600; }
.tries ul { margin: 4px 0; padding-left: 18px; }
.next-step { margin: -6px 0 16px; font-size: 14px; font-weight: 600; line-height: 1.6; }
button.link {
  width: auto; height: auto; margin: 0; padding: 4px; background: none;
  color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: underline;
}
.hint.center { text-align: center; }
.actions { flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }
.actions .btn.ghost { width: auto; height: auto; margin: 0; background: #fff; color: #344054; border: 1px solid var(--border); }
.row.two { grid-template-columns: 1fr 1fr; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92em; background: #f2f4f7; padding: 1px 5px; border-radius: 5px; }

@media (max-width: 380px) {
  .card { padding: 22px 16px; }
  .row { grid-template-columns: 1fr 1fr; }
  #field-securityCode { grid-column: span 2; }
  .row.two { grid-template-columns: 1fr; }
}
