:root {
  --blue: #2f7cf6;
  --blue-dark: #1c5fd0;
  --ink: #172438;
  --muted: #76849a;
  --line: #e7edf6;
  --bg: #f3f7fd;
  --ok: #17b26a;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.pay-page {
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 32px;
  display: flex;
  flex-direction: column;
}

.pay-header {
  padding: 26px 4px 18px;
  text-align: center;
}

.pay-brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3px;
}

.pay-brand-mark {
  display: inline-flex;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  border-radius: 7px;
  background: linear-gradient(135deg, #4e9bff, #1c5fd0);
  color: #fff;
  font-size: 13px;
  align-items: center;
  justify-content: center;
  vertical-align: -4px;
}

.pay-secure {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pay-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: 0 6px 24px rgba(31, 77, 160, .05);
}

.pay-card-title {
  font-size: 13px;
  color: var(--muted);
}

.pay-amount {
  margin-top: 6px;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.pay-amount small {
  font-size: 20px;
  margin-right: 4px;
  font-weight: 600;
}

.pay-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.6;
}

.pay-dot { margin: 0 6px; }

.pay-expire {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}

.pay-expire span { color: var(--blue); font-weight: 600; }

.pay-body {
  text-align: center;
  padding-top: 28px;
  padding-bottom: 28px;
}

.pay-step-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 15px;
  background: #eaf3ff;
  color: var(--blue);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pay-body h2, .done-card h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.pay-subtip {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.pay-btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 10px auto 0;
  padding: 13px 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #4e9bff, var(--blue-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
}

.pay-btn:active { transform: translateY(1px); }

.pay-btn.ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid #cfe0fb;
}

.pay-back {
  display: block;
  margin: 20px auto 0;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.qr-box {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 18px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-canvas { display: none; }

.qr-box.ready #qr-canvas { display: block; }

.qr-box.ready .qr-loading { display: none; }

.qr-loading {
  position: absolute;
  color: var(--muted);
  font-size: 13px;
}

.qr-fallback {
  margin: 0 0 18px;
  padding: 12px;
  border-radius: 10px;
  background: #f7f9fd;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  word-break: break-all;
}

.qr-fallback code { color: var(--ink); }

.done-card { text-align: center; padding-top: 32px; }

.done-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #e7f8f0;
  color: var(--ok);
  font-size: 30px;
  line-height: 56px;
  font-weight: 700;
}

.done-note {
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.pay-footer {
  margin-top: auto;
  padding: 18px 4px 0;
  color: #9aa6b8;
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.pay-footer p { margin: 0; }

.hidden { display: none !important; }

.err-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.err-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
}

.err-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff0f0;
  color: #e5484d;
  font-size: 26px;
  font-weight: 700;
  line-height: 48px;
}

.err-card h1 { margin: 0 0 10px; font-size: 17px; }
.err-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
