/**
 * Pixleas OS — Phase 1 shared UI base (core skin).
 * v3: Phase 1.3 POS polish (totals strip tokens + structure).
 * v3.1: Phase 1.4/1.5 box-header / modal header tokens.
 * v3.2: Phase 1.3 POS empty-cart state (i18n + core CSS).
 * Color skins H1–H4 stay in AdvancedUi module.
 * Marker: corepatch_pixleas_ui_base_v1 (link) / content v3.2
 */
:root {
  /* Shell breakpoints — match Tailwind lg / mobile */
  --pix-bp-desktop: 1024px;
  --pix-bp-mobile: 768px;

  --pix-surface: #ffffff;
  --pix-surface-muted: #f8fafc;
  --pix-border: rgba(148, 163, 184, 0.35);
  --pix-text: #0f172a;
  --pix-text-muted: #64748b;
  --pix-radius: 10px;
  --pix-radius-lg: 14px;
  --pix-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  --pix-shadow-lg: 0 10px 26px rgba(15, 23, 42, 0.08);
  --pix-focus: rgba(14, 116, 144, 0.35);
  --pix-box-header-bg: var(--pix-surface-muted);
  --pix-modal-header-bg: var(--pix-surface-muted);
  --pix-dt-scroll-bg: var(--pix-surface-muted);

  /* POS totals strip (core defaults; UI modes override these) */
  --pix-pos-totals-bg: #f8fafc;
  --pix-pos-totals-border: #e2e8f0;
  --pix-pos-totals-gap-bg: #e2e8f0;
  --pix-pos-cell-bg: #f8fafc;
  --pix-pos-label: #64748b;
  --pix-pos-value: #0f172a;
  --pix-pos-value-danger: #dc2626;
  --pix-pos-value-loyalty: #7c3aed;
  --pix-pos-edit: #0284c7;
  --pix-pos-payable-bg: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  --pix-pos-payable-border: #a7f3d0;
  --pix-pos-payable-label: #065f46;
  --pix-pos-payable-value: #047857;

  /* POS footer action bar (follows UI mode — not hard-coded white) */
  --pix-pos-footer-bg: #f1f5f9;
  --pix-pos-footer-border: rgba(148, 163, 184, 0.35);
  --pix-pos-footer-text: #334155;
  --pix-pos-footer-muted: #475569;
  --pix-pos-footer-divider: #cbd5e1;
  --pix-pos-footer-cancel-bg: transparent;
  --pix-pos-footer-cancel-border: #f87171;
  --pix-pos-footer-cancel-text: #dc2626;
  --pix-pos-footer-shadow: 0 -2px 10px rgba(15, 23, 42, 0.08);
}

/* Shared content cards / boxes */
:is(#scrollable-container, main, .content-wrapper) .box,
:is(#scrollable-container, main, .content-wrapper) .tw-rounded-xl,
:is(#scrollable-container, main, .content-wrapper) .tw-bg-white {
  border-color: var(--pix-border);
}

:is(#scrollable-container, main, .content-wrapper) .box {
  border-radius: var(--pix-radius);
  box-shadow: var(--pix-shadow);
  overflow: hidden;
}

:is(#scrollable-container, main, .content-wrapper) .box-header {
  background: var(--pix-box-header-bg);
  border-bottom: 1px solid var(--pix-border);
}

/* Filters row: consistent spacing */
:is(#scrollable-container, main, .content-wrapper) .form-group {
  margin-bottom: 0.75rem;
}

:is(#scrollable-container, main, .content-wrapper) label:not(.btn) {
  color: var(--pix-text-muted);
  font-weight: 600;
}

/* --- Absorbed from AdvancedUi: filter cards (structure, neutral) --- */
:is(#scrollable-container, main, .content-wrapper) [id^="pf_"].tw-bg-white,
:is(#scrollable-container, main, .content-wrapper) [id^="pf_"].tw-rounded-xl {
  background: rgba(255, 255, 255, 0.96) !important;
  border-radius: var(--pix-radius-lg) !important;
  box-shadow: var(--pix-shadow-lg) !important;
  border: 1px solid var(--pix-border) !important;
}

:is(#scrollable-container, main, .content-wrapper) .pf-btn .tw-text-gray-900 {
  color: var(--pix-text) !important;
}

/* Tables */
:is(#scrollable-container, main, .content-wrapper) .table > thead > tr > th,
:is(#scrollable-container, main, .content-wrapper) table.dataTable thead th {
  background: var(--pix-surface-muted);
  color: var(--pix-text);
  border-bottom-color: var(--pix-border) !important;
  font-weight: 700;
}

:is(#scrollable-container, main, .content-wrapper) .table > tbody > tr > td {
  vertical-align: middle;
}

/* --- Absorbed from AdvancedUi: button / export chrome (neutral) --- */
:is(#scrollable-container, main, .content-wrapper) .btn,
:is(#scrollable-container, main, .content-wrapper) .tw-dw-btn,
:is(#scrollable-container, main, .content-wrapper) a.tw-dw-btn,
:is(#scrollable-container, main, .content-wrapper) button.tw-dw-btn,
:is(#scrollable-container, main, .content-wrapper) .buttons-html5,
:is(#scrollable-container, main, .content-wrapper) .buttons-print,
:is(#scrollable-container, main, .content-wrapper) .buttons-collection,
:is(#scrollable-container, main, .content-wrapper) .buttons-colvis,
:is(#scrollable-container, main, .content-wrapper) .dt-buttons .dt-button {
  border-radius: 8px !important;
}

:is(#scrollable-container, main, .content-wrapper) .btn-default,
:is(#scrollable-container, main, .content-wrapper) .tw-dw-btn,
:is(#scrollable-container, main, .content-wrapper) .dt-buttons .dt-button {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

:is(#scrollable-container, main, .content-wrapper) .btn:focus,
:is(#scrollable-container, main, .content-wrapper) .form-control:focus,
:is(#scrollable-container, main, .content-wrapper) select:focus,
:is(#scrollable-container, main, .content-wrapper) input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--pix-focus);
}

/* Modals */
.modal-content {
  border-radius: var(--pix-radius);
  border: 1px solid var(--pix-border);
  box-shadow: var(--pix-shadow);
}

.modal-header {
  background: var(--pix-modal-header-bg);
  border-bottom: 1px solid var(--pix-border);
}

/* --- DataTables list tables --- */
:is(#scrollable-container, main, .content-wrapper) .box-primary:has(#sell_table),
:is(#scrollable-container, main, .content-wrapper) .box-primary:has(#product_table),
:is(#scrollable-container, main, .content-wrapper) .box-primary:has(#contact_table),
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper:not(.pixleas-dt-native-align) {
  overflow: visible !important;
  max-width: 100%;
}

/*
 * GLOBAL native align (PixleasDt default / scrollX:false):
 * One thead+tbody+tfoot = columns always align. H-scroll on wrapper.
 */
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper.pixleas-dt-native-align,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper:not(:has(.dataTables_scroll)),
:is(#scrollable-container, main, .content-wrapper) .pixleas-dt-host {
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper.pixleas-dt-native-align table.dataTable,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable {
  width: max-content !important;
  min-width: 100% !important;
  max-width: none !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper.pixleas-dt-native-align table.dataTable thead th,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper.pixleas-dt-native-align table.dataTable tbody td,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper.pixleas-dt-native-align table.dataTable tfoot td,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable thead th,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable tbody td,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable tfoot td {
  padding: 6px 8px !important;
  font-size: 12.5px !important;
  line-height: 1.3 !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  height: auto !important;
}

/* Shared column width caps (classNames — ColVis safe) */
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable th.pix-col-status,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable td.pix-col-status {
  max-width: 7.5rem !important;
  width: 7.5rem !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable th.pix-col-method,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable td.pix-col-method {
  max-width: 7rem !important;
  width: 7rem !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable th.pix-col-name,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable td.pix-col-name {
  max-width: 10rem !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable th.pix-col-note,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable td.pix-col-note {
  max-width: 9rem !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable th.pix-col-compact,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable td.pix-col-compact {
  max-width: 6.5rem !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tbody td.pix-col-status,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tbody td.pix-col-method,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tbody td.pix-col-name,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tbody td.pix-col-note,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tbody td.pix-col-compact {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tfoot td.pix-col-status,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tfoot td.pix-col-method,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tfoot td.footer_payment_status_count,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tfoot td.payment_method_count,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable tfoot td.service_type_count {
  max-width: 7.5rem !important;
  width: 7.5rem !important;
  white-space: normal !important;
  overflow: hidden !important;
  word-break: break-word !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
  vertical-align: top !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable .payment-status-label .label,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper table.dataTable td .label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Head/foot stay locked; body is the real H-scrollbar (DataTables syncs them) */
:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollHead,
:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollFoot {
  overflow: hidden !important;
}
:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Hide legacy custom bottom bar if any leftover DOM exists */
:is(#scrollable-container, main, .content-wrapper) .pixleas-dt-hscroll {
  display: none !important;
}

:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollHeadInner,
:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollFootInner,
:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollBody {
  box-sizing: border-box !important;
}

/* Pre-init placeholder width before DataTables marks .dataTable */
:is(#scrollable-container, main, .content-wrapper) #product_table:not(.dataTable),
:is(#scrollable-container, main, .content-wrapper) #contact_table:not(.dataTable) {
  width: 100%;
}

:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollHead table,
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollBody table,
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollFoot table,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollHead table,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollBody table,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollFoot table {
  max-width: none;
  table-layout: auto;
}

:is(#scrollable-container, main, .content-wrapper) .footer_sale_total,
:is(#scrollable-container, main, .content-wrapper) .footer_total_paid,
:is(#scrollable-container, main, .content-wrapper) .footer_total_remaining,
:is(#scrollable-container, main, .content-wrapper) .footer_total_sell_return_due {
  white-space: nowrap !important;
  font-weight: 700 !important;
  text-align: center !important;
  vertical-align: middle !important;
}

:is(#scrollable-container, main, .content-wrapper) #sell_table_wrapper .footer_payment_status_count,
:is(#scrollable-container, main, .content-wrapper) #sell_table_wrapper .payment_method_count,
:is(#scrollable-container, main, .content-wrapper) #sell_table_wrapper .service_type_count {
  font-size: 11px !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
  text-align: left !important;
}

:is(#scrollable-container, main, .content-wrapper) .dataTables_scrollBody tfoot {
  display: none !important;
}

:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollBody {
  min-height: 320px;
}

/* Products — same head/body padding; no tall footer (bulk actions are outside table) */
:is(#scrollable-container, main, .content-wrapper) #product_table thead th,
:is(#scrollable-container, main, .content-wrapper) #product_table tbody td,
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollHead th,
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollBody td {
  padding: 6px 8px !important;
  font-size: 12.5px !important;
  line-height: 1.3 !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper .dataTables_scrollFoot {
  display: none !important;
}
:is(#scrollable-container, main, .content-wrapper) .pixleas-product-bulk-actions {
  max-width: 100%;
  overflow-x: auto;
}

/* Contacts + sales: same head/body/foot padding so columns line up */
:is(#scrollable-container, main, .content-wrapper) #contact_table thead th,
:is(#scrollable-container, main, .content-wrapper) #contact_table tbody td,
:is(#scrollable-container, main, .content-wrapper) #contact_table tfoot td,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollHead th,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollBody td,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollFoot td {
  padding: 6px 8px !important;
  font-size: 12.5px !important;
  line-height: 1.3 !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

/* Contacts list — keep head/body/foot columns + borders aligned (no sell-footer tall cells) */
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollFoot {
  min-height: 0 !important;
}
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollFoot td,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper tfoot tr.footer-total td {
  min-height: 0 !important;
  height: auto !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollHead table,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollBody table,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollFoot table {
  border-collapse: collapse !important;
}
/* DataTables owns H-scroll — disable Bootstrap table-responsive nesting */
:is(#scrollable-container, main, .content-wrapper) .table-responsive:has(#contact_table),
:is(#scrollable-container, main, .content-wrapper) .table-responsive:has(#sell_table),
:is(#scrollable-container, main, .content-wrapper) .table-responsive:has(.dataTables_wrapper) {
  overflow: visible !important;
}
/* ColVis-hidden cells must collapse completely (specificity must beat per-table padding rules) */
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper th.dt-hidden,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper td.dt-hidden,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper th.pixleas-col-collapsed,
:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper td.pixleas-col-collapsed,
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #product_table_wrapper td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #product_table thead th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #product_table tbody td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #sell_table_wrapper th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #sell_table_wrapper td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #sell_table thead th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #sell_table tbody td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #sell_table tfoot td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #contact_table thead th[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #contact_table tbody td[style*="display: none"],
:is(#scrollable-container, main, .content-wrapper) #contact_table tfoot td[style*="display: none"] {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-width: 0 !important;
  overflow: hidden !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
}
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollHead th,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollBody td,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .dataTables_scrollFoot td {
  border-color: rgba(148, 163, 184, 0.35) !important;
}
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .footer_contact_due,
:is(#scrollable-container, main, .content-wrapper) #contact_table_wrapper .footer_contact_return_due {
  font-weight: 700 !important;
  text-align: center !important;
}

:is(#scrollable-container, main, .content-wrapper) #sell_table .btn-group,
:is(#scrollable-container, main, .content-wrapper) #sell_table .btn,
:is(#scrollable-container, main, .content-wrapper) #sell_table .dropdown-toggle {
  padding: 3px 8px !important;
  font-size: 12px !important;
  height: auto !important;
  min-height: 0 !important;
}

/* --- Phase 1.3: POS empty cart --- */
#pos_table:not(.pos-has-rows) thead {
  display: none !important;
}
#pos_table.pos-has-rows .pos-empty-state-row {
  display: none !important;
}
#add_pos_sell_form:not(.pos-has-rows) .pos_form_totals,
#edit_pos_sell_form:not(.pos-has-rows) .pos_form_totals {
  display: none !important;
}

.pos-empty-state-cell {
  border: 0 !important;
  padding: 0 !important;
}

.pos-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 2.5rem 1.5rem;
  min-height: 220px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(14, 116, 144, 0.06), transparent 70%),
    var(--pix-surface);
}

.pos-empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pix-text-muted);
  background: var(--pix-surface-muted);
  border: 1px solid var(--pix-border);
  box-shadow: var(--pix-shadow);
}

.pos-empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--pix-text);
  letter-spacing: -0.2px;
}

.pos-empty-state-hint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--pix-text-muted);
  max-width: 22rem;
}

@media (min-width: 768px) {
  .pos-empty-state {
    padding: 3.25rem 1.5rem;
    min-height: 280px;
  }
}

/* --- Phase 1.3: POS totals strip (structure + token colors) --- */
.pos_form_totals {
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--pix-pos-totals-bg);
  border-top: 1px solid var(--pix-pos-totals-border);
}

.pos_form_totals .pos_totals_left {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--pix-pos-totals-gap-bg);
  order: 1;
  min-width: 0;
}

.pos_form_totals .pos_totals_cell {
  flex: 1 1 calc(25% - 1px);
  min-width: calc(25% - 1px);
  max-width: 100%;
  background: var(--pix-pos-cell-bg);
  color: var(--pix-pos-value);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 3px;
  min-height: 26px;
  overflow: hidden;
  box-sizing: border-box;
}

.pos_form_totals .pos_totals_label,
.pos_form_totals .pos_totals_label .desktop-only,
.pos_form_totals .pos_totals_label .mobile-only {
  font-size: 9px;
  font-weight: 700;
  color: var(--pix-pos-label);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos_form_totals .pos_totals_value {
  font-size: 12px;
  font-weight: 700;
  color: var(--pix-pos-value);
  line-height: 1.2;
  letter-spacing: -0.2px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pos_form_totals .pos_totals_value--danger { color: var(--pix-pos-value-danger); }
.pos_form_totals .pos_totals_value--loyalty { color: var(--pix-pos-value-loyalty); }

.pos_form_totals .pos_totals_edit {
  cursor: pointer;
  font-size: 9px;
  padding: 0 2px;
  margin-left: 1px;
  color: var(--pix-pos-edit);
  vertical-align: middle;
  opacity: 0.8;
}

.pos_form_totals .pos_totals_edit:hover { opacity: 1; }

.pos_form_totals .pos_totals_right {
  order: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--pix-pos-payable-bg);
  border-top: 1px solid var(--pix-pos-payable-border);
}

.pos_form_totals .pos_totals_right_label {
  font-size: 11px;
  font-weight: 800;
  color: var(--pix-pos-payable-label);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  line-height: 1.2;
}

.pos_form_totals .pos_totals_right_value,
.pos_form_totals #total_payable {
  font-size: 19px;
  font-weight: 800;
  color: var(--pix-pos-payable-value);
  letter-spacing: -0.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.pos_form_totals .desktop-only { display: none; }
.pos_form_totals .mobile-only { display: inline; }

@media (max-width: 767px) {
  .pos_form_totals .pos_totals_right {
    margin-bottom: 25px;
  }
}

@media (min-width: 768px) {
  .pos_form_totals {
    flex-direction: row;
  }
  .pos_form_totals .pos_totals_left {
    flex: 1 1 70%;
  }
  .pos_form_totals .pos_totals_right {
    flex: 0 0 28%;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 4px 10px;
    min-height: 44px;
    border-top: none;
    border-left: 1px solid var(--pix-pos-payable-border);
  }
  .pos_form_totals .pos_totals_cell {
    padding: 3px 5px;
    min-height: 36px;
  }
  .pos_form_totals .pos_totals_label {
    font-size: 9px;
    letter-spacing: 0.4px;
    line-height: 1.15;
    white-space: nowrap;
  }
  .pos_form_totals .pos_totals_value {
    font-size: 12px;
  }
  .pos_form_totals .pos_totals_right_label { font-size: 9px; }
  .pos_form_totals .pos_totals_right_value,
  .pos_form_totals #total_payable { font-size: 22px; }
  .pos_form_totals .desktop-only { display: inline; }
  .pos_form_totals .mobile-only { display: none; }
}

/* POS footer action bar — token-driven (all UI modes) */
.pos-form-actions {
  background: var(--pix-pos-footer-bg) !important;
  border-top: 1px solid var(--pix-pos-footer-border) !important;
  box-shadow: var(--pix-pos-footer-shadow) !important;
  color: var(--pix-pos-footer-text) !important;
}
.pos-form-actions-inner {
  padding: 4px 8px !important;
  min-height: 44px !important;
}
.pos-form-actions .pos-footer-divider {
  background: var(--pix-pos-footer-divider) !important;
}
.pos-form-actions .pos-footer-btn--muted {
  color: var(--pix-pos-footer-muted) !important;
  background: transparent !important;
  border: 0;
  cursor: pointer;
}
.pos-form-actions .pos-footer-btn--cancel {
  background: var(--pix-pos-footer-cancel-bg) !important;
  border-color: var(--pix-pos-footer-cancel-border) !important;
  color: var(--pix-pos-footer-cancel-text) !important;
}
.pos-form-actions .pos-footer-btn--muted:hover {
  opacity: 1;
  filter: brightness(1.08);
}

/* Tighter cart product lines + less side padding */
body.lockscreen #add_pos_sell_form .tw-rounded-2xl,
body.lockscreen #edit_pos_sell_form .tw-rounded-2xl {
  border-radius: 12px !important;
}
#pos_table > thead > tr > th.pos-th,
#pos_table > thead > tr > th {
  background: var(--pix-pos-totals-bg) !important;
  color: var(--pix-pos-label) !important;
  border-bottom: 1px solid var(--pix-pos-totals-border) !important;
  padding: 4px 6px !important;
}
#pos_table > tbody > tr.product_row > td {
  padding: 4px 6px !important;
  vertical-align: middle !important;
}
#pos_table > tbody > tr.product_row .form-control {
  height: 30px;
  padding-top: 2px;
  padding-bottom: 2px;
}
.pos_product_div {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body.lockscreen .content.no-print {
  padding-left: 4px !important;
  padding-right: 4px !important;
}
#add_pos_sell_form .row.tw-flex,
#edit_pos_sell_form .row.tw-flex {
  gap: 2px !important;
}

/* ========== P1 admin shell responsive (all UI modes) ==========
   Marker: pixleas_ui_shell_responsive_v1 */

.thetop {
  min-width: 0;
  width: 100%;
  max-width: 100vw;
}

/* Fixed sidebar while page content scrolls (was in H1–H4 SkinCss; UI modes need it too) */
@media (min-width: 1024px) {
  body:not(.lockscreen) .thetop > aside#side-bar.side-bar,
  body:not(.lockscreen) .thetop > aside.side-bar.side-bar-modern,
  body:not(.lockscreen) aside#side-bar.side-bar-modern {
    position: fixed !important;
    top: 0 !important;
    inset-inline-start: 0 !important;
    inset-inline-end: auto !important;
    height: 100vh !important;
    max-height: 100vh !important;
    width: 16rem !important;
    min-width: 16rem !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    z-index: 1040 !important;
    display: flex !important;
    flex-direction: column !important;
    flex-shrink: 0 !important;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  html[dir="rtl"] body:not(.lockscreen) .thetop > aside#side-bar.side-bar,
  html[dir="rtl"] body:not(.lockscreen) .thetop > aside.side-bar.side-bar-modern,
  html[dir="rtl"] body:not(.lockscreen) aside#side-bar.side-bar-modern {
    inset-inline-start: auto !important;
    inset-inline-end: 0 !important;
  }

  body:not(.lockscreen) .thetop > main {
    margin-inline-start: 16rem !important;
    width: calc(100% - 16rem) !important;
    max-width: calc(100% - 16rem) !important;
  }

  /* Collapsed: slide off-screen; main reclaim full width */
  body.sidebar-panel-collapsed:not(.lockscreen) .thetop > aside#side-bar.side-bar,
  body.sidebar-collapse:not(.lockscreen) .thetop > aside#side-bar.side-bar,
  body.sidebar-panel-collapsed:not(.lockscreen) .thetop > aside.side-bar.side-bar-modern,
  body.sidebar-collapse:not(.lockscreen) .thetop > aside.side-bar.side-bar-modern {
    transform: translateX(-105%) !important;
    width: 16rem !important;
    min-width: 16rem !important;
    opacity: 1 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    box-shadow: none !important;
  }

  html[dir="rtl"] body.sidebar-panel-collapsed:not(.lockscreen) .thetop > aside#side-bar.side-bar,
  html[dir="rtl"] body.sidebar-collapse:not(.lockscreen) .thetop > aside#side-bar.side-bar,
  html[dir="rtl"] body.sidebar-panel-collapsed:not(.lockscreen) .thetop > aside.side-bar.side-bar-modern,
  html[dir="rtl"] body.sidebar-collapse:not(.lockscreen) .thetop > aside.side-bar.side-bar-modern {
    transform: translateX(105%) !important;
  }

  body.sidebar-panel-collapsed:not(.lockscreen) .thetop > main,
  body.sidebar-collapse:not(.lockscreen) .thetop > main {
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

main.tw-flex-1,
#scrollable-container {
  min-width: 0;
  max-width: 100%;
}

body.pix-mobile-sidebar-open {
  overflow: hidden;
}

/* Tools headers (module gradient bars) — stack on narrow viewports */
[class$="-tools-header"],
[class*="-tools-header "] {
  box-sizing: border-box;
  max-width: 100%;
}

[class$="-tools-header"] .tw-flex,
[class*="-tools-header"] .tw-flex {
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 767px) {
  [class$="-tools-header"] h2,
  [class*="-tools-header"] h2 {
    font-size: 1.15rem;
    line-height: 1.3;
    word-break: break-word;
  }

  [class$="-tools-header"] .tw-items-start,
  [class*="-tools-header"] .tw-items-start,
  [class$="-tools-header"] .tw-justify-between,
  [class*="-tools-header"] .tw-justify-between {
    flex-direction: column;
    align-items: stretch !important;
  }
}

/* Boxes / action rows wrap instead of overflowing */
:is(#scrollable-container, main, .content-wrapper) .box-header,
:is(#scrollable-container, main, .content-wrapper) .box-tools {
  max-width: 100%;
}

:is(#scrollable-container, main, .content-wrapper) .box-tools {
  float: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

:is(#scrollable-container, main, .content-wrapper) .dt-buttons,
:is(#scrollable-container, main, .content-wrapper) .dataTables_length,
:is(#scrollable-container, main, .content-wrapper) .dataTables_filter {
  float: none !important;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper {
  max-width: 100%;
}

:is(#scrollable-container, main, .content-wrapper) .dataTables_wrapper .row {
  display: flex;
  flex-wrap: wrap;
  margin-left: 0;
  margin-right: 0;
}

/* Prevent page-level horizontal scroll; table scrolls inside wrapper */
html, body {
  overflow-x: hidden;
  overflow-x: clip;
}

@media (max-width: 1023px) {
  #scrollable-container,
  main {
    width: 100%;
  }

  .pix-ui-mode-picker--compact {
    max-width: 140px;
  }

  .pix-ui-mode-picker--compact select {
    max-width: 100%;
    font-size: 12px;
  }
}

@media (max-width: 767px) {
  :is(#scrollable-container, main, .content-wrapper) .content {
    padding-left: 10px;
    padding-right: 10px;
  }

  :is(#scrollable-container, main, .content-wrapper) .box {
    margin-bottom: 12px;
  }
}

/* ========== P2 high-traffic admin pages (all UI modes) ==========
   Marker: pixleas_ui_pages_responsive_v1 */

/* Dense filter grids: stack col-md-2/3 before they crush under sidebar */
@media (max-width: 1279px) {
  :is(#scrollable-container, main, .content-wrapper) .box .row > [class*="col-md-2"],
  :is(#scrollable-container, main, .content-wrapper) .box .row > [class*="col-md-3"],
  :is(#scrollable-container, main, .content-wrapper) .box-body .row > [class*="col-md-2"],
  :is(#scrollable-container, main, .content-wrapper) .box-body .row > [class*="col-md-3"] {
    width: 50%;
    float: left;
  }
}

@media (max-width: 767px) {
  :is(#scrollable-container, main, .content-wrapper) .box .row > [class*="col-md-2"],
  :is(#scrollable-container, main, .content-wrapper) .box .row > [class*="col-md-3"],
  :is(#scrollable-container, main, .content-wrapper) .box-body .row > [class*="col-md-2"],
  :is(#scrollable-container, main, .content-wrapper) .box-body .row > [class*="col-md-3"],
  :is(#scrollable-container, main, .content-wrapper) .box .row > [class*="col-md-4"],
  :is(#scrollable-container, main, .content-wrapper) .box-body .row > [class*="col-md-4"] {
    width: 100%;
    float: none;
  }
}

/* DataTables search / length controls must not force page width */
:is(#scrollable-container, main, .content-wrapper) .dataTables_filter input,
:is(#scrollable-container, main, .content-wrapper) .dataTables_length select {
  max-width: 100%;
  box-sizing: border-box;
}

:is(#scrollable-container, main, .content-wrapper) .dataTables_filter label,
:is(#scrollable-container, main, .content-wrapper) .dataTables_length label {
  max-width: 100%;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Wide admin tables: scroll inside wrapper, allow cells to shrink */
:is(#scrollable-container, main, .content-wrapper) .table-responsive {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
:is(#scrollable-container, main, .content-wrapper) .pixleas-dt-host {
  max-width: 100%;
  width: 100%;
  overflow: visible;
}

:is(#scrollable-container, main, .content-wrapper) .table-responsive > .table {
  margin-bottom: 0;
}

@media (max-width: 1279px) {
  :is(#scrollable-container, main, .content-wrapper) .table-responsive > .table > thead > tr > th,
  :is(#scrollable-container, main, .content-wrapper) .table-responsive > .table > tbody > tr > td {
    word-break: break-word;
  }
}

/* Select2 in filter rows: stay within column */
:is(#scrollable-container, main, .content-wrapper) .box .select2-container,
:is(#scrollable-container, main, .content-wrapper) .box-body .select2-container {
  max-width: 100% !important;
}

/* POS totals: allow cells to wrap under laptop widths (also helps P3) */
@media (max-width: 1279px) {
  .pos_form_totals .pos_totals_cell {
    flex: 1 1 calc(33.333% - 1px);
    min-width: 0;
  }
}

@media (max-width: 1023px) {
  .pos_form_totals .pos_totals_cell {
    flex: 1 1 calc(50% - 1px);
    min-width: 0;
  }

  /* POS product sidebar filters — stack when column is narrow */
  #product_category.select2,
  #product_brand.select2,
  .select2-container--default#product_category,
  .box-header #product_category + .select2-container,
  .box-header #product_brand + .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 6px;
  }
}

/* POS line inputs: never spill with inline width:auto */
#pos_table .form-control.pos_unit_price_inc_tax,
#pos_table .form-control.pos_line_total,
#pos_table .input-group.input-number,
#pos_table .input-group.input-number > .form-control {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

/* POS footer action bar: wrap instead of only horizontal scroll */
.pos-form-actions,
.pos_form_actions,
#pos_form_actions {
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

@media (max-width: 767px) {
  .pos-form-actions .btn,
  .pos_form_actions .btn,
  #pos_form_actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* POS short viewports (laptop height / landscape phone) */
@media (max-height: 800px) {
  #product_list_body.eq-height-row,
  #product_list_body {
    max-height: calc(100vh - 180px) !important;
  }

  .pos_form_totals .pos_totals_cell {
    min-height: 28px;
    padding: 2px 4px;
  }

  .pos_form_totals .pos_totals_value {
    font-size: 11px;
  }

  .pos_form_totals .pos_totals_right_value,
  .pos_form_totals #total_payable {
    font-size: 18px;
  }
}

@media (max-height: 640px) {
  .pos-form-actions,
  .pos_form_actions {
    min-height: 0 !important;
  }

  .pos-form-actions .tw-min-h-\[52px\] {
    min-height: 44px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
  }
}

/* POS header fields: two-up on tablets */
@media (max-width: 1279px) and (min-width: 768px) {
  #add_pos_sell_form .box-body > .row > [class*="col-md-4"] {
    width: 50%;
    float: left;
  }
}

@media (max-width: 767px) {
  #add_pos_sell_form .box-body > .row > [class*="col-md-4"],
  #add_pos_sell_form .box-body > .row > [class*="col-md-3"] {
    width: 100%;
    float: none;
  }

  #pos_sidebar_wrap {
    margin-bottom: 72px;
  }
}
