:root {
  --bg: #0f1117;
  --bg-card: #171a23;
  --bg-card-2: #1e222d;
  --border: #2a2f3d;
  --text: #e8e9ee;
  --text-dim: #9096a8;
  --accent: #6c5ce7;
  --accent-2: #00d9a5;
  --danger: #ff5c72;
  --warn: #ffb020;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.navbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,17,23,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.brand span { color: var(--accent-2); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-btn {
  background: transparent; border: 1px solid transparent; color: var(--text);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.nav-btn:hover { background: var(--bg-card-2); }
.nav-btn.active { background: var(--accent); color: #fff; }
.nav-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }

main#app { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; min-height: 70vh; }

.section-title { font-size: 18px; font-weight: 800; margin: 24px 0 12px; }

/* ---- Product grid: 3 per baris, gambar & info kecil ---- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 560px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.product-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display:block; background:#000; }
.product-card .pc-body { padding: 6px 7px 9px; }
.product-card .pc-name { font-size: 11.5px; font-weight: 700; line-height: 1.25; height: 28px; overflow: hidden; }
.product-card .pc-price { font-size: 11px; color: var(--accent-2); font-weight: 700; margin-top: 3px; }
.product-card .pc-stock { font-size: 9.5px; color: var(--text-dim); margin-top: 2px; }

/* ---- Top 10 ---- */
.top10-list { display: flex; flex-direction: column; gap: 8px; }
.top10-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.top10-rank {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink:0;
}
.top10-item img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }
.top10-name { font-weight: 700; font-size: 14px; flex: 1; }
.top10-count { font-size: 12px; color: var(--text-dim); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 440px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 20px;
}
.modal-box h3 { margin-top: 0; }
.modal-close {
  float: right; background: none; border: none; color: var(--text-dim); font-size: 18px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px;
}
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
}
.btn.secondary { background: var(--bg-card-2); color: var(--text); border: 1px solid var(--border); }
.btn.success { background: var(--accent-2); color: #04241c; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; text-align: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 6px; }
.success-msg { color: var(--accent-2); font-size: 13px; margin-top: 6px; }

.variant-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer;
}
.variant-row.selected { border-color: var(--accent); background: rgba(108,92,231,0.12); }
.variant-row .vr-price { font-weight: 700; color: var(--accent-2); font-size: 13px; }
.variant-row .vr-old { text-decoration: line-through; color: var(--text-dim); font-size: 11px; margin-right: 6px; }

.qr-box { text-align: center; }
.qr-box img { width: 220px; height: 220px; margin: 10px auto; display:block; background:#fff; padding:8px; border-radius:8px; }
.timer { font-size: 13px; color: var(--warn); margin-top: 6px; }

/* ---- Profile ---- */
.profile-header {
  display: flex; align-items: center; gap: 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; flex-wrap: wrap;
}
.avatar-wrap { position: relative; }
.avatar-wrap img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.avatar-edit {
  position: absolute; bottom: -2px; right: -2px; background: var(--accent); border-radius: 50%;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 12px; border: 2px solid var(--bg-card);
}
.profile-info h2 { margin: 0 0 4px; font-size: 18px; }
.badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.badge { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.badge.saldo { background: rgba(0,217,165,0.15); color: var(--accent-2); }
.badge.seller { background: rgba(108,92,231,0.2); color: #b3a4ff; }
.badge.reseller { background: rgba(255,176,32,0.18); color: var(--warn); }
.badge.off { background: rgba(255,92,114,0.15); color: var(--danger); }
.profile-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none; border: none; color: var(--text-dim); padding: 10px 14px; font-weight: 700; font-size: 13.5px;
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--text); border-color: var(--accent); }

.tx-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
}
.tx-card img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.tx-main { flex: 1; }
.tx-title { font-weight: 700; font-size: 14px; }
.tx-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.tx-key {
  margin-top: 6px; font-family: monospace; font-size: 12px; background: var(--bg); border: 1px dashed var(--border);
  padding: 6px 8px; border-radius: 6px; word-break: break-all; cursor: pointer;
}
.status-pill { font-size: 10.5px; padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.status-pill.completed { background: rgba(0,217,165,0.15); color: var(--accent-2); }
.status-pill.pending { background: rgba(255,176,32,0.18); color: var(--warn); }
.status-pill.failed, .status-pill.canceled { background: rgba(255,92,114,0.15); color: var(--danger); }

/* ---- Admin ---- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.stat-card .num { font-size: 22px; font-weight: 800; }
.stat-card .lbl { font-size: 12px; color: var(--text-dim); }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { color: var(--text-dim); font-weight: 700; }
.table-wrap { overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.form-row .field { margin-bottom: 0; min-width: 160px; flex: 1; }
textarea {
  width: 100%; min-height: 100px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px; font-family: monospace;
}
.toggle-badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; cursor: pointer; border: none; }
.toggle-badge.on { background: rgba(0,217,165,0.18); color: var(--accent-2); }
.toggle-badge.off { background: rgba(255,92,114,0.15); color: var(--danger); }

.empty-state { text-align: center; color: var(--text-dim); padding: 40px 10px; font-size: 14px; }
.footer { text-align: center; padding: 20px; color: var(--text-dim); font-size: 12px; border-top: 1px solid var(--border); }
