[hidden] { display: none !important; }
:root {
  --bg: #f6f4ef; --card: #fff; --ink: #1d232b; --muted: #6b7380; --line: #e4e0d8;
  --brand: #1f3a5f; --brand-ink: #f4efe6; --ok: #2f7d4f; --bad: #b3261e; --warn: #9a6a00;
  --head: #8b1a1a; /* header judul: merah tua */
  --hutang-uang: #e53935; --hutang-uang-bg: #ffe3e0;   /* warning hutang uang: merah cerah */
  --hutang-brg: #f59e0b; --hutang-brg-bg: #fff1c9;     /* warning hutang barang: kuning oranye */
  --r: 12px; --safe-b: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* html merah: celah di atas/bawah layar iPhone (status bar & bug viewport iOS) ikut merah, bukan krem */
html { background: var(--head); }
body { min-height: 100vh; min-height: 100dvh; }
html, body { margin: 0; color: var(--ink); }
body { background: var(--bg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: var(--head); color: #fff; }
header .hl { display: flex; align-items: center; } header .hr { display: flex; justify-content: flex-end; }
header .icon { background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; padding: 4px 8px 4px 2px; }
header #topAction button { background: #fff; color: var(--head); border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
/* Logo teks: BG besar + POS kecil (±1/3), gaya ikon aplikasi */
@font-face { font-family: "BGLogo"; src: url("/fonts/logo.woff2") format("woff2"); font-weight: 900; font-display: block; }
.logo-mark { display: flex; align-items: baseline; gap: 5px; color: #fff; user-select: none;
  font-family: "BGLogo", system-ui, sans-serif; font-weight: 900; }
.logo-mark b { font-size: 30px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo-mark span { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; }
#ptitle { max-width: 720px; margin: 0 auto; padding: 12px 16px 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { padding: 12px 16px calc(84px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 4px; background: var(--head);
  padding: 6px 6px calc(var(--safe-b) + 6px); z-index: 5; }
nav#tabs a { flex: 1; text-align: center; padding: 6px 0 7px; color: #fff; text-decoration: none; font-size: 12px; font-weight: 600; border-radius: 10px; }
nav#tabs a span { display: block; font-size: 20px; }
nav#tabs a.on { background: #fff; color: var(--ink); }
.search { position: sticky; top: calc(env(safe-area-inset-top) + 50px); z-index: 4; background: var(--bg); padding: 4px 0 10px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--brand); border-color: transparent; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); font-weight: 400; margin: 8px 0; }
.check input { width: 22px; height: 22px; flex: none; }
button.btn { width: 100%; margin-top: 16px; padding: 13px; font: inherit; font-weight: 700; border: 0; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); }
button.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
button:disabled { opacity: .5; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px;
  margin-bottom: 10px; color: inherit; text-decoration: none; }
.card h3 { margin: 0 0 2px; font-size: 16px; }
.sub { color: var(--muted); font-size: 13px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.price { font-weight: 700; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.chip.me { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.neg { color: var(--bad); font-weight: 700; }
.chip.me .neg { color: #ffb4ab; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #eee; color: var(--muted); font-weight: 700; }
.badge.off { background: #fbe9e7; color: var(--bad); }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 8px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
dt { color: var(--muted); font-size: 14px; } dd { margin: 0; text-align: right; font-weight: 600; }
.stock { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stock:last-child { border: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.key { word-break: break-all; background: #fff8e1; border: 1px solid #f3d27a; padding: 12px; border-radius: 10px; font-family: ui-monospace, monospace; font-size: 14px; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(80px + var(--safe-b)); background: var(--ink); color: #fff;
  padding: 12px 14px; border-radius: 10px; font-size: 15px; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; z-index: 9; }
#toast.show { opacity: 1; transform: none; } #toast.err { background: var(--bad); }
.login { max-width: 360px; margin: 12vh auto 0; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 10px; }
.grp { font-size: 12px; color: var(--muted); margin: 14px 0 2px; font-weight: 700; text-transform: uppercase; }

/* ---- Penjualan ---- */
button.card.pick { width: 100%; text-align: left; font: inherit; cursor: pointer; }
a.btn { display: block; text-align: center; text-decoration: none; width: 100%; margin-top: 16px; padding: 13px; font-weight: 700;
  border-radius: 10px; background: var(--brand); color: var(--brand-ink); }
a.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.sm, a.btn.sm { width: auto; margin: 0; padding: 8px 14px; font-size: 14px; }
.acts { display: flex; gap: 8px; margin-top: 10px; }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 2px; }
.line h3 { flex: 1; }
.lgrid { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; margin: 8px 0; }
.lgrid2 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; margin-top: 10px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 40px; height: 44px; border: 0; background: var(--bg); font-size: 22px; color: var(--brand); }
.stepper input { width: 64px; border: 0; border-radius: 0; text-align: center; padding: 10px 4px; }
.row.big { font-size: 19px; margin-top: 8px; }
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 10px 6px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
.seg.small { margin-top: 8px; } .seg.small button { padding: 7px 4px; font-size: 13px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.quick button { flex: 1; min-width: 70px; padding: 9px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: inherit; font-size: 14px; }
.badge.ok { background: #e6f4ea; color: var(--ok); } .badge.warn { background: #fff4d6; color: var(--warn); }
.warn { color: var(--warn); } .okc { color: var(--ok); }
.li { padding: 8px 0; border-bottom: 1px solid var(--line); } .li:last-of-type { border: 0; }
.link { background: none; border: 0; color: var(--brand); font: inherit; font-size: 13px; text-transform: none; text-decoration: underline; padding: 0; }
textarea { resize: vertical; }

/* ---- Struk 80mm (area cetak ±72mm) ---- */
.receipt { width: 72mm; max-width: 100%; margin: 0 auto; background: #fff; color: #000; padding: 3mm;
  font: 12px/1.35 ui-monospace, "Courier New", monospace; border: 1px dashed var(--line); }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt .c { text-align: center; } .receipt .big { font-size: 15px; font-weight: 700; }
.receipt .sm { font-size: 11px; }
.receipt .logo { display: block; width: 48mm; max-width: 70%; margin: 0 auto 4px; image-rendering: pixelated; }
.receipt .sk { margin: 6px 0; text-align: center; }
.receipt .sp { height: 1.35em; }
.receipt .kv { display: flex; justify-content: space-between; gap: 8px; } .receipt .kv > :last-child { text-align: right; }
.receipt .sign { display: flex; justify-content: space-between; text-align: center; margin: 12px 0 8px; }
.receipt + .receipt { margin-top: 14px; }
.receipt .sign > div { flex: 1; overflow: hidden; white-space: nowrap; }
@media print {
  @page { size: 80mm auto; margin: 0; }
  html, body { background: #fff; }
  header, nav, #toast, #ptitle, #drawer, #drawerBg, .noprint { display: none !important; }
  main { padding: 0; max-width: none; }
  .receipt { border: 0; width: 100%; max-width: none; padding: 0 1mm; }
  .receipt + .receipt { margin-top: 0; break-before: page; }
}
.hint { margin: 6px 0 10px; }
.chip[data-addr] { cursor: pointer; font: inherit; font-size: 12px; text-align: left; }
.addrs { align-items: center; }

/* ---- POS v2 ---- */
.two { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.two .btn { margin-top: 16px; }
.link.center { display: block; margin: 14px auto 0; }
.lgrid { grid-template-columns: auto auto 1fr; }
.lgrid input[data-f="price"] { text-align: right; font-weight: 600; }
.card.sum { margin-top: 14px; }
.row.disc { align-items: center; margin: 6px 0; }
.dgrid { display: flex; gap: 6px; align-items: center; }
.dgrid input { width: 110px; text-align: right; padding: 8px 10px; }
.seg.mini { padding: 2px; } .seg.mini button { padding: 6px 10px; font-size: 13px; }
.card.ship.off, .card.off { opacity: .55; }
.owed { font-size: 13px; font-weight: 600; margin-top: 6px; }
.badge { vertical-align: middle; }

/* ---- Rekap transaksi & kasir ---- */
.pin { margin: 8px 0 14px; border-radius: var(--r); padding: 4px 8px 2px; }
.pin summary { font-weight: 700; padding: 10px 4px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
.pin summary::-webkit-details-marker { display: none; }
.pin summary::after { content: "▾"; font-size: 18px; line-height: 1; transition: transform .2s; }
.pin[open] summary::after { transform: rotate(180deg); }
.pin.pay { background: var(--hutang-uang-bg); border: 2px solid var(--hutang-uang); }
.pin.pay summary { color: var(--hutang-uang); }
.pin.ship { background: var(--hutang-brg-bg); border: 2px solid var(--hutang-brg); }
.pin.ship summary { color: #b45309; }
.card.hl-pay { border-left: 5px solid var(--hutang-uang); }
.card.hl-ship { border-left: 5px solid var(--hutang-brg); }
.badge.hutang-uang { background: var(--hutang-uang); color: #fff; }
.badge.hutang-brg { background: var(--hutang-brg); color: #fff; }
.card.hl-ok { border-left: 5px solid var(--ok); }
.range { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 6px; align-items: center; }
/* iOS: input date punya lebar bawaan besar → paksa muat kolom, font lebih kecil */
.range input[type=date] { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; max-width: 100%;
  font-size: 15px; padding: 8px 6px; text-align: center; }
.range input[type=date]::-webkit-date-and-time-value { text-align: center; }
/* Ringkasan Transaksi: blok biru tua supaya beda dari kartu nota */
.card.sumbox { background: var(--brand); border-color: var(--brand); color: #fff; }
.card.sumbox dt { color: #c9d6ea; }
.card.sumbox dd { color: #fff; font-weight: 700; }
.quickr { margin: 8px 0 10px; } .quickr .chip { cursor: pointer; font: inherit; font-size: 13px; padding: 6px 12px; }
/* ubah nota / retur / saldo */
.mt8 { margin-top: 8px; } .center { text-align: center; }
a.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.bk select, #payBk select, #bankBox select { margin-top: 8px; }
a.row.li { color: inherit; text-decoration: none; padding: 6px 0; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; padding: 6px 0; }
.row > b:last-child, .chg .row > span:last-child { white-space: nowrap; }
form.bayar .btn.sm { margin-top: 10px; }

/* Menu ☰ */
#drawerBg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
#drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 82vw); background: var(--card); z-index: 21;
  padding: calc(env(safe-area-inset-top) + 14px) 0 calc(var(--safe-b) + 14px); overflow-y: auto;
  transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.2); }
#drawer.open { transform: none; }
#drawer .dh { padding: 4px 18px 12px; border-bottom: 1px solid var(--line); }
#drawer .dsec { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 14px 18px 4px; }
#drawer .ditem { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--ink);
  padding: 12px 18px; text-decoration: none; }
#drawer .ditem.on { color: var(--head); font-weight: 700; background: #fbeeee; }
#drawer .ditem.neg { color: var(--bad); }
/* Barang terlaris */
.lgrid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 9px 8px; font: inherit; color: inherit; min-height: 92px; }
.tile:active { background: #f1ede5; }
.tile.in { border-color: var(--head); box-shadow: inset 0 0 0 1px var(--head); }
.tile .tn { font-size: 13px; font-weight: 600; line-height: 1.25; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tp { font-size: 13px; font-weight: 700; }
.tile .ts { font-size: 11px; color: var(--muted); }
.empty.sm { padding: 18px 10px; }
@media (min-width: 560px) { .lgrid3 { grid-template-columns: repeat(4, 1fr); } }
.sum .row > span:last-child { white-space: nowrap; }
#drawer .dsel { padding: 4px 18px 6px; }

/* ---- Gaya Olsera: menu samping, bar keranjang, kotak foto ---- */
main { padding-bottom: calc(24px + var(--safe-b)); }
body.has-bar main { padding-bottom: calc(96px + var(--safe-b)); }
#drawer .dh { text-align: left; }
.dlogo { width: 64px; height: 64px; border-radius: 16px; background: var(--head); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; margin-bottom: 10px; font-family: "BGLogo", system-ui, sans-serif; font-weight: 900; line-height: 1; }
.dlogo b { font-size: 26px; letter-spacing: -1px; } .dlogo span { font-size: 9px; letter-spacing: 1.5px; margin-top: 2px; }
#drawer .ditem.big { display: flex; align-items: center; gap: 14px; font-size: 17px; padding: 13px 18px; }
#drawer .ditem .di { width: 26px; text-align: center; font-size: 20px; }
#cartBar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; gap: 8px; background: var(--head);
  padding: 8px 10px calc(var(--safe-b) + 8px); }
#cartBar button { border: 0; font: inherit; border-radius: 12px; }
#cbOpen { flex: 1; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.14); color: #fff; padding: 10px 12px; text-align: left; }
.cb-n { min-width: 28px; height: 28px; border-radius: 14px; background: #fff; color: var(--head); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px; padding: 0 6px; }
.cb-t { flex: 1; font-weight: 700; font-size: 17px; } .cb-up { font-size: 12px; opacity: .8; }
#cbPay { background: #fff; color: var(--head); font-weight: 800; padding: 0 18px; font-size: 16px; }
#cbPay:disabled { opacity: .5; }
#sheetBg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 6; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; max-height: 86vh; overflow-y: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 0 16px calc(var(--safe-b) + 90px); transform: translateY(100%); transition: transform .22s;
  box-shadow: 0 -6px 24px rgba(0,0,0,.18); max-width: 720px; margin: 0 auto; }
#sheet.open { transform: none; }
.sh-head { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; }
.sh-head .icon { background: none; border: 0; font-size: 30px; line-height: 1; color: var(--muted); padding: 0 4px; }
.tile .ph { position: relative; display: block; aspect-ratio: 4 / 3; margin: -9px -9px 4px; border-radius: 11px 11px 0 0; overflow: hidden; background: #4e6573; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph .ini { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; font-weight: 300; letter-spacing: 1px; }
.tile .qb { position: absolute; top: 6px; right: 6px; background: var(--head); color: #fff; font-size: 12px; font-weight: 800; border-radius: 10px; padding: 2px 7px; }
.tile { min-height: 0; }
.voidbox { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.voidbox .chips { margin: 8px 0; } .voidbox .chip { font: inherit; font-size: 13px; padding: 6px 10px; }
.voidbox input { margin-bottom: 4px; }

/* ---- Transfer stok ---- */
:root { --luar: #3b5bdb; --luar-bg: #e8eefc; --reg: #7c3aed; --reg-bg: #f3edff; } /* luar regional: biru · satu regional: ungu */
#pickBg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
#pick { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 0 16px calc(var(--safe-b) + 16px); transform: translateY(100%); transition: transform .22s;
  box-shadow: 0 -6px 24px rgba(0,0,0,.25); max-width: 720px; margin: 0 auto; }
#pick.open { transform: none; }
.blk { border-radius: var(--r); padding: 2px 12px 6px; margin: 10px 0; }
.blk h4 { margin: 10px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.blk.reg { background: var(--reg-bg); border: 2px solid var(--reg); } .blk.reg h4 { color: var(--reg); }
.blk.luar { background: var(--luar-bg); border: 2px solid var(--luar); } .blk.luar h4 { color: var(--luar); }
.src { display: grid; grid-template-columns: 1fr 92px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.src:last-child { border: 0; }
.sbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: none; border: 0; font: inherit; color: inherit; text-align: left; padding: 6px 0; }
.src input { text-align: center; }
.trfinfo { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 8px; padding: 7px 10px; border-radius: 8px;
  background: var(--hutang-brg-bg); color: #b45309; font-size: 13px; font-weight: 600; }
.trfinfo.luar { background: var(--luar-bg); color: var(--luar); }
.card.hl-luar { border-left: 5px solid var(--luar); }
.badge.luar { background: var(--luar); color: #fff; }
.card.trf .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
#drawer .ditem.subm { padding-left: 36px; font-size: 15px; }
#drawer .ditem.subm .di { font-size: 16px; }
.dbadge { margin-left: auto; background: var(--hutang-uang); color: #fff; font-size: 12px; font-weight: 800; border-radius: 10px; padding: 1px 8px; }

/* Tombol share WhatsApp */
.btn.wa, button.btn.wa { background: #25d366; color: #fff; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.wa .wai { width: 20px; height: 20px; flex: none; }
.btn.sm.wa .wai { width: 16px; height: 16px; }

/* Perlu tindakan & approval */
.card.todo { display: block; }
.card.age-y { border-left: 5px solid #f59e0b; background: #fffbeb; }
.card.age-r { border-left: 5px solid var(--bad); background: #fef2f2; }
.age { font-size: 12px; color: var(--muted); white-space: nowrap; margin-left: 8px; }
.age-y .age { color: #b45309; font-weight: 700; }
.age-r .age { color: var(--bad); font-weight: 800; }
.lg { font-size: 11px; padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.lg.age-y { background: #fef3c7; color: #b45309; } .lg.age-r { background: #fee2e2; color: var(--bad); }
.rdot { color: var(--bad); font-weight: 800; font-size: 13px; }
.card.chg .acts .btn { flex: 1; }
#menuBtn { position: relative; }
#menuBtn.has-dot::after { content: attr(data-n); position: absolute; top: 0; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  border-radius: 9px; background: #f59e0b; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
#menuBtn.has-dot.urgent::after { background: #fff; color: var(--bad); }

/* Matikan zoom double-tap (sering ke-zoom saat tap + item berulang) */
* { touch-action: manipulation; }
/* Judul sub-halaman + tombol kembali (☰ selalu di kiri atas) */
#ptitle:not([hidden]) { display: flex; align-items: center; gap: 10px; }
#ptitle #ptText { overflow: hidden; text-overflow: ellipsis; }
#back { flex: none; background: var(--card); color: var(--head); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 10px; font: inherit; font-size: 14px; font-weight: 700; }
.needbtn { display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%; margin-top: 10px; padding: 12px 14px; border: 2px solid var(--warn, #b8860b); border-radius: var(--r); background: rgba(184,134,11,.08); font: inherit; font-size: 18px; color: inherit; text-align: left; }
.needbtn b { color: var(--warn, #b8860b); font-size: 22px; }
.needbtn .sub { grid-column: 1 / -1; font-size: 12px; }
.needbtn:active { transform: scale(.98); }
.needbtn:disabled { border-style: dashed; opacity: .7; }
.hrgbox { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; margin: 8px 0; }
.hrgbox .sub { grid-column: 1 / -1; }

/* Pilihan metode bayar (pelunasan): rekening tampil langsung */
.paym { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.paychip input { position: absolute; opacity: 0; pointer-events: none; }
.paychip span { display: block; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 15px; }
.paychip input:checked + span { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }

/* Menu Inventory (dropdown) */
#drawer .ditem.grp .caret { margin-left: 8px; font-size: 14px; color: var(--muted); transition: transform .15s; }
#drawer .ditem.grp:not(.open) .caret { transform: rotate(-90deg); }
#drawer .ditem.grp.open #b-inv { display: none; }
#drawer .ditem[hidden] { display: none; }
/* Pergerakan stok */
.card.mut h3 a { color: inherit; text-decoration: none; }
.card.mut .mq { white-space: nowrap; } .mq.pos { color: #15803d; }
.mb8 { margin-bottom: 8px; }
#drawer .ditem.grp { text-transform: none; letter-spacing: normal; }
#drawer .ditem.grp.on { background: none; }
.card.mut .sub a { color: var(--head); }
.card.mut .msal { float: right; color: var(--head); } .card.mut .msal b { color: inherit; }
.card.mutsum { background: #fff7ed; } .card.mutsum .row { padding: 2px 0; } .card.mutsum b { font-size: 1.1em; white-space: nowrap; }
/* Pergerakan stok — desain sama dengan Backoffice (19 Okt) */
.mtools { position: sticky; top: calc(env(safe-area-inset-top) + 50px); z-index: 4; background: var(--bg); padding: 4px 0 2px; }
body.wide .mtools { top: var(--hh); }
.mrow { display: flex; gap: 8px; } .mpick { position: relative; flex: 1; min-width: 0; } .mpick input { width: 100%; }
.mrow select { flex: 0 0 34%; max-width: 240px; }
.mres { position: absolute; left: 0; right: 0; top: 100%; z-index: 8; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 360px; overflow: auto; }
.mres button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; padding: 9px 12px; cursor: pointer; }
.mres button .sub { display: block; font-size: 12px; }
.mchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 8px 0 6px; } .mchips .chip { flex: none; }
.msep { flex: none; width: 1px; background: var(--line); margin: 2px 4px; }
.mitem { margin: 8px 2px; font-size: 17px; } .lnkbtn { border: 0; background: none; color: var(--head); font: inherit; font-size: 13px; cursor: pointer; }
.mtiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.mtile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; } .mtile .sub { font-size: 12px; }
.mtile b { display: block; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; } .mtile.ok b { color: var(--ok); } .mtile.bad b { color: var(--bad); }
.mtbw { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.mtbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.mtbl th { background: #eef1f4; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 8px 10px; white-space: nowrap; }
.mtbl td { padding: 7px 10px; border-top: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.mtbl td.ket { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.mtbl .r { text-align: right; } .mtbl .mut { color: var(--muted); } .mtbl .pos { color: var(--ok); font-weight: 700; }
.mtbl a { color: var(--head); } .mtbl tr.late td { background: #fdf0ee; } .mtbl .wk small { font-size: inherit; }
.mtbl .sn { display: none; }
.mside { margin-top: 12px; }
.msec { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
.msec h3 { margin: 2px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.msec.alert { background: #fdf0ee; border-color: #f2c6bf; } .msec.alert h3 { color: var(--bad); } .msec a { color: var(--head); }
.mkv { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; border-bottom: 1px dashed var(--line); background: none; font: inherit; color: inherit; padding: 5px 0; cursor: pointer; text-align: left; }
.mkv:last-child { border-bottom: 0; } .mkv.on { font-weight: 700; color: var(--head); }
.mside .btn { margin-top: 0; text-align: center; text-decoration: none; }
body.wide .mgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
body.wide .mside { margin-top: 0; position: sticky; top: calc(var(--hh) + 110px); }
body.wide .mgrid:has(.mside[hidden]) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1300px) { body.wide .mtbl .hw { display: none; } }
@media (max-width: 760px) {
  .mtbl .hn { display: none; } .mtbl .sn { display: table-cell; } .mtbl td.sn small { color: var(--muted); }
  .mtbl td, .mtbl th { padding-left: 7px; padding-right: 7px; } .mtbl td { white-space: normal; } .mtbl td.mut { white-space: nowrap; }
  .mtbl .wk small { display: block; font-size: 12px; }
  .mtiles { grid-template-columns: repeat(2, 1fr); } .mrow { flex-wrap: wrap; } .mrow select { flex: 1 0 100%; max-width: none; }
}

/* =========================================================
   Layout lebar (tablet horizontal / PC, ≥900px): body.wide
   Menu samping selalu tampil, keranjang selalu terbuka di kanan.
   ========================================================= */
#who { display: none; }
body.wide { --hh: 60px; --rail: 96px; --cartw: 420px; }
body.wide header { height: var(--hh); padding: 0 16px 0 0; grid-template-columns: var(--rail) auto 1fr; }
body.wide header .hl { justify-content: center; }
body.wide header .logo-mark { justify-self: start; }
body.wide header .hr { gap: 10px; align-items: center; }
body.wide #who:not([hidden]) { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; padding: 5px 12px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); border-radius: 10px; }
body.wide #who b { font-size: 14px; } body.wide #who span { font-size: 12px; opacity: .85; }
body.wide header #topAction button { padding: 10px 16px; font-size: 15px; }

#rail { display: none; }
body.wide #rail:not([hidden]) { display: flex; flex-direction: column; gap: 2px; position: fixed; top: var(--hh); bottom: 0; left: 0; width: var(--rail);
  padding: 8px; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; z-index: 5; }
#rail a, #rail button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0; border-radius: 12px;
  color: #3a4050; text-decoration: none; font: inherit; font-size: 12px; font-weight: 600; background: none; border: 0; cursor: pointer; }
#rail a.on { background: #fbe9e9; color: var(--head); font-weight: 800; }
#rail i { position: absolute; top: 3px; right: 10px; min-width: 22px; height: 22px; padding: 0 5px; box-sizing: border-box; border-radius: 11px;
  background: #c2410c; color: #fff; font-style: normal; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
#rail i.red { background: var(--bad); }
#rail .sp { flex: 1; min-height: 8px; }

body.wide main { max-width: none; margin: 0 0 0 var(--rail); padding: 16px 20px 32px; }
body.wide main.narrow { max-width: 820px; margin-left: calc(var(--rail) + max(20px, (100vw - var(--rail) - 820px) / 2)); }
body.wide #ptitle { max-width: none; margin: 0 0 0 var(--rail); padding: 14px 20px 0; font-size: 19px; }
body.wide #ptitle:has(+ #rail + main.narrow) { max-width: 820px; margin-left: calc(var(--rail) + max(20px, (100vw - var(--rail) - 820px) / 2)); padding-left: 0; padding-right: 0; }
body.wide .search { top: var(--hh); }
body.wide #toast { left: calc(var(--rail) + 16px); right: auto; bottom: 20px; max-width: 480px; }

/* Jual: keranjang kolom kanan */
body.wide.pos main, body.wide.pos #ptitle { margin-right: var(--cartw); }
body.wide.pos #sheet { position: fixed; top: var(--hh); right: 0; bottom: 0; left: auto; width: var(--cartw); max-width: none; max-height: none; margin: 0;
  border-radius: 0; transform: none; transition: none; box-shadow: none; border-left: 1px solid var(--line); background: #fff; padding: 0 16px 0; z-index: 4; }
body.wide.pos #sheet .sh-head { background: #fff; padding: 14px 0 8px; font-size: 18px; }
body.wide.pos #sheet .sh-head .icon { display: none; }
body.wide.pos #sheet .two { position: sticky; bottom: 0; z-index: 2; background: #fff; margin: 12px -16px 0; padding: 10px 16px 12px;
  border-top: 1px solid var(--line); grid-template-columns: 1fr 1.8fr; box-shadow: 0 -6px 12px rgba(0,0,0,.05); }
body.wide.pos #sheet .two .btn { margin-top: 0; }
body.wide.pos #sheet #pay { background: #15803d; color: #fff; font-size: 19px; font-weight: 800; padding: 16px 10px; }
body.wide.pos #sheet .stepper button { width: 46px; height: 46px; }
body.wide .lgrid3 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
body.wide .tile { padding: 10px; } body.wide .tile .ph { margin: -10px -10px 6px; }
body.wide .tile .tn { font-size: 14px; } body.wide .tile .tp { font-size: 15px; } body.wide .tile .ts { font-size: 12px; }
.guide { display: none; }
body.wide .guide { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 10px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; font-size: 14px; color: #3a4050; }
.guide span { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.guide i { width: 26px; height: 26px; border-radius: 13px; background: var(--head); color: #fff; font-style: normal; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; }
.guide b { color: #9aa0ac; }

/* Daftar kartu jadi beberapa kolom */
body.wide :is(#list, #alist, #tdone, #hist) { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 14px; align-items: start; }
body.wide :is(#list, #alist, #tdone, #hist) > :not(.card) { grid-column: 1 / -1; }
/* Tugas & transfer: kelompok jadi kolom (kanban) */
body.wide :is(#tlist, #tpin) { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; align-items: start; }
body.wide :is(#tlist, #tpin) > .pin { margin: 0; }
body.wide :is(#tlist, #tpin) > :not(.pin) { grid-column: 1 / -1; }
body.wide .card.todo .row b { font-size: 15px; }

/* Tombol & isian lebih besar untuk layar sentuh lebar */
body.wide button.btn, body.wide a.btn { padding: 15px; font-size: 16px; }
body.wide .seg button { padding: 12px 6px; }
@media print { body.wide main, body.wide main.narrow { margin: 0; max-width: none; } #rail, #who { display: none !important; } }
body.wide .tile .ph { aspect-ratio: 16 / 9; }

/* ---- Penanda "harus ditekan": kedip lembut ---- */
@keyframes bgPulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(194,65,12,.55); } 50% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(194,65,12,0); } }
@keyframes bgFlashRed { 0%, 100% { background: #fef2f2; } 50% { background: #fecaca; } }
@keyframes bgFlashWarn { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } 50% { box-shadow: 0 0 0 3px rgba(245,158,11,.7); } }
@keyframes bgBump { 0% { transform: scale(1); } 35% { transform: scale(1.06); filter: brightness(1.15); } 100% { transform: scale(1); } }
#rail i { animation: bgPulse 1.8s ease-in-out infinite; }
#menuBtn.has-dot::after { animation: bgPulse 1.8s ease-in-out infinite; }
.card.age-r { animation: bgFlashRed 2.2s ease-in-out infinite; }
.trfinfo.attn { animation: bgFlashWarn 1.6s ease-in-out infinite; }
.needbtn:not(:disabled) { animation: bgFlashWarn 1.6s ease-in-out infinite; }
.bump { animation: bgBump .45s ease-out; }
@media (prefers-reduced-motion: reduce) { #rail i, #menuBtn.has-dot::after, .card.age-r, .trfinfo.attn, .needbtn, .bump { animation: none !important; } }

/* Transfer: tombol buat baru biru & jarak ke kotak notifikasi */
#tmNew { display: block; text-align: center; margin-bottom: 18px; }

/* Slider pilihan (plat mobil, sopir) — geser ke samping, tap untuk pilih (20 Okt) */
.hs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.hs::-webkit-scrollbar { display: none; }
.hs button { flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font: inherit; font-size: 14px; color: inherit; text-align: left; }
.hs button b { font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
.hs button small { font-size: 11px; color: var(--muted); white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.hs button.on { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.hs button.on small { color: inherit; opacity: .85; }

/* Tarik ke bawah untuk muat ulang (20 Okt) */
#ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px); z-index: 60; transform: translate(-50%, -50px); opacity: 0;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #fff; color: #333; font-size: 14px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,.18); pointer-events: none; }
#ptr.anim { transition: transform .25s, opacity .25s; }
#ptr .ptr-ic { display: inline-block; font-size: 16px; transition: transform .15s; }
#ptr.ready { color: var(--ok); }
#ptr.spin .ptr-ic { animation: ptrspin .8s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }

/* ---- Stok opname (hitung buta) ---- */
.opbar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0 4px; }
.opbar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }
a.card.opcard { display: block; color: inherit; text-decoration: none; }
.badge.ok { background: #e3f3e8; color: var(--ok); } .badge.neg { background: #fde8e6; color: var(--bad); } .badge.age-y { background: #fff1c9; color: #7a5300; }
.oprow { padding: 10px 12px; cursor: pointer; }
.oprow.done { background: #f3faf5; } .oprow.ulang { background: #fff8e1; border-color: #f3d27a; }
.ophd { display: flex; align-items: center; gap: 10px; }
.ophd .ph { width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--bg); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.ophd .ph img { width: 100%; height: 100%; object-fit: cover; } .ophd .ph .ini { font-weight: 800; color: var(--muted); font-size: 14px; }
.opnm { flex: 1; min-width: 0; } .opnm b { display: block; }
.opq { text-align: right; min-width: 64px; } .opq b { font-size: 20px; display: block; line-height: 1.1; color: var(--ok); }
.opin { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); cursor: default; }
.opinrow { gap: 8px; margin-top: 6px; } .opinrow input { flex: 1; font-size: 22px; font-weight: 700; text-align: center; padding: 10px; }
.opinrow .btn { padding: 12px 18px; font-size: 16px; } .opinrow input::placeholder { font-size: 16px; font-weight: 400; }
.sub.warn { color: var(--warn); font-weight: 600; }
body.wide #orows { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 12px; align-items: start; }
body.wide #orows .grp { grid-column: 1 / -1; }
