﻿/* Simple POS demo — counter, receipts and back-office screens.
   Reuses the site's palette and type from app.css; this file only adds the
   till layout, product grid and printable receipt. */

.pos-body { background: var(--surface); min-height: 100vh; display: flex; flex-direction: column; }
.pos-body h1 { font-size: 2rem; }
.pos-body h2 { font-size: 1.15rem; font-family: var(--font-body); font-weight: 600; margin: 0; }
.pos-body p { max-width: none; }
.btn-lg { padding: 15px 22px; font-size: 1.02rem; }

/* Top bar */
.pos-topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--ink); color: #DCE3DE; padding: 12px 22px;
  position: sticky; top: 0; z-index: 20;
}
.pos-topbar-left { display: flex; align-items: center; gap: 12px; }
.pos-mark {
  width: 38px; height: 38px; border-radius: 8px; background: var(--green); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.1rem;
}
.pos-shop-name { font-family: var(--font-display); font-size: 1.05rem; color: var(--white); line-height: 1.2; }
.pos-shop-meta { font-size: 0.75rem; color: #8FA096; }
.pos-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pos-nav a {
  color: #B7C2BB; text-decoration: none; font-size: 0.88rem; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius);
  display: inline-flex; align-items: center; min-height: 38px; white-space: nowrap;
  touch-action: manipulation;
}
.pos-nav a:hover { color: var(--white); background: rgba(255,255,255,0.06); }
.pos-nav a.active { color: var(--white); background: var(--green-deep); }
.pos-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pos-switch { display: flex; align-items: center; gap: 8px; }
.pos-switch-label { font-size: 0.75rem; color: #8FA096; }
.pos-switch select {
  background: var(--ink); color: var(--white); border: 1px solid #33453C;
  border-radius: var(--radius); padding: 7px 10px; font-family: var(--font-body); font-size: 0.85rem;
}
.pos-topbar .btn-ghost { border-color: #33453C; color: #DCE3DE; }
.pos-topbar .btn-ghost:hover { border-color: var(--white); color: var(--white); }

.pos-role { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 10px; border-radius: 999px; }
.pos-role.is-admin { background: var(--green); color: var(--white); }
.pos-role.is-cashier { background: var(--amber); color: var(--white); }

/* Flash messages */
.pos-flash { padding: 12px 22px; font-size: 0.9rem; }
.pos-flash-success { background: #E6F3EC; color: var(--green-deep); border-bottom: 1px solid #BEE1CE; }
.pos-flash-error { background: #FBEAE6; color: var(--danger); border-bottom: 1px solid #F2C7BC; }

/* Full-bleed main area: the counter and back-office screens use every pixel
   on laptops, tablets and phones alike. */
.pos-main { flex: 1; width: 100%; max-width: 100%; margin: 0; padding: 22px clamp(14px, 2vw, 30px) 44px; }
.pos-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px dashed var(--line); padding: 18px 22px; font-size: 0.8rem; color: var(--ink-soft);
}
.pos-footer a { color: var(--green); text-decoration: none; font-weight: 600; }

/* ===== Entry screen ===== */
.pos-enter { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.pos-enter-intro h1 { margin-bottom: 12px; }
.pos-enter-list { margin: 18px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: 0.94rem; }
.pos-enter-list li { margin-bottom: 6px; }
.pos-enter-note {
  margin-top: 22px; padding: 16px 18px; font-size: 0.88rem; line-height: 1.6;
  color: var(--ink-soft); background: var(--amber-soft);
  border-left: 3px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0;
}
.pos-enter-note strong { color: var(--ink); }
.pos-enter-note a { color: var(--green); font-weight: 600; text-decoration: none; }
.pos-enter-note a:hover { text-decoration: underline; }
.pos-enter-cards { display: flex; flex-direction: column; gap: 20px; }
.pos-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.pos-card h3 { margin-bottom: 6px; }
.pos-card-hint { font-size: 0.85rem; margin-bottom: 14px; }
.pos-account-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font-family: var(--font-body);
}
.pos-account-btn:hover { border-color: var(--green); background: #F7FAF8; }
.pos-account-name { font-weight: 600; font-size: 0.95rem; }

/* ===== Counter ===== */
.pos-counter {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 22px;
  align-items: stretch;
}
.pos-filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.pos-filters input[type=search], .pos-filters select {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
  font-family: var(--font-body); font-size: 0.92rem; background: var(--white);
}
.pos-filters input[type=search] { flex: 1; min-width: 220px; }

.pos-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.pos-product {
  text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; font-family: var(--font-body); display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.pos-product:hover:not(:disabled) { border-color: var(--green); transform: translateY(-2px); box-shadow: 0 10px 22px -16px rgba(22,33,27,0.5); }
.pos-product:disabled { opacity: 0.55; cursor: not-allowed; background: var(--surface-deep); }
.pos-product-name { font-weight: 600; font-size: 0.93rem; line-height: 1.3; }
.pos-product-meta { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pos-product-price { font-family: var(--font-mono); color: var(--green); font-size: 0.95rem; }
.pos-product-sku { font-size: 0.7rem; color: var(--ink-soft); }
.pos-product-stock { font-size: 0.75rem; color: var(--ink-soft); }
.pos-low { color: var(--danger); font-weight: 600; }
.pos-empty { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--ink-soft); }

/* Sale success banner */
.pos-sale-alert[hidden], [hidden] {
  display: none !important;
}
.pos-sale-alert:not([hidden]) {
  display: flex;
}
.pos-sale-alert {
  background: #E8F6EE; border: 1px solid #73C991; color: #0E5A35; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px; align-items: center; justify-content: space-between;
  gap: 16px; box-shadow: 0 4px 14px rgba(14,90,53,0.08);
}
.pos-sale-alert-content { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; }
.pos-sale-alert-icon {
  width: 28px; height: 28px; border-radius: 50%; background: #0E5A35; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 700; flex-shrink: 0;
}
.pos-sale-alert-actions { display: flex; align-items: center; gap: 10px; }
.pos-sale-alert-close {
  background: none; border: none; font-size: 1.5rem; line-height: 1; color: #0E5A35;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.pos-sale-alert-close:hover { background: rgba(14,90,53,0.1); }

.pos-till {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.pos-till-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
  flex-shrink: 0;
}
.pos-till-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pos-till-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pos-cart {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 18px;
  -webkit-overflow-scrolling: touch;
}
.pos-cart-empty { font-size: 0.88rem; color: var(--ink-soft); padding: 18px 0; }
.pos-cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.pos-cart-line:last-child { border-bottom: none; }
.pos-cart-name { font-size: 0.9rem; font-weight: 600; }
.pos-cart-unit { font-size: 0.75rem; color: var(--ink-soft); }
.pos-cart-total { font-family: var(--font-mono); font-size: 0.9rem; text-align: right; }
.pos-cart-controls { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; margin-top: 4px; }
.pos-cart-controls button.pos-cart-step,
.pos-cart-controls button:not(.pos-cart-remove) {
  width: 30px; height: 30px; border: 1px solid var(--line); background: var(--white); border-radius: 6px;
  cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--ink); touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s ease;
}
.pos-cart-controls button.pos-cart-step:active,
.pos-cart-controls button:not(.pos-cart-remove):active { background: #E8F6EE; border-color: var(--green); transform: scale(0.95); }
.pos-cart-controls button.pos-cart-step:hover,
.pos-cart-controls button:not(.pos-cart-remove):hover { border-color: var(--green); color: var(--green); }
.pos-cart-qty { min-width: 28px; text-align: center; font-size: 0.92rem; font-weight: 700; }
.pos-cart-remove {
  width: auto !important; height: 28px !important; min-height: 0 !important;
  padding: 0 10px !important; margin-left: auto !important;
  background: #FFF5F5 !important; border: 1px solid #FED7D7 !important; border-radius: 6px !important;
  color: #C53030 !important; font-size: 0.78rem !important; font-weight: 600 !important;
  cursor: pointer !important; display: inline-flex !important; align-items: center !important;
  justify-content: center !important; gap: 4px !important; text-decoration: none !important;
  touch-action: manipulation !important; transition: all 0.15s ease !important;
}
.pos-cart-remove:hover { background: #FED7D7 !important; border-color: #FEB2B2 !important; color: #9B2C2C !important; }
.pos-cart-remove:active { transform: scale(0.96) !important; }

.pos-till-body { border-top: 1px solid var(--line); padding: 16px 18px 18px; }
.pos-money-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pos-money-row label { font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.pos-money-row input, .pos-money-row select {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px;
  font-family: var(--font-body); font-size: 0.92rem; width: 175px; background: var(--white);
}
.pos-money-row input:focus, .pos-money-row select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,110,79,0.12); }
.pos-totals { border-top: 1px solid var(--line); margin: 14px 0; padding-top: 12px; }
.pos-total-line { display: flex; justify-content: space-between; font-size: 0.88rem; padding: 3px 0; color: var(--ink-soft); }
.pos-total-line span:last-child { font-family: var(--font-mono); color: var(--ink); }
.pos-total-grand { font-weight: 700; font-size: 1.08rem; padding-top: 8px; }
.pos-total-grand span:last-child { color: var(--green); font-size: 1.2rem; }
.pos-total-change { color: var(--amber) !important; font-weight: 600; }
.pos-checkout-error { background: #FBEAE6; color: var(--danger); border: 1px solid #F2C7BC; border-radius: var(--radius); padding: 10px 12px; font-size: 0.84rem; margin-bottom: 12px; }

/* Sticky cart / checkout bar — permanent on screen with dynamic tabs for Current Sale and each Held Order */
.pos-cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex !important; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--white);
  padding: 8px clamp(12px, 2.5vw, 24px);
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 24px rgba(10, 20, 15, 0.28);
  box-sizing: border-box;
  transition: box-shadow 0.3s ease;
}
.pos-cart-bar-tabs-scroll {
  overflow-x: auto;
  max-width: clamp(260px, 50vw, 650px);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
}
.pos-cart-bar-tabs-scroll::-webkit-scrollbar { display: none; }
.pos-cart-bar-tabs {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: nowrap;
}
.pos-cart-bar-tabs-wrap {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex-shrink: 1;
}
.pos-cart-bar-scroll {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.pos-bar-scroll-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #DCE3DE;
  font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pos-bar-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.25);
}
.pos-bar-scroll-btn:active { transform: scale(0.94); }
.pos-bar-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  color: #DCE3DE;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.pos-bar-tab:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.25);
}
.pos-bar-tab.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(11, 110, 79, 0.35);
}
.pos-bar-tab.is-held-tab {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.4);
  color: #FDE68A;
}
.pos-bar-tab.is-held-tab:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: #F59E0B;
  color: #FFF;
}
.pos-bar-tab.is-held-tab.is-active {
  background: #D97706;
  border-color: #F59E0B;
  color: #FFF;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}
.pos-bar-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 0.72rem; font-weight: 700;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--white);
}
.pos-bar-tab.is-active .pos-bar-tab-badge {
  background: rgba(255, 255, 255, 0.25);
}
.pos-tab-discard {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; margin-left: 2px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px; line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pos-tab-discard:hover {
  background: var(--danger);
  color: var(--white);
}
.pos-cart-bar-right {
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
}
.pos-cart-bar-info { display: flex; align-items: baseline; gap: 8px; font-size: 0.88rem; min-width: 0; }
.pos-cart-bar-label { color: #B7C2BB; font-size: 0.82rem; }
.pos-cart-bar-total { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 700; color: #6EE7B7; }
.pos-cart-bar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pos-cart-bar .btn-ghost { border-color: #33453C; color: #DCE3DE; }
.pos-cart-bar .btn-ghost:hover:not(:disabled) { border-color: var(--white); color: var(--white); }
.pos-cart-bar .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.pos-cart-bar .btn-primary { min-height: 42px; padding: 8px 18px; white-space: nowrap; }

/* Animation: Order flying from till down to pos cart bar */
@keyframes heldTabPop {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.65);
    box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.9);
  }
  50% {
    opacity: 1;
    transform: translateY(-5px) scale(1.14);
    box-shadow: 0 0 0 10px rgba(110, 231, 183, 0.45), 0 8px 24px rgba(16, 185, 129, 0.6);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
}

.pos-tab-enter-anim {
  animation: heldTabPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes barGlowPulse {
  0% {
    box-shadow: 0 -8px 24px rgba(10, 20, 15, 0.28);
  }
  40% {
    box-shadow: 0 -14px 36px rgba(16, 185, 129, 0.6), 0 0 0 2.5px #6EE7B7;
  }
  100% {
    box-shadow: 0 -8px 24px rgba(10, 20, 15, 0.28);
  }
}

.pos-bar-glow {
  animation: barGlowPulse 0.9s ease-out !important;
}

/* Flying ghost element moving from till down to cart bar */
.pos-flying-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--ink);
  color: #6EE7B7;
  border: 1.5px solid #6EE7B7;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4), 0 0 0 4px rgba(110, 231, 183, 0.35);
  transition: all 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}
/* ===== Checkout & Payment Modal ===== */
.pos-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  background: rgba(10, 20, 15, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.pos-modal-backdrop[hidden] {
  display: none !important;
}

.pos-modal-dialog {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(10, 25, 18, 0.32), 0 4px 16px rgba(0,0,0,0.08);
  border: 1px solid var(--line);
  width: 100%;
  max-width: 530px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  animation: posModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes posModalPop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ── Header ── */
.pos-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: #FAFBF9;
  flex-shrink: 0;
}

.pos-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pos-modal-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: #E8F6EE;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pos-modal-title {
  font-size: 1.15rem;
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  color: var(--ink);
  line-height: 1.2;
}

.pos-modal-subtitle {
  font-size: 0.77rem;
  color: var(--ink-soft);
  margin: 2px 0 0;
}

.pos-modal-close {
  background: none;
  border: none;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.pos-modal-close:hover {
  background: rgba(0,0,0,0.07);
  color: var(--ink);
}

/* ── Body: single scrollable column ── */
.pos-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* ── Total hero card ── */
.pos-modal-total-card {
  background: linear-gradient(135deg, #0A4F38 0%, #053324 100%);
  color: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 6px 20px rgba(10,79,56,0.22);
  flex-shrink: 0;
}

.pos-modal-total-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #A3D9C4;
  font-weight: 700;
  margin-bottom: 4px;
}

.pos-modal-total-breakdown {
  font-size: 0.76rem;
  color: #C8E8DA;
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
}

.pos-modal-total-amount {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  color: #6EE7B7;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

/* ── Section dividers ── */
.pos-modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-modal-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0;
}

/* ── Field grid ── */
.pos-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Form fields ── */
.pos-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pos-modal-field label {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.pos-modal-field input,
.pos-modal-field select,
.pos-modal-field textarea {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  width: 100%;
  background: var(--white);
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pos-modal-field input:focus,
.pos-modal-field select:focus,
.pos-modal-field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11,110,79,0.12);
}

/* ── Payment method pills ── */
.pos-payment-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pos-payment-pill {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 6px 9px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
  position: relative;
}

.pos-payment-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pos-payment-pill-icon  { font-size: 1.3rem; line-height: 1; }

.pos-payment-pill-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}

.pos-payment-pill:hover { border-color: #AAB9AD; background: #F7FAF7; }

.pos-payment-pill.is-active {
  border-color: var(--green);
  background: #EAF6F0;
  box-shadow: 0 0 0 1px var(--green);
}

.pos-payment-pill.is-active .pos-payment-pill-name { color: var(--green-deep); }

/* ── Cash section: input left, numpad right ── */
.pos-cash-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.pos-cash-input {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.pos-cash-input > label {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ── Currency input group ── */
.pos-modal-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.pos-modal-input-group .pos-modal-currency {
  position: absolute;
  left: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.pos-modal-input-group input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px 12px 36px !important;
  font-family: var(--font-mono) !important;
  font-size: 1.45rem !important;
  font-weight: 700;
  color: var(--ink);
  background: var(--white);
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pos-modal-input-group input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11,110,79,0.12);
}

/* ── Quick cash chips ── */
.pos-quick-cash {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pos-quick-cash-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pos-quick-cash-btns {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.pos-quick-btn {
  background: #EEF2EE;
  border: 1px solid #D2DDD4;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  touch-action: manipulation;
}

.pos-quick-btn:hover  { background: #DCE5DD; border-color: #B5C5B9; }
.pos-quick-btn:active { transform: scale(0.96); }

.pos-quick-btn.is-exact {
  background: #E8F6EE;
  border-color: #73C991;
  color: #0E5A35;
  font-weight: 700;
}

/* ── Change due card ── */
.pos-modal-change-box {
  background: #F2FAF6;
  border: 1.5px solid #C8E3D5;
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  transition: background 0.2s, border-color 0.2s;
}

.pos-modal-change-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pos-modal-change-val {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--green);
}

.pos-modal-change-box.is-short { background: #FFF9F2; border-color: #F6AD55; }
.pos-modal-change-box.is-short .pos-modal-change-val { color: var(--amber); }

/* ── Non-cash notice ── */
.pos-modal-notice {
  background: #F0F7F4;
  border: 1px solid #C8E3D5;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.86rem;
  color: #1E3A2F;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Error block ── */
.pos-checkout-error {
  background: #FBEAE6;
  border: 1px solid #F2C7BC;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 0.84rem;
  color: var(--danger);
  font-weight: 500;
}

.pos-checkout-error[hidden] { display: none; }

/* ── Numpad (standalone, inside numpad container) ── */
.pos-numpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.pos-numpad-key {
  height: 44px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}

.pos-numpad-key:hover  { background: #F2F6F2; border-color: #AABFAD; }
.pos-numpad-key:active { background: #E4EAE4; transform: scale(0.95); }

.pos-numpad-key.pos-numpad-action {
  background: #F7FAF8;
  color: var(--ink-soft);
  font-size: 1rem;
}

.pos-numpad-key.pos-numpad-action:hover { background: #EAEFEA; }
.pos-numpad-key[data-key="clear"] { color: var(--danger); font-weight: 800; }

.pos-numpad-key.pos-numpad-exact {
  background: #E8F6EE;
  border-color: #73C991;
  color: #0E5A35;
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-weight: 700;
}

.pos-numpad-key.pos-numpad-exact:hover { background: #D7EFE0; }

/* ── Side numpad panel (inside .pos-cash-row) ── */
.pos-side-pad {
  display: flex;
  flex-direction: column;
  background: #F7FAF8;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  width: 196px;
  flex-shrink: 0;
}

.pos-side-pad .pos-numpad       { gap: 5px; }
.pos-side-pad .pos-numpad-key   { height: 46px; font-size: 1.15rem; border-radius: 8px; }
.pos-side-pad .pos-numpad-key.pos-numpad-action { font-size: 1rem; }
.pos-side-pad .pos-numpad-key.pos-numpad-exact  { font-size: 0.79rem; }

/* ── Footer ── */
.pos-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #FAFBF9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.pos-modal-footer .btn-lg {
  min-height: 46px;
  padding: 11px 22px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* ── Checkout modal: proper popup (not full-viewport) ── */
#pos-checkout-modal .pos-modal-dialog {
  max-width: 720px;
  width: calc(100vw - 24px);
  max-height: 92vh;
  height: auto;
}

/* ── Pro POS: 3-col customer row ── */
.pos-checkout-customer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* ── Legacy layout aliases (kept for JS compatibility) ── */
.pos-modal-body.pos-modal-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pos-checkout-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pos-checkout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* ── Responsive ── */
@media (max-width: 680px) {
  #pos-checkout-modal .pos-modal-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .pos-cash-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .pos-side-pad {
    width: 100%;
  }

  .pos-side-pad .pos-numpad-key { height: 50px; }

  .pos-checkout-customer { grid-template-columns: 1fr 1fr; }

  .pos-checkout-row { grid-template-columns: 1fr; }

  .pos-modal-footer { flex-direction: column-reverse; gap: 8px; }
  .pos-modal-footer .btn { width: 100%; }
}

@media (max-width: 440px) {
  .pos-modal-grid { grid-template-columns: 1fr; }
  .pos-checkout-customer { grid-template-columns: 1fr; }
  .pos-modal-body { padding: 14px 16px; gap: 13px; }
  .pos-modal-header { padding: 14px 16px 12px; }
  .pos-modal-footer { padding: 12px 16px; }
  .pos-modal-total-amount { font-size: 1.7rem; }
}


/* Held Sales */
.pos-held-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.pos-held-pill:hover {
  background: #FDE68A;
  border-color: #F59E0B;
}

.pos-held-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.pos-held-card {
  background: #FAFBF9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}

.pos-held-card:hover {
  border-color: #B2C2B6;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.pos-held-meta h4 {
  margin: 0 0 2px;
  font-size: 0.94rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
}

.pos-held-meta p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.pos-held-meta .pos-held-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--green);
}

.pos-held-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pos-btn-danger-icon {
  color: var(--danger) !important;
  border-color: #F2C7BC !important;
  padding: 6px 10px !important;
}

.pos-btn-danger-icon:hover {
  background: #FBEAE6 !important;
  border-color: var(--danger) !important;
}

.pos-held-empty {
  text-align: center;
  padding: 30px 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* Till Tabs */
.pos-till-tabs-scroll {
  overflow-x: auto;
  max-width: 280px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pos-till-tabs-scroll::-webkit-scrollbar { display: none; }
.pos-till-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #EDF2EE;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-wrap: nowrap;
}

.pos-till-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.pos-till-tab:hover {
  color: var(--ink);
}

.pos-till-tab.is-active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.pos-till-tab.is-held-tab {
  color: #B45309;
}
.pos-till-tab.is-held-tab:hover {
  color: #78350F;
}
.pos-till-tab.is-held-tab.is-active {
  background: #FEF3C7;
  color: #92400E;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.15);
}

.pos-till-tab-discard {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pos-till-tab-discard:hover {
  background: var(--danger);
  color: var(--white);
}

.pos-till-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  background: #DCE3DE;
  color: var(--ink);
}

.pos-till-tab.is-active .pos-till-tab-badge {
  background: var(--green);
  color: var(--white);
}

.pos-till-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}

.pos-till-panel[hidden] {
  display: none !important;
}

/* Held Sales Pane inside Till */
.pos-held-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  padding: 14px 18px;
  overflow-y: auto;
}

.pos-held-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.pos-held-pane-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

/* Two-Section Counter: Product Rows expand & scroll independently, Cart sticks at full screen height */
@media (min-width: 901px) {
  .pos-main {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .pos-counter {
    display: grid;
    grid-template-columns: 1fr 410px;
    gap: 20px;
    height: calc(100vh - 104px - 62px);
    max-height: calc(100vh - 104px - 62px);
    align-items: stretch;
    box-sizing: border-box;
  }
  .pos-catalogue {
    height: 100%;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-gutter: stable;
    display: flex;
    flex-direction: column;
  }
  .pos-catalogue .pos-filters {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
    padding-top: 2px;
    padding-bottom: 12px;
  }
  .pos-till {
    height: 100%;
    max-height: 100%;
    position: sticky;
    top: 74px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(10, 20, 15, 0.05);
  }
  .pos-till-head {
    flex-shrink: 0;
  }
  .pos-cart {
    flex: 1 1 0%;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto;
  }
  .pos-till-body {
    flex-shrink: 0;
    margin-top: auto;
  }
}

/* ===== Receipt ===== */
.pos-receipt-wrap { display: flex; justify-content: center; padding: 10px 0 20px; }
.pos-receipt {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; box-shadow: 0 4px 18px rgba(0,0,0,0.06); padding: 24px 20px;
  font-family: var(--font-mono); font-size: 0.85rem; color: #111;
  box-sizing: border-box; transition: max-width 0.2s ease;
}

/* Paper size modifiers on screen */
.pos-receipt.paper-80mm { max-width: 360px; }
.pos-receipt.paper-58mm { max-width: 275px; font-size: 0.76rem; padding: 16px 12px; }
.pos-receipt.paper-a4 { max-width: 620px; font-size: 0.92rem; padding: 36px 32px; }

/* Thermal Receipt inner structure */
.receipt-header { text-align: center; margin-bottom: 12px; }
.receipt-store-name {
  font-family: var(--font-display, sans-serif); font-size: 1.28rem; font-weight: 700;
  margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.5px; color: #000;
}
.receipt-store-info { font-size: 0.78rem; line-height: 1.45; color: #333; }

.receipt-rule-solid { border: none; border-top: 1.5px solid #000; margin: 10px 0; }
.receipt-rule-dashed { border: none; border-top: 1px dashed #444; margin: 10px 0; }
.receipt-rule-double { border: none; border-top: 3px double #000; margin: 10px 0; }

.receipt-meta { font-size: 0.8rem; margin: 8px 0; }
.receipt-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.receipt-row span:first-child { color: #333; }
.receipt-row span:last-child { font-weight: 600; color: #000; }

.receipt-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.82rem; }
.receipt-table th {
  text-align: left; padding: 6px 0; border-bottom: 1px dashed #000;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.5px; color: #000;
}
.receipt-table td { padding: 5px 0; vertical-align: top; }
.receipt-table .th-qty, .receipt-table .td-qty { text-align: center; width: 40px; }
.receipt-table .th-price, .receipt-table .td-price { text-align: right; width: 68px; }
.receipt-table .th-total, .receipt-table .td-total { text-align: right; width: 72px; font-weight: 600; }
.receipt-item-name { font-weight: 600; color: #000; word-break: break-word; }
.receipt-item-sub { font-size: 0.72rem; color: #555; }

.receipt-totals { margin: 8px 0; }
.receipt-totals .receipt-row { margin-bottom: 5px; }
.receipt-grand-total {
  font-size: 1.15rem !important; font-weight: 800 !important; color: #000 !important;
  padding: 6px 0; border-top: 1px dashed #000; border-bottom: 1px dashed #000; margin: 8px 0;
}
.receipt-grand-total span:last-child { font-size: 1.25rem !important; }
.receipt-change span:last-child { color: #0E5A35 !important; font-weight: 700; }
.receipt-balance span:last-child { color: #C53030 !important; font-weight: 700; }

.receipt-footer { text-align: center; margin-top: 14px; font-size: 0.78rem; color: #444; }
.receipt-footer-msg { font-weight: 600; margin: 0 0 4px; color: #111; }
.receipt-item-count { font-size: 0.75rem; color: #555; margin-bottom: 8px; }

.receipt-barcode { margin-top: 12px; text-align: center; }
.receipt-barcode-bars {
  height: 34px; width: 180px; max-width: 80%; margin: 0 auto 4px;
  background: repeating-linear-gradient(
    to right,
    #000 0px, #000 2px,
    #fff 2px, #fff 4px,
    #000 4px, #000 6px,
    #fff 6px, #fff 7px,
    #000 7px, #000 10px,
    #fff 10px, #fff 12px,
    #000 12px, #000 15px,
    #fff 15px, #fff 17px,
    #000 17px, #000 20px,
    #fff 20px, #fff 22px
  );
}
.receipt-barcode-code { font-size: 0.72rem; letter-spacing: 2px; color: #222; }

.pos-receipt-actions { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.pos-receipt-paper-picker { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; font-weight: 600; color: var(--ink-soft); }
.pos-receipt-paper-picker select {
  padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); font-family: var(--font-body); font-size: 0.86rem; font-weight: 500;
}
.pos-receipt-paper-picker select:focus { outline: none; border-color: var(--green); }

/* ===== Back office screens ===== */
.pos-page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.pos-page-head h1 { font-size: 1.5rem; margin: 0; }
.pos-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.pos-stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.pos-stat .num { font-family: var(--font-display); font-size: 1.5rem; }
.pos-stat .label { font-size: 0.78rem; color: var(--ink-soft); }

/* Two column panels that collapse on tablets/phones */
.pos-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
@media (max-width: 900px) {
  .pos-grid-2 { grid-template-columns: 1fr; gap: 16px; }
}

.pos-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; overflow: hidden; }
.pos-panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pos-panel-head h3 { margin: 0; font-size: 1rem; }
.pos-panel-body { padding: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pos-panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

table.pos-table { width: 100%; border-collapse: collapse; }
table.pos-table th { text-align: left; font-size: 0.76rem; color: var(--ink-soft); font-weight: 600; padding: 12px 20px; border-bottom: 1px solid var(--line); }
table.pos-table td { padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
table.pos-table tr:last-child td { border-bottom: none; }
table.pos-table .num { font-family: var(--font-mono); text-align: right; }
.pos-inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pos-inline-form input, .pos-inline-form select {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 9px;
  font-family: var(--font-body); font-size: 0.85rem; background: var(--white);
}
.pos-inline-form input[type=number] { width: 82px; }
.pos-empty-row { padding: 40px 20px; text-align: center; color: var(--ink-soft); }
.pos-tag { display: inline-block; font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-deep); color: var(--ink-soft); }
.pos-tag-active { background: #E6F3EC; color: var(--green-deep); }
.pos-tag-inactive { background: #F3E7E4; color: var(--danger); }
.pos-tag-warn { background: var(--amber-soft); color: var(--amber); }
.pos-tag-danger { background: #F3E7E4; color: var(--danger); }
.pos-tag-info { background: #E7EEF6; color: #2B5878; }
.pos-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.pos-form-grid .field-full { grid-column: 1 / -1; }
.pos-check-row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 500; }
.pos-note { font-size: 0.82rem; color: var(--ink-soft); }
.pos-danger-zone { border-color: #F2C7BC; }
.pos-danger-zone .pos-panel-head h3 { color: var(--danger); }

/* ============================================================
   Responsive layer — laptop, tablet (landscape & portrait), phone
   ============================================================ */

/* --- Top bar: below 1200px the navigation gets its own swipeable row --- */
@media (max-width: 1199px) {
  .pos-topbar { gap: 8px 14px; padding: 10px clamp(12px, 2vw, 20px); }
  .pos-topbar-left { min-width: 0; }
  .pos-topbar-left > div { min-width: 0; }
  .pos-topbar .pos-nav, .pos-topbar .pos-pro-nav {
    order: 3; width: 100%;
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin: 0 calc(-1 * clamp(12px, 2vw, 20px));
    padding: 0 clamp(12px, 2vw, 20px) 2px;
  }
  .pos-nav::-webkit-scrollbar, .pos-pro-nav::-webkit-scrollbar { display: none; }
  .pos-nav a, .pos-pro-nav a { min-height: 44px; padding: 10px 14px; }
  .pos-topbar-right { row-gap: 6px; }
}

/* --- Touch devices: fat targets, no iOS focus zoom --- */
@media (pointer: coarse), (max-width: 900px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .pos-nav a, .pos-pro-nav a { min-height: 44px; }
  .pos-product { min-height: 112px; }
  .pos-product-grid { gap: 14px; }
  .pos-cart-controls button:not(.pos-cart-remove) { width: 42px; height: 42px; font-size: 1.2rem; }
  .pos-filters input[type=search], .pos-filters select,
  .pos-money-row input, .pos-money-row select,
  .pos-inline-form input, .pos-inline-form select,
  .pos-switch select, .pos-receipt-paper-picker select {
    font-size: 16px; min-height: 46px;
  }
  .pos-preset-btn { min-height: 44px; display: inline-flex; align-items: center; }
  table.pos-table th, table.pos-table td { padding: 13px 16px; }
}

/* --- Laptop & tablet landscape: two column counter with a fixed till --- */
@media (max-width: 1400px) and (min-width: 901px) {
  .pos-counter { grid-template-columns: 1fr minmax(320px, 360px); gap: 18px; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .pos-product { min-height: 104px; padding: 14px; }
  .pos-product-name { font-size: 0.94rem; }
  .pos-product-price { font-size: 1rem; }
  .pos-money-row input, .pos-money-row select { width: 150px; min-height: 44px; }
  .pos-till { position: sticky; top: 76px; }
  .pos-till-head { padding: 18px 20px; }
  .pos-cart { max-height: 320px; }
  .pos-cart-line { padding: 14px 0; }
  .pos-till-body .btn-block { min-height: 56px; font-size: 1.05rem; }
  .pos-filters input[type=search], .pos-filters select { min-height: 44px; font-size: 0.95rem; }
  .pos-filters .btn { min-height: 44px; }
}

/* The header wraps to two rows here, so the till needs a taller offset. */
@media (max-width: 1199px) and (min-width: 901px) {
  .pos-counter { grid-template-columns: 1fr 340px; gap: 16px; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .pos-till { top: 118px; }
  .pos-money-row input, .pos-money-row select { width: 140px; }
}

/* --- Tablet portrait & smaller: stacked counter, sticky checkout bar --- */
@media (max-width: 900px) {
  .pos-body { padding-bottom: 76px; }
  .pos-counter, .pos-pro-counter { grid-template-columns: 1fr; gap: 20px; }
  .pos-till { position: static; }
  .pos-cart { max-height: 260px; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .pos-enter { grid-template-columns: 1fr; gap: 28px; }
  .pos-form-grid { grid-template-columns: 1fr; }
  .pos-topbar-right { width: 100%; margin-left: 0; }
  .pos-money-row { gap: 10px; }
  .pos-money-row input, .pos-money-row select { width: min(52%, 220px); }
  .pos-till-body .btn-block { min-height: 56px; font-size: 1.05rem; }
  .pos-main { padding-top: 16px; }
  .pos-page-head h1 { font-size: 1.3rem; }
}

/* --- Phones --- */
@media (max-width: 560px) {
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
  .pos-product { min-height: 100px; padding: 12px; }
  .pos-stats { grid-template-columns: 1fr 1fr; }
  .pos-money-row input, .pos-money-row select { width: min(58%, 170px); }
  .pos-cart-bar-info { gap: 8px; font-size: 0.84rem; }
  .pos-cart-bar-total { font-size: 1rem; }
  .pos-cart-bar .btn-ghost:not(.pos-cart-open-btn) { display: none; }
  .pos-footer { flex-direction: column; gap: 8px; }
  .pos-receipt.paper-80mm { max-width: 100%; }
  .pos-receipt.paper-58mm { max-width: 100%; }
}

/* ============================================================
   Mobile experience enhancements
   — compact app-style header
   — slide-up cart sheet with backdrop
   — thumb-friendly cart bar, products and back-office forms
   ============================================================ */

/* Hidden on desktop; JS adds .pos-mobile-cart to <body> on small screens */
.pos-cart-overlay,
.pos-cart-open-btn,
.pos-sheet-close {
  display: none;
}

/* Utility grids used by the Pro back-office screens */
.pos-split-grid { display: grid; gap: 20px; align-items: start; }
.pos-split-grid > *,
.pos-form-row > * { min-width: 0; }
.pos-split-grid-main-aside { grid-template-columns: minmax(0, 1fr) 360px; }
.pos-split-grid-aside-main { grid-template-columns: 360px minmax(0, 1fr); }
.pos-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; align-items: end; }
.pos-form-row-aside { grid-template-columns: minmax(0, 1fr) 140px; }
.pos-form-row-wide { grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr)) auto; }

@media (max-width: 900px) {
  .pos-split-grid-main-aside,
  .pos-split-grid-aside-main { grid-template-columns: minmax(0, 1fr); }
}

/* ── Compact header on phones and portrait tablets ── */
@media (max-width: 900px) {
  .pos-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand tools"
      "nav nav";
    align-items: center;
    gap: 8px 10px;
    padding: 8px 12px;
  }
  .pos-topbar-left { grid-area: brand; gap: 10px; min-width: 0; }
  .pos-topbar-left > div { min-width: 0; }
  .pos-topbar-right {
    grid-area: tools;
    width: auto;
    margin-left: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }
  .pos-mark { width: 34px; height: 34px; font-size: 1rem; flex-shrink: 0; }
  .pos-shop-name {
    font-size: 0.96rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .pos-shop-meta,
  .pos-switch-label,
  .pos-topbar .pos-role { display: none; }
  .pos-topbar .pos-pro-badge { display: none; }
  .pos-switch select {
    max-width: 150px;
    min-height: 38px;
    padding: 6px 8px;
    text-overflow: ellipsis;
  }
  .pos-topbar .btn-ghost {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .pos-topbar .pos-nav, .pos-topbar .pos-pro-nav {
    grid-area: nav;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    margin: 0 -12px;
    padding: 0 12px 2px;
  }
  .pos-nav a, .pos-pro-nav a { min-height: 40px; padding: 8px 12px; font-size: 0.85rem; }
}

@media (max-width: 380px) {
  .pos-switch select { max-width: 112px; }
  .pos-topbar .btn-ghost { padding: 0 8px; font-size: 0.74rem; }
  /* The bar tabs live inside the cart sheet on very narrow phones */
  .pos-cart-bar-tabs-wrap { display: none; }
}

/* ── Cart bar: open-cart affordance replaces Hold/Clear on touch ── */
@media (max-width: 900px) {
  .pos-cart-bar [data-action="hold-sale"],
  .pos-cart-bar [data-action="clear-cart"] { display: none; }

  body.pos-mobile-cart .pos-cart-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    white-space: nowrap;
  }
  .pos-cart-open-btn svg { flex-shrink: 0; }
  .pos-cart-open-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--green);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
  }

  /* The cart becomes a bottom sheet instead of a section far below the products */
  body.pos-mobile-cart .pos-till {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: 100%;
    max-height: min(86vh, 720px);
    height: auto;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    box-shadow: 0 -18px 48px rgba(6, 18, 12, 0.32);
    overflow: hidden;
    transform: translateY(103%);
    visibility: hidden;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.18s ease, visibility 0.3s;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  body.pos-mobile-cart.pos-cart-open .pos-till {
    transform: translateY(0);
    visibility: visible;
    opacity: 1;
  }
  body.pos-mobile-cart .pos-till::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    margin-left: -21px;
    border-radius: 999px;
    background: #CBD5D0;
    z-index: 2;
    pointer-events: none;
  }
  body.pos-mobile-cart .pos-till-head {
    flex-shrink: 0;
    padding: 20px 14px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  body.pos-mobile-cart .pos-till-tabs-scroll { max-width: none; flex: 1 1 140px; }
  body.pos-mobile-cart .pos-cart {
    max-height: none;
    flex: 1 1 auto;
    min-height: 90px;
    padding: 4px 14px;
    overscroll-behavior: contain;
  }
  body.pos-mobile-cart .pos-till-body {
    flex-shrink: 0;
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body.pos-mobile-cart .pos-held-pane { padding: 14px; }

  .pos-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--white);
    color: var(--ink-soft);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
  }
  .pos-sheet-close:active { background: var(--surface-deep); }

  body.pos-mobile-cart.pos-cart-open { overflow: hidden; }
  .pos-cart-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(8, 20, 14, 0.52);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  body.pos-mobile-cart.pos-cart-open .pos-cart-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* ── Phone counter, filters and product tiles ── */
@media (max-width: 700px) {
  .pos-main { padding: 14px 12px 88px; }
  .pos-filters { gap: 8px; margin-bottom: 14px; }
  .pos-filters input[type=search] {
    flex: 1 1 100%;
    min-width: 0 !important;
    width: 100%;
  }
  .pos-filters select { flex: 1 1 130px; min-width: 0; }
  .pos-filters .btn { flex: 0 0 auto; }
  .pos-catalogue .pos-filters { margin-bottom: 12px; }
}

@media (max-width: 560px) {
  .pos-body { padding-bottom: 84px; }
  .pos-cart-bar {
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .pos-cart-bar-tabs-wrap { flex: 1 1 auto; min-width: 0; }
  .pos-cart-bar-scroll { display: none; }
  .pos-cart-bar-tabs-scroll { max-width: none; width: 100%; }
  .pos-cart-bar-label { display: none; }
  .pos-cart-bar-info { flex-shrink: 0; }
  .pos-cart-bar-actions { gap: 6px; }
  .pos-cart-bar .btn-primary { padding: 8px 12px; font-size: 0.86rem; }
  .pos-cart-open-btn { width: 40px; min-width: 40px; padding: 0; }
  .pos-cart-open-btn .pos-cart-open-label { display: none; }

  .pos-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pos-product {
    min-height: 112px;
    padding: 12px;
    border-radius: 10px;
  }
  .pos-product-name { font-size: 0.92rem; }
  .pos-product-price { font-size: 0.98rem; }
  .pos-product:active:not(:disabled) {
    transform: scale(0.98);
    border-color: var(--green);
    box-shadow: none;
  }

  .pos-sale-alert { flex-direction: column; align-items: stretch; gap: 10px; }
  .pos-sale-alert-actions { justify-content: flex-start; }
  .pos-enter-note { padding: 14px; }
  .pos-page-head h1 { font-size: 1.2rem; }
  .pos-stats { gap: 10px; }
  .pos-stat { padding: 13px 14px; }
  .pos-stat .num { font-size: 1.28rem; }
}

/* ── Back-office screens on touch devices ── */
@media (max-width: 900px) {
  .pos-main { padding-left: 12px; padding-right: 12px; }
  .pos-page-head { align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .pos-page-head h1 { font-size: 1.24rem; }
  .pos-page-actions { width: 100%; gap: 6px; }
  .pos-page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .pos-panel-head { padding: 13px 14px; }
  .pos-panel-body { padding: 14px; }
  .pos-panel-body[style*="padding:0"],
  .pos-panel-body[style*="padding: 0"] { padding: 0 !important; }
  .pos-panel-foot { padding: 12px 14px; }
  .pos-inline-form input[type=search] { min-width: 0 !important; }
  .pos-staff-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px;
    padding: 0 12px;
  }
  .pos-staff-tabs::-webkit-scrollbar { display: none; }
  .pos-staff-tab { flex: 0 0 auto; white-space: nowrap; }
  .pos-filter-form > div { flex: 1 1 100% !important; min-width: 0 !important; }
  .pos-filter-form .btn { flex: 1 1 auto; }
  .pos-footer { padding: 16px 14px; }
}

/* ── Narrow phones: single-column form rows ── */
@media (max-width: 640px) {
  .pos-form-row,
  .pos-form-row-aside,
  .pos-form-row-wide { grid-template-columns: minmax(0, 1fr); }
  .pos-form-row-wide .btn { width: 100%; }
  .pos-account-btn { flex-wrap: wrap; }
  .pos-dossier-item { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body.pos-mobile-cart .pos-till,
  .pos-cart-overlay { transition: none; }
}

@media print {
  @page {
    margin: 0;
  }
  .pos-topbar,
  .pos-footer,
  .pos-flash,
  .pos-sale-alert,
  .pos-receipt-actions,
  .pos-page-head,
  .pos-filters,
  .pos-nav,
  .pos-switch,
  .pos-cart-bar,
  .no-print,
  button,
  header,
  footer {
    display: none !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .pos-main,
  .pos-receipt-wrap {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    background: transparent !important;
    display: block !important;
  }

  .pos-receipt {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: #000000 !important;
    background: #ffffff !important;
    margin: 0 auto !important;
  }

  .pos-receipt.paper-80mm {
    width: 74mm !important;
    max-width: 74mm !important;
    padding: 2mm 2mm !important;
    font-size: 12px !important;
  }

  .pos-receipt.paper-58mm {
    width: 48mm !important;
    max-width: 48mm !important;
    padding: 1mm 1mm !important;
    font-size: 10.5px !important;
  }

  .pos-receipt.paper-a4 {
    width: 160mm !important;
    max-width: 160mm !important;
    padding: 10mm !important;
    font-size: 13.5px !important;
  }

  .receipt-header,
  .receipt-store-name,
  .receipt-store-info,
  .receipt-row span,
  .receipt-table th,
  .receipt-table td,
  .receipt-item-name,
  .receipt-grand-total,
  .receipt-footer,
  .receipt-footer-msg,
  .receipt-item-count,
  .receipt-barcode-code {
    color: #000000 !important;
  }

  .receipt-rule-solid,
  .receipt-rule-dashed,
  .receipt-rule-double,
  .receipt-table th,
  .receipt-grand-total {
    border-color: #000000 !important;
  }

  .receipt-change span,
  .receipt-balance span {
    color: #000000 !important;
  }
}
