/* Purchase pages (/billing, /billing/checkout) in the main-menu style. */
.billing-page {
  min-height: 100vh;
  margin: 0;
  background: #090909;
  color: #f5f5f5;
  font-family: Onest, Inter, system-ui, sans-serif;
}
.billing-page [hidden] { display: none !important; }
.billing-topbar .public-controls { margin-left: auto; }
.billing-topbar .public-mail-link img { width: 18px; height: 18px; filter: brightness(0) invert(1); }

.billing-main {
  display: grid;
  gap: 22px;
  width: min(100% - 32px, 560px);
  margin: clamp(24px, 6vh, 64px) auto 56px;
}

.billing-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.billing-head h1 { margin: 0; font: 800 clamp(28px, 6vw, 38px)/1.1 Onest, Inter, sans-serif; letter-spacing: -.03em; }
.billing-eyebrow { margin: 0 0 6px; color: #9a9a9a; font: 800 12px/1 Onest, Inter, sans-serif; letter-spacing: .12em; text-transform: uppercase; }

/* Back arrow: rounded square, the same as the main menu. */
.billing-back {
  display: inline-grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #3b3b3b;
  border-radius: 12px;
  background: #171717;
  transition: background .25s, border-color .25s, box-shadow .3s;
}
.billing-back img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.billing-back:is(:hover, :focus-visible) { outline: none; border-color: #d4d4d4; background: #242424; box-shadow: 0 0 16px #ffffff24; }

.billing-card {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid #2e2e2e;
  border-radius: 16px;
  background: #111;
}

/* Quantity and total share one row; the caption is a separate label, so hovering it
   (or the gap around the field) never highlights the input. */
.billing-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 20px; }
.billing-field { display: grid; gap: 8px; min-width: 0; }
.billing-field > label, .billing-label { margin: 0; color: #d6d6d6; font: 700 13px/1.3 Onest, Inter, sans-serif; }
.billing-grid .billing-sum { display: grid; align-content: end; gap: 8px; text-align: right; }
.billing-grid .billing-sum > span { color: #d6d6d6; font: 700 13px/1.3 Onest, Inter, sans-serif; }
.billing-grid .billing-sum > strong { display: flex; align-items: center; min-height: 50px; justify-content: flex-end; font: 700 18px/1 Onest, Inter, sans-serif; letter-spacing: 0; }
@media (max-width: 280px) {
  .billing-grid { grid-template-columns: minmax(0, 1fr); }
  .billing-grid .billing-sum { text-align: left; }
  .billing-grid .billing-sum > strong { justify-content: flex-start; min-height: 0; }
}
.billing-field small, .billing-note { margin: 0; color: #8f8f8f; font-size: 12.5px; line-height: 1.5; }
.billing-field input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: #171717;
  color: #f5f5f5;
  font: 700 18px/1 Onest, Inter, sans-serif;
  outline: none;
  transition: border-color .25s, box-shadow .3s;
  -moz-appearance: textfield;
  appearance: textfield;
}
.billing-field input::-webkit-inner-spin-button,
.billing-field input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.billing-field input:hover { border-color: #6b6b6b; }
.billing-field input:focus-visible { border-color: #d4d4d4; box-shadow: 0 0 0 3px #ffffff1f; }
.billing-field input[aria-invalid="true"] { border-color: #b4545c; }

.billing-summary { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid #262626; }
.billing-sum { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.billing-sum span { color: #b5b5b5; font-size: 14px; }
.billing-sum strong { font: 800 clamp(22px, 5vw, 28px)/1.2 Onest, Inter, sans-serif; letter-spacing: -.02em; white-space: nowrap; }

.billing-primary, .billing-secondary, .billing-method {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: #171717;
  color: #f5f5f5;
  font: 700 14px/1.3 Onest, Inter, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background .25s, border-color .25s, box-shadow .3s, opacity .25s;
}
.billing-primary { justify-content: center; border-color: #d4d4d4; background: #242424; }
.billing-primary img, .billing-secondary img, .billing-method > img:first-child {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}
.billing-primary:is(:hover, :focus-visible):not(:disabled),
.billing-secondary:is(:hover, :focus-visible):not(:disabled),
.billing-method:is(:hover, :focus-visible):not(:disabled) {
  outline: none;
  border-color: #d4d4d4;
  background: #2a2a2a;
  box-shadow: 0 0 16px #ffffff24;
}
.billing-primary:disabled, .billing-secondary:disabled { opacity: .45; cursor: not-allowed; }

.billing-step { display: grid; gap: 12px; }
.billing-methods { display: grid; gap: 8px; }
.billing-method { width: 100%; min-height: 60px; text-align: left; }
.billing-method > span { display: grid; flex: 1 1 auto; gap: 2px; min-width: 0; }
.billing-method small { color: #8f8f8f; font-size: 12px; font-weight: 600; }
.billing-method-arrow { flex: 0 0 18px; width: 18px; height: 18px; margin-left: auto; filter: brightness(0) invert(.7); }
.billing-method:disabled { cursor: not-allowed; opacity: .5; }

.billing-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.billing-key {
  display: block;
  padding: 14px;
  overflow-wrap: anywhere;
  border: 1px dashed #4a4a4a;
  border-radius: 10px;
  background: #0c0c0c;
  color: #f5f5f5;
  font: 700 clamp(15px, 4vw, 19px)/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: .06em;
  text-align: center;
  user-select: all;
}
.billing-success { color: #7ed99a; }
.billing-message { min-height: 1.4em; margin: 0; color: #c9c9c9; font-size: 13px; }
.billing-message:empty { display: none; }

.billing-confirm {
  width: min(100% - 32px, 420px);
  padding: 22px;
  border: 1px solid #3b3b3b;
  border-radius: 16px;
  background: #111;
  color: #f5f5f5;
}
.billing-confirm::backdrop { background: #000000b3; backdrop-filter: blur(2px); }
.billing-confirm h2 { margin: 0 0 8px; font: 800 20px/1.25 Onest, Inter, sans-serif; }
.billing-confirm p { margin: 0 0 18px; color: #c3c3c3; line-height: 1.55; }

@media (max-width: 600px) {
  .billing-main { width: min(100% - 24px, 560px); margin-top: 18px; gap: 16px; }
  .billing-head { gap: 12px; }
  .billing-back { flex-basis: 44px; width: 44px; height: 44px; }
  .billing-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .billing-page * { transition: none !important; }
}
