html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ── Smooth transition when toggling dark/light ── */
body, body *,
body *::before,
body *::after {
  transition:
    background-color 0.25s ease,
    background     0.25s ease,
    color          0.2s  ease,
    border-color   0.25s ease,
    box-shadow     0.25s ease !important;
}

/* ════════════════════════════════════════
   DARK MODE — COMPREHENSIVE SYSTEM
   ════════════════════════════════════════ */

/* ── Light mode explicit ── */
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="light"] body {
  background: #f8fafc !important;
  color: #1e293b !important;
}

/* ── CSS Variables ── */
html[data-theme="dark"] {
  --dm-bg:          #0f172a;
  --dm-bg2:         #1e293b;
  --dm-bg3:         #273549;
  --dm-border:      #334155;
  --dm-text:        #e2e8f0;
  --dm-text2:       #94a3b8;
  --dm-text3:       #64748b;
  --dm-input-bg:    #1e293b;
  --dm-card-bg:     #1e293b;
  --dm-hover:       #334155;
  --dm-header-bg:   #1a2744;
  color-scheme: dark;

  /* ── override dashboard-styles.css & sidebar-layout.css vars ── */
  /* هذا يحوّل كل العناصر اللي تستخدم هذه المتغيرات تلقائياً */
  --white:    #1e293b;
  --dark:     #e2e8f0;
  --gray:     #94a3b8;
  --light:    #273549;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.45);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.5);
}

/* ── Body & Page ── */
html[data-theme="dark"] body {
  background: linear-gradient(180deg, #0f172a 0%, #1a1f35 100%) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .bg-decoration { display: none; }
html[data-theme="dark"] .main-wrapper { background: transparent; }
html[data-theme="dark"] .content-area { background: transparent; }

/* ── Generic elements — كل عنصر يرث اللون من الـ body ── */
html[data-theme="dark"] div:not([style*="color:"]),
html[data-theme="dark"] p:not([style*="color:"]),
html[data-theme="dark"] span:not([style*="color:"]),
html[data-theme="dark"] li:not([style*="color:"]),
html[data-theme="dark"] td:not([style*="color:"]),
html[data-theme="dark"] th:not([style*="color:"]),
html[data-theme="dark"] small:not([style*="color:"]),
html[data-theme="dark"] a:not(.btn):not([style*="color:"]),
html[data-theme="dark"] strong:not([style*="color:"]) { color: var(--dm-text); }

/* ── Headings ── */
html[data-theme="dark"] h1, html[data-theme="dark"] h2,
html[data-theme="dark"] h3, html[data-theme="dark"] h4,
html[data-theme="dark"] h5, html[data-theme="dark"] h6 { color: var(--dm-text) !important; }
html[data-theme="dark"] label { color: var(--dm-text) !important; }
html[data-theme="dark"] .create-title { -webkit-text-fill-color: var(--dm-text) !important; }

/* ── Top Navbar ── */
html[data-theme="dark"] .top-navbar {
  background: rgba(15,23,42,.95) !important;
  border-bottom-color: var(--dm-border) !important;
  backdrop-filter: blur(12px);
}
html[data-theme="dark"] .top-navbar .user-name-text,
html[data-theme="dark"] .top-navbar .user-role-text { color: var(--dm-text) !important; }
html[data-theme="dark"] #darkModeToggle {
  background: rgba(255,255,255,.1) !important;
  border-color: rgba(255,255,255,.2) !important;
  color: rgba(255,255,255,.9) !important;
}

/* ── Footer ── */
html[data-theme="dark"] .footer-bar {
  background: rgba(15,23,42,.9) !important;
  border-top-color: var(--dm-border) !important;
  color: var(--dm-text2) !important;
}
html[data-theme="dark"] .footer-copy,
html[data-theme="dark"] .footer-center { color: var(--dm-text2) !important; }

/* ════ BOOTSTRAP COMPONENTS ════ */

/* Cards */
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}

/* Modals */
html[data-theme="dark"] .modal-content {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .modal-header {
  background: var(--dm-bg3) !important;
  border-bottom-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .modal-footer { border-top-color: var(--dm-border) !important; }
html[data-theme="dark"] .modal-title { color: var(--dm-text) !important; }
html[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.7); }

/* Dropdowns */
html[data-theme="dark"] .dropdown-menu {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.4) !important;
}
html[data-theme="dark"] .dropdown-item { color: var(--dm-text) !important; }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background: var(--dm-hover) !important; }
html[data-theme="dark"] .dropdown-divider { border-color: var(--dm-border) !important; }

/* Tables */
html[data-theme="dark"] .table {
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table thead td {
  background: var(--dm-bg3) !important;
  color: var(--dm-text2) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .table tbody tr { background: var(--dm-card-bg) !important; }
html[data-theme="dark"] .table tbody tr:nth-child(even) { background: var(--dm-bg2) !important; }
html[data-theme="dark"] .table tbody tr:hover td,
html[data-theme="dark"] .table tbody tr:hover th { background: var(--dm-hover) !important; }
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table th { border-color: var(--dm-border) !important; color: var(--dm-text) !important; }
html[data-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd)>* { background: var(--dm-bg2) !important; }

/* Forms */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  background: var(--dm-input-bg) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  background: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
  border-color: #6366f1 !important;
}
html[data-theme="dark"] .form-check-label { color: var(--dm-text) !important; }
html[data-theme="dark"] .form-check-input {
  background-color: var(--dm-bg3) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .form-check-input:checked { background-color: #6366f1 !important; border-color: #6366f1 !important; }
html[data-theme="dark"] .form-text { color: var(--dm-text2) !important; }
html[data-theme="dark"] .form-label { color: var(--dm-text) !important; }
html[data-theme="dark"] .input-group-text {
  background: var(--dm-bg3) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}

/* Alerts */
html[data-theme="dark"] .alert {
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .alert-info    { background: rgba(14,165,233,.15)  !important; color: #7dd3fc !important; }
html[data-theme="dark"] .alert-success { background: rgba(16,185,129,.15)  !important; color: #6ee7b7 !important; }
html[data-theme="dark"] .alert-danger  { background: rgba(239,68,68,.15)   !important; color: #fca5a5 !important; }
html[data-theme="dark"] .alert-warning { background: rgba(245,158,11,.15)  !important; color: #fcd34d !important; }
html[data-theme="dark"] .alert-primary { background: rgba(99,102,241,.15)  !important; color: #c4b5fd !important; }
html[data-theme="dark"] .alert-secondary { background: var(--dm-bg3) !important; color: var(--dm-text2) !important; }

/* Badges */
html[data-theme="dark"] .badge.bg-light { background: var(--dm-bg3) !important; color: var(--dm-text) !important; }
html[data-theme="dark"] .badge.text-dark { color: var(--dm-text) !important; }

/* List Groups */
html[data-theme="dark"] .list-group-item {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .list-group-item:hover { background: var(--dm-hover) !important; }
html[data-theme="dark"] .list-group-item.active {
  background: #6366f1 !important;
  border-color: #6366f1 !important;
}

/* Nav Tabs / Pills */
html[data-theme="dark"] .nav-tabs { border-bottom-color: var(--dm-border) !important; }
html[data-theme="dark"] .nav-tabs .nav-link { color: var(--dm-text2) !important; }
html[data-theme="dark"] .nav-tabs .nav-link:hover { color: var(--dm-text) !important; }
html[data-theme="dark"] .nav-tabs .nav-link.active {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) var(--dm-border) var(--dm-card-bg) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .tab-content { background: transparent; }
html[data-theme="dark"] .nav-pills .nav-link { color: var(--dm-text2) !important; }
html[data-theme="dark"] .nav-pills .nav-link.active {
  background: #6366f1 !important;
  color: #fff !important;
}

/* Buttons — light variants */
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-light {
  background: var(--dm-bg3) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .btn-outline-secondary {
  border-color: var(--dm-border) !important;
  color: var(--dm-text2) !important;
}
html[data-theme="dark"] .btn-outline-secondary:hover {
  background: var(--dm-hover) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .btn-close { filter: invert(1); }

/* Pagination */
html[data-theme="dark"] .page-link {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .page-link:hover { background: var(--dm-hover) !important; }
html[data-theme="dark"] .page-item.active .page-link { background: #6366f1 !important; border-color: #6366f1 !important; }
html[data-theme="dark"] .page-item.disabled .page-link { background: var(--dm-bg3) !important; color: var(--dm-text3) !important; }

/* Progress */
html[data-theme="dark"] .progress { background: var(--dm-bg3) !important; }

/* Accordion */
html[data-theme="dark"] .accordion-item { background: var(--dm-card-bg) !important; border-color: var(--dm-border) !important; }
html[data-theme="dark"] .accordion-button {
  background: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .accordion-button:not(.collapsed) { background: var(--dm-hover) !important; }
html[data-theme="dark"] .accordion-body { background: var(--dm-card-bg) !important; color: var(--dm-text) !important; }

/* Tooltip / Popover */
html[data-theme="dark"] .tooltip-inner { background: var(--dm-bg3) !important; color: var(--dm-text) !important; }
html[data-theme="dark"] .popover { background: var(--dm-card-bg) !important; border-color: var(--dm-border) !important; }
html[data-theme="dark"] .popover-header { background: var(--dm-bg3) !important; border-color: var(--dm-border) !important; color: var(--dm-text) !important; }
html[data-theme="dark"] .popover-body { color: var(--dm-text) !important; }

/* ════ CUSTOM APP COMPONENTS ════ */

/* Inline white/light backgrounds */
html[data-theme="dark"] .table-card-drugs,
html[data-theme="dark"] .barcode-check-card,
html[data-theme="dark"] .form-card-create,
html[data-theme="dark"] .search-card,
html[data-theme="dark"] .stat-card-drug,
html[data-theme="dark"] .dmp-card,
html[data-theme="dark"] .create-header,
html[data-theme="dark"] .drugs-header {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}

/* Stats Cards */
html[data-theme="dark"] .stat-card-drug { background: var(--dm-card-bg) !important; border-color: var(--dm-border) !important; }
html[data-theme="dark"] .stat-label-drug,
html[data-theme="dark"] .stat-sub-drug { color: var(--dm-text2) !important; }
html[data-theme="dark"] .stat-value-drug { color: var(--dm-text) !important; }

/* Modern Tables */
html[data-theme="dark"] .modern-table-drugs thead th {
  background: var(--dm-bg3) !important;
  color: var(--dm-text2) !important;
  border-bottom-color: var(--dm-border) !important;
}
html[data-theme="dark"] .modern-table-drugs tbody td {
  background: var(--dm-card-bg) !important;
  color: var(--dm-text) !important;
  border-bottom-color: var(--dm-border) !important;
}
html[data-theme="dark"] .modern-table-drugs tbody tr:hover td { background: var(--dm-hover) !important; }

/* Inputs (custom) */
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .form-control-custom,
html[data-theme="dark"] .barcode-check-field,
html[data-theme="dark"] .dmp-add-bc-input,
html[data-theme="dark"] .sd-search-input,
html[data-theme="dark"] .search-input {
  background: var(--dm-input-bg) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--dm-text3) !important; }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }

/* Filter / Page-size Buttons */
html[data-theme="dark"] .filter-btn {
  background: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .filter-btn.active {
  background: var(--gradient-primary) !important;
  color: #fff !important;
}
html[data-theme="dark"] .pagination-controls-top,
html[data-theme="dark"] .page-size-btn {
  background: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .page-size-btn.active {
  background: var(--gradient-primary) !important;
  color: #fff !important;
}
html[data-theme="dark"] .page-size-label { color: var(--dm-text2) !important; }

/* Searchable Dropdown */
html[data-theme="dark"] .searchable-dropdown .sd-toggle,
html[data-theme="dark"] .searchable-dropdown .sd-dropdown,
html[data-theme="dark"] .sd-options-list,
html[data-theme="dark"] .sd-option {
  background: var(--dm-card-bg) !important;
  color: var(--dm-text) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .sd-option:hover { background: var(--dm-hover) !important; }

/* Action Dropdowns */
html[data-theme="dark"] .actions-dropdown-menu {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
}
html[data-theme="dark"] .actions-dropdown-item { color: var(--dm-text) !important; }
html[data-theme="dark"] .actions-dropdown-item:hover { background: var(--dm-hover) !important; }

/* Column Settings Panel */
html[data-theme="dark"] #colSettingsPanel {
  background: var(--dm-bg3) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}

/* DMP / Stage sections */
html[data-theme="dark"] .dmp-stages-section { background: var(--dm-bg3) !important; }
html[data-theme="dark"] .dmp-stage { color: var(--dm-text) !important; }
html[data-theme="dark"] .dmp-add-bc-form { background: var(--dm-bg3) !important; }

/* Alert custom */
html[data-theme="dark"] .success-alert { border-color: var(--dm-border) !important; }

/* Stage2 sticky header */
html[data-theme="dark"] div[style*="background:white;border-radius:0 0 1rem 1rem"] {
  background: var(--dm-card-bg) !important;
}

/* ════ INLINE STYLE OVERRIDES ════ */

/* White / near-white backgrounds */
html[data-theme="dark"] [style*="background:white"],
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background-color:white"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background-color:#fff"],
html[data-theme="dark"] [style*="background-color:#ffffff"] {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  color: var(--dm-text) !important;
}

/* Modal white backgrounds */
html[data-theme="dark"] [style*="background:#fff;border-radius"],
html[data-theme="dark"] [style*="background: #fff;border-radius"] {
  background: var(--dm-card-bg) !important;
  color: var(--dm-text) !important;
}

/* Light gray / off-white backgrounds */
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background:#f9fafb"],
html[data-theme="dark"] [style*="background:#f1f5f9"],
html[data-theme="dark"] [style*="background:#f3f4f6"],
html[data-theme="dark"] [style*="background:#e5e7eb"],
html[data-theme="dark"] [style*="background:#d1d5db"],
html[data-theme="dark"] [style*="background:#e2e8f0"] {
  background: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
}

/* Light purple/violet tints */
html[data-theme="dark"] [style*="background:#f5f3ff"],
html[data-theme="dark"] [style*="background:#faf5ff"],
html[data-theme="dark"] [style*="background:#ede9fe"],
html[data-theme="dark"] [style*="background:#ddd6fe"],
html[data-theme="dark"] [style*="background:#e0e7ff"],
html[data-theme="dark"] [style*="background:#eef2ff"] {
  background: rgba(99,102,241,.12) !important;
  color: var(--dm-text) !important;
}

/* Light blue tints */
html[data-theme="dark"] [style*="background:#eff6ff"],
html[data-theme="dark"] [style*="background:#dbeafe"],
html[data-theme="dark"] [style*="background:#bfdbfe"],
html[data-theme="dark"] [style*="background:#e0f2fe"],
html[data-theme="dark"] [style*="background:#f0f9ff"],
html[data-theme="dark"] [style*="background:#cffafe"] {
  background: rgba(14,165,233,.12) !important;
  color: var(--dm-text) !important;
}

/* Light green tints */
html[data-theme="dark"] [style*="background:#f0fdf4"],
html[data-theme="dark"] [style*="background:#dcfce7"],
html[data-theme="dark"] [style*="background:#bbf7d0"],
html[data-theme="dark"] [style*="background:#d1fae5"],
html[data-theme="dark"] [style*="background:#ecfdf5"],
html[data-theme="dark"] [style*="background:#a7f3d0"] {
  background: rgba(16,185,129,.12) !important;
  color: var(--dm-text) !important;
}

/* Light amber/yellow tints */
html[data-theme="dark"] [style*="background:#fffbeb"],
html[data-theme="dark"] [style*="background:#fef3c7"],
html[data-theme="dark"] [style*="background:#fde68a"],
html[data-theme="dark"] [style*="background:#fff7ed"],
html[data-theme="dark"] [style*="background:#fef9c3"],
html[data-theme="dark"] [style*="background:#fefce8"] {
  background: rgba(245,158,11,.12) !important;
  color: var(--dm-text) !important;
}

/* Light red/pink tints */
html[data-theme="dark"] [style*="background:#fef2f2"],
html[data-theme="dark"] [style*="background:#fee2e2"],
html[data-theme="dark"] [style*="background:#fecaca"],
html[data-theme="dark"] [style*="background:#fff1f2"],
html[data-theme="dark"] [style*="background:#ffe4e6"] {
  background: rgba(239,68,68,.12) !important;
  color: var(--dm-text) !important;
}

/* ── Inline Text Color Overrides ── */

/* Dark gray/slate text → light */
html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color:#374151"],
html[data-theme="dark"] [style*="color:#475569"],
html[data-theme="dark"] [style*="color:#1e293b"],
html[data-theme="dark"] [style*="color:#0f172a"],
html[data-theme="dark"] [style*="color:#111827"],
html[data-theme="dark"] [style*="color:#1f2937"],
html[data-theme="dark"] [style*="color:#334155"] { color: var(--dm-text) !important; }

html[data-theme="dark"] [style*="color:#94a3b8"],
html[data-theme="dark"] [style*="color:#6b7280"],
html[data-theme="dark"] [style*="color:#9ca3af"],
html[data-theme="dark"] [style*="color:#cbd5e1"],
html[data-theme="dark"] [style*="color:#d1d5db"] { color: var(--dm-text2) !important; }

/* Dark blue text → light blue */
html[data-theme="dark"] [style*="color:#1d4ed8"],
html[data-theme="dark"] [style*="color:#1e40af"],
html[data-theme="dark"] [style*="color:#2563eb"],
html[data-theme="dark"] [style*="color:#1a56db"],
html[data-theme="dark"] [style*="color:#1c3faa"],
html[data-theme="dark"] [style*="color:#0ea5e9"],
html[data-theme="dark"] [style*="color:#0284c7"] { color: #93c5fd !important; }

/* Dark purple text → light purple */
html[data-theme="dark"] [style*="color:#4c1d95"],
html[data-theme="dark"] [style*="color:#5b21b6"],
html[data-theme="dark"] [style*="color:#6d28d9"],
html[data-theme="dark"] [style*="color:#7c3aed"],
html[data-theme="dark"] [style*="color:#4338ca"],
html[data-theme="dark"] [style*="color:#3730a3"] { color: #c4b5fd !important; }

/* Medium purple (already visible) */
html[data-theme="dark"] [style*="color:#8b5cf6"],
html[data-theme="dark"] [style*="color:#a78bfa"] { color: #c4b5fd !important; }

/* Dark green text → light green */
html[data-theme="dark"] [style*="color:#047857"],
html[data-theme="dark"] [style*="color:#059669"],
html[data-theme="dark"] [style*="color:#065f46"],
html[data-theme="dark"] [style*="color:#15803d"],
html[data-theme="dark"] [style*="color:#166534"] { color: #6ee7b7 !important; }

/* Dark red text → light red */
html[data-theme="dark"] [style*="color:#dc2626"],
html[data-theme="dark"] [style*="color:#b91c1c"],
html[data-theme="dark"] [style*="color:#991b1b"],
html[data-theme="dark"] [style*="color:#ef4444"] { color: #fca5a5 !important; }

/* Dark amber/brown text → light amber */
html[data-theme="dark"] [style*="color:#92400e"],
html[data-theme="dark"] [style*="color:#78350f"],
html[data-theme="dark"] [style*="color:#d97706"],
html[data-theme="dark"] [style*="color:#b45309"],
html[data-theme="dark"] [style*="color:#854d0e"] { color: #fcd34d !important; }

/* Dark teal text → light teal */
html[data-theme="dark"] [style*="color:#0f766e"],
html[data-theme="dark"] [style*="color:#0d9488"],
html[data-theme="dark"] [style*="color:#134e4a"] { color: #5eead4 !important; }

/* ── Inline Border Overrides ── */
html[data-theme="dark"] [style*="border:1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border:1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border:1px solid #d1d5db"],
html[data-theme="dark"] [style*="border:1px solid #cbd5e1"],
html[data-theme="dark"] [style*="border:1px solid #f1f5f9"],
html[data-theme="dark"] [style*="border:2px solid #e2e8f0"],
html[data-theme="dark"] [style*="border:2px solid #e5e7eb"],
html[data-theme="dark"] [style*="border:2px solid #ddd6fe"],
html[data-theme="dark"] [style*="border:2px solid #bfdbfe"],
html[data-theme="dark"] [style*="border:2px solid #bbf7d0"],
html[data-theme="dark"] [style*="border-bottom:1px solid #f1f5f9"],
html[data-theme="dark"] [style*="border-bottom:1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border-bottom:2px solid #e2e8f0"],
html[data-theme="dark"] [style*="border-top:1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border-top:1px solid #f1f5f9"] {
  border-color: var(--dm-border) !important;
}

/* ── Scrollbar ── */
html[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--dm-bg2); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--dm-border); border-radius: 4px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ════════════════════════════════════════
   DASHBOARD STYLES DARK MODE
   (dashboard-styles.css overrides)
   ════════════════════════════════════════ */

/* Background */
html[data-theme="dark"] .dashboard-bg {
  background: linear-gradient(180deg, #0f172a 0%, #1a1f35 100%) !important;
}
html[data-theme="dark"] .bg-shape { opacity: 0.15; }
html[data-theme="dark"] .shape-1 { background: radial-gradient(circle, rgba(99,102,241,.4), transparent); }
html[data-theme="dark"] .shape-2 { background: radial-gradient(circle, rgba(16,185,129,.25), transparent); }
html[data-theme="dark"] .shape-3 { background: radial-gradient(circle, rgba(139,92,246,.25), transparent); }
html[data-theme="dark"] .shape-4 { background: radial-gradient(circle, rgba(245,158,11,.2), transparent); }

/* Stat Cards */
html[data-theme="dark"] .stat-card-pro {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.35) !important;
}
html[data-theme="dark"] .stat-card-pro:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,.5) !important;
}
html[data-theme="dark"] .stat-label { color: var(--dm-text2) !important; }
html[data-theme="dark"] .stat-number-pro .number { color: var(--dm-text) !important; }
html[data-theme="dark"] .stat-number-pro .unit   { color: var(--dm-text2) !important; }
html[data-theme="dark"] .card-pattern {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(255,255,255,.02) 15px, rgba(255,255,255,.02) 30px);
}

/* Tabs Container */
html[data-theme="dark"] .tabs-container {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.45) !important;
}
html[data-theme="dark"] .tabs-nav {
  background: var(--dm-bg3) !important;
  border-bottom-color: var(--dm-border) !important;
}
html[data-theme="dark"] .tabs-nav::-webkit-scrollbar-track { background: var(--dm-bg2); }
html[data-theme="dark"] .tabs-nav::-webkit-scrollbar-thumb { background: var(--dm-border); }
html[data-theme="dark"] .tab-btn { color: var(--dm-text2) !important; }
html[data-theme="dark"] .tab-btn:hover {
  background: rgba(99,102,241,.1) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .tab-btn.active {
  background: linear-gradient(135deg,rgba(99,102,241,.15),rgba(59,130,246,.1)) !important;
  color: #818cf8 !important;
  border-bottom-color: #818cf8 !important;
}
html[data-theme="dark"] .tab-count {
  background: var(--dm-bg2) !important;
  color: var(--dm-text) !important;
}
html[data-theme="dark"] .tab-btn.active .tab-count {
  background: linear-gradient(135deg,#3b82f6,#2563eb) !important;
  color: #fff !important;
}

/* Premium Data Card */
html[data-theme="dark"] .data-card-premium {
  background: var(--dm-card-bg) !important;
}
html[data-theme="dark"] .card-header-premium {
  background: var(--dm-bg3) !important;
  border-bottom-color: var(--dm-border) !important;
}
html[data-theme="dark"] .header-title-premium   { color: var(--dm-text) !important; }
html[data-theme="dark"] .header-subtitle-premium { color: var(--dm-text2) !important; }
html[data-theme="dark"] .badge-number  { color: var(--dm-text) !important; }
html[data-theme="dark"] .badge-label   { color: var(--dm-text2) !important; }
html[data-theme="dark"] .badge-warning-premium {
  background: rgba(245,158,11,.15) !important;
  border: 1px solid rgba(245,158,11,.25) !important;
}
html[data-theme="dark"] .badge-danger-premium {
  background: rgba(239,68,68,.15) !important;
  border: 1px solid rgba(239,68,68,.25) !important;
}
html[data-theme="dark"] .icon-warning-light {
  background: rgba(245,158,11,.2) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .icon-danger-light {
  background: rgba(239,68,68,.2) !important;
  color: #fca5a5 !important;
}

/* Card Body Scrollbar */
html[data-theme="dark"] .card-body-premium::-webkit-scrollbar-track { background: var(--dm-bg2); }
html[data-theme="dark"] .card-body-premium::-webkit-scrollbar-thumb { background: var(--dm-border); }

/* List Items */
html[data-theme="dark"] .list-item-premium {
  border-bottom-color: var(--dm-border) !important;
}
html[data-theme="dark"] .list-item-premium:hover {
  background: linear-gradient(90deg,rgba(99,102,241,.07),transparent) !important;
}
html[data-theme="dark"] .item-name { color: var(--dm-text) !important; }

/* Tags */
html[data-theme="dark"] .tag-code {
  background: rgba(59,130,246,.15) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .tag-scientific {
  background: var(--dm-bg3) !important;
  color: var(--dm-text2) !important;
}
html[data-theme="dark"] .tag-company {
  background: rgba(16,185,129,.12) !important;
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .tag-category {
  background: rgba(245,158,11,.12) !important;
  color: #fcd34d !important;
}

/* Action Buttons */
html[data-theme="dark"] .action-edit-premium {
  background: rgba(59,130,246,.15) !important;
  color: #93c5fd !important;
  border-color: rgba(59,130,246,.3) !important;
}
html[data-theme="dark"] .action-upload-premium {
  background: rgba(16,185,129,.12) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16,185,129,.25) !important;
}

/* Avatars */
html[data-theme="dark"] .item-avatar {
  background: rgba(59,130,246,.2) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .item-avatar-teal {
  background: rgba(20,184,166,.2) !important;
  color: #5eead4 !important;
}

/* Empty State */
html[data-theme="dark"] .empty-title-premium { color: var(--dm-text) !important; }
html[data-theme="dark"] .empty-text-premium   { color: var(--dm-text2) !important; }
html[data-theme="dark"] .empty-icon-premium {
  background: rgba(16,185,129,.15) !important;
}

/* ════════════════════════════════════════
   SIDEBAR LAYOUT DARK MODE
   (sidebar-layout.css overrides)
   ════════════════════════════════════════ */

/* top-header (old sidebar layout) */
html[data-theme="dark"] .top-header {
  background: rgba(15,23,42,.95) !important;
  border-bottom: 1px solid var(--dm-border) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,.3) !important;
}
html[data-theme="dark"] .user-name { color: var(--dm-text) !important; }

/* Login Card */
html[data-theme="dark"] .login-card {
  background: var(--dm-card-bg) !important;
  border: 1px solid var(--dm-border) !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.6) !important;
}

/* Footer (sidebar-layout) */
html[data-theme="dark"] footer {
  background: rgba(15,23,42,.9) !important;
  border-top-color: var(--dm-border) !important;
}

/* ════════════════════════════════════════
   ADDITIONAL INLINE COLOR OVERRIDES
   (extra colors not covered before)
   ════════════════════════════════════════ */

/* More dark text colors that need to become light */
html[data-theme="dark"] [style*="color:#16a34a"],
html[data-theme="dark"] [style*="color:#15803d"] { color: #86efac !important; }

html[data-theme="dark"] [style*="color:#0891b2"],
html[data-theme="dark"] [style*="color:#0e7490"] { color: #67e8f9 !important; }

html[data-theme="dark"] [style*="color:#d97706"],
html[data-theme="dark"] [style*="color:#b45309"] { color: #fcd34d !important; }

html[data-theme="dark"] [style*="color:#e11d48"],
html[data-theme="dark"] [style*="color:#be123c"] { color: #fda4af !important; }

html[data-theme="dark"] [style*="color:#7c3aed"],
html[data-theme="dark"] [style*="color:#6d28d9"] { color: #c4b5fd !important; }

/* More light backgrounds */
html[data-theme="dark"] [style*="background:#e8f5e9"],
html[data-theme="dark"] [style*="background:#e3f2fd"],
html[data-theme="dark"] [style*="background:#fff3e0"],
html[data-theme="dark"] [style*="background:#fce4ec"],
html[data-theme="dark"] [style*="background:#f3e5f5"] {
  background: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
}

/* background-color variants */
html[data-theme="dark"] [style*="background-color:#f8fafc"],
html[data-theme="dark"] [style*="background-color:#f1f5f9"],
html[data-theme="dark"] [style*="background-color:#f9fafb"] {
  background-color: var(--dm-bg3) !important;
  color: var(--dm-text) !important;
}

/* More border variants */
html[data-theme="dark"] [style*="border-left:"],
html[data-theme="dark"] [style*="border-right:"] {
  /* keep colored left/right borders but update gray ones */
}
html[data-theme="dark"] [style*="border-left:4px solid #e2e8f0"],
html[data-theme="dark"] [style*="border-left:3px solid #e2e8f0"],
html[data-theme="dark"] [style*="border-left:2px solid #e2e8f0"] {
  border-left-color: var(--dm-border) !important;
}

/* Color: #1e293b used as text in many places */
html[data-theme="dark"] [style*="color:#1e293b"] { color: var(--dm-text) !important; }
html[data-theme="dark"] [style*="color: #1e293b"] { color: var(--dm-text) !important; }

/* ════════════════════════════════════════
   THEME SWITCH — ANIMATED PILL TOGGLE
   ════════════════════════════════════════ */

.theme-switch {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 16px;
  -webkit-tap-highlight-color: transparent;
}
.theme-switch:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.ts-track {
  width: 54px;
  height: 28px;
  border-radius: 14px;
  background: #e2e8f0;
  border: 1.5px solid #cbd5e1;
  position: relative;
  transition: background 0.4s ease, border-color 0.4s ease;
  overflow: hidden;
  direction: ltr; /* prevent RTL flipping */
}

.ts-icons {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  pointer-events: none;
  z-index: 1;
}

.ts-sun {
  color: #f59e0b;
  font-size: 11px;
  transition: opacity 0.3s ease;
}
.ts-moon {
  color: #818cf8;
  font-size: 11px;
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.ts-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 5px rgba(0,0,0,.25), 0 0 0 0.5px rgba(0,0,0,.08);
  transition:
    transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.38s ease;
  z-index: 2;
}

html[data-theme="dark"] .ts-track {
  background: linear-gradient(135deg, #312e81 0%, #1e3a5f 100%);
  border-color: #4338ca;
}
html[data-theme="dark"] .ts-thumb {
  transform: translateX(26px);
  background: #c7d2fe;
}
html[data-theme="dark"] .ts-sun  { opacity: 0.35; }
html[data-theme="dark"] .ts-moon { opacity: 1; }

/* ════════════════════════════════════════
   DARK MODE — GLOBAL CSS VARIABLE OVERRIDES
   Fixes all components that use page-level
   :root variables (Dashboard, Layout, etc.)
   ════════════════════════════════════════ */

html[data-theme="dark"] {
  /* ── Dashboard page variables ── */
  --bg-base:        #0f172a;
  --bg-card:        #1e293b;
  --bg-card-hover:  #1a2744;
  --border:         #334155;
  --border-bright:  #475569;
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  /* ── Layout shared variables ── */
  --border-color:   #334155;
  --light-bg:       #1e293b;
}

/* Dashboard body background */
html[data-theme="dark"] body.dashboard-page {
  background: #0f172a !important;
}
html[data-theme="dark"] .db-bg {
  background: linear-gradient(160deg, #0c1220 0%, #0f172a 55%, #130e20 100%) !important;
}

/* Layout: top navbar white bg */
html[data-theme="dark"] .top-navbar {
  background: rgba(15,23,42,.96) !important;
}

/* Layout: user section */
html[data-theme="dark"] .user-section {
  background: rgba(255,255,255,.06) !important;
}
html[data-theme="dark"] .user-section:hover {
  background: rgba(255,255,255,.12) !important;
}
html[data-theme="dark"] .user-dropdown-menu {
  background: var(--dm-card-bg) !important;
  border-color: var(--dm-border) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.5) !important;
}

/* Dashboard: list item hover (hardcoded blue tint) */
html[data-theme="dark"] .list-item:hover {
  background: var(--dm-bg3) !important;
  border-color: var(--dm-border) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.25) !important;
}

/* Dashboard: tag pills */
html[data-theme="dark"] .tag-code    { background: rgba(37,99,235,.16) !important; color: #93c5fd !important; }
html[data-theme="dark"] .tag-sci     { background: rgba(124,58,237,.16) !important; color: #c4b5fd !important; }
html[data-theme="dark"] .tag-company { background: rgba(13,148,136,.16) !important; color: #5eead4 !important; }
html[data-theme="dark"] .tag-cat     { background: rgba(217,119,6,.16) !important;  color: #fcd34d !important; }
html[data-theme="dark"] .tag-type    { background: rgba(220,38,38,.16) !important;  color: #fca5a5 !important; }

/* Dashboard: action buttons */
html[data-theme="dark"] .btn-action.edit    { background: rgba(37,99,235,.15) !important;  border-color: rgba(37,99,235,.3) !important;  color: #93c5fd !important; }
html[data-theme="dark"] .btn-action.upload  { background: rgba(16,185,129,.15) !important; border-color: rgba(16,185,129,.3) !important; color: #6ee7b7 !important; }
html[data-theme="dark"] .btn-action.barcode { background: rgba(245,158,11,.15) !important; border-color: rgba(245,158,11,.3) !important; color: #fcd34d !important; }
html[data-theme="dark"] .btn-action.view    { background: rgba(139,92,246,.15) !important; border-color: rgba(139,92,246,.3) !important; color: #c4b5fd !important; }
html[data-theme="dark"] .btn-action.edit:hover    { background: #3b82f6 !important; color: #fff !important; }
html[data-theme="dark"] .btn-action.upload:hover  { background: #10b981 !important; color: #fff !important; }
html[data-theme="dark"] .btn-action.barcode:hover { background: #f59e0b !important; color: #fff !important; }
html[data-theme="dark"] .btn-action.view:hover    { background: #8b5cf6 !important; color: #fff !important; }

/* Dashboard: empty state */
html[data-theme="dark"] .empty-icon {
  background: rgba(16,185,129,.15) !important;
  border-color: rgba(16,185,129,.25) !important;
}

/* Dashboard: ring inner (ov-panel) */
html[data-theme="dark"] .ov-ring-inner {
  background: var(--bg-card) !important;
  box-shadow: 0 0 0 1px var(--border) !important;
}

/* Dashboard: kpi-arrow */
html[data-theme="dark"] .kpi-arrow {
  background: var(--bg-base) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

/* ════════════════════════════════════════
   COMPREHENSIVE EXPLICIT DARK MODE FIXES
   (CSS classes with hardcoded colors)
   ════════════════════════════════════════ */

/* ── Dashboard v2: KPI Summary Strip (ov-sum-card) ── */
html[data-theme="dark"] .ov-sum-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ov-sum-num { color: #e2e8f0 !important; }
html[data-theme="dark"] .ov-sum-lbl { color: #64748b !important; }

/* ── Dashboard v2: KPI Grid Cards ── */
html[data-theme="dark"] .kpi-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .kpi-value  { color: #e2e8f0 !important; }
html[data-theme="dark"] .kpi-label,
html[data-theme="dark"] .kpi-unit   { color: #94a3b8 !important; }
html[data-theme="dark"] .kpi-mixed-val { color: #e2e8f0 !important; }
html[data-theme="dark"] .kpi-mixed-lbl { color: #64748b !important; }
html[data-theme="dark"] .kpi-progress-bar { background: #334155 !important; }

/* ── Dashboard v2: Tabs ── */
html[data-theme="dark"] .tabs-section {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .tabs-nav {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme="dark"] .tab-btn          { color: #94a3b8 !important; }
html[data-theme="dark"] .tab-btn:hover    { color: #e2e8f0 !important; }
html[data-theme="dark"] .tab-btn.active   { color: #818cf8 !important; }
html[data-theme="dark"] .tc {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .tab-btn.active .tc {
  background: linear-gradient(135deg,#3b82f6,#2563eb) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* ── Dashboard v2: List Items & Panes ── */
html[data-theme="dark"] .list-item {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .list-name  { color: #e2e8f0 !important; }
html[data-theme="dark"] .pane-badge {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .pane-htitle { color: #e2e8f0 !important; }
html[data-theme="dark"] .pane-hsub   { color: #94a3b8 !important; }

/* ── Dashboard v2: Duplicate Groups ── */
html[data-theme="dark"] .dup-group {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .dup-key { color: #e2e8f0 !important; }
html[data-theme="dark"] .dup-badge {
  background: rgba(239,68,68,.18) !important;
  color: #fca5a5 !important;
  border-color: rgba(239,68,68,.3) !important;
}
html[data-theme="dark"] .dup-badge.type {
  background: rgba(139,92,246,.18) !important;
  color: #c4b5fd !important;
  border-color: rgba(139,92,246,.3) !important;
}

/* ── Dashboard: Welcome Banner logo circle ── */
html[data-theme="dark"] .ase-welcome-logo-wrap {
  background: rgba(255,255,255,.15) !important;
  box-shadow: 0 4px 16px rgba(255,255,255,.08) !important;
}
html[data-theme="dark"] .ase-welcome-edit-btn {
  background: #1e293b !important;
  border-color: rgba(255,255,255,.2) !important;
  color: #818cf8 !important;
}

/* ── Drugs Page: Table Cell Badges ── */
html[data-theme="dark"] .badge-soft {
  background: #273549 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .badge-missing-drug {
  background: rgba(239,68,68,.18) !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .badge-barcode-yes {
  background: rgba(16,185,129,.18) !important;
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .badge-barcode-no {
  background: rgba(239,68,68,.18) !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .barcode-reason-chip {
  background: rgba(245,158,11,.18) !important;
  border-color: rgba(245,158,11,.3) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .drug-trade-name  { color: #e2e8f0 !important; }
html[data-theme="dark"] .drug-scientific  { color: #94a3b8 !important; }
html[data-theme="dark"] .barcode-value-drug { color: #e2e8f0 !important; }

html[data-theme="dark"] .barcode-count-btn {
  background: rgba(59,130,246,.15) !important;
  border-color: rgba(59,130,246,.3) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .barcode-count-btn:hover {
  background: rgba(59,130,246,.28) !important;
  border-color: rgba(59,130,246,.5) !important;
}

html[data-theme="dark"] .bc-item {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .bc-item-code { color: #e2e8f0 !important; }
html[data-theme="dark"] .bc-delete-btn:hover {
  color: #fca5a5 !important;
  background: rgba(239,68,68,.15) !important;
}

html[data-theme="dark"] .user-badge-drug {
  background: rgba(124,58,237,.2) !important;
  color: #c4b5fd !important;
  border-color: rgba(124,58,237,.35) !important;
}
html[data-theme="dark"] .user-badge-drug:hover {
  background: linear-gradient(135deg,#7c3aed,#6d28d9) !important;
  color: white !important;
}

/* ── Inline gradient with #fff (stat-filtered card) ── */
html[data-theme="dark"] [style*="background:linear-gradient(135deg,#fff"] {
  background: #1e293b !important;
}

/* ── Bootstrap bg-white utility class ── */
html[data-theme="dark"] .bg-white {
  background-color: #1e293b !important;
}

/* ── Sections that use background: white in CSS (not inline) ── */
html[data-theme="dark"] .stat-card-drug {
  background: #1e293b !important;
  border-color: #334155 !important;
}

/* ── Section labels ── */
html[data-theme="dark"] .section-label { color: #64748b !important; }
html[data-theme="dark"] .section-label::after { background: #334155 !important; }

/* ════════════════════════════════════════
   COMPREHENSIVE DARK MODE — MISSING CLASSES
   (View-embedded <style> blocks not covered above)
   ════════════════════════════════════════ */

/* ── Body & background force ── */
html[data-theme="dark"] body {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .content-area,
html[data-theme="dark"] .main-wrapper { background: transparent !important; }

/* ── Common page containers (Companies, Pharmacies, etc.) ── */
html[data-theme="dark"] .action-bar {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .action-bar input { background: #273549 !important; border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .table-container {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .company-row:hover td,
html[data-theme="dark"] .company-row:hover th { background: #334155 !important; }
html[data-theme="dark"] .country-badge {
  background: rgba(37,99,235,.18) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .empty-state {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .empty-state i { color: #475569 !important; }
html[data-theme="dark"] .empty-state h4 { color: #94a3b8 !important; }

/* ── Modal (custom — not Bootstrap modal) ── */
html[data-theme="dark"] .modal-box {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .modal-container {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .modal-title { color: #e2e8f0 !important; }
html[data-theme="dark"] .modal-message { color: #94a3b8 !important; }
html[data-theme="dark"] .modal-message strong { color: #e2e8f0 !important; }
html[data-theme="dark"] .modal-icon.danger  { background: rgba(239,68,68,.18) !important; }
html[data-theme="dark"] .modal-icon.warning { background: rgba(245,158,11,.18) !important; }
html[data-theme="dark"] .modal-btn-cancel {
  background: #273549 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .modal-btn-cancel:hover { background: #334155 !important; }
html[data-theme="dark"] .modal-drug-count {
  background: rgba(245,158,11,.15) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .modal-icon-delete { opacity: .85; }

/* ── Drugs page — missing classes ── */
html[data-theme="dark"] .stage-mini-card {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stage-mini-label { color: #94a3b8 !important; }
html[data-theme="dark"] .stage-mini-val   { color: #e2e8f0 !important; }

html[data-theme="dark"] .btn-clear {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .btn-clear:hover {
  background: rgba(239,68,68,.15) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
}

html[data-theme="dark"] .user-filter-select {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .user-filter-select.active-filter {
  background: rgba(109,40,217,.15) !important;
  border-color: rgba(109,40,217,.4) !important;
  color: #c4b5fd !important;
}
html[data-theme="dark"] .user-filter-active-badge {
  background: rgba(109,40,217,.2) !important;
  color: #c4b5fd !important;
}

html[data-theme="dark"] .filter-hint-box {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .filter-hint-box i { color: #93c5fd !important; }

html[data-theme="dark"] .table-header-drugs {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme="dark"] .table-title-drugs { color: #e2e8f0 !important; }
html[data-theme="dark"] .search-badge {
  background: rgba(37,99,235,.15) !important;
  color: #93c5fd !important;
}

html[data-theme="dark"] .drug-row:hover { background: #334155 !important; }
html[data-theme="dark"] .date-main { color: #e2e8f0 !important; }
html[data-theme="dark"] .date-time  { color: #64748b !important; }
html[data-theme="dark"] .edit-by    { color: #a78bfa !important; }

html[data-theme="dark"] .edit-count-zero {
  background: #273549 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .edit-count-badge {
  background: rgba(245,158,11,.15) !important;
  color: #fcd34d !important;
}

html[data-theme="dark"] .actions-dropdown-toggle {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .actions-dropdown-toggle:hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .actions-dropdown-item:hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .actions-dropdown-item-danger:hover {
  background: rgba(239,68,68,.15) !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .actions-dropdown-divider { background: #334155 !important; }

html[data-theme="dark"] .pagination-wrapper {
  background: #273549 !important;
  border-top-color: #334155 !important;
}
html[data-theme="dark"] .page-btn {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .page-btn:hover {
  border-color: #6366f1 !important;
  color: #818cf8 !important;
}
html[data-theme="dark"] .page-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
}
html[data-theme="dark"] .pagination-info  { color: #94a3b8 !important; }
html[data-theme="dark"] .page-dots        { color: #64748b !important; }
html[data-theme="dark"] .pagination-jump span { color: #94a3b8 !important; }

/* ── table-scroll-wrapper scrollbar ── */
html[data-theme="dark"] .table-scroll-wrapper::-webkit-scrollbar-track { background: #1e293b; }
html[data-theme="dark"] .table-scroll-wrapper::-webkit-scrollbar-thumb { background: #334155; }

/* ── Dashboard page ── */
html[data-theme="dark"] .db-bg {
  background: linear-gradient(160deg, #0c1220 0%, #0f172a 55%, #130e20 100%) !important;
}
html[data-theme="dark"] .ov-panel {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ov-col { border-top-color: #334155 !important; }
html[data-theme="dark"] .ov-col-title { color: #e2e8f0 !important; }
html[data-theme="dark"] .ov-col-total {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .ov-sum-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ov-sum-num { color: #e2e8f0 !important; }
html[data-theme="dark"] .ov-sum-lbl { color: #64748b !important; }
html[data-theme="dark"] .ov-stat {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ov-stat:hover { border-color: #475569 !important; }
html[data-theme="dark"] .ov-stat-num { color: #e2e8f0 !important; }
html[data-theme="dark"] .ov-stat-lbl { color: #64748b !important; }
html[data-theme="dark"] .ov-stat-arrow { color: #64748b !important; }
html[data-theme="dark"] .ov-stages-block {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ov-stage-bar-wrap { background: #334155 !important; }
html[data-theme="dark"] .ov-stage-nums { color: #94a3b8 !important; }
html[data-theme="dark"] .ov-stage-pct  { color: #94a3b8 !important; }
html[data-theme="dark"] .pane-hicon { opacity: .85; }
html[data-theme="dark"] .tab-pane { background: transparent !important; }
html[data-theme="dark"] .dup-group-header:hover { background: #273549 !important; }
html[data-theme="dark"] .kpi-progress-fill { filter: brightness(1.15); }

/* ── CSS variable re-declarations for views with :root overrides ── */
html[data-theme="dark"] {
  --bg-base:        #0f172a;
  --bg-card:        #1e293b;
  --bg-card-hover:  #1a2744;
  --border:         #334155;
  --border-bright:  #475569;
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --sc-color:       inherit;
}

/* ════════════════════════════════════════
   PAYMENTS / BONUSES PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .pay-header,
html[data-theme="dark"] .filter-card,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .table-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .pay-title          { color: #e2e8f0 !important; }
html[data-theme="dark"] .pay-subtitle       { color: #94a3b8 !important; }
html[data-theme="dark"] .filter-label       { color: #94a3b8 !important; }
html[data-theme="dark"] .filter-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .summary-value      { color: #e2e8f0 !important; }
html[data-theme="dark"] .summary-label      { color: #94a3b8 !important; }
html[data-theme="dark"] .btn-reset,
html[data-theme="dark"] .btn-cancel-modal,
html[data-theme="dark"] .btn-history {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .pay-table th {
  background: #273549 !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme="dark"] .pay-table tbody tr:hover { background: #334155 !important; }
html[data-theme="dark"] .pay-table td { border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .modal-info-item {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .settlement-date-badge {
  background: rgba(16,185,129,.15) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16,185,129,.3) !important;
}
html[data-theme="dark"] .alert-success-custom {
  background: rgba(16,185,129,.15) !important;
  border-color: rgba(16,185,129,.3) !important;
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .alert-error-custom {
  background: rgba(239,68,68,.15) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
}

/* ════════════════════════════════════════
   ALL VIEWS — GENERIC WHITE CARD PATTERNS
   Catch-all for classes with white/light backgrounds
   ════════════════════════════════════════ */

/* Generic white card patterns common across many views */
html[data-theme="dark"] .page-header-card,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .details-card,
html[data-theme="dark"] .list-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* Generic hover on table rows (when not covered by .drug-row or .company-row) */
html[data-theme="dark"] .table-hover tbody tr:hover > * { background: #334155 !important; }

/* User dropdown dark mode (layout) */
html[data-theme="dark"] .user-drop-item { color: #e2e8f0 !important; }
html[data-theme="dark"] .user-drop-item:hover { background: #273549 !important; color: #818cf8 !important; }
html[data-theme="dark"] .drop-item-icon {
  background: #273549 !important;
  color: #818cf8 !important;
}
html[data-theme="dark"] .user-drop-item:hover .drop-item-icon { background: #334155 !important; }
html[data-theme="dark"] .user-drop-divider { background: #334155 !important; }
html[data-theme="dark"] .user-drop-logout { color: #fca5a5 !important; }
html[data-theme="dark"] .user-drop-logout:hover { background: rgba(239,68,68,.15) !important; }
html[data-theme="dark"] .user-drop-logout .drop-item-icon { color: #fca5a5 !important; }

/* Navbar page title area */
html[data-theme="dark"] .navbar-page-title { border-color: #334155 !important; }

/* ════════════════════════════════════════
   PHARMACIES — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stat-card .stat-value { color: #e2e8f0 !important; }
html[data-theme="dark"] .stat-card .stat-label { color: #94a3b8 !important; }

/* MedicalMap */
html[data-theme="dark"] .map-filter-bar {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .map-search-box {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .filter-chip {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .filter-chip.active {
  background: rgba(59,130,246,.2) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .map-select {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .map-back-btn {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .map-legend {
  background: rgba(30,41,59,.97) !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* AuditLog page */
html[data-theme="dark"] .pag-btn {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .pag-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
}

/* Reports page (Pharmacies) */
html[data-theme="dark"] .rpt-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .rpt-card-hdr {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
  color: #94a3b8 !important;
}

/* ════════════════════════════════════════
   SETTINGS PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .settings-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .settings-tabs {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .settings-tab-btn {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .settings-tab-btn.active {
  color: #3b82f6 !important;
  border-bottom-color: #3b82f6 !important;
}
html[data-theme="dark"] .settings-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .settings-example-card {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .navLogoPreview,
html[data-theme="dark"] .loginLogoPreview {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .settings-label { color: #94a3b8 !important; }
html[data-theme="dark"] .settings-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* ════════════════════════════════════════
   PROFILE PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .profile-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-input-profile {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .profile-label { color: #94a3b8 !important; }

/* ════════════════════════════════════════
   BONUSES PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .bon-filter,
html[data-theme="dark"] .bon-stats,
html[data-theme="dark"] .bon-table {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .bon-row {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .bon-row:hover { background: #273549 !important; }
html[data-theme="dark"] .bon-label { color: #94a3b8 !important; }
html[data-theme="dark"] .bon-value { color: #e2e8f0 !important; }
html[data-theme="dark"] .bcr-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* ════════════════════════════════════════
   REPORTS (DrugsByUser / DrugsByUserDay) — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] {
  --white: #1e293b;
  --light: #273549;
}
html[data-theme="dark"] .page-header-pro,
html[data-theme="dark"] .filter-card-pro,
html[data-theme="dark"] .report-card-pro {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stat-mini-card {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .day-card-pro {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .day-card-pro:hover { background: #273549 !important; }

/* ════════════════════════════════════════
   USER DASHBOARD — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] {
  --card:   #1e293b;
  --bg:     #0f172a;
  --gray:   #273549;
  --border-color: #334155;
}

/* ════════════════════════════════════════
   DAILY DUPLICATES — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .drugs-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .filter-bar {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .filter-date-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .filter-date-input:focus,
html[data-theme="dark"] .filter-date-input:hover {
  background: #334155 !important;
}

/* ════════════════════════════════════════
   WAREHOUSES — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .toolbar-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* ════════════════════════════════════════
   MEDICAL SUPPLIES — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .search-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .search-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .search-input:focus { background: #334155 !important; }

/* ════════════════════════════════════════
   GENERATED BARCODES — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .gb-table-wrap {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .gb-table-wrap.nobc .gb-table th {
  background: rgba(245,158,11,.12) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .gb-table-wrap.dup .gb-table th {
  background: rgba(239,68,68,.12) !important;
  color: #fca5a5 !important;
}

/* ════════════════════════════════════════
   PAYMENTS — ADDITIONAL PAGES DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .type-stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .mypay-header,
html[data-theme="dark"] .mypay-card,
html[data-theme="dark"] .tabs-bar,
html[data-theme="dark"] .section-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .tabs-bar .tab-link { color: #94a3b8 !important; }
html[data-theme="dark"] .tabs-bar .tab-link.active {
  color: #3b82f6 !important;
  border-bottom-color: #3b82f6 !important;
}

/* ════════════════════════════════════════
   DRUGS CREATE / EDIT — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .form-card-edit {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-input-edit {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-input-edit:focus { background: #1e293b !important; border-color: #3b82f6 !important; }
html[data-theme="dark"] .label-icon-edit { color: #94a3b8 !important; }
html[data-theme="dark"] .form-label-edit { color: #e2e8f0 !important; }
html[data-theme="dark"] .tradename-suggestions,
html[data-theme="dark"] .name-suggestions {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .tn-suggest-item:hover,
html[data-theme="dark"] .tn-suggest-item.active { background: #273549 !important; }
html[data-theme="dark"] .name-suggestion-item:hover { background: #273549 !important; }
html[data-theme="dark"] .sd-toggle {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .sd-toggle.has-value { background: #1e293b !important; border-color: #93c5fd !important; }
html[data-theme="dark"] .sd-toggle-text { color: #94a3b8 !important; }
html[data-theme="dark"] .sd-toggle.has-value .sd-toggle-text { color: #e2e8f0 !important; }
html[data-theme="dark"] .sd-dropdown {
  background: #1e293b !important;
  border-color: #3b82f6 !important;
}
html[data-theme="dark"] .sd-search-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .sd-option { color: #e2e8f0 !important; }
html[data-theme="dark"] .sd-option:hover { background: #273549 !important; }
html[data-theme="dark"] .current-image-box {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .current-image {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .btn-open-image {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .btn-open-image:hover { background: #334155 !important; }
html[data-theme="dark"] .empty-image-box {
  background: #273549 !important;
  border-color: #475569 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .bc-edit-item {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .bc-edit-code { color: #e2e8f0 !important; }
html[data-theme="dark"] .bc-primary   { background: rgba(37,99,235,.18) !important; color: #93c5fd !important; }
html[data-theme="dark"] .bc-secondary { background: rgba(22,163,74,.18) !important; color: #86efac !important; }
html[data-theme="dark"] .bc-confirm-box {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .bc-confirm-title { color: #e2e8f0 !important; }
html[data-theme="dark"] .bc-confirm-code {
  background: #273549 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .bc-confirm-cancel {
  background: #273549 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .bc-confirm-cancel:hover { background: #334155 !important; }
html[data-theme="dark"] .dmp-detail-panel,
html[data-theme="dark"] .dmp-bc-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .dmp-s1-field {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* ════════════════════════════════════════
   COMPANIES / PHARMACIES CREATE & EDIT — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .form-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-control-custom {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-control-custom:focus { background: #1e293b !important; }
html[data-theme="dark"] .country-dropdown-list {
  background: #1e293b !important;
  border-color: #6366f1 !important;
}
html[data-theme="dark"] .country-search-box {
  background: #1e293b !important;
  border-bottom-color: #334155 !important;
}
html[data-theme="dark"] .country-search-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .country-search-input:focus { background: #334155 !important; }
html[data-theme="dark"] .country-item { color: #e2e8f0 !important; border-bottom-color: #334155 !important; }
html[data-theme="dark"] .country-item:hover { background: #273549 !important; }
html[data-theme="dark"] .country-item.selected { background: rgba(99,102,241,.15) !important; }
html[data-theme="dark"] .info-box {
  background: rgba(99,102,241,.1) !important;
  border-color: rgba(99,102,241,.3) !important;
}

/* ════════════════════════════════════════
   PHARMACIES DETAILS — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .det-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .det-card-hdr { border-bottom-color: #334155 !important; }
html[data-theme="dark"] .info-val   { color: #e2e8f0 !important; }
html[data-theme="dark"] .info-lbl   { color: #64748b !important; }
html[data-theme="dark"] .entity-card {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .entity-name { color: #e2e8f0 !important; }
html[data-theme="dark"] .entity-sub  { color: #94a3b8 !important; }
html[data-theme="dark"] .mini-btn {
  background: #273549 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .mini-btn-warn:hover   { background: rgba(245,158,11,.15) !important; }
html[data-theme="dark"] .mini-btn-danger:hover { background: rgba(239,68,68,.15) !important; }
html[data-theme="dark"] .audit-item {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* ════════════════════════════════════════
   USERS PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .users-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stat-card-user {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stat-label-user  { color: #94a3b8 !important; }
html[data-theme="dark"] .stat-value-user  { color: #e2e8f0 !important; }
html[data-theme="dark"] .filter-tab {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .filter-tab:hover { border-color: #8b5cf6 !important; color: #c4b5fd !important; }
html[data-theme="dark"] .filter-tab-count {
  background: #1e293b !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .table-card-users {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .table-header-users {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme="dark"] .table-title-users { color: #e2e8f0 !important; }
html[data-theme="dark"] .search-box-users input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .modern-table-users thead th {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .user-row:hover { background: #273549 !important; }
html[data-theme="dark"] .status-normal   { background: rgba(71,85,105,.3) !important; color: #94a3b8 !important; }
html[data-theme="dark"] .status-inactive { background: rgba(239,68,68,.15) !important; color: #fca5a5 !important; }
html[data-theme="dark"] .btn-deactivate  { background: #273549 !important; border-color: #334155 !important; color: #94a3b8 !important; }
html[data-theme="dark"] .btn-password    { background: #273549 !important; border-color: #334155 !important; color: #94a3b8 !important; }
html[data-theme="dark"] .badge-role-admin { background: rgba(139,92,246,.18) !important; color: #c4b5fd !important; }
html[data-theme="dark"] .badge-new       { background: rgba(16,185,129,.15) !important; color: #6ee7b7 !important; }
html[data-theme="dark"] .empty-icon-users { background: #273549 !important; color: #475569 !important; }
html[data-theme="dark"] .empty-state-users { color: #94a3b8 !important; }

/* Users Create */
html[data-theme="dark"] .cu-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .cu-col {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .cu-input {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .cu-perm-card,
html[data-theme="dark"] .cu-role-card {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .cu-opt {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .cu-perms-panel {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .cu-btn-cancel {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .cu-back-btn {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .cu-pic-btn {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* Users Change Password */
html[data-theme="dark"] .user-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .user-form-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-input-user {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .security-note {
  background: rgba(99,102,241,.1) !important;
  border-color: rgba(99,102,241,.3) !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .note-icon-security { background: rgba(99,102,241,.2) !important; }
html[data-theme="dark"] .validation-summary-user {
  background: rgba(239,68,68,.1) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
}
html[data-theme="dark"] .btn-cancel-user {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* ════════════════════════════════════════
   BATCHES PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .page-header-modern {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stat-card-batch {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .table-card-batches {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .table-header-batches {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
}
html[data-theme="dark"] .modern-table-batches thead th {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .batch-row:hover { background: #273549 !important; }
html[data-theme="dark"] .badge-empty { background: rgba(239,68,68,.15) !important; color: #fca5a5 !important; }
html[data-theme="dark"] .form-card-modern {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .form-input-modern {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .btn-cancel-modern {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .validation-summary-modern {
  background: rgba(239,68,68,.1) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
}

/* ════════════════════════════════════════
   MEDICAL SPECIALTIES — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .spec-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .spec-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .sub-item {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .sub-item:hover { background: #334155 !important; }
html[data-theme="dark"] .btn-modal-cancel {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* ════════════════════════════════════════
   CATEGORIES — DARK MODE (extra classes)
   ════════════════════════════════════════ */
html[data-theme="dark"] .group-row:hover   { background: #273549 !important; }
html[data-theme="dark"] .category-row:hover { background: #273549 !important; }

/* ════════════════════════════════════════
   BONUS / REPORTS — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .bonus-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .bonus-header-icon { opacity: .85; }
html[data-theme="dark"] .bonus-stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .stat-deductions { border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .stat-extra       { border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .bonus-filter-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .bonus-filter-info {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .bonus-table-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .bonus-table-header {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .bonus-table th {
  background: #273549 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .bonus-table td { border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .bonus-table tbody tr:hover { background: #273549 !important; }
html[data-theme="dark"] .bonus-milestone {
  background: rgba(16,185,129,.1) !important;
  border-color: rgba(16,185,129,.3) !important;
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .badge-total {
  background: rgba(59,130,246,.15) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .net-zero,
html[data-theme="dark"] .remaining-zero,
html[data-theme="dark"] .edit-badge-zero {
  background: #273549 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .edit-badge-count {
  background: rgba(245,158,11,.15) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .total-row > td { background: #273549 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .btn-bonus-search,
html[data-theme="dark"] .btn-back-report {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .btn-detail {
  background: rgba(59,130,246,.15) !important;
  border-color: rgba(59,130,246,.3) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .ExtraBonuses {
  background: rgba(245,158,11,.1) !important;
  border-color: rgba(245,158,11,.3) !important;
  color: #fcd34d !important;
}

/* ════════════════════════════════════════
   COMPANIES PRODUCTS — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .table-header {
  background: #273549 !important;
  border-bottom-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .products-table th {
  background: #273549 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .products-table td { border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .products-count { color: #94a3b8 !important; }
html[data-theme="dark"] .btn-back {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* ════════════════════════════════════════
   WAREHOUSES DETAILS — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .card-pro {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .tbl th {
  background: #273549 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .tbl td { border-color: #334155 !important; color: #e2e8f0 !important; }

/* ════════════════════════════════════════
   DAILY DUPLICATES GROUP — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .group-header {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .dup-table th {
  background: #273549 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .dup-table td { border-color: #334155 !important; color: #e2e8f0 !important; }

/* ════════════════════════════════════════
   IMPORT PAGE — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .import-header {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .import-form-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .template-card {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .template-icon {
  background: rgba(59,130,246,.15) !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .upload-area-import {
  background: #273549 !important;
  border-color: #475569 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .upload-area-import:hover { border-color: #3b82f6 !important; }
html[data-theme="dark"] .form-input-import {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .file-preview {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}
html[data-theme="dark"] .btn-cancel-import,
html[data-theme="dark"] .btn-download-template {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
html[data-theme="dark"] .validation-summary-import {
  background: rgba(239,68,68,.1) !important;
  border-color: rgba(239,68,68,.3) !important;
  color: #fca5a5 !important;
}

/* ════════════════════════════════════════
   PHARMACIES ADD DOCTOR/CLINIC/LAB — DARK MODE
   ════════════════════════════════════════ */
html[data-theme="dark"] .warn-box {
  background: rgba(245,158,11,.1) !important;
  border-color: rgba(245,158,11,.3) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .toggle-section {
  background: #1e293b !important;
  border-color: #334155 !important;
}

/* ════════════════════════════════════════
   USER DASHBOARD — SPECIFIC ELEMENT OVERRIDES
   ════════════════════════════════════════ */
html[data-theme="dark"] {
  --bdr: #334155;
}
html[data-theme="dark"] .c   { background: #1e293b !important; border-color: #334155 !important; }
html[data-theme="dark"] .ct  { color: #e2e8f0 !important; }
html[data-theme="dark"] .slbl { color: #94a3b8 !important; }
html[data-theme="dark"] .bkl  { color: #94a3b8 !important; }
html[data-theme="dark"] .bkbar { background: #334155 !important; }
html[data-theme="dark"] .fic-val { color: #e2e8f0 !important; }
html[data-theme="dark"] .ph-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ph-toggle-meta {
  background: #273549 !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .ph-date-badge {
  background: #273549 !important;
  color: #93c5fd !important;
}
html[data-theme="dark"] .ph-stat {
  background: #273549 !important;
  border-color: #334155 !important;
}
html[data-theme="dark"] .ph-stat-lbl { color: #64748b !important; }
html[data-theme="dark"] .ph-stat-val  { color: #e2e8f0 !important; }
html[data-theme="dark"] .ph-bonus-label { color: #c4b5fd !important; }
html[data-theme="dark"] .ph-bonus-amt   { color: #c4b5fd !important; }
html[data-theme="dark"] .ph-notes {
  background: rgba(245,158,11,.08) !important;
  border-color: rgba(245,158,11,.25) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .fin-settle {
  background: rgba(16,185,129,.1) !important;
  border-color: rgba(16,185,129,.3) !important;
  color: #6ee7b7 !important;
}
html[data-theme="dark"] .fin-settle-warn {
  background: rgba(245,158,11,.1) !important;
  border-color: rgba(245,158,11,.3) !important;
  color: #fcd34d !important;
}
html[data-theme="dark"] .ph-body  { background: #0f172a !important; }
html[data-theme="dark"] .ph-details-link { background: #273549 !important; color: #93c5fd !important; }
html[data-theme="dark"] .ph-details-link:hover { background: #334155 !important; }

/* ── force CSS variables correctly at end of cascade ── */
html[data-theme="dark"] {
  --dm-card-bg: #1e293b;
  --dm-bg:      #0f172a;
  --dm-bg2:     #1e293b;
  --dm-bg3:     #273549;
  --dm-border:  #334155;
  --dm-text:    #e2e8f0;
  --dm-text2:   #94a3b8;
  --dm-text3:   #64748b;
  --dm-hover:   #334155;
}
