/* DPG public checkout (DM Sans) */\n
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --white: #FFFFFF;
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --border: #E5E5E5;
  --border-light: #F0F0F0;
  --text: #111111;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --black: #000000;
  --accent: #111111;
  --success: #1A7F37;
  --success-bg: #F0FFF4;
  --success-border: #B7EBD5;
  --error: #CF222E;
  --error-bg: #FFF0F0;
  --error-border: #FFB3B3;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-full: 999px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Top Bar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 24px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}
.topbar-brand {
  font-size: 14px; font-weight: 600; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.topbar-brand span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--black);
}
.topbar-right {
  font-size: 12px; color: var(--text-tertiary);
  display: flex; align-items: center; gap: 6px;
}

/* ── Demo Nav ── */
.demo-nav {
  position: fixed; top: 60px; right: 16px; z-index: 200;
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.demo-nav button {
  padding: 5px 12px; border: none; border-radius: 4px;
  font-size: 11px; font-weight: 500; font-family: inherit;
  background: transparent; color: var(--text-tertiary); cursor: pointer;
  transition: all 0.15s;
}
.demo-nav button.active { background: var(--black); color: var(--white); }
.demo-nav button:hover:not(.active) { color: var(--text); }

/* ── Views ── */
.view { display: none; }
.view.active { display: block; }

/* ── Page Container ── */
.page {
  max-width: 560px; margin: 0 auto;
  padding: 40px 20px 80px;
  animation: enter 0.4s ease both;
}
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Section Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}
.card + .card { margin-top: 16px; }

/* ── Status Pill ── */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500; padding: 4px 12px;
  border-radius: var(--radius-full); margin-bottom: 20px;
  letter-spacing: 0.02em;
}
.pill .dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}
.pill.pend { background: #F5F5F5; color: var(--text-secondary); border: 1px solid var(--border); }
.pill.ok { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.pill.expired { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); }

.pill.pend .dot { animation: blink 1.8s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Typography ── */
.heading {
  font-size: 26px; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.15; margin-bottom: 8px;
}
.heading .muted { color: var(--text-tertiary); }
.heading .green { color: var(--success); }
.heading .red { color: var(--error); }

.subtext {
  font-size: 14px; line-height: 1.6; color: var(--text-secondary);
  margin-bottom: 28px;
}
.subtext strong { color: var(--text); font-weight: 600; }

.label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 8px;
  letter-spacing: 0.01em;
}

/* ── Input ── */
.input-wrap {
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.input {
  flex: 1; height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  font-family: inherit; color: var(--text); outline: none;
  transition: border-color 0.15s;
}
.input::placeholder { color: var(--text-tertiary); font-weight: 400; }
.input:focus { border-color: var(--black); }

.badge {
  font-size: 11px; font-weight: 600; padding: 0 10px;
  height: 32px; display: inline-flex; align-items: center;
  border-radius: var(--radius-sm); white-space: nowrap; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text-tertiary);
}
.badge.valid { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.badge.invalid { color: var(--error); background: var(--error-bg); border-color: var(--error-border); }

/* ── Credit Chips ── */
.chip-grid {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.chip {
  padding: 8px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  color: var(--text); background: var(--surface);
  cursor: pointer; font-family: inherit;
  transition: all 0.15s; position: relative;
}
.chip:hover { border-color: var(--text-tertiary); }
.chip.active {
  background: var(--black); color: var(--white); border-color: var(--black);
}
.chip .pop {
  position: absolute; top: -7px; right: -6px;
  background: var(--black); color: var(--white);
  font-size: 8px; font-weight: 700; padding: 1px 5px;
  border-radius: var(--radius-full); letter-spacing: 0.03em;
}
.chip.active .pop { background: var(--white); color: var(--black); }

.custom-row { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.custom-input {
  width: 120px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: inherit;
  color: var(--text); background: var(--surface); outline: none;
}
.custom-input:focus { border-color: var(--black); }
.custom-sep { color: var(--text-tertiary); font-size: 13px; }

/* ── Payment Option ── */
.pay-option {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; font-family: inherit;
  transition: border-color 0.15s;
}
.pay-option:hover { border-color: var(--text-tertiary); }
.pay-option:has(input:checked) { border-color: var(--black); background: var(--bg); }
.pay-option input[type="radio"] { accent-color: var(--black); width: 15px; height: 15px; flex-shrink: 0; }
.pay-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: #FFF8E1; color: #F59E0B;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  flex-shrink: 0;
}
.pay-info { flex: 1; }
.pay-info .pi-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pay-info .pi-desc { font-size: 12px; color: var(--text-tertiary); }

/* ── Summary ── */
.summary { margin-bottom: 24px; }
.sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
}
.sum-row + .sum-row { border-top: 1px solid var(--border-light); }
.sum-row .sl { font-size: 13px; color: var(--text-secondary); }
.sum-row .sv { font-size: 13px; font-weight: 600; text-align: right; }
.sum-row.total { padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--border) !important; }
.sum-row.total .sl { font-size: 14px; font-weight: 600; color: var(--text); }
.sum-row.total .sv { font-size: 22px; font-weight: 700; color: var(--black); letter-spacing: -0.02em; }
.sum-row.total .sv.green { color: var(--success); }

.mini-tag {
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: var(--radius-full); display: inline-flex; align-items: center; gap: 3px;
  background: var(--success-bg); color: var(--success);
}

/* ── Buttons ── */
.btn-primary {
  width: 100%; height: 48px; background: var(--black); color: var(--white);
  border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: all 0.15s;
}
.btn-primary:hover { background: #222; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-secondary {
  width: 100%; height: 44px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--text-tertiary); }

.btn-row { display: flex; gap: 10px; margin-top: 8px; }
.btn-row .btn-primary { flex: 1; }

.link {
  background: none; border: none; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer; padding: 0; font: inherit;
}
.link:hover { color: var(--text); }

.err-msg { color: var(--error); font-size: 13px; min-height: 20px; margin-bottom: 4px; }

.hint { font-size: 12px; color: var(--text-tertiary); margin-top: 14px; line-height: 1.5; }
.hint i { margin-right: 5px; }

/* ── Divider ── */
.divider {
  height: 1px; background: var(--border-light); margin: 24px 0;
}

/* ── Payment View ── */
.qr-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
  background: var(--surface);
}
.qr-label {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px;
}
.qr-frame {
  width: 180px; height: 180px; background: var(--white);
  border-radius: var(--radius); padding: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-light);
}
.qr-frame canvas { max-width: 100%; max-height: 100%; }

.qr-amount-text { font-size: 24px; font-weight: 700; margin-top: 14px; letter-spacing: -0.02em; }
.qr-ccy { font-size: 13px; color: var(--text-tertiary); margin-top: 2px; }

.copy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 16px;
}
.copy-row-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); margin-bottom: 2px; }
.copy-row-val { font-size: 13px; font-weight: 600; word-break: break-all; }
.copy-btn {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 12px; font-weight: 500; padding: 5px 12px;
  border-radius: var(--radius-sm); cursor: pointer; font-family: inherit;
  white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
}
.copy-btn:hover { border-color: var(--black); color: var(--black); }

/* ── Timer ── */
.timer-strip {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--surface);
}
.timer-strip-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; flex-shrink: 0; }
.timer-digits { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.timer-digits .td {
  font-size: 16px; font-weight: 700; min-width: 28px; text-align: center;
}
.timer-digits .tsep { font-size: 14px; color: var(--text-tertiary); font-weight: 500; }
.timer-progress { flex: 1; height: 2px; background: var(--border-light); border-radius: 1px; overflow: hidden; }
.timer-progress-fill { height: 100%; background: var(--black); transition: width 1s linear; }
.timer-strip.dim { opacity: 0.35; }

/* ── Steps ── */
.steps { margin-bottom: 16px; }
.steps-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-tertiary); margin-bottom: 10px;
}
.step {
  display: flex; gap: 12px; padding: 10px 0;
}
.step + .step { border-top: 1px solid var(--border-light); }
.step-n {
  min-width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.step-p strong { color: var(--text); }
.steps.dim { opacity: 0.35; }

/* ── Warn ── */
.warn {
  font-size: 13px; line-height: 1.55; padding: 12px 14px;
  border-radius: var(--radius-sm); margin-bottom: 16px;
  background: var(--error-bg); border: 1px solid var(--error-border); color: var(--text);
}

/* ── Success Result ── */
.result {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.result.ok { background: var(--success-bg); border: 1px solid var(--success-border); }
.result-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: 14px; flex-shrink: 0;
}
.result-icon.ok { background: var(--success); }
.result-body { flex: 1; }
.result-title { font-size: 15px; font-weight: 700; }
.result-title.green { color: var(--success); }
.result-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.result-tx { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; word-break: break-all; }
.result-tx strong { color: var(--text-secondary); }

/* ── Completed Terminal ── */
.done-card {
  text-align: center; padding: 36px 24px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.done-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--success); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin: 0 auto 16px;
}
.done-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; color: var(--success); }
.done-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.5; }
.done-details {
  width: 100%; text-align: left; padding: 14px;
  background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.dd-row {
  display: flex; justify-content: space-between; padding: 6px 0; font-size: 12px;
}
.dd-row + .dd-row { border-top: 1px solid var(--border-light); }
.dd-row .ddl { color: var(--text-tertiary); }
.dd-row .ddv { font-weight: 600; color: var(--text); }
.dd-row .ddv.green { color: var(--success); }

/* ── Modal ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.25);
  z-index: 5000; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 420px; width: 100%;
  padding: 28px;
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.modal p { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 16px; }
.modal label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); margin-bottom: 4px; }
.modal input {
  width: 100%; height: 40px; padding: 0 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; color: var(--text);
  background: var(--surface); outline: none;
}
.modal input:focus { border-color: var(--black); }
.modal-msg { font-size: 13px; min-height: 20px; margin-top: 6px; }
.modal-msg.ok { color: var(--success); }
.modal-msg.err { color: var(--error); }
.modal-btns { display: flex; gap: 8px; margin-top: 16px; }
.modal-btns button {
  flex: 1; height: 40px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; border: none; cursor: pointer; font-family: inherit;
}
.mbtn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border) !important; }
.mbtn-ghost:hover { background: var(--border-light); }
.mbtn-primary { background: var(--black); color: var(--white); }
.mbtn-primary:hover { background: #222; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--black); color: var(--white);
  padding: 10px 20px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500; z-index: 6000;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast i { font-size: 12px; }

/* ── Confetti ── */
.confetti-wrap { position: fixed; inset: 0; z-index: 400; pointer-events: none; overflow: hidden; }
.confetti-p { position: absolute; top: -20px; opacity: 0; }
@keyframes confettiFall {
  0% { transform: translateY(0) translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) translateX(var(--dx)) rotate(var(--rot)); opacity: 0; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .page { padding: 28px 16px 60px; }
  .card { padding: 20px; }
  .heading { font-size: 22px; }
  .chip-grid { gap: 6px; }
  .chip { padding: 7px 12px; font-size: 13px; }
  .demo-nav { top: auto; bottom: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
  \n/* DPG: loader, confetti (JS cfall + cfp), pub banner, legacy var aliases */
:root {
  --tx: var(--text);
  --tx2: var(--text-secondary);
  --text-primary: var(--text);
  --ok: var(--success);
  --ok-lt: var(--success-bg);
  --no: var(--error);
  --no-lt: var(--error-bg);
  --orange: var(--black);
  --card: var(--surface);
  --bd: var(--border);
  --white-glass-strong: #fff;
}

.cfw { position: fixed; inset: 0; z-index: 400; pointer-events: none; overflow: hidden; }
.cfp { position: absolute; top: -20px; opacity: 0; }
@keyframes cfall {
  0% { transform: translateY(0) translateX(0) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) translateX(var(--dx)) rotate(var(--rot)); opacity: 0; }
}

.loader {
  position: fixed; inset: 0; z-index: 8000; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  transition: opacity 0.45s, visibility 0.45s;
}
.loader.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.l-logo { width: 52px; height: 52px; background: var(--black); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 22px; }
.l-bar { width: 200px; height: 3px; background: var(--border); border-radius: 3px; overflow: hidden; }
.l-fill { height: 100%; background: var(--black); width: 0; animation: dpg_lp 1.8s ease-out forwards; }
@keyframes dpg_lp { 0% { width: 0; } 100% { width: 100%; } }
.l-txt { font-size: 13px; color: var(--text-secondary); }

.pub-banner { max-width: 560px; margin: 12px auto 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; }
.pub-banner.err { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error); }

#rcard { display: none; }
#rcard.show { display: flex; }

.pill.no { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); }
.pill.no .dot { color: var(--error); }
.pill.ok .dot { background: var(--success); }

.heading .hl, .hl { color: var(--text-tertiary); }
.heading .hl.ok, .hl.ok { color: var(--success); }
.heading .hl.no, .hl.no { color: var(--error); }
.heading .green, .sv.green, .ok { color: var(--success); }
.heading .red, .red { color: var(--error); }

.card.gok { background: var(--success-bg); border-color: var(--success-border); }
.card.gno { background: var(--error-bg); border-color: var(--error-border); }
.sum-row .sv.ok { color: var(--success); }
.sum-row .sv.no, .sum-row .sv.danger { color: var(--error); }

/* legacy step class names in PHP */
.step .sn { min-width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); font-size: 11px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step .st { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.step .st strong { color: var(--text); }
.steps h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); margin-bottom: 10px; }

.qr-frame { position: relative; }
.qr-frame #qrCodeMount, .qr-frame #qrCodeMount img, .qr-frame #qrCodeMount canvas { max-width: 100%; }
.qr-frame #qrCodeMount { min-height: 120px; display: flex; align-items: center; justify-content: center; }
.cb { position: absolute; width: 10px; height: 10px; z-index: 2; }
.cb::before, .cb::after { content: ""; position: absolute; background: var(--text); border-radius: 1px; }
.cb.tl { top: 0; left: 0; } .cb.tl::before { width: 10px; height: 2px; } .cb.tl::after { width: 2px; height: 10px; }
.cb.tr { top: 0; right: 0; } .cb.tr::before { width: 10px; height: 2px; } .cb.tr::after { width: 2px; height: 10px; }
.cb.bl { bottom: 0; left: 0; } .cb.bl::before { width: 10px; height: 2px; } .cb.bl::after { width: 2px; height: 10px; }
.cb.br { bottom: 0; right: 0; } .cb.br::before { width: 10px; height: 2px; } .cb.br::after { width: 2px; height: 10px; }
.cb.ok::before, .cb.ok::after { background: var(--success); }
.cb.no::before, .cb.no::after { background: var(--error); }
.scanln { position: absolute; left: 6px; right: 6px; height: 2px; background: linear-gradient(90deg, transparent, var(--text-tertiary), transparent); animation: dpg_qsc 2.2s ease-in-out infinite; z-index: 1; }
.scanln.stop { opacity: 0; animation: none; }
@keyframes dpg_qsc { 0% { top: 8px; } 100% { top: calc(100% - 10px); } }

.pick-offline-card { text-align: center; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pick-offline-card h2 { font-size: 18px; margin: 12px 0 8px; }
.pick-offline-card p { color: var(--text-secondary); font-size: 14px; }
