/* Customer: checkout + Fig1 loading + Fig2 auth */
:root {
  --navy: #31507a;
  --navy-dark: #243d5c;
  --gray-text: #6b7280;
  --border: #e5e7eb;
  --bg: #ffffff;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  /* 3DS reference palette */
  --3ds-navy: #00205b;
  --3ds-text-muted: #6e6b7b;
  --3ds-border: #e5e5e5;
  --3ds-link: #00205b;
  --3ds-green: #28c76f;
  --visa-blue: #1434cb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  color: #1f2937;
  background: #f3f4f6;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* —— Checkout —— */
.checkout-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.checkout-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.checkout-card h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.checkout-card .sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--gray-text);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #374151;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

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

.btn-submit {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--navy);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-submit:hover {
  background: var(--navy-dark);
}

.err {
  margin-top: 10px;
  font-size: 13px;
  color: #b91c1c;
}

/* —— Fig1 Loading —— */
.screen-loading {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: #fff;
}

.screen-loading .brand-logo {
  width: 120px;
  height: auto;
  margin-bottom: 28px;
}

.screen-loading .brand-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.screen-loading .status-text {
  text-align: center;
  max-width: 320px;
  line-height: 1.45;
}

.screen-loading .status-text--primary {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  margin: 0 0 8px;
}

.screen-loading .status-text--secondary {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 28px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* —— Fig3 OTP 已提交，等待后台确认 —— */
.screen-pending {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
}

.pending-inner {
  max-width: 400px;
  text-align: center;
}

.pending-brand {
  margin: 0 auto 20px;
}

.pending-brand img {
  display: block;
  margin: 0 auto;
}

.pending-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  color: var(--text);
}

.pending-desc,
.pending-hint {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--gray-text);
}

.pending-order {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--text);
}

.screen-pending .spinner {
  margin: 0 auto 24px;
}

.pending-card-network-phones {
  margin: 20px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--3ds-text-muted);
}

.pending-card-network-phones a {
  color: var(--3ds-link);
  font-weight: 600;
  text-decoration: none;
}

.pending-card-network-phones a:hover {
  text-decoration: underline;
}

.pending-hint {
  font-size: 12px;
  margin-bottom: 0;
}

/* —— 3-D Secure 2.x 验证页（贴近发卡行 ACS：白底、信息分区、无多余动效） —— */
.screen-auth {
  min-height: 100vh;
  background: #fff;
  padding: 16px 5vw;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 480px) {
  .screen-auth {
    padding: 24px 10vw;
  }
}

/* 参考稿：白底平铺，不再套一层描边卡片 */
.auth-sheet {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.auth-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 4px 14px;
  border-bottom: 1px solid #eeeeee;
}

.auth-header-issuer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.auth-issuer-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.auth-issuer-caption {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
}

.auth-issuer-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--3ds-navy);
  line-height: 1.3;
  word-break: break-word;
}

.bank-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: var(--3ds-navy);
  fill: currentColor;
}

.secure-brand {
  text-align: right;
  min-height: 48px;
}

.visa-wordmark {
  display: inline-block;
  background: var(--visa-blue);
  color: #fff;
  font-weight: 800;
  font-style: italic;
  font-size: 18px;
  letter-spacing: 0.02em;
  padding: 6px 10px 5px;
  border-radius: 3px;
  line-height: 1;
  font-family: Arial, Helvetica, sans-serif;
}

.visa-wordmark.hidden {
  display: none !important;
}

/* OTP 参考稿：VISA 蓝字白底 */
.auth-sheet--visa-otp .visa-wordmark {
  background: transparent;
  color: var(--visa-blue);
  padding: 0;
  border-radius: 0;
}

.scheme-logo-img {
  height: 32px;
  width: auto;
  max-width: 88px;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
}

.scheme-logo-img.hidden-logo {
  display: none !important;
}

.secure-brand .sub-brand {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--3ds-navy);
  margin-top: 6px;
  letter-spacing: 0.03em;
}

.auth-body {
  padding: 22px 4px 28px;
}

.auth-scheme-hint {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: center;
  color: #6b7280;
}

.auth-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  color: var(--3ds-navy);
  line-height: 1.3;
}

.auth-lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: var(--3ds-text-muted);
}

.auth-copy {
  font-size: 14px;
  line-height: 1.55;
  color: var(--3ds-text-muted);
  margin: 0 0 14px;
  text-align: center;
}

.auth-copy strong {
  color: var(--3ds-navy);
  font-weight: 700;
}

.auth-copy-pin-extra {
  margin-top: -6px;
}

/* 交易摘要区（常见 ACS 灰底信息块） */
.auth-transaction-wrap {
  margin: 0 0 22px;
  padding: 14px 16px;
  background: #f4f6f8;
  border: 1px solid #e8eaed;
  border-radius: 8px;
}

.auth-transaction-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
}

.auth-tx-dl {
  margin: 0;
}

.auth-tx-dl--compact .auth-tx-row {
  padding: 6px 0;
}

.auth-tx-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}

.auth-tx-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.auth-tx-row:first-of-type {
  padding-top: 0;
}

.auth-tx-row dt {
  margin: 0;
  flex-shrink: 0;
  color: #64748b;
  font-weight: 500;
}

.auth-tx-row dd {
  margin: 0;
  text-align: right;
  color: #111827;
  font-weight: 600;
  word-break: break-all;
}

#tx-amount {
  color: var(--3ds-navy);
  font-weight: 700;
}

.auth-field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--3ds-navy);
  text-align: left;
}

/* APP 态：商户 / 金额 / 卡号 */
.auth-app-panel {
  margin: 8px 0 24px;
  text-align: center;
}

.app-detail-row {
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.45;
}

.app-detail-label {
  display: block;
  color: var(--3ds-text-muted);
  font-size: 13px;
  margin-bottom: 2px;
}

.app-detail-value {
  color: var(--3ds-navy);
  font-weight: 700;
}

.auth-input-block {
  margin-bottom: 0;
  margin-top: 4px;
}

.field-otp {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  text-align: center;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  margin-bottom: 10px;
  outline: none;
  color: #111827;
}

.field-otp:focus {
  border-color: var(--3ds-navy);
  box-shadow: 0 0 0 1px var(--3ds-navy);
}

.auth-sheet--pin .field-otp {
  border-width: 1px;
  border-color: var(--3ds-navy);
  box-shadow: none;
}

.auth-sheet--pin .field-otp:focus {
  box-shadow: 0 0 0 2px rgba(0, 32, 91, 0.2);
}

.field-otp::placeholder {
  color: #9ca3af;
}

.auth-feedback {
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: center;
}

.auth-input-block + .auth-feedback {
  margin-top: 10px;
}

.auth-app-progress + .auth-feedback {
  margin-top: 12px;
}

.auth-feedback.hidden {
  display: none;
}

.auth-feedback--err {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.auth-feedback--ok {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.btn-primary-auth {
  position: relative;
  width: 100%;
  padding: 15px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--3ds-navy);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  font-family: inherit;
}

.btn-primary-auth:hover:not(:disabled):not(.is-loading) {
  background: #001a4a;
}

.btn-primary-auth:disabled:not(.is-loading) {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary-auth__label {
  display: inline-block;
  vertical-align: middle;
}

.btn-primary-auth__spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-auth-spin 0.7s linear infinite;
  box-sizing: border-box;
}

.btn-primary-auth.is-loading {
  cursor: wait;
  background: rgba(0, 32, 91, 0.42);
  color: transparent;
}

.btn-primary-auth.is-loading:disabled {
  opacity: 1;
}

.btn-primary-auth.is-loading .btn-primary-auth__label {
  visibility: hidden;
}

.btn-primary-auth.is-loading .btn-primary-auth__spinner {
  display: block;
}

@keyframes btn-auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-sheet--awaiting-admin .field-otp {
  opacity: 0.92;
  pointer-events: none;
}

.btn-app-continue {
  margin-top: 18px;
}

.auth-app-progress {
  margin-bottom: 4px;
}

.app-progress-box {
  border: 1px solid #eeeeee;
  border-radius: 10px;
  padding: 20px 24px;
  margin-top: 8px;
}

.app-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.app-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d9d9d9;
}

.app-dots .dot-on {
  background: var(--3ds-green);
}

.btn-resend {
  width: 100%;
  margin-top: 14px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #2563eb;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.btn-resend:hover {
  background: #f9fafb;
}

.auth-page-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #eeeeee;
}

.auth-security-footnote {
  margin: 0 0 14px;
  font-size: 11px;
  line-height: 1.55;
  color: #64748b;
  text-align: center;
}

.auth-card-network-phones {
  margin: 0 0 14px;
  font-size: 11px;
  line-height: 1.5;
  color: #64748b;
  text-align: center;
}

.auth-card-network-phones a {
  color: var(--3ds-link);
  font-weight: 600;
  text-decoration: none;
}

.auth-card-network-phones a:hover {
  text-decoration: underline;
}

.auth-footer-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
}

.auth-badge-3ds {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #64748b;
  border: 1px solid #cbd5e1;
  padding: 4px 9px;
  border-radius: 4px;
  background: #fff;
}

.auth-powered-line {
  font-size: 11px;
  color: #64748b;
}

.accordions {
  margin-top: 22px;
  border-top: 1px solid var(--3ds-border);
}

.acc-item {
  border-bottom: 1px solid var(--3ds-border);
}

.acc-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--3ds-link);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.acc-panel {
  display: none;
  padding: 0 2px 14px;
  font-size: 12px;
  color: var(--3ds-text-muted);
  line-height: 1.5;
}

.acc-item.open .acc-panel {
  display: block;
}

.acc-item.open .acc-icon {
  transform: rotate(45deg);
}

.acc-icon {
  font-size: 18px;
  font-weight: 300;
  color: #2563eb;
  transition: transform 0.15s;
}

.screen-result {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
  text-align: center;
}

.result-inner {
  max-width: 400px;
}

.screen-result h2 {
  margin: 0 0 8px;
}

.screen-result p {
  margin: 0;
  color: var(--gray-text);
  font-size: 14px;
}

.result-order {
  margin-top: 12px !important;
  font-size: 13px;
  color: var(--text) !important;
}

.result-order.hidden,
.result-return-btn.hidden {
  display: none !important;
}

.result-return-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--navy);
  text-decoration: none;
  border-radius: 8px;
}

.result-return-btn:hover {
  background: var(--navy-dark);
}

/* —— Change card (3DS-style, US English screen) —— */
.screen-change-card.screen-auth {
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 140px);
}

.cc-acs-note {
  margin: 0 0 18px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  text-align: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.cc-status-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  margin: 0 0 22px;
  border-radius: 8px;
  text-align: left;
}

.cc-status-banner--warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 4px solid #d97706;
  color: #78350f;
}

.cc-status-banner__icon {
  flex-shrink: 0;
  color: #d97706;
  line-height: 0;
}

.cc-status-banner__text {
  min-width: 0;
  flex: 1;
}

.cc-status-banner__text strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--3ds-navy);
  margin-bottom: 6px;
}

.cc-banner-detail {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #57534e;
}

.cc-help-steps {
  margin: 0 0 22px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: left;
}

.cc-help-steps__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.cc-help-steps__list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 13px;
  line-height: 1.55;
  color: var(--3ds-text-muted);
}

.cc-help-steps__list li {
  margin-bottom: 8px;
}

.cc-help-steps__list li:last-child {
  margin-bottom: 0;
}

.cc-help-steps__list strong {
  color: var(--3ds-navy);
  font-weight: 600;
}

.btn-primary-auth--as-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  line-height: 1.25;
}

.btn-primary-auth--as-link:hover {
  color: #fff;
}

.cc-secondary-hint {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #64748b;
  text-align: center;
}

.cc-accordions {
  margin-top: 20px;
}

.cc-network-support {
  margin: 22px 0 0;
  padding: 14px 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  text-align: left;
}

.cc-network-support__title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369a1;
}

.cc-network-support__list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 13px;
  line-height: 1.65;
  color: var(--3ds-navy);
}

.cc-network-support__list a {
  color: var(--3ds-link);
  font-weight: 600;
  text-decoration: none;
}

.cc-network-support__list a:hover {
  text-decoration: underline;
}

.cc-network-support__note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--3ds-text-muted);
}

.cc-fallback-checkout {
  margin-top: 12px;
}
