/* Bar screen + voucher scan (bar.js). Apple-like: ink #111111, text #1D1D1F, muted #6E6E73, cards #F5F5F7, hairlines #E5E5EA;
   green = served, red only for real problems (already served, cancelled). No orange or amber anywhere. Dark = the KDS "Graphite". */
:root,[data-theme="light"]{
  --b-screen:#F5F5F7; --b-card:#FFFFFF; --b-ink:#111111; --b-text:#1D1D1F; --b-muted:#6E6E73; --b-line:#E5E5EA; --b-quiet:#F5F5F7; --b-quiet-2:#EBEBF0;
  --b-btn:#111111; --b-btn-ink:#FFFFFF; --b-ok:#1A7A3E; --b-ok-soft:#E8F5EC; --b-err:#B3261E; --b-err-soft:#FDECEC; --b-neutral:#1D1D1F;
  --b-shadow:0 1px 2px rgba(0,0,0,.04),0 6px 20px rgba(0,0,0,.05); --b-toast:#1D1D1F; --b-toast-ink:#FFFFFF;
}
[data-theme="dark"]{
  --b-screen:#111214; --b-card:#1C1D21; --b-ink:#F4F4F5; --b-text:#F4F4F5; --b-muted:#9A9CA3; --b-line:#2C2E34; --b-quiet:#26282D; --b-quiet-2:#303238;
  --b-btn:#303238; --b-btn-ink:#F4F4F5; --b-ok:#5DBB90; --b-ok-soft:#1E2B25; --b-err:#E5484D; --b-err-soft:#341C1E; --b-neutral:#303238;
  --b-shadow:none; --b-toast:#F4F4F5; --b-toast-ink:#111214;
}
body.barmode #screen{display:none}
body.barmode{background:var(--b-screen);color:var(--b-text)}
.bar{--s:var(--bscale,1);height:100vh;height:100dvh;display:flex;flex-direction:column;font-family:var(--font-ui);color:var(--b-text);background:var(--b-screen);font-size:calc(16px * var(--s))}
.bar svg{display:block;flex:none}
:where(.bar) button{font:inherit;color:inherit;border:0;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent}

/* header */
.bh{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 24px;min-height:76px;flex:none;border-bottom:1px solid var(--b-line);background:var(--b-screen)}
.bl,.br{display:flex;align-items:center;gap:14px;min-width:0}
.bic{width:44px;height:44px;border-radius:12px;background:var(--b-ink);color:var(--b-btn-ink);display:flex;align-items:center;justify-content:center;flex:none}
[data-theme="dark"] .bic{background:var(--b-quiet);color:var(--b-ink)}
.bic svg{width:24px;height:24px}
.btt{display:flex;flex-direction:column;min-width:0;line-height:1.15}
.btt b{font-size:calc(22px * var(--s));font-weight:700;letter-spacing:-.02em;color:var(--b-ink)}
.btt span{font-size:calc(14px * var(--s));color:var(--b-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bseg{display:flex;gap:4px;padding:4px;border-radius:999px;background:var(--b-quiet-2)}
.bseg button{display:flex;align-items:center;gap:8px;min-height:52px;padding:0 22px;border-radius:999px;font-size:calc(17px * var(--s));font-weight:650;color:var(--b-muted)}
.bseg button svg{width:20px;height:20px}
.bseg button.on{background:var(--b-card);color:var(--b-ink);box-shadow:0 1px 4px rgba(0,0,0,.12)}
.bseg i{font-style:normal;min-width:26px;height:26px;padding:0 8px;border-radius:999px;background:var(--b-ink);color:var(--b-screen);font-size:14px;display:inline-flex;align-items:center;justify-content:center}
.bconn{display:flex;align-items:center;gap:8px;font-size:calc(15px * var(--s));color:var(--b-muted);white-space:nowrap}
.bconn i{width:9px;height:9px;border-radius:50%;background:var(--b-ok)}
.bconn.off i{background:var(--b-muted)}
.bclock{font-size:calc(22px * var(--s));font-weight:700;letter-spacing:-.02em;color:var(--b-ink);font-variant-numeric:tabular-nums}
.bgear{width:52px;height:52px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--b-quiet-2);color:var(--b-ink)}
.bgear svg{width:24px;height:24px}

/* orders + live totals */
.bmain{flex:1;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch;padding:18px 24px 28px}
.bsum{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap;margin-bottom:12px}
.bsum b{font-size:calc(26px * var(--s));font-weight:700;letter-spacing:-.02em;color:var(--b-ink)}
.bsum span{font-size:calc(16px * var(--s));color:var(--b-muted)}
.btot{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:18px}
.btot::-webkit-scrollbar{display:none}
.btot .lab,.bdone .lab,.blast .lab{font-size:calc(13px * var(--s));font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--b-muted);white-space:nowrap;margin-inline-end:6px}
.btot .it{display:inline-flex;align-items:baseline;gap:8px;white-space:nowrap;min-height:52px;padding:10px 18px;border-radius:16px;background:var(--b-card);box-shadow:0 0 0 1px var(--b-line);font-size:calc(19px * var(--s));font-weight:600;color:var(--b-text)}
.btot .it b{font-size:calc(26px * var(--s));font-weight:750;letter-spacing:-.02em;color:var(--b-ink);font-variant-numeric:tabular-nums}
.btot .it em{font-style:normal;color:var(--b-muted)}
.bgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(320px * var(--s)),1fr));gap:16px;align-items:start}
.bo{background:var(--b-card);border-radius:22px;box-shadow:0 0 0 1px var(--b-line),var(--b-shadow);padding:16px 16px 16px;display:flex;flex-direction:column;gap:10px}
.boh{display:flex;align-items:center;gap:10px}
.bno{font-size:calc(34px * var(--s));font-weight:750;letter-spacing:-.04em;line-height:1;color:var(--b-ink);font-variant-numeric:tabular-nums}
.btest{font-size:12px;font-weight:700;letter-spacing:.06em;padding:4px 8px;border-radius:6px;background:var(--b-quiet-2);color:var(--b-muted)}
.bmeta{margin-inline-start:auto;display:flex;flex-direction:column;align-items:flex-end;gap:4px}
.bdn{display:flex;align-items:center;gap:6px;font-size:calc(14px * var(--s));color:var(--b-muted)}
.bdn svg{width:16px;height:16px}
.bago{font-size:calc(18px * var(--s));font-weight:700;color:var(--b-ink);font-variant-numeric:tabular-nums}
.bleft{font-size:calc(14px * var(--s));color:var(--b-muted);margin-top:-4px}
.bus{display:flex;flex-direction:column;gap:8px}
.bu{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:max(56px,calc(66px * var(--s)));padding:10px 16px;border-radius:14px;background:var(--b-quiet);text-align:start;width:100%;transition:background .15s,transform .08s}
.bu:active{transform:scale(.985);background:var(--b-quiet-2)}
.bun{display:flex;flex-direction:column;gap:2px;min-width:0}
.bun b{font-size:calc(20px * var(--s));font-weight:650;letter-spacing:-.015em;color:var(--b-ink);line-height:1.2}
.bun small{font-size:calc(15px * var(--s));color:var(--b-muted);line-height:1.3}
.bur{flex:none;display:flex;align-items:center}
.bur em{font-style:normal;font-size:calc(14px * var(--s));color:var(--b-muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.bu.sv{background:transparent;box-shadow:inset 0 0 0 1px var(--b-line)}
.bu.sv .bun b{color:var(--b-muted);text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:var(--b-muted)}
.bu.sv .bur{width:32px;height:32px;border-radius:50%;background:var(--b-ok);color:#fff;justify-content:center}
[data-theme="dark"] .bu.sv .bur{color:#111214}
.bu.sv .bur svg{width:18px;height:18px}
.ball{display:flex;align-items:center;justify-content:center;gap:10px;min-height:56px;border-radius:14px;background:var(--b-btn);color:var(--b-btn-ink);font-size:calc(18px * var(--s));font-weight:700;margin-top:2px}
.ball svg{width:20px;height:20px}
[data-theme="dark"] .ball,[data-theme="dark"] .brow button{box-shadow:inset 0 0 0 1px #44474F}
.bempty{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:12vh 24px 8vh;gap:12px}
.bic.big{width:76px;height:76px;border-radius:22px;background:var(--b-quiet-2);color:var(--b-ink);margin-bottom:6px}
.bic.big svg{width:38px;height:38px}
.bempty h2{font-size:calc(26px * var(--s));letter-spacing:-.02em;color:var(--b-ink)}
.bempty p{font-size:calc(17px * var(--s));color:var(--b-muted);max-width:520px;line-height:1.45}
.bdone{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:22px;padding-top:16px;border-top:1px solid var(--b-line)}
.bdone button{display:flex;align-items:center;gap:8px;min-height:52px;padding:0 16px;border-radius:999px;background:var(--b-card);box-shadow:0 0 0 1px var(--b-line);font-size:calc(17px * var(--s));font-weight:700;color:var(--b-ink)}
.bdone button svg{width:18px;height:18px;color:var(--b-muted)}
[dir=rtl] .bdone button svg{transform:scaleX(-1)}
.bdone button span{font-weight:500;color:var(--b-muted);font-size:calc(15px * var(--s))}

/* scan */
.bmain.scan{display:flex}
.bscan{flex:1;display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:24px;min-height:0}
.bcam{position:relative;border-radius:24px;overflow:hidden;background:#000;min-height:300px}
.bcam video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.bframe{position:absolute;left:50%;top:50%;width:min(58%,300px);aspect-ratio:1;transform:translate(-50%,-50%)}
.bframe i{position:absolute;width:44px;height:44px;border:5px solid #fff;border-radius:6px}
.bframe i:nth-child(1){left:0;top:0;border-right:0;border-bottom:0;border-radius:14px 0 0 0}
.bframe i:nth-child(2){right:0;top:0;border-left:0;border-bottom:0;border-radius:0 14px 0 0}
.bframe i:nth-child(3){left:0;bottom:0;border-right:0;border-top:0;border-radius:0 0 0 14px}
.bframe i:nth-child(4){right:0;bottom:0;border-left:0;border-top:0;border-radius:0 0 14px 0}
.bcamnote{position:absolute;left:20px;right:20px;bottom:20px;text-align:center;color:#fff;font-size:calc(16px * var(--s));line-height:1.4;background:rgba(0,0,0,.55);padding:12px 16px;border-radius:14px}
.bcamnote[hidden]{display:none}
.bcamgo{min-height:52px;padding:0 22px;border-radius:999px;background:#fff;color:#111!important;font-weight:700}
.bside{display:flex;flex-direction:column;gap:10px;min-width:0;overflow:auto}
.bside h2{font-size:calc(30px * var(--s));letter-spacing:-.025em;color:var(--b-ink);line-height:1.15}
.bhint{font-size:calc(17px * var(--s));color:var(--b-muted)}
.bform{margin-top:14px;background:var(--b-card);border-radius:22px;box-shadow:0 0 0 1px var(--b-line);padding:18px}
.bform label{display:block;font-size:calc(15px * var(--s));font-weight:650;color:var(--b-text);margin-bottom:10px}
.brow{display:flex;gap:10px}
.brow input{flex:1;min-width:0;height:64px;border-radius:14px;border:0;box-shadow:inset 0 0 0 1px var(--b-line);background:var(--b-quiet);color:var(--b-ink);
  font:700 calc(28px * var(--s))/1 ui-monospace,"SF Mono",Menlo,monospace;letter-spacing:.14em;text-align:center;text-transform:uppercase;padding:0 12px}
.brow input:focus{outline:none;box-shadow:inset 0 0 0 2px var(--b-ink)}
.brow button{height:64px;padding:0 24px;border-radius:14px;background:var(--b-btn);color:var(--b-btn-ink)!important;font-size:calc(18px * var(--s));font-weight:700}
.berr{margin-top:8px;font-size:calc(15px * var(--s));color:var(--b-err)}
.berr:empty{display:none}
.blast{margin-top:12px;display:flex;flex-direction:column;gap:8px}
.bl1{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 14px;border-radius:14px;background:var(--b-card);box-shadow:0 0 0 1px var(--b-line);font-size:calc(16px * var(--s))}
.bl1 i{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex:none;background:var(--b-neutral);color:#fff}
.bl1 i svg{width:17px;height:17px}
.bl1.ok i{background:var(--b-ok)} .bl1.err i{background:var(--b-err)} .bl1.off i{background:var(--b-quiet-2);color:var(--b-muted)}
[data-theme="dark"] .bl1.ok i{color:#111214}
.bl1 span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--b-text)}
.bl1 span b{color:var(--b-ink)}
.bl1 em{font-style:normal;color:var(--b-muted);font-variant-numeric:tabular-nums}

/* the answer: full screen, impossible to miss */
.bcard{position:fixed;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;padding:24px;color:#fff;animation:bcin .16s ease-out;cursor:pointer;font-family:var(--font-ui)}
.bcard.ok{background:var(--b-ok)} .bcard.err{background:var(--b-err)} .bcard.neutral{background:#1D1D1F}
.bcard.off{background:var(--b-screen);color:var(--b-ink)}
[data-theme="dark"] .bcard.ok{background:#1A7A3E} [data-theme="dark"] .bcard.err{background:#B3261E} [data-theme="dark"] .bcard.neutral{background:#303238}
.bcin{text-align:center;max-width:760px;display:flex;flex-direction:column;align-items:center;gap:12px}
.bcic{width:132px;height:132px;border-radius:50%;background:#fff;display:flex;align-items:center;justify-content:center;margin-bottom:10px}
.bcard.ok .bcic{color:#1A7A3E} .bcard.err .bcic{color:#B3261E} .bcard.neutral .bcic{color:#1D1D1F}
.bcard.off .bcic{background:var(--b-quiet-2);color:var(--b-ink)}
.bcic svg{width:76px;height:76px}
.bcard h1{font-size:clamp(40px,7vw,68px);font-weight:750;letter-spacing:-.035em;line-height:1.05}
.bcbig{font-size:clamp(26px,4.4vw,40px);font-weight:700;letter-spacing:-.02em;line-height:1.15}
.bcard p{font-size:clamp(17px,2.4vw,22px);line-height:1.4;opacity:.92;max-width:620px}
.bctap{margin-top:18px;font-size:15px;opacity:.7}
@keyframes bcin{from{opacity:0;transform:scale(1.02)}to{opacity:1;transform:none}}

/* toast with Undo */
.btoast{position:fixed;left:50%;bottom:28px;z-index:70;display:flex;align-items:center;gap:16px;padding:8px 8px 8px 22px;border-radius:999px;background:var(--b-toast);color:var(--b-toast-ink);
  font:650 17px/1.2 var(--font-ui);box-shadow:0 10px 30px rgba(0,0,0,.22);opacity:0;transform:translate(-50%,12px);transition:opacity .2s,transform .2s;pointer-events:none;max-width:calc(100vw - 32px)}
[dir=rtl] .btoast{padding:8px 22px 8px 8px}
.btoast.on{opacity:1;transform:translate(-50%,0);pointer-events:auto}
.btoast span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.btoast button{min-height:52px;min-width:96px;padding:0 20px;border-radius:999px;border:0;background:color-mix(in srgb,var(--b-toast-ink) 16%,transparent);color:var(--b-toast-ink);font:700 17px var(--font-ui);cursor:pointer}

/* voucher opened on a phone that isn't a bar screen */
.bvland .bvcode{font:700 34px/1 ui-monospace,"SF Mono",Menlo,monospace;letter-spacing:.14em;margin-top:3rem;color:var(--card-ink)}
#setup .bvland button.bvpair{background:transparent;color:var(--card-ink-2);border:0;font-size:2.75rem;font-weight:600;text-decoration:underline;height:auto;padding:2rem}

/* phone */
@media (max-width:700px){
  .bh{flex-wrap:wrap;padding:10px 14px;gap:10px;min-height:0}
  .bseg{order:3;width:100%}
  .bseg button{flex:1;justify-content:center;min-height:50px;padding:0 12px}
  .bclock{display:none}
  .bconn span,.bconn{font-size:13px}
  .bmain{padding:14px 14px 96px}
  .btot{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding-bottom:4px}
  .btot .lab{display:none}
  .bgrid{grid-template-columns:minmax(0,1fr)}
  .bscan{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto;gap:14px}
  .bcam{min-height:0;aspect-ratio:4/3.3}
  .bside{overflow:visible}
  .bside h2{font-size:24px}
  .bmain.scan{display:block}
  .bcic{width:110px;height:110px} .bcic svg{width:62px;height:62px}
}
@media (prefers-reduced-motion:reduce){.bcard{animation:none}.btoast{transition:none}}
