/* Billing pages. Brand colors are the public site primary and accent.
   Layout reuses site.css; this file only adds the account screen. */

.billing-page [hidden] {
  display: none !important;
}

.billing-page {
  --navy: #022741;
  --teal: #00aeac;
  --teal-deep: #008c8a;
}

.billing-main {
  width: min(40rem, calc(100% - 2rem));
  margin: 1.25rem auto 2.5rem;
  display: grid;
  gap: 1rem;
}

.billing-card,
.status-block,
.sign-in,
.session-strip {
  background: var(--surface);
  border: 1px solid rgb(2 39 65 / 12%);
  border-radius: 16px;
  padding: 1rem;
}

html[data-theme="dark"] .billing-card,
html[data-theme="dark"] .status-block,
html[data-theme="dark"] .sign-in,
html[data-theme="dark"] .session-strip {
  border-color: var(--panel-border);
}

.billing-card h1,
.sign-in h2,
.manage-block h2 {
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-size: 1.35rem;
}

.lead {
  margin: 0;
  color: var(--muted);
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgb(2 39 65 / 18%);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

html[data-theme="dark"] .field input {
  border-color: var(--panel-border);
}

.sign-in,
.field,
.provider-row,
.plan-grid,
.manage-block {
  display: grid;
  gap: 0.75rem;
}

.field {
  font-weight: 600;
  color: var(--ink);
}

.provider-row .btn,
#login-btn,
#portal,
#link,
#logout {
  width: 100%;
}

.session-strip {
  display: grid;
  gap: 0.75rem;
}

.session-line {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

.plan-line {
  margin: 0;
  color: var(--ink);
}

.status-block {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}

.status-block.is-live {
  border-color: #00aeac;
  background: rgb(0 174 172 / 10%);
}

.plan-grid {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  height: 100%;
  min-height: 44px;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid rgb(2 39 65 / 16%);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

html[data-theme="dark"] .plan-card {
  border-color: var(--panel-border);
}

.plan-card .plan-price {
  font-size: 1.15rem;
  font-weight: 700;
}

.plan-card:hover,
.plan-card:focus-visible {
  border-color: #00aeac;
  outline: 2px solid #00aeac;
  outline-offset: 2px;
}

.notice {
  margin: 0;
}

#back .btn {
  width: 100%;
}

@media (min-width: 40rem) {
  .plan-grid {
    grid-template-columns: 1fr 1fr;
  }
}


.notice.is-success {
  border: 1px solid #00aeac;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: rgb(0 174 172 / 12%);
  color: var(--ink);
  font-weight: 600;
}

.notice.is-wait,
.notice.is-pending {
  border: 1px solid rgb(2 39 65 / 16%);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] .notice.is-wait,
html[data-theme="dark"] .notice.is-pending {
  border-color: var(--panel-border);
}

.return-wait {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 0.5rem;
}

.spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid rgb(0 174 172 / 25%);
  border-top-color: #00aeac;
  border-radius: 50%;
  animation: billing-spin 0.8s linear infinite;
}

@keyframes billing-spin {
  to { transform: rotate(360deg); }
}


.plans-h {
  margin: 0;
  color: var(--ink);
  font-size: 1.15rem;
}

.plan-card .btn {
  width: 100%;
  margin-top: auto;
  padding-top: 0.75rem;
}

.plan-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgb(0 174 172 / 16%);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
}

#upgrade-p .btn {
  width: 100%;
}


.pay-how {
  border: 1px solid rgb(2 39 65 / 14%);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  color: var(--ink);
}

html[data-theme="dark"] .pay-how {
  border-color: var(--panel-border);
}

.pay-how summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.pay-how summary::-webkit-details-marker { display: none; }

.pay-how[open] summary {
  margin-bottom: 0.45rem;
}

.pay-how p {
  margin: 0;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.45;
}

/* Cloudflare Turnstile: same vertical rhythm as other login fields */
#billing-turnstile {
  margin: 0.85rem 0;
  display: block;
}
#billing-turnstile:not([hidden]) {
  margin-top: 0.85rem;
  margin-bottom: 0.85rem;
}
#billing-login #billing-turnstile,
.sign-in #billing-turnstile {
  margin-block: 0.9rem;
}

/* +48 r48c: same login order as the app: quick buttons, divider, email,
   then 'Forgot password · Email me a sign-in link · Create account'. */
.or-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.25rem 0;
  color: var(--muted, #5b6b7a);
  font-size: 0.9rem;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--panel-border);
}
.or-divider[hidden] {
  display: none;
}
.signin-links {
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.92rem;
}
.signin-links a {
  color: var(--teal-deep, #007a78);
  font-weight: 600;
  text-decoration: none;
}
.signin-links a:hover,
.signin-links a:focus-visible {
  text-decoration: underline;
}
.signin-links [hidden] {
  display: none;
}
.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.session-actions .btn {
  flex: 1 1 10rem;
}
.session-actions #logout {
  width: auto;
}


/* Login provider marks: same trio as the app (fingerprint, Apple, Google G). */
.provider-row .provider-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}
.provider-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}
.provider-icon--passkey {
  color: var(--teal, #00aeac);
}
.provider-icon--apple {
  color: var(--ink);
}

/* Country select: same field chrome as billing inputs, custom chevron like /import. */
.startnow-country label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--ink);
}
#buyer-country {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 2.75rem 0.55rem 0.75rem;
  border: 1px solid rgb(2 39 65 / 18%);
  border-radius: 12px;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.35rem) calc(50% - 0.15rem),
    calc(100% - 0.95rem) calc(50% - 0.15rem);
  background-size: 0.4rem 0.4rem, 0.4rem 0.4rem;
  background-repeat: no-repeat;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
html[data-theme="dark"] #buyer-country {
  border-color: var(--panel-border);
}
#buyer-country:hover {
  border-color: color-mix(in srgb, var(--teal, #00aeac) 45%, var(--muted));
}
#buyer-country:focus-visible {
  outline: none;
  border-color: var(--teal, #00aeac);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal, #00aeac) 28%, transparent);
}

/* Withdrawal start-now box: slightly larger, aligned to the first line of the label. */
.startnow > p:first-child label,
#order-a-p label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}
.startnow input[type="checkbox"],
#order-a-p input[type="checkbox"] {
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.15rem 0 0;
  flex: none;
  accent-color: var(--teal, #00aeac);
  border-radius: 4px;
  cursor: pointer;
}


/* Year-end choice: space between buttons, selected + busy state, visible feedback. */
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0.75rem 0;
}
.choice-row .btn {
  margin: 0;
}
.choice-row .btn[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--navy, #0b1c2c);
  outline: 2px solid var(--teal, #14b8a6);
  outline-offset: 2px;
  cursor: default;
}
html[data-theme="dark"] .choice-row .btn[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--ink, #e8f1f8);
}
.choice-row .btn[aria-busy="true"],
.choice-row .btn:disabled {
  cursor: progress;
}
.choice-row .btn[aria-pressed="true"]:disabled {
  cursor: default;
  opacity: 1;
}
.choice-row .btn.is-busy {
  position: relative;
  padding-right: 2.25rem;
}
.choice-row .btn.is-busy::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  width: 0.9rem;
  height: 0.9rem;
  margin-top: -0.45rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: choice-spin 0.7s linear infinite;
}
@keyframes choice-spin {
  to { transform: rotate(360deg); }
}
.choice-msg {
  min-height: 1.4em;
  margin: 0.4rem 0 0;
  font-weight: 600;
}
.return-auto {
  margin: 0.6rem 0 0;
  font-weight: 600;
}
.return-timeout {
  margin: 0.75rem 0 0;
}
.return-timeout a {
  display: inline-block;
  margin-top: 0.4rem;
}
