/* =====================================================================
   Kasir Jualan: design system (aturan lengkap di docs/DESIGN.md)
   1. Tidak ada kartu di dalam kartu: isi kartu/sheet dipisah garis, bukan kotak.
   2. Teks abu (--muted) hanya di atas --surface atau --bg, tidak di latar berwarna.
   3. Tanpa gradasi. Satu warna aksen (biru) + warna status seperlunya.
   4. Tidak ada ikon berkotak/berbulat di atas judul. Ikon hanya di tombol, navigasi, dan baris.
   ===================================================================== */
@font-face { font-family: 'Inter'; src: url('/fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #f2f4f7;
  --line: #e4e7ec; --line-strong: #d0d5dd;
  --text: #101828; --text-2: #344054; --muted: #667085;
  --brand: #2563eb; --brand-hover: #1d4ed8; --brand-soft: #eef4ff; --brand-ring: rgba(37, 99, 235, .22); --on-brand: #ffffff;
  --ok: #067647; --ok-soft: #ecfdf3;
  --warn: #b54708; --warn-soft: #fffaeb;
  --danger: #d92d20; --danger-soft: #fef3f2;
  --wa: #128c4b;
  --overlay: rgba(16, 24, 40, .5);
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 20px;
  --sh-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-lg: 0 20px 40px -8px rgba(16, 24, 40, .18), 0 6px 12px -4px rgba(16, 24, 40, .06);
  --top-h: 60px; --nav-h: 64px; --rail-w: 88px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b1120; --surface: #111827; --surface-2: #1a2336;
    --line: #232e44; --line-strong: #334159;
    --text: #eef2f8; --text-2: #cdd5e2; --muted: #8e9ab0;
    --brand: #3b82f6; --brand-hover: #60a5fa; --brand-soft: rgba(59, 130, 246, .14); --brand-ring: rgba(59, 130, 246, .32);
    --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .12);
    --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12);
    --danger: #f97066; --danger-soft: rgba(249, 112, 102, .12);
    --wa: #1fa855; --overlay: rgba(0, 0, 0, .6);
    --sh-xs: none; --sh-lg: 0 24px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0b1120; --surface: #111827; --surface-2: #1a2336;
  --line: #232e44; --line-strong: #334159;
  --text: #eef2f8; --text-2: #cdd5e2; --muted: #8e9ab0;
  --brand: #3b82f6; --brand-hover: #60a5fa; --brand-soft: rgba(59, 130, 246, .14); --brand-ring: rgba(59, 130, 246, .32);
  --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .12);
  --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12);
  --danger: #f97066; --danger-soft: rgba(249, 112, 102, .12);
  --wa: #1fa855; --overlay: rgba(0, 0, 0, .6);
  --sh-xs: none; --sh-lg: 0 24px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* =========================== dasar =========================== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg); color: var(--text); min-height: 100dvh;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mono-id { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* =========================== kerangka =========================== */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img { width: 32px; height: 32px; border-radius: 9px; flex: none; object-fit: cover; }
.brand-text { display: grid; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 12px; color: var(--muted); white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.d-short { display: none; }
@media (max-width: 520px) { .d-long { display: none; } .d-short { display: inline; } }

.mode-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mode-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mode-badge.demo { color: var(--warn); }
.mode-badge.sandbox { color: var(--brand); }
.mode-badge.production { color: var(--ok); }
@media (max-width: 360px) { .mode-badge { display: none; } }

.account-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text);
}
.account-btn:hover { border-color: var(--line-strong); }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: flex; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; position: relative;
}
.nav a svg.i { width: 22px; height: 22px; }
.nav a.active { color: var(--brand); }
.nav a.active::before { content: ''; position: absolute; top: 0; left: 50%; width: 32px; height: 3px; margin-left: -16px; border-radius: 0 0 3px 3px; background: var(--brand); }

.view { overflow-x: clip; padding: 20px 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 1240px; margin: 0 auto; }
.view[data-page='kasir'] { max-width: none; padding: 0; }
.page { max-width: 1200px; margin: 0 auto; }

@media (min-width: 900px) {
  .nav { inset: var(--top-h) auto 0 0; width: var(--rail-w); height: auto; flex-direction: column; gap: 4px; padding: 12px 10px; border-top: 0; border-right: 1px solid var(--line); }
  .nav a { flex: none; height: 64px; border-radius: var(--r); }
  .nav a:hover { color: var(--text); }
  .nav a.active { color: var(--brand); background: var(--brand-soft); }
  .nav a.active::before { display: none; }
  .view { margin-left: var(--rail-w); max-width: none; padding: 28px 32px 40px; }
}

/* =========================== komponen dasar =========================== */
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .titles { flex: 1; min-width: 180px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-xs); }
.card-head { display: flex; align-items: baseline; gap: 10px; padding: 16px 18px 0; }
.card-head h2 { font-size: 15px; font-weight: 650; flex: 1; }
.card-head .meta { color: var(--muted); font-size: 13px; }
.card-body { padding: 16px 18px 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm); text-decoration: none;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { filter: brightness(.94); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--surface); }
.btn.solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn.lg { height: 52px; font-size: 15px; border-radius: var(--r); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm); display: inline-grid; place-items: center; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-2); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--danger); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: var(--r-sm); outline: none;
  border: 1px solid var(--line-strong); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg.i, .input-wrap > .prefix { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-wrap > .prefix { font-weight: 600; }
.input-wrap .input { padding-left: 40px; }
.input-wrap kbd { position: absolute; right: 10px; font: 600 11px/1 Inter, sans-serif; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 4px 6px; }
.input[type='search']::-webkit-search-cancel-button { display: none; }

.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text-2); }
.tab:hover { border-color: var(--line-strong); }
.tab .count { font-size: 11px; color: var(--muted); }
.tab.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.tab.active .count { color: inherit; }

/* pilihan bersegmen: garis tepi, bukan latar abu */
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.segmented button { height: 38px; padding: 0 14px; border: 0; background: transparent; font-size: 13px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button + button { border-left: 1px solid var(--line-strong); }
.segmented button.active { background: var(--brand); color: var(--on-brand); }
.segmented.full { display: grid; grid-template-columns: repeat(3, 1fr); }

/* label status: teks berwarna di latar lembut, atau garis tepi untuk yang netral */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.danger { color: var(--danger); }
.pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* catatan: teks biasa dengan ikon sejajar, tanpa kotak */
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); text-align: left; margin: 0; }
.note svg.i { margin-top: 1px; color: var(--muted); }
.note.warn svg.i { color: var(--warn); }
.note a { font-weight: 600; }
.note .input { margin-top: 6px; height: 34px; font-size: 12px; }

/* keadaan kosong: judul + penjelasan + aksi, tanpa ikon di atas */
.empty { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 36px 16px; }
.empty b { font-size: 15px; }
.empty p { margin: 0; max-width: 300px; color: var(--muted); }
.empty .btn { margin-top: 12px; }

.skeleton { background: var(--surface-2); border-radius: var(--r); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .55; } }

/* daftar baris dengan garis pemisah (dipakai di struk, detail, menu) */
.rows > * { border-bottom: 1px solid var(--line); }
.rows > *:last-child { border-bottom: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.kv > span:first-child { color: var(--muted); }
.kv > span:last-child { font-weight: 600; text-align: right; }

/* =========================== kasir =========================== */
.pos { display: grid; min-height: calc(100dvh - var(--top-h)); }
.catalog { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 96px); min-width: 0; }
.catalog-tools { display: grid; gap: 12px; margin-bottom: 16px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.tile {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden;
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-xs);
  transition: border-color .15s, transform .08s;
}
.tile:hover { border-color: var(--line-strong); }
.tile:active { transform: scale(.98); }
.tile.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.tile:disabled { opacity: .5; cursor: not-allowed; }
.tile-media {
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text); font-size: 24px; font-weight: 700; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.tile-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-info { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.tile-name { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-stock { flex: 1; }
.tile-price { font-weight: 700; font-size: 15px; }
.tile .qty {
  position: absolute; top: 10px; right: 10px; z-index: 1; min-width: 26px; height: 26px; padding: 0 8px;
  display: grid; place-items: center; border-radius: 99px; background: var(--brand); color: var(--on-brand);
  font-size: 13px; font-weight: 700; box-shadow: 0 0 0 3px var(--surface);
}

.order { display: none; }
.order-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.order-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.order-head h2 { font-size: 16px; font-weight: 700; flex: 1; }
.order-items { flex: 1; overflow-y: auto; padding: 0 20px; min-height: 120px; }
.order-items.is-empty { display: grid; place-items: center; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line-name { font-weight: 600; line-height: 1.3; }
.line-unit { color: var(--muted); font-size: 13px; }
.line-sub { font-weight: 700; text-align: right; }
.stepper { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 34px; height: 100%; border: 0; background: transparent; display: grid; place-items: center; color: var(--text-2); }
.stepper button:hover { background: var(--surface-2); }
.stepper span { min-width: 34px; text-align: center; font-weight: 700; line-height: 32px; border-inline: 1px solid var(--line); }
.order-foot { padding: 16px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); display: grid; gap: 10px; background: var(--surface); }
.buyer { display: grid; gap: 8px; padding-bottom: 6px; }
.buyer-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.buyer-label small { font-weight: 500; color: var(--muted); }
.buyer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.buyer .input { height: 40px; padding: 0 10px; }
.sum-row { display: flex; justify-content: space-between; color: var(--muted); }
.sum-row.total { color: var(--text); font-weight: 700; font-size: 15px; align-items: baseline; }
.sum-row.total .num { font-size: 26px; letter-spacing: -.02em; }

.order-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 25;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  border-radius: var(--r-lg); background: var(--text); color: var(--bg); box-shadow: var(--sh-lg); animation: rise .2s ease-out;
}
.order-bar .info { flex: 1; display: grid; line-height: 1.25; }
.order-bar .info small { font-size: 12px; font-weight: 500; }
.order-bar .info b { font-size: 18px; }
.order-bar .btn { height: 44px; background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

@media (min-width: 900px) {
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
  .catalog { padding: 24px 28px 40px; }
  .order { display: block; position: sticky; top: var(--top-h); height: calc(100dvh - var(--top-h)); background: var(--surface); border-left: 1px solid var(--line); }
  .order-bar { display: none; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
}
@media (min-width: 1280px) { .pos { grid-template-columns: minmax(0, 1fr) 420px; } }

/* =========================== sheet / dialog =========================== */
.modal { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 460px; max-height: 94dvh; overflow-y: auto; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--sh-lg); animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 10px auto 0; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 4px; }
.sheet-head .titles { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 18px; font-weight: 700; }
.sheet-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.sheet-body { padding: 12px 20px 20px; display: grid; gap: 16px; }
.sheet-actions { display: flex; gap: 10px; padding: 16px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); }
.sheet-actions .btn { flex: 1; }
@media (min-width: 600px) { .modal { align-items: center; padding: 24px; } .sheet { border-radius: var(--r-xl); } .sheet-grip { display: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

.dialog-wrap { position: fixed; inset: 0; z-index: 90; background: var(--overlay); display: grid; place-items: center; padding: 24px; animation: fade .15s; }
.dialog { width: 100%; max-width: 380px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg); padding: 24px; animation: pop .18s ease-out; }
.dialog h3 { font-size: 17px; margin-bottom: 6px; }
.dialog p { margin: 0 0 20px; color: var(--muted); }
.dialog .actions { display: flex; gap: 10px; }
.dialog .actions .btn { flex: 1; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.form { display: grid; gap: 16px; padding: 16px 20px 20px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-pick { display: flex; gap: 14px; align-items: center; }
.photo-box { width: 88px; height: 88px; border-radius: var(--r); flex: none; overflow: hidden; border: 1px dashed var(--line-strong); color: var(--muted); display: grid; place-items: center; font-size: 12px; text-align: center; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: grid; gap: 8px; justify-items: start; }

/* =========================== tagihan QRIS =========================== */
.pay { padding: 20px 20px calc(20px + var(--safe-b)); display: grid; gap: 16px; }
.pay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pay-head h2 { font-size: 16px; font-weight: 700; }
.pay-head small { display: block; color: var(--muted); font-size: 12px; }
.amount { text-align: center; display: grid; gap: 2px; }
.amount span { color: var(--muted); font-size: 13px; }
.amount b { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
/* QR selalu di atas putih (syarat scan), tanpa bingkai kartu */
.qr { justify-self: center; width: min(280px, 100%); display: grid; gap: 10px; text-align: center; }
.qr img { width: 100%; height: auto; border-radius: var(--r); background: #fff; image-rendering: pixelated; border: 1px solid var(--line); }
.qr-meta { font-size: 13px; color: var(--text-2); }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width .5s linear; }
.progress.low i { background: var(--danger); }
.waiting { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--text-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.pay-actions { display: grid; gap: 8px; }

/* hasil: judul berwarna status, tanpa ikon besar di atas */
.result { text-align: center; display: grid; gap: 4px; padding-top: 4px; }
.result h2 { font-size: 22px; font-weight: 700; }
.result.ok h2 { color: var(--ok); }
.result.warn h2 { color: var(--warn); }
.result p { margin: 0; color: var(--muted); }

.receipt { display: grid; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.receipt-row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--line-strong); margin-top: 4px; padding-top: 12px; }
.receipt-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }

.fullqr { position: fixed; inset: 0; z-index: 85; background: #fff; color: #101828; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; animation: fade .15s; }
.fullqr .fq-store { font-size: 18px; font-weight: 700; }
.fullqr .fq-amt { font-size: clamp(34px, 7vw, 60px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.fullqr img { width: min(86vw, 62vh); height: auto; image-rendering: pixelated; }
.fullqr .fq-hint { font-size: 15px; color: #344054; }
.fullqr .fq-close { position: absolute; top: 16px; right: 16px; background: #fff; border-color: #d0d5dd; color: #101828; }

/* =========================== produk =========================== */
.toolbar { display: grid; gap: 12px; margin-bottom: 16px; }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.thead { display: none; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main .t { min-width: 0; }
.cell-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb { width: 40px; height: 40px; border-radius: 10px; flex: none; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--text); }
.cell-cat, .cell-price, .cell-stock { display: none; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mobile-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; color: var(--muted); font-size: 13px; }
.mobile-meta .price { font-weight: 700; color: var(--text); }
@media (min-width: 760px) {
  .trow { grid-template-columns: minmax(0, 2.2fr) 1fr 1fr 1fr 96px; padding: 12px 18px; }
  .thead { display: grid; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .cell-cat, .cell-price, .cell-stock { display: block; }
  .cell-price { font-weight: 600; }
  .mobile-meta { display: none; }
}

/* =========================== dashboard =========================== */
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r-lg); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { padding: 16px; display: grid; gap: 6px; }
.kpi-label { color: var(--text-2); font-size: 13px; font-weight: 600; }
.kpi-val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.kpi-foot { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 420px) { .kpi-val { font-size: 20px; } }

.dash-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }
.span-all { grid-column: 1 / -1; }

.chart { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-size: 11px; color: var(--muted); text-align: right; }
.chart-y span { transform: translateY(-50%); }
.chart-y span:last-child { transform: translateY(50%); }
.chart-plot { position: relative; height: 200px; }
.chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid i { height: 1px; background: var(--line); }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 4px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; min-width: 0; }
.bar-col .bar { width: 100%; max-width: 30px; border-radius: 5px 5px 2px 2px; background: var(--brand); }
.bar-col:hover .bar { opacity: .8; }
.tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); display: none; z-index: 3; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; pointer-events: none; text-align: left; line-height: 1.4; }
.tip b { display: block; }
.bar-col:hover .tip, .hours div:hover .tip { display: block; }
.bar-col.tl .tip { left: 0; transform: none; }
.bar-col.tr .tip { left: auto; right: 0; transform: none; }
.chart-x { grid-column: 2; display: flex; gap: 4px; margin-top: 8px; }
.chart-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 0; }

.rank-list { display: grid; gap: 14px; }
.rank { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.rank-no { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.rank-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.rank-val { text-align: right; }
.rank-val b { display: block; }
.rank-val small { color: var(--muted); font-size: 12px; }

.hours { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.hours div { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; }
.hours i { display: block; width: 100%; border-radius: 3px 3px 1px 1px; background: var(--brand); min-height: 2px; }
.hours i.zero { background: var(--line); }
.hours-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.peak { margin: 14px 0 0; color: var(--text-2); font-size: 13px; }

.tx-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.tx-row:last-child { border-bottom: 0; }
.tx-items { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { color: var(--muted); font-size: 12px; }
.tx-amt { font-weight: 700; text-align: right; }
.tx-time, .tx-idcol, .tx-row.thead { display: none; }
.tx-row.click { cursor: pointer; }
.tx-row.click:hover { background: var(--bg); }
@media (max-width: 759.98px) {
  .tx-row > .tx-main { grid-column: 1; grid-row: 1 / span 2; }
  .tx-row .tx-amt { grid-column: 2; grid-row: 1; align-self: end; }
  .tx-row .tx-status { grid-column: 2; grid-row: 2; justify-self: end; align-self: start; }
}
@media (min-width: 760px) {
  .tx-row { grid-template-columns: 110px 190px minmax(0, 1fr) 120px 110px; }
  .tx-row .tx-time, .tx-row .tx-idcol { display: block; }
  .tx-row .tx-meta { display: none; }
  .tx-row.thead { display: grid; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .tx-status { justify-self: end; }
}
@media (max-width: 420px) { .hide-xs { display: none; } .page-actions .btn { padding-inline: 12px; } }

/* =========================== PIN =========================== */
.lock { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); overflow-y: auto; }
.pin { width: 100%; max-width: 340px; display: grid; gap: 22px; text-align: center; }
.pin-title h1 { font-size: 22px; font-weight: 700; }
.pin-title p { margin: 4px 0 0; color: var(--muted); }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 14px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); transition: background .12s, border-color .12s; }
.pin-dots i.on { background: var(--brand); border-color: var(--brand); }
.pin-dots.shake { animation: shake .36s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-err { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 20px; margin: -8px 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 60px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; font-weight: 600; display: grid; place-items: center; }
.keypad button:hover { border-color: var(--line-strong); }
.keypad button:active { border-color: var(--brand); color: var(--brand); }
.keypad button.fn { background: transparent; border-color: transparent; font-size: 14px; color: var(--text-2); }
.pin-foot { color: var(--muted); font-size: 12px; }

/* =========================== menu akun =========================== */
.menu-section { padding: 14px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.menu-section > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.menu { display: grid; padding: 6px 8px 10px; border-top: 1px solid var(--line); }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; font-weight: 600; }
.menu button:hover { background: var(--bg); }
.menu .lbl { flex: 1; display: grid; }
.menu .lbl small { color: var(--muted); font-weight: 500; font-size: 12px; }
.menu button.danger { color: var(--danger); }
.menu .chev { color: var(--muted); }
.who { padding: 4px 20px 14px; }
.who b { display: block; font-size: 16px; }
.who small { color: var(--muted); }

/* =========================== toast =========================== */
.toast {
  position: fixed; left: 50%; z-index: 100; bottom: calc(var(--nav-h) + var(--safe-b) + 84px); transform: translate(-50%, 12px);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 10px 16px 10px 12px; border-radius: var(--r);
  background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--sh-lg);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.err .t-dot { background: var(--danger); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* =========================== cetak struk (thermal 58/80 mm atau PDF) =========================== */
#printArea { display: none; }
@media print {
  @page { size: 80mm auto; margin: 4mm; }
  body { background: #fff !important; min-height: 0; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; width: 72mm; color: #000; font: 12px/1.45 ui-monospace, Consolas, 'Courier New', monospace; }
}
.pr-c { text-align: center; }
.pr-big { font-size: 15px; font-weight: 700; }
.pr-row { display: flex; justify-content: space-between; gap: 8px; }
.pr-hr { border-top: 1px dashed #000; margin: 6px 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Halaman Pesanan */
.od-grid { display: grid; gap: 16px; }
.od-list { margin-top: 8px; }
.od-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.od-row:hover { background: var(--bg); }
.od-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.od-who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.od-who small { color: var(--muted); font-size: 12px; }
.od-tag { color: var(--brand); font-size: 12px; font-weight: 600; }
.od-items { color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.od-end { display: grid; gap: 6px; justify-items: end; flex: none; }
.od-empty { margin: 0; padding: 10px 18px 18px; color: var(--muted); font-size: 14px; }
@media (max-width: 560px) {
  .od-row { flex-wrap: wrap; padding: 12px 16px; }
  .od-end { flex-basis: 100%; grid-auto-flow: column; justify-content: space-between; align-items: center; }
}
