/* brand: Roti Anak Puri (@rotianakpuri logo): red #C20001 + cream #F7E5CD. No brown. */
:root{--bg:#fdf7ee;--card:#fff;--ink:#2a2523;--mute:#6f6865;--brand:#c20001;--brand-dk:#9b0001;--brand-lt:#f3c2bd;--cream:#f7e5cd;--line:#eedfcb;
  --red:#d32f2f;--redbg:#fde3df;--yel:#b7791f;--yelbg:#fdf1d6;--grn:#2e7d4f;--grnbg:#e1f3e7;--blue:#2f5aa8}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);font:18px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  -webkit-user-select:none;user-select:none;overscroll-behavior:none}
input,textarea{-webkit-user-select:text;user-select:text}
button{font:inherit;cursor:pointer;touch-action:manipulation}
.hidden{display:none!important}
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:12px;padding:10px 16px;padding-top:max(10px,env(safe-area-inset-top));
  background:linear-gradient(135deg,var(--brand),var(--brand-dk));color:#fff8ee;flex-wrap:wrap}
.top .brand{font-weight:800;font-size:21px;white-space:nowrap}
.top .sp{flex:1}
.top .meta{font-size:14px;opacity:.92;text-align:right;line-height:1.25}
.seg{display:inline-flex;background:rgba(255,255,255,.18);border-radius:14px;padding:4px;gap:4px}
.seg button{border:0;background:transparent;color:#fff;font-size:19px;font-weight:700;padding:10px 22px;border-radius:10px;min-height:48px}
.seg button.on{background:var(--cream);color:var(--brand)}
.seg.light{background:var(--cream)}.seg.light button{color:var(--brand)}.seg.light button.on{background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.15)}
.stick{position:sticky;top:0;z-index:20}
.stick .top{position:static}
.tabs{display:flex;gap:8px;padding:10px 16px 0;background:var(--bg);overflow-x:auto}
.tabs button{border:0;background:var(--cream);color:var(--brand);font-weight:700;font-size:18px;padding:12px 20px;border-radius:14px 14px 0 0;min-height:52px;white-space:nowrap}
.tabs button.on{background:#fff;box-shadow:0 -1px 3px rgba(0,0,0,.06)}
main{padding:0 16px 120px}
.panel{background:#fff;border-radius:0 16px 16px 16px;padding:16px;min-height:60vh}
.btn{border:1px solid var(--line);background:#fff;color:var(--brand);border-radius:14px;padding:12px 18px;font-weight:700;min-height:52px;font-size:18px}
.btn.big{font-size:22px;padding:16px 26px;min-height:64px}
.btn.go{background:var(--grn);color:#fff;border-color:var(--grn)}
.btn.warn{background:var(--yelbg);color:#7a4f0c;border-color:#f0d9a6}
.btn.danger{color:var(--red);border-color:#f2c4bd}
.btn.pri{background:var(--brand);color:#fff;border-color:var(--brand)}
.btn:disabled{opacity:.45}
.mute{color:var(--mute)}.small{font-size:15px}.tiny{font-size:13.5px}
.note{background:#fff7ea;border-left:5px solid var(--brand);padding:10px 14px;border-radius:10px;margin:0 0 12px;font-size:16px}
.chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.chip{border-radius:999px;padding:6px 14px;font-weight:700;font-size:16px}
.c-red{background:var(--redbg);color:var(--red)}.c-yellow{background:var(--yelbg);color:#8a5a0c}.c-green{background:var(--grnbg);color:var(--grn)}
.plist{display:grid;grid-template-columns:1fr;gap:10px}
@media(min-width:1000px){.plist{grid-template-columns:1fr 1fr}}
.prow{border:1px solid var(--line);border-left:10px solid #ccc;border-radius:14px;padding:12px 14px;background:#fffdf9}
.prow.red{border-left-color:var(--red);background:#fff8f7}.prow.yellow{border-left-color:#e0a526;background:#fffcf3}.prow.green{border-left-color:var(--grn)}
.prow .nm{font-weight:800;font-size:20px;display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.prow .adv{font-size:19px;font-weight:700;margin:6px 0;color:var(--ink)}
.prow.red .adv{color:var(--red)}.prow.yellow .adv{color:#8a5a0c}
.prow .nums,.sheet .nums,.slot .nums{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:15.5px;color:var(--mute)}
.prow .nums b,.sheet .nums b,.slot .nums b{color:var(--ink)}
.prow .acts{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.dot{display:inline-block;width:14px;height:14px;border-radius:50%;margin-right:6px;vertical-align:middle}
.d-red{background:var(--red)}.d-yellow{background:#e0a526}.d-green{background:var(--grn)}
.search{width:100%;font-size:20px;padding:14px 16px;border:2px solid var(--line);border-radius:14px;margin-bottom:12px;background:#fff}
.cat h3{margin:14px 0 8px;color:var(--brand);font-size:19px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px}
.pbtn{border:2px solid var(--line);background:#fffdf9;border-radius:16px;padding:12px;min-height:96px;text-align:left;display:flex;flex-direction:column;justify-content:space-between}
.pbtn:active{transform:scale(.98);background:var(--cream)}
.pbtn .n{font-weight:800;font-size:18px;line-height:1.2;color:var(--ink)}
.pbtn .s{font-size:14.5px;color:var(--mute);margin-top:6px}
.pbtn.red{border-color:#efb7af}.pbtn.yellow{border-color:#f0d9a6}
.sheet-bg{position:fixed;inset:0;background:rgba(30,18,18,.45);z-index:50;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:#fff;width:min(720px,100%);border-radius:24px 24px 0 0;padding:20px 22px calc(24px + env(safe-area-inset-bottom));max-height:92vh;overflow:auto}
@media(min-height:700px) and (min-width:700px){.sheet-bg{align-items:center}.sheet{border-radius:24px}}
.sheet h2{margin:0 0 4px;font-size:25px}
.stepper{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid var(--line)}
.stepper .l{font-size:18px;font-weight:700}
.stepper .ctl{display:flex;align-items:center;gap:10px}
.stepper button{width:68px;height:64px;border-radius:16px;border:2px solid var(--line);background:var(--cream);font-size:32px;font-weight:800;color:var(--brand)}
.stepper .v{min-width:90px;text-align:center;font-size:32px;font-weight:800}
.stepper input.v{border:2px solid var(--line);border-radius:12px;padding:6px;width:110px;font:inherit;font-size:30px;font-weight:800}
.total{font-size:22px;margin:14px 0;text-align:center}
.toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom));transform:translateX(-50%);background:#2a2523;color:#fff;
  padding:14px 18px;border-radius:16px;z-index:60;display:flex;gap:14px;align-items:center;font-size:18px;box-shadow:0 6px 20px rgba(0,0,0,.25);max-width:92vw}
.toast button{background:#fff;color:#2a2523;border:0;border-radius:10px;padding:10px 14px;font-weight:800}
table{border-collapse:collapse;width:100%;font-size:17px}
th,td{padding:10px 8px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
th{color:var(--mute);font-size:14.5px;font-weight:600}
td.r,th.r{text-align:right}
.login{max-width:420px;margin:6vh auto;text-align:center;padding:0 16px}
.login h1{color:var(--brand);margin:0 0 6px;font-size:30px}
.pins{display:flex;justify-content:center;gap:16px;margin:22px 0}
.pins i{width:22px;height:22px;border-radius:50%;border:3px solid var(--brand);display:block}
.pins i.f{background:var(--brand)}
.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
.keypad button{height:84px;border-radius:20px;border:2px solid var(--line);background:#fff;font-size:34px;font-weight:700;color:var(--ink)}
.keypad button:active{background:var(--cream)}
.err{color:var(--red);font-weight:700;min-height:26px;margin-top:10px}
.stale{background:var(--redbg);color:var(--red);padding:2px 8px;border-radius:8px;font-weight:700}
/* staff gate (shared by every station): enroll device -> who are you? -> PIN */
.gate{position:fixed;inset:0;z-index:40;background:var(--bg);overflow:auto;padding:max(20px,env(safe-area-inset-top)) 16px 40px}
.gate h1{color:var(--brand);margin:8px 0 4px;font-size:30px;text-align:center}
.gate .sub{text-align:center;color:var(--mute);margin-bottom:18px}
.staff{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;max-width:980px;margin:0 auto}
.staff button{min-height:96px;border-radius:18px;border:2px solid var(--line);background:#fff;font-size:20px;font-weight:800;color:var(--ink);padding:12px}
.staff button .av{display:block;width:44px;height:44px;line-height:44px;border-radius:50%;margin:0 auto 6px;background:var(--cream);color:var(--brand);font-size:20px}
.staff button.here{border-color:var(--brand-lt)}.staff button.locked{opacity:.5}
.staff .grp{grid-column:1/-1;color:var(--mute);font-size:15px;margin-top:6px}
.gate form{max-width:480px;margin:0 auto;display:grid;gap:12px}
.gate input,.gate select,.field{font:inherit;font-size:20px;padding:14px;border:2px solid var(--line);border-radius:14px;background:#fff;width:100%}
.err{color:var(--red);min-height:26px;margin-top:12px;font-weight:700;text-align:center}
.who{background:rgba(255,255,255,.2);color:#fff;border-color:transparent}
.btn.rej{background:#fff1ef;color:var(--red);border-color:#f2c4bd}
.opts{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 4px}
.opts button{border:2px solid var(--line);background:#fff;border-radius:12px;padding:10px 16px;font-weight:700;font-size:17px;min-height:50px;color:var(--ink)}
.opts button.on{background:var(--brand);border-color:var(--brand);color:#fff}
.lbl{font-weight:700;margin-top:14px;font-size:16px;color:var(--mute)}
.thumb{max-width:120px;max-height:90px;border-radius:10px;vertical-align:middle;margin-left:8px}
.toggle{display:flex;align-items:center;gap:12px;padding:12px 0;font-size:17px}
.toggle input{width:30px;height:30px}
.plist2 button{display:block;width:100%;text-align:left;border:0;border-bottom:1px solid var(--line);background:#fff;padding:14px 8px;font-size:18px;font-weight:700;color:var(--ink)}
.prow .acts .btn{font-size:16px;padding:10px 12px;min-height:50px}
/* nav links between station pages (only pages the user may open) */
.btn.nav{display:inline-flex;align-items:center;text-decoration:none;margin-right:6px}
/* dough page */
.slot{background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px 18px;margin-bottom:12px}
.slot.logged{border-color:var(--grn)}
.slot.rec{border:2px solid var(--brand);box-shadow:0 2px 10px rgba(0,0,0,.06)}
.slot .hd{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-size:22px;font-weight:800}
.slot .big:not(.btn){font-size:34px;font-weight:900;color:var(--brand)}
.why{margin:10px 0 0 0;padding-left:20px}
.why li{margin:3px 0}
.kgopts{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.kgopts button{min-width:76px;min-height:60px;font-size:22px;font-weight:800;border-radius:14px;border:1px solid var(--line);background:#fff;color:var(--brand)}
.kgopts button.on{background:var(--brand);color:#fff;border-color:var(--brand)}
.kgopts button.sug{outline:3px dashed var(--grn);outline-offset:2px}
.split td{padding:6px 4px}
.split .ctl button{min-width:44px;min-height:44px}
.badge{display:inline-block;padding:2px 8px;border-radius:10px;font-size:13px;font-weight:700;background:var(--cream)}
.badge.warn{background:#fde8c8;color:#8a4b00}
.perm td,.perm th{text-align:center;padding:6px}
.perm td:first-child,.perm th:first-child{text-align:left}
/* stock page (closing opname, raw-material opname, warehouse) */
.bar{position:fixed;left:0;right:0;bottom:0;z-index:30;background:#fff;border-top:2px solid var(--line);padding:12px 16px calc(12px + env(safe-area-inset-bottom));display:flex;gap:12px;align-items:center;flex-wrap:wrap;box-shadow:0 -4px 14px rgba(0,0,0,.06)}
.bar .sp{flex:1}
.crow{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center;padding:10px 4px;border-bottom:1px solid var(--line)}
.crow .nm{font-weight:800;font-size:19px}
.crow.done .nm::before{content:"✓ ";color:var(--grn)}
.cnt{display:flex;align-items:center;gap:8px}
.cnt button{width:56px;height:56px;border-radius:14px;border:2px solid var(--line);background:var(--cream);font-size:28px;font-weight:800;color:var(--brand)}
.cnt input{width:96px;height:56px;border:2px solid var(--line);border-radius:12px;text-align:center;font:inherit;font-size:26px;font-weight:800;background:#fff}
.cnt input:placeholder-shown{background:#fffaf3}
.cnt .w{font-size:14px;color:var(--mute);text-align:center;line-height:1.1}
.cnt input.waste{width:76px;font-size:20px;height:48px;border-color:var(--brand-lt)}
.vneg{color:var(--red);font-weight:800}.vpos{color:var(--blue);font-weight:800}
tr.flag td{background:#fff3f2}
.catH{margin:16px 0 4px;color:var(--brand);font-size:18px}
.kpi{display:flex;gap:10px;flex-wrap:wrap;margin:8px 0 14px}
.kpi div{background:var(--cream);border-radius:14px;padding:10px 14px;min-width:130px}
.kpi b{display:block;font-size:24px}
.field.sm{font-size:17px;padding:10px 12px}
/* offline banner (shared/offline.js) */
.offbn{position:fixed;left:12px;bottom:84px;z-index:60;max-width:440px;background:#2a2523;color:#fff;border-radius:14px;padding:10px 14px;font-size:15px;line-height:1.35;box-shadow:0 6px 20px rgba(0,0,0,.25);cursor:pointer}
.offbn.down{background:#9b0001}
.offbn.hidden{display:none}
.badge.q{background:#2a2523;color:#fff}
/* fast entry (opname malam / closing): big boxes, current row highlighted, Enter/▶ = next */
.fast .crow .cnt input[data-f=c]{width:120px;height:64px;font-size:30px}
.fast .crow .cnt button{width:60px;height:64px}
.fast .crow{padding-left:10px;padding-right:6px}
.fast .crow.cur{background:#fff3e6;border-radius:12px;box-shadow:inset 4px 0 0 var(--brand)}
.cnt .u{min-width:44px}
.paper{display:inline-flex;gap:8px;flex-wrap:wrap}.paper .btn{text-decoration:none;display:inline-flex;align-items:center}
.g2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.g21{display:grid;grid-template-columns:2fr 1fr;gap:10px}
.g4{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:8px}
/* phones (≈ 360–430 px wide): same pages, stacked; inputs stay ≥16px so iOS doesn't zoom */
@media(max-width:600px){
  body{font-size:16px}
  .top{gap:6px 8px;padding:8px 10px;padding-top:max(8px,env(safe-area-inset-top))}
  .top .brand{font-size:18px}.top .meta{display:none}
  .seg button{font-size:16px;padding:6px 12px;min-height:40px}
  .top .btn{min-height:40px;padding:6px 10px;font-size:14px}.btn.nav{margin-right:2px}
  #navLinks{display:flex;gap:4px;overflow-x:auto;max-width:100%;order:9;flex-basis:100%}
  .tabs{padding:6px 8px 0;gap:4px}.tabs button{font-size:15px;padding:9px 12px;min-height:44px}
  main{padding:0 6px 150px}.panel{padding:10px;border-radius:0 12px 12px 12px}
  .btn{font-size:16px;padding:10px 12px;min-height:48px}.btn.big{font-size:18px;padding:12px 16px;min-height:56px}
  .crow{grid-template-columns:1fr;gap:6px;padding:10px 2px}
  .crow .nm{font-size:17px}
  .cnt{justify-content:flex-start;flex-wrap:wrap}
  .cnt button{width:52px;height:52px}.cnt input{width:88px;height:52px;font-size:24px}
  .fast .crow .cnt input[data-f=c]{flex:1;min-width:100px;width:auto;height:60px;font-size:28px}
  .fast .crow .cnt button{width:58px;height:60px}
  .cnt .w{display:flex;align-items:center;gap:6px}.cnt .w br{display:none}
  .bar{padding:8px 8px calc(8px + env(safe-area-inset-bottom));gap:6px 8px}
  .bar .btn.big{flex:1;min-height:52px;font-size:17px;padding:10px}.bar>div:first-child{flex-basis:100%}.bar .sp{display:none}
  .kpi div{min-width:0;flex:1;padding:8px 10px}.kpi b{font-size:20px}
  table{font-size:15px}th,td{padding:7px 5px}
  .panel table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .g2,.g21{grid-template-columns:1fr}.g4{grid-template-columns:1fr 1fr}
  .slot .hd .btn{min-height:42px}
  .slot{padding:12px}.slot .hd{font-size:18px;flex-wrap:wrap}
  .sheet{padding:16px 14px calc(18px + env(safe-area-inset-bottom))}.sheet h2{font-size:21px}
  .note{font-size:14.5px;padding:8px 10px}
  .search{font-size:17px;padding:11px 12px}
  .offbn{left:8px;right:8px;bottom:120px;max-width:none}
  .opts button{padding:8px 12px;font-size:15px;min-height:46px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr))}
  .stepper button{width:56px;height:56px}.stepper .v{font-size:26px;min-width:70px}.stepper input.v{width:90px;font-size:26px}
}
