/*
 * subscription_agentic.css
 * Styles for /subscription_agentic (subscription_agentic.mak)
 *
 * Self-contained — does not depend on, override, or extend
 * subscription_stripe.css. To unwind, simply remove this file
 * and the template. The legacy /subscription_tiered page is
 * untouched.
 */

/* ============================================================
   Tokens
   ============================================================ */
.sa-page {
  --sa-bg: #e9edf3;
  --sa-surface: #ffffff;
  --sa-border: #cbd5e1;
  --sa-border-strong: #94a3b8;
  --sa-text: #0f172a;
  --sa-text-muted: #475569;
  --sa-text-faint: #64748b;
  --sa-accent: #4d9dff;
  --sa-accent-2: #22d3ee;
  --sa-accent-deep: #2563eb;
  --sa-success: #059669;
  --sa-success-soft: #ecfdf5;
  --sa-warning-soft: #fff7ed;
  --sa-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --sa-shadow: 0 4px 16px rgba(15, 23, 42, 0.10);
  --sa-shadow-lg: 0 12px 36px rgba(15, 23, 42, 0.12);
  --sa-radius: 12px;
  --sa-radius-lg: 16px;

  background-color: var(--sa-bg);
  color: var(--sa-text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang TC", "Microsoft YaHei", sans-serif;
  padding: 32px 0 80px;
  min-height: 100vh;
  /* Floor the page width so iPhone viewports (375px) trigger horizontal
     scroll on the body instead of squashing the checkout form layout.
     Below ~600px the .sa-grid two-column → one-column collapse plus the
     fixed-width payment-form inputs caused field overlap. */
  min-width: 600px;
}

.sa-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================================
   Header
   ============================================================ */
.sa-header {
  text-align: center;
  margin-bottom: 36px;
}
.sa-header__eyebrow {
  margin-bottom: 12px;
}
.sa-header__badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(77, 157, 255, 0.12), rgba(34, 211, 238, 0.12));
  color: var(--sa-accent-deep);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(77, 157, 255, 0.2);
}
.sa-header__title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.sa-brand {
  color: #4d9dff;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Hide the single mounted plan radio — its only job is to satisfy
   the shared subscription_stripe JS contract (input[name=subscription_plan]).
   Plan + cycle are chosen upstream on /price_plan_agentic. */
.sa-plan-radio-mount { display: none; }
.sa-header__subtitle {
  color: var(--sa-text-muted);
  font-size: 15px;
  margin: 0;
}

/* ============================================================
   Two-column grid
   ============================================================ */
.sa-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: start;
}

/* ============================================================
   Card / section
   ============================================================ */
.sa-section {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-lg);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--sa-shadow-sm);
}
.sa-section__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.sa-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sa-accent), var(--sa-accent-2));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.sa-section__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  flex-grow: 1;
}
.sa-stripe-badge {
  font-size: 12px;
  color: var(--sa-text-muted);
}
.sa-stripe-badge a { color: var(--sa-accent-deep); }
.sa-lock { margin-right: 2px; }

/* ============================================================
   Tier switcher
   ============================================================ */
.sa-tier-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 14px;
  margin-bottom: 16px;
}
.sa-tier-tab {
  border: none;
  background: transparent;
  padding: 14px 16px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 160ms ease;
  color: var(--sa-text-muted);
}
.sa-tier-tab:hover { background: rgba(255, 255, 255, 0.6); }
.sa-tier-tab.is-active {
  background: var(--sa-surface);
  box-shadow: var(--sa-shadow);
  color: var(--sa-text);
}
.sa-tier-tab__name {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.sa-tier-tab__sub {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  color: var(--sa-text-faint);
}
.sa-tier-tab.is-active .sa-tier-tab__sub { color: var(--sa-text-muted); }
.sa-tier-tab__ai {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sa-accent), var(--sa-accent-2));
  color: #fff;
  vertical-align: 2px;
}
.sa-tier-bullets {
  margin-top: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 13px;
  color: var(--sa-text-muted);
}
.sa-tier-bullets ul {
  margin: 0;
  padding-left: 18px;
}
.sa-tier-bullets li { margin: 4px 0; }

/* ============================================================
   Plan cards (billing cycle)
   ============================================================ */
.sa-plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sa-plan-card {
  position: relative;
  display: block;
  border: 1.5px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 18px 18px 16px;
  cursor: pointer;
  transition: all 160ms ease;
  background: var(--sa-surface);
  margin: 0;
}
.sa-plan-card:hover {
  border-color: var(--sa-accent);
  transform: translateY(-1px);
}
.sa-plan-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.sa-plan-card__check {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--sa-border-strong);
  background: transparent;
  transition: all 160ms ease;
}
.sa-plan-card input[type="radio"]:checked ~ .sa-plan-card__check {
  background: var(--sa-accent);
  border-color: var(--sa-accent);
  box-shadow: inset 0 0 0 4px #fff;
}
.sa-plan-card input[type="radio"]:checked + .sa-plan-card__badge,
.sa-plan-card input[type="radio"]:checked ~ .sa-plan-card__body {
  /* checked state styles applied via parent below */
}
.sa-plan-card:has(input[type="radio"]:checked) {
  border-color: var(--sa-accent);
  box-shadow: 0 0 0 3px rgba(77, 157, 255, 0.15);
}
.sa-plan-card--featured {
  border-color: rgba(77, 157, 255, 0.4);
  background: linear-gradient(180deg, rgba(77, 157, 255, 0.04), rgba(34, 211, 238, 0.04));
}
.sa-plan-card__badge {
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--sa-success);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.sa-plan-card__body { padding-right: 28px; }
.sa-plan-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sa-text-muted);
  margin-bottom: 6px;
}
.sa-plan-card__price {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.sa-plan-card__amount {
  font-size: 26px;
  font-weight: 700;
  color: var(--sa-text);
  letter-spacing: -0.02em;
}
.sa-plan-card__period {
  font-size: 13px;
  color: var(--sa-text-muted);
}
.sa-plan-card__eq {
  font-size: 13px;
  color: var(--sa-text-muted);
  margin-top: 4px;
}
.sa-plan-card__perk {
  font-size: 12px;
  color: var(--sa-success);
  font-weight: 600;
  margin-top: 8px;
}
.sa-plan-card:not(.sa-plan-card--featured) .sa-plan-card__perk {
  color: var(--sa-text-muted);
  font-weight: 500;
}

/* "已有帳戶？登入" link — rendered inside Step 1's section header,
   right-aligned via the flex layout that already pushes the title to
   the left. Only present for anonymous visitors. */
.sa-section__login-link {
  font-size: 12px;
  color: var(--sa-accent-deep);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.sa-section__login-link:hover { text-decoration: underline; }

/* ============================================================
   Form fields
   ============================================================ */
.sa-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 4px;
}
.sa-form-row + .sa-form-row { margin-top: 18px; }
.sa-form-field {
  flex: 1 1 180px;
  min-width: 0;
}
.sa-form-field--grow { flex: 2 1 260px; }
.sa-form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--sa-text-muted);
  margin-bottom: 6px;
}
.sa-form-field__hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--sa-text-faint);
  margin-left: 4px;
}
.sa-form-field .form-control {
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--sa-border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--sa-surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  box-shadow: none;
}
.sa-form-field .form-control:focus {
  border-color: var(--sa-accent);
  box-shadow: 0 0 0 3px rgba(77, 157, 255, 0.15);
  outline: none;
}
/* Dimmer placeholder text so users don't mistake it for a filled value.
   Each vendor pseudo must be in its own rule block — a single unknown
   selector in a comma list invalidates the entire declaration. */
.sa-page .form-control::placeholder {
  color: #cbd5e1 !important;
  opacity: 1;
  font-weight: 400;
}
.sa-page .form-control::-webkit-input-placeholder {
  color: #cbd5e1 !important;
  opacity: 1;
  font-weight: 400;
}
.sa-page .form-control::-moz-placeholder {
  color: #cbd5e1 !important;
  opacity: 1;
  font-weight: 400;
}
.sa-page .form-control:-ms-input-placeholder {
  color: #cbd5e1 !important;
  font-weight: 400;
}
.sa-page .form-control:-moz-placeholder {
  color: #cbd5e1 !important;
  opacity: 1;
  font-weight: 400;
}
/* jQuery validate inline errors */
.sa-form-field label.error {
  display: block !important;
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
  font-weight: 400;
}
.subscription-error {
  color: #dc2626;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 0;
}
.subscription-error:empty { margin-bottom: 0; }

/* ============================================================
   Payment section
   ============================================================ */
.sa-section--payment { padding-bottom: 28px; }
.sa-card-field {
  margin-top: 8px;
  margin-bottom: 14px;
}
#card-element.MyCardElement {
  padding: 11px 14px;
  border: 1px solid var(--sa-border);
  border-radius: 8px;
  background: var(--sa-surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
#card-element.StripeElement--focus {
  border-color: var(--sa-accent);
  box-shadow: 0 0 0 3px rgba(77, 157, 255, 0.15);
}
#card-element.StripeElement--invalid { border-color: #dc2626; }
#card-errors {
  color: #dc2626;
  font-size: 13px;
  margin-top: 3px;
  min-height: 0;
}

/* Trust band — inline-SVG card-brand tiles */
.sa-trust-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 20px;
  font-size: 12px;
  color: var(--sa-text-muted);
}
.sa-trust-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 28px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--sa-border);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
}
.sa-trust-card svg {
  display: block;
  width: 100%;
  height: 100%;
}
.sa-trust-card--amex {
  background: #2e77bb;
  border-color: #235e95;
}
.sa-trust-text { margin-left: 6px; font-size: 11px; }

/* Coupon — click-to-reveal */
.sa-coupon-block { margin-bottom: 18px; }
.sa-coupon-toggle {
  display: inline-block;
  font-size: 13px;
  color: var(--sa-accent-deep);
  cursor: pointer;
  text-decoration: none;
}
.sa-coupon-toggle:hover { text-decoration: underline; }
.sa-coupon-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  max-width: 340px;
}
/* HTML [hidden] would default to display:none but the .sa-coupon-row
   rule above wins on specificity tie. Re-assert hidden state. */
.sa-coupon-row[hidden] { display: none; }
.sa-coupon-row .form-control {
  height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--sa-border);
  border-radius: 8px;
  font-size: 14px;
  flex: 1;
}
.sa-coupon-apply {
  padding: 8px 18px;
  border: 1px solid var(--sa-accent);
  color: var(--sa-accent-deep);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(77, 157, 255, 0.06);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.sa-coupon-apply:hover {
  background: var(--sa-accent);
  color: #fff;
}

/* TOS */
.sa-tos {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
  font-size: 13px;
  color: var(--sa-text-muted);
  line-height: 1.5;
  font-weight: 400;
}
.sa-tos input[type="checkbox"] {
  margin-top: 4px;
  flex-shrink: 0;
}
.sa-tos a {
  color: var(--sa-accent-deep);
  text-decoration: none;
}
.sa-tos a:hover { text-decoration: underline; }
.sa-tos__en {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--sa-text-faint);
}

/* CTA */
.sa-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sa-accent-deep) 0%, var(--sa-accent) 50%, var(--sa-accent-2) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 6px 20px rgba(77, 157, 255, 0.3);
  gap: 10px;
}
.sa-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(77, 157, 255, 0.4);
}
.sa-cta-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}
.sa-cta-btn #payment-check { font-size: 16px; }
.sa-cta-btn #payment-processing-loader {
  display: none;
}
.sa-cta-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  box-sizing: border-box;
  animation: sa-cta-spin 0.7s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes sa-cta-spin {
  to { transform: rotate(360deg); }
}
.sa-cta-btn__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.sa-cta-btn__label {
  font-size: 16px;
  font-weight: 600;
}
.sa-cta-btn__price {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
  font-weight: 500;
}

.sa-cta-reassure {
  text-align: center;
  font-size: 12px;
  color: var(--sa-text-muted);
  margin-top: 14px;
  line-height: 1.6;
}
.sa-troubleshoot {
  text-align: center;
  font-size: 12px;
  color: var(--sa-text-faint);
  margin-top: 16px;
}
.sa-troubleshoot a { color: var(--sa-accent-deep); }

/* ============================================================
   Right column: summary + guarantee + testimonial
   ============================================================ */
.sa-aside { position: sticky; top: 24px; }

.sa-summary {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-lg);
  padding: 20px 22px 22px;
  box-shadow: var(--sa-shadow);
  margin-bottom: 16px;
}
.sa-summary__head {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sa-text-faint);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sa-border);
  margin-bottom: 16px;
}
.sa-summary__product {
  font-size: 14px;
  font-weight: 600;
  color: var(--sa-text);
  margin-bottom: 14px;
  line-height: 1.4;
}
.sa-summary__coupon-msg {
  display: inline-block;
  padding: 2px 9px;
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  margin-top: 6px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.sa-summary__coupon-msg:empty { display: none; }

/* Discreet change-plan link under the product name. */
.sa-summary__change-plan {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--sa-text-faint);
  text-decoration: none;
  font-weight: 400;
}
.sa-summary__change-plan:hover {
  color: var(--sa-accent-deep);
  text-decoration: underline;
}

/* Price-lock callout — legitimate urgency from real 6/1 price hike. */
.sa-summary__lock-note {
  margin: 14px 0 12px;
  padding: 8px 10px 8px 12px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 11px;
  color: #92400e;
  font-weight: 500;
  line-height: 1.5;
}
.sa-summary__lock-note strong { font-weight: 700; }

/* Monthly → yearly upsell card (rendered only on _monthly plans). */
.sa-summary__upsell {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.10) 0%, rgba(245, 158, 11, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.30);
  border-radius: 8px;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 160ms ease;
}
.sa-summary__upsell:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18) 0%, rgba(245, 158, 11, 0.14) 100%);
  border-color: rgba(245, 158, 11, 0.45);
  color: #78350f;
  text-decoration: none;
  transform: translateY(-1px);
}
.sa-summary__upsell-icon { font-size: 14px; line-height: 1; }
.sa-summary__upsell-text { flex: 1; }
.sa-summary__upsell-text strong { font-weight: 700; }
.sa-summary__upsell-arrow {
  font-size: 14px;
  font-weight: 700;
  transition: transform 160ms ease;
}
.sa-summary__upsell:hover .sa-summary__upsell-arrow {
  transform: translateX(2px);
}

.sa-summary__lines {
  padding: 14px 0;
  border-top: 1px dashed var(--sa-border);
  border-bottom: 1px dashed var(--sa-border);
  margin-bottom: 14px;
}
.sa-summary__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--sa-text-muted);
  padding: 4px 0;
}
.sa-summary__line > span:last-child { color: var(--sa-text); font-weight: 500; }
.sa-summary__monthly-value .sa-price-orig {
  color: var(--sa-text-faint);
  text-decoration: line-through;
  font-weight: 500;
  margin-right: 6px;
  font-size: 12px;
}
.sa-summary__monthly-value .sa-price-new {
  color: var(--sa-text);
  font-weight: 600;
}
.sa-summary__line--saving {
  color: var(--sa-success);
}
.sa-summary__line--saving span:last-child {
  color: var(--sa-success);
  font-weight: 600;
}

.sa-summary__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  gap: 10px;
}
.sa-summary__total > span:first-child {
  font-size: 14px;
  font-weight: 600;
  color: var(--sa-text);
  flex-shrink: 0;
}
.sa-summary__total-value {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sa-summary__total-value .sa-price-orig {
  font-size: 15px;
  font-weight: 500;
  color: var(--sa-text-faint);
  text-decoration: line-through;
}
.sa-summary__total-value .sa-price-new {
  font-size: 22px;
  font-weight: 700;
  color: var(--sa-text);
  letter-spacing: -0.01em;
}
.sa-summary__footnote {
  font-size: 11px;
  color: var(--sa-text-faint);
  line-height: 1.5;
}

/* Guarantee card */
.sa-guarantee {
  background: var(--sa-success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--sa-radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.sa-guarantee__head {
  font-size: 13px;
  font-weight: 600;
  color: #047857;
  margin-bottom: 8px;
}
.sa-guarantee ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: #065f46;
  line-height: 1.7;
}
.sa-guarantee li::before {
  content: "·";
  margin-right: 6px;
  font-weight: 700;
}

/* Testimonial */
.sa-testimonial {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 16px 18px;
  box-shadow: var(--sa-shadow-sm);
}
.sa-testimonial__quote {
  font-size: 13px;
  line-height: 1.6;
  color: var(--sa-text);
  font-style: italic;
}
.sa-testimonial__mark {
  color: var(--sa-accent);
  font-size: 18px;
  font-weight: 700;
  margin: 0 2px;
}
.sa-testimonial__cite {
  margin-top: 8px;
  font-size: 11px;
  color: var(--sa-text-faint);
  font-style: normal;
}

/* ============================================================
   訂購成功 modal (rebuilt — celebration moment, not a system notice)
   ============================================================ */
.sa-success-modal__dialog {
  margin: 50px auto;
  max-width: 520px;
}
.sa-success-modal__content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.32);
  overflow: hidden;
  background: #ffffff;
}
.sa-success-modal__header {
  border-bottom: none;
  padding: 14px 18px 0;
  min-height: 28px;
}
.sa-success-modal__header .close {
  font-size: 24px;
  font-weight: 400;
  opacity: 0.45;
  margin-top: 0;
  line-height: 1;
}
.sa-success-modal__header .close:hover { opacity: 1; }

.sa-success-modal__body {
  padding: 4px 36px 24px;
  text-align: center;
}
.sa-success-modal__check {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  animation: sa-success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.sa-success-modal__check svg { width: 100%; height: 100%; display: block; }
@keyframes sa-success-pop {
  0%   { transform: scale(0.55); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sa-success-modal__title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.sa-success-modal__subtitle {
  font-size: 14px;
  color: #475569;
  margin: 0 0 22px;
  line-height: 1.5;
}
.sa-success-modal__subtitle strong {
  color: #2563eb;
  font-weight: 600;
}

.sa-success-modal__unlocked {
  text-align: left;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px 12px;
  margin-bottom: 16px;
}
.sa-success-modal__unlocked-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 8px;
}
.sa-success-modal__unlocked-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: #1e293b;
}
.sa-success-modal__unlocked-list li {
  position: relative;
  padding: 4px 0 4px 22px;
}
.sa-success-modal__unlocked-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 4px;
  color: #059669;
  font-weight: 700;
  font-size: 13px;
}

.sa-success-modal__receipt {
  font-size: 12px;
  color: #64748b;
  text-align: center;
}

.sa-success-modal__footer {
  border-top: none;
  padding: 0 36px 28px;
  text-align: center;
  display: block;
}
.sa-success-modal__cta {
  display: block;
  width: 100%;
  padding: 14px 22px;
  background: linear-gradient(135deg, #2563eb 0%, #4d9dff 50%, #22d3ee 100%);
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(77, 157, 255, 0.32);
  transition: transform 160ms ease, box-shadow 160ms ease;
  margin-bottom: 12px;
}
.sa-success-modal__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(77, 157, 255, 0.42);
  text-decoration: none;
  color: #fff !important;
}
.sa-success-modal__cta-arrow {
  display: inline-block;
  transition: transform 160ms ease;
  margin-left: 2px;
}
.sa-success-modal__cta:hover .sa-success-modal__cta-arrow { transform: translateX(3px); }

.sa-success-modal__cta-secondary {
  display: inline-block;
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
}
.sa-success-modal__cta-secondary:hover {
  color: #2563eb;
  text-decoration: underline;
}

.sa-success-modal__founder-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.6;
}
.sa-success-modal__founder-note strong {
  font-weight: 600;
  color: #475569;
}
.sa-success-modal__founder-note a {
  color: #94a3b8;
  text-decoration: underline;
}
.sa-success-modal__founder-note a:hover { color: #2563eb; }

@media (max-width: 560px) {
  .sa-success-modal__dialog {
    margin: 20px auto;
    max-width: calc(100% - 24px);
  }
  .sa-success-modal__body { padding: 4px 22px 20px; }
  .sa-success-modal__footer { padding: 0 22px 22px; }
  .sa-success-modal__title { font-size: 22px; }
  .sa-success-modal__check { width: 60px; height: 60px; }
}

/* ============================================================
   訂購未能完成 modal (rebuilt — mirrors success modal structure,
   amber/warning theme on the icon + error box, blue gradient on
   the primary CTA since the action is positive: retry).
   ============================================================ */
.sa-failure-modal__dialog {
  margin: 50px auto;
  max-width: 520px;
}
.sa-failure-modal__content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.32);
  overflow: hidden;
  background: #ffffff;
}
.sa-failure-modal__header {
  border-bottom: none;
  padding: 14px 18px 0;
  min-height: 28px;
}
.sa-failure-modal__header .close {
  font-size: 24px;
  font-weight: 400;
  opacity: 0.45;
  margin-top: 0;
  line-height: 1;
}
.sa-failure-modal__header .close:hover { opacity: 1; }

.sa-failure-modal__body {
  padding: 4px 36px 24px;
  text-align: center;
}
.sa-failure-modal__icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  animation: sa-failure-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.sa-failure-modal__icon svg { width: 100%; height: 100%; display: block; }
@keyframes sa-failure-pop {
  0%   { transform: scale(0.55); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sa-failure-modal__title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 14px;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.sa-failure-modal__error {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: #92400e;
  line-height: 1.55;
  text-align: left;
  margin: 0 auto 14px;
  font-weight: 500;
}
.sa-failure-modal__error:empty { display: none; }

.sa-failure-modal__reassure {
  font-size: 12px;
  color: #475569;
  font-weight: 500;
}

.sa-failure-modal__footer {
  border-top: none;
  padding: 0 36px 28px;
  text-align: center;
  display: block;
}
.sa-failure-modal__cta {
  display: block;
  width: 100%;
  padding: 14px 22px;
  border: none;
  background: linear-gradient(135deg, #2563eb 0%, #4d9dff 50%, #22d3ee 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(77, 157, 255, 0.32);
  transition: transform 160ms ease, box-shadow 160ms ease;
  margin-bottom: 12px;
}
.sa-failure-modal__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(77, 157, 255, 0.42);
  color: #fff;
}
.sa-failure-modal__cta-secondary {
  display: inline-block;
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
}
.sa-failure-modal__cta-secondary:hover {
  color: #2563eb;
  text-decoration: underline;
}
.sa-failure-modal__support-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.6;
}
.sa-failure-modal__support-note a {
  color: #94a3b8;
  text-decoration: underline;
}
.sa-failure-modal__support-note a:hover { color: #2563eb; }

@media (max-width: 560px) {
  .sa-failure-modal__dialog {
    margin: 20px auto;
    max-width: calc(100% - 24px);
  }
  .sa-failure-modal__body { padding: 4px 22px 20px; }
  .sa-failure-modal__footer { padding: 0 22px 22px; }
  .sa-failure-modal__title { font-size: 21px; }
  .sa-failure-modal__icon { width: 60px; height: 60px; }
}

/* ============================================================
   Mobile sticky CTA bar (visible only on mobile)
   ============================================================ */
.sa-mobile-cta { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .sa-grid {
    grid-template-columns: 1fr;
  }
  .sa-aside {
    position: static;
  }
  .sa-page { padding: 24px 0 60px; }
  .sa-header__title { font-size: 26px; }
}

@media (max-width: 768px) {
  /* Mobile-only sticky CTA bar at the bottom of the viewport. */
  .sa-mobile-cta {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid var(--sa-border);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.10);
  }
  .sa-mobile-cta__price {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
  }
  .sa-mobile-cta__price-label {
    font-size: 11px;
    color: var(--sa-text-muted);
    font-weight: 500;
  }
  .sa-mobile-cta__price-amount {
    font-size: 18px;
    color: var(--sa-text);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 2px;
  }
  .sa-mobile-cta__btn {
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--sa-accent-deep) 0%, var(--sa-accent) 50%, var(--sa-accent-2) 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(77, 157, 255, 0.30);
  }
  /* Pad the page so the fixed bar doesn't cover the bottom content. */
  .sa-page { padding-bottom: 90px; }
}

@media (max-width: 560px) {
  .sa-container { padding: 0 16px; }
  .sa-section { padding: 18px 18px; }
  /* NOTE: form-row column-stack + plan-grid/tier-switcher single-column
     collapses were dropped — `.sa-page { min-width: 600px }` forces the
     page to render ≥600px wide on phones (user horizontally scrolls),
     so there's room to keep paired fields side-by-side. Media queries
     fire on viewport width regardless, so without dropping these the
     iPhone viewport (~375px) was still stacking fields and creating a
     visible vertical gap between rows. */
  .sa-cta-btn { padding: 14px 18px; }
  .sa-header__title { font-size: 22px; }
  /* Bump form inputs to 16px so iOS Safari doesn't auto-zoom on focus. */
  .sa-form-field .form-control,
  .sa-coupon-row .form-control {
    font-size: 16px;
    height: 46px;
  }
}
