:root {
  --bg: #f6f7f9;
  --card: #fff;
  --ink: #17212b;
  --muted: #6b7684;
  --line: #e4e7ec;
  --brand: #1f3a5f;
  --brand-2: #2d5687;
  --accent: #c8963e;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c0392b;
  --r: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 12px; height: 58px; }
.logo { font-weight: 800; font-size: 18px; letter-spacing: .02em; color: var(--brand); display: flex; align-items: center; gap: 8px; }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-style: normal; font-size: 15px; }
.spacer { flex: 1; }
.cart-btn { position: relative; border: 1px solid var(--line); background: #fff; border-radius: 12px; height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.cart-btn b { background: var(--accent); color: #fff; border-radius: 99px; font-size: 12px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; }

/* hero + search */
.hero { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; padding: 22px 0 54px; }
.hero h1 { margin: 0 0 4px; font-size: 22px; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }
.search { margin-top: -30px; }
.search input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line); padding: 0 16px 0 44px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%236b7684' stroke-width='2'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='m14 14 4 4'/%3E%3C/svg%3E") 14px 50% no-repeat; box-shadow: var(--shadow); outline: none; }
.search input:focus { border-color: var(--brand-2); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 14px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* grid produk */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 10px 0 30px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; color: inherit; }
.ph { aspect-ratio: 1 / 1; background: #eef1f5; display: grid; place-items: center; color: #a3acb9; font-size: 13px; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .nm { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .cat { font-size: 12px; color: var(--muted); }
.price { font-weight: 800; color: var(--brand); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: #eef1f5; color: var(--muted); }
.badge.out { background: #fdecea; color: var(--bad); }
.badge.ok { background: #e7f5ec; color: var(--ok); }
.badge.warn { background: #fdf3e1; color: var(--warn); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 42px; margin-bottom: 6px; }

/* detail */
.detail { padding: 14px 0 110px; display: grid; gap: 16px; }
@media (min-width: 800px) { .detail { grid-template-columns: 1fr 1fr; padding-bottom: 40px; } }
.gallery .main { border-radius: var(--r); overflow: hidden; background: #eef1f5; aspect-ratio: 1/1; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.thumbs img.on { border-color: var(--brand); }
.detail h1 { font-size: 20px; margin: 4px 0 6px; }
.detail .price { font-size: 22px; }
.desc { white-space: pre-wrap; color: #333c47; margin-top: 12px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; color: var(--muted); font-size: 14px; }

/* tombol & form */
.btn { border: 0; border-radius: 12px; height: 48px; padding: 0 18px; font-weight: 700; cursor: pointer; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn.wa { background: #1fa855; }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid #f3c7c1; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: center; z-index: 15; }
@media (min-width: 800px) { .bar { position: static; border: 0; padding: 16px 0 0; background: transparent; } }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.qty button { width: 38px; height: 40px; border: 0; background: #fff; font-size: 18px; cursor: pointer; }
.qty span { min-width: 32px; text-align: center; font-weight: 700; }

.panel { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 14px 0; }
.panel h2 { font-size: 17px; margin: 0 0 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: #3a4552; }
.field input, .field textarea, .field select { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; outline: none; width: 100%; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand-2); }
.field textarea { min-height: 80px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); }
.radio { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--brand); background: #f3f6fb; }
.radio input { margin-top: 3px; accent-color: var(--brand); }
.radio b { display: block; }

.line { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .th { width: 58px; height: 58px; border-radius: 10px; overflow: hidden; flex: none; background: #eef1f5; }
.line .th img { width: 100%; height: 100%; object-fit: cover; }
.line .mid { flex: 1; min-width: 0; }
.line .mid .nm { font-weight: 600; font-size: 14px; }
.sum { display: flex; justify-content: space-between; font-weight: 800; font-size: 17px; padding-top: 10px; }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; }

.qris { text-align: center; }
.qris img { max-width: 280px; margin: 8px auto; border-radius: 12px; border: 1px solid var(--line); }
.big-total { font-size: 26px; font-weight: 800; color: var(--brand); }
.oid { font-family: ui-monospace, Menlo, monospace; font-weight: 700; font-size: 18px; letter-spacing: .03em; background: #f3f6fb; padding: 8px 12px; border-radius: 10px; display: inline-block; }
.ok-ico { width: 60px; height: 60px; border-radius: 99px; background: #e7f5ec; color: var(--ok); display: grid; place-items: center; font-size: 30px; margin: 4px auto 8px; }
.stack > * + * { margin-top: 10px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.err { background: #fdecea; color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #17212b; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.on { opacity: 1; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 20px 0 30px; }
.skel { background: linear-gradient(90deg, #eef1f5 25%, #f6f7f9 50%, #eef1f5 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); aspect-ratio: 3/4; }
@keyframes sk { to { background-position: -200% 0; } }
