/* Point of Sale: the register (and the kitchen screen). On top of app.css's tokens, so both themes stay WCAG 2.2 AA:
   big targets for fingers, a visible focus, and nothing that needs dragging. */
html, body.reg { height: 100%; }
body.reg { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; overflow: hidden; background: var(--bg); }
.regbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-height: 52px; padding: 6px 14px; background: var(--head); color: var(--head-ink); }
.rb-store { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.rb-name { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-dev { font-size: .8rem; color: var(--head-soft); }
.rb-net { font-size: .85rem; font-weight: 700; border-radius: 99px; }
.rb-net:not(:empty) { padding: 4px 12px; background: var(--ok-bg); color: var(--ok-ink); }
.rb-net.wait { background: var(--warn-bg); color: var(--warn-ink); }
.rb-net.off { background: var(--err-bg); color: var(--err-ink); }
.rb-who { display: flex; align-items: center; gap: 8px; }
#who { font-weight: 700; }
.rb-btn { min-height: 40px; min-width: 44px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--head-soft); background: transparent; color: var(--head-ink); font: inherit; font-weight: 700; cursor: pointer; }
.rb-btn:hover { background: rgba(255,255,255,.08); }
.regbar :focus-visible { outline-color: #f5c542; }
.demo-bar { background: var(--warn-bg); color: var(--warn-ink); padding: 6px 14px; font-size: .9rem; }
.demo-bar a { color: var(--warn-ink); font-weight: 700; }

.reg-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); min-height: 0; }
.catalog { display: flex; flex-direction: column; min-height: 0; padding: 10px 12px 0; }
.cat-top { display: flex; gap: 8px; align-items: center; }
.cat-top input[type=search] { flex: 1; min-height: 48px; font-size: 17px; }
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 8px; flex: none; }
.cat-tabs button { flex: none; min-height: 44px; padding: 6px 16px; border-radius: 99px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.cat-tabs button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.items { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); grid-auto-rows: min-content; gap: 8px; padding: 2px 2px 16px; align-content: start; }
.items:focus { outline: none; }
.item { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 4px; min-height: 86px; padding: 10px 10px 8px; text-align: left; border: 1px solid var(--line); border-top: 6px solid var(--c0);
  border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; touch-action: manipulation; }
.item:hover { border-color: var(--brand); border-top-color: inherit; }
.item:active { transform: scale(.98); }
.i-name { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.i-price { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.i-tag, .i-stock { font-size: .75rem; font-weight: 700; color: var(--muted); }
.i-stock.out { color: var(--danger); }
.item.custom { border-style: dashed; border-top-style: dashed; }
.c0 { border-top-color: var(--c0) !important; } .c1 { border-top-color: var(--c1) !important; } .c2 { border-top-color: var(--c2) !important; } .c3 { border-top-color: var(--c3) !important; } .c4 { border-top-color: var(--c4) !important; }
.c5 { border-top-color: var(--c5) !important; } .c6 { border-top-color: var(--c6) !important; } .c7 { border-top-color: var(--c7) !important; } .c8 { border-top-color: var(--c8) !important; } .c9 { border-top-color: var(--c9) !important; }
.cat-tabs button.c0, .cat-tabs button.c1, .cat-tabs button.c2, .cat-tabs button.c3, .cat-tabs button.c4, .cat-tabs button.c5, .cat-tabs button.c6, .cat-tabs button.c7, .cat-tabs button.c8, .cat-tabs button.c9 { border-top-color: var(--line) !important; }
.cat-tabs button.c0 { border-bottom-color: var(--c0); } .cat-tabs button.c1 { border-bottom-color: var(--c1); } .cat-tabs button.c2 { border-bottom-color: var(--c2); } .cat-tabs button.c3 { border-bottom-color: var(--c3); } .cat-tabs button.c4 { border-bottom-color: var(--c4); }
.cat-tabs button.c5 { border-bottom-color: var(--c5); } .cat-tabs button.c6 { border-bottom-color: var(--c6); } .cat-tabs button.c7 { border-bottom-color: var(--c7); } .cat-tabs button.c8 { border-bottom-color: var(--c8); } .cat-tabs button.c9 { border-bottom-color: var(--c9); }
.cat-tabs button[aria-pressed="true"][class] { border-color: var(--brand) !important; }
.empty { padding: 16px 4px; grid-column: 1 / -1; }

.order { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-left: 1px solid var(--line); }
.o-head { padding: 10px 14px 6px; border-bottom: 1px solid var(--line); }
.o-head h2 { margin: 0 0 6px; font-size: 1.2rem; }
.o-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.o-meta select { width: auto; min-height: 40px; padding: 6px 10px; }
.chip-btn { min-height: 40px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--muted); background: var(--card); color: var(--ink); font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-lines { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }
.o-lines > li { border-bottom: 1px solid var(--line); }
.o-lines > li.empty { padding: 18px 14px; border: 0; }
.ln { width: 100%; display: grid; grid-template-columns: minmax(2rem, max-content) minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 10px 14px; background: none; border: 0; text-align: left; color: var(--ink); font: inherit; cursor: pointer; min-height: 48px; }
.ln:hover { background: var(--bg); }
.ln:disabled { cursor: default; opacity: .75; }
.ln-q { font-weight: 800; font-variant-numeric: tabular-nums; }
.ln-n { display: flex; flex-direction: column; font-weight: 600; overflow-wrap: anywhere; }
.ln-m { font-size: .85rem; font-weight: 400; color: var(--muted); }
.ln-note { font-style: italic; }
.ln-disc { color: var(--sale); font-weight: 600; }
.ln-tag { align-self: flex-start; margin-top: 3px; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--tag-bg); color: var(--muted); }
.ln-a { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.voided .ln-n > :first-child, .voided .ln-a { text-decoration: line-through; }
li.just .ln { background: var(--ok-bg); }
@media (prefers-reduced-motion: no-preference) { .ln { transition: background .4s; } }
.o-totals { padding: 8px 14px; border-top: 2px solid var(--line); }
.tot { margin: 0; display: grid; gap: 2px; }
.tot > div { display: flex; justify-content: space-between; gap: 12px; }
.tot dt, .tot dd { margin: 0; }
.tot dd { font-variant-numeric: tabular-nums; font-weight: 600; }
.tot .tot-big { font-size: 1.25rem; font-weight: 800; }
.tot .tot-big dd { font-weight: 800; }
.o-actions { padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.btn.pay { width: 100%; min-height: 60px; font-size: 1.3rem; }
.o-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; }
.o-row .btn { padding: 8px 6px; }
.phone-bar { display: none; }

/* The lock screen */
.lock { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.lock-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 560px; text-align: center; }
.who-list { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.small-who { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.who-btn { width: 100%; min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.who-btn:hover { border-color: var(--brand); }
.who-name { font-weight: 800; font-size: 1.1rem; }
.who-role { font-size: .85rem; color: var(--muted); }
.pin-who { font-weight: 800; font-size: 1.2rem; margin: 6px 0 2px; }
.pin-dots { font-size: 1.6rem; letter-spacing: .3em; min-height: 2rem; margin: 0; }
.pin-in { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pin-msg { min-height: 1.4rem; color: var(--danger); font-weight: 600; margin: 4px 0; }
.pad { display: grid; grid-template-columns: repeat(3, minmax(64px, 96px)); gap: 10px; justify-content: center; margin: 8px 0; }
.pad button { min-height: 64px; font: inherit; font-size: 1.5rem; font-weight: 700; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); cursor: pointer; touch-action: manipulation; }
.pad button:active { background: var(--tag-bg); }
.pad button[data-k="OK"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-size: 1.15rem; }
.demo-pins { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 12px; }

/* Dialogs */
dialog { border: 0; padding: 0; border-radius: 16px; background: var(--card); color: var(--ink); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 14, 26, .55); }
.dlg-in { padding: 16px 18px 18px; }
.dlg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; position: sticky; top: -16px; background: var(--card); padding-top: 2px; }
.dlg-head h2 { margin: 0; font-size: 1.25rem; flex: 1; overflow-wrap: anywhere; }
.dlg-x { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dlg-err { color: var(--danger); font-weight: 600; min-height: 1.2rem; margin: 6px 0 0; }
.dlg-err:empty { min-height: 0; margin: 0; }
.msg { font-size: 1.05rem; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.menu-grid .btn { justify-content: flex-start; text-align: left; }
.pick { list-style: none; margin: 8px 0; padding: 0; }
.pick > li + li { border-top: 1px solid var(--line); }
.pick-btn { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 6px; min-height: 48px; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.pick-btn:hover { background: var(--bg); }
.pick-r { margin-left: auto; text-align: right; }
.mods { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 10px; }
.mods legend { padding: 0 4px; font-size: 1rem; }
.mod-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.mod { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.mod input { width: 22px; height: 22px; flex: none; }
.mod:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--tag-bg); }
.mod-p { color: var(--muted); font-weight: 700; }
.stepper { display: flex; align-items: stretch; gap: 6px; max-width: 240px; }
.stepper button { min-width: 52px; min-height: 48px; font-size: 1.4rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); cursor: pointer; }
.stepper input { text-align: center; font-size: 1.2rem; font-weight: 700; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.due { display: flex; flex-direction: column; align-items: center; padding: 8px; margin-bottom: 8px; background: var(--bg); border-radius: 12px; }
.due strong { font-size: 2.2rem; font-variant-numeric: tabular-nums; }
.tips { border: 0; padding: 0; margin: 0 0 10px; }
.tips .btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.tip-in { width: 7rem !important; }
.split-row { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.split-row select { width: auto; }
.tenders { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.tender { min-height: 60px; font-size: 1.1rem; }
.tender.t-card, .tender.t-gift, .tender.t-other { background: var(--card); color: var(--link); }
#pMore { border-top: 1px solid var(--line); margin-top: 6px; }
#pMore:empty { border: 0; }
#pMore h3 { margin: 12px 0 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.quick .btn { min-height: 52px; min-width: 96px; font-size: 1.05rem; }
.done-big { display: flex; flex-direction: column; align-items: center; padding: 12px; background: var(--ok-bg); color: var(--ok-ink); border-radius: 14px; margin-bottom: 8px; }
.done-big span { font-weight: 700; }
.done-big strong { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.rlines { list-style: none; padding: 0; margin: 8px 0; }
.rlines li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.rlines li:first-child { border-top: 0; }
.rlines input.rq { width: 5rem; text-align: center; }
.rtotal { display: flex; justify-content: space-between; font-size: 1.15rem; border-top: 2px solid var(--line); padding-top: 8px; }
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.denom { display: flex; align-items: center; gap: 8px; }
.denom span { min-width: 3.6rem; font-weight: 700; text-align: right; }
.denom input { width: 5rem; }
.cam { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--card); padding: 12px 18px; border-radius: 12px; font-weight: 700; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.center { text-align: center; }
.add-cust { margin-top: 10px; }
.add-cust summary { cursor: pointer; font-weight: 700; color: var(--link); min-height: 32px; }

/* A phone: the items or the order, with a bar to switch */
@media (max-width: 759px) {
  .reg-main { grid-template-columns: 1fr; }
  .order { display: none; border-left: 0; }
  body.show-order .order { display: flex; }
  body.show-order .catalog { display: none; }
  .phone-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
  .phone-bar button { min-height: 52px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
  .phone-bar button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .items { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  dialog, dialog.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: auto; border-radius: 0; margin: 0; }
  .rb-dev { display: none; }
}

/* The kitchen screen */
body.kds { overflow: auto; }
.kds-main { padding: 12px; flex: 1; }
.kds-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.kds-tools .spacer { flex: 1; }
.chits { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.chit { background: var(--card); border: 2px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.chit-h { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--tag-bg); font-weight: 800; }
.chit.late { border-color: var(--c2); }
.chit.later { border-color: var(--danger); }
.chit.late .chit-h { background: var(--warn-bg); color: var(--warn-ink); }
.chit.later .chit-h { background: var(--err-bg); color: var(--err-ink); }
.chit.void { border-style: dashed; border-color: var(--danger); }
.chit.void .chit-h { background: var(--err-bg); color: var(--err-ink); }
.chit-st { font-size: .8rem; font-weight: 700; color: var(--muted); padding: 4px 12px 0; text-transform: uppercase; letter-spacing: .05em; }
.chit ul { list-style: none; margin: 0; padding: 6px 12px; }
.chit li { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 1.1rem; }
.chit li:last-child { border-bottom: 0; }
.chit .q { font-weight: 800; margin-right: 6px; }
.chit .m { display: block; font-size: .92rem; color: var(--muted); }
.chit .nt { display: block; font-size: .92rem; font-style: italic; color: var(--warn-ink); background: var(--warn-bg); padding: 0 4px; border-radius: 4px; }
.chit-note { margin: 0 12px 6px; padding: 4px 8px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; }
.chit .btn { margin: 6px 12px 12px; }
.allday { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.allday h2 { font-size: 1rem; margin: 0 0 6px; }
.allday ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
@media print { .regbar, .phone-bar, .kds-tools { display: none !important; } }
