:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1b1f2a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #ee4d2d;
  --brand-dark: #d73211;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(17,24,39,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
a { color: var(--brand); }
.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 480px; }

/* Header */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; text-decoration: none; color: var(--text); }
.logo span { color: var(--brand); }
.badge-secure { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }

.hero { padding: 36px 0 18px; }
.hero h1 { margin: 0 0 6px; font-size: 1.8rem; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); }

/* Produk */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 18px 0 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.product { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.product h3 { margin: 0; font-size: 1.05rem; }
.product p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; white-space: pre-line; }
.price { font-weight: 800; font-size: 1.15rem; color: var(--brand); }
.empty { text-align: center; color: var(--muted); padding: 60px 0; grid-column: 1 / -1; }

/* Tombol & form */
.btn {
  appearance: none; border: 0; border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 650;
  background: var(--brand); color: #fff; cursor: pointer; text-align: center; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: #eef0f4; color: var(--text); }
.btn.secondary:hover { background: #e3e6ec; }
.btn.small { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--bad); }
.btn.block { width: 100%; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 6px; }
input, textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(238,77,45,.25); border-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.error { color: var(--bad); font-size: .9rem; margin-top: 10px; min-height: 1.2em; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.5); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 420px; padding: 22px; }
.modal h2 { margin: 0 0 4px; font-size: 1.2rem; }
.modal .row { display: flex; gap: 10px; margin-top: 18px; }
.modal .row .btn { flex: 1; }

/* Halaman pembayaran */
.pay { margin: 28px auto 48px; padding: 24px; text-align: center; }
.pay h1 { font-size: 1.25rem; margin: 0 0 2px; }
.pay .sub { color: var(--muted); margin: 0 0 16px; font-size: .92rem; }
.qr-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: inline-block; }
.qr-wrap img { display: block; width: 260px; height: 260px; image-rendering: pixelated; }
.amount { font-size: 2rem; font-weight: 850; letter-spacing: -.02em; margin: 14px 0 2px; }
.breakdown { color: var(--muted); font-size: .88rem; }
.notice { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: 10px 12px; font-size: .88rem; margin: 14px 0; text-align: left; }
.merchant { font-size: .88rem; color: var(--muted); }
.merchant b { color: var(--text); }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.status-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: .92rem; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-icon { font-size: 3rem; line-height: 1; margin: 6px 0 8px; }
.content-box { text-align: left; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; margin: 14px 0; }
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { font-size: .82rem; color: var(--muted); }
.hidden { display: none !important; }

/* Admin */
.admin-wrap { padding: 24px 0 60px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: .82rem; }
.stat .v { font-weight: 800; font-size: 1.25rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.section { padding: 18px; margin-bottom: 18px; }
.section h2 { margin: 0 0 12px; font-size: 1.05rem; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.section h2 select { width: auto; padding: 6px 10px; font-size: .88rem; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.pill.paid { background: #dcfce7; color: #166534; }
.pill.pending { background: #fef3c7; color: #92400e; }
.pill.expired { background: #f3f4f6; color: #6b7280; }
.pill.off { background: #fee2e2; color: #991b1b; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.login { margin: 70px auto; padding: 24px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 20px 0 30px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.45rem; }
  .amount { font-size: 1.7rem; }
}
