:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --soft: #f8fafc;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #079455;
  --ok-soft: #ecfdf3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 480px at 50% -180px, #dbe6ff 0%, rgba(219, 230, 255, 0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.page {
  max-width: 1020px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 8px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.brand-name {
  font-weight: 650;
  letter-spacing: 0.01em;
}

.divider {
  width: 1px;
  height: 16px;
  background: #cbd5e1;
}

.brand-sub {
  color: var(--muted);
  font-size: 14px;
}

.secure {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.secure svg {
  width: 15px;
  height: 15px;
  color: #12b76a;
}

.card {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 44px;
  background: var(--card);
  border: 1px solid rgba(228, 231, 236, 0.9);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, 0.04),
    0 18px 50px -12px rgba(16, 24, 40, 0.12);
}

.col {
  min-width: 0;
}

.block + .block {
  margin-top: 28px;
}

h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.step {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.plan {
  position: relative;
  padding: 18px 16px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  font: inherit;
  color: inherit;
}

.plan:hover {
  border-color: #c7d2fe;
  transform: translateY(-1px);
}

.plan[aria-checked="true"] {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f5f8ff 0%, #ffffff 100%);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.plan-price {
  display: block;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.plan-price small {
  margin-left: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.plan-gain {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.plan-gain b {
  color: var(--ink);
  font-weight: 600;
}

.plan-desc {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: #98a2b3;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff4ed;
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
}

.channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  font-weight: 600;
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.channel:hover {
  border-color: #c7d2fe;
}

.channel[aria-checked="true"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.channel-logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.summary {
  margin-top: 28px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--soft);
  border: 1px solid #eef2f6;
}

.summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13.5px;
}

.summary-row + .summary-row {
  margin-top: 8px;
}

.summary-row strong {
  font-size: 17px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.pay-btn {
  width: 100%;
  height: 52px;
  margin-top: 22px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #3b82f6 0%, var(--brand) 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, 0.65);
  transition: filter 0.16s ease, transform 0.16s ease;
}

.pay-btn:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.pay-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.footnote {
  margin: 14px 2px 0;
  font-size: 12px;
  line-height: 1.6;
  color: #98a2b3;
}

.col-qr {
  display: flex;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 468px;
  padding: 30px 24px;
  border: 1px dashed #d6dce6;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 100%);
  text-align: center;
  animation: panel-in 0.24s ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-title {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 260px;
}

.qr-frame {
  position: relative;
  padding: 10px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 26px -14px rgba(16, 24, 40, 0.35);
}

.qr-frame img {
  display: block;
  width: 236px;
  height: 236px;
}

.qr-hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: #344054;
}

.countdown {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.countdown strong {
  color: var(--ink);
  font-weight: 600;
}

.progress {
  width: 220px;
  height: 4px;
  border-radius: 999px;
  background: #e9edf3;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #12b76a);
  transition: width 0.9s linear;
}

.qr-actions {
  display: flex;
  gap: 18px;
  margin-top: 6px;
}

.link-btn {
  border: none;
  background: none;
  padding: 2px;
  color: var(--brand);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn.primary {
  color: var(--brand);
  font-weight: 650;
}

.qr-missing {
  width: 236px;
  padding: 28px 16px;
  border: 1px dashed #d0d5dd;
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.qr-missing span {
  font-size: 12px;
  color: #98a2b3;
}

.claim-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin-top: 4px;
  text-align: left;
}

.claim-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: #344054;
  font-weight: 600;
}

.claim-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  outline: none;
}

.claim-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.claim-form .pay-btn {
  margin-top: 2px;
  height: 46px;
  font-size: 15px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 12.5px;
}

.claim-note {
  margin: 2px 0 0;
  max-width: 280px;
  color: #98a2b3;
  font-size: 12px;
  line-height: 1.6;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #dbe3ef;
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

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

.state-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.state-icon.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.state-icon.err {
  background: var(--danger-soft);
  color: var(--danger);
}

.state-icon.neutral {
  background: #eef2f7;
  color: #98a2b3;
}

.state-icon svg {
  width: 26px;
  height: 26px;
}

.success-amount {
  margin: 6px 0 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.success-amount small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.ghost-btn {
  margin-top: 8px;
  padding: 11px 22px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: #b9c0cc;
}

.mobile-tip {
  display: none;
}

.admin-body {
  background: #f2f4f8;
}

.admin-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.admin-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-head .ghost-btn {
  margin: 0;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-tabs button {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475467;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.admin-tabs button[aria-pressed="true"] {
  border-color: var(--brand);
  background: #eff4ff;
  color: var(--brand);
  font-weight: 600;
}

.admin-msg {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #eff4ff;
  color: #1e40af;
  font-size: 13px;
}

.admin-msg[data-kind="ok"] {
  background: var(--ok-soft);
  color: var(--ok);
}

.admin-msg[data-kind="warn"] {
  background: #fffaeb;
  color: #b54708;
}

.admin-msg[data-kind="error"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px -18px rgba(16, 24, 40, 0.28);
}

.admin-table {
  width: 100%;
  min-width: 1060px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  padding: 11px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #f1f3f7;
  vertical-align: top;
}

.admin-table td:first-child {
  white-space: nowrap;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table code {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.45;
}

.admin-sub {
  display: block;
  margin-top: 3px;
  color: #98a2b3;
  font-size: 11.5px;
}

.admin-sub.danger {
  color: var(--danger);
}

.admin-table .amount {
  font-weight: 700;
  white-space: nowrap;
}

.admin-table .txn {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475467;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.status-reviewing {
  background: #fffaeb;
  color: #b54708;
}

.status-badge.status-fulfilled {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-badge.status-rejected,
.status-badge.status-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.status-paid {
  background: #eff4ff;
  color: var(--brand);
}

.admin-ops {
  white-space: nowrap;
}

.admin-btn {
  margin-right: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475467;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.admin-btn.approve {
  border-color: #a6f4c5;
  background: var(--ok-soft);
  color: var(--ok);
}

.admin-btn.reject {
  border-color: #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.admin-btn:hover {
  filter: brightness(0.98);
}

.admin-empty {
  padding: 28px !important;
  text-align: center;
  color: #98a2b3;
}

.admin-foot {
  margin: 14px 2px 0;
  color: #98a2b3;
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .page {
    padding: 16px 14px 88px;
  }

  .topbar {
    padding: 4px 4px 14px;
  }

  .secure {
    display: none;
  }

  .card {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 24px 18px;
    border-radius: 16px;
  }

  .panel {
    min-height: 380px;
  }

  .mobile-tip {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #101828;
    color: #f2f4f7;
    font-size: 12.5px;
    text-align: center;
  }
}

body.embedded .topbar {
  display: none;
}

body.embedded .card {
  border: none;
  box-shadow: none;
  padding: 8px 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
