/* ==========================================================================
   NovaPOS — pos.css
   The touch-first checkout: product grid, cart, tender pad and completion.
   ========================================================================== */

.pos {
  display: grid; gap: 0;
  --pos-cart-w: 560px;
  grid-template-columns: minmax(0, 1fr) 18px minmax(400px, var(--pos-cart-w));
  align-items: start;
  max-width: 1800px; margin: 0 auto;
}
.pos__main { min-width: 0; display: flex; flex-direction: column; gap: var(--s4); }

/* ------------------------------------------------------- cart width handle */
.pos-resizer {
  align-self: stretch; min-height: 320px; width: 18px;
  display: grid; place-items: center; cursor: col-resize; touch-action: none;
  user-select: none; -webkit-user-select: none; border-radius: var(--r-full);
}
.pos-resizer::before {
  content: ""; width: 5px; height: 64px; border-radius: var(--r-full);
  background: var(--border-strong); transition: background var(--t-fast), height var(--t-fast);
}
.pos-resizer:hover::before, .pos-resizer:focus-visible::before, .pos-resizer.is-active::before {
  background: var(--brand-500); height: 110px;
}
.pos-resizer:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }

/* ------------------------------------------------------------ scan/search */
.pos-scan { display: flex; gap: var(--s2); align-items: stretch; }
.pos-scan .search-field { flex: 1 1 auto; }
.pos-scan .input {
  min-height: 56px; font-size: var(--fs-lg); padding-left: 46px;
  border-radius: var(--r-lg); border-width: 2px;
}
.pos-scan .search-field > svg { left: 15px; width: 22px; height: 22px; }
.pos-scan__hint { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: var(--s1); }

.pos-scan.is-scanning .input { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(21, 128, 61, .14); }
@keyframes scanFlash { 0% { background: var(--ok-bg); } 100% { background: var(--surface); } }
.ptile.is-flash { animation: scanFlash .55s ease-out; }

.pos-cats { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pos-cats::-webkit-scrollbar { display: none; }
.pos-cat {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 52px; padding: var(--s2) var(--s4);
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; text-align: left; transition: all var(--t-fast);
}
.pos-cat:hover { border-color: var(--brand-400); }
.pos-cat.is-active { background: var(--brand-600); border-color: var(--brand-700); color: #fff; }
.pos-cat__name { font-size: var(--fs-md); font-weight: 650; white-space: nowrap; }
.pos-cat__count { font-size: 11px; opacity: .7; }
.pos-cat__swatch { width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; display: inline-block; }

/* ------------------------------------------------------------- product grid */
.pos-grid {
  display: grid; gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.ptile {
  position: relative; display: flex; flex-direction: column; gap: var(--s2);
  min-height: 178px; padding: var(--s3);
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; text-align: left; overflow: hidden;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.ptile:hover { border-color: var(--brand-400); box-shadow: var(--sh-2); transform: translateY(-1px); }
.ptile:active { transform: scale(.985); }
.ptile__thumb {
  display: grid; place-items: center; height: 96px; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text-subtle); overflow: hidden;
}
.ptile__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ptile__name {
  font-size: var(--fs-md); font-weight: 650; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ptile__meta { display: flex; align-items: center; gap: var(--s2); margin-top: auto; }
.ptile__price { font-size: var(--fs-lg); font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ptile__stock { font-size: 11px; color: var(--text-subtle); margin-left: auto; font-variant-numeric: tabular- nums; }
.ptile__flags { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.ptile--out { opacity: .55; }
.ptile--out .ptile__price { text-decoration: line-through; }
.ptile--variant::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent-500);
}
.ptile__qty-badge {
  position: absolute; top: 8px; left: 8px; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: var(--r-full); background: var(--brand-600); color: #fff;
  font-size: var(--fs-sm); font-weight: 750; line-height: 24px; text-align: center;
}

/* --------------------------------------------------------- arrange (reorder) */
.arrange-bar {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s3); font-size: var(--fs-sm);
  border: 1px dashed var(--brand-400); border-radius: var(--r-md);
  background: var(--brand-50); color: var(--brand-700);
}
.arrange-bar svg { flex: 0 0 auto; }

.pos.is-arranging .ptile { border-style: dashed; cursor: grab; padding-bottom: 42px; }
.pos.is-arranging .ptile:hover { transform: none; }
.pos.is-arranging .ptile:active { cursor: grabbing; transform: none; }
.ptile.is-dragging { opacity: .35; }
.ptile.is-drop-target, .pos-cat.is-drop-target {
  border-color: var(--brand-500); border-style: solid;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .18);
}
.ptile__move { position: absolute; left: 0; right: 0; bottom: 0; display: none; justify-content: center; gap: 4px; padding: 6px; border-radius: 0 0 var(--r-lg) var(--r-lg); background: linear-gradient(transparent, var(--surface) 42%); }
.pos.is-arranging .ptile__move,
.ptile:hover .ptile__move,
.ptile:focus-within .ptile__move { display: flex; }

.mv-btn {
  width: 27px; height: 27px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: all var(--t-fast);
}
.mv-btn:hover { border-color: var(--brand-500); color: var(--brand-600); background: var(--brand-50); }
.mv-btn:active { transform: scale(.92); }
.mv-btn svg { width: 15px; height: 15px; }

.pos-cat { position: relative; }
.pos-cat__move { display: none; position: absolute; top: 4px; right: 4px; gap: 2px; }
.pos.is-arranging .pos-cat__move,
.pos-cat:hover .pos-cat__move,
.pos-cat:focus-within .pos-cat__move { display: flex; }
.pos.is-arranging .pos-cat { cursor: grab; border-style: dashed; padding-right: 62px; }
.pos.is-arranging .pos-cat:active { cursor: grabbing; }
.pos-cat.is-dragging { opacity: .4; }
.pos-cat__move .mv-btn { width: 24px; height: 24px; }
.pos-cat__move .mv-btn svg { width: 13px; height: 13px; }

/* ------------------------------------------------------- camera barcode scan */
.scanner { display: flex; flex-direction: column; gap: var(--s3); }
.scanner__frame { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #0a0d16; min-height: 220px; }
.scanner__video { width: 100%; max-height: 52dvh; display: block; object-fit: cover; }
.scanner__reticle {
  position: absolute; inset: 20% 8%; pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, .8); border-radius: var(--r-lg);
  box-shadow: 0 0 0 9999px rgba(4, 8, 20, .28);
}
.scanner.is-hit .scanner__reticle { border-color: var(--ok); border-style: solid; background: rgba(21, 128, 61, .14); }
.scanner__status { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-subtle); }
.scanner__error { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s6) var(--s4); text-align: center; }

/* ------------------------------------------------------------------- cart */
.cart {
  position: sticky; top: calc(var(--topbar-h) + var(--s4));
  display: flex; flex-direction: column; max-height: calc(100dvh - var(--topbar-h) - var(--s7));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden;
}
.cart__head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cart__head h2 { font-size: var(--fs-base); }
.cart__count { padding: 1px 8px; border-radius: var(--r-full); background: var(--brand-600); color: #fff; font-size: 11.5px; font-weight: 750; }
.cart__head-actions { margin-left: auto; display: flex; gap: 4px; }

.cart__customer { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border-soft); }
.cart__customer .avatar { flex: 0 0 34px; width: 34px; height: 34px; }
.cart__customer-main { min-width: 0; flex: 1 1 auto; }
.cart__customer-name { font-weight: 650; font-size: var(--fs-md); }
.cart__customer-sub { font-size: var(--fs-xs); color: var(--text-subtle); }

.cart__lines { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: var(--s2); min-height: 160px; }
.cart__lines:empty::after { content: ""; }

.cline {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s1) var(--s3);
  padding: var(--s3) var(--s4); border-radius: var(--r-md); border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.cline + .cline { margin-top: 2px; }
.cline:hover { background: var(--surface-2); border-color: var(--border-soft); }
.cline.is-new { animation: lineIn var(--t-med) both; }
@keyframes lineIn { from { background: var(--brand-50); transform: translateX(6px); opacity: .5; } to { background: transparent; transform: none; opacity: 1; } }
.cline__name { font-weight: 650; font-size: var(--fs-lg); line-height: 1.3; word-break: break-word; }
.cline__sub { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 2px; display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.cline__right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); }
.cline__price { font-weight: 700; font-variant-numeric: tabular-nums; font-size: var(--fs-lg); }
.cline__was { font-size: var(--fs-xs); color: var(--text-subtle); text-decoration: line-through; }
.cline__controls { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.cline__note { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--text-muted); font-style: italic; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.stepper button {
  width: 42px; height: 42px; border: 0; background: transparent; color: var(--text);
  font-size: 20px; font-weight: 700; cursor: pointer; display: grid; place-items: center; line-height: 1;
}
.stepper button:hover { background: var(--surface-hover); }
.stepper button:active { background: var(--brand-50); }
.stepper input {
  width: 58px; height: 42px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  text-align: center; font-weight: 700; font-size: var(--fs-md); font-variant-numeric: tabular-nums; background: var(--surface);
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper--lg button { width: 56px; height: 56px; font-size: 24px; }
.stepper--lg input { width: 76px; height: 56px; font-size: var(--fs-xl); }

.cart__empty { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s7) var(--s4); text-align: center; color: var(--text-subtle); }
.cart__empty [data-icon], .cart__empty svg { width: 40px; height: 40px; opacity: .45; }

.cart__totals { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); background: var(--surface-2); }
.tline { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: 3px 0; font-size: var(--fs-md); }
.tline__label { color: var(--text-muted); }
.tline__value { font-weight: 650; font-variant-numeric: tabular-nums; }
.tline--discount .tline__value { color: var(--danger); }
.tline--total {
  margin-top: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--border);
  font-size: var(--fs-lg);
}
.tline--total .tline__label { color: var(--text); font-weight: 700; }
.tline--total .tline__value { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.02em; }
.tline--tax-detail { font-size: var(--fs-xs); color: var(--text-subtle); }

.cart__actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--border); }
.cart__actions .btn { min-height: 46px; font-size: var(--fs-sm); padding: 0 var(--s2); }
.cart__charge { padding: var(--s3) var(--s4) var(--s4); }
.charge-btn {
  width: 100%; min-height: 76px; border-radius: var(--r-lg);
  font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.01em;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 0 var(--s5);
}
.charge-btn__amount { font-variant-numeric: tabular-nums; font-size: var(--fs-3xl); }

/* --------------------------------------------------------------- payment */
.pay { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
.pay__methods { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pay-method {
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  min-height: 108px; padding: var(--s4) var(--s3);
  border: 2px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; text-align: center; transition: all var(--t-fast);
}
.pay-method:hover { border-color: var(--brand-400); background: var(--surface-hover); }
.pay-method.is-active { border-color: var(--brand-600); background: var(--brand-50); box-shadow: var(--focus-ring); }
[data-theme="dark"] .pay-method.is-active { background: rgba(99,102,241,.16); }
.pay-method [data-icon], .pay-method svg { width: 28px; height: 28px; color: var(--brand-600); }
.pay-method__name { font-weight: 700; font-size: var(--fs-md); }
.pay-method__hint { font-size: 11px; color: var(--text-subtle); }
.pay-method:disabled { opacity: .45; cursor: not-allowed; }

.pay-summary { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4); }
.pay-due { text-align: center; padding: var(--s4) 0; }
.pay-due__label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--text-subtle); }
.pay-due__value { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pay-due__value.is-paid { color: var(--ok); }

.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.numpad button {
  min-height: 60px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font-size: var(--fs-xl); font-weight: 700;
  cursor: pointer; transition: all var(--t-fast); font-variant-numeric: tabular-nums;
}
.numpad button:hover { background: var(--surface-hover); border-color: var(--brand-400); }
.numpad button:active { background: var(--brand-50); transform: scale(.98); }
.numpad button.fn { font-size: var(--fs-md); font-weight: 650; color: var(--text-muted); }
.numpad button.fn:hover { color: var(--text); }

.quick-cash { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--s2); }
.quick-cash button {
  min-height: 46px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); font-weight: 700; font-size: var(--fs-md); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.quick-cash button:hover { border-color: var(--brand-400); background: var(--surface-hover); }

.tenders { display: flex; flex-direction: column; gap: var(--s2); }
.tender {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3);
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.tender__main { flex: 1 1 auto; min-width: 0; }
.tender__name { font-weight: 650; font-size: var(--fs-md); }
.tender__meta { font-size: var(--fs-xs); color: var(--text-subtle); }
.tender__amount { font-weight: 750; font-variant-numeric: tabular-nums; font-size: var(--fs-lg); }

.change-display {
  display: flex; flex-direction: column; align-items: center; gap: var(--s1);
  padding: var(--s5); border-radius: var(--r-lg); background: var(--ok-bg);
  border: 1px solid var(--ok-border); color: var(--ok); text-align: center;
}
.change-display__label { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.change-display__value { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 850; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.change-display__hint { font-size: var(--fs-sm); opacity: .85; }
.change-display--neutral { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.split-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------------------------------------------------------- completion */
.done { display: grid; place-items: center; gap: var(--s4); padding: var(--s6) 0; text-align: center; }
.done__tick {
  display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%;
  background: var(--ok-bg); color: var(--ok); animation: popIn 420ms cubic-bezier(.2, 1.4, .5, 1) both;
}
.done__tick svg { width: 46px; height: 46px; }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.done__title { font-size: var(--fs-2xl); font-weight: 800; }
.done__amount { font-size: var(--fs-3xl); font-weight: 850; letter-spacing: -.02em; }
.done__actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; }

/* ------------------------------------------------------------ held sales */
.held-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.held-card {
  display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4);
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; text-align: left; transition: all var(--t-fast);
}
.held-card:hover { border-color: var(--brand-400); box-shadow: var(--sh-2); }
.held-card__no { font-weight: 700; font-size: var(--fs-md); }
.held-card__meta { font-size: var(--fs-xs); color: var(--text-subtle); }
.held-card__total { font-size: var(--fs-xl); font-weight: 800; margin-top: auto; font-variant-numeric: tabular-nums; }
.held-card__actions { display: flex; gap: var(--s2); margin-top: var(--s2); }

/* ------------------------------------------------- mobile cart behaviour */
.mobile-cart-bar { display: none; }

@media (max-width: 1080px) {
  .pos { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .pos-resizer { display: none; }
  .cart { position: static; max-height: none; }
  .pay { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--s2); }
  .ptile { min-height: 142px; padding: var(--s2); }
  .ptile__thumb { height: 58px; }
  .pos.is-arranging .ptile { padding-bottom: 38px; }

  /* the cart becomes a bottom sheet summoned by a sticky bar */
  .cart {
    position: fixed; inset: auto 0 0 0; z-index: 75; max-height: 88dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(101%);
    transition: transform var(--t-med); box-shadow: var(--sh-4);
  }
  body.cart-open .cart { transform: none; }
  body.cart-open { overflow: hidden; }
  .cart__lines { max-height: 34dvh; }
  .mobile-cart-bar {
    display: flex; align-items: center; gap: var(--s3);
    position: fixed; left: var(--s3); right: var(--s3); bottom: var(--s3); z-index: 74;
    min-height: 60px; padding: var(--s2) var(--s4);
    border-radius: var(--r-xl); background: var(--brand-600); color: #fff;
    box-shadow: var(--sh-3); border: 0; cursor: pointer; font-weight: 700;
  }
  .mobile-cart-bar[hidden] { display: none; }
  .mobile-cart-bar__count {
    display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px;
    border-radius: var(--r-full); background: rgba(255, 255, 255, .22); font-size: var(--fs-md);
  }
  .mobile-cart-bar__total { margin-left: auto; font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
  .pos__main { padding-bottom: 84px; }
  .numpad button { min-height: 54px; font-size: var(--fs-lg); }
  .pay-method { min-height: 92px; }
  .cart__actions { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 400px) {
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charge-btn { min-height: 60px; font-size: var(--fs-lg); }
  .charge-btn__amount { font-size: var(--fs-xl); }
}

/* ------------------------------------------------------ print: receipts */
@media print {
  body { background: #fff; }
  .pos, .cart, .topbar, .sidebar { display: none !important; }
  .receipt-print { display: block !important; }
}
.receipt-print { display: none; }

/* ==========================================================================
   Smart POS input modes — touch-first and keyboard-first tills.
   The mode toggle lives in the scan row; <body class="pos-touch"> extends
   the enlarged targets into portalled modals (payment, keypads, pickers).
   ========================================================================== */
.mode-switch { display: flex; gap: var(--s2); align-items: stretch; }
.mode-switch .btn { white-space: nowrap; }
@media (max-width: 1200px) {
  .pos-scan { flex-wrap: wrap; }
  .mode-switch { flex: 1 0 auto; }
  .mode-switch .btn { flex: 1; justify-content: center; }
}

/* ---------------------------------------------------------- touch mode */
.pos.mode-touch .pos-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--s4); }
.pos.mode-touch .ptile { min-height: 200px; padding: var(--s4); }
.pos.mode-touch .ptile:hover { transform: none; }
.pos.mode-touch .ptile:active { transform: scale(.97); }
.pos.mode-touch .ptile__thumb { height: 106px; }
.pos.mode-touch .ptile__name { font-size: var(--fs-lg); }
.pos.mode-touch .pos-cat { min-height: 60px; padding: var(--s3) var(--s5); }
.pos.mode-touch .pos-cat__name { font-size: var(--fs-lg); }
.pos.mode-touch .pos-scan .input { min-height: 60px; font-size: 16px; } /* 16px blocks iOS focus-zoom */
.pos.mode-touch .pos-scan > .btn { min-height: 56px; padding: 0 var(--s4); }
.pos.mode-touch .stepper button { width: 52px; height: 52px; font-size: 24px; }
.pos.mode-touch .stepper input { width: 72px; height: 52px; font-size: var(--fs-lg); }
.pos.mode-touch .cline { padding: var(--s4); }
.pos.mode-touch .cline__controls .icon-btn { width: 42px; height: 42px; }
.pos.mode-touch .cline__controls .icon-btn svg,
.pos.mode-touch .cline__controls .icon-btn [data-icon] { width: 22px; height: 22px; }
.pos.mode-touch .cart__actions .btn { min-height: 54px; font-size: var(--fs-md); }
.pos.mode-touch .charge-btn { min-height: 92px; }
/* modals are portalled to <body> — the body-level flag keeps them in step */
body.pos-touch .numpad button { min-height: 70px; font-size: var(--fs-2xl); }
body.pos-touch .quick-cash button { min-height: 54px; font-size: var(--fs-lg); }
body.pos-touch .pay-method { min-height: 120px; }
body.pos-touch .modal .btn { min-height: 48px; }
body.pos-touch .modal .icon-btn { width: 42px; height: 42px; }

/* ------------------------------------------------- quantity keypad modal */
.qty-keypad { display: grid; gap: var(--s3); }
.qty-keypad__name { font-weight: 700; font-size: var(--fs-md); display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; }
.qty-keypad__display {
  min-height: 64px; display: flex; align-items: center; justify-content: flex-end;
  padding: var(--s2) var(--s4); font-size: var(--fs-3xl); font-weight: 800;
  border: 2px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); font-variant-numeric: tabular-nums;
}
body.pos-touch .qty-keypad__display { min-height: 72px; }

/* -------------------------------------------------------- keyboard mode */
.pos.mode-keyboard .ptile.is-cursor,
.pos.mode-keyboard .ptile:focus-visible {
  outline: 3px solid var(--brand-500); outline-offset: 2px; border-color: var(--brand-400);
}
.kbd--icon { display: inline-flex; align-items: center; padding: 1px 4px; vertical-align: -2px; }

/* ------------------------------------------------- F1 shortcut help modal */
.shortcut-list { display: grid; gap: var(--s2); }
.shortcut-row { display: flex; align-items: baseline; gap: var(--s3); }
.shortcut-row .kbd { flex: 0 0 auto; min-width: 172px; text-align: center; }

/* ------------------------------------------------- on-button keycap chips
   Keyboard mode prints the shortcut on every till button (Charge = F4 …).
   Touch mode hides the chips — fingers do not need keycaps. */
.kbd--chip {
  display: none; align-items: center; margin-left: 7px; padding: 1px 6px; height: auto;
  border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 1px;
  background: var(--surface-2); color: var(--text-subtle);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; line-height: 1.7;
  letter-spacing: .02em; pointer-events: none; white-space: nowrap;
}
.pos.mode-keyboard .kbd--chip { display: inline-flex; }
.search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); margin-left: 0; }
.btn--success .kbd--chip, .btn--primary .kbd--chip, .charge-btn .kbd--chip {
  background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .42); color: #fff;
}
.charge-btn .kbd--chip { font-size: 12px; padding: 2px 9px; }
.cline__controls .kbd--chip { margin-left: 2px; }
.pos.mode-touch .search-kbd { display: none; }

/* ============================================ payment screen: modes + keys
   The payment modal is portalled to <body>, so body-level flags drive it.
   Keyboard mode prints the shortcut on every payment button (F4 completes);
   touch mode hides the chips and fattens every tap target instead. */
body.pos-keyboard .kbd--chip { display: inline-flex; }
body.pos-touch .kbd--chip { display: none !important; }

.pay-method { position: relative; }
.pay-method .kbd--chip { position: absolute; top: 8px; right: 8px; margin-left: 0; }
.pay-method:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; }
.pay-complete { display: inline-flex; align-items: center; }
.pay-complete .kbd--chip { font-size: 12px; padding: 2px 9px; }

/* ---- keyboard mode: roomy grid so the number chips fit, clear focus order */
.pay--keyboard .pay__methods { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pay--keyboard .numpad button { min-height: 52px; }

/* ---- touch mode: fat-finger targets across the whole payment screen */
.pay--touch { gap: var(--s4); }
.pay--touch .pay__methods { gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); }
.pay--touch .pay-method { min-height: 128px; padding: var(--s4); }
.pay--touch .pay-method:active { transform: scale(.97); }
.pay--touch .pay-method [data-icon],
.pay--touch .pay-method svg { width: 34px; height: 34px; }
.pay--touch .pay-method__name { font-size: var(--fs-lg); }
.pay--touch .input--money.input--lg { min-height: 60px; font-size: var(--fs-xl); }
.pay--touch .quick-cash { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: var(--s3); }
.pay--touch .quick-cash button { min-height: 62px; font-size: var(--fs-lg); font-weight: 700; }
.pay--touch .quick-cash button:active { transform: scale(.97); }
.pay--touch .numpad { gap: var(--s3); }
.pay--touch .numpad button { min-height: 84px; font-size: var(--fs-2xl); border-width: 2px; }
.pay--touch .row.mt4 {
  display: grid; grid-template-columns: minmax(0, 1fr) 0 minmax(0, 1.5fr);
  gap: var(--s3); align-items: stretch;
}
.pay--touch .row.mt4 .spacer { flex: 0 0 0; width: 0; }
.pay--touch .pay-complete { min-height: 84px; font-size: var(--fs-lg); justify-content: center; }
.pay--touch .pay-complete .mono { font-size: var(--fs-lg); }
.pay--touch .pay .btn:not(.pay-complete) { min-height: 56px; }
.pay--touch .tender { padding: var(--s4); }
.pay--touch .tender__amount { font-size: var(--fs-lg); }
.pay--touch .pay-due__value { font-size: var(--fs-3xl); }

/* ============================================ till power pack (v1.9.0)
   Fast-key strip, weighed-item entry, unit chips on basket lines. */
.fastkeys { display: flex; gap: var(--s2); align-items: stretch; padding: 0 16px 8px; overflow-x: auto; }
.fastkeys__slot {
  position: relative; flex: 1 1 0; min-width: 76px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 6px 6px 5px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text); cursor: pointer;
}
.fastkeys__slot:not(.is-empty) { border-style: solid; background: var(--surface); }
.fastkeys__slot:hover { border-color: var(--brand-400); }
.fastkeys__slot.is-assigning { border-color: var(--brand-500); box-shadow: var(--focus-ring); }
.fastkeys__key {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--text-subtle);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; background: var(--surface-2);
}
.fastkeys__name { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fastkeys__clear {
  position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger, #dc2626); color: #fff; font-size: 12px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
}
.fastkeys__edit { flex: 0 0 auto; align-self: center; }
.fastkeys__hint { align-self: center; color: var(--brand-600); font-weight: 700; white-space: nowrap; }
body.pos-touch .fastkeys__slot { min-height: 58px; min-width: 96px; }

.weigh__unit { font-size: var(--fs-lg); color: var(--text-subtle); margin-left: 6px; }
.weigh__preview { text-align: right; margin-top: 4px; }
.weigh .numpad { margin-top: var(--s3); }

.cline__unit { font-size: 11px; font-weight: 700; color: var(--text-subtle); align-self: center; margin-right: 2px; }

.xrep { width: 100%; border-collapse: collapse; }
.xrep td { padding: 4px 0; border-bottom: 1px solid var(--border); }
.xrep td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.cart .row--tight { flex-wrap: wrap; }

/* ============================================ customer-facing display (v2.0) */
.cd { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(160deg, #0b1020, #101a3a 60%, #0b1020); color: #fff; }
.cd__head { display: flex; align-items: center; justify-content: space-between; padding: 28px 40px; border-bottom: 1px solid rgba(255,255,255,.12); }
.cd__brand { display: flex; align-items: center; gap: 18px; }
.cd__logo { width: 72px; height: 72px; object-fit: contain; }
.cd__store { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.cd__tag { font-size: 13px; letter-spacing: .24em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.cd__clock { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.8); }
.cd__main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 40px 56px; overflow: hidden; }
.cd__lines { display: flex; flex-direction: column; gap: 14px; }
.cd__line { display: grid; grid-template-columns: 1fr auto auto; gap: 24px; align-items: baseline; font-size: 30px; }
.cd__line-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd__line-qty { color: rgba(255,255,255,.6); font-size: 24px; }
.cd__line-total { font-variant-numeric: tabular-nums; font-weight: 700; }
.cd__welcome { display: flex; flex-direction: column; align-items: center; gap: 18px; color: rgba(255,255,255,.75); font-size: 30px; text-align: center; }
.cd__total { text-align: center; }
.cd__total-label { font-size: 20px; letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.6); }
.cd__total-value { font-size: clamp(72px, 14vw, 148px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: #4ade80; line-height: 1.05; }
.cd__total-value.is-idle { color: rgba(255,255,255,.25); }
.cd__thanks { text-align: center; }
.cd__thanks-card { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cd__thanks-card [data-icon], .cd__thanks-card svg { width: 96px; height: 96px; color: #4ade80; }
.cd__thanks-title { font-size: clamp(48px, 8vw, 84px); font-weight: 800; letter-spacing: -.02em; }
.cd__change { display: flex; align-items: baseline; gap: 18px; font-size: 30px; color: rgba(255,255,255,.75); }
.cd__change strong { font-size: clamp(56px, 9vw, 96px); color: #4ade80; font-variant-numeric: tabular-nums; }
.cd__change-sub { font-size: 26px; color: rgba(255,255,255,.7); }
.cd__foot { padding: 20px 40px; text-align: center; color: rgba(255,255,255,.45); font-size: 15px; border-top: 1px solid rgba(255,255,255,.12); }
