:root {
  /* byDesign brand palette */
  --bg: #ffffff;
  --ink: #232323;          /* byDesign heading black */
  --ink-soft: #4a4f57;
  --ink-faint: #868b93;
  --line: #ecece8;
  --line-strong: #dcdcd6;
  --brand: #4285fc;        /* byDesign primary blue */
  --brand-dark: #2f6fe0;
  --brand-tint: #eef4ff;
  --brand-tint-2: #e0ecff;
  --green: #9de551;        /* byDesign green accent */
  --green-tint: #eef9df;
  --violet: #6c63f5;       /* logo violet blade */
  --summary-from: #4f8dff;
  --summary-to: #2f6fe0;
  --ok: #34b566;
  --ok-tint: #e8f8ee;
  --warn: #f59e0b;
  --err: #e5484d;
  --err-tint: #fef0f0;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(35, 35, 35, 0.05);
  --shadow-sm: 0 1px 3px rgba(35, 35, 35, 0.08), 0 1px 2px rgba(35, 35, 35, 0.04);
  --shadow-md: 0 4px 12px rgba(35, 35, 35, 0.08);
  --shadow-lg: 0 24px 48px rgba(47, 111, 224, 0.22), 0 8px 16px rgba(35, 35, 35, 0.08);
  --focus: 0 0 0 4px rgba(66, 133, 252, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  display: grid;
  grid-template-columns: 44% 56%;
  min-height: 100vh;
}

/* ============ LEFT: summary ============ */
.summary {
  background: linear-gradient(160deg, var(--summary-from) 0%, var(--summary-to) 100%);
  color: #fff;
  display: flex;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}
.summary::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(55% 45% at 12% 6%, rgba(157, 229, 81, 0.28), transparent 60%),
    radial-gradient(50% 45% at 92% 96%, rgba(108, 99, 245, 0.35), transparent 58%);
  pointer-events: none;
}
.summary-inner {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 52px 60px;
  display: flex;
  flex-direction: column;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }
/* The logo wordmark is near-black; on the blue panel we render it white. */
.brand-logo { height: 30px; width: auto; filter: brightness(0) invert(1); }

.summary-body { margin-top: 68px; flex: 1; }
.summary-label { color: rgba(255, 255, 255, 0.62); font-size: 14px; font-weight: 500; margin: 0 0 10px; }
.amount { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 40px; line-height: 1; }

.line-items { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.line-item { display: flex; gap: 14px; align-items: center; }
.line-item-thumb {
  width: 46px; height: 46px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, #9de551, #4285fc);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 6px 16px rgba(47, 111, 224, 0.35);
}
.line-item-info { flex: 1; }
.line-item-name { font-weight: 600; font-size: 14.5px; }
.line-item-desc { color: rgba(255, 255, 255, 0.5); font-size: 12.5px; margin-top: 3px; line-height: 1.45; }
.line-item-price { font-weight: 700; font-size: 14.5px; }

.totals { border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 20px; }
.totals-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 13px; }
.totals-row.muted { color: rgba(255, 255, 255, 0.55); }
.totals-row.total { font-weight: 700; font-size: 17px; margin-top: 6px; margin-bottom: 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }

.trust { list-style: none; margin: 40px 0 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.trust li { display: flex; align-items: center; gap: 11px; font-size: 13px; color: rgba(255, 255, 255, 0.78); }
.trust-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px;
  background: rgba(255, 255, 255, 0.14); color: #fff;
}
.summary-footer { margin-top: 28px; color: rgba(255, 255, 255, 0.45); font-size: 12.5px; }
.summary-footer strong { color: rgba(255, 255, 255, 0.72); font-weight: 600; }

/* ============ RIGHT: checkout ============ */
.checkout { display: flex; justify-content: flex-start; }
.checkout-inner { width: 100%; max-width: 500px; padding: 52px 60px 64px; }

.checkout-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 5px; }
.subtitle { color: var(--ink-faint); font-size: 14.5px; margin: 0 0 32px; line-height: 1.5; }

.section { margin-bottom: 30px; }
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--ink);
  margin: 0 0 16px;
}
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; font-weight: 550; color: var(--ink-soft); margin-bottom: 7px; }
.optional { color: var(--ink-faint); font-weight: 400; }
.field-hint { display: block; font-size: 12px; color: var(--ink-faint); margin-top: 7px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.grid-2 .field { margin-bottom: 0; }

.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: #c3c8d2; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input::placeholder { color: #b3bac6; }

.select-wrap { position: relative; }
.select { appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer; }
.select-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 12px; pointer-events: none; }

/* products */
.products { display: flex; flex-direction: column; gap: 11px; }
.product {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer; background: #fff; width: 100%; text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.06s;
}
.product:hover { border-color: #bfc3d4; }
.product:active { transform: scale(0.995); }
.product.selected { border-color: var(--brand); background: var(--brand-tint); box-shadow: var(--focus); }
.product-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; position: relative; transition: border-color 0.15s; }
.product.selected .product-radio { border-color: var(--brand); }
.product.selected .product-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand); }
.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 14.5px; }
.product-desc { color: var(--ink-faint); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.product-price { font-weight: 700; font-size: 15px; white-space: nowrap; }

/* method toggle */
.method-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.method-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: all 0.15s;
}
.method-btn:hover { border-color: #bfc3d4; }
.method-btn.active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dark); box-shadow: var(--focus); }
.method-ic { display: inline-flex; }

/* accepted card brands */
.card-accepted { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-accepted[hidden] { display: none; }
.card-accepted-label { font-size: 12px; color: var(--ink-faint); }
.brands { display: inline-flex; gap: 7px; align-items: center; }
.brand-badge {
  height: 26px; min-width: 40px; padding: 0 7px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-xs);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
}
.brand-badge.visa { color: #1a1f71; }
.brand-badge.amex { color: #1174c0; font-size: 9px; }
.brand-badge.disc { color: #e26a1b; font-size: 9px; }
.brand-badge.mc { gap: 0; }
.brand-badge.mc span { width: 13px; height: 13px; border-radius: 50%; display: block; }
.brand-badge.mc span:first-child { background: #eb001b; }
.brand-badge.mc span:last-child { background: #f79e1b; margin-left: -6px; mix-blend-mode: multiply; }

/* finix / evervault form shell */
.finix-shell { position: relative; min-height: 90px; }
#finix-form { border-radius: var(--radius); }
.finix-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--ink-faint); font-size: 14px; background: #fff;
}
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ACH consent */
.ach-consent[hidden] { display: none; }
.consent { display: flex; gap: 11px; align-items: flex-start; padding: 14px 16px; background: #f8f9fb; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; }
.consent input[type="checkbox"] { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--brand); flex-shrink: 0; cursor: pointer; }
.consent-text { font-size: 12px; line-height: 1.55; color: var(--ink-soft); }

/* pay button */
.pay-btn {
  width: 100%; padding: 16px; margin-top: 6px; border: none; border-radius: var(--radius-pill);
  background: var(--brand); color: #fff; font-family: inherit; font-size: 15.5px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: 0 6px 16px rgba(66, 133, 252, 0.32);
}
.pay-btn:hover:not(:disabled) { background: var(--brand-dark); box-shadow: 0 8px 20px rgba(66, 133, 252, 0.42); }
.pay-btn:active:not(:disabled) { transform: translateY(1px); }
.pay-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.pay-lock { display: inline-flex; opacity: 0.9; }
.pay-btn.secondary { background: var(--ink); box-shadow: none; }
.pay-btn.secondary:hover:not(:disabled) { background: #000; box-shadow: none; }
.pay-btn.secondary .pay-lock { display: none; }
.pay-btn-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.7s linear infinite; }

/* error */
.error-banner { margin-top: 16px; padding: 12px 14px; background: var(--err-tint); border: 1px solid #f7c6c7; color: var(--err); border-radius: var(--radius); font-size: 13.5px; line-height: 1.45; }
.error-banner[hidden] { display: none; }

/* test hint */
.test-hint { margin-top: 26px; padding: 4px 0; font-size: 12.5px; color: var(--ink-soft); border-top: 1px solid var(--line); }
.test-hint summary { cursor: pointer; padding: 14px 0 4px; font-weight: 600; color: var(--ink-faint); list-style: none; user-select: none; }
.test-hint summary::-webkit-details-marker { display: none; }
.test-hint summary::before { content: "▸ "; color: var(--ink-faint); }
.test-hint[open] summary::before { content: "▾ "; }
.test-hint ul { margin: 8px 0 14px; padding-left: 18px; line-height: 1.8; }
.test-hint code { background: #f1f2f5; padding: 1px 6px; border-radius: 5px; font-size: 12px; color: var(--ink); }

/* ============ success overlay ============ */
.overlay {
  position: fixed; inset: 0; background: rgba(11, 11, 26, 0.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
  animation: fade 0.2s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.receipt { background: #fff; border-radius: 20px; padding: 34px 34px 38px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); text-align: center; animation: pop 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.2); }
.receipt-logo { height: 26px; width: auto; margin: 0 auto 22px; display: block; }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.receipt-check { width: 60px; height: 60px; margin: 0 auto 20px; border-radius: 50%; background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; box-shadow: 0 8px 20px rgba(18, 183, 106, 0.35); }
.receipt-check.pending { background: var(--warn); box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35); }
.receipt-check.failed { background: var(--err); box-shadow: 0 8px 20px rgba(229, 72, 77, 0.35); }
.receipt h2 { margin: 0 0 7px; font-size: 21px; letter-spacing: -0.01em; }
.receipt-sub { color: var(--ink-faint); font-size: 14px; margin: 0 0 24px; line-height: 1.5; }
.receipt-details { text-align: left; background: #f8f9fb; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; margin: 0 0 22px; font-size: 13px; }
.receipt-details div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.receipt-details div:last-child { border-bottom: none; }
.receipt-details dt { color: var(--ink-faint); }
.receipt-details dd { margin: 0; font-weight: 600; font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; text-align: right; word-break: break-all; }
.ach-confirmation { text-align: left; font-size: 11.5px; line-height: 1.5; color: var(--ink-faint); background: #f8f9fb; border-radius: var(--radius); padding: 12px 14px; margin: -6px 0 20px; }
.ach-confirmation[hidden] { display: none; }

/* ============ responsive ============ */
@media (max-width: 940px) {
  .page { grid-template-columns: 1fr; }
  .summary { justify-content: center; }
  .summary-inner { max-width: 560px; padding: 36px 28px; }
  .summary-body { margin-top: 30px; }
  .amount { font-size: 38px; margin-bottom: 28px; }
  .trust { flex-direction: row; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
  .trust li { font-size: 12px; }
  .checkout { justify-content: center; }
  .checkout-inner { max-width: 560px; padding: 36px 28px 56px; }
}
@media (max-width: 480px) {
  .summary-inner, .checkout-inner { padding-left: 20px; padding-right: 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .amount { font-size: 34px; }
}
