/* ═══════════════════════════════════════════════════════
   Billing Module — 套餐与账单支付中心 UI
   ═══════════════════════════════════════════════════════ */

.billing-module {
  padding: 32px 40px 60px;
  max-width: 1280px;
  margin: 0 auto;
  font-family: -apple-system, 'SF Pro Display', 'PingFang SC', sans-serif;
}

/* ── Header ── */
.bm-header { margin-bottom: 32px; }

.bm-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.bm-badge-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--color-primary); }

.bm-title { font-size: 24px; font-weight: 700; color: #0f172a; letter-spacing: -0.03em; margin: 0 0 5px; }
.bm-subtitle { font-size: 14px; color: #64748b; margin: 0; }

/* ── Section ── */
.bm-section { margin-bottom: 24px; }

/* ── Skeleton ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.bm-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

/* ── Current plan overview card ── */
.bm-overview-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.bm-overview-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.bm-plan-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--color-primary), #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.bm-plan-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px;
}

.bm-plan-meta {
  font-size: 12px;
  color: #64748b;
  margin: 0;
}

.bm-overview-stats {
  display: flex;
  gap: 32px;
  flex: 1;
  justify-content: center;
}

.bm-stat { text-align: center; }

.bm-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  display: block;
}

.bm-stat-label {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
  display: block;
}

.bm-overview-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.bm-plan-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.bm-status-active   { background: #dcfce7; color: #166534; }
.bm-status-expired  { background: #fee2e2; color: #991b1b; }
.bm-status-trial    { background: #fef9c3; color: #854d0e; }

.bm-upgrade-btn {
  height: 36px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.bm-upgrade-btn:hover { background: var(--color-primary-hover); }

.bm-manage-btn {
  height: 36px;
  padding: 0 18px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-manage-btn:hover { border-color: #94a3b8; color: #334155; }

/* Skeleton overview */
.bm-ov-skeleton {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ── Pricing section ── */
.bm-pricing-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.bm-pricing-hd {
  padding: 28px 28px 20px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
}

.bm-pricing-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.bm-pricing-sub {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
}

/* Cycle tabs */
.bm-cycle-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
}

.bm-cycle-tab {
  height: 32px;
  padding: 0 16px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.bm-cycle-tab:hover { color: #334155; }

.bm-cycle-tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15,23,42,.08);
}

.bm-cycle-discount {
  font-size: 10px;
  color: #16a34a;
  font-weight: 700;
  margin-left: 4px;
}

/* Plan grid */
.bm-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 24px;
  gap: 12px;
}

@media (max-width: 1024px) { .bm-plan-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .bm-plan-grid { grid-template-columns: 1fr; } }

/* Plan card */
.bm-plan-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  transition: all 0.18s;
  background: #fff;
  cursor: pointer;
}

.bm-plan-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 20px rgba(14,165,233,.08);
  transform: translateY(-2px);
}

.bm-plan-card.is-premium {
  border-color: var(--color-primary);
  background: linear-gradient(160deg, var(--color-primary-light) 0%, #fff 60%);
}

.bm-plan-card.is-current {
  border-color: #e2e8f0;
  background: #fafbfc;
  cursor: default;
  transform: none !important;
  box-shadow: none !important;
}

/* Recommended badge */
.bm-plan-badge {
  position: absolute;
  top: -1px;
  right: 14px;
  padding: 3px 10px;
  border-radius: 0 0 8px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-recommend { background: var(--color-primary); color: #fff; }
.badge-best      { background: #0f172a; color: #fff; }

.bm-plan-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.bm-plan-name-text {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.bm-plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-bottom: 4px;
}

.bm-price-currency { font-size: 16px; font-weight: 700; color: #0f172a; }
.bm-price-amount   { font-size: 32px; font-weight: 800; color: #0f172a; letter-spacing: -0.04em; line-height: 1; }
.bm-plan-card.is-premium .bm-price-amount { color: var(--color-primary); }
.bm-price-period   { font-size: 12px; color: #94a3b8; }

.bm-plan-period-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 16px;
}

.bm-plan-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 14px 0;
}

.bm-plan-credits {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.bm-plan-quota {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 14px;
}

.bm-plan-features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  margin-bottom: 16px;
}

.bm-plan-feature {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11px;
  color: #475569;
  line-height: 1.4;
}

.bm-feature-check {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex; align-items: center; justify-content: center;
  color: #16a34a;
  flex-shrink: 0;
  margin-top: 1px;
}

.bm-plan-card.is-premium .bm-feature-check {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* CTA button */
.bm-plan-cta {
  width: 100%;
  height: 38px;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-top: auto;
}

.cta-current  { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
.cta-basic    { background: #f1f5f9; border: 1.5px solid #e2e8f0; color: #475569; }
.cta-basic:hover { background: #e2e8f0; color: #334155; }
.cta-standard { background: var(--color-primary); color: #fff; }
.cta-standard:hover { background: var(--color-primary-hover); }
.cta-premium  { background: var(--color-primary); color: #fff; }
.cta-premium:hover { background: var(--color-primary-hover); box-shadow: 0 4px 14px rgba(14,165,233,.35); }

/* ── Points section ── */
.bm-points-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.bm-points-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.bm-points-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.bm-points-buy-btn {
  height: 28px;
  padding: 0 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-points-buy-btn:hover { border-color: var(--color-primary); background: var(--color-primary-light); }

.bm-points-body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

@media (max-width: 768px) { .bm-points-body { grid-template-columns: repeat(2, 1fr); } }

.bm-point-stat {
  padding: 16px 20px;
  border-right: 1px solid #f1f5f9;
}
.bm-point-stat:last-child { border-right: none; }

.bm-point-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  display: block;
  margin-bottom: 3px;
}

.bm-point-stat-label {
  font-size: 11px;
  color: #94a3b8;
  display: block;
}

/* Progress bar */
.bm-points-progress-wrap {
  padding: 0 20px 16px;
  border-right: 1px solid #f1f5f9;
}

.bm-progress-bar {
  height: 4px;
  background: #f1f5f9;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.bm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #0ea5e9);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.bm-point-warn {
  font-size: 10px;
  color: #f59e0b;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Table card (billing records) ── */
.bm-table-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.bm-table-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
}

.bm-table-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.bm-table-wrap {
  overflow-x: auto;
}

.bm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.bm-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fafbfc;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.bm-table td {
  padding: 13px 16px;
  color: #334155;
  border-bottom: 1px solid #f8fafc;
}

.bm-table tbody tr:last-child td { border-bottom: none; }
.bm-table tbody tr:hover td { background: #fafbfc; }

/* Status badges */
.bm-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.bm-status-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.bm-st-paid    { background: #dcfce7; color: #166534; }
.bm-st-paid    .bm-status-dot { background: #16a34a; }
.bm-st-pending { background: #fef9c3; color: #854d0e; }
.bm-st-pending .bm-status-dot { background: #ca8a04; }
.bm-st-refund  { background: #f3f4f6; color: #6b7280; }
.bm-st-refund  .bm-status-dot { background: #9ca3af; }
.bm-st-failed  { background: #fee2e2; color: #991b1b; }
.bm-st-failed  .bm-status-dot { background: #dc2626; }

.bm-table-action {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}
.bm-table-action:hover { opacity: 0.75; }

/* Empty state */
.bm-table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: #94a3b8;
  text-align: center;
}

.bm-table-empty-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  color: #cbd5e1;
}

/* Table skeleton */
.bm-table-skeleton-row td { padding: 13px 16px; }

/* ── Invoice form card ── */
.bm-invoice-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

.bm-invoice-hd {
  padding: 18px 24px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.bm-invoice-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.bm-invoice-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.bm-invoice-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  padding: 20px 24px;
}

@media (max-width: 768px) { .bm-invoice-form { grid-template-columns: 1fr; } }

.bm-iv-field { display: flex; flex-direction: column; gap: 5px; }

.bm-iv-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.bm-iv-input {
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  font-family: inherit;
}

.bm-iv-input::placeholder { color: #cbd5e1; }
.bm-iv-input:hover  { border-color: #cbd5e1; }
.bm-iv-input:focus  { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(14,165,233,.1); }

.bm-invoice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
}

.bm-iv-save-btn {
  height: 38px;
  padding: 0 20px;
  border: none;
  border-radius: 9px;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.bm-iv-save-btn:hover { background: var(--color-primary-hover); }

.bm-iv-apply-btn {
  height: 38px;
  padding: 0 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.bm-iv-apply-btn:hover { border-color: #94a3b8; color: #334155; }

/* ── Payment Modal ── */
.bm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.bm-modal {
  background: #fff;
  border-radius: 20px;
  width: 400px;
  max-width: 100%;
  box-shadow: 0 24px 60px rgba(15,23,42,.2);
  overflow: hidden;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.bm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.bm-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.bm-modal-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
}
.bm-modal-close:hover { background: #f1f5f9; color: #334155; }

.bm-modal-body { padding: 24px; }

/* QR code area */
.bm-qr-area {
  width: 200px; height: 200px;
  border: 2px dashed #e2e8f0;
  border-radius: 14px;
  margin: 0 auto 20px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.bm-qr-placeholder {
  /* QR pattern placeholder */
  display: grid;
  grid-template-columns: repeat(8, 12px);
  grid-template-rows: repeat(8, 12px);
  gap: 2px;
  opacity: 0.15;
}

.bm-qr-cell { background: #0f172a; border-radius: 2px; }

.bm-qr-label {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin-bottom: 8px;
}

.bm-modal-amount {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  text-align: center;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.bm-modal-plan-name {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  margin-bottom: 20px;
}

.bm-modal-pay-btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  transition: background 0.15s;
  font-family: inherit;
}
.bm-modal-pay-btn:hover { background: var(--color-primary-hover); }

.bm-modal-terms {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.6;
}

.bm-modal-terms a { color: var(--color-primary); text-decoration: none; }
.bm-modal-terms a:hover { text-decoration: underline; }

/* Modal states */
.bm-modal-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px;
  text-align: center;
  gap: 12px;
}

.bm-modal-state-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.bm-state-success { background: #dcfce7; color: #16a34a; }
.bm-state-failed  { background: #fee2e2; color: #dc2626; }
.bm-state-timeout { background: #fef9c3; color: #ca8a04; }

.bm-modal-state-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.bm-modal-state-desc  { font-size: 13px; color: #64748b; line-height: 1.5; }

.bm-modal-retry-btn {
  height: 38px;
  padding: 0 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 8px;
}
.bm-modal-retry-btn:hover { border-color: #94a3b8; }
