/* ============================================================
   ERP 2026 – Modern Clean Theme
   ============================================================ */

/* Standard UI font: Helvetica everywhere (Arial as the metric-compatible
   fallback on systems without Helvetica, e.g. Windows). */
:root {
  --app-font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /* Override Bootstrap's body font so all its components inherit Helvetica. */
  --bs-body-font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --sidebar-bg:      #ffffff;
  --sidebar-border:  #e5e7eb;
  --sidebar-hover:   #f3f4f6;
  --sidebar-active-bg: #eff6ff;
  --sidebar-active:  #2563eb;
  --header-bg:       #ffffff;
  --header-border:   #e5e7eb;
  --accent:          #2563eb;
  --accent-hover:    #1d4ed8;
  --accent-light:    #eff6ff;
  --content-bg:      #f8fafc;
  --text-primary:    #111827;
  --text-secondary:  #6b7280;
  --text-sidebar:    #374151;
  --sidebar-width:   240px;
  --header-height:   60px;
  --radius:          10px;
  --shadow-sm:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:       0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);

  /* ── Type scale ──────────────────────────────────────────────
     One consistent ladder used across the app instead of ad-hoc
     per-element sizes. Roughly a 1.125 (major-second) scale on a
     14.4px base. Use these everywhere new UI is written. */
  --fs-2xs:  .68rem;   /* ~10.9px — micro labels (badge captions) */
  --fs-xs:   .75rem;   /* ~12px   — table headers, helper text */
  --fs-sm:   .82rem;   /* ~13px   — secondary text, small buttons */
  --fs-base: .9rem;    /* ~14.4px — body / table cells (default) */
  --fs-md:   1rem;     /* ~16px   — emphasized values */
  --fs-lg:   1.15rem;  /* ~18.4px — card / section titles */
  --fs-xl:   1.4rem;   /* ~22.4px — page titles (h1) */
  --fs-2xl:  1.75rem;  /* ~28px   — big stat numbers */
  --lh-tight: 1.25;
  --lh-base:  1.5;
}

/* ── Reset / Base ── */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--app-font);
  background: var(--content-bg);
  color: var(--text-primary);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}

/* Force form controls / buttons to inherit the app font (some browsers and
   Bootstrap resets fall back to the platform UI font otherwise). Monospace is
   preserved where it's intentional (code blocks, barcodes) via .font-monospace
   and explicit monospace rules elsewhere. */
button, input, select, textarea, optgroup,
.btn, .form-control, .form-select, .dropdown-menu, .badge, .nav, .modal {
  font-family: var(--app-font);
}

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #3b82f6 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  border: none;
  box-shadow: var(--shadow-md);
}
.login-card .card-body { padding: 2.5rem !important; }

/* ── Layout Wrapper ── */
.erp-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ── */
.erp-header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}
.erp-logo span {
  letter-spacing: -.3px;
  color: var(--text-primary) !important;
  font-weight: 700;
}
.erp-logo .bi-eye-fill { color: var(--accent) !important; }

/* Header user area */
.erp-header .btn-outline-light {
  border-color: #e5e7eb;
  color: var(--text-secondary);
  font-size: .82rem;
  padding: .3rem .75rem;
}
.erp-header .btn-outline-light:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
  border-color: #d1d5db;
}
.erp-header .small { color: var(--text-secondary) !important; font-size: .85rem; }
.erp-header .badge.bg-warning {
  background: var(--accent-light) !important;
  color: var(--accent) !important;
  font-weight: 600;
}

/* Language dropdown */
.erp-header .btn-outline-light.dropdown-toggle {
  background: transparent;
}

/* ── Body ── */
.erp-body { margin-top: var(--header-height); flex: 1; }

/* ── Sidebar ── */
.erp-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-height);
  left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 900;
  padding: 8px 10px 24px;
  display: flex;
  flex-direction: column;
}

/* Sidebar scrollbar */
.erp-sidebar::-webkit-scrollbar { width: 4px; }
.erp-sidebar::-webkit-scrollbar-track { background: transparent; }
.erp-sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Sidebar section labels — clearly readable group headers (were too faint). */
.erp-menu-section {
  font-size: .74rem;
  font-weight: 800;
  color: #475569;            /* slate-600: prominent but not as loud as items */
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 15px 12px 5px;
}

.erp-menu { padding-top: 2px; }

/* Collapsible section headers */
.erp-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  /* inherit the .erp-menu-section look (it's applied alongside) */
}
.erp-group-toggle:hover { color: var(--accent); }
.erp-group-right { display: inline-flex; align-items: center; gap: 6px; }
.erp-group-chevron { font-size: .72rem; opacity: .75; transition: transform .15s ease; }
.erp-menu-group.collapsed .erp-group-chevron { transform: rotate(-90deg); }
.erp-menu-group.collapsed .erp-group-body { display: none; }
/* The header aggregate badge only matters while the group is collapsed. */
.erp-group-badge { display: none; }
.erp-menu-group.collapsed .erp-group-badge { display: inline-block; }

.erp-menu-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: .855rem;
  font-weight: 500;
  transition: background .12s, color .12s;
  border-radius: 8px;
  margin-bottom: 1px;
  border-left: none;
  gap: 9px;
}

.erp-menu-item i { font-size: .95rem; opacity: .75; flex-shrink: 0; }

.erp-menu-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}
.erp-menu-item:hover i { opacity: 1; }

.erp-menu-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
}
.erp-menu-item.active i { opacity: 1; color: var(--sidebar-active); }

/* Sidebar bottom area (logout) */
.erp-sidebar-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  padding: 8px 10px;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--sidebar-border);
  border-right: 1px solid var(--sidebar-border);
}
.erp-sidebar-bottom .erp-menu-item {
  color: #9ca3af;
  font-size: .82rem;
}
.erp-sidebar-bottom .erp-menu-item:hover {
  background: #fef2f2;
  color: #dc2626;
}
.erp-sidebar-bottom .erp-menu-item.text-danger { color: #9ca3af; }

/* ── Main Content ── */
.erp-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  min-height: calc(100vh - var(--header-height));
}

/* ── Page Header ── */
.erp-page-header h1 {
  color: var(--text-primary);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.3px;
}
.erp-page-header .text-muted { color: var(--text-secondary) !important; }

/* ── Stat Cards ── */
.stat-card {
  border-radius: var(--radius);
  border: 1px solid #f0f0f0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-icon {
  padding: 12px;
  font-size: 1.5rem;
  border-radius: 10px;
}

/* ── Cards ── */
.card {
  border-radius: var(--radius);
  border: 1px solid #f0f2f5;
  box-shadow: var(--shadow-sm);
}
.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-size: .875rem;
  font-weight: 600;
  background: #fff;
  border-bottom: 1px solid #f0f2f5;
  padding: .9rem 1.25rem;
}

/* ── Tables ── */
.table {
  font-size: var(--fs-base);
}
.table thead th {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  background: #f8fafc !important;
  border-bottom: 1px solid #e5e7eb;
  padding: .75rem 1rem;
  white-space: nowrap;
}
/* Keep small-table variants genuinely smaller but consistent. */
.table-sm { font-size: var(--fs-sm); }

/* ── Resizable columns (col-resize.js) ── */
table[data-resizable] thead th { position: relative; }
.erp-col-grip {
  position: absolute;
  top: 0; right: 0;
  width: 7px; height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}
.erp-col-grip:hover { background: var(--accent); opacity: .35; }
body.erp-col-resizing { cursor: col-resize; user-select: none; }
body.erp-col-resizing * { cursor: col-resize !important; }
.table thead.table-dark th {
  background: #f8fafc !important;
  color: var(--text-secondary) !important;
}
.table tbody td {
  padding: .75rem 1rem;
  vertical-align: middle;
  border-color: #f0f2f5;
  color: var(--text-primary);
}
.table tbody tr:hover td { background: #f8fafc; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background: transparent; }

/* ── Buttons ── */
.btn {
  font-size: .855rem;
  font-weight: 500;
  border-radius: 7px;
  padding: .42rem .9rem;
  transition: all .15s;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-outline-primary {
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}
.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}
.btn-sm { font-size: .8rem; padding: .3rem .7rem; border-radius: 6px; }
.btn-outline-secondary {
  border-color: #e5e7eb;
  color: var(--text-secondary);
}
.btn-outline-secondary:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
  border-color: #d1d5db;
}

/* ── Badges ── */
.badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: .3em .65em;
  border-radius: 5px;
}
.badge.bg-success { background: #dcfce7 !important; color: #16a34a !important; }
.badge.bg-danger  { background: #fee2e2 !important; color: #dc2626 !important; }
.badge.bg-warning { background: #fef3c7 !important; color: #d97706 !important; }
.badge.bg-primary { background: var(--accent-light) !important; color: var(--accent) !important; }
.badge.bg-secondary { background: #f3f4f6 !important; color: #6b7280 !important; }

/* ── Alerts ── */
.alert { border-radius: 8px; border: none; font-size: .875rem; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-danger   { background: #fee2e2; color: #b91c1c; }
.alert-warning  { background: #fef3c7; color: #92400e; }
.alert-info     { background: var(--accent-light); color: #1e40af; }

/* ── Forms ── */
.form-control, .form-select {
  border-color: #e5e7eb;
  border-radius: 7px;
  font-size: .875rem;
  padding: .45rem .75rem;
  color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}
.input-group-text {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: var(--text-secondary);
}

/* ── Product Editor Tabs ── */
.product-tabs {
  border-bottom: 2px solid #e5e7eb;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.product-tabs::-webkit-scrollbar { display: none; }
.product-tabs .nav-link {
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 500;
  padding: .6rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  border-radius: 0;
  transition: color .15s, border-color .15s;
}
.product-tabs .nav-link:hover {
  color: var(--text-primary);
  border-bottom-color: #d1d5db;
  background: none;
}
.product-tabs .nav-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: none;
  font-weight: 600;
}
.product-tabs .nav-link .badge {
  vertical-align: middle;
}

/* ── Breadcrumb ── */
.breadcrumb-erp {
  font-size: .8rem;
  background: none;
  padding: 0;
}
.breadcrumb-erp .breadcrumb-item a {
  color: var(--text-secondary);
  text-decoration: none;
}
.breadcrumb-erp .breadcrumb-item a:hover { color: var(--accent); }
.breadcrumb-erp .breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }
.breadcrumb-erp .breadcrumb-item + .breadcrumb-item::before { color: #d1d5db; }

/* ── Pagination ── */
.page-link {
  color: var(--accent);
  border-color: #e5e7eb;
  border-radius: 6px !important;
  margin: 0 2px;
  font-size: .82rem;
}
.page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Dropdowns ── */
.dropdown-menu {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: .875rem;
  padding: .4rem;
}
.dropdown-item {
  border-radius: 6px;
  padding: .45rem .8rem;
  color: var(--text-primary);
}
.dropdown-item:hover { background: var(--sidebar-hover); }
.dropdown-item.active { background: var(--accent-light); color: var(--accent); }

/* ── Modals ── */
.modal-content {
  border-radius: 14px;
  border: none;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-header {
  border-bottom: 1px solid #f0f2f5;
  padding: 1.2rem 1.5rem;
}
.modal-footer {
  border-top: 1px solid #f0f2f5;
  padding: 1rem 1.5rem;
}

/* ── Progress ── */
.progress { border-radius: 99px; background: #f0f2f5; }
.progress-bar { border-radius: 99px; background: var(--accent); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .erp-sidebar { display: none; }
  .erp-content { margin-left: 0; padding: 16px; }
}

/* ============================================================
   Loading overlay (ERP.loading)
   ============================================================ */
.erp-loading-overlay {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(2px);
}
.erp-loading-overlay.is-active { display: flex; }
.erp-loading-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: .5rem; color: #fff; font-weight: 500;
}
.erp-loading-label { font-size: .9rem; opacity: .9; }

/* ============================================================
   Theme toggle button (header)
   ============================================================ */
.erp-theme-toggle {
  border: 1px solid #e5e7eb;
  background: transparent;
  color: var(--text-secondary);
  width: 34px; height: 34px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.erp-theme-toggle:hover { background: var(--sidebar-hover); color: var(--text-primary); }

/* ============================================================
   Dark theme
   ============================================================ */
[data-bs-theme="dark"] {
  --sidebar-bg:        #111827;
  --sidebar-border:    #1f2937;
  --sidebar-hover:     #1f2937;
  --sidebar-active-bg: #1e3a8a33;
  --sidebar-active:    #60a5fa;
  --header-bg:         #0f172a;
  --header-border:     #1f2937;
  --accent:            #3b82f6;
  --accent-hover:      #2563eb;
  --accent-light:      #1e3a8a33;
  --content-bg:        #0b1220;
  --text-primary:      #e5e7eb;
  --text-secondary:    #9ca3af;
  --text-sidebar:      #d1d5db;
}
[data-bs-theme="dark"] body { background: var(--content-bg); color: var(--text-primary); }

/* Headings, generic content */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] p,
[data-bs-theme="dark"] label,
[data-bs-theme="dark"] span,
[data-bs-theme="dark"] div { color: inherit; }
[data-bs-theme="dark"] a { color: #93c5fd; }
[data-bs-theme="dark"] a:hover { color: #bfdbfe; }
[data-bs-theme="dark"] code,
[data-bs-theme="dark"] kbd,
[data-bs-theme="dark"] pre { background: #0f172a; color: #f1f5f9; border-color: #1f2937; }

/* Sidebar + header backgrounds use CSS vars, but menu text needs explicit colors */
[data-bs-theme="dark"] .erp-sidebar { background: var(--sidebar-bg); border-color: var(--sidebar-border); }
[data-bs-theme="dark"] .erp-header  { background: var(--header-bg);  border-color: var(--header-border); }
[data-bs-theme="dark"] .erp-menu-item { color: var(--text-sidebar); }
[data-bs-theme="dark"] .erp-menu-item:hover { background: var(--sidebar-hover); color: #fff; }
[data-bs-theme="dark"] .erp-menu-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); }
[data-bs-theme="dark"] .erp-menu-section { color: #94a3b8; }
[data-bs-theme="dark"] .erp-group-toggle:hover { color: #e5e7eb; }
[data-bs-theme="dark"] .erp-sidebar-bottom { border-color: var(--sidebar-border); }
[data-bs-theme="dark"] .erp-sidebar::-webkit-scrollbar-thumb { background: #374151; }
[data-bs-theme="dark"] .erp-logo span { color: var(--text-primary) !important; }
[data-bs-theme="dark"] .erp-content { background: var(--content-bg); }

/* Cards */
[data-bs-theme="dark"] .card { background: #111827; border-color: #1f2937; color: var(--text-primary); }
[data-bs-theme="dark"] .card-header { background: #0f172a; border-color: #1f2937; color: var(--text-primary); }
[data-bs-theme="dark"] .card-footer { background: #0f172a; border-color: #1f2937; color: var(--text-primary); }
[data-bs-theme="dark"] .card-title { color: var(--text-primary); }

/* Tables — high-contrast headers and borders */
[data-bs-theme="dark"] .table {
  --bs-table-bg:           transparent;
  --bs-table-color:        #e5e7eb;
  --bs-table-striped-bg:   rgba(255,255,255,.03);
  --bs-table-striped-color:#e5e7eb;
  --bs-table-hover-bg:     rgba(255,255,255,.05);
  --bs-table-hover-color:  #fff;
  --bs-table-border-color: #1f2937;
  color: var(--text-primary);
  border-color: #1f2937;
}
[data-bs-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent;
  color: var(--text-primary);
  border-bottom-color: #1f2937;
}
[data-bs-theme="dark"] .table thead,
[data-bs-theme="dark"] .table thead.table-light,
[data-bs-theme="dark"] .table > thead > tr > th {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #1f2937 !important;
}
[data-bs-theme="dark"] .table tbody tr { border-color: #1f2937; }
[data-bs-theme="dark"] .table tbody tr:hover > td { background: rgba(255,255,255,.04); }
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .bg-light { background: #0f172a !important; color: var(--text-primary) !important; }

/* Form controls */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background: #0b1220; border-color: #1f2937; color: var(--text-primary);
}
[data-bs-theme="dark"] .form-control::placeholder { color: #6b7280; }
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background: #0b1220; color: var(--text-primary);
  border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .25);
}
[data-bs-theme="dark"] .form-label { color: var(--text-primary); }
[data-bs-theme="dark"] .form-check-input { background-color: #0b1220; border-color: #374151; }
[data-bs-theme="dark"] .form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* Dropdowns */
[data-bs-theme="dark"] .dropdown-menu { background: #111827; border-color: #1f2937; }
[data-bs-theme="dark"] .dropdown-item { color: var(--text-primary); }
[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus { background: var(--sidebar-hover); color: #fff; }
[data-bs-theme="dark"] .dropdown-divider { border-color: #1f2937; }

/* Modal */
[data-bs-theme="dark"] .modal-content { background: #111827; color: var(--text-primary); border-color: #1f2937; }
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer { border-color: #1f2937; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(2); }

/* Header area + user chip */
[data-bs-theme="dark"] .erp-header .btn-outline-secondary { color: var(--text-primary); border-color: #1f2937; background: transparent; }
[data-bs-theme="dark"] .erp-header .btn-outline-secondary:hover { background: var(--sidebar-hover); }
[data-bs-theme="dark"] .erp-header div[style*="background:#f3f4f6"],
[data-bs-theme="dark"] .erp-header [style*="background:#f3f4f6"] { background: #1f2937 !important; }
[data-bs-theme="dark"] .erp-theme-toggle { border-color: #1f2937; color: #d1d5db; }
[data-bs-theme="dark"] .erp-theme-toggle:hover { background: #1f2937; color: #fff; }

/* Buttons — outline variants need lighter borders in dark */
[data-bs-theme="dark"] .btn-outline-secondary { color: #d1d5db; border-color: #374151; }
[data-bs-theme="dark"] .btn-outline-secondary:hover { background: #1f2937; color: #fff; border-color: #4b5563; }
[data-bs-theme="dark"] .btn-light { background: #1f2937; border-color: #1f2937; color: var(--text-primary); }
[data-bs-theme="dark"] .btn-light:hover { background: #374151; color: #fff; }

/* Alerts */
[data-bs-theme="dark"] .alert-info    { background: #0c4a6e33; color: #bae6fd; border-color: #0c4a6e; }
[data-bs-theme="dark"] .alert-success { background: #064e3b33; color: #bbf7d0; border-color: #064e3b; }
[data-bs-theme="dark"] .alert-warning { background: #78350f33; color: #fde68a; border-color: #78350f; }
[data-bs-theme="dark"] .alert-danger  { background: #7f1d1d33; color: #fecaca; border-color: #7f1d1d; }

/* Breadcrumb */
[data-bs-theme="dark"] .breadcrumb { background: transparent; }
[data-bs-theme="dark"] .breadcrumb-item,
[data-bs-theme="dark"] .breadcrumb-item a { color: var(--text-secondary); }
[data-bs-theme="dark"] .breadcrumb-item.active { color: var(--text-primary); }
[data-bs-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: #4b5563; }

/* Pagination */
[data-bs-theme="dark"] .page-link { background: #111827; border-color: #1f2937; color: var(--text-primary); }
[data-bs-theme="dark"] .page-link:hover { background: #1f2937; color: #fff; }
[data-bs-theme="dark"] .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-bs-theme="dark"] .page-item.disabled .page-link { background: #0f172a; color: #6b7280; }

/* Badges */
[data-bs-theme="dark"] .badge.bg-light { background: #1f2937 !important; color: var(--text-primary) !important; }

/* Progress */
[data-bs-theme="dark"] .progress { background: #1f2937; }

/* Muted text */
[data-bs-theme="dark"] .text-muted,
[data-bs-theme="dark"] .text-secondary { color: #9ca3af !important; }
[data-bs-theme="dark"] small { color: inherit; }

/* Generic borders */
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end { border-color: #1f2937 !important; }

/* Inline style overrides scattered across views */
[data-bs-theme="dark"] [style*="background:#f0f2f5"],
[data-bs-theme="dark"] [style*="background: #f0f2f5"],
[data-bs-theme="dark"] [style*="background:#f8fafc"],
[data-bs-theme="dark"] [style*="background:#f3f4f6"],
[data-bs-theme="dark"] [style*="background: #f3f4f6"] { background: #1f2937 !important; color: var(--text-primary) !important; }
[data-bs-theme="dark"] [style*="color:#6b7280"],
[data-bs-theme="dark"] [style*="color: #6b7280"],
[data-bs-theme="dark"] [style*="color:#374151"],
[data-bs-theme="dark"] [style*="color:#111827"],
[data-bs-theme="dark"] [style*="color: #111827"] { color: var(--text-primary) !important; }

/* ------------------------------------------------------------------
   Dark-mode overrides for hardcoded Bootstrap utility classes that
   otherwise force a light background/foreground and produce a mixed
   light/dark appearance on pages like inventory/receipts.
   ------------------------------------------------------------------ */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-body,
[data-bs-theme="dark"] .bg-body-tertiary { background-color: #111827 !important; color: var(--text-primary) !important; }
[data-bs-theme="dark"] .text-dark { color: var(--text-primary) !important; }
[data-bs-theme="dark"] .text-black { color: var(--text-primary) !important; }
[data-bs-theme="dark"] .text-body { color: var(--text-primary) !important; }
[data-bs-theme="dark"] .shadow-sm,
[data-bs-theme="dark"] .shadow { box-shadow: 0 1px 2px rgba(0,0,0,.5) !important; }

/* Nav tabs / pills inside dark theme */
[data-bs-theme="dark"] .nav-tabs { border-color: #1f2937; }
[data-bs-theme="dark"] .nav-tabs .nav-link { color: var(--text-secondary); background: transparent; border-color: transparent; }
[data-bs-theme="dark"] .nav-tabs .nav-link:hover { color: var(--text-primary); border-color: #1f2937 #1f2937 transparent; }
[data-bs-theme="dark"] .nav-tabs .nav-link.active,
[data-bs-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    background: #111827;
    color: var(--text-primary);
    border-color: #1f2937 #1f2937 #111827;
}
[data-bs-theme="dark"] .tab-content,
[data-bs-theme="dark"] .tab-content.bg-white { background-color: #111827 !important; color: var(--text-primary); border-color: #1f2937 !important; }
[data-bs-theme="dark"] .nav-pills .nav-link { color: var(--text-secondary); }
[data-bs-theme="dark"] .nav-pills .nav-link.active { background: var(--accent); color: #fff; }

/* Accordion / list-group commonly used on receipts & reports */
[data-bs-theme="dark"] .accordion-item,
[data-bs-theme="dark"] .accordion-button { background: #111827; color: var(--text-primary); border-color: #1f2937; }
[data-bs-theme="dark"] .accordion-button:not(.collapsed) { background: #0f172a; color: var(--text-primary); box-shadow: none; }
[data-bs-theme="dark"] .list-group-item { background: #111827; color: var(--text-primary); border-color: #1f2937; }

/* Header utility pills (search/user chip) that used inline light bg */
[data-bs-theme="dark"] .erp-header .bg-white,
[data-bs-theme="dark"] .erp-header .bg-light { background: #1f2937 !important; }

/* Inputs inside input-group / datalist on dark pages */
[data-bs-theme="dark"] textarea.form-control,
[data-bs-theme="dark"] select.form-select,
[data-bs-theme="dark"] input.form-control {
    background-color: #0b1220;
    color: var(--text-primary);
    border-color: #1f2937;
}
[data-bs-theme="dark"] input[type="date"].form-control,
[data-bs-theme="dark"] input[type="number"].form-control { color-scheme: dark; }

/* Tables with Bootstrap `table-bordered` & striped rows */
[data-bs-theme="dark"] .table-bordered { border-color: #1f2937; }
[data-bs-theme="dark"] .table-bordered > :not(caption) > * > * { border-color: #1f2937; }
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { background: rgba(255,255,255,.02); color: var(--text-primary); }
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * { background: rgba(255,255,255,.05); color: var(--text-primary); }

/* Generic inline "light" surfaces frequently used across views */
[data-bs-theme="dark"] [style*="background:#fff"],
[data-bs-theme="dark"] [style*="background: #fff"],
[data-bs-theme="dark"] [style*="background:#ffffff"],
[data-bs-theme="dark"] [style*="background: #ffffff"],
[data-bs-theme="dark"] [style*="background-color:#fff"],
[data-bs-theme="dark"] [style*="background-color: #fff"] { background: #111827 !important; color: var(--text-primary) !important; }

/* Print-sheet surfaces (barcode, receipts) — keep white ONLY on @media print */
@media not print {
    [data-bs-theme="dark"] .print-sheet,
    [data-bs-theme="dark"] .receipt-sheet { background: #111827; color: var(--text-primary); }
}
