/*
 * Soft Cloud BD — Global Theme Contrast & Layer Repair v8
 * Loaded after the legacy theme stack so light/dark tokens and overlays
 * remain consistent across every authenticated module.
 */
body.mf-classic-v4:not(.dark-mode) {
  --bg-body: var(--mfv4-background) !important;
  --bg-card: var(--mfv4-card) !important;
  --surface: var(--mfv4-card) !important;
  --surface-alt: #f7f9fb !important;
  --bg-surface-alt: #f7f9fb !important;
  --border: var(--mfv4-border) !important;
  --text-primary: var(--mfv4-text) !important;
  --text-secondary: #536477 !important;
  --text-muted: #66788a !important;
  color: var(--mfv4-text) !important;
}
body.mf-classic-v4.dark-mode {
  --mfv4-background: #101722;
  --mfv4-card: #182433;
  --mfv4-border: #33465b;
  --mfv4-text: #e8eff7;
  --mfv4-widget-title: #dce7f2;
  --mfv4-footer-primary: #a9bacb;
  --mfv4-footer-secondary: #c4d1df;
  --mfv4-success: #34d399;
  --mfv4-danger: #fb7185;
  --bg-body: #101722 !important;
  --bg-card: #182433 !important;
  --surface: #182433 !important;
  --surface-alt: #202f40 !important;
  --surface-hover: #293a4d !important;
  --bg-surface-alt: #202f40 !important;
  --bg-hover: #293a4d !important;
  --border: #33465b !important;
  --border-light: #29394b !important;
  --text-primary: #e8eff7 !important;
  --text-secondary: #bdcad8 !important;
  --text-muted: #9aabbd !important;
  --admin-bg: #101722 !important;
  --admin-card: #182433 !important;
  --admin-text: #e8eff7 !important;
  --admin-text-muted: #aab9c8 !important;
  --admin-border: #33465b !important;
  color-scheme: dark;
  background: #101722 !important;
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode .main-area,
body.mf-classic-v4.dark-mode .content-area,
body.mf-classic-v4.dark-mode .sidebar-layout {
  background: transparent !important;
  color: var(--text-primary) !important;
}
body.mf-classic-v4.dark-mode .top-bar {
  background: rgba(17, 28, 42, .97) !important;
  border-color: #33465b !important;
  box-shadow: 0 1px 8px rgba(0,0,0,.24) !important;
}
body.mf-classic-v4.dark-mode .header-left .brand,
body.mf-classic-v4.dark-mode .header-left .brand i,
body.mf-classic-v4.dark-mode .sidebar-toggle {
  color: #e4edf6 !important;
}
body.mf-classic-v4.dark-mode .header-right .lang-btn,
body.mf-classic-v4.dark-mode .header-right .theme-btn,
body.mf-classic-v4.dark-mode .header-right .user-btn {
  background: #202f40 !important;
  color: #e1eaf4 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .header-right .lang-btn:hover,
body.mf-classic-v4.dark-mode .header-right .theme-btn:hover,
body.mf-classic-v4.dark-mode .header-right .user-btn:hover {
  background: #2b3e53 !important;
  color: #fff !important;
  border-color: var(--mfv4-primary) !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 {
  background: linear-gradient(180deg, #1c2939 0%, #141e2c 100%) !important;
  border-color: #33465b !important;
  box-shadow: 8px 0 28px rgba(0,0,0,.25) !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-brand,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-top,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-footer {
  background: #172332 !important;
  border-color: #33465b !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sb-brand-text strong,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-profile-details strong {
  color: #f0f5fb !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sb-brand-text .mf-sb-overline,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sb-brand-text small,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-profile-details small,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-footer-note {
  color: #aebed0 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-search {
  background: #202f40 !important;
  border-color: #40536a !important;
  color: #dce7f2 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-search input#mfSidebarSearch {
  background: transparent !important;
  color: #f0f5fb !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sidebar-search input::placeholder {
  color: #a7b7c8 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-quick-action {
  background: #202f40 !important;
  color: #e1eaf4 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-quick-action i {
  color: #9bcfe0 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-quick-sale,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-quick-sale i {
  background: var(--mfv4-primary) !important;
  color: #fff !important;
  border-color: var(--mfv4-primary) !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-section {
  color: #9eafc2 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-row > a.mf-nav-leaf-link,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-group-btn {
  background: transparent !important;
  color: #d5e0ec !important;
  border-color: transparent !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-row > a.mf-nav-leaf-link i,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-group-btn > i,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-group-btn .chevron {
  color: #aebfd1 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-row:hover > a.mf-nav-leaf-link,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-group-btn:hover,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-group-li.open > .mf-nav-group-btn {
  background: #293b50 !important;
  color: #fff !important;
  border-color: #405b75 !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-leaf.mf-is-active > .mf-nav-row > a.mf-nav-leaf-link {
  background: var(--mfv4-primary) !important;
  color: #fff !important;
  border-color: var(--mfv4-primary) !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-nav-children {
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-favorites-links a,
body.mf-classic-v4.dark-mode #sidebar.mf-sidebar-v4 .mf-sb-favorites {
  background: #202f40 !important;
  color: #dce7f2 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .page-header {
  background: #1c2a3a !important;
  color: #e8eff7 !important;
  border-top-color: var(--mfv4-primary) !important;
}
body.mf-classic-v4.dark-mode .page-header h1,
body.mf-classic-v4.dark-mode .page-header h1 i,
body.mf-classic-v4.dark-mode .page-header p {
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode .page-header p { opacity: .82; }
body.mf-classic-v4.dark-mode .stat-card,
body.mf-classic-v4.dark-mode .card-modern,
body.mf-classic-v4.dark-mode .card,
body.mf-classic-v4.dark-mode .form-card,
body.mf-classic-v4.dark-mode .search-filter-bar,
body.mf-classic-v4.dark-mode .action-btn,
body.mf-classic-v4.dark-mode .products-grid .product-card,
body.mf-classic-v4.dark-mode .mf-inventory-card,
body.mf-classic-v4.dark-mode .pos-products-panel,
body.mf-classic-v4.dark-mode .pos-cart-panel,
body.mf-classic-v4.dark-mode .admin-card,
body.mf-classic-v4.dark-mode .admin-table-wrap {
  background: #182433 !important;
  color: #e8eff7 !important;
  border-color: #33465b !important;
  box-shadow: 0 4px 18px rgba(0,0,0,.12) !important;
}
body.mf-classic-v4.dark-mode .card-header,
body.mf-classic-v4.dark-mode .card-modern .card-header,
body.mf-classic-v4.dark-mode .products-header,
body.mf-classic-v4.dark-mode .cart-header,
body.mf-classic-v4.dark-mode .admin-table-header {
  background: #202f40 !important;
  color: #e5edf6 !important;
  border-color: #33465b !important;
}
body.mf-classic-v4.dark-mode .card-header *,
body.mf-classic-v4.dark-mode .card-modern .card-header *,
body.mf-classic-v4.dark-mode .products-header *,
body.mf-classic-v4.dark-mode .cart-header *,
body.mf-classic-v4.dark-mode .admin-table-header * {
  color: inherit;
}
body.mf-classic-v4.dark-mode .card-title,
body.mf-classic-v4.dark-mode .card-modern .card-header h5,
body.mf-classic-v4.dark-mode .form-card h4,
body.mf-classic-v4.dark-mode .stat-info h3,
body.mf-classic-v4.dark-mode .product-name,
body.mf-classic-v4.dark-mode .product-info .product-name,
body.mf-classic-v4.dark-mode .admin-table-header h3 {
  color: #edf3fa !important;
}
body.mf-classic-v4.dark-mode .stat-info p,
body.mf-classic-v4.dark-mode .product-meta,
body.mf-classic-v4.dark-mode .form-text,
body.mf-classic-v4.dark-mode .text-muted,
body.mf-classic-v4.dark-mode .text-secondary,
body.mf-classic-v4.dark-mode .page-description {
  color: #aebed0 !important;
}
body.mf-classic-v4.dark-mode .table,
body.mf-classic-v4.dark-mode .table tbody,
body.mf-classic-v4.dark-mode .table tbody tr,
body.mf-classic-v4.dark-mode .admin-table {
  --bs-table-bg: #182433;
  --bs-table-color: #dce7f2;
  --bs-table-border-color: #33465b;
  color: #dce7f2 !important;
  background: #182433 !important;
}
body.mf-classic-v4.dark-mode .table thead th,
body.mf-classic-v4.dark-mode .table-light th,
body.mf-classic-v4.dark-mode .admin-table th {
  background: #202f40 !important;
  color: #c8d5e3 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .table tbody td,
body.mf-classic-v4.dark-mode .admin-table td {
  background: #182433 !important;
  color: #dce7f2 !important;
  border-color: #33465b !important;
}
body.mf-classic-v4.dark-mode .table tbody tr:hover,
body.mf-classic-v4.dark-mode .admin-table tr:hover {
  background: #26384c !important;
}
body.mf-classic-v4.dark-mode input:not([type=checkbox]):not([type=radio]):not([type=range]),
body.mf-classic-v4.dark-mode textarea,
body.mf-classic-v4.dark-mode select,
body.mf-classic-v4.dark-mode .form-control,
body.mf-classic-v4.dark-mode .form-select,
body.mf-classic-v4.dark-mode .search-box input,
body.mf-classic-v4.dark-mode .filter-select,
body.mf-classic-v4.dark-mode .admin-search input {
  background: #202f40 !important;
  color: #edf3fa !important;
  border-color: #40536a !important;
  box-shadow: none !important;
}
body.mf-classic-v4.dark-mode input::placeholder,
body.mf-classic-v4.dark-mode textarea::placeholder,
body.mf-classic-v4.dark-mode .form-control::placeholder {
  color: #a1b1c3 !important;
  opacity: 1;
}
body.mf-classic-v4.dark-mode input:focus,
body.mf-classic-v4.dark-mode textarea:focus,
body.mf-classic-v4.dark-mode select:focus,
body.mf-classic-v4.dark-mode .form-control:focus,
body.mf-classic-v4.dark-mode .form-select:focus {
  border-color: var(--mfv4-primary) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mfv4-primary) 22%, transparent) !important;
}
body.mf-classic-v4.dark-mode label,
body.mf-classic-v4.dark-mode .form-group label,
body.mf-classic-v4.dark-mode .form-label {
  color: #c4d1df !important;
}
body.mf-classic-v4.dark-mode .user-menu,
body.mf-classic-v4.dark-mode .mfv4-search-results,
body.mf-classic-v4.dark-mode #langDropdown {
  background: #1b2939 !important;
  color: #e6eef7 !important;
  border-color: #40536a !important;
  box-shadow: 0 12px 32px rgba(0,0,0,.35) !important;
}
body.mf-classic-v4.dark-mode .user-menu a,
body.mf-classic-v4.dark-mode .user-menu button,
body.mf-classic-v4.dark-mode .mfv4-search-results a,
body.mf-classic-v4.dark-mode #langDropdown a {
  color: #dce7f2 !important;
}
body.mf-classic-v4.dark-mode .user-menu a:hover,
body.mf-classic-v4.dark-mode .user-menu button:hover,
body.mf-classic-v4.dark-mode .mfv4-search-results a:hover,
body.mf-classic-v4.dark-mode #langDropdown a:hover {
  background: #293b50 !important;
  color: #fff !important;
}
body.mf-classic-v4.dark-mode .site-footer {
  background: #172332 !important;
  color: #b7c5d4 !important;
  border-color: #33465b !important;
}
body.mf-classic-v4.dark-mode .site-footer a { color: #8fd5ef !important; }
body.mf-classic-v4.dark-mode a:not(.btn):not(.mf-nav-leaf-link) { color: #8fd5ef; }
body.mf-classic-v4.dark-mode .btn-primary,
body.mf-classic-v4.dark-mode .btn-success,
body.mf-classic-v4.dark-mode .btn-danger,
body.mf-classic-v4.dark-mode .pos-btn {
  color: #fff !important;
}
body.mf-classic-v4.dark-mode .btn-outline-primary {
  background: transparent !important;
  color: #9edcf0 !important;
  border-color: #65bdd8 !important;
}
body.mf-classic-v4.dark-mode .btn-outline-danger {
  background: transparent !important;
  color: #ff9ba8 !important;
  border-color: #ed7c8b !important;
}
body.mf-classic-v4.dark-mode .alert,
body.mf-classic-v4.dark-mode .list-group-item,
body.mf-classic-v4.dark-mode .accordion-item {
  background: #1b2939 !important;
  color: #e2ebf4 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .accordion-button {
  background: #202f40 !important;
  color: #e2ebf4 !important;
}
body.mf-classic-v4.dark-mode .pagination .page-link {
  background: #202f40 !important;
  color: #dce7f2 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .pagination .page-item.active .page-link {
  background: var(--mfv4-primary) !important;
  color: #fff !important;
}
body.mf-classic-v4.dark-mode hr { border-color: #40536a !important; opacity: 1; }
body.mf-classic-v4.dark-mode .empty-state h4 { color: #e8eff7 !important; }
body.mf-classic-v4.dark-mode .empty-state p { color: #b7c5d4 !important; }
body.mf-classic-v4.dark-mode .product-stock.in-stock { background: #123d32 !important; color: #a7f3d0 !important; }
body.mf-classic-v4.dark-mode .product-stock.low-stock { background: #493716 !important; color: #fde68a !important; }
body.mf-classic-v4.dark-mode .product-stock.out-of-stock { background: #4a2028 !important; color: #fecdd3 !important; }

/* Contrast-safe product modal. These names deliberately avoid Bootstrap's .modal-* internals. */
.product-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  isolation: isolate;
  padding: 24px;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  background: rgba(12, 20, 32, .68);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.product-modal-overlay.active { display: flex; }
.product-modal-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: min(88vh, 820px);
  margin: auto;
  overflow: hidden;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.35);
}
.product-modal-header {
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  color: var(--text-primary);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.product-modal-header h3 {
  min-width: 0;
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.product-modal-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.product-modal-close:hover { color: var(--text-primary); border-color: var(--mfv4-primary); }
.product-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  color: var(--text-primary);
  background: var(--bg-card);
}
.product-modal-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.product-modal-image-wrap {
  width: 100%;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-alt);
}
.product-modal-image {
  display: none;
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  background: var(--surface-alt);
}
.product-modal-no-image {
  width: 100%;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--surface-alt);
  font-size: 48px;
}
.product-modal-details { min-width: 0; }
.product-modal-details .detail-row {
  display: grid;
  grid-template-columns: minmax(82px, 112px) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.product-modal-details .detail-row span {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}
.product-modal-details .detail-row strong {
  min-width: 0;
  color: var(--text-primary);
  font-weight: 650;
  line-height: 1.5;
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.product-modal-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 15px 22px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}
body.dark-mode .product-modal-dialog { background: #182433; border-color: #40536a; }
body.dark-mode .product-modal-header,
body.dark-mode .product-modal-body { background: #182433; color: #e8eff7; }
body.dark-mode .product-modal-header h3,
body.dark-mode .product-modal-details .detail-row strong { color: #edf3fa; }
body.dark-mode .product-modal-details .detail-row span { color: #b7c6d5; }
body.dark-mode .product-modal-footer { background: #202f40; border-color: #40536a; }
body.dark-mode .product-modal-close { background: #26384c; color: #dce7f2; border-color: #40536a; }
body.dark-mode .product-modal-image-wrap,
body.dark-mode .product-modal-image,
body.dark-mode .product-modal-no-image { background: #202f40; border-color: #40536a; }
body.dark-mode .product-modal-footer .btn-secondary {
  background: #293b50 !important;
  color: #e2ebf4 !important;
  border-color: #40536a !important;
}
@media (max-width: 640px) {
  .product-modal-overlay { padding: 12px; align-items: flex-start; }
  .product-modal-dialog { width: 100%; max-height: 94dvh; margin: auto 0; border-radius: 13px; }
  .product-modal-header { min-height: 58px; padding: 13px 15px; }
  .product-modal-header h3 { font-size: 16px; }
  .product-modal-body { padding: 15px; }
  .product-modal-grid { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .product-modal-image-wrap { max-width: 240px; min-height: 160px; margin: 0 auto; }
  .product-modal-no-image { min-height: 160px; }
  .product-modal-footer { padding: 12px 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .product-modal-overlay, .product-modal-dialog { scroll-behavior: auto !important; }
}


/* Bootstrap modals and legacy page-specific modal components. */
body.mf-classic-v4.dark-mode .modal-content {
  background: #182433 !important;
  color: #e8eff7 !important;
  border: 1px solid #40536a !important;
}
body.mf-classic-v4.dark-mode .modal-header,
body.mf-classic-v4.dark-mode .modal-footer {
  background: #202f40 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .modal-body {
  background: #182433 !important;
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode .modal-title,
body.mf-classic-v4.dark-mode .modal-header h3,
body.mf-classic-v4.dark-mode .modal-header h4,
body.mf-classic-v4.dark-mode .modal-header h5,
body.mf-classic-v4.dark-mode .modal-label {
  color: #edf3fa !important;
}
body.mf-classic-v4.dark-mode .modal-content .btn-close {
  filter: invert(1) grayscale(1) brightness(1.8);
}

/* POS defines its own light-only palette inside the page; rebind it at body level. */
body.mf-classic-v4.dark-mode.pos {
  --pos-surface: #182433;
  --pos-bg: #101722;
  --pos-bg-alt: #202f40;
  --pos-text: #e8eff7;
  --pos-text-light: #bdcad8;
  --pos-text-muted: #9aabbd;
  --pos-border: #40536a;
}
body.mf-classic-v4.dark-mode.pos .pos-products-panel,
body.mf-classic-v4.dark-mode.pos .pos-cart-panel,
body.mf-classic-v4.dark-mode.pos .payment-card {
  background: #182433 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode.pos .products-header,
body.mf-classic-v4.dark-mode.pos .cart-header,
body.mf-classic-v4.dark-mode.pos .products-filters {
  background: #202f40 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode.pos .products-header h4,
body.mf-classic-v4.dark-mode.pos .cart-header h4,
body.mf-classic-v4.dark-mode.pos .cart-header h5,
body.mf-classic-v4.dark-mode.pos .products-header .count {
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode.pos .product-card,
body.mf-classic-v4.dark-mode.pos .summary-row:not(.total),
body.mf-classic-v4.dark-mode.pos .qty-box button,
body.mf-classic-v4.dark-mode.pos .customer-row button,
body.mf-classic-v4.dark-mode.pos .customer-row select,
body.mf-classic-v4.dark-mode.pos .method-btn:not(.active),
body.mf-classic-v4.dark-mode.pos .mobile-banks button:not(.active),
body.mf-classic-v4.dark-mode.pos .modal-cancel,
body.mf-classic-v4.dark-mode.pos .modal-content,
body.mf-classic-v4.dark-mode.pos .success-details {
  background: #202f40 !important;
  color: #e2ebf4 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode.pos .product-card .product-name,
body.mf-classic-v4.dark-mode.pos .product-card .product-price,
body.mf-classic-v4.dark-mode.pos .summary-row span,
body.mf-classic-v4.dark-mode.pos .customer-row label,
body.mf-classic-v4.dark-mode.pos .payment-label,
body.mf-classic-v4.dark-mode.pos .payment-inputs label,
body.mf-classic-v4.dark-mode.pos .modal-label,
body.mf-classic-v4.dark-mode.pos .modal-header h4,
body.mf-classic-v4.dark-mode.pos .success-modal h3,
body.mf-classic-v4.dark-mode.pos .success-details p {
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode.pos .products-filters input,
body.mf-classic-v4.dark-mode.pos .products-filters select,
body.mf-classic-v4.dark-mode.pos .customer-row input,
body.mf-classic-v4.dark-mode.pos .qty-box input,
body.mf-classic-v4.dark-mode.pos .summary-row input,
body.mf-classic-v4.dark-mode.pos .modal-input,
body.mf-classic-v4.dark-mode.pos .modal-select {
  background: #172433 !important;
  color: #edf3fa !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode.pos .products-filters input::placeholder,
body.mf-classic-v4.dark-mode.pos .customer-row input::placeholder {
  color: #a5b6c8 !important;
}
body.mf-classic-v4.dark-mode.pos .summary-card {
  background: #1b2939 !important;
  border: 1px solid #40536a !important;
}
body.mf-classic-v4.dark-mode.pos .payment-box.receive,
body.mf-classic-v4.dark-mode.pos .payment-box.change {
  background: #123d32 !important;
  color: #a7f3d0 !important;
}
body.mf-classic-v4.dark-mode.pos .payment-box.due {
  background: #4a2028 !important;
  color: #fecdd3 !important;
}
body.mf-classic-v4.dark-mode.pos .modal {
  background: rgba(4, 10, 18, .76) !important;
}
body.mf-classic-v4.dark-mode.pos .modal-header {
  background: transparent !important;
}
body.mf-classic-v4.dark-mode.pos .modal-cancel:hover {
  background: #293b50 !important;
}

/* Page-specific white cards and inline neutral surfaces used by older modules. */
body.mf-classic-v4.dark-mode .content-area .ie-card,
body.mf-classic-v4.dark-mode .content-area .profile-card,
body.mf-classic-v4.dark-mode .content-area .customer-profile-card,
body.mf-classic-v4.dark-mode .content-area .customer-card,
body.mf-classic-v4.dark-mode .content-area .db-card,
body.mf-classic-v4.dark-mode .content-area .db-section,
body.mf-classic-v4.dark-mode .content-area .report-card,
body.mf-classic-v4.dark-mode .content-area .filter-card,
body.mf-classic-v4.dark-mode .content-area .table-card,
body.mf-classic-v4.dark-mode .content-area .type-card {
  background: #182433 !important;
  color: #e8eff7 !important;
  border-color: #33465b !important;
}
body.mf-classic-v4.dark-mode .content-area .back-btn,
body.mf-classic-v4.dark-mode .content-area .cancel-btn {
  background: #26384c !important;
  color: #dce7f2 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .content-area [style*="background:#fff" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background: #fff" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background:#ffffff" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background: #ffffff" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background:white" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background: white" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background-color:#fff" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background-color: #fff" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background-color:white" i]:not(.btn):not(button),
body.mf-classic-v4.dark-mode .content-area [style*="background-color: white" i]:not(.btn):not(button) {
  background: #182433 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .content-area [style*="background:#fff" i] :is(p,span,strong,small,label,h1,h2,h3,h4,h5,h6,td,th),
body.mf-classic-v4.dark-mode .content-area [style*="background: #fff" i] :is(p,span,strong,small,label,h1,h2,h3,h4,h5,h6,td,th),
body.mf-classic-v4.dark-mode .content-area [style*="background:white" i] :is(p,span,strong,small,label,h1,h2,h3,h4,h5,h6,td,th),
body.mf-classic-v4.dark-mode .content-area [style*="background: white" i] :is(p,span,strong,small,label,h1,h2,h3,h4,h5,h6,td,th) {
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode .content-area [style*="color:#333" i],
body.mf-classic-v4.dark-mode .content-area [style*="color: #333" i],
body.mf-classic-v4.dark-mode .content-area [style*="color:#000" i],
body.mf-classic-v4.dark-mode .content-area [style*="color: #000" i],
body.mf-classic-v4.dark-mode .content-area [style*="color:black" i],
body.mf-classic-v4.dark-mode .content-area [style*="color: black" i] {
  color: #e8eff7 !important;
}


/* Bootstrap 5 semantic tokens keep utilities and third-party components in sync. */
body.mf-classic-v4:not(.dark-mode) {
  color-scheme: light;
  --bs-body-color: var(--mfv4-text);
  --bs-body-bg: var(--mfv4-background);
  --bs-border-color: var(--mfv4-border);
  --bs-secondary-color: #536477;
  --bs-tertiary-color: #66788a;
  --bs-secondary-bg: #f1f5f8;
  --bs-tertiary-bg: #f7f9fb;
  --bs-emphasis-color: #1f2937;
  --bs-card-bg: var(--mfv4-card);
  --bs-modal-bg: var(--mfv4-card);
  --bs-modal-color: var(--mfv4-text);
  --bs-dropdown-bg: var(--mfv4-card);
  --bs-dropdown-link-color: var(--mfv4-text);
  --bs-table-bg: var(--mfv4-card);
  --bs-table-color: var(--mfv4-text);
  --bs-table-border-color: var(--mfv4-border);
}
body.mf-classic-v4.dark-mode {
  --bs-body-color: #e8eff7;
  --bs-body-bg: #101722;
  --bs-border-color: #40536a;
  --bs-secondary-color: #bdcad8;
  --bs-tertiary-color: #9aabbd;
  --bs-secondary-bg: #202f40;
  --bs-tertiary-bg: #1b2939;
  --bs-emphasis-color: #f5f8fc;
  --bs-card-bg: #182433;
  --bs-modal-bg: #182433;
  --bs-modal-color: #e8eff7;
  --bs-modal-border-color: #40536a;
  --bs-dropdown-bg: #1b2939;
  --bs-dropdown-link-color: #dce7f2;
  --bs-dropdown-link-hover-bg: #293b50;
  --bs-table-bg: #182433;
  --bs-table-color: #dce7f2;
  --bs-table-border-color: #33465b;
  --bs-table-striped-bg: #1e2d3d;
  --bs-table-striped-color: #e8eff7;
  --bs-link-color: #8fd5ef;
  --bs-link-hover-color: #b6e9f8;
}
body.mf-classic-v4.dark-mode .content-area .bg-light,
body.mf-classic-v4.dark-mode .content-area .bg-white,
body.mf-classic-v4.dark-mode .content-area .alert-light {
  background: #202f40 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .content-area .text-dark,
body.mf-classic-v4.dark-mode .content-area .link-dark {
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode .content-area .border-light {
  border-color: #40536a !important;
}


/* Authentication pages follow the same selected theme as the application. */
body.mf-classic-v4.dark-mode .login-page {
  background: radial-gradient(circle at 18% 12%, #20354a 0%, #101722 48%, #0c1420 100%) !important;
  color: #e8eff7 !important;
}
body.mf-classic-v4.dark-mode .login-card {
  background: #182433 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
  border-top-color: var(--mfv4-primary) !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.32) !important;
}
body.mf-classic-v4.dark-mode .login-card h1,
body.mf-classic-v4.dark-mode .login-card h2,
body.mf-classic-v4.dark-mode .login-card h3,
body.mf-classic-v4.dark-mode .login-card h4,
body.mf-classic-v4.dark-mode .login-card .brand-title {
  color: #edf3fa !important;
}
body.mf-classic-v4.dark-mode .login-card .brand-subtitle,
body.mf-classic-v4.dark-mode .login-card .login-options .form-check-label,
body.mf-classic-v4.dark-mode .login-card .form-label {
  color: #b7c6d5 !important;
}
body.mf-classic-v4.dark-mode .login-card .input-group {
  background: #202f40 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .login-card .input-group-text {
  background: #26384c !important;
  color: #c8d5e3 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .login-card .form-control {
  background: #202f40 !important;
  color: #edf3fa !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .login-card .form-control::placeholder { color: #a1b1c3 !important; }
body.mf-classic-v4.dark-mode .login-options a,
body.mf-classic-v4.dark-mode .login-footer a { color: #8fd5ef !important; }

/* Chart labels and tooltips remain readable in dark mode. */
body.mf-classic-v4.dark-mode .apexcharts-text,
body.mf-classic-v4.dark-mode .apexcharts-legend-text {
  fill: #cbd7e4 !important;
  color: #cbd7e4 !important;
}
body.mf-classic-v4.dark-mode .apexcharts-gridline { stroke: #33465b !important; }
body.mf-classic-v4.dark-mode .apexcharts-tooltip,
body.mf-classic-v4.dark-mode .apexcharts-xaxistooltip,
body.mf-classic-v4.dark-mode .apexcharts-yaxistooltip {
  background: #1b2939 !important;
  color: #e8eff7 !important;
  border-color: #40536a !important;
}
body.mf-classic-v4.dark-mode .apexcharts-tooltip-title {
  background: #26384c !important;
  color: #edf3fa !important;
  border-color: #40536a !important;
}

/* Printed invoices/reports stay paper-white regardless of the saved screen theme. */
@media print {
  body.mf-classic-v4,
  body.mf-classic-v4.dark-mode {
    color-scheme: light !important;
    background: #fff !important;
    color: #111 !important;
  }
  body.mf-classic-v4.dark-mode .content-area,
  body.mf-classic-v4.dark-mode .card,
  body.mf-classic-v4.dark-mode .card-modern,
  body.mf-classic-v4.dark-mode .form-card,
  body.mf-classic-v4.dark-mode .table,
  body.mf-classic-v4.dark-mode .table tbody tr,
  body.mf-classic-v4.dark-mode .table tbody td {
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    border-color: #d7dce2 !important;
  }
  body.mf-classic-v4.dark-mode .product-modal-overlay,
  body.mf-classic-v4.dark-mode .modal,
  body.mf-classic-v4.dark-mode .modal-backdrop {
    display: none !important;
  }
}
