/* Recharge forms retain their vertical order and existing payment controls. */
#page-billing > .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { #page-billing > .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { #page-billing > .stats { grid-template-columns: 1fr; } }
#page-billing .billing-recharge-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 12px;
  margin-top: 14px;
  padding: 14px 18px;
  border: 1px solid #dfe8e2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 14px #25433508;
}
#page-billing .billing-recharge-card > h3 {
  flex-basis: 100%;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
#page-billing .billing-recharge-card .quick-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  margin: 0;
}
#page-billing .billing-recharge-card .quick-amount {
  box-sizing: border-box;
  flex: 0 0 52px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 18px;
  background: #f8faf9;
  border: 1px solid #dce5df;
  color: #5c7063;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
#page-billing .billing-recharge-card .quick-amount:hover { background: #edf4ef; border-color: #a7c3b2; color: #326e59; }
#page-billing .billing-recharge-card .quick-amount:active { background: #deece3; }
#page-billing .billing-recharge-card .quick-amount:focus-visible { outline: 2px solid #66977c; outline-offset: 2px; }
#page-billing .billing-recharge-card .quick-amount.active {
  background: #eaf4ee;
  border-color: #81aa95;
  color: #286b50;
}
#page-billing .billing-recharge-card .actions {
  display: grid;
  flex: 0 1 266px;
  max-width: 100%;
  grid-template-columns: minmax(0, 160px) auto;
  gap: 4px 8px;
  align-items: start;
  margin: 0;
}
#page-billing .billing-recharge-card :is(#coinRechargeAmount, #rechargeAmount) {
  grid-column: 1;
  grid-row: 1;
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding-block: 3px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 20px;
  background: #fbfdfc;
  border-color: #ccddd2;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#page-billing .billing-recharge-card :is(#coinRechargeAmount, #rechargeAmount):hover { border-color: #9ebcaa; }
#page-billing .billing-recharge-card :is(#coinRechargeAmount, #rechargeAmount):focus { border-color: #609578; box-shadow: 0 0 0 2px #326e5914; background: #fff; }
#page-billing .billing-recharge-card .actions > .btn {
  grid-column: 2;
  grid-row: 1;
  min-height: 28px;
  margin-left: 0 !important;
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  border-color: #326e59;
  background: #326e59;
  color: #fff;
  box-shadow: 0 2px 4px #244d3a14;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
#page-billing .billing-recharge-card .actions > .btn:hover:not(:disabled) { background: #408168; border-color: #408168; box-shadow: 0 3px 8px #244d3a24; }
#page-billing .billing-recharge-card .actions > .btn:active:not(:disabled) { background: #24543f; border-color: #24543f; box-shadow: inset 0 1px 3px #153d3033; }
#page-billing .billing-recharge-card .actions > .btn:focus-visible { outline: 2px solid #66977c; outline-offset: 2px; }
#page-billing .billing-recharge-card #coinRechargePreview {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.5;
  color: #326e59;
}
#page-billing .billing-recharge-card > p {
  flex-basis: 100%;
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid #e8eeea;
  font-size: 11px;
  line-height: 1.65;
  color: #75837b;
}
#page-billing .billing-recharge-card > :is(#coinQrPanel, #wechatQrPanel) { flex-basis: 100%; min-width: 0; }
@media (max-width: 600px) {
  #page-billing .billing-recharge-card { padding: 12px 14px; }
  #page-billing .billing-recharge-card .quick-amount { flex-basis: 48px; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #page-billing .billing-recharge-card :is(.quick-amount, .actions > .btn, #coinRechargeAmount, #rechargeAmount) { transition: none; }
}

/* Both Alipay recharge flows share one focused payment dialog. */
#rechargePaymentDialog {
  box-sizing: border-box;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #dce6e0;
  border-radius: 18px;
  background: #fff;
  color: #253c32;
  box-shadow: 0 24px 80px #153d3033;
  overflow: auto;
  font: 13px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
#rechargePaymentDialog::backdrop { background: #142b2361; backdrop-filter: blur(4px); }
body:has(#rechargePaymentDialog[open]) { overflow: hidden; }
#rechargePaymentDialog * { box-sizing: border-box; }
#rechargePaymentDialog button { font: inherit; cursor: pointer; }
#rechargePaymentDialog button:focus-visible { outline: 2px solid #326e59; outline-offset: 2px; }
#rechargePaymentDialog .payment-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #edf1ee; }
#rechargePaymentDialog .payment-eyebrow { color: #85948b; font-size: 10px; letter-spacing: 1px; }
#rechargePaymentDialog h2 { margin: 1px 0 0; font-size: 16px; font-weight: 600; }
#rechargePaymentDialog .payment-dialog-close { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: #f4f7f5; color: #7a8b80; font-size: 21px; line-height: 1; }
#rechargePaymentDialog .payment-dialog-close:hover { background: #e7f0eb; color: #326e59; }
#rechargePaymentDialog .payment-dialog-body { padding: 18px 20px; text-align: center; background: linear-gradient(#f5faf7, #fff 150px); }
#rechargePaymentDialog .payment-amount-label { font-size: 11px; color: #7b8b82; }
#rechargePaymentDialog .payment-amount { display: block; margin-top: 2px; font-size: 28px; line-height: 1.3; font-weight: 650; font-variant-numeric: tabular-nums; color: #24573f; }
#rechargePaymentDialog .payment-credit { margin: 3px 0 12px; color: #7a8c80; font-size: 11px; }
#rechargePaymentDialog .payment-code { display: grid; place-items: center; width: 240px; min-height: 240px; max-width: 100%; margin: 0 auto; padding: 10px; overflow: hidden; border: 1px solid #e0e9e3; border-radius: 12px; background: #fff; }
#rechargePaymentDialog iframe { display: block; width: 200px; height: 200px; max-width: 100%; border: 0; background: #fff; overflow: hidden; }
#rechargePaymentDialog .payment-instruction { margin: 10px 0 8px; color: #6c7e73; font-size: 12px; overflow-wrap: anywhere; }
#rechargePaymentDialog .payment-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: #edf5f0; color: #397456; font-size: 11px; }
#rechargePaymentDialog .payment-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
#rechargePaymentDialog .payment-order { margin: 8px 0 0; color: #99a59e; font-size: 10px; overflow-wrap: anywhere; }
#rechargePaymentDialog .payment-order:empty { display: none; }
#rechargePaymentDialog .payment-notice { margin: 10px 0 0; font-size: 11px; color: #9a6b38; }
#rechargePaymentDialog .payment-dialog-footer { display: flex; justify-content: center; gap: 10px; padding: 12px 20px 16px; border-top: 1px solid #edf1ee; }
#rechargePaymentDialog .payment-dialog-footer button { min-height: 32px; padding: 5px 14px; border: 1px solid #d8e3dc; border-radius: 8px; background: #fff; color: #6d8073; font-size: 12px; }
#rechargePaymentDialog .payment-dialog-footer .payment-check { border-color: #326e59; background: #326e59; color: #fff; }
#rechargePaymentDialog .payment-dialog-footer .payment-check:hover { background: #265a44; }
#rechargePaymentDialog .payment-dialog-footer button:disabled { opacity: .5; cursor: wait; }
#rechargePaymentDialog [hidden] { display: none !important; }
#rechargePaymentDialog :is(.payment-success-mark, .payment-error-mark) { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: #e9f5ed; color: #326e59; font-size: 30px; }
#rechargePaymentDialog .payment-error-mark { background: #fff1e9; color: #b0784c; }
#rechargePaymentDialog[data-state="paid"] .payment-code,
#rechargePaymentDialog[data-state="error"] .payment-code { min-height: 130px; border: 0; background: transparent; }
#rechargePaymentDialog[data-state="error"] .payment-status { background: #fff4eb; color: #a67449; }
#rechargePaymentDialog .payment-spinner { width: 28px; height: 28px; border: 3px solid #e5eee8; border-top-color: #326e59; border-radius: 50%; animation: payment-spin .8s linear infinite; }
@keyframes payment-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #rechargePaymentDialog .payment-spinner { animation: none; } }
