:root {
  --brand: #F97316;
  --brand-dark: #C2570C;
  --brand-soft: #FFF1E6;
  --ink: #1F2933;
  --muted: #6B7785;
  --line: #E3E8EE;
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --ok: #15803D;
  --bad: #B91C1C;
  --radius: 14px;
  --nav-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }

/* ---------- tata letak ---------- */
.shell { max-width: 760px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--brand); color: #fff; }
.top .nama { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top select { flex: 1; min-width: 0; background: transparent; color: #fff; border: 0; font-weight: 700; font-size: 17px; }
.top select option { color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .22); color: #fff; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #86EFAC; }
.pill.off::before { background: #FDE68A; }
.view { padding: 14px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; max-width: 760px; margin: 0 auto; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav button { flex: 1; height: var(--nav-h); border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.nav button.on { color: var(--brand-dark); }
.nav .ic { font-size: 20px; line-height: 1; }

/* ---------- elemen umum ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.sp { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.bold { font-weight: 700; }
.right { text-align: right; }
.inp { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.inp:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
label.f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.f .inp { font-weight: 400; color: var(--ink); }
.btn { min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 700; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:disabled { opacity: .45; }
.btn.bad { color: var(--bad); border-color: #F3C4C4; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--muted); }
.badge.bad { background: #FBE4E4; color: var(--bad); }
.badge.ok { background: #DCF3E4; color: var(--ok); }
.sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ---------- kasir ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.pcard { position: relative; text-align: left; padding: 12px; min-height: 92px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.pcard:active { background: var(--brand-soft); }
.pcard .pn { font-weight: 700; font-size: 15px; line-height: 1.25; word-break: break-word; }
.pcard .pp { color: var(--brand-dark); font-weight: 700; }
.pcard .ps { font-size: 12px; color: var(--muted); }
.pcard .ps.low { color: var(--bad); font-weight: 700; }
.pcard .q { position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--brand); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.cartbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 25; max-width: 760px; margin: 0 auto; padding: 10px 14px; }
.cartbar .btn { width: 100%; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 6px 18px rgba(194, 87, 12, .35); min-height: 54px; font-size: 17px; }

/* ---------- sheet ---------- */
.ov { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 20px 20px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 12px; align-content: start; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 18px; }
.sheet .x { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; line-height: 1; }
.line { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.line.tot { font-size: 20px; font-weight: 800; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 18px; font-weight: 800; }
.qty span { min-width: 30px; text-align: center; font-weight: 700; }
.big { font-size: 28px; font-weight: 800; }
.kembali { background: var(--brand-soft); border-radius: var(--radius); padding: 14px; text-align: center; }
.kembali .big { color: var(--brand-dark); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; }
.stat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat .card .v { font-size: 20px; font-weight: 800; }
.stat .card .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; }
.li:last-child { border-bottom: 0; }

/* ---------- login ---------- */
.login { max-width: 420px; margin: 0 auto; padding: 56px 20px 32px; text-align: center; display: grid; gap: 18px; justify-items: center; }
.login .logo { width: 84px; height: 84px; border-radius: 22px; }
.login h1 { font-size: 26px; }
.login p { margin: 0; color: var(--muted); }
.gbtn { min-height: 44px; display: grid; place-items: center; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 90px); transform: translateX(-50%); z-index: 90; max-width: 90vw; padding: 10px 16px; border-radius: 12px; background: #111827; color: #fff; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; }
#toast.err { background: var(--bad); }

/* ---------- struk (cetak) ---------- */
#struk { display: none; }
@media print {
  body > *:not(#struk) { display: none !important; }
  #struk { display: block; width: 58mm; margin: 0; padding: 2mm; color: #000; font-family: "Courier New", monospace; font-size: 11px; line-height: 1.3; }
  #struk .c { text-align: center; }
  #struk .b { font-weight: 700; }
  #struk .ln { display: flex; justify-content: space-between; gap: 6px; }
  #struk hr { border: 0; border-top: 1px dashed #000; margin: 4px 0; }
  @page { margin: 0; }
}
