/* =========================================================
   QBPOZ — pos.css   (Point of Sale: qb_order.html, requires base.css)
   ========================================================= */
body.pos {
  --foot-h: 80px;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--foot-h);           /* room for the fixed footer */
}

/* ---------- HEADER ---------- */
.pos-header {
  flex: none;
  position: relative; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background-color .35s, border-color .35s;
}
.pos-brand { display: none; flex-direction: column; line-height: 1.05; min-width: 0; }
.pos-brand b { font-family: var(--font-display); font-weight: 400; font-size: 24px; letter-spacing: 1px; }
.pos-brand b span { color: var(--accent); }
.pos-brand small { font-size: 12px; color: var(--muted); font-weight: 700; }

.search-group {
  flex: 1; min-width: 0;
  display: flex; align-items: stretch;
  height: 44px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.search-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.search-group select {
  flex: none; max-width: 130px;
  border: 0; border-right: 1px solid var(--border);
  background: transparent; color: var(--text);
  padding: 0 8px 0 12px;
  font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.search-group select:focus { outline: none; background: var(--accent-soft); }
.search-input { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
.search-input > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; width: 20px; height: 20px; }
.search-input input {
  width: 100%; height: 100%;
  border: 0; background: transparent; color: var(--text);
  padding: 0 38px 0 40px;
  font-size: 16px;
}
.search-input input:focus { outline: none; }
.search-input input::-webkit-search-cancel-button { display: none; }
.clear-btn {
  position: absolute; right: 6px;
  width: 28px; height: 28px; border-radius: 8px; border: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--muted);
  opacity: 0; transform: scale(.6); pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease), background-color .2s;
}
.clear-btn .icon { width: 16px; height: 16px; }
.clear-btn:hover { background: var(--danger-soft); color: var(--danger); }
.search-group.has-value .clear-btn { opacity: 1; transform: none; pointer-events: auto; }
.search-btn { height: auto; border-radius: 0; border: 0; }
.search-btn:active { transform: none; filter: brightness(.95); }

.qsearch-btn .icon { color: var(--accent); }

/* ---------- MAIN: two scrollable panes ---------- */
.pos-main {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 16px;
  padding: 16px;
}
.pos-tabs { display: none; }

.pane {
  min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background-color .35s, border-color .35s;
  animation: fade-up .45s var(--ease) both;
}
.pane-cart { animation-delay: .08s; }
.pane_head {
  flex: none;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  min-height: 56px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.pane_head h2 { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.pane_head h2::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: var(--accent); }
.pane_head h2 small { font-size: 13px; font-weight: 700; color: var(--muted); }
.pane_meta { margin-left: auto; font-size: 14px; color: var(--muted); }
.pane_body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  scrollbar-width: thin;
}

/* filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 4px 0 10px;
  border: 0; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 700;
  animation: pop .3s var(--ease);
}
.chip i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; transition: background-color .2s; }
.chip:hover i { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.chip .icon { width: 13px; height: 13px; }

/* ---------- PRODUCT GRID (search result) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px; }
.product {
  position: relative;
  display: flex; flex-direction: column;
  padding: 0; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: fade-up .35s var(--ease) both;
  animation-delay: calc(min(var(--i, 0), 18) * 25ms);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s, background-color .35s;
}
.product:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.product:active { transform: scale(.96); }
.product:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.product.added { animation: flash .6s ease-out; }
.product_tile {
  height: 78px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
  color: rgba(255,255,255,.95);
  position: relative;
}
.product_tile > .icon { width: 34px; height: 34px; stroke-width: 1.6; transition: transform .35s var(--ease); }
.product:hover .product_tile > .icon { transform: scale(1.12) rotate(-6deg); }
.product_code { position: absolute; left: 8px; top: 8px; font-size: 11px; font-weight: 700; background: rgba(0,0,0,.28); padding: 1px 7px; border-radius: 20px; letter-spacing: .4px; }
.in-cart {
  position: absolute; right: 8px; top: 8px;
  min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.in-cart:empty { display: none; }
.in-cart.bump { animation: bump .35s var(--ease); }
.product_body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.product_name { font-size: 15px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.product_name mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 1px; }
.product_price { font-size: 17px; font-weight: 700; color: var(--accent); margin-top: auto; }
.product_stock { font-size: 12.5px; color: var(--muted); }
.product_stock.low { color: var(--danger); font-weight: 700; }
.product.out { opacity: .5; cursor: not-allowed; }
.product.out:hover { transform: none; border-color: var(--border); box-shadow: none; }
.product.out .product_tile::after { content: "OUT OF STOCK"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); font-size: 12px; font-weight: 700; letter-spacing: 1px; }

/* ---------- CART (selected products) ---------- */
.cart-cols, .cart-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 86px 30px; align-items: center; gap: 8px; }
.cart-cols {
  flex: none;
  padding: 8px 18px 8px 16px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cart-cols span:nth-child(2) { text-align: center; }
.cart-cols span:nth-child(3) { text-align: right; }
.cart-list { padding: 4px 14px; }
.cart-row {
  padding: 10px 2px;
  border-bottom: 1px dashed var(--border);
  transition: opacity .25s, transform .25s var(--ease), background-color .3s;
}
.cart-row:last-child { border-bottom: 0; }
.cart-row.is-new { animation: slide-in .35s var(--ease); }
.cart-row.is-hit { background: var(--accent-soft); border-radius: 8px; }
.cart-row.removing { opacity: 0; transform: translateX(30px); }
.cart-row .ci-name { min-width: 0; }
.cart-row .ci-name b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-row .ci-name small { font-size: 13px; color: var(--muted); }
.line-total { text-align: right; font-weight: 700; font-size: 15px; }
.line-total.bump { animation: bump .35s var(--ease); color: var(--accent); }

.qty { display: inline-flex; align-items: stretch; justify-self: center; height: 34px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.qty button { width: 30px; border: 0; background: var(--surface-2); display: grid; place-items: center; transition: background-color .15s, color .15s; touch-action: manipulation; }
.qty button .icon { width: 15px; height: 15px; }
.qty button:hover { background: var(--accent-soft); color: var(--accent); }
.qty input { width: 46px; border: 0; background: transparent; color: var(--text); text-align: center; font-weight: 700; font-size: 15px; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; background: var(--accent-soft); }
.remove-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; transition: background-color .2s, color .2s; }
.remove-btn .icon { width: 16px; height: 16px; }
.remove-btn:hover { background: var(--danger-soft); color: var(--danger); }

.cart-empty { height: 100%; min-height: 180px; display: grid; place-content: center; text-align: center; color: var(--muted); gap: 6px; animation: fade-up .4s var(--ease); }
.cart-empty .icon { width: 46px; height: 46px; margin: 0 auto; opacity: .5; stroke-width: 1.5; }

.cart-summary { flex: none; display: grid; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--border); background: var(--surface-2); transition: background-color .35s; }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; }
.sum-row > span { color: var(--muted); font-weight: 600; }
.sum-row .disc { display: flex; gap: 6px; margin-left: auto; }
.sum-row .disc .input { height: 34px; padding: 0 10px; font-size: 15px; border-radius: 8px; background: var(--surface); }
.sum-row .disc input { width: 92px; }
.sum-row .disc select { width: 76px; padding: 0 6px; }
.sum-row #sumDiscount { min-width: 86px; text-align: right; color: var(--danger); }
.sum-row.total { padding-top: 8px; border-top: 1px dashed var(--border); }
.sum-row.total > span { color: var(--text); font-weight: 700; font-size: 17px; }
.sum-row.total strong { font-size: 22px; color: var(--accent); }

/* ---------- FOOTER (fixed) ---------- */
.pos-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--foot-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,.06);
  transition: background-color .35s, border-color .35s;
}
.foot-total { display: flex; align-items: center; gap: 24px; min-width: 0; }
.foot-meta { display: flex; flex-direction: column; font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.foot-amount small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.foot-amount strong { display: inline-block; font-family: var(--font-display); font-weight: 400; font-size: 36px; letter-spacing: 1px; line-height: 1; white-space: nowrap; }
.foot-amount strong.bump { animation: bump .35s var(--ease); color: var(--accent); }
.foot-actions { display: flex; gap: 10px; }
.foot-actions .btn { height: 52px; padding: 0 20px; font-size: 16px; }
.btn-confirm { min-width: 210px; }
.btn-confirm kbd { background: rgba(0,0,0,.12); border-color: transparent; color: inherit; }
.btn-confirm.ready { animation: glow 2.4s ease-in-out infinite; }
.pos-footer.shake .btn-confirm { animation: shake .35s ease; }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(255,140,30,.0); } 50% { box-shadow: 0 0 0 6px rgba(255,140,30,.22); } }

/* ---------- PAYMENT POPUP ---------- */
.pay-due {
  display: grid; justify-items: center; gap: 2px;
  padding: 14px 16px; margin-bottom: 16px;
  border: 1px dashed var(--accent); border-radius: 12px;
  background: var(--accent-soft);
  text-align: center;
}
.pay-due span { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.pay-due strong { font-family: var(--font-display); font-weight: 400; font-size: 42px; letter-spacing: 1px; line-height: 1.05; color: var(--accent); }
.pay-due small { font-size: 13px; color: var(--muted); }

.pay-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pay-type { position: relative; cursor: pointer; }
.pay-type input { position: absolute; opacity: 0; pointer-events: none; }
.pay-type .box {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px; font-weight: 700;
  transition: border-color .2s, background-color .2s, color .2s, transform .15s;
}
.pay-type .box .icon { width: 22px; height: 22px; color: var(--muted); transition: color .2s, transform .3s var(--ease); }
.pay-type:hover .box { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.pay-type input:checked + .box { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pay-type input:checked + .box .icon { color: var(--accent); transform: scale(1.12); }
.pay-type input:focus-visible + .box { box-shadow: 0 0 0 4px var(--accent-soft); }
.pay-type:active .box { transform: scale(.96); }

.ref-field { max-height: 0; opacity: 0; overflow: hidden; margin-bottom: 0; transition: max-height .3s var(--ease), opacity .25s, margin .3s; }
.ref-field.show { max-height: 110px; opacity: 1; margin-bottom: 14px; }
#payPaid[readonly] { opacity: .75; cursor: not-allowed; }

.quick-cash { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-cash:empty { display: none; }
.quick-cash button {
  height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface);
  font-size: 14px; font-weight: 700;
  transition: border-color .2s, background-color .2s, color .2s;
  animation: pop .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
}
.quick-cash button:hover { border-color: var(--accent); color: var(--accent); }

.balance-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; margin-bottom: 14px;
  border-radius: 12px;
  background: var(--success-soft); color: var(--success);
  font-weight: 700;
  transition: background-color .25s, color .25s;
}
.balance-box strong { font-size: 26px; white-space: nowrap; }
.balance-box.due  { background: var(--danger-soft); color: var(--danger); }
.balance-box.credit { background: var(--accent-soft); color: var(--accent); }
.balance-box strong.bump { animation: bump .3s var(--ease); }

/* ---------- Q-SEARCH POPUP ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface);
  text-align: left;
  animation: fade-up .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms);
  transition: transform .2s var(--ease), border-color .2s, background-color .2s;
}
.cat:hover { transform: translateY(-2px); border-color: var(--accent); }
.cat.active { border-color: var(--accent); background: var(--accent-soft); }
.cat_icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); }
.cat b { font-size: 16px; }
.cat small { color: var(--muted); font-size: 13px; margin-top: -6px; }

/* ---------- SAVED ORDERS POPUP ---------- */
.saved-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: 12px;
  animation: fade-up .3s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
  transition: opacity .25s, transform .25s var(--ease), border-color .2s;
}
.saved-row:hover { border-color: var(--accent); }
.saved-row.removing { opacity: 0; transform: translateX(30px); }
.saved-row b { display: block; font-size: 16px; }
.saved-row small { color: var(--muted); font-size: 13px; }
.saved-row .acts { display: flex; gap: 6px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }

/* shortcuts / summary tables */
.keys { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: center; }
.keys kbd { font-size: 13px; padding: 3px 9px; justify-self: start; }
.sales-sum { display: grid; gap: 8px; margin-top: 4px; }
.sales-sum div { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }
.sales-sum div.total { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ---------- CART ROW: editable line, price change, remark ---------- */
.cart-row .ci-name { cursor: pointer; border-radius: 6px; }
.cart-row .ci-name:hover b { color: var(--accent); }
.cart-row .ci-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cart-row .ci-name s { color: var(--muted); opacity: .8; margin-right: 3px; }
.cart-row .ci-name .new-price { color: var(--accent); font-weight: 700; }
.ci-remark {
  display: flex; align-items: center; gap: 4px;
  margin-top: 3px;
  font-size: 12.5px; font-style: italic; color: var(--info);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ci-remark .icon { width: 13px; height: 13px; flex-shrink: 0; }

/* ---------- ADD / EDIT ITEM POPUP ---------- */
.item-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; margin-bottom: 16px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2);
  animation: fade-up .3s var(--ease);
}
.item-head .tile {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
}
.item-head .tile .icon { width: 28px; height: 28px; stroke-width: 1.6; }
.item-head .info { min-width: 0; flex: 1; }
.item-head .info b { display: block; font-size: 17px; line-height: 1.2; }
.item-head .info small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.item-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-head .in-order { display: block; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--accent); }

.qty-big { display: flex; align-items: stretch; height: 46px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); transition: border-color .2s, box-shadow .2s; }
.qty-big:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.qty-big.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.qty-big button { width: 46px; border: 0; background: var(--surface); display: grid; place-items: center; transition: background-color .15s, color .15s; touch-action: manipulation; }
.qty-big button:hover { background: var(--accent-soft); color: var(--accent); }
.qty-big button:active .icon { transform: scale(.85); }
.qty-big input {
  flex: 1; min-width: 0; width: 100%; height: 100%;
  border: 0 !important; box-shadow: none !important; border-radius: 0;
  background: transparent; color: var(--text);
  text-align: center; font-size: 22px; font-weight: 700;
  padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.qty-big input::-webkit-outer-spin-button, .qty-big input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-big input:focus { outline: none; }
#itemPrice { height: 46px; font-size: 20px; font-weight: 700; }

.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chip-btn {
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface);
  font-size: 13px; font-weight: 700;
  transition: border-color .2s, color .2s, background-color .2s, transform .15s;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.chip-btn:active { transform: scale(.94); }
.chip-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.char-count { margin-left: auto; font-size: 12px; color: var(--muted); }

.price-hint { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.price-hint b { color: var(--text); }
.price-hint .min { transition: color .2s; }
.price-hint .min.bad, .price-hint .min.bad b { color: var(--danger); animation: shake .3s ease; }
.price-note { min-height: 20px; margin-top: 4px; font-size: 13px; font-weight: 700; }
.price-note.down { color: var(--success); }
.price-note.up   { color: var(--info); }
.price-note.bad  { color: var(--danger); }
.field .hint.bad { color: var(--danger); font-weight: 700; }

.line-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700;
}
.line-box span { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.line-box small { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.line-box strong { font-family: var(--font-display); font-weight: 400; font-size: 32px; letter-spacing: 1px; white-space: nowrap; line-height: 1; }
.line-box strong.bump { animation: bump .3s var(--ease); }

#itemPopup .popup_footer #itemRemoveBtn { margin-right: auto; }
#itemPopup:not(.is-edit) #itemRemoveBtn { display: none; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .pos-main { grid-template-columns: minmax(0, 1fr) minmax(330px, 380px); }
  .btn-confirm { min-width: 0; }
  .btn-confirm kbd { display: none; }
}

/* tablet / phone: one pane at a time, switch with tabs */
@media (max-width: 900px) {
  .pos-main { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 10px; }
  .pos-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  }
  .pos-tabs button {
    height: 40px; border: 0; border-radius: 9px; background: transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 700; color: var(--muted);
    transition: background-color .25s, color .25s;
  }
  .pos-tabs button .icon { width: 18px; height: 18px; }
  .pos-tabs button.active { background: var(--accent); color: var(--accent-ink); }
  .tab-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; font-size: 12px; background: var(--danger); color: #fff; }
  .tab-badge.bump { animation: bump .35s var(--ease); }
  .pane { grid-row: 2; grid-column: 1; }
  .pos-main[data-pane="products"] .pane-cart,
  .pos-main[data-pane="cart"] .pane-products { display: none; }
  .pos-main[data-pane] .pane { animation: fade-up .3s var(--ease) both; }
}

@media (max-width: 760px) {
  body.pos { --foot-h: 124px; }
  .pos-header { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .hamburger { order: 0; }
  .pos-brand { display: flex; flex: 1; order: 1; }
  .new-job-btn { order: 2; }
  .pos-header .menu-wrap { order: 3; }
  .search-group { order: 4; flex: 1 1 calc(100% - 58px); }
  .qsearch-btn { order: 5; }
  .new-job-btn span, .qsearch-btn span, .search-btn span { display: none; }
  .new-job-btn, .qsearch-btn { padding: 0 12px; }
  .search-btn { padding: 0 14px; }
  .search-group select { max-width: 84px; padding: 0 2px 0 8px; font-size: 14px; }
  .search-input input { padding-left: 34px; font-size: 16px; }
  .search-input > .icon { left: 9px; width: 18px; height: 18px; }

  .product-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
  .pane_body { padding: 10px; }
  .cart-list { padding: 2px 10px; }
  .cart-cols, .cart-row { grid-template-columns: minmax(0, 1fr) 104px 76px 28px; gap: 6px; }
  .cart-cols { padding: 8px 12px 8px 10px; }
  .cart-row .ci-name b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; font-size: 14.5px; }
  .balance-box strong { font-size: 22px; }

  .pos-footer { flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .foot-total { justify-content: space-between; gap: 12px; }
  .foot-meta { flex-direction: row; gap: 10px; }
  .foot-amount { text-align: right; }
  .foot-amount small { display: inline; margin-right: 6px; }
  .foot-amount strong { font-size: 30px; }
  .foot-actions .btn { flex: 1; height: 48px; padding: 0 8px; font-size: 15px; }
  .foot-actions .btn-confirm { flex: 1.5; }

  .pay-types { grid-template-columns: repeat(3, 1fr); }
  #itemPopup .popup_footer #itemRemoveBtn { flex: 0 0 48px; padding: 0; }
  #itemPopup .popup_footer #itemRemoveBtn span { display: none; }
  .line-box strong { font-size: 28px; }
}

@media (max-width: 420px) {
  .foot-actions #resetBtn .icon, .foot-actions #saveBtn .icon { display: none; }
  .foot-meta #ftQty { display: none; }
  .sum-row .disc input { width: 74px; }
}
