:root {
  --bg: #f4f6fb;
  --bg2: #ffffff;
  --bg3: #eef1f7;
  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --primary: #e11d6e;
  --primary-dim: rgba(225, 29, 110, 0.12);
  --accent: #7c3aed;
  --accent-dim: rgba(124, 58, 237, 0.12);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); }
body { -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
.app { height: 100%; display: flex; flex-direction: column; }
.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .emoji { font-size: 26px; }
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.section { padding: 0 16px 18px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.stat .v { font-size: 17px; font-weight: 700; color: var(--primary); }
.stat .l { font-size: 10px; color: var(--muted); margin-top: 3px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; background: #eef1f7; border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 12px; color: var(--text); font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.btn { border: none; border-radius: 11px; padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer; transition: transform .12s, opacity .15s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #e11d6e, #db2777); color: #fff; }
.btn-accent { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; }
.btn-ghost { background: #eef1f7; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-full { width: 100%; }
.mt { margin-top: 10px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.hint code { background: #eef1f7; padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-item { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.list-item:last-child { border-bottom: none; }
.list-item .t { font-size: 13px; font-weight: 500; }
.list-item .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.badge { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.badge-pending { background: #fef3c7; color: var(--warning); }
.badge-success, .badge-approved, .badge-active { background: #d1fae5; color: var(--success); }
.badge-failed, .badge-rejected, .badge-banned { background: #fee2e2; color: var(--danger); }
.badge-processing, .badge-paid { background: #dbeafe; color: #2563eb; }
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); padding-top: 4px;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: flex-start;
  box-shadow: 0 -4px 20px rgba(15,23,42,0.05);
}
.nav-item {
  flex: 1; background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; cursor: pointer; position: relative; z-index: 2;
  font-size: 10px; font-weight: 500;
}
.nav-item svg { width: 22px; height: 22px; transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: translateY(-3px) scale(1.08); }
.nav-blob {
  position: absolute; top: -8px; width: 48px; height: 30px;
  background: radial-gradient(ellipse 70% 90% at 50% 100%, var(--primary) 0%, transparent 70%);
  border-radius: 50% 50% 0 0;
  transition: left .38s cubic-bezier(.34,1.4,.64,1);
  pointer-events: none; z-index: 1; opacity: 0.85;
}
.nav-blob::before {
  content: ''; position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 7px; height: 7px; background: var(--primary); border-radius: 50%;
  box-shadow: 0 0 10px 3px rgba(225,29,110,0.45);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7; transform:translateX(-50%) scale(1.25)} }
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal.hidden { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(15,23,42,.35); backdrop-filter: blur(3px); }
.modal-sheet {
  position: relative; width: 100%; max-width: 440px;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 10px 18px 28px; border: 1px solid var(--border); border-bottom: none;
  animation: up .28s ease; box-shadow: 0 -8px 40px rgba(15,23,42,0.12);
}
@keyframes up { from{transform:translateY(100%)} to{transform:none} }
.modal-handle { width: 36px; height: 4px; background: #cbd5e1; border-radius: 2px; margin: 0 auto 14px; }
.modal-sheet h3 { text-align: center; margin-bottom: 16px; font-size: 17px; }
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 80; background: #fff; padding: 11px 18px; border-radius: 11px;
  font-size: 13px; border: 1px solid var(--border); box-shadow: 0 8px 28px rgba(15,23,42,.15);
  max-width: 90%; animation: tin .25s ease; color: var(--text);
}
.toast.hidden { display: none; }
.toast.ok { border-color: #a7f3d0; }
.toast.err { border-color: #fecaca; }
@keyframes tin { from{opacity:0;transform:translateX(-50%) translateY(-12px)} to{opacity:1;transform:translateX(-50%)} }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pkg {
  background: var(--card); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 12px; cursor: pointer; transition: .15s; position: relative; box-shadow: var(--shadow);
}
.pkg.selected { border-color: var(--primary); background: var(--primary-dim); }
.pkg .name { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.pkg .price { font-size: 15px; font-weight: 700; color: var(--primary); }
.pkg .tag { position: absolute; top: 6px; right: 6px; font-size: 9px; padding: 2px 5px; border-radius: 4px; background: #eef1f7; color: var(--muted); }
.pkg.vip .tag { background: var(--accent-dim); color: var(--accent); }
.qr-box { text-align: center; padding: 12px; }
.qr-box img { max-width: 220px; border-radius: 12px; background: #fff; padding: 8px; border: 1px solid var(--border); }
.qr-info { font-size: 13px; margin-top: 10px; line-height: 1.6; }
.qr-info b { color: var(--primary); }
.empty { text-align: center; padding: 28px; color: var(--muted); font-size: 13px; }
@media (min-width: 560px) {
  .main, .topbar, .bottom-nav { max-width: 480px; margin: 0 auto; }
  .bottom-nav { left: 50%; transform: translateX(-50%); width: 100%; border-radius: 16px 16px 0 0; }
}
