
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&display=swap");

/* Keep toastr default colors even when Bootstrap dark theme toast styles are active */
#toast-container > .toast-success,
html[data-bs-theme="dark"] #toast-container > .toast-success {
  background-color: #51a351 !important;
  color: #fff !important;
}

#toast-container > .toast-error,
html[data-bs-theme="dark"] #toast-container > .toast-error {
  background-color: #bd362f !important;
  color: #fff !important;
}

#toast-container > .toast-info,
html[data-bs-theme="dark"] #toast-container > .toast-info {
  background-color: #2f96b4 !important;
  color: #fff !important;
}

#toast-container > .toast-warning,
html[data-bs-theme="dark"] #toast-container > .toast-warning {
  background-color: #f89406 !important;
  color: #fff !important;
}

.admin-topbar {
  position: fixed;
  top: 0.75rem;
  right: 1rem;
  left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0;
  z-index: 1600;
  pointer-events: auto;
  background: #ffffff !important;
  background-color: #ffffff !important;
  box-shadow: none !important;
  border: none !important;
}

.admin-topbar,
html[data-bs-theme="light"] .admin-topbar {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: var(--bs-body-color) !important;
}

html[data-bs-theme="dark"] .admin-topbar {
  background: #1e1e2d !important;
  background-color: #1e1e2d !important;
  color: var(--bs-body-color) !important;
}

.admin-topbar__menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  width: auto;
  margin: 0;
  pointer-events: auto;
  background: transparent;
}

#main > header {
  position: relative;
  z-index: 1061;
}

#main .burger-btn {
  position: relative;
  z-index: 1062;
  display: inline-flex;
  align-items: center;
}

@media screen and (max-width: 1199.98px) {
  #sidebar.active .sidebar-wrapper {
    z-index: 2000 !important;
  }

  .sidebar-backdrop {
    z-index: 1999 !important;
  }

  #sidebar.active ~ #main .burger-btn {
    display: none !important;
  }

  /* Extra scroll room below Logout on mobile drawer */
  #sidebar .sidebar-wrapper .sidebar-menu,
  #sidebar .sidebar-wrapper .menu {
    padding-bottom: 5rem !important;
  }

  #sidebar .sidebar-wrapper .menu > .sidebar-item:last-child,
  #sidebar .sidebar-logout-item {
    margin-bottom: 2.5rem;
  }
}

.admin-topbar__track-form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.admin-topbar__track-input {
  width: 260px;
  max-width: 260px;
  min-width: 0;
}

.admin-topbar__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 12px !important;
  background: transparent !important;
  color: var(--bs-body-color) !important;
  box-shadow: none;
}

.admin-topbar__toggle:hover,
.admin-topbar__toggle:focus,
html[data-bs-theme="dark"] .admin-topbar__toggle:hover,
html[data-bs-theme="dark"] .admin-topbar__toggle:focus {
  background: transparent !important;
  color: var(--bs-body-color) !important;
  border-color: var(--bs-border-color) !important;
  box-shadow: none !important;
}

.admin-topbar__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: #7c3aed;
  color: #ffffff;
  flex: 0 0 auto;
}

.admin-topbar__name {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.admin-topbar__dropdown {
  z-index: 1601 !important;
  background: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(15, 15, 21, 0.12);
  overflow: hidden;
}
/* Keep branch badge and profile below Bootstrap modals (backdrop 1050, modal 1055) */
body.modal-open .admin-topbar {
  z-index: 1030 !important;
}

body.modal-open .admin-topbar__dropdown {
  z-index: 1031 !important;
}

.admin-topbar__dropdown-track-section {
  min-width: min(280px, calc(100vw - 2rem));
}

.admin-topbar__track-form--dropdown {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.admin-topbar__track-form--dropdown .admin-topbar__track-input {
  width: 100%;
  max-width: 100%;
}

.admin-topbar__track-form--dropdown .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.admin-topbar__track-form--desktop-dashboard .admin-topbar__track-input {
  width: clamp(170px, 22vw, 260px);
}

.admin-topbar__track-form--desktop-dashboard .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.admin-topbar__track-form--desktop-dashboard {
  display: none;
}

.admin-topbar__dropdown-track-section--mobile-only {
  display: none;
}

@media screen and (min-width: 1200px) {
  .admin-topbar {
    left: auto;
    right: 1rem;
  }

  .admin-topbar__track-form--desktop-dashboard {
    display: inline-flex;
  }
}

@media screen and (max-width: 1199.98px) {
  .admin-topbar__dropdown-track-section--mobile-only {
    display: block;
  }

  .admin-topbar__track-form--desktop-dashboard {
    display: none !important;
  }

  /* Solid sticky bar â€” full-width, items vertically centered, never clips */
  .admin-topbar {
    --admin-topbar-height: 3.75rem;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    z-index: 1060 !important;
    height: auto !important;
    min-height: var(--admin-topbar-height) !important;
    max-height: none !important;
    padding: 0.55rem 0.75rem 0.55rem 3.5rem !important;
    margin: 0 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: none !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.06) !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    overflow: visible !important;
    opacity: 1 !important;
  }

  html[data-bs-theme="dark"] .admin-topbar {
    background: #1e1e2d !important;
    background-color: #1e1e2d !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.35) !important;
  }

  .admin-topbar__menu {
    width: 100%;
    min-height: 2.5rem;
    height: auto;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    background: transparent;
  }

  .admin-topbar__menu > .badge,
  .admin-topbar__branch {
    flex: 0 1 auto;
    max-width: 42%;
    min-height: 1.85rem;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    padding: 0.4em 0.7em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 auto 0 0;
    position: relative;
    top: 0;
    transform: none;
  }

  .admin-topbar__menu > .dropdown {
    flex: 0 0 auto;
    min-width: 0;
    max-width: min(58%, 12.5rem);
    margin: 0;
    display: flex;
    align-items: center;
    align-self: center;
  }

  .admin-topbar__track-form--dropdown {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
  }

  .admin-topbar__track-input {
    width: 100%;
    max-width: 100%;
  }

  .admin-topbar__toggle,
  .admin-topbar__toggle:hover,
  .admin-topbar__toggle:focus,
  .admin-topbar__toggle:active,
  .admin-topbar__toggle.show,
  html[data-bs-theme="dark"] .admin-topbar__toggle,
  html[data-bs-theme="dark"] .admin-topbar__toggle:hover,
  html[data-bs-theme="dark"] .admin-topbar__toggle:focus,
  html[data-bs-theme="light"] .admin-topbar__toggle {
    width: auto;
    max-width: 100%;
    height: auto !important;
    min-height: 2.5rem;
    padding: 0.2rem 0.35rem 0.2rem 0.25rem !important;
    gap: 0.4rem;
    justify-content: flex-start;
    align-items: center !important;
    align-self: center;
    margin: 0 !important;
    line-height: 1.2 !important;
    background: transparent !important;
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    color: var(--bs-body-color) !important;
  }

  .admin-topbar__toggle::after {
    margin-top: 0;
    align-self: center;
  }

  .admin-topbar__avatar {
    width: 1.85rem;
    height: 1.85rem;
    flex-shrink: 0;
  }

  .admin-topbar__name {
    max-width: 7.5rem;
    font-size: 0.85rem;
    line-height: 1.2;
    color: var(--bs-body-color) !important;
  }

  html {
    scroll-padding-top: 4rem;
  }

  /* Push page content below the fixed topbar */
  #main {
    padding-top: 4rem !important;
    position: relative;
  }

  #main > header {
    margin: 0 !important;
    min-height: 0;
    height: var(--admin-topbar-height, 3.75rem) !important;
    width: 3rem;
    position: fixed !important;
    top: 0 !important;
    left: 0.5rem !important;
    z-index: 1065 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }
}

@media screen and (max-width: 420px) {
  .admin-topbar__track-form--dropdown {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-topbar__track-form--dropdown .btn {
    width: 100%;
  }
}

table th,
table td {
  white-space: nowrap;
}

/* Make Select2 follow active Bootstrap theme colors instead of fixed white */
.select2-container--bootstrap-5 .select2-selection,
.select2-container--bootstrap-5 .select2-dropdown,
.select2-container--bootstrap-5
  .select2-dropdown
  .select2-search
  .select2-search__field {
  background-color: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
  border-color: var(--bs-border-color) !important;
}

.select2-container--bootstrap-5
  .select2-selection--single
  .select2-selection__rendered,
.select2-container--bootstrap-5
  .select2-selection--multiple
  .select2-selection__rendered,
.select2-container--bootstrap-5 .select2-results__option,
.select2-container--bootstrap-5
  .select2-search--dropdown
  .select2-search__field,
.select2-container--bootstrap-5 .select2-search--inline .select2-search__field {
  color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5
  .select2-results__option.select2-results__option--highlighted {
  background-color: var(--bs-secondary-bg) !important;
  color: var(--bs-body-color) !important;
}

.select2-container--bootstrap-5 .select2-results__option[aria-selected="true"] {
  background-color: var(--bs-tertiary-bg) !important;
}

.select2-container--bootstrap-5 .select2-selection__placeholder,
.select2-container--bootstrap-5
  .select2-results__option.select2-results__message {
  color: var(--bs-secondary-color) !important;
}

html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
html[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown,
html[data-bs-theme="dark"]
  .select2-container--bootstrap-5
  .select2-dropdown
  .select2-search
  .select2-search__field,
html[data-bs-theme="dark"]
  .select2-container--bootstrap-5
  .select2-results__option,
html[data-bs-theme="dark"]
  .select2-container--bootstrap-5
  .select2-results__option.select2-results__option--highlighted,
html[data-bs-theme="dark"]
  .select2-container--bootstrap-5
  .select2-results__option[aria-selected="true"] {
  background-color: rgb(27, 27, 40) !important;
}


/* fixed height for selected container div */
#products_container {
  min-height: 300px;
}

#products_container .selected-product-label {
  min-height: calc(1.5em + 0.75rem + 2px);
  display: flex;
  align-items: center;
}

/* Remove browser stepper controls on POS quantity input for cleaner spacing */
#sales_form .product-quantity,
#sales_form .product-discount {
  -moz-appearance: textfield;
  appearance: textfield;
}

#sales_form .product-quantity::-webkit-outer-spin-button,
#sales_form .product-quantity::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#sales_form .product-discount::-webkit-outer-spin-button,
#sales_form .product-discount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#sales_form .product-item .form-label {
  font-weight: 700;
}

html[data-bs-theme="light"] #sales_form .product-item .form-label {
  color: #dc3545;
}

html[data-bs-theme="dark"] #sales_form .product-item .form-label {
  color: #dc3545;
}

/* Match .form-control / .btn row height and full column width (pos line items) */
#products_container .pos-item-total-field.badge.item-total {
  --bs-badge-padding-x: 0.75rem;
  --bs-badge-padding-y: 0.375rem;
  --bs-badge-font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(1.5em + 0.75rem + 2px);
  font-weight: 400;
  line-height: 1.5;
  box-sizing: border-box;
}

/* Entry screens rendered without the admin sidebar (purchase, stock adjustment,
   sales return, stock transfer, phone swap). Mirrors #main minus the 300px sidebar gutter. */
.no-sidebar-page {
  margin-left: 0;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media screen and (max-width: 767.98px) {
  .no-sidebar-page {
    padding: 1rem;
  }
}

/* Sidebar kept off-canvas at every width on those pages. !important is required
   to beat app.css / app-dark.css desktop pin rules (incl. dark theme). */
html body #sidebar.offcanvas-always .sidebar-wrapper,
html body #sidebar.offcanvas-always.inactive .sidebar-wrapper {
  left: -300px !important;
  z-index: 2000;
}

/* Only show when explicitly opened: theme onFirstLoad can leave both
   `active` and `inactive` on the element; inactive must win in that case. */
html body #sidebar.offcanvas-always.active:not(.inactive) .sidebar-wrapper {
  left: 0 !important;
}

html body #sidebar.offcanvas-always ~ .no-sidebar-page {
  margin-left: 0 !important;
}

html body:has(#sidebar.offcanvas-always) .sidebar-backdrop {
  z-index: 1999 !important;
}

.no-sidebar-page > header {
  position: relative;
  z-index: 1061;
}

.no-sidebar-page .burger-btn {
  position: relative;
  z-index: 1062;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  line-height: 1;
  color: var(--bs-body-color);
}

.no-sidebar-page .burger-btn i {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  line-height: 1;
}

/* â”€â”€ POS mobile densify (small screens only) â”€â”€ */
@media (max-width: 991.98px) {
  .pos-page {
    padding-left: 0.35rem !important;
    padding-right: 0.35rem !important;
    max-width: 100%;
    overflow-x: hidden;
  }

  .pos-page > header {
    padding-left: 0.35rem;
  }

  .pos-page .page-title,
  .pos-page .page-heading,
  .pos-page .page-content,
  .pos-page .page-heading .section {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .pos-page .pos-toolbar-card {
    margin-bottom: 0.5rem !important;
    border-radius: 0.65rem;
  }

  .pos-page .pos-toolbar-card > .card-body {
    /* Same inset as .page-title (no extra layer); tiny edge breathing room only */
    padding: 0.25rem !important;
  }

  .pos-page .pos-toolbar-title {
    border-right: 0 !important;
    padding-right: 0 !important;
  }

  .pos-page .pos-toolbar-title h4 {
    font-size: 1.15rem;
  }

  .pos-page .pos-toolbar-meta-inner {
    width: 100%;
    flex-wrap: wrap;
  }

  .pos-page .pos-toolbar-meta-inner > #order_number {
    width: 7.25rem !important;
    flex: 0 0 auto;
  }

  .pos-page .pos-toolbar-meta-inner > #quick_order_date {
    width: auto !important;
    flex: 1 1 8rem;
    min-width: 0;
  }

  .pos-page .pos-toolbar-meta-inner > #quick_customer_id,
  .pos-page .pos-toolbar-meta-inner > .select2-container {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100%;
    min-width: 0 !important;
  }

  .pos-page .pos-toolbar-actions .btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
  }

  .pos-page .pos-alert-modes {
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start;
    gap: 0.5rem !important;
    /* Same inset as toolbar / main card-body on mobile */
    margin: 0.25rem 0 0.5rem !important;
    padding: 0.25rem !important;
    box-sizing: border-box;
    width: 100%;
  }

  .pos-page .pos-alert-modes > .d-flex {
    width: 100%;
    margin-left: 0 !important;
    gap: 0.75rem !important;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .pos-page .pos-alert-text {
    font-size: 0.8rem;
    line-height: 1.35;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .pos-page .page-heading > .card,
  .pos-page .page-content > .card,
  .pos-page .page-heading .card.shadow-sm {
    border-radius: 0.65rem !important;
    margin-left: 0;
    margin-right: 0;
  }

  .pos-page .page-heading > .card > .card-body,
  .pos-page .page-heading .card > .card-body,
  .pos-page .page-content .card > .card-body,
  .pos-page .pos-main-card-body.card-body,
  .pos-page .card .pos-main-card-body {
    padding: 0.25rem !important;
  }

  .pos-page #pos_main_row.pos-layout {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
  }

  .pos-page #pos_main_left_col .checkout-panel {
    padding: 0.25rem !important;
  }

  .pos-page #pos_main_left_col .checkout-panel > .row.g-3.mb-3 {
    margin-bottom: 0.5rem !important;
    --bs-gutter-y: 0.4rem;
  }

  /* Select product + cart + summaries: keep Bootstrap p-2 */
  .pos-page .pos-select-product-box,
  .pos-page .pos-selected-product-box {
    padding: 0.5rem !important; /* Bootstrap p-2 */
    margin-bottom: 0.65rem !important;
  }

  .pos-page .pos-select-product-box .row {
    --bs-gutter-x: 0.5rem;
    --bs-gutter-y: 0.5rem;
  }

  .pos-page #products_container {
    min-height: 0;
  }

  .pos-page #products_container .product-item {
    margin-bottom: 0.55rem !important;
    padding: 0.5rem !important;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
  }

  .pos-page #products_container .product-item .row {
    --bs-gutter-x: 0.45rem;
    --bs-gutter-y: 0.35rem;
  }

  .pos-page #products_container .selected-product-label,
  .pos-page #products_container .unit-price-label,
  .pos-page #products_container .pos-item-total-field.badge.item-total {
    min-height: 0;
  }

  .pos-page #products_container .selected-product-label {
    display: block;
    font-size: 0.88rem;
    line-height: 1.3;
    font-weight: 600;
    color: var(--bs-body-color);
  }

  .pos-page #products_container .product-item .form-label {
    margin-bottom: 0.1rem;
    font-size: 0.72rem;
  }

  .pos-page #products_container .product-item .col-md-6.order-1 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .pos-page #products_container .product-item .col-md-2.order-2,
  .pos-page #products_container .product-item .col-md-1.order-3,
  .pos-page #products_container .product-item .col-md-1.order-4,
  .pos-page #products_container .product-item .col-md-1.order-5 {
    flex: 0 0 25%;
    max-width: 25%;
  }

  .pos-page #products_container .product-item .col-md-1.order-last {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .pos-page #products_container .product-item .remove-product-btn {
    margin-top: 0.15rem;
  }

  .pos-page .pos-summaries-wrap {
    margin-top: 0.65rem !important;
  }

  .pos-page .pos-summaries-row {
    display: flex;
    flex-direction: column;
  }

  /* Payment first, Sale Summary after â€” mobile only */
  .pos-page .pos-payment-summary-col {
    order: 1;
  }

  .pos-page .pos-sale-summary-col {
    order: 2;
  }

  .pos-page .pos-payment-summary-col > .border,
  .pos-page .pos-sale-summary-col > .border {
    padding: 0.5rem !important; /* p-2 */
  }

  .pos-page .pos-payment-summary-col h6,
  .pos-page .pos-sale-summary-col h6 {
    margin-bottom: 0.45rem !important;
    font-size: 0.85rem;
  }

  .pos-page #payment_method_btn_row {
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
  }

  .pos-page #payment_method_btn_row .payment-method-col {
    flex: 1 1 calc(33.333% - 0.35rem);
    min-width: 4.75rem;
  }

  .pos-page .payment-method-btn {
    font-size: 0.78rem;
    white-space: nowrap;
    padding: 0.4rem 0.2rem !important;
    line-height: 1.2;
  }

  .pos-page .payment-method-amount-label {
    font-size: 0.65rem;
    line-height: 1.2;
  }

  .pos-page #grand_total,
  .pos-page #balance,
  .pos-page #quick_customer_credit_balance {
    font-size: 1.25rem !important;
  }

  .pos-page #pos_main_right_col .product-panel {
    border-radius: 0.65rem;
  }

  .pos-page #pos_main_right_col .product-header {
    padding: 0.5rem !important;
  }

  .pos-page #pos_main_right_col .product-grid-scroll {
    padding: 0.35rem !important;
  }

  .pos-page #pos_products_grid {
    --bs-gutter-x: 0.35rem;
    --bs-gutter-y: 0.35rem;
    margin-left: calc(-0.5 * var(--bs-gutter-x));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
  }

  .pos-page #pos_products_grid > [class*="col-"] {
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    padding-right: calc(var(--bs-gutter-x) * 0.5);
  }

  .pos-page .pos-product-item .card {
    margin-bottom: 0.35rem !important;
  }

  .pos-page .pos-product-item .card-body {
    padding: 0.4rem 0.3rem !important;
  }

  .pos-page .pos-product-item .text-truncate {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
    font-size: 10px !important;
  }
}

@media (max-width: 575.98px) {
  .pos-page {
    padding-left: 0.2rem !important;
    padding-right: 0.2rem !important;
  }

  .pos-page #payment_method_btn_row .payment-method-col {
    flex: 1 1 calc(50% - 0.35rem);
  }

  .pos-page .pos-toolbar-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (min-width: 992px) {
  .pos-page .pos-toolbar-title {
    border-right: 1px solid var(--bs-border-color);
  }

  .pos-page .pos-toolbar-meta-inner {
    flex-wrap: nowrap;
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
  }

  .pos-page .pos-toolbar-meta-inner > #order_number {
    width: 120px !important;
    flex: 0 0 120px;
  }

  .pos-page .pos-toolbar-meta-inner > #quick_order_date {
    width: 150px !important;
    flex: 0 0 150px;
  }

  .pos-page .pos-toolbar-meta-inner > #quick_customer_id,
  .pos-page .pos-toolbar-meta-inner > .select2-container {
    width: 300px !important;
    max-width: 300px !important;
    min-width: 220px !important;
    flex: 1 1 300px;
  }

  .pos-page .pos-toolbar-card > .card-body {
    padding: 0.5rem 0.75rem !important;
  }
}

/* Dashboard summary period filter */
.dashboard-period-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.dashboard-period-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.dashboard-period-custom .form-control {
  width: auto;
  min-width: 9.5rem;
}

/* Dashboard layout refinements */
.dashboard-layout .summary-metrics .stats-icon {
  flex-shrink: 0;
  float: none !important;
  margin-bottom: 0 !important;
  margin-left: auto;
  order: 2;
}

.dashboard-layout .summary-metrics {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}

.dashboard-layout .summary-metrics > [class*="col-"] {
  display: flex;
}

.dashboard-layout .summary-metric-card {
  margin-bottom: 0;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.dashboard-layout .summary-metric-card__link {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  color: inherit;
}

.dashboard-layout .summary-metric-card .card-body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-height: 5.5rem;
  overflow: visible;
}

.dashboard-layout .summary-metric-card .card-body > .d-flex {
  width: 100%;
  min-width: 0;
  align-items: center !important;
}

.dashboard-layout .summary-metric-card__text {
  min-width: 0;
  flex: 1 1 auto;
  order: 1;
  overflow: visible;
  padding-right: 0.5rem;
}

.dashboard-layout .summary-metrics h6 {
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
  margin-bottom: 0.25rem !important;
}

.dashboard-layout .summary-metric-card__value {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: 1.05rem;
  line-height: 1.25;
}

.profit-summary-metrics .summary-metric-card .card-body {
  padding: 0.7rem 0.85rem !important;
  min-height: 0;
}

.orders-tender-metrics .summary-metrics {
  --bs-gutter-x: 0.75rem;
  --bs-gutter-y: 0.75rem;
}

.orders-tender-metrics .summary-metrics > .col {
  display: flex;
  min-width: 0;
}

.orders-tender-metrics .summary-metric-card__label {
  font-size: 0.72rem;
  line-height: 1.2;
}

.dashboard-layout.orders-tender-metrics .summary-metric-card__value,
.dashboard-layout.orders-tender-metrics .summary-metrics h5 {
  font-size: 1.05rem;
}

/* When metrics sit beside Top Selling: 4 cols x 2 rows, keep amounts readable */
@media screen and (min-width: 1400px) {
  .dashboard-layout .dashboard-metrics-top-row .summary-metrics {
    --bs-gutter-x: 0.65rem;
    --bs-gutter-y: 0.65rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metric-card .card-body {
    padding: 0.85rem 0.9rem !important;
    min-height: 4.75rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metric-card__text {
    padding-right: 0.35rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metrics h6 {
    font-size: 0.8rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metric-card__value {
    font-size: 0.98rem;
    overflow: visible;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metrics .stats-icon {
    width: 2.15rem;
    height: 2.15rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metrics .stats-icon i {
    font-size: 1.15rem;
  }

  .dashboard-layout.orders-tender-metrics .summary-metrics .stats-icon {
    width: 2.15rem;
    height: 2.15rem;
  }

  .dashboard-layout.orders-tender-metrics .summary-metrics .stats-icon i {
    font-size: 1.15rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .top-selling-products-card .card-header h4 {
    font-size: 1.05rem;
  }

  .dashboard-layout .dashboard-metrics-top-row .top-selling-products-card .card-header .small {
    font-size: 0.75rem;
  }
}

.dashboard-layout .top-selling-products-card {
  width: 100%;
}

.dashboard-layout .top-selling-products-body {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

@media screen and (min-width: 1400px) {
  .dashboard-layout .dashboard-metrics-top-row {
    align-items: stretch !important;
  }

  .dashboard-layout .dashboard-metrics-top-row > [class*="col-"] {
    display: flex;
    flex-direction: column;
  }

  .dashboard-layout .dashboard-metrics-top-row .summary-metrics {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
  }

  .dashboard-layout .dashboard-metrics-top-row > .col-xxl-3 > .top-selling-products-card {
    height: 100%;
    min-height: 100%;
  }
}

/* Below xxl: Top Selling stacks under metrics; keep metric tiles readable */
@media screen and (max-width: 1399.98px) {
  .dashboard-layout .dashboard-metrics-top-row > .col-xxl-9,
  .dashboard-layout .dashboard-metrics-top-row > .col-xxl-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .dashboard-layout .top-selling-products-card {
    height: auto !important;
    min-height: 0 !important;
  }

  .dashboard-layout .summary-metric-card .card-body {
    padding: 1rem !important;
  }

  .dashboard-layout .summary-metric-card__value {
    font-size: 1rem;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }

  .dashboard-layout .summary-metric-card__text {
    min-width: 0;
    padding-right: 0.5rem;
  }

  .dashboard-layout .summary-metrics .stats-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    float: none !important;
    margin-left: auto;
    margin-bottom: 0 !important;
  }
}

/* Paired dashboard rows: Recent Sales / Branch Sales and Low Stock / Cash Flow */
.dashboard-layout {
  --dash-sales-thead-height: 2.4rem;
  --dash-sales-row-height: 3.1rem;
  --dash-sales-visible-rows: 4;
  --dash-branch-card-height: 5.85rem;
  --dash-branch-visible-rows: 2;
  --dash-branch-grid-gap: 0.75rem;
  --dash-stock-card-height: 7.25rem;
  --dash-stock-visible-rows: 2;
  --dash-stock-grid-gap: 0.5rem;
  --dash-credit-card-height: 5.35rem;
  --dash-credit-visible-rows: 5;
  --dash-credit-grid-gap: 0.5rem;
  --dash-chart-panel-height: calc(
    (var(--dash-credit-card-height) * var(--dash-credit-visible-rows)) +
    (var(--dash-credit-grid-gap) * (var(--dash-credit-visible-rows) - 1))
  );
}

/* Top Selling Products dropdown: keep rows inside the card width */
.dashboard-layout .top-products-dropdown {
  position: relative;
  max-width: 100%;
}

.dashboard-layout .top-products-menu {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  padding: 0.35rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(24rem, 60vh);
  position: absolute;
  inset: auto;
  left: 0;
  right: 0;
  transform: none !important;
}

.dashboard-layout .top-products-item {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  cursor: default;
}

.dashboard-layout .top-products-item:hover,
.dashboard-layout .top-products-item:focus {
  background-color: var(--bs-tertiary-bg);
}

.dashboard-layout .top-products-item__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
}

.dashboard-layout .top-products-item__rank,
.dashboard-layout .top-products-item__qty {
  flex-shrink: 0;
  white-space: nowrap;
}

.dashboard-layout .top-products-item__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.dashboard-layout .top-products-item__sales {
  margin-top: 0.2rem;
  text-align: right;
}

/* Large screens: tighter vertical gaps between dashboard card rows */
@media screen and (min-width: 1200px) {
  .dashboard-layout > .dashboard-grid > .row {
    --bs-gutter-y: 0.5rem;
    margin-top: 0.35rem !important;
    margin-bottom: 0 !important;
  }

  .dashboard-layout > .dashboard-grid > .row.dashboard-paired-row {
    margin-top: 0.35rem !important;
  }

  .dashboard-layout > .dashboard-grid > .row.dashboard-paired-row--stock {
    margin-bottom: 0.75rem !important;
  }

  .dashboard-layout .summary-metrics {
    --bs-gutter-y: 0.5rem;
  }

  .dashboard-layout .summary-metrics .card,
  .dashboard-layout .summary-metric-card {
    margin-bottom: 0 !important;
  }

  .dashboard-layout .summary-metric-card__value {
    font-size: 1.05rem;
  }

  .dashboard-layout .card {
    margin-bottom: 0;
  }
}

.dashboard-layout .dashboard-paired-row > [class*="col-"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-layout .dashboard-paired-row > [class*="col-"] > .card {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dashboard-layout .dashboard-paired-row .dashboard-panel-paired,
.dashboard-layout .dashboard-paired-row .dashboard-panel-scroll {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
}

.dashboard-layout .dashboard-paired-row .dashboard-panel-paired > .card-header,
.dashboard-layout .dashboard-paired-row .dashboard-panel-scroll > .card-header {
  flex-shrink: 0;
}

.dashboard-layout .dashboard-paired-row .dashboard-panel-reference > .card-body {
  flex: 1 1 auto;
  min-height: 0;
}

/* Tablet/desktop: shorter right cards stretch to match left bottoms */
@media screen and (min-width: 768px) {
  .dashboard-layout .dashboard-paired-row {
    align-items: stretch !important;
  }

  .dashboard-layout .dashboard-paired-row > [class*="col-"] {
    display: flex !important;
    flex-direction: column;
  }

  .dashboard-layout .dashboard-paired-row > [class*="col-"] > .card {
    flex: 1 1 auto;
    height: 100% !important;
    min-height: 100%;
  }

  .dashboard-layout .dashboard-paired-row .dashboard-credit-sales-card > .card-body,
  .dashboard-layout .dashboard-paired-row .branch-sales-body,
  .dashboard-layout .dashboard-paired-row--stock > [class*="col-"]:last-child > .card > .card-body {
    flex: 1 1 auto !important;
    min-height: 0;
  }
}

/* Phone: stacked paired panels stay content-height */
@media screen and (max-width: 767.98px) {
  .dashboard-layout .dashboard-paired-row > [class*="col-"] > .card {
    height: auto !important;
    min-height: 0 !important;
  }

  .dashboard-layout .top-selling-products-card {
    height: auto !important;
    min-height: 0 !important;
  }

  .dashboard-layout .summary-metric-card .card-body {
    min-height: 0;
  }

  .dashboard-layout .summary-metric-card__value {
    font-size: 1rem;
  }
}

/* Sales Summary + Recent Credit Sales: fixed chart height (no vertical expand) */
.dashboard-layout .dashboard-paired-row--chart .dashboard-sales-chart-card,
.dashboard-layout .dashboard-paired-row--chart .dashboard-credit-sales-card {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
}

.dashboard-layout .dashboard-paired-row--chart .dashboard-sales-chart-body {
  flex: 0 0 auto !important;
  height: var(--dash-chart-panel-height) !important;
  min-height: var(--dash-chart-panel-height) !important;
  max-height: var(--dash-chart-panel-height) !important;
  overflow: hidden;
}

.dashboard-layout .dashboard-paired-row--chart .dashboard-credit-sales-card .card-body {
  flex: 0 0 auto !important;
  height: var(--dash-chart-panel-height) !important;
  max-height: var(--dash-chart-panel-height) !important;
  min-height: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dashboard-layout .dashboard-paired-row--chart #chart-profile-visit {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.dashboard-layout .dashboard-paired-row--chart .apexcharts-datalabels text {
  pointer-events: none;
}

/* Branch Sales: 2 visible branches, then vertical scroll */
.dashboard-layout .dashboard-paired-row--sales .branch-sales-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  justify-content: flex-start;
  overflow: visible;
}

.dashboard-layout .dashboard-paired-row--sales .branch-sales-scroll {
  flex: 0 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(
    (var(--dash-branch-card-height) * var(--dash-branch-visible-rows)) +
    (var(--dash-branch-grid-gap) * (var(--dash-branch-visible-rows) - 1))
  );
}

.dashboard-layout .dashboard-paired-row--sales .branch-sales-list {
  display: flex;
  flex-direction: column;
  gap: var(--dash-branch-grid-gap);
}

.dashboard-layout .dashboard-paired-row--sales .branch-sales-item {
  flex: 0 0 auto;
  min-height: var(--dash-branch-card-height);
  margin-bottom: 0;
}

/* Recent Sales: 4 visible rows, then vertical scroll */
.dashboard-layout .dashboard-paired-row--sales .recent-sales-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  justify-content: flex-start;
  overflow: visible;
}

.dashboard-layout .dashboard-paired-row--sales .recent-sales-wrap {
  flex: 0 0 auto;
  max-height: calc(
    var(--dash-sales-thead-height) + (var(--dash-sales-row-height) * var(--dash-sales-visible-rows))
  );
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dashboard-layout .recent-sales-table {
  table-layout: fixed;
  width: 100%;
  margin-bottom: 0;
}

.dashboard-layout .recent-sales-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  vertical-align: middle;
}

.dashboard-layout .recent-sales-table tbody tr {
  height: var(--dash-sales-row-height);
}

.dashboard-layout .recent-sales-table th,
.dashboard-layout .recent-sales-table td {
  vertical-align: middle;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Low Stock: 2 visible items, then vertical scroll */
.dashboard-layout .dashboard-paired-row--stock .low-stock-alerts-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  justify-content: flex-start;
  overflow: visible;
}

.dashboard-layout .dashboard-paired-row--stock .low-stock-alerts-scroll {
  flex: 0 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(
    (var(--dash-stock-card-height) * var(--dash-stock-visible-rows)) + var(--dash-stock-grid-gap)
  );
}

.dashboard-layout .dashboard-low-stock-link {
  cursor: pointer;
}

.dashboard-layout .dashboard-low-stock-link:hover > .border,
.dashboard-layout .dashboard-low-stock-link:focus-visible > .border {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.15);
}

/* Scrollable dashboard panels (Recent Sales, Low Stock) */
.dashboard-layout .dashboard-panel-scroll {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-layout .dashboard-panel-scroll > .card-header {
  flex-shrink: 0;
}

.dashboard-layout .dashboard-panel-scroll > .card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keep equal horizontal inset on dashboard panel bodies */
.dashboard-layout .card > .card-header {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.dashboard-layout .card > .card-header.d-flex > h4 {
  min-width: 0;
  margin-bottom: 0;
}

.dashboard-layout .card > .card-header.d-flex > a.ms-auto,
.dashboard-layout .card > .card-header.d-flex > a.flex-shrink-0 {
  margin-left: auto !important;
  flex-shrink: 0;
}

.dashboard-layout .card > .card-body {
  padding-left: 1.25rem !important;
  padding-right: 1.25rem !important;
}

.dashboard-layout .recent-sales-wrap {
  border-radius: 0.6rem;
}

.dashboard-layout .recent-sales-table th:first-child,
.dashboard-layout .recent-sales-table td:first-child {
  padding-left: 0.75rem;
}

.dashboard-layout .recent-sales-table th:last-child,
.dashboard-layout .recent-sales-table td:last-child {
  padding-right: 0.75rem;
}

/* .dashboard-layout .recent-sales-table {
  table-layout: fixed;
  width: 100%;
  margin-bottom: 0;
}

.dashboard-layout .recent-sales-table thead th {
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.dashboard-layout .recent-sales-table th {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  line-height: 1.25;
  vertical-align: middle;
}

.dashboard-layout .recent-sales-table td {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  line-height: 1.25;
  vertical-align: middle;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
} */

/* .dashboard-layout .recent-sales-table tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--bs-body-bg) 92%, var(--bs-tertiary-bg) 8%);
}

.dashboard-layout .recent-sales-table tbody tr:hover {
  background-color: color-mix(in srgb, var(--bs-body-bg) 85%, var(--bs-primary-bg-subtle) 15%);
}

.dashboard-layout .recent-sales-wrap::-webkit-scrollbar {
  height: 7px;
} */

.dashboard-layout .recent-sales-wrap::-webkit-scrollbar-thumb {
  background: var(--bs-secondary-color);
  border-radius: 999px;
}

.dashboard-layout .recent-sales-table th:nth-child(1),
.dashboard-layout .recent-sales-table td:nth-child(1) {
  width: 36%;
}

.dashboard-layout .recent-sales-table th:nth-child(2),
.dashboard-layout .recent-sales-table td:nth-child(2) {
  width: 16%;
}

.dashboard-layout .recent-sales-table th:nth-child(4),
.dashboard-layout .recent-sales-table td:nth-child(4) {
  width: 18%;
}

.dashboard-layout .recent-sales-table th:nth-child(3),
.dashboard-layout .recent-sales-table td:nth-child(3) {
  width: 8%;
  text-align: center;
}

.dashboard-layout .recent-sales-table th:nth-child(5),
.dashboard-layout .recent-sales-table td:nth-child(5) {
  width: 22%;
  text-align: center;
}

.dashboard-layout .recent-sales-table .badge {
  font-size: 0.7rem;
  white-space: nowrap;
}

@media (max-width: 1399.98px) {
  .dashboard-layout .summary-metrics .card-body {
    padding: 1rem !important;
  }

  .dashboard-layout .summary-metrics .stats-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
    float: none !important;
    margin-left: auto;
    margin-bottom: 0 !important;
    flex-shrink: 0;
  }

  .dashboard-layout.orders-tender-metrics .summary-metrics .stats-icon {
    width: 2rem;
    height: 2rem;
  }

  .dashboard-layout.orders-tender-metrics .summary-metrics .stats-icon i {
    font-size: 1.15rem;
  }

  .dashboard-layout .summary-metrics h5 {
    font-size: 1rem;
  }
}

@media (max-width: 1399.98px) {
  .dashboard-layout .dashboard-main-col,
  .dashboard-layout .dashboard-side-col {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

@media (max-width: 575.98px) {
  .dashboard-layout .summary-metrics .stats-icon {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.9rem;
    float: none !important;
    margin-left: auto;
    margin-bottom: 0 !important;
    flex-shrink: 0;
  }

  .dashboard-layout.orders-tender-metrics .summary-metrics .stats-icon {
    width: 1.75rem;
    height: 1.75rem;
  }

  .dashboard-layout.orders-tender-metrics .summary-metrics .stats-icon i {
    font-size: 0.9rem;
  }

  .dashboard-layout .summary-metrics h6 {
    font-size: 0.75rem;
  }

  /* Keep all shortlist columns reachable on small screens */
  .dashboard-layout .recent-sales-card > .card-body.recent-sales-body {
    overflow-x: auto;
    overflow-y: auto;
  }

  .dashboard-layout .dashboard-paired-row--sales .recent-sales-wrap,
  .dashboard-layout .recent-sales-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-layout .recent-sales-table {
    min-width: 32rem;
    table-layout: auto;
  }

  .dashboard-layout .recent-sales-table th,
  .dashboard-layout .recent-sales-table td {
    font-size: 0.78rem;
    padding: 0.45rem 0.5rem;
    white-space: nowrap;
  }

  .dashboard-layout .recent-sales-table th:nth-child(1),
  .dashboard-layout .recent-sales-table td:nth-child(1),
  .dashboard-layout .recent-sales-table th:nth-child(2),
  .dashboard-layout .recent-sales-table td:nth-child(2),
  .dashboard-layout .recent-sales-table th:nth-child(3),
  .dashboard-layout .recent-sales-table td:nth-child(3),
  .dashboard-layout .recent-sales-table th:nth-child(4),
  .dashboard-layout .recent-sales-table td:nth-child(4),
  .dashboard-layout .recent-sales-table th:nth-child(5),
  .dashboard-layout .recent-sales-table td:nth-child(5) {
    width: auto;
  }
}

@media (max-width: 1599.98px) {
  .dashboard-layout .top-products-item__name {
    max-width: none;
  }
}

@media (max-width: 575.98px) {
  .dashboard-layout .top-products-item__row {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "rank name"
      "qty qty";
    gap: 0.35rem 0.45rem;
  }

  .dashboard-layout .top-products-item__rank {
    grid-area: rank;
  }

  .dashboard-layout .top-products-item__name {
    grid-area: name;
  }

  .dashboard-layout .top-products-item__qty {
    grid-area: qty;
    justify-self: start;
  }

  .dashboard-layout .top-products-item__sales {
    text-align: left;
  }
}

/* Dashboard welcome (no-statistics view) */
.dashboard-welcome-shell {
  position: relative;
  min-height: calc(100vh - 10rem);
}

.dashboard-welcome-card {
  border-radius: 1.35rem;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

.dashboard-welcome-hero {
  background: #7c3aed;
}

.dashboard-welcome-brand-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dashboard-welcome-logo-wrap {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.dashboard-welcome-tile {
  background: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-welcome-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.12);
}

@media (max-width: 991.98px) {
  .dashboard-welcome-hero {
    min-height: 16rem;
  }
}


        #pos_main_row.pos-layout {
            min-height: 0;
        }

        #pos_main_row.pos-layout > [class*="col-"] {
            min-height: 0;
        }

        #pos_main_right_col .product-panel {
            min-height: 0;
            overflow: hidden;
        }

        #pos_main_right_col .product-header {
            flex: 0 0 auto;
        }

        #pos_main_right_col .product-grid-scroll {
            flex: 1 1 auto;
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
        }

        @media (min-width: 1200px) {
            #pos_main_row.pos-layout {
                height: var(--pos-layout-height, auto);
                max-height: var(--pos-layout-height, none);
                align-items: stretch;
            }

            #pos_main_left_col .checkout-panel,
            #pos_main_right_col .product-panel {
                height: 100%;
                min-height: 0;
            }

            #pos_main_left_col .checkout-panel {
                overflow-y: auto;
                overflow-x: hidden;
            }
        }

        @media (max-width: 1199.98px) {
            #pos_main_row.pos-layout {
                height: auto !important;
                max-height: none !important;
            }

            #pos_main_left_col .checkout-panel,
            #pos_main_right_col .product-panel,
            #pos_main_right_col .product-grid-scroll {
                height: auto !important;
                max-height: none !important;
                overflow: visible !important;
            }
        }

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
/* ENHANCED SEARCH STYLES */
/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */
#search-results-dropdown {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.98);
}

#search-suggestions-content::-webkit-scrollbar {
    width: 6px;
}

#search-suggestions-content::-webkit-scrollbar-track {
    background: transparent;
}

#search-suggestions-content::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}

#search-suggestions-content::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

.suggestion-item {
    cursor: pointer;
    border: 1px solid transparent;
}

.suggestion-item.bg-gray-100 {
    border-color: rgba(0, 0, 0, 0.05);
}

@keyframes searchFadeIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-animate-in {
    animation: searchFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Pulse effect for matching category icon */
.suggestion-item:hover .w-8 {
    animation: iconPulse 1.5s infinite;
}

@keyframes iconPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Mobile Search Refinements */
#mobile-search-dropdown {
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .suggestion-item {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .suggestion-item h4 {
        font-size: 0.875rem !important;
    }
}

@media screen and (max-width: 1199.98px) {
    #main {
        padding: 0;
        padding-top: 4rem !important;
        position: relative;
    }

    #main > header {
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0;
        height: 3.75rem !important;
        width: 3rem;
        position: fixed !important;
        top: 0 !important;
        left: 0.5rem !important;
        z-index: 1065 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }

    #main .burger-btn {
        margin: 0;
        height: 2.5rem;
        width: 2.5rem;
        min-height: 2.5rem;
        min-width: 2.5rem;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        line-height: 1;
        color: var(--bs-body-color);
    }

    #main .burger-btn i {
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.75rem;
    }

    #main .page-title,
    #main .page-heading,
    #main .page-content {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
    }

    /* Inline margin-top: 50px is for desktop clearance; tighten on mobile (#main already has topbar padding) */
    #main .page-title,
    #main .page-heading {
        margin-top: 0.5rem !important;
    }

    /* Page header action buttons: wrap cleanly, don't stretch tall */
    #main .page-title .page-title-actions,
    #main .page-title .d-flex.gap-2 {
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start !important;
        row-gap: 0.5rem;
    }

    #main .page-title .page-title-actions > .btn,
    #main .page-title .d-flex.gap-2 > .btn {
        flex: 0 0 auto;
        align-self: center;
        height: 2.5rem;
        min-height: 2.5rem;
        max-height: 2.5rem;
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    #main .page-title .page-title-actions > .btn:not(.page-title-actions__primary),
    #main .page-title .d-flex.gap-2 > .btn.btn-outline-warning:not(.page-title-actions__primary),
    #main .page-title .d-flex.gap-2 > .btn.btn-outline-info:not(.page-title-actions__primary),
    #main .page-title .d-flex.gap-2 > .btn.btn-outline-danger:not(.page-title-actions__primary),
    #main .page-title .d-flex.gap-2 > .btn.btn-outline-primary:not(.page-title-actions__primary) {
        width: 2.5rem;
        min-width: 2.5rem;
        padding-left: 0;
        padding-right: 0;
    }

    #main .page-title .page-title-actions > .page-title-actions__primary {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    @media (min-width: 576px) {
        #main .page-title .page-title-actions > .page-title-actions__primary {
            flex: 1 1 calc(50% - 0.35rem);
            width: auto;
        }
    }

    #main .page-title > .card,
    #main .page-heading > .card,
    #main .page-heading .section > .card,
    #main .page-content > .card,
    #main .page-content .section > .card {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    #main .page-heading .section {
        padding-left: 0;
        padding-right: 0;
    }

    /* Dashboard mobile: full-bleed content, no side padding */
    #main .page-content.dashboard-layout {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #main .page-heading:has(+ .page-content.dashboard-layout) {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #main .page-content.dashboard-layout > .dashboard-grid > .row {
        margin-left: 0;
        margin-right: 0;
        margin-top: 0.35rem !important;
        margin-bottom: 0 !important;
        --bs-gutter-x: 0;
        --bs-gutter-y: 0.4rem;
        row-gap: 0.4rem;
    }

    #main .page-content.dashboard-layout > .dashboard-grid > .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
        padding-top: calc(var(--bs-gutter-y) * 0.5);
        padding-bottom: calc(var(--bs-gutter-y) * 0.5);
    }

    #main .page-content.dashboard-layout .card {
        margin-bottom: 0 !important;
    }

    #main .page-content.dashboard-layout .dashboard-paired-row--stock {
        margin-bottom: 0.5rem !important;
    }

    #main .page-content.dashboard-layout .summary-metrics {
        --bs-gutter-y: 0.35rem;
        row-gap: 0.35rem;
        margin-bottom: 0 !important;
    }

    #main .page-content.dashboard-layout .summary-metrics .card,
    #main .page-content.dashboard-layout .summary-metric-card {
        margin-bottom: 0 !important;
    }

    /* Tighten space under summary metrics before Top Selling Products */
    #main .page-content.dashboard-layout > .dashboard-grid > .row:first-child {
        --bs-gutter-y: 0.35rem;
        row-gap: 0.35rem;
        margin-bottom: 0 !important;
    }

    #main .page-content.dashboard-layout > .dashboard-grid > .row:first-child > [class*="col-"] {
        padding-top: 0.15rem;
        padding-bottom: 0.15rem;
    }

    #main .page-content.dashboard-layout .top-selling-products-card {
        height: auto !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    #main .page-heading:has(+ .page-content.dashboard-layout) {
        margin-bottom: 0.35rem !important;
    }

    #main footer {
        padding: 0.65rem 1rem 1rem;
    }

    #main footer .dashboard-footer,
    #main footer .footer {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        text-align: right;
        gap: 0.15rem;
    }

    #main footer .dashboard-footer__copy,
    #main footer .dashboard-footer__credit,
    #main footer .footer .float-start,
    #main footer .footer .float-end {
        float: none !important;
        width: 100%;
        text-align: right;
    }

    #main footer .footer p,
    #main footer .dashboard-footer p {
        margin-bottom: 0;
    }
}

/* Dashboard footer (desktop keeps split; mobile handled above) */
#main .dashboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

#main .dashboard-footer__copy,
#main .dashboard-footer__credit {
    flex: 0 1 auto;
}

#main .dashboard-footer__credit {
    text-align: right;
    margin-left: auto;
}

/* IMEI Lookup page */
.imei-lookup-page .imei-search-card {
    border: 0;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.06);
}

.imei-lookup-page .imei-search-card .card-body {
    padding: 1.75rem 1.5rem;
}

.imei-lookup-page .imei-search-input {
    font-size: 1.05rem;
    letter-spacing: 0.04em;
}

@media (max-width: 767.98px) {
    .imei-lookup-page .lookup-search-group {
        flex-wrap: wrap;
    }

    .imei-lookup-page .lookup-search-group > .input-group-text {
        flex: 0 0 auto;
    }

    .imei-lookup-page .lookup-search-group > .form-control {
        flex: 1 1 0;
        min-width: 0;
        border-top-right-radius: var(--bs-border-radius-lg) !important;
        border-bottom-right-radius: var(--bs-border-radius-lg) !important;
    }

    .imei-lookup-page .lookup-search-group > .btn {
        flex: 0 0 100%;
        width: 100%;
        margin-top: 0.55rem;
        border-radius: var(--bs-border-radius-lg) !important;
    }
}

.imei-lookup-page .imei-summary-card {
    border: 0;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.06);
    background: linear-gradient(135deg, rgba(var(--bs-primary-rgb), 0.08) 0%, transparent 55%);
}

.imei-lookup-page .imei-display-value {
    font-size: 1.35rem;
    letter-spacing: 0.06em;
    word-break: break-all;
}

.imei-lookup-page .imei-overview-stat {
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: 0.5rem;
    padding: 0.85rem 0.9rem;
}

.imei-lookup-page .imei-overview-stat__value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--bs-body-color);
}

.imei-lookup-page .imei-overview-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.imei-lookup-page .imei-overview-note {
    padding: 0.75rem 0.9rem;
    background: var(--bs-body-bg);
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    min-width: 0;
}

@media (max-width: 575.98px) {
    .imei-lookup-page .imei-overview-notes {
        grid-template-columns: 1fr;
    }
}

.imei-lookup-page .imei-overview-note__icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
}

.imei-lookup-page .imei-result-card {
    border: 0;
    box-shadow: 0 0.125rem 0.5rem rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.imei-lookup-page .imei-result-card .card-header {
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.85rem 1.25rem;
}

.imei-lookup-page .imei-result-card .table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color);
    font-weight: 600;
    white-space: nowrap;
}

.imei-lookup-page .imei-empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--bs-secondary-color);
}

.imei-lookup-page .imei-empty-state i {
    font-size: 2.5rem;
    opacity: 0.35;
    margin-bottom: 0.75rem;
}

.imei-lookup-page .barcode-label-tools {
    max-width: 100%;
}

.imei-lookup-page .barcode-label-preview {
    display: inline-block;
    padding: 0;
    background: #fff;
    border: 1px dashed #ced4da;
    border-radius: 0;
    line-height: 0;
}

.imei-lookup-page .barcode-label-preview__svg {
    display: block;
    width: 40mm;
    height: 30mm;
}

/* Product import / export page */
.pie-import-export-page .pie-page-card .card-header {
    background: #fff;
    padding: 0 1.25rem;
    border-bottom: 1px solid #e9ecef;
}

.pie-import-export-page .pie-nav-tabs {
    border-bottom: none;
    gap: 0;
    flex-wrap: nowrap;
    margin-bottom: 0;
}

.pie-import-export-page .pie-nav-tabs .nav-item {
    margin-bottom: 0;
}

.pie-import-export-page .pie-nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: #6c757d;
    font-weight: 500;
    padding: 0.85rem 1.35rem;
    white-space: nowrap;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pie-import-export-page .pie-nav-tabs .nav-link:hover {
    color: #7c3aed;
    border-bottom-color: rgba(124, 58, 237, 0.35);
    background: transparent;
    isolation: isolate;
}

.pie-import-export-page .pie-nav-tabs .nav-link.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
    background: transparent;
}

.pie-import-export-page .pie-export-table-wrap {
    max-height: 620px;
    overflow: auto;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
}

.pie-import-export-page .pie-export-table {
    margin-bottom: 0;
    font-size: 0.8125rem;
}

.pie-import-export-page .pie-export-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    background: #f8f9fa;
    box-shadow: inset 0 -1px 0 #dee2e6;
    font-size: 0.75rem;
    text-transform: none;
}

.pie-import-export-page .pie-export-table td {
    vertical-align: middle;
}

.pie-import-export-page .pie-export-table .pie-col-imei {
    min-width: 180px;
    max-width: 240px;
    white-space: normal;
    word-break: break-word;
}

.pie-import-export-page .pie-export-table .pie-col-name {
    min-width: 160px;
    white-space: normal;
}

.pie-import-export-page .pie-export-table .pie-col-money,
.pie-import-export-page .pie-export-table .pie-col-qty {
    text-align: right;
    white-space: nowrap;
}

.pie-import-export-page .pie-export-table .pie-type-badge {
    font-size: 0.7rem;
    text-transform: lowercase;
}

/* Sales report preview â€” inventory/reports/sales_report_preview.php */
.report-wrap {
    max-width: 2380px;
    margin: 0 auto;
    padding: 18px;
}

.report-header {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 16px;
    background: #fff;
}

.report-logo {
    max-height: 64px;
    max-width: 140px;
    object-fit: contain;
}

.report-meta td {
    padding: 4px 8px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.kpi-card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    background: #fff;
}

.kpi-card .label {
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.kpi-card .value {
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0;
    white-space: nowrap;
}

[data-bs-theme="light"] .report-wrap #report_table thead th,
[data-bs-theme="light"] .report-wrap .sales-details-repeat-header th,
body:not([data-bs-theme="dark"]) .report-wrap #report_table thead th,
body:not([data-bs-theme="dark"]) .report-wrap .sales-details-repeat-header th {
    background: #7c3aed !important;
    color: #ffffff !important;
    border-color: #3a51a8 !important;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.87rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-bs-theme="light"] .report-wrap #report_table tbody td,
body:not([data-bs-theme="dark"]) .report-wrap #report_table tbody td {
    background: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
    white-space: nowrap;
    font-size: 0.9rem;
    vertical-align: middle;
}

[data-bs-theme="light"] .report-wrap #report_table.table-striped > tbody > tr:nth-of-type(odd):not(.sales-details-repeat-header) > td,
body:not([data-bs-theme="dark"]) .report-wrap #report_table.table-striped > tbody > tr:nth-of-type(odd):not(.sales-details-repeat-header) > td {
    background: #f4f7fb;
}

[data-bs-theme="light"] .report-wrap .items-purchased-table thead th,
body:not([data-bs-theme="dark"]) .report-wrap .items-purchased-table thead th {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #293548;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-bs-theme="light"] .report-wrap .items-purchased-table tbody td,
body:not([data-bs-theme="dark"]) .report-wrap .items-purchased-table tbody td {
    background: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
}

[data-bs-theme="dark"] .report-wrap #report_table thead th,
[data-bs-theme="dark"] .report-wrap .sales-details-repeat-header th {
    background: #7c3aed !important;
    color: #ffffff !important;
    border-color: #3a51a8 !important;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.87rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-bs-theme="dark"] .report-wrap #report_table tbody td {
    background: #1a2035;
    color: #e2e8f0;
    border-color: #2d3748;
    white-space: nowrap;
    font-size: 0.9rem;
    vertical-align: middle;
}

[data-bs-theme="dark"] .report-wrap #report_table.table-striped > tbody > tr:nth-of-type(odd):not(.sales-details-repeat-header) > td {
    background: #222a42;
}

[data-bs-theme="dark"] .report-wrap .items-purchased-table thead th {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-bs-theme="dark"] .report-wrap .items-purchased-table tbody td {
    background: #1a2035;
    color: #e2e8f0;
    border-color: #2d3748;
}

.sales-details-order-group {
    border-top: 2px solid #dee2e6;
}

[data-bs-theme="dark"] .sales-details-order-group {
    border-top-color: #3d4a63;
}

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff !important;
    }

    .report-wrap #report_table thead th,
    .report-wrap .sales-details-repeat-header th,
    .report-wrap .items-purchased-table thead th {
        background: #7c3aed !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-wrap #report_table tbody td,
    .report-wrap .items-purchased-table tbody td {
        background: #ffffff !important;
        color: #1e293b !important;
    }

    .report-wrap {
        max-width: 100%;
        padding: 0;
    }

    .report-wrap .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }

    .report-wrap .table {
        page-break-inside: auto;
    }

    .report-wrap tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    .sales-details-order-group {
        page-break-inside: avoid;
    }
}

/* Sales return items table */
.sales-return-table-card {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.sales-return-table-wrap.table-responsive {
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.sales-return-items-table.table {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
    margin-bottom: 0;
}

.sales-return-items-table thead {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.sales-return-items-table .sales-return-head-row th {
    background: #f8f9fb;
    color: #5c6678;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.65rem 0.75rem;
    border-bottom: none;
    white-space: nowrap;
    line-height: 1.25;
    overflow: visible;
    text-overflow: clip;
}

.sales-return-th-short {
    display: none;
}

.sales-return-items-table .col-product {
    min-width: 14rem;
}

.sales-return-items-table .col-imei {
    min-width: 17rem;
}

.sales-return-items-table .col-barcode {
    min-width: 15rem;
}

.sales-return-items-table .col-qty-purchased,
.sales-return-items-table .col-qty-already,
.sales-return-items-table .col-qty-returnable {
    min-width: 6.75rem;
}

.sales-return-items-table .col-qty-returned {
    min-width: 7.25rem;
}

.sales-return-items-table .col-price,
.sales-return-items-table .col-discount,
.sales-return-items-table .col-overall,
.sales-return-items-table .col-final-unit,
.sales-return-items-table .col-line-total {
    min-width: 7.5rem;
    white-space: nowrap;
}

.sales-return-items-table tbody tr.sales-return-item-row {
    transition: background-color 0.15s ease;
}

.sales-return-items-table tbody tr.sales-return-item-row:hover {
    background-color: #f8fafc;
}

.sales-return-items-table th,
.sales-return-items-table td {
    white-space: nowrap;
}

.sales-return-items-table td.col-imei,
.sales-return-items-table td.col-barcode,
.sales-return-items-table td.col-product {
    white-space: normal;
}

.sales-return-items-table td {
    padding: 0.85rem 0.75rem;
    border-top: 1px solid #eef1f5;
    vertical-align: top;
    overflow: visible;
}

.sales-return-items-table th {
    vertical-align: middle;
}

.sales-return-product-cell {
    min-width: 0;
}

.sales-return-product-sku {
    display: inline-block;
    margin-bottom: 0.2rem;
    padding: 0.1rem 0.45rem;
    border-radius: 0.25rem;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.sales-return-product-name {
    max-width: 100%;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sales-return-product-variation {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #6b7280;
    white-space: normal;
    word-break: break-word;
}

.sales-return-unit-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    position: relative;
}

.sales-return-unit-meta {
    margin: 0;
    font-size: 0.6875rem;
    line-height: 1.3;
    color: #8b95a5;
}

.sales-return-unit-count {
    font-variant-numeric: tabular-nums;
}

.sales-return-unit-value {
    display: inline-block;
    font-size: 0.8125rem;
    color: #374151;
    word-break: break-all;
    white-space: normal;
}

.sales-return-empty-value {
    color: #c5cad3;
    font-size: 0.875rem;
}

.sales-return-qty-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sales-return-qty-badge--muted {
    background: #f8fafc;
    color: #94a3b8;
}

.sales-return-qty-meta {
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    line-height: 1.2;
}

.sales-return-qty-input-wrap {
    display: flex;
    justify-content: center;
}

.sales-return-items-table .qty-returned {
    width: 4.75rem;
    min-width: 4.75rem;
    max-width: 4.75rem;
    margin: 0 auto;
    font-variant-numeric: tabular-nums;
}

.sales-return-money {
    display: inline-block;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    color: #374151;
    white-space: nowrap;
}

.sales-return-line-total {
    font-weight: 600;
    color: #111827;
}

.sales-return-items-table .col-imei .select2-container,
.sales-return-items-table .col-barcode .select2-container {
    width: 100% !important;
    max-width: 100%;
    min-width: 16.5rem;
    display: block;
    overflow: visible !important;
}

.sales-return-items-table .col-imei .select2-container .selection,
.sales-return-items-table .col-barcode .select2-container .selection {
    display: block;
    width: 100%;
    overflow: visible !important;
}

.sales-return-items-table .col-imei .select2-selection--multiple,
.sales-return-items-table .col-barcode .select2-selection--multiple {
    display: block;
    min-height: 2.35rem;
    height: auto !important;
    max-height: none !important;
    padding: 0.25rem 0.4rem !important;
    border-color: #d7dde5;
    border-radius: 0.375rem;
    overflow: visible !important;
}

/* IMEI + barcode chips: two per row (overrides Select2 bootstrap flex sizing). */
.sales-return-items-table .col-imei .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered,
.sales-return-items-table .col-barcode .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered,
.sales-return-items-table .col-imei .select2-selection--multiple .select2-selection__rendered,
.sales-return-items-table .col-barcode .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 0.35rem !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.sales-return-items-table .col-imei .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice,
.sales-return-items-table .col-barcode .select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice,
.sales-return-items-table .col-imei .select2-selection__choice,
.sales-return-items-table .col-barcode .select2-selection__choice {
    float: none !important;
    display: inline-flex !important;
    flex: 0 0 calc(50% - 0.175rem) !important;
    align-items: center !important;
    width: calc(50% - 0.175rem) !important;
    max-width: calc(50% - 0.175rem) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0.2rem 0.4rem !important;
    gap: 0.25rem !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: visible !important;
}

/* Single selection uses the full width. */
.sales-return-items-table .col-imei .select2-selection__choice:first-child:nth-last-child(2),
.sales-return-items-table .col-barcode .select2-selection__choice:first-child:nth-last-child(2) {
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

.sales-return-items-table .col-imei .select2-selection__choice__remove,
.sales-return-items-table .col-barcode .select2-selection__choice__remove {
    flex: 0 0 auto !important;
    position: static !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.sales-return-items-table .col-imei .select2-selection__choice__display,
.sales-return-items-table .col-barcode .select2-selection__choice__display {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    word-break: normal !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
    font-size: 0.6875rem !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.sales-return-items-table .col-imei .select2-search--inline,
.sales-return-items-table .col-barcode .select2-search--inline {
    float: none !important;
    display: block !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.sales-return-items-table .col-imei .select2-search--inline .select2-search__field,
.sales-return-items-table .col-barcode .select2-search--inline .select2-search__field {
    width: 100% !important;
    margin: 0 !important;
    min-height: 1.5rem;
}

.sales-return-empty-row td {
    padding: 0 !important;
    border-top: none !important;
}

.sales-return-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    color: #8b95a5;
    text-align: center;
}

.sales-return-empty-state i {
    font-size: 1.75rem;
    color: #c5cad3;
}

.sales-return-empty-state p {
    font-size: 0.875rem;
}

.sales-return-qty-readonly,
.sales-return-price-readonly,
.sales-return-discount-readonly {
    display: inline-block;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.sales-return-main-row {
    cursor: pointer;
}

.sales-return-audit-panel {
    background: #f8fafc;
}

.sales-return-audit-table {
    font-variant-numeric: tabular-nums;
}

html[data-bs-theme="dark"] .sales-return-audit-panel {
    background: rgba(255, 255, 255, 0.03);
}

.sales-return-start-grid {
    margin-bottom: 0.25rem;
}

.sales-return-idle-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding: 2.5rem 1.25rem;
    border: 1px dashed #d7deea;
    border-radius: 0.85rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    text-align: center;
    color: #64748b;
}

.sales-return-idle-hint i {
    font-size: 2rem;
    color: #94a3b8;
}

.sales-return-idle-hint h6 {
    margin: 0.35rem 0 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.sales-return-idle-hint p {
    max-width: 28rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.sales-return-identity {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1.15rem 0 1.1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #e5e9f0;
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sales-return-identity__item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sales-return-identity__label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.sales-return-identity__value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sales-return-status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    background: #f1f5f9;
    color: #475569;
}

.sales-return-status-badge.is-paid {
    background: #dcfce7;
    color: #166534;
}

.sales-return-status-badge.is-partial {
    background: #fef3c7;
    color: #92400e;
}

.sales-return-status-badge.is-unpaid {
    background: #fee2e2;
    color: #991b1b;
}

.sales-return-panel {
    height: 100%;
    overflow: hidden;
    border: 1px solid #e5e9f0;
    border-radius: 0.9rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.sales-return-panel--order {
    border-top: 3px solid #0A0A0A;
}

.sales-return-panel--return {
    border-top: 3px solid #CC0000;
}

.sales-return-panel__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1.05rem 0.85rem;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.sales-return-panel__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.65rem;
    background: rgba(204, 0, 0, 0.08);
    color: #CC0000;
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.sales-return-panel--order .sales-return-panel__icon {
    background: rgba(10, 10, 10, 0.06);
    color: #0A0A0A;
}

.sales-return-panel__heading {
    min-width: 0;
    flex: 1 1 auto;
}

.sales-return-panel__eyebrow {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.sales-return-panel__title {
    margin: 0.1rem 0 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.sales-return-panel__count {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.sales-return-panel__metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.95rem 1.05rem;
}

.sales-return-panel__metrics--highlight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #f8fafc;
}

.sales-return-metric {
    min-width: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid #eef2f7;
    border-radius: 0.7rem;
    background: #fff;
}

.sales-return-metric--primary {
    border-color: rgba(204, 0, 0, 0.22);
    background: rgba(204, 0, 0, 0.06);
}

.sales-return-metric--success {
    border-color: rgba(25, 135, 84, 0.22);
    background: rgba(25, 135, 84, 0.08);
}

.sales-return-metric__label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
}

.sales-return-metric__value {
    display: block;
    font-size: 1.02rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
    line-height: 1.25;
    word-break: break-word;
}

.sales-return-metric__value.is-active {
    color: #CC0000;
}

.sales-return-metric__value.is-success {
    color: #198754;
}

.sales-return-panel__list {
    padding: 0.15rem 1.05rem 0.95rem;
}

#orderDetailsModal .sales-return-identity {
    margin-top: 0;
}

#orderDetailsModal .sales-return-panel__list p:last-child {
    margin-bottom: 0;
}

#orderDetailsModal .sales-return-audit-table {
    margin-bottom: 0;
}

#orderDetailsModal .sales-return-audit-table th,
#orderDetailsModal .sales-return-audit-table td {
    padding: 0.45rem 0.6rem;
    vertical-align: top;
}

#orderPaymentHistoryModal .sales-return-panel__list,
#swapPaymentHistoryModal .sales-return-panel__list,
#swapOrderPaymentHistoryModal .sales-return-panel__list {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
}

#orderPaymentHistoryModal .order-payment-history-table th,
#orderPaymentHistoryModal .order-payment-history-table td,
#swapPaymentHistoryModal .order-payment-history-table th,
#swapPaymentHistoryModal .order-payment-history-table td,
#swapOrderPaymentHistoryModal .order-payment-history-table th,
#swapOrderPaymentHistoryModal .order-payment-history-table td {
    padding: 0.55rem 0.9rem;
    vertical-align: middle;
}

.sales-return-summary-card .card-body {
    padding: 0.85rem 1rem;
}

.sales-return-summary-heading {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.65rem;
}

.sales-return-summary-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.sales-return-summary-line + .sales-return-summary-line {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.sales-return-summary-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.35;
}

.sales-return-summary-value {
    flex: 0 0 auto;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: right;
    color: #0f172a;
}

.no-sidebar-page .page-title .page-title-actions {
    flex-wrap: wrap;
}

/* Narrow / tablet: card rows so IMEI/barcode chips never collide */
@media screen and (max-width: 1199.98px) {
    .no-sidebar-page .page-title .page-title-actions {
        width: 100%;
    }

    .no-sidebar-page .page-title .page-title-actions > .btn {
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
        white-space: nowrap;
    }

    .sales-return-table-wrap.table-responsive {
        overflow: visible;
    }

    .sales-return-table-card {
        border: none;
        border-radius: 0;
        overflow: visible;
        background: transparent;
        box-shadow: none;
    }

    .sales-return-items-table,
    .sales-return-items-table.table {
        table-layout: auto;
        width: 100%;
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
    }

    .sales-return-items-table .col-product,
    .sales-return-items-table .col-imei,
    .sales-return-items-table .col-barcode,
    .sales-return-items-table .col-qty-purchased,
    .sales-return-items-table .col-qty-already,
    .sales-return-items-table .col-qty-returnable,
    .sales-return-items-table .col-qty-returned,
    .sales-return-items-table .col-price,
    .sales-return-items-table .col-discount,
    .sales-return-items-table .col-overall,
    .sales-return-items-table .col-final-unit,
    .sales-return-items-table .col-line-total {
        min-width: 0;
        max-width: none;
    }

    .sales-return-items-table thead {
        display: none;
    }

    .sales-return-items-table tbody {
        display: block;
        width: 100%;
    }

    .sales-return-items-table tbody tr.sales-return-item-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem 0.85rem;
        width: 100%;
        margin: 0 0 0.9rem;
        padding: 0;
        border: 1px solid #e5e9f0;
        border-radius: 0.75rem;
        background: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
        overflow: visible;
    }

    .sales-return-items-table tbody tr.sales-return-item-row:hover {
        background: #fff;
    }

    .sales-return-items-table tbody tr.sales-return-empty-row {
        display: block;
        border: 1px solid #e5e9f0;
        border-radius: 0.75rem;
        background: #fff;
        overflow: hidden;
    }

    .sales-return-items-table tbody tr.sales-return-empty-row td {
        display: block;
        width: 100% !important;
        border: none;
        padding: 0;
    }

    .sales-return-items-table td {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.35rem;
        width: auto !important;
        max-width: none !important;
        min-width: 0;
        margin: 0;
        padding: 0 1rem;
        border: none !important;
        text-align: left !important;
        overflow: visible;
        white-space: normal;
    }

    .sales-return-items-table td::before {
        content: attr(data-label);
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: #94a3b8;
        line-height: 1.2;
        padding: 0;
    }

    .sales-return-items-table td.col-product {
        grid-column: 1 / -1;
        gap: 0.25rem;
        padding: 0.95rem 1rem 0.85rem;
        background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
        border-bottom: 1px solid #eef2f7 !important;
    }

    .sales-return-items-table td.col-product::before {
        display: none;
    }

    .sales-return-items-table td.col-imei,
    .sales-return-items-table td.col-barcode {
        grid-column: 1 / -1;
        position: relative;
        z-index: 1;
    }

    .sales-return-items-table td.col-imei:has(.sales-return-empty-value) {
        display: none;
    }

    .sales-return-items-table td.col-qty-purchased,
    .sales-return-items-table td.col-qty-returned {
        padding-top: 0.15rem;
    }

    .sales-return-items-table td.col-price,
    .sales-return-items-table td.col-discount,
    .sales-return-items-table td.col-line-total {
        padding-top: 0.7rem;
        padding-bottom: 0.95rem;
        margin-top: 0.1rem;
        background: #f8fafc;
        border-top: 1px solid #eef2f7 !important;
    }

    .sales-return-items-table td.col-price {
        padding-right: 0.5rem;
    }

    .sales-return-items-table td.col-discount {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .sales-return-items-table td.col-line-total {
        padding-left: 0.5rem;
    }

    .sales-return-product-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.35;
        color: #0f172a;
    }

    .sales-return-product-variation {
        white-space: normal;
        word-break: break-word;
        font-size: 0.75rem;
        line-height: 1.4;
        color: #64748b;
    }

    .sales-return-unit-field,
    .sales-return-qty-input-wrap,
    .sales-return-items-table .col-imei .select2-container,
    .sales-return-items-table .col-barcode .select2-container {
        width: 100% !important;
        max-width: 100%;
    }

    .sales-return-unit-meta {
        font-size: 0.6875rem;
    }

    .sales-return-items-table .col-imei .select2-selection--multiple,
    .sales-return-items-table .col-barcode .select2-selection--multiple {
        min-height: 2.5rem;
        padding: 0.3rem 0.45rem !important;
    }

    .sales-return-items-table .col-imei .select2-selection__choice,
    .sales-return-items-table .col-barcode .select2-selection__choice {
        font-size: 0.78rem;
    }

    .sales-return-unit-value {
        font-size: 0.8125rem;
        word-break: break-all;
    }

    .sales-return-empty-value {
        font-size: 0.8rem;
        color: #cbd5e1;
    }

    .sales-return-qty-input-wrap {
        justify-content: flex-start;
    }

    .sales-return-items-table .qty-returned {
        width: 100%;
        min-width: 0;
        max-width: none;
        height: 2.4rem;
        font-size: 1rem;
        font-weight: 600;
    }

    .sales-return-qty-badge {
        min-width: 2.4rem;
        height: 2.4rem;
        padding: 0 0.6rem;
        border-radius: 0.45rem;
        font-size: 0.95rem;
        align-self: flex-start;
    }

    .sales-return-money {
        font-size: 0.9375rem;
        font-weight: 600;
        color: #1e293b;
        white-space: nowrap;
    }

    .sales-return-line-total {
        font-size: 1rem;
        color: #0f172a;
    }

    .sales-return-summary-row > [class*="col-"] {
        margin-left: 0 !important;
        flex: 0 0 100%;
        max-width: 100%;
    }

    .sales-return-identity {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sales-return-panel__metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sales-return-panel__metrics--highlight {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sales-return-summary-card .card-body {
        padding: 0.95rem 1rem;
    }

    .sales-return-summary-label {
        font-size: 0.8125rem;
    }

    .sales-return-summary-value {
        font-size: 1rem;
    }

    .sales-return-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .sales-return-form-actions > .btn {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 575.98px) {
    .no-sidebar-page .page-title .page-title-actions > .btn {
        flex: 1 1 100%;
    }

    .sales-return-items-table tbody tr.sales-return-item-row {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .sales-return-items-table td.col-price,
    .sales-return-items-table td.col-discount,
    .sales-return-items-table td.col-line-total {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .sales-return-items-table td.col-qty-purchased,
    .sales-return-items-table td.col-qty-returned,
    .sales-return-items-table td.col-price,
    .sales-return-items-table td.col-discount,
    .sales-return-items-table td.col-line-total {
        grid-column: 1 / -1;
    }

    .sales-return-meta-grid .form-label {
        margin-bottom: 0.3rem;
        font-size: 0.8125rem;
    }

    .sales-return-identity {
        grid-template-columns: 1fr;
        padding: 0.85rem 0.9rem;
    }

    .sales-return-panel__head {
        flex-wrap: wrap;
    }

    .sales-return-panel__metrics,
    .sales-return-panel__metrics--highlight {
        grid-template-columns: 1fr;
    }
}

html[data-bs-theme="dark"] .sales-return-idle-hint {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    border-color: var(--bs-border-color);
    color: #94a3b8;
}

html[data-bs-theme="dark"] .sales-return-idle-hint h6,
html[data-bs-theme="dark"] .sales-return-identity__value,
html[data-bs-theme="dark"] .sales-return-panel__title,
html[data-bs-theme="dark"] .sales-return-metric__value {
    color: #f1f5f9;
}

html[data-bs-theme="dark"] .sales-return-identity,
html[data-bs-theme="dark"] .sales-return-panel,
html[data-bs-theme="dark"] .sales-return-metric {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .sales-return-panel__head,
html[data-bs-theme="dark"] .sales-return-panel__metrics--highlight {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] .sales-return-panel--order .sales-return-panel__icon {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

html[data-bs-theme="dark"] .sales-return-panel--return .sales-return-panel__icon {
    background: rgba(204, 0, 0, 0.18);
    color: #FF1A1A;
}

html[data-bs-theme="dark"] .sales-return-metric--primary {
    border-color: rgba(204, 0, 0, 0.35);
    background: rgba(204, 0, 0, 0.12);
}

html[data-bs-theme="dark"] .sales-return-metric--success {
    border-color: rgba(25, 135, 84, 0.4);
    background: rgba(25, 135, 84, 0.14);
}

html[data-bs-theme="dark"] .sales-return-metric__value.is-active {
    color: #FF1A1A;
}

html[data-bs-theme="dark"] .sales-return-metric__value.is-success {
    color: #75b798;
}

html[data-bs-theme="dark"] .sales-return-status-badge.is-paid {
    background: rgba(22, 163, 74, 0.18);
    color: #86efac;
}

html[data-bs-theme="dark"] .sales-return-status-badge.is-partial {
    background: rgba(217, 119, 6, 0.2);
    color: #fcd34d;
}

html[data-bs-theme="dark"] .sales-return-status-badge.is-unpaid {
    background: rgba(220, 38, 38, 0.18);
    color: #fca5a5;
}

html[data-bs-theme="dark"] .sales-return-table-card {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] .sales-return-items-table .sales-return-head-row th {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
}

html[data-bs-theme="dark"] .sales-return-items-table td {
    border-top-color: rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] .sales-return-product-name,
html[data-bs-theme="dark"] .sales-return-line-total,
html[data-bs-theme="dark"] .sales-return-summary-value {
    color: #f1f5f9;
}

html[data-bs-theme="dark"] .sales-return-product-variation,
html[data-bs-theme="dark"] .sales-return-summary-label {
    color: #94a3b8;
}

html[data-bs-theme="dark"] .sales-return-summary-line + .sales-return-summary-line {
    border-top-color: rgba(255, 255, 255, 0.08);
}

@media screen and (max-width: 1199.98px) {
    html[data-bs-theme="dark"] .sales-return-items-table tbody tr.sales-return-item-row,
    html[data-bs-theme="dark"] .sales-return-items-table tbody tr.sales-return-empty-row {
        background: var(--bs-body-bg);
        border-color: var(--bs-border-color);
    }

    html[data-bs-theme="dark"] .sales-return-items-table td.col-product,
    html[data-bs-theme="dark"] .sales-return-items-table td.col-price,
    html[data-bs-theme="dark"] .sales-return-items-table td.col-discount,
    html[data-bs-theme="dark"] .sales-return-items-table td.col-line-total {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.06) !important;
    }
}

/* Credit sales page */
.credit-sales-summary__card {
    height: 100%;
}

.credit-sales-summary__card .card-body {
    padding: 1rem 1.15rem;
}

.credit-sales-summary__value {
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    word-break: break-word;
}

@media screen and (max-width: 767.98px) {
    .credit-sales-page .credit-sales-summary {
        --bs-gutter-x: 0.65rem;
        --bs-gutter-y: 0.65rem;
        margin-bottom: 0.85rem !important;
    }

    .credit-sales-page .credit-sales-summary__card .card-body {
        padding: 0.7rem 0.8rem;
        min-height: 0;
    }

    .credit-sales-page .credit-sales-summary__card h6 {
        margin-bottom: 0.2rem !important;
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        color: #64748b;
        line-height: 1.25;
    }

    .credit-sales-page .credit-sales-summary__value {
        font-size: 1.05rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .credit-sales-page .credit-sales-summary > .col-12 .credit-sales-summary__value {
        font-size: 1.15rem;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .credit-sales-page > .section > .card > .card-header {
        padding: 0.75rem 0.9rem;
    }

    .credit-sales-page > .section > .card > .card-header h5 {
        font-size: 0.95rem;
    }
}

/* Complete Purchase modal: scroll long item lists inside the body */
#purchaseCompleteModal .modal-dialog {
    max-height: calc(100vh - 2rem);
}

#purchaseCompleteModal .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

#purchaseCompleteModal .modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    max-height: min(65vh, calc(100vh - 12rem));
}

/* Global page loader (admin_header.php) */
#rcm_page_loader {
    --rcm-loader-ink: #0b1f33;
    --rcm-loader-muted: #5b6b7c;
    --rcm-loader-accent: #7c3aed;
    --rcm-loader-surface: #ffffff;
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background:
        radial-gradient(ellipse 80% 55% at 50% 42%, rgba(13, 110, 253, 0.10), transparent 62%),
        rgba(8, 18, 32, 0.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

#rcm_page_loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#rcm_page_loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#rcm_page_loader .rcm-page-loader-card {
    width: min(100%, 18.5rem);
    background: var(--rcm-loader-surface);
    border: 1px solid rgba(11, 31, 51, 0.08);
    border-radius: 1rem;
    padding: 1.5rem 1.35rem 1.35rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 18px 48px rgba(8, 18, 32, 0.28);
    text-align: center;
    animation: rcm-page-loader-enter 0.28s ease-out;
}

#rcm_page_loader .rcm-page-loader-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 1.15rem;
}

#rcm_page_loader .rcm-page-loader-logo {
    width: 2.35rem;
    height: 2.35rem;
    object-fit: contain;
    flex: 0 0 auto;
}

#rcm_page_loader .rcm-page-loader-brand-text {
    text-align: left;
    line-height: 1.15;
}

#rcm_page_loader .rcm-page-loader-brand-name {
    display: block;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--rcm-loader-ink);
}

#rcm_page_loader .rcm-page-loader-brand-tag {
    display: block;
    margin-top: 0.12rem;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rcm-loader-muted);
}

#rcm_page_loader .rcm-page-loader-ring {
    position: relative;
    width: 3.1rem;
    height: 3.1rem;
    margin: 0 auto;
}

#rcm_page_loader .rcm-page-loader-ring::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(13, 110, 253, 0.12);
}

#rcm_page_loader .rcm-page-loader-spinner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--rcm-loader-accent);
    border-right-color: rgba(13, 110, 253, 0.35);
    animation: rcm-page-loader-spin 0.85s cubic-bezier(0.5, 0.15, 0.5, 0.85) infinite;
}

#rcm_page_loader .rcm-page-loader-core {
    position: absolute;
    inset: 0.72rem;
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(13, 110, 253, 0.12), rgba(13, 110, 253, 0.03));
}

#rcm_page_loader .rcm-page-loader-title {
    margin-top: 1rem;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-weight: 650;
    font-size: 0.98rem;
    color: var(--rcm-loader-ink);
    letter-spacing: 0.01em;
}

#rcm_page_loader .rcm-page-loader-subtitle {
    margin-top: 0.28rem;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.78rem;
    color: var(--rcm-loader-muted);
}

#rcm_page_loader .rcm-page-loader-track {
    margin: 1rem auto 0;
    width: 70%;
    height: 3px;
    border-radius: 99px;
    background: rgba(13, 110, 253, 0.1);
    overflow: hidden;
}

#rcm_page_loader .rcm-page-loader-track > span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.2), var(--rcm-loader-accent), rgba(13, 110, 253, 0.2));
    animation: rcm-page-loader-slide 1.15s ease-in-out infinite;
}

@keyframes rcm-page-loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes rcm-page-loader-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

@keyframes rcm-page-loader-enter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    #rcm_page_loader .rcm-page-loader-spinner,
    #rcm_page_loader .rcm-page-loader-track > span,
    #rcm_page_loader .rcm-page-loader-card {
        animation: none;
    }

    #rcm_page_loader .rcm-page-loader-track > span {
        width: 100%;
        transform: none;
    }
}

/* â”€â”€ Phone Swap (design preview) â”€â”€ */
.phone-swap-page .phone-swap-preview-badge {
    font-weight: 600;
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
}

.phone-swap-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.phone-swap-step {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
    background: var(--bs-body-bg);
    cursor: pointer;
    min-width: 0;
}

.phone-swap-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--bs-secondary-bg, #e9ecef);
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.phone-swap-step-label {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-swap-step.is-active {
    border-color: #7c3aed;
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.2);
}

.phone-swap-step.is-active .phone-swap-step-index,
.phone-swap-step.is-done .phone-swap-step-index {
    background: #7c3aed;
    color: #fff;
}

.phone-swap-step.is-done {
    border-color: rgba(124, 58, 237, 0.35);
}

.phone-swap-page .select2-container {
    width: 100% !important;
}

.phone-swap-page .select2-container .select2-selection--single {
    min-height: 38px;
}

.phone-swap-page .pos-select-product-box .select2-container .select2-selection--single {
    min-height: 36px;
}

.phone-swap-score-badge {
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
}

.phone-swap-condition-block {
    border-top: 1px solid var(--bs-border-color);
}

.phone-swap-deduct-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16.75rem, 1fr));
    gap: 1.1rem 1.25rem;
}

.phone-swap-deduct-group {
    padding: 0.9rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.04));
    min-width: 0;
}

.phone-swap-deduct-group h6 {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.7rem;
}

.phone-swap-deduct-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    min-width: 0;
}

.phone-swap-deduct-row:last-child {
    margin-bottom: 0;
}

.phone-swap-deduct-row label {
    font-size: 0.8rem;
    margin-bottom: 0;
    line-height: 1.25;
    flex: 1 1 auto;
    min-width: 0;
}

.phone-swap-deduct-row .input-group {
    width: 6.5rem;
    flex: 0 0 6.5rem;
    isolation: isolate;
}

.phone-swap-deduct-row .form-control {
    min-height: 2rem;
    min-width: 0;
    text-align: right;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    appearance: textfield;
    -moz-appearance: textfield;
}

.phone-swap-deduct-row .form-control::-webkit-outer-spin-button,
.phone-swap-deduct-row .form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.phone-swap-adjust {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
    background: var(--bs-body-bg);
    overflow: hidden;
}

.phone-swap-adjust-head {
    padding: 0.6rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.04));
    border-bottom: 1px solid var(--bs-border-color);
}

.phone-swap-adjust-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
}

.phone-swap-adjust-row + .phone-swap-adjust-row {
    border-top: 1px solid var(--bs-border-color);
}

.phone-swap-adjust-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    border-radius: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.phone-swap-adjust-icon.is-discount {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.phone-swap-adjust-icon.is-credit {
    background: rgba(25, 135, 84, 0.12);
    color: #198754;
}

.phone-swap-adjust-icon.is-deposit {
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
}

.phone-swap-adjust-body {
    flex: 1 1 auto;
    min-width: 0;
}

.phone-swap-adjust-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    cursor: default;
}

label.phone-swap-adjust-title {
    cursor: pointer;
}

.phone-swap-adjust-meta {
    font-size: 0.76rem;
    color: var(--bs-secondary-color, #6c757d);
}

.phone-swap-adjust-meta .phone-swap-adjust-link {
    font-size: inherit;
    line-height: inherit;
    vertical-align: baseline;
}

.phone-swap-adjust-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 0 0 auto;
}

.phone-swap-adjust-amount {
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.phone-swap-pay-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--bs-border-color);
    border-radius: 0.65rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.phone-swap-pay-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.8rem 1rem;
}

.phone-swap-pay-stat + .phone-swap-pay-stat {
    border-left: 1px solid var(--bs-border-color);
}

.phone-swap-pay-stat.is-balance {
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.04));
}

.phone-swap-pay-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
}

.phone-swap-pay-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-swap-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 0.85rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(25, 135, 84, 0.35);
    border-radius: 0.65rem;
    background: rgba(25, 135, 84, 0.06);
}

.phone-swap-callout-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
}

.phone-swap-callout-controls .form-select {
    width: auto;
    min-width: 12rem;
}

.phone-swap-adjust .form-switch .form-check-input {
    width: 2.4em;
    height: 1.3em;
    margin-top: 0;
    cursor: pointer;
}

html[data-bs-theme="dark"] .phone-swap-deduct-group {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.16);
}

html[data-bs-theme="dark"] .phone-swap-adjust-head {
    background: rgba(255, 255, 255, 0.04);
}

html[data-bs-theme="dark"] .phone-swap-deduct-group h6 {
    color: rgba(255, 255, 255, 0.62);
}

html[data-bs-theme="dark"] .phone-swap-deduct-row label {
    color: rgba(255, 255, 255, 0.88);
}

html[data-bs-theme="dark"] .phone-swap-deduct-row .form-control {
    background-color: #1b1d26;
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
    box-shadow: none;
}

html[data-bs-theme="dark"] .phone-swap-deduct-row .form-control:focus {
    background-color: #16181f;
    border-color: #6d88e8;
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.28);
}

html[data-bs-theme="dark"] .phone-swap-deduct-row .input-group-text {
    background-color: #2a334f;
    border-color: rgba(255, 255, 255, 0.22);
    color: #e8ecff;
}

/* Condition configuration — "Configured models" table */
.pscc-row { cursor: pointer; }
.pscc-row td { padding-top: 0.9rem; padding-bottom: 0.9rem; }
.pscc-row td:first-child { font-weight: 600; color: #212529; }
.pscc-row:hover { background-color: #f8f9fc; }
.pscc-chevron { transition: transform 0.15s ease; color: #adb5bd; }
.pscc-row[aria-expanded="true"] .pscc-chevron { transform: rotate(90deg); color: #6a5fdb; }
.pscc-row[aria-expanded="true"] { background-color: #f8f9fc; }

#pscc_table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 700;
    border-bottom-width: 2px;
}

.pscc-detail-wrap {
    background: #f8f9fb;
    border: 1px solid #edeff2;
    border-radius: 0.6rem;
    overflow: hidden;
}
.pscc-detail-table { margin-bottom: 0; }
.pscc-detail-table th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color, #6c757d);
    font-weight: 700;
    background-color: #eef1f6;
    border-bottom: 1px solid #e3e6ec;
}
.pscc-detail-table td, .pscc-detail-table th { padding: 0.65rem 1.15rem; }
.pscc-detail-table td { border-color: #eceef2; font-variant-numeric: tabular-nums; }
.pscc-detail-table td:first-child { font-weight: 500; color: #343a40; }
.pscc-detail-table tbody tr:hover { background-color: #f1f0fd; }
.pscc-amt {
    display: inline-block;
    min-width: 5.5rem;
    padding: 0.2rem 0.6rem;
    border-radius: 0.4rem;
    font-weight: 600;
    font-size: 0.82rem;
}
.pscc-amt-neat { background-color: rgba(40, 167, 69, 0.12); color: #1e7e34; }
.pscc-amt-good { background-color: rgba(255, 171, 0, 0.14); color: #a06a00; }
.pscc-amt-poor { background-color: rgba(220, 53, 69, 0.12); color: #c0293b; }

html[data-bs-theme="dark"] .pscc-row td:first-child { color: rgba(255, 255, 255, 0.92); }
html[data-bs-theme="dark"] .pscc-row:hover,
html[data-bs-theme="dark"] .pscc-row[aria-expanded="true"] { background-color: rgba(255, 255, 255, 0.04); }
html[data-bs-theme="dark"] .pscc-chevron { color: rgba(255, 255, 255, 0.35); }
html[data-bs-theme="dark"] .pscc-row[aria-expanded="true"] .pscc-chevron { color: #8b80ff; }
html[data-bs-theme="dark"] .pscc-detail-wrap {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.14);
}
html[data-bs-theme="dark"] .pscc-detail-table th {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
}
html[data-bs-theme="dark"] .pscc-detail-table td { border-color: rgba(255, 255, 255, 0.1); }
html[data-bs-theme="dark"] .pscc-detail-table td:first-child { color: rgba(255, 255, 255, 0.88); }
html[data-bs-theme="dark"] .pscc-detail-table tbody tr:hover { background-color: rgba(109, 136, 232, 0.16); }
html[data-bs-theme="dark"] .pscc-amt-neat { background-color: rgba(40, 167, 69, 0.22); color: #4ade80; }
html[data-bs-theme="dark"] .pscc-amt-good { background-color: rgba(255, 171, 0, 0.22); color: #fbbf24; }
html[data-bs-theme="dark"] .pscc-amt-poor { background-color: rgba(220, 53, 69, 0.22); color: #f87171; }

.phone-swap-config-card [data-bs-toggle="collapse"] .bx-chevron-up {
    display: inline-block;
    transition: transform 0.2s ease;
}

.phone-swap-config-card [data-bs-toggle="collapse"][aria-expanded="false"] .bx-chevron-up {
    transform: rotate(180deg);
}

.phone-swap-phone-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.5rem;
}

.phone-swap-phone-card {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    text-align: left;
    padding: 0.7rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.7rem;
    background: var(--bs-body-bg);
    cursor: pointer;
    height: 100%;
}

.phone-swap-phone-card:hover {
    border-color: #7c3aed;
}

.phone-swap-phone-card.is-selected {
    border-color: #7c3aed;
    box-shadow: 0 0 0 1px #7c3aed;
    background: rgba(124, 58, 237, 0.06);
}

.phone-swap-phone-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
}

.phone-swap-phone-name {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.phone-swap-phone-meta {
    font-size: 0.72rem;
    color: var(--bs-secondary-color, #6c757d);
}

.phone-swap-phone-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: #7c3aed;
    margin-top: 0.25rem;
}

.phone-swap-deal-rail {
    position: sticky;
    top: 1rem;
}

.phone-swap-page .pos-select-product-box {
    background: var(--bs-body-bg);
}

.phone-swap-page #swap_new_picked {
    min-height: 1.25rem;
}

.phone-swap-deal-phones {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.65rem;
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.05));
}

.phone-swap-deal-phone strong {
    display: block;
    font-size: 0.82rem;
    line-height: 1.3;
}

.phone-swap-deal-arrow {
    font-size: 1.25rem;
    color: #7c3aed;
}

.phone-swap-deal-deduct-lines {
    margin: -0.15rem 0 0.65rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.45rem;
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.05));
}

.phone-swap-deal-deduct-lines > div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.2rem;
}

.phone-swap-deal-deduct-lines > div:last-child {
    margin-bottom: 0;
}

.phone-swap-deal-payments {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.55rem;
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.05));
}

.phone-swap-deal-payment-line {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #198754;
    margin-bottom: 0.3rem;
}

.phone-swap-deal-balance {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    font-weight: 600;
}

[data-deal-payment-lines]:not(:empty) + .phone-swap-deal-balance {
    padding-top: 0.45rem;
    margin-top: 0.15rem;
    border-top: 1px dashed var(--bs-border-color);
}

.phone-swap-deal-balance > span:last-child {
    font-size: 1.05rem;
    font-weight: 700;
}

.phone-swap-pay-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
}

.phone-swap-pay-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
}

.phone-swap-pay-tile {
    --pay-color: #7c3aed;
    --pay-soft: rgba(124, 58, 237, 0.12);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.75rem;
    text-align: left;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.phone-swap-pay-tile[data-swap-pay="cash"] {
    --pay-color: #198754;
    --pay-soft: rgba(25, 135, 84, 0.12);
}

.phone-swap-pay-tile[data-swap-pay="momo"] {
    --pay-color: #c99400;
    --pay-soft: rgba(255, 193, 7, 0.18);
}

.phone-swap-pay-tile[data-swap-pay="hubtel"] {
    --pay-color: #0a9ab8;
    --pay-soft: rgba(13, 202, 240, 0.14);
}

.phone-swap-pay-tile[data-swap-pay="credit"] {
    --pay-color: #dc3545;
    --pay-soft: rgba(220, 53, 69, 0.1);
}

.phone-swap-pay-tile:hover {
    border-color: var(--pay-color);
}

.phone-swap-pay-tile:focus-visible {
    outline: 0;
    border-color: var(--pay-color);
    box-shadow: 0 0 0 0.2rem var(--pay-soft);
}

.phone-swap-pay-tile.is-active {
    border-color: var(--pay-color);
    box-shadow: 0 0 0 1px var(--pay-color);
    background: var(--pay-soft);
}

.phone-swap-pay-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.4rem;
    font-size: 1.15rem;
    color: var(--pay-color);
    background: var(--pay-soft);
}

.phone-swap-pay-tile.is-active .phone-swap-pay-icon {
    color: #fff;
    background: var(--pay-color);
}

.phone-swap-pay-name {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.phone-swap-pay-hint,
.phone-swap-pay-amount {
    max-width: 100%;
    font-size: 0.72rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-swap-pay-hint {
    color: var(--bs-secondary-color, #6c757d);
}

.phone-swap-pay-amount {
    font-weight: 700;
    color: var(--pay-color);
}

.phone-swap-pay-tile.is-active .phone-swap-pay-hint {
    display: none;
}

.phone-swap-pay-check {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
    background: var(--pay-color);
}

.phone-swap-pay-tile.is-active .phone-swap-pay-check {
    display: inline-flex;
}

@media (max-width: 575.98px) {
    .phone-swap-pay-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .phone-swap-pay-status {
        grid-template-columns: 1fr;
    }

    .phone-swap-pay-stat {
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
        gap: 0.75rem;
        padding: 0.65rem 0.85rem;
    }

    .phone-swap-pay-stat + .phone-swap-pay-stat {
        border-left: 0;
        border-top: 1px solid var(--bs-border-color);
    }

    .phone-swap-pay-stat-value {
        font-size: 1rem;
    }

    .phone-swap-callout-controls {
        width: 100%;
        margin-left: 0;
    }

    .phone-swap-callout-controls .form-select,
    .phone-swap-callout-controls > div {
        flex: 1 1 100%;
        min-width: 0;
    }

    .phone-swap-adjust-row {
        padding: 0.75rem;
        gap: 0.65rem;
    }

    .phone-swap-adjust-action {
        gap: 0.5rem;
    }
}

@media (max-width: 1199.98px) {
    .phone-swap-phone-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .phone-swap-steps {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .phone-swap-deal-rail {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .phone-swap-steps {
        grid-template-columns: 1fr;
    }

    .phone-swap-phone-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .phone-swap-step {
        padding: 0.55rem 0.65rem;
    }

    .phone-swap-step-label {
        font-size: 0.75rem;
    }
}

/* Deposit / Withdraw modal */
#customerDepositModal .cd-modal {
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

#customerDepositModal .cd-modal__header {
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

#customerDepositModal .cd-modal__header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.7rem;
    background: rgba(10, 10, 10, 0.06);
    color: #0A0A0A;
    font-size: 1.25rem;
    flex: 0 0 auto;
}

#customerDepositModal .cd-modal__body {
    padding: 1.15rem 1.25rem 1.25rem;
    background: #f8fafc;
}

#customerDepositModal .cd-account-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 1.05rem;
}

#customerDepositModal .sales-return-identity__value {
    font-variant-numeric: tabular-nums;
}

#customerDepositModal .sales-return-identity__value.is-success {
    color: #198754;
}

#customerDepositModal .sales-return-identity__value.is-danger {
    color: #dc3545;
}

#customerDepositModal .cd-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin: 0 0 1.05rem;
    padding: 0.3rem;
    border-radius: 0.85rem;
    background: #fff;
    border: 1px solid #e5e9f0;
}

#customerDepositModal .cd-mode-tabs .nav-item {
    margin: 0;
}

#customerDepositModal .cd-mode-tabs .nav-link {
    width: 100%;
    border: 0;
    border-radius: 0.65rem;
    padding: 0.55rem 0.75rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
}

#customerDepositModal .cd-mode-tabs .nav-link.active {
    color: #fff;
    background: #0A0A0A;
    box-shadow: 0 6px 14px rgba(10, 10, 10, 0.18);
}

#customerDepositModal .cd-mode-tabs #cd_mode_withdraw_tab.active {
    background: #CC0000;
    box-shadow: 0 6px 14px rgba(204, 0, 0, 0.22);
}

#customerDepositModal .sales-return-panel {
    height: auto;
}

#customerDepositModal .cd-panel-body {
    padding: 1.05rem;
}

#customerDepositModal .cd-advanced {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border: 1px dashed #dbe3ee;
    border-radius: 0.75rem;
    background: #f8fafc;
}

#customerDepositModal .cd-advanced__label {
    margin-bottom: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

#customerDepositModal .cd-history-head {
    flex-wrap: wrap;
}

#customerDepositModal .cd-inner-tabs {
    margin-left: auto;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 0.7rem;
    background: #eef2f7;
}

#customerDepositModal .cd-inner-tabs .nav-link {
    border: 0;
    border-radius: 0.55rem;
    padding: 0.32rem 0.7rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
}

#customerDepositModal .cd-inner-tabs .nav-link.active {
    color: #0f172a;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

#customerDepositModal .cd-table thead th {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    white-space: nowrap;
}

#customerDepositModal .cd-table td {
    font-size: 0.8125rem;
    vertical-align: middle;
}

#customerDepositModal .cd-orders-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.05rem 0.35rem;
}

#customerDepositModal .cd-source-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.05rem;
}

#customerDepositModal .cd-source-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #e5e9f0;
    border-radius: 0.8rem;
    background: #fff;
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#customerDepositModal .cd-source-card:hover {
    border-color: #cbd5e1;
}

#customerDepositModal .cd-source-card.is-active {
    border-color: #CC0000;
    background: rgba(204, 0, 0, 0.05);
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.08);
}

#customerDepositModal .cd-source-card__label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

#customerDepositModal .cd-source-card__value {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

#customerDepositModal .cd-source-card.is-active .cd-source-card__value {
    color: #CC0000;
}

#customerDepositModal .cd-source-card__hint {
    font-size: 0.75rem;
    color: #94a3b8;
}

#customerDepositModal .cd-modal__footer {
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #eef2f7;
    background: #fff;
}

@media (max-width: 767.98px) {
    #customerDepositModal .cd-account-strip,
    #customerDepositModal .cd-source-grid {
        grid-template-columns: 1fr;
    }

    #customerDepositModal .cd-inner-tabs {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    #customerDepositModal .cd-inner-tabs .nav-item {
        flex: 1 1 0;
    }

    #customerDepositModal .cd-inner-tabs .nav-link {
        width: 100%;
        text-align: center;
    }
}

html[data-bs-theme="dark"] #customerDepositModal .cd-modal__header,
html[data-bs-theme="dark"] #customerDepositModal .cd-modal__footer,
html[data-bs-theme="dark"] #customerDepositModal .cd-mode-tabs,
html[data-bs-theme="dark"] #customerDepositModal .cd-source-card,
html[data-bs-theme="dark"] #customerDepositModal .cd-advanced {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}

html[data-bs-theme="dark"] #customerDepositModal .cd-modal__body {
    background: rgba(255, 255, 255, 0.02);
}

html[data-bs-theme="dark"] #customerDepositModal .cd-modal__header-icon {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

html[data-bs-theme="dark"] #customerDepositModal .cd-mode-tabs .nav-link {
    color: #94a3b8;
}

html[data-bs-theme="dark"] #customerDepositModal .cd-mode-tabs .nav-link.active {
    color: #fff;
    background: #0A0A0A;
}

html[data-bs-theme="dark"] #customerDepositModal .cd-inner-tabs {
    background: rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] #customerDepositModal .cd-inner-tabs .nav-link.active {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] #customerDepositModal .cd-table thead th {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
}

html[data-bs-theme="dark"] #customerDepositModal .cd-source-card__value,
html[data-bs-theme="dark"] #customerDepositModal .sales-return-identity__value {
    color: #f1f5f9;
}

html[data-bs-theme="dark"] #customerDepositModal .sales-return-identity__value.is-success {
    color: #75b798;
}

html[data-bs-theme="dark"] #customerDepositModal .sales-return-identity__value.is-danger {
    color: #fca5a5;
}

html[data-bs-theme="dark"] #customerDepositModal .cd-source-card.is-active {
    border-color: rgba(204, 0, 0, 0.55);
    background: rgba(204, 0, 0, 0.12);
}

/* Customer Order Sheet */
.cos-wrap { max-width: none; width: 100%; margin: 0; }
.cos-summary-metrics .summary-metrics {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
}
.cos-summary-metrics .summary-metric-card .card-body {
    min-height: 5.5rem;
    padding: 1rem 1.15rem !important;
}
.cos-summary-metrics .summary-metrics h6 {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.25rem !important;
}
.cos-summary-metrics .summary-metric-card__value {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
    color: inherit;
}
.cos-summary-metrics .summary-metrics .stats-icon {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.5rem;
    float: none !important;
    margin: 0 0 0 auto;
    flex-shrink: 0;
}
.cos-summary-metrics .summary-metrics .stats-icon i {
    font-size: 1.15rem;
    color: #fff;
}
.cos-filters .form-label { font-size: 0.8rem; font-weight: 600; color: #444; }
.cos-profile-title {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}
.cos-profile-title__text {
    display: grid;
    gap: 0.1rem;
}
.cos-profile-title__eyebrow {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}
.cos-profile-title__name {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}
.cos-customer-card__avatar {
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.cos-customer-card__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 0;
}
.cos-customer-card__left,
.cos-customer-card__stats {
    min-width: 0;
    padding: 0.85rem 1rem 1rem;
}
.cos-customer-card__left {
    border-right: 1px solid #e5e8ec;
}
.cos-customer-card__stats {
    background: #fafbfc;
}
.cos-customer-card__table {
    width: 100%;
}
.cos-customer-card__table tbody th {
    width: 42%;
    color: #5f6770;
    font-weight: 600;
    text-align: left;
    vertical-align: middle;
}
.cos-customer-card__stats-table tbody th {
    width: 58%;
}
.cos-customer-card__table tbody td {
    vertical-align: middle;
}
@media (max-width: 767.98px) {
    .cos-customer-card__inner {
        grid-template-columns: 1fr;
    }
    .cos-customer-card__left {
        border-right: 0;
        border-bottom: 1px solid #e5e8ec;
    }
}
.cos-panel {
    background: #fff;
    border: 1px solid #cfd5dc;
    border-radius: 0.35rem;
    overflow: hidden;
}
.cos-panel__title {
    margin: 0;
    padding: 0.7rem 1rem;
    background: #111;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.cos-panel + .cos-panel { margin-top: 1rem; }
.cos-sheet .cos-sheet__section + .cos-sheet__section .cos-panel__title {
    border-top: 1px solid #cfd5dc;
}
.cos-txn-date {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: #666;
}
.cos-order { border-top: 1px solid #e5e8ec; }
.cos-order + .cos-order { border-top: 8px solid #f1f2f4; }
.cos-order.is-search-hidden,
.cos-txn-row.is-search-hidden,
.cos-deposit-row.is-search-hidden { display: none; }
.cos-order-head {
    width: 100%;
    border-collapse: collapse;
}
.cos-order-head thead th {
    padding: 0.65rem 0.85rem;
    background: #f3f4f6;
    color: #222;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid #d7dce2;
    white-space: nowrap;
}
.cos-order-head tbody td {
    padding: 0.75rem 0.85rem;
    background: #fff;
    border-bottom: 1px solid #d7dce2;
    vertical-align: middle;
    font-size: 0.92rem;
    font-weight: 700;
    color: #111;
}
.cos-order-head__date {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: #666;
}
.cos-txn-table tbody td {
    border-bottom: 1px solid #eceff2;
    font-weight: 600;
}
.cos-txn-table tbody tr:last-child td {
    border-bottom: 0;
}
.cos-badge {
    display: inline-block;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
}
.cos-badge--success { background: #d1fae5; color: #065f46; }
.cos-badge--warning { background: #fef3c7; color: #92400e; }
.cos-badge--danger { background: #fee2e2; color: #991b1b; }
.cos-badge--info { background: #dbeafe; color: #1e40af; }
.cos-badge--muted { background: #e5e7eb; color: #374151; }
.cos-items { width: 100%; border-collapse: collapse; }
.cos-items thead th {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #d7dce2;
    background: #f3f4f6;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #222;
    white-space: nowrap;
}
.cos-items tbody td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #eceff2;
    vertical-align: top;
    font-size: 0.9rem;
    color: #222;
}
.cos-items tbody tr:last-child td { border-bottom: 0; }
.cos-item-name { display: block; font-weight: 700; color: #111; }
.cos-item-spec {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: #666;
}
.cos-item-return {
    display: inline-block;
    margin-top: 0.35rem;
}
.cos-serials {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.35rem 1rem;
    margin-top: 0.55rem;
}
.cos-serials__col { min-width: 0; }
.cos-serials__label {
    display: block;
    margin-bottom: 0.1rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #666;
}
.cos-serials__value {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.74rem;
    line-height: 1.45;
    color: #444;
    word-break: break-all;
}
.cos-money { white-space: nowrap; font-weight: 600; }
.cos-money--paid { color: #1f9d57; font-weight: 700; }
.cos-money--due { color: #c4122f; font-weight: 700; }
.cos-money--change { color: #9a5b00; font-weight: 700; }
.cos-money--credit { color: #0b5cad; font-weight: 700; }
.cos-money--deposit { color: #1f9d57; font-weight: 700; }
.cos-money--used { color: #c4122f; font-weight: 700; }
.cos-order-head tbody td.cos-money--credit-in,
.cos-txn-table tbody td.cos-money--credit-in,
.cos-money--credit-in {
    color: #1f9d57 !important;
    font-weight: 700;
}
.cos-order-head tbody td.cos-money--debit-out,
.cos-txn-table tbody td.cos-money--debit-out,
.cos-money--debit-out {
    color: #c4122f !important;
    font-weight: 700;
}
.cos-account-tag {
    display: inline-block;
    width: fit-content;
    margin-top: 0;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.3;
}
.cos-account-tag--deposit {
    background: #e8f7ee;
    color: #1f9d57;
}
.cos-account-tag--credit {
    background: #e7f1fb;
    color: #0b5cad;
}
.cos-totals {
    display: flex;
    justify-content: flex-end;
    padding: 0;
    background: #fff;
    border-top: 1px solid #d7dce2;
}
.cos-totals__box {
    width: min(100%, 340px);
    border-left: 1px solid #d7dce2;
    background: #fff;
}
.cos-totals__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid #d7dce2;
    font-size: 0.9rem;
    color: #111;
    background: #fff;
}
.cos-totals__row:last-child {
    border-bottom: 0;
}
.cos-totals__row--grand {
    background: #c4122f;
    color: #fff;
    font-weight: 700;
}
.cos-totals__row--grand .cos-money {
    color: #fff;
}
.cos-totals__row--paid,
.cos-totals__row--due,
.cos-totals__row--change,
.cos-totals__row--credit {
    background: #fff;
    color: #111;
    font-weight: 600;
}
.cos-totals__note {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #666;
}
.cos-empty { padding: 2.5rem 1rem; text-align: center; }
@media (max-width: 991.98px) {
    .cos-serials { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 575.98px) {
    .cos-serials { grid-template-columns: 1fr; }
    .cos-items thead { display: none; }
    .cos-items tbody td {
        display: block;
        width: 100%;
        border-bottom: 0;
        padding: 0.25rem 0.85rem;
    }
    .cos-items tbody tr {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid #eceff2;
    }
}
@media print {
    @page { margin: 10mm; }
    body:has(#customer_sheet_print) * { visibility: hidden !important; }
    body:has(#customer_sheet_print) #customer_sheet_print,
    body:has(#customer_sheet_print) #customer_sheet_print * { visibility: visible !important; }
    body:has(#customer_sheet_print) #customer_sheet_print {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    body:has(#customer_sheet_print) .sidebar-wrapper,
    body:has(#customer_sheet_print) .burger-btn,
    body:has(#customer_sheet_print) .btn,
    body:has(#customer_sheet_print) form.row,
    body:has(#customer_sheet_print) .card-header,
    body:has(#customer_sheet_print) .page-title,
    body:has(#customer_sheet_print) .no-print { display: none !important; }
    body:has(#customer_sheet_print) #main { padding: 0 !important; margin: 0 !important; }
    body:has(#customer_sheet_print) .card,
    body:has(#customer_sheet_print) .card-body,
    body:has(#customer_sheet_print) .cos-wrap {
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        background: transparent !important;
    }
    body:has(#customer_sheet_print) .cos-order.is-search-hidden,
    body:has(#customer_sheet_print) .cos-txn-row.is-search-hidden,
    body:has(#customer_sheet_print) .cos-deposit-row.is-search-hidden { display: none !important; }
    body:has(#customer_sheet_print) .cos-panel__title,
    body:has(#customer_sheet_print) .cos-order-head thead th,
    body:has(#customer_sheet_print) .cos-totals__row--grand,
    body:has(#customer_sheet_print) .cos-totals__row--paid,
    body:has(#customer_sheet_print) .cos-totals__row--due,
    body:has(#customer_sheet_print) .cos-totals__row--change,
    body:has(#customer_sheet_print) .cos-totals__row--credit,
    body:has(#customer_sheet_print) .cos-badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    body:has(#customer_sheet_print) .cos-order { break-inside: avoid; page-break-inside: avoid; }
}

/* Product list (view_products.php) */
.products-table-wrap {
    overflow-x: auto;
    overflow-y: visible !important;
}

.products-table-wrap .dropdown {
    position: static;
}

.products-table-wrap .dropdown-menu {
    z-index: 1055;
}

.product-main-row {
    cursor: pointer;
}

.product-main-row.table-active {
    --bs-table-accent-bg: rgba(13, 110, 253, 0.08);
}

.product-variation-tfoot {
    background: #f8f9fa;
    border-top: 2px solid #212529;
}

.product-variation-tfoot td {
    vertical-align: middle;
    white-space: nowrap;
}

.product-variation-tfoot__title {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #495057;
}

.product-variation-tfoot__label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 0.1rem;
}

.product-variation-tfoot__value {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #212529;
    line-height: 1.2;
}

.variation-imei-list-scroll,
.variation-barcode-list-scroll {
    max-height: min(60vh, 22rem);
    overflow-y: auto;
}

.product-print-barcode-list-scroll {
    max-height: calc(5 * 2.5rem);
    overflow-y: auto;
}

.product-print-variation-option {
    cursor: pointer;
}

.product-print-variation-option.active {
    border-color: var(--bs-primary) !important;
    background-color: rgba(var(--bs-primary-rgb), 0.08);
}

/* Stock Movement Ledger (inventory/datalist/view_stock_movement_ledger.php) */
.sml-card { border: 1px solid #ced4da; }
.sml-card__head { border-bottom: 2px solid #212529; background: #f8f9fa; padding: 1rem; }
.sml-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem 1rem; font-size: .875rem; }
.sml-meta span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: #6c757d; }
.sml-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sml-balance { font-weight: 700; background: #f8f9fa; }
.sml-table thead th { border-bottom: 2px solid #212529 !important; font-size: .75rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.sml-table tfoot td { border-top: 2px solid #212529 !important; font-weight: 600; background: #f8f9fa; }
@media print {
    .card { box-shadow: none !important; }
    /* #main normally carries margin-left: 300px to clear the fixed sidebar,
       and min-height: 100vh for the screen layout. Neither makes sense on a
       printed page. */
    html, body, #main {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    #sidebar { display: none !important; }
   
    html, [data-bs-theme="dark"] {
        color-scheme: light !important;
        --bs-body-color: #212529 !important;
        --bs-body-bg: #ffffff !important;
        --bs-emphasis-color: #000000 !important;
        --bs-secondary-color: rgba(33, 37, 41, 0.75) !important;
    }
    body, .sml-card, .sml-card__head { color: #212529 !important; background: #ffffff !important; }

    table, .table {
        --bs-table-color: #212529 !important;
        --bs-table-bg: transparent !important;
        --bs-table-color-state: #212529 !important;
        --bs-table-color-type: #212529 !important;
    }
}

/* Printing the ledger shows only the product summary + table (#sml_print_area),
   not the filters or page chrome — same isolation technique as
   #customer_sheet_print above. */
@media print {
    body:has(#sml_print_area) * { visibility: hidden !important; }
    body:has(#sml_print_area) #sml_print_area,
    body:has(#sml_print_area) #sml_print_area * { visibility: visible !important; }
    body:has(#sml_print_area) #sml_print_area {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }
    body:has(#sml_print_area) #sml_print_area .no-print { display: none !important; }
}

/* ── Swap Orders (trade-in resale) ── */
.swap-orders-page .so-shell {
    overflow: hidden;
}

.swap-orders-page .so-shell-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.35fr);
    min-height: 34rem;
}

.swap-orders-page .so-stock {
    border-right: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg, rgba(124, 58, 237, 0.03));
    display: flex;
    flex-direction: column;
    /* Size the column to the sale card, not the phone list, so the list scrolls inside it. */
    height: 0;
    min-height: 100%;
    overflow: hidden;
}

.swap-orders-page .so-checkout {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.swap-orders-page .so-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 1.15rem 1.25rem 0.85rem;
}

.swap-orders-page .so-checkout-head {
    border-bottom: 1px solid var(--bs-border-color);
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.05), transparent);
}

.swap-orders-page .so-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7c3aed;
    margin-bottom: 0.15rem;
}

.swap-orders-page .so-meta-row {
    display: flex;
    gap: 0.55rem;
    flex: 0 0 auto;
}

.swap-orders-page .so-meta-field label {
    display: block;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.2rem;
}

.swap-orders-page .so-meta-field .form-control {
    min-width: 8.25rem;
}

.swap-orders-page .so-search-wrap {
    position: relative;
    padding: 0 1.25rem 0.85rem;
}

.swap-orders-page .so-search-icon {
    position: absolute;
    left: 1.9rem;
    top: 50%;
    transform: translateY(calc(-50% - 0.15rem));
    color: var(--bs-secondary-color, #6c757d);
    pointer-events: none;
}

.swap-orders-page .so-search-wrap .form-control {
    padding-left: 2.25rem;
}

.swap-orders-page .swap-orders-inventory {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 1.25rem 1.25rem;
}

.swap-orders-page .swap-orders-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    text-align: left;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-body-bg);
    padding: 0.8rem 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.swap-orders-page .swap-orders-item:hover {
    border-color: rgba(124, 58, 237, 0.4);
}

.swap-orders-page .swap-orders-item.is-selected {
    border-color: #7c3aed;
    box-shadow: 0 0 0 1px #7c3aed;
    background: rgba(124, 58, 237, 0.05);
}

.swap-orders-page .so-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.swap-orders-page .so-item-title {
    font-weight: 650;
    font-size: 0.92rem;
    line-height: 1.3;
}

.swap-orders-page .so-item-meta,
.swap-orders-page .so-item-customer {
    font-size: 0.78rem;
    color: var(--bs-secondary-color, #6c757d);
}

.swap-orders-page .so-item-price {
    flex-shrink: 0;
    font-weight: 700;
    color: #7c3aed;
    white-space: nowrap;
}

.swap-orders-page .so-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--bs-secondary-color, #6c757d);
}

.swap-orders-page .so-empty-glyph {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.65rem;
    opacity: 0.55;
}

.swap-orders-page .so-checkout-body {
    padding: 1.15rem 1.25rem 0.25rem;
    flex: 1 1 auto;
}

.swap-orders-page .so-section + .so-section {
    margin-top: 1.35rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bs-border-color);
}

.swap-orders-page .so-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 0.85rem;
}

.swap-orders-page .so-checkout-footer {
    margin-top: auto;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.swap-orders-page .so-checkout-footer .btn {
    width: 100%;
    border-radius: 0.7rem;
    font-weight: 650;
}

.swap-orders-page .phone-swap-pay-tile:disabled {
    opacity: 0.45;
    pointer-events: none;
}

.swap-orders-page .so-sell-price-input {
    appearance: textfield;
    -moz-appearance: textfield;
}

.swap-orders-page .so-sell-price-input::-webkit-outer-spin-button,
.swap-orders-page .so-sell-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media (max-width: 991.98px) {
    .swap-orders-page .so-shell-grid {
        grid-template-columns: 1fr;
    }

    .swap-orders-page .so-stock {
        border-right: 0;
        border-bottom: 1px solid var(--bs-border-color);
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .swap-orders-page .swap-orders-inventory {
        flex: none;
        max-height: 18rem;
    }

    .swap-orders-page .so-checkout-head {
        flex-direction: column;
    }

    .swap-orders-page .so-meta-row {
        width: 100%;
    }

    .swap-orders-page .so-meta-field {
        flex: 1 1 0;
    }

    .swap-orders-page .so-meta-field .form-control {
        min-width: 0;
        width: 100%;
    }
}

/* Sidebar menu search */
.sidebar-search {
  position: sticky;
  top: 0;
  z-index: 11;
  padding: 0.75rem 2rem 0.5rem;
  background-color: #fff;
}

html[data-bs-theme="dark"] .sidebar-search {
  background-color: #1e1e2d;
}

.sidebar-search__field {
  position: relative;
}

.sidebar-search__icon {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: #9899ac;
  pointer-events: none;
}

.sidebar-search__input.form-control {
  padding-left: 2.25rem;
  padding-right: 2.25rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.sidebar-search__clear {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #9899ac;
  font-size: 0.8rem;
  line-height: 1;
}

.sidebar-search__clear:hover,
.sidebar-search__clear:focus {
  color: #7c3aed;
}

.sidebar-search__empty {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: #9899ac;
}

/* Filter hits only: permission-hidden items keep their own d-none */
.sidebar-search-hidden {
  display: none !important;
}
