:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1d1b18;
  --muted: #6b665d;
  --line: #e3dfd6;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0eb;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fdf1d8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1d1c1a;
    --surface-2: #262522;
    --text: #efece6;
    --muted: #a39e94;
    --line: #34322e;
    --accent: #5cc3a6;
    --accent-ink: #0c1f1a;
    --accent-soft: #1d3530;
    --danger: #f08b82;
    --danger-soft: #3a1f1c;
    --warn: #f0c267;
    --warn-soft: #3a2f17;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1100px; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); border-color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { width: 100%; }
.btn-lg { min-height: 50px; font-size: 1.02rem; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=number], input[type=url], input[type=search], textarea, select {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pad { padding: 16px; }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.baru { background: var(--warn-soft); color: var(--warn); }
.badge.dibayar, .badge.dikirim { background: var(--accent-soft); color: var(--accent); }
.badge.selesai { background: var(--surface-2); color: var(--text); }
.badge.batal { background: var(--danger-soft); color: var(--danger); }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; }
.notice.info { background: var(--accent-soft); color: var(--accent); }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* ---------- shop ---------- */
.shop-head { padding: 28px 0 18px; }
.shop-head p { margin: 6px 0 0; }
.shop-head .top button { white-space: nowrap; flex-shrink: 0; }
.shop-head .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.products { display: grid; gap: 14px; padding-bottom: 120px; }
.product { display: grid; grid-template-columns: 112px 1fr; overflow: hidden; }
.product .thumb {
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 2rem; min-height: 112px;
}
.product .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product .body { padding: 14px; min-width: 0; }
.product .desc { margin: 4px 0 10px; font-size: .9rem; color: var(--muted); }
.variants { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  min-height: 36px; padding: 5px 12px; border-radius: 999px; font-size: .88rem;
  flex-direction: column; gap: 0; line-height: 1.2;
}
.chip small { font-size: .72rem; color: var(--muted); }
.chip[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip[aria-pressed=true] small { color: var(--accent); }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.05rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; border-radius: 0; min-width: 38px; min-height: 38px; padding: 0; font-size: 1.1rem; }
.stepper span { min-width: 30px; text-align: center; font-weight: 600; }

@media (min-width: 640px) {
  .products { grid-template-columns: 1fr 1fr; }
  .product { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .product .thumb { aspect-ratio: 4/3; min-height: 0; }
}

.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.cartbar .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.cartbar .sum { flex: 1; min-width: 0; }
.cartbar .sum b { display: block; font-size: 1.05rem; }

.checkout { padding-top: 20px; padding-bottom: 60px; }
.checkout section { margin-bottom: 16px; }
.line-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .name { flex: 1; min-width: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px; margin-top: 10px; }
.totals .grand { font-weight: 700; font-size: 1.1rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label {
  font-weight: 500; margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; background: var(--surface);
}
.seg input { margin-right: 6px; }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg.seg3 label { padding: 9px 8px; font-size: .9rem; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay-info { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.qris { max-width: 240px; margin-top: 10px; border-radius: 8px; }
.upload {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer;
  font-weight: 500;
}
.upload:hover { border-color: var(--accent); }
.upload img { max-height: 220px; border-radius: 8px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.success { padding-top: 40px; padding-bottom: 40px; text-align: center; }
.success .code {
  font: 700 2.2rem/1 ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .12em;
  background: var(--surface); border: 1px dashed var(--accent); color: var(--accent);
  display: inline-block; padding: 14px 22px; border-radius: 12px; margin: 14px 0;
}
.success .card { text-align: left; margin: 18px 0; }

/* ---------- admin ---------- */
.admin-top {
  position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line);
}
.admin-top .row { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.admin-top h1 { font-size: 1.15rem; flex: 1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; }
.tabs button { border-color: transparent; background: transparent; white-space: nowrap; }
.tabs button[aria-selected=true] { background: var(--surface); border-color: var(--line); font-weight: 600; }
.admin-main { padding-top: 18px; padding-bottom: 60px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { min-height: 34px; padding: 4px 12px; border-radius: 999px; font-size: .88rem; }
.filters button[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 180px; }

.order-list { display: grid; gap: 8px; }
.order-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 12px; min-height: 0;
}
.order-row .l1 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.order-row .code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.order-row .items { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row .amt { font-weight: 700; text-align: right; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { padding: 14px; }
.stat .k { font-size: .8rem; color: var(--muted); }
.stat .v { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.low { color: var(--danger); font-weight: 600; }

.prod-admin { display: grid; gap: 10px; }
.prod-admin .card { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px; }
.prod-admin .mini { width: 64px; height: 64px; border-radius: 8px; background: var(--surface-2); object-fit: cover; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.prod-admin .vs { font-size: .85rem; color: var(--muted); }

dialog {
  border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--text);
  width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-body { padding: 16px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: .92rem; margin-bottom: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.bukti-img { border-radius: 10px; border: 1px solid var(--line); max-height: 60vh; margin: 0 auto; }
.var-row { display: grid; grid-template-columns: 1fr 110px 80px 36px; gap: 6px; margin-bottom: 6px; align-items: center; }
.var-row button { min-height: 40px; padding: 0; }
.switch { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.switch input { width: 18px; height: 18px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { max-width: 380px; width: 100%; text-align: center; padding: 28px 22px; }
.login #gbtn { display: flex; justify-content: center; margin: 18px 0 8px; min-height: 44px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .var-row { grid-template-columns: 1fr 92px 64px 36px; }
  .kv { grid-template-columns: 90px 1fr; }
}
