* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid #1e293b; position: sticky; top: 0; background: rgba(15,23,42,0.9); backdrop-filter: blur(8px); z-index: 10; }
.brand { font-weight: 700; color: #38bdf8; font-size: 1.15rem; }
.auth-area { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.auth-area .email { color: #94a3b8; }
.badge { background: linear-gradient(135deg,#22c55e,#16a34a); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 6px; }

.container { max-width: 860px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.section-title { font-size: 1.05rem; color: #64748b; margin: 1.5rem 0 1rem; font-weight: 600; }

#subBanner .banner { background: linear-gradient(135deg,#1e3a8a,#5b21b6); border-radius: 14px; padding: 1.1rem 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
#subBanner .banner p { font-size: 0.92rem; }
#subBanner .banner strong { color: #fff; }

.app-grid { display: grid; gap: 1rem; }
.app-card { background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem; }

.app-icon { width: 64px; height: 64px; border-radius: 14px; background: linear-gradient(135deg,#3b82f6,#8b5cf6); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; flex-shrink: 0; overflow: hidden; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }

.app-info { flex: 1; min-width: 0; }
.app-name { font-weight: 700; font-size: 1.05rem; }
.app-version { display: inline-block; background: #334155; color: #94a3b8; font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 6px; margin-top: 0.2rem; font-weight: 600; }
.app-meta { font-size: 0.8rem; color: #475569; margin-top: 0.3rem; }
.app-desc { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }

.app-actions { flex-shrink: 0; }
.btn { border: none; border-radius: 10px; padding: 0.6rem 1.15rem; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all .2s; text-decoration: none; display: inline-block; text-align: center; }
.btn-primary { background: #3b82f6; color: #fff; width: 100%; }
.btn-primary:hover { background: #2563eb; }
.btn-download { background: #22c55e; color: #fff; }
.btn-download:hover { background: #16a34a; }
.btn-ghost { background: transparent; color: #94a3b8; border: 1px solid #334155; }
.btn-ghost:hover { color: #e2e8f0; border-color: #475569; }
.btn-lock { background: #334155; color: #cbd5e1; }
.btn-lock:hover { background: #475569; }

/* Locked / skeleton apps */
.app-card.locked .app-icon { background: #334155; }
.skel { position: relative; overflow: hidden; background: #334155; border-radius: 6px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skel-icon { width: 64px; height: 64px; border-radius: 14px; }
.skel-line { height: 10px; margin-top: 8px; }
.skel-line.w40 { width: 40%; } .skel-line.w60 { width: 60%; }
.lock-tag { font-size: 0.7rem; color: #f59e0b; font-weight: 700; margin-top: 0.35rem; display: inline-flex; align-items: center; gap: 0.25rem; }

.skeleton-card { height: 96px; background: #1e293b; border: 1px solid #334155; border-radius: 16px; }

/* Modals */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.active { display: flex; }
.modal { background: #1e293b; border-radius: 18px; padding: 1.8rem; width: 100%; max-width: 420px; position: relative; }
.modal h2 { margin-bottom: 1.2rem; }
.modal label { display: block; color: #94a3b8; font-size: 0.82rem; margin: 0.9rem 0 0.3rem; }
.modal input { width: 100%; background: #0f172a; border: 1px solid #334155; border-radius: 9px; padding: 0.7rem; color: #e2e8f0; font-size: 0.95rem; }
.modal input:focus { outline: none; border-color: #38bdf8; }
.modal .btn-primary { margin-top: 1.3rem; }
.card-row { display: flex; gap: 0.75rem; }
.card-row > div { flex: 1; }
.err { color: #f87171; font-size: 0.82rem; margin-top: 0.6rem; min-height: 1rem; }
.switch { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: #64748b; }
.switch a { color: #38bdf8; text-decoration: none; margin-left: 0.3rem; }
.pw-hint { font-size: 0.75rem; color: #64748b; margin-top: 0.35rem; }
.modal-close { position: absolute; top: 0.8rem; right: 1rem; background: none; border: none; color: #64748b; font-size: 1.6rem; cursor: pointer; line-height: 1; }
.sub-price { font-size: 1.6rem; font-weight: 800; color: #fff; }
.sub-note { font-size: 0.8rem; color: #64748b; margin-top: 0.3rem; }
.sub-note.secure { text-align: center; margin-top: 1rem; }
.sub-note.center { text-align: center; }
.qr-wrap { display: flex; justify-content: center; margin: 1rem 0 0.4rem; }
.qr-wrap img { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; }
#subBanner .banner.pending { background: linear-gradient(135deg,#78350f,#92400e); }

/* Admin */
.admin-wrap { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem; }
.admin-wrap h1 { font-size: 1.3rem; margin-bottom: 1rem; }
.pay-item { background: #1e293b; border: 1px solid #334155; border-radius: 14px; padding: 1rem; margin-bottom: 1rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.pay-item .slip { width: 90px; height: 90px; border-radius: 10px; object-fit: cover; background: #0f172a; cursor: zoom-in; flex-shrink: 0; }
.pay-item .pay-info { flex: 1; min-width: 160px; }
.pay-item .pay-email { font-weight: 700; }
.pay-item .pay-meta { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }
.pay-actions { display: flex; gap: 0.5rem; }
.btn-approve { background: #22c55e; color: #fff; }
.btn-approve:hover { background: #16a34a; }
.btn-reject { background: transparent; color: #f87171; border: 1px solid #7f1d1d; }
.btn-reject:hover { background: #7f1d1d; color: #fff; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 300; padding: 1rem; }
.lightbox.active { display: flex; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(80px); background: #22c55e; color: #fff; padding: 0.7rem 1.6rem; border-radius: 10px; font-weight: 600; opacity: 0; transition: all .3s; z-index: 200; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: #ef4444; }

@media (max-width: 520px) {
  .app-card { flex-wrap: wrap; }
  .app-actions { width: 100%; }
  .app-actions .btn { width: 100%; }
}
