/* Cart images retain a square frame at every viewport. */
html body.pos-mode :is(.pos-selling-shell, #table-cart-modal) .cart-thumb {
  width: 52px !important; height: 52px !important; aspect-ratio: 1 / 1;
  min-width: 52px !important; flex: 0 0 52px !important; border-radius: 8px !important;
}
html body.pos-mode :is(.pos-selling-shell, #table-cart-modal) .cart-thumb img {
  width: 100% !important; height: 100% !important; object-fit: cover !important;
}
/* The bridge inherits the sales cart styles; only its host position differs. */
#table-cart-modal[open] {
  display: flex; flex-direction: column; width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px); padding: 12px; overflow: hidden; box-sizing: border-box;
}
#table-cart-modal .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-shrink: 0; }
#table-cart-modal .modal-head h2 { font-size: 18px; margin: 0; }
#table-cart-modal .table-cart-workspace { display: flex !important; flex-direction: column !important; overflow: hidden !important; flex: 1; min-height: 0 !important; height: auto !important; width: 100%; padding: 0 !important; }
#table-cart-modal .pos-layout { display: contents !important; }
#table-cart-modal .restaurant-pos-context { display: none !important; }
html body.pos-mode #app #table-cart-modal .cart { position: relative !important; inset: auto !important; transform: none !important; transition: none !important; width: 100% !important; min-width: 0 !important; max-width: none !important; min-height: 0 !important; max-height: none !important; flex: 1; margin: 0 !important; }
#table-cart-modal > .form-actions { flex-shrink: 0; margin: 0; padding: 8px 12px; }
@media (max-width: 640px) {
  #table-cart-modal[open] { width: 100vw; max-width: 100vw; padding: 0; border-radius: 20px; }
  #table-cart-modal > .modal-head, #table-cart-modal > .table-cart-customer { padding: 8px 12px; }
  #table-cart-modal .table-cart-customer:empty { display: none; }
}
#table-cart-modal::backdrop, #cart-line-confirm::backdrop { background: rgba(0, 0, 0, .45); }
#cart-line-confirm { width: min(420px, calc(100vw - 24px)); box-sizing: border-box; }
#cart-line-confirm h2 { margin-top: 0; font-size: 20px; }
#cart-line-confirm .form-actions button { min-height: 44px; }
      @keyframes posFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
      }
      @keyframes posScaleUp {
        from { opacity: 0; transform: scale(0.92); }
        to { opacity: 1; transform: scale(1); }
      }
      @media (max-width: 640px) {
        /* 1. Eliminate screen flashing on mobile cart open & smooth transition */
        .pos-selling-shell .cart {
          transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
        }
        .pos-cart-backdrop {
          transition: opacity 0.25s ease !important;
        }
        body.pos-mobile-cart-open .pos-selling-shell .cart,
        .pos-selling-shell.pos-mobile-cart-open .cart {
          transform: translateY(0) !important;
          pointer-events: auto !important;
          visibility: visible !important;
          opacity: 1 !important;
        }
        body.pos-mobile-cart-open .pos-cart-backdrop,
        .pos-selling-shell.pos-mobile-cart-open .pos-cart-backdrop {
          display: block !important;
          opacity: 1 !important;
          pointer-events: auto !important;
        }

        /* Category swipe feedback & animations */
        .pos-categories, .pos-category-rail {
          transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease !important;
        }
        .category-slide-left {
          animation: slideFromRight 0.22s cubic-bezier(0.16, 1, 0.3, 1) both !important;
        }
        .category-slide-right {
          animation: slideFromLeft 0.22s cubic-bezier(0.16, 1, 0.3, 1) both !important;
        }

        /* 2. Mobile header rows; the category row owns the sticky boundary. */
        .pos-selling-shell .pos-topbar {
          display: flex !important;
          flex-direction: column !important;
          padding: 6px 10px !important;
          gap: 6px !important;
          position: sticky !important;
          top: 0 !important;
          z-index: 40 !important;
          background: #061b29 !important;
          border-bottom: 1px solid #14394c !important;
        }
        .pos-topbar-row1 {
          display: flex !important;
          align-items: center !important;
          justify-content: space-between !important;
          gap: 8px !important;
          width: 100% !important;
          max-height: 48px;
          overflow: visible;
          transition: max-height 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, transform 0.22s ease, margin 0.22s ease !important;
        }
        .pos-selling-shell .pos-header-tools {
          display: flex !important;
          width: 100% !important;
          flex: 1 1 100% !important;
          margin: 0 !important;
        }
        .pos-selling-shell .pos-header-search {
          width: 100% !important;
          flex: 1 !important;
        }

        /* Compact header controls without changing picker or scanner actions. */
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar,
        html .pos-selling-shell.has-restaurant-context:not(.pos-edit-active) .pos-topbar,
        html .pos-selling-shell:not(.pos-edit-active):has(.restaurant-pos-context) .pos-topbar {
          padding: calc(env(safe-area-inset-top, 0px) + 4px) 10px 6px !important;
          row-gap: 6px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar-row1 {
          min-height: 32px !important;
          max-height: none !important;
          gap: 6px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar-row1 :is(.pos-mobile-back-btn, .customer-picker-trigger, .pos-brand, .pos-tools-trigger) {
          height: 32px !important;
          min-height: 32px !important;
          font-size: 12px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar-row1 :is(.pos-mobile-back-btn, .pos-tools-trigger) {
          width: 32px !important;
          min-width: 32px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar-row1 .pos-mobile-table-name {
          font-size: 12px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar .pos-header-search,
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar .pos-header-search input {
          height: 32px !important;
          min-height: 32px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar .pos-header-search input {
          padding-top: 4px !important;
          padding-bottom: 4px !important;
          font-size: 16px !important;
        }
        html .pos-selling-shell:not(.pos-edit-active) .pos-topbar .pos-header-search .scan-action {
          width: 30px !important;
          min-width: 30px !important;
          height: 30px !important;
          min-height: 30px !important;
        }

        /* 3. Back Button before customer picker */
        .pos-mobile-back-btn {
          display: inline-flex !important;
          align-items: center !important;
          justify-content: center !important;
          width: 36px !important;
          height: 36px !important;
          min-width: 36px !important;
          border-radius: 8px !important;
          border: 1px solid #2d5b73 !important;
          background: #0b2b3c !important;
          color: #f7fbff !important;
          padding: 0 !important;
          cursor: pointer !important;
          flex-shrink: 0 !important;
          transition: background 0.15s ease, border-color 0.15s ease;
        }
        .pos-mobile-back-btn:active {
          background: #173946 !important;
          border-color: #45d6df !important;
        }

        /* 5. Table Button Display */
        .pos-topbar-row1 .pos-brand {
          display: inline-flex !important;
          align-items: center !important;
          gap: 4px !important;
          height: 36px !important;
          min-height: 36px !important;
          padding: 0 10px !important;
          border-radius: 8px !important;
          border: 1px solid #2d5b73 !important;
          background: #0b2b3c !important;
          color: #f7fbff !important;
          text-decoration: none !important;
          cursor: pointer !important;
          flex: 0 0 auto !important;
          transition: background 0.15s ease, border-color 0.15s ease !important;
        }
        .pos-topbar-row1 .pos-brand:active {
          background: #173946 !important;
          border-color: #45d6df !important;
        }
        .pos-mobile-table-name {
          font-size: 13px !important;
          font-weight: 700 !important;
          color: #f7fbff !important;
          white-space: nowrap !important;
        }
        .pos-topbar-row1 .pos-brand svg.pos-svg-chevron {
          display: inline-block !important;
          flex-shrink: 0 !important;
          color: #94a3b8 !important;
        }

        /* Tools trigger (•••) */
        .pos-topbar-row1 .pos-tools-anchor {
          margin: 0 !important;
          flex-shrink: 0 !important;
        }
        .pos-topbar-row1 .pos-tools-trigger {
          width: 36px !important;
          height: 36px !important;
          min-width: 36px !important;
          min-height: 36px !important;
          padding: 0 !important;
          border-radius: 8px !important;
          border: 1px solid #2d5b73 !important;
          background: #0b2b3c !important;
          color: #f7fbff !important;
          display: inline-flex !important;
          align-items: center !important;
          justify-content: center !important;
          cursor: pointer !important;
        }
        .pos-selling-shell .pos-tools-trigger svg.pos-svg-dots {
          display: block !important;
        }
        .pos-selling-shell .pos-tools-trigger::before,
        .pos-selling-shell .pos-tools-trigger::after {
          display: none !important;
          content: none !important;
        }

        /* 8. Remaining Stock Badge */
        .pos-selling-shell .product-cover {
          position: relative !important;
        }
        .pos-selling-shell .product-cover .product-cart-badge {
          position: absolute;
          top: 6px;
          right: 6px;
          z-index: 4;
          min-width: 20px;
          height: 20px;
          padding: 0 5px;
          border-radius: 9999px;
          background: #1677ff;
          color: #ffffff;
          font-size: 11px;
          font-weight: 700;
          line-height: 20px;
          text-align: center;
          box-shadow: 0 2px 6px rgba(22, 119, 255, 0.4);
          pointer-events: none;
        }

        /* 9. Cart line price box */
        .cart-line-price-box {
          display: flex !important;
          flex-direction: column !important;
          align-items: flex-end !important;
          justify-content: center !important;
        }
        .cart-line-total-price {
          font-size: 14px !important;
          font-weight: 700 !important;
          color: #4ff1f8 !important;
          white-space: nowrap !important;
        }
        .cart-line-unit-price {
          font-size: 11px !important;
          color: #94a3b8 !important;
          white-space: nowrap !important;
        }

        /* 10. Cart heading action buttons (Xóa giỏ / Hủy bàn) */
        .pos-cart-action-btn {
          display: inline-flex !important;
          align-items: center !important;
          gap: 5px !important;
          padding: 5px 9px !important;
          border-radius: 7px !important;
          font-size: 12px !important;
          font-weight: 600 !important;
          cursor: pointer !important;
          transition: all 0.15s ease !important;
        }
        .pos-cart-action-btn.btn-clear-cart {
          background: rgba(239, 68, 68, 0.15) !important;
          color: #ef4444 !important;
          border: 1px solid rgba(239, 68, 68, 0.3) !important;
        }
        .pos-cart-action-btn.btn-clear-cart:hover,
        .pos-cart-action-btn.btn-clear-cart:active {
          background: rgba(239, 68, 68, 0.25) !important;
        }
        .pos-cart-action-btn.btn-cancel-table {
          background: rgba(245, 158, 11, 0.15) !important;
          color: #f59e0b !important;
          border: 1px solid rgba(245, 158, 11, 0.3) !important;
        }
        .pos-cart-action-btn.btn-cancel-table:hover,
        .pos-cart-action-btn.btn-cancel-table:active {
          background: rgba(245, 158, 11, 0.25) !important;
        }

        /* Cart Bottom Sheet Handle & Heading */
        .pos-selling-shell .cart-heading {
          position: relative !important;
          display: flex !important;
          align-items: center !important;
          justify-content: space-between !important;
          padding: 18px 12px 10px 12px !important;
        }
        .pos-sheet-handle {
          position: absolute !important;
          top: 6px !important;
          left: 50% !important;
          transform: translateX(-50%) !important;
          width: 36px !important;
          height: 4px !important;
          border-radius: 9999px !important;
          background: #334e68 !important;
          cursor: grab !important;
        }
        .pos-selling-shell .cart-heading h3 {
          margin: 0 !important;
          text-align: left !important;
          flex: 0 0 auto !important;
        }

        /* Hide Save Order on Mobile Checkout Footer */
        .pos-selling-shell .cart-checkout-footer .pos-save-order,
        .pos-selling-shell .cart-checkout-footer [data-action="saveTable"] {
          display: none !important;
        }

        /* Mobile Dropdowns */
        .pos-mobile-dropdown-backdrop {
          position: fixed !important;
          inset: 0 !important;
          z-index: 20040 !important;
          background: transparent !important;
        }
        .pos-mobile-dropdown-menu {
          position: fixed !important;
          z-index: 20050 !important;
          background: #f8fafc !important;
          border: 1px solid #e2e8f0 !important;
          border-radius: 12px !important;
          box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14) !important;
          padding: 6px !important;
          min-width: 200px !important;
          max-width: calc(100vw - 20px) !important;
          max-height: min(300px, 48vh) !important;
          overflow-y: auto !important;
          -webkit-overflow-scrolling: touch !important;
          touch-action: pan-y !important;
          overscroll-behavior: contain !important;
          scrollbar-width: thin !important;
          scrollbar-color: #cbd5e1 transparent !important;
          animation: posFadeIn 0.15s ease !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item {
          display: flex !important;
          align-items: center !important;
          justify-content: space-between !important;
          gap: 10px !important;
          width: 100% !important;
          padding: 9px 12px !important;
          border: none !important;
          background: transparent !important;
          color: #0f172a !important;
          font-size: 13px !important;
          font-weight: 500 !important;
          text-align: left !important;
          border-radius: 8px !important;
          cursor: pointer !important;
          box-sizing: border-box !important;
          transition: background 0.12s ease !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item:active,
        .pos-mobile-dropdown-menu .pos-dropdown-item:hover {
          background: #eef2f7 !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item.is-current {
          background: #e8f1ff !important;
          color: #1677ff !important;
          font-weight: 600 !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item.danger {
          color: #ef4444 !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item.danger:active,
        .pos-mobile-dropdown-menu .pos-dropdown-item.danger:hover {
          background: rgba(239, 68, 68, 0.15) !important;
          color: #ef4444 !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item-left {
          display: flex !important;
          align-items: center !important;
          gap: 10px !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item-left svg {
          flex-shrink: 0 !important;
          stroke: currentColor !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item.danger svg {
          stroke: #ef4444 !important;
        }
        .pos-mobile-dropdown-menu .pos-dropdown-item:not(.danger):hover svg,
        .pos-mobile-dropdown-menu .pos-dropdown-item:not(.danger):active svg {
          stroke: #1677ff !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu {
          background: #092638 !important;
          border-color: #1c4860 !important;
          box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75) !important;
          scrollbar-color: #2d5b73 transparent !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item {
          color: #f7fbff !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item:active,
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item:hover {
          background: #153a4d !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item:not(.danger):hover svg,
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item:not(.danger):active svg {
          stroke: #38bdf8 !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item.danger {
          color: #f87171 !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item.danger svg {
          stroke: #f87171 !important;
        }
        html[data-ui-style="midnight"] .pos-mobile-dropdown-menu .pos-dropdown-item.is-current {
          background: rgba(22, 119, 255, 0.18) !important;
          color: #4ff1f8 !important;
        }

        /* Mobile cleanups: hide pos-nav & large context block */
        .pos-nav,
        .restaurant-pos-context {
          display: none !important;
        }
        body.pos-tables-landing-active .pos-nav,
        body.pos-tables-landing-active .pos-shell > .pos-topbar,
        .pos-shell:has(.pos-tables-landing-view) > .pos-nav,
        .pos-shell:has(.pos-tables-landing-view) > .pos-topbar {
          display: none !important;
        }
        .restaurant-landing > .restaurant-landing-head,
        .restaurant-landing > .restaurant-takeaway-card,
        .restaurant-landing > .restaurant-tables-section > .restaurant-section-heading,
        .restaurant-landing > .restaurant-tables-section > .restaurant-table-grid,
        .restaurant-landing > .restaurant-operations {
          display: none !important;
        }

        /* "Bán tại quầy" action button in header Danh sách bàn */
        .pos-tables-head-btn.pos-tables-counter-btn {
          width: auto !important;
          min-width: 36px !important;
          height: 36px !important;
          padding: 0 12px !important;
          gap: 6px !important;
          font-size: 13px !important;
          font-weight: 600 !important;
          border-radius: 10px !important;
          background: #2563eb !important;
          color: #ffffff !important;
          border: 1px solid #1d4ed8 !important;
          white-space: nowrap !important;
          cursor: pointer !important;
          display: inline-flex !important;
          align-items: center !important;
          justify-content: center !important;
          box-sizing: border-box !important;
          transition: background 0.15s ease, transform 0.1s ease !important;
        }
        .pos-tables-head-btn.pos-tables-counter-btn:active {
          background: #1d4ed8 !important;
          transform: scale(0.98);
        }
        .pos-tables-head-btn.pos-tables-counter-btn svg {
          flex-shrink: 0 !important;
          stroke: currentColor !important;
        }
        html[data-ui-style="midnight"] .pos-tables-head-btn.pos-tables-counter-btn {
          background: #1d4ed8 !important;
          border-color: #2563eb !important;
          color: #ffffff !important;
        }
        html[data-ui-style="midnight"] .pos-tables-head-btn.pos-tables-counter-btn:active {
          background: #2563eb !important;
        }

        /* Clean sale chrome on mobile: prioritize Table -> Products -> Order */
        .pos-selling-shell .page-head,
        .pos-selling-shell > .pos-actions,
        .pos-selling-shell .pos-category-footer,
        .pos-selling-shell .pos-section-label,
        .pos-selling-shell .pos-column-divider,
        .pos-selling-shell .cart-status,
        .pos-selling-shell .restaurant-pos-context {
          display: none !important;
        }

        /* Modals: Confirm Dialog */
        .pos-confirm-backdrop {
          position: fixed !important;
          inset: 0 !important;
          z-index: 20000 !important;
          background: rgba(0, 0, 0, 0.6) !important;
          backdrop-filter: blur(3px) !important;
          -webkit-backdrop-filter: blur(3px) !important;
          display: flex !important;
          align-items: center !important;
          justify-content: center !important;
          padding: 16px !important;
          animation: posFadeIn 0.15s ease;
        }
        .pos-modal-card,
        .pos-confirm-dialog {
          background: #092638 !important;
          border: 1px solid #1c4860 !important;
          border-radius: 14px !important;
          color: #f7fbff !important;
          width: 100% !important;
          max-width: 380px !important;
          box-shadow: 0 20px 48px rgba(0, 0, 0, 0.65) !important;
          overflow: hidden !important;
          animation: posScaleUp 0.18s ease;
        }
        .pos-modal-head {
          display: flex !important;
          align-items: center !important;
          justify-content: space-between !important;
          padding: 14px 16px !important;
          border-bottom: 1px solid #1c4860 !important;
        }
        .pos-modal-head h3 {
          margin: 0 !important;
          font-size: 16px !important;
          font-weight: 700 !important;
          color: #f7fbff !important;
        }
        .pos-modal-close {
          background: transparent !important;
          border: 0 !important;
          color: #94a3b8 !important;
          font-size: 20px !important;
          cursor: pointer !important;
          padding: 4px 8px !important;
          line-height: 1 !important;
        }
        .pos-modal-body {
          padding: 14px 16px !important;
          max-height: 60vh !important;
          overflow-y: auto !important;
        }
        .pos-table-grid-list {
          display: grid !important;
          grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
          gap: 10px !important;
        }
        .pos-quick-table-card {
          display: flex !important;
          flex-direction: column !important;
          align-items: flex-start !important;
          gap: 4px !important;
          padding: 10px 12px !important;
          border-radius: 10px !important;
          border: 1px solid #2d5b73 !important;
          background: #0b2b3c !important;
          color: #f7fbff !important;
          text-align: left !important;
          cursor: pointer !important;
          transition: all 0.15s ease !important;
        }
        .pos-quick-table-card:active {
          border-color: #45d6df !important;
          background: #153a4d !important;
        }
        .pos-quick-table-card strong {
          font-size: 14px !important;
        }
        .pos-table-badge {
          display: inline-block !important;
          font-size: 10px !important;
          font-weight: 700 !important;
          padding: 2px 6px !important;
          border-radius: 4px !important;
          text-transform: uppercase !important;
        }
        .pos-table-badge.green {
          background: rgba(16, 185, 129, 0.2) !important;
          color: #10b981 !important;
        }
        .pos-table-badge.orange {
          background: rgba(245, 158, 11, 0.2) !important;
          color: #f59e0b !important;
        }
        .pos-table-badge.blue {
          background: rgba(59, 130, 246, 0.2) !important;
          color: #3b82f6 !important;
        }
        .pos-table-badge.purple {
          background: rgba(168, 85, 247, 0.2) !important;
          color: #a855f7 !important;
        }
        .pos-table-op-list {
          display: flex !important;
          flex-direction: column !important;
          gap: 8px !important;
        }
        .pos-table-op-btn {
          display: flex !important;
          align-items: center !important;
          gap: 12px !important;
          width: 100% !important;
          padding: 12px 14px !important;
          border-radius: 10px !important;
          border: 1px solid #2d5b73 !important;
          background: #0b2b3c !important;
          color: #f7fbff !important;
          font-size: 14px !important;
          font-weight: 600 !important;
          cursor: pointer !important;
          text-align: left !important;
          transition: all 0.12s ease !important;
        }
        .pos-table-op-btn:active {
          background: #153a4d !important;
          border-color: #45d6df !important;
        }
        .pos-table-op-btn.danger {
          color: #ef4444 !important;
          border-color: rgba(239, 68, 68, 0.4) !important;
        }
        .pos-table-op-btn.danger:active {
          background: rgba(239, 68, 68, 0.15) !important;
        }
        .pos-confirm-title {
          padding: 16px 16px 8px !important;
          font-size: 16px !important;
          font-weight: 700 !important;
          color: #f7fbff !important;
        }
        .pos-confirm-message {
          padding: 0 16px 16px !important;
          font-size: 14px !important;
          color: #cbd5e1 !important;
          line-height: 1.4 !important;
        }
        .pos-confirm-actions {
          display: flex !important;
          align-items: center !important;
          justify-content: flex-end !important;
          gap: 10px !important;
          padding: 12px 16px !important;
          border-top: 1px solid #1c4860 !important;
          background: #082232 !important;
        }
        .pos-confirm-actions .btn {
          padding: 8px 16px !important;
          font-size: 13px !important;
          font-weight: 600 !important;
          border-radius: 8px !important;
          cursor: pointer !important;
        }
        .pos-confirm-actions .btn-cancel-confirm {
          background: #153a4d !important;
          border: 1px solid #2d5b73 !important;
          color: #f7fbff !important;
        }
        .pos-confirm-actions .btn-ok-confirm {
          background: #1677ff !important;
          border: 1px solid #1677ff !important;
          color: #ffffff !important;
        }

        .pos-selling-shell .cart-checkout-footer .pos-action-checkout svg.pos-svg-arrow {
          display: inline-block !important;
        }
        html:not([data-ui-style="midnight"]) .product-info strong,
        html:not([data-ui-style="midnight"]) .product-info .price,
        html:not([data-ui-style="midnight"]) .product-info small {
          text-shadow: none !important;
          filter: none !important;
        }
        .pos-selling-shell .pos-brand .pos-mobile-table-icon {
          display: inline-flex !important;
          align-items: center !important;
          justify-content: center !important;
        }
      }
/* Anchor both the closed summary and open cart to the phone viewport.
   Even an identity page transform creates a containing block for fixed children. */
@media (max-width: 640px) {
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-topbar {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    position: sticky !important;
    top: calc(-1 * var(--pos-mobile-header-scroll-offset, 80px)) !important;
    z-index: 60 !important;
    padding: calc(env(safe-area-inset-top, 0px) + 4px) 10px 0 !important;
    gap: 6px !important;
    transition: none !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-topbar:has(.pos-header-search input:focus, .pos-topbar-row1 :focus-visible) {
    top: 0 !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-topbar-row1 {
    order: 0 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-topbar > .pos-header-tools,
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-topbar > .pos-header-search {
    display: flex !important;
    order: 1 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-topbar > .pos-category-rail {
    order: 2 !important;
    flex: 0 0 auto !important;
    width: calc(100% + 20px) !important;
    margin: 0 -10px !important;
    position: relative !important;
    top: auto !important;
    overflow: visible !important;
    transition: none !important;
  }
  body.pos-mode #app .pos-selling-shell .pos-content { touch-action: pan-y pinch-zoom; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-category-rail {
    padding: 0 12px 4px !important;
    background: transparent !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-category-list {
    gap: 4px !important;
    padding: 0 !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-category {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #526274 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-category.active { color: #1677ff !important; }
  html[data-ui-style="midnight"] body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-category { color: #a8bbcc !important; }
  html[data-ui-style="midnight"] body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .pos-category.active { color: #60a5fa !important; }
  body.pos-mode #app.app-ready,
  body.pos-mode .pos-content {
    animation: none !important;
    transform: none !important;
    will-change: auto !important;
  }
}

/* Finger-following horizontal feedback applies only to movable content,
   never the app/page ancestors of the fixed cart. */
@media (max-width: 640px) {
  body.pos-mode #app .pos-products { overflow-x: clip !important; position: relative; }
  body.pos-mode #app .pos-category-preview {
    position: absolute !important;
    margin: 0 !important;
    pointer-events: none;
    backface-visibility: hidden;
  }
  .pos-category-list { position: relative; }
  .pos-category-swipe-marker {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary, #2563eb);
    border-radius: 3px;
    pointer-events: none;
    will-change: transform;
    transition: transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1), width 180ms cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  .pos-category-list[data-category-swipe-moving="true"] .pos-category-swipe-marker { transition: none; }
  .pos-swipe-follow,
  .pos-swipe-return,
  .pos-swipe-settle {
    animation: none !important;
    transform: translate3d(var(--pos-swipe-x, 0px), 0, 0) !important;
  }
  .pos-swipe-follow {
    transition: none !important;
    will-change: transform;
  }
  .pos-swipe-return {
    transition: transform var(--pos-swipe-duration, 180ms) ease-out !important;
  }
  .pos-swipe-settle {
    transition: transform var(--pos-swipe-duration, 180ms) cubic-bezier(0.2, 0.7, 0.3, 1) !important;
    will-change: transform;
  }
  body.pos-mode .pos-topbar,
  body.pos-mode .page-head,
  body.pos-mode .pos-tables-head,
  body.pos-mode .pos-billiards-table-grid,
  body.pos-mode .restaurant-table-grid {
    touch-action: pan-y;
  }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .pos-category-swipe-marker { transition: none !important; }
  .pos-swipe-return,
  .pos-swipe-settle { transition: none !important; }
}
@media (max-width: 640px) {
  body.pos-mode #app .pos-billiards-card-wrap { position: relative; min-width: 0; }
  body.pos-mode #app .pos-billiards-card-wrap .pos-billiards-card { width: 100%; height: 100%; }
  body.pos-mode #app .pos-billiards-card-wrap.has-table-cart .pos-billiards-card { padding: 10px 8px !important; }
  body.pos-mode #app .has-table-cart .pos-billiards-card-meta { min-height: 44px !important; padding-right: 48px; box-sizing: border-box; }
  body.pos-mode #app .has-table-cart .pos-billiards-clock { font-size: 10.5px; font-variant-numeric: tabular-nums; padding: 0 !important; border: 0 !important; background: transparent !important; gap: 0 !important; }
  body.pos-mode #app .has-table-cart .pos-billiards-clock svg { display: none; }
  body.pos-mode #app .pos-table-cart-btn {
    position: absolute; right: 6px; bottom: 8px; width: 44px; height: 44px; padding: 0;
    display: grid; place-items: center; border: 0; border-radius: 12px;
    background: transparent; color: #1d4ed8; cursor: pointer;
  }
  body.pos-mode #app .pos-table-cart-btn::before {
    content: ''; position: absolute; width: 32px; height: 32px; border: 1px solid #dbeafe;
    border-radius: 9px; background: #eff6ff; box-sizing: border-box;
  }
  body.pos-mode #app .pos-table-cart-btn svg { position: relative; width: 16px; height: 16px; }
  body.pos-mode #app .pos-table-cart-btn:active::before { background: #dbeafe; }
  body.pos-mode #app .pos-table-cart-btn:disabled { opacity: .55; cursor: wait; }
  body.pos-mode #app .pos-table-cart-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line.is-swiped { transform: none !important; padding-right: 116px !important; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line.is-swiped > :is(.cart-thumb,.cart-item-content,.cart-line-total,.cart-line-qty) { transform: none !important; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line.is-swiped .cart-thumb { display: none !important; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line-swipe-actions { width: 104px !important; gap: 8px !important; justify-content: flex-end !important; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line-swipe-actions .cart-line-swipe-btn {
    display: inline-flex !important; flex: 0 0 48px; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    width: 48px !important; height: 48px !important; padding: 0 !important; gap: 3px !important;
    border: 1px solid #dbeafe !important; border-radius: 10px !important; background: #eff6ff !important; color: #1d4ed8 !important;
    font-size: 10px !important; font-weight: 600 !important; line-height: 1.2 !important;
  }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line-swipe-actions .cart-line-delete { background: #fff1f2 !important; color: #be123c !important; border-color: #ffe4e6 !important; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line-swipe-btn::before,
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line-swipe-btn::after { content: none !important; display: none !important; }
  html body.pos-mode #app .pos-selling-shell:not(.pos-edit-active) .cart-line-swipe-btn svg { width: 18px !important; height: 18px !important; margin: 0 !important; }
  html[data-ui-style="midnight"] body.pos-mode #app .pos-table-cart-btn::before,
  html[data-ui-style="midnight"] body.pos-mode #app .cart-line-swipe-actions .note-toggle { background: #172d49 !important; color: #93c5fd !important; border-color: #294568 !important; }
  html[data-ui-style="midnight"] body.pos-mode #app .cart-line-swipe-actions .cart-line-delete { background: #3f1c29 !important; color: #fda4af !important; border-color: #61283d !important; }
}
@media (max-width: 380px) {
  body.pos-mode #app .has-table-cart .pos-billiards-card-meta { min-height: 66px !important; padding-right: 0; align-items: flex-start !important; padding-top: 2px; }
  body.pos-mode #app .has-table-cart .pos-billiards-clock { font-size: 11.5px; }
}

@media (max-width: 640px) {
  html body.pos-mode #app .pos-selling-shell .pos-mobile-scroll-top:not([hidden]) {
    position: fixed; left: 16px; bottom: calc(var(--pos-mobile-cart-trigger-height, 58px) + 8px);
    width: 44px; height: 44px; min-width: 44px; min-height: 44px; display: grid; place-items: center;
    padding: 0; border: 1px solid var(--line, #dbeafe); border-radius: 50%;
    background: var(--panel, #fff); color: var(--brand, #1677ff); box-shadow: 0 3px 12px #0002; z-index: 64;
  }
  html body.pos-mode #app .pos-selling-shell .pos-mobile-scroll-top[hidden],
  html body.pos-mode #app .pos-selling-shell.pos-mobile-cart-open .pos-mobile-scroll-top { display: none !important; }
}
