/* ============================================================
   CHEMICAL INVENTORY & RUNWAY DASHBOARD - EXECUTIVE STYLESHEET
   ============================================================ */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: rgba(30, 41, 59, 0.75);
  --bg-card-hover: rgba(51, 65, 85, 0.85);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: rgba(148, 163, 184, 0.15);
  --border-focus: #38bdf8;
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --accent: #818cf8;
  
  /* Status Colors */
  --critical-bg: rgba(239, 68, 68, 0.18);
  --critical-border: #ef4444;
  --critical-text: #fca5a5;
  --critical-glow: rgba(239, 68, 68, 0.4);
  
  --warning-bg: rgba(245, 158, 11, 0.15);
  --warning-border: #f59e0b;
  --warning-text: #fcd34d;
  
  --healthy-bg: rgba(34, 197, 94, 0.15);
  --healthy-border: #22c55e;
  --healthy-text: #86efac;
  
  --surplus-bg: rgba(168, 85, 247, 0.15);
  --surplus-border: #a855f7;
  --surplus-text: #d8b4fe;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(248, 250, 252, 1);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-color: rgba(203, 213, 225, 0.8);
  --border-focus: #0284c7;
  
  --primary: #0284c7;
  --primary-glow: rgba(2, 132, 199, 0.2);
  --accent: #6366f1;
  
  --critical-bg: #fee2e2;
  --critical-border: #dc2626;
  --critical-text: #991b1b;
  --critical-glow: rgba(220, 38, 38, 0.2);
  
  --warning-bg: #fef3c7;
  --warning-border: #d97706;
  --warning-text: #92400e;
  
  --healthy-bg: #dcfce7;
  --healthy-border: #16a34a;
  --healthy-text: #166534;
  
  --surplus-bg: #f3e8ff;
  --surplus-border: #9333ea;
  --surplus-text: #6b21a8;
  
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100vh !important;
  max-height: 100vh !important;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  box-sizing: border-box;
}

/* Main App Shell (Flex Layout) */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden !important;
  background-color: var(--bg-primary);
  box-sizing: border-box;
}

/* ============================================================
   FIXED LEFT SIDEBAR (v2.00 ENTERPRISE RBAC)
   ============================================================ */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  box-sizing: border-box !important;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-right: 1px solid var(--border-color);
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  z-index: 100;
  padding: 5px 6px 12px 6px !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  user-select: none;
  overflow: hidden !important;
  position: relative !important;
}

[data-theme="light"] .app-sidebar {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
}

/* Sidebar Brand */
.sidebar-brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 6px 4px !important;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0 !important;
  box-sizing: border-box;
}

.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.sidebar-logo-wrap:hover {
  transform: scale(1.05);
}

.sidebar-brand-text h2 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.1;
  margin: 0;
}

.sidebar-brand-text p {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 1px;
  margin-bottom: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1 1 0px !important;
  min-height: 0 !important;
  max-height: calc(100vh - 145px) !important;
  max-height: calc(100dvh - 145px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 3px 2px 6px 2px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 1.5px !important;
  box-sizing: border-box !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px !important;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35) !important;
  border-radius: 4px !important;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #38bdf8 !important;
}

.sidebar-section-heading {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 10px 4px 10px;
  text-transform: uppercase;
}

.sidebar-folder-header:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.32) 0%, rgba(234, 179, 8, 0.22) 100%) !important;
  border-color: rgba(245, 158, 11, 0.8) !important;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25) !important;
}

.sidebar-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: left;
  width: 100%;
  text-decoration: none;
  user-select: none;
}

.sidebar-nav-item:hover {
  background: rgba(56, 189, 248, 0.12);
  color: var(--text-primary);
  transform: translateX(4px);
}

.sidebar-nav-item:active {
  transform: scale(0.96) translateX(2px) !important;
  transition: transform 0.08s ease;
}

/* ==============================================================================
   ILLUMINATED "LIGHT-ON" ACTIVE TAB THEME (PROMINENT NEON GLOW)
   ============================================================================== */
.sidebar-nav-item.active,
.sidebar-folder-content .sidebar-nav-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.38) 0%, rgba(56, 189, 248, 0.48) 50%, rgba(99, 102, 241, 0.36) 100%) !important;
  border: 1.5px solid #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 
    0 0 18px rgba(56, 189, 248, 0.75), 
    0 0 35px rgba(14, 165, 233, 0.45), 
    inset 0 1px 1px rgba(255, 255, 255, 0.6), 
    inset 0 0 16px rgba(56, 189, 248, 0.3) !important;
  transform: translateX(4px) !important;
  animation: lightSwitchOn 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
  z-index: 2;
}

/* Glowing Neon LED Switch-On Indicator Bar on the Left Edge */
.sidebar-nav-item.active::before,
.sidebar-folder-content .sidebar-nav-item.active::before {
  content: "" !important;
  position: absolute !important;
  left: 0 !important;
  top: 10% !important;
  height: 80% !important;
  width: 4.5px !important;
  border-radius: 0 4px 4px 0 !important;
  background: #38bdf8 !important;
  box-shadow: 
    0 0 8px #38bdf8, 
    0 0 18px #0ea5e9, 
    0 0 28px #38bdf8 !important;
  animation: neonGlowPulse 2s ease-in-out infinite alternate !important;
}

/* Illuminated Icon Badge ("The Light Bulb Turned ON") */
.sidebar-nav-item.active .nav-icon-badge,
.sidebar-folder-content .sidebar-nav-item.active .nav-icon-badge {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.9) !important;
  box-shadow: 
    0 0 14px rgba(56, 189, 248, 1), 
    0 0 28px rgba(14, 165, 233, 0.7), 
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  transform: scale(1.12) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.sidebar-nav-item.active .nav-icon-badge svg,
.sidebar-folder-content .sidebar-nav-item.active .nav-icon-badge svg {
  stroke: #ffffff !important;
  stroke-width: 2.6 !important;
  filter: drop-shadow(0 0 4px #ffffff) drop-shadow(0 0 8px #38bdf8) !important;
}

/* Lit Title (High contrast, luminous glowing text) */
.sidebar-nav-item.active .nav-title,
.sidebar-folder-content .sidebar-nav-item.active .nav-title {
  color: #ffffff !important;
  font-weight: 900 !important;
  letter-spacing: 0.02em !important;
  text-shadow: 
    0 0 10px rgba(255, 255, 255, 0.85), 
    0 0 22px rgba(56, 189, 248, 0.95) !important;
}

/* Crystal-clear bright subtitle */
.sidebar-nav-item.active .nav-sub,
.sidebar-folder-content .sidebar-nav-item.active .nav-sub {
  color: #e0f2fe !important;
  font-weight: 700 !important;
  opacity: 1 !important;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.6) !important;
}

/* Lit Badge Pill */
.sidebar-nav-item.active .nav-badge-pill,
.sidebar-folder-content .sidebar-nav-item.active .nav-badge-pill {
  background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%) !important;
  color: #ffffff !important;
  border: 1px solid #7dd3fc !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
  font-weight: 900 !important;
}

.sidebar-nav-item.active .nav-badge-count,
.sidebar-folder-content .sidebar-nav-item.active .nav-badge-count {
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.9), 0 0 22px rgba(239, 68, 68, 0.6) !important;
}

/* "Light Switch On" Real-Time Flicker / Turn-On Animation */
@keyframes lightSwitchOn {
  0% {
    opacity: 0.5;
    transform: scale(0.96) translateX(0);
    filter: brightness(0.6);
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
  30% {
    filter: brightness(1.75);
    box-shadow: 
      0 0 35px rgba(56, 189, 248, 1), 
      0 0 70px rgba(14, 165, 233, 0.75), 
      inset 0 0 25px rgba(56, 189, 248, 0.6);
    transform: scale(1.02) translateX(4px);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
    transform: scale(1) translateX(4px);
    box-shadow: 
      0 0 18px rgba(56, 189, 248, 0.75), 
      0 0 35px rgba(14, 165, 233, 0.45), 
      inset 0 1px 1px rgba(255, 255, 255, 0.6), 
      inset 0 0 16px rgba(56, 189, 248, 0.3);
  }
}

@keyframes neonGlowPulse {
  0% {
    box-shadow: 0 0 8px #38bdf8, 0 0 16px #0ea5e9;
  }
  100% {
    box-shadow: 0 0 12px #38bdf8, 0 0 24px #38bdf8, 0 0 36px #0ea5e9;
  }
}

/* Light Theme Support */
[data-theme="light"] .sidebar-nav-item.active,
[data-theme="light"] .sidebar-folder-content .sidebar-nav-item.active {
  background: linear-gradient(90deg, #e0f2fe 0%, #bae6fd 60%, #e0f2fe 100%) !important;
  border: 1.5px solid #0284c7 !important;
  color: #0369a1 !important;
  box-shadow: 
    0 0 14px rgba(2, 132, 199, 0.45), 
    0 4px 16px rgba(2, 132, 199, 0.25), 
    inset 0 1px 0 #ffffff !important;
  transform: translateX(4px) !important;
}

[data-theme="light"] .sidebar-nav-item.active::before,
[data-theme="light"] .sidebar-folder-content .sidebar-nav-item.active::before {
  background: #0284c7 !important;
  box-shadow: 0 0 8px #0284c7, 0 0 16px #38bdf8 !important;
}

[data-theme="light"] .sidebar-nav-item.active .nav-title,
[data-theme="light"] .sidebar-folder-content .sidebar-nav-item.active .nav-title {
  color: #0c4a6e !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4) !important;
  font-weight: 900 !important;
}

[data-theme="light"] .sidebar-nav-item.active .nav-sub,
[data-theme="light"] .sidebar-folder-content .sidebar-nav-item.active .nav-sub {
  color: #0369a1 !important;
  font-weight: 700 !important;
  text-shadow: none !important;
}

[data-theme="light"] .sidebar-nav-item.active .nav-icon-badge,
[data-theme="light"] .sidebar-folder-content .sidebar-nav-item.active .nav-icon-badge {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.6) !important;
}

[data-theme="light"] .sidebar-nav-item.active .nav-badge-pill,
[data-theme="light"] .sidebar-folder-content .sidebar-nav-item.active .nav-badge-pill {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.4) !important;
}

/* RTL Support */
html[dir="rtl"] .sidebar-nav-item.active::before,
html[dir="rtl"] .sidebar-folder-content .sidebar-nav-item.active::before {
  left: auto !important;
  right: 0 !important;
  border-radius: 4px 0 0 4px !important;
}
html[dir="rtl"] .sidebar-nav-item.active,
html[dir="rtl"] .sidebar-folder-content .sidebar-nav-item.active {
  transform: translateX(-4px) !important;
}

.nav-icon-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.nav-text-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nav-title {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}



.nav-badge-count {
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.nav-badge-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

/* High-Density Compact Styling for Sidebar Folders (e.g. Bahrain & Saudi Operations) */
.sidebar-folder-content .sidebar-section-heading {
  font-size: 7.5px !important;
  font-weight: 800 !important;
  padding: 2px 4px 1px 4px !important;
  margin-top: 3px !important;
  letter-spacing: 0.06em !important;
}

.sidebar-folder-content .sidebar-nav-item {
  padding: 3.5px 6px !important;
  gap: 5px !important;
  border-radius: 6px !important;
  margin-bottom: 1.5px !important;
  min-height: 28px !important;
}

.sidebar-folder-content .nav-icon-badge {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  font-size: 10px !important;
  border-radius: 5px !important;
}

.sidebar-folder-content .nav-icon-badge svg {
  width: 12px !important;
  height: 12px !important;
}

.sidebar-folder-content .nav-title {
  font-size: 10px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
}

.sidebar-folder-content .nav-sub {
  font-size: 7.5px !important;
  line-height: 1 !important;
  margin-top: 0.5px !important;
}

.sidebar-folder-content .nav-badge-pill,
.sidebar-folder-content .nav-badge-count {
  font-size: 7.5px !important;
  padding: 1px 4px !important;
  border-radius: 4px !important;
}

/* Sidebar Footer (Pinned strictly to absolute bottom-left) */
.sidebar-footer {
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  margin-top: auto !important;
  margin-bottom: 8px !important;
  padding: 5px 7px !important;
  border-top: 1.5px solid rgba(56, 189, 248, 0.35) !important;
  background: rgba(15, 23, 42, 0.98) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(56, 189, 248, 0.28) !important;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 50 !important;
}

.sidebar-user-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
}

.user-role-badge {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 2.5px 6px !important;
  border-radius: 5px !important;
  background: rgba(30, 41, 59, 0.85) !important;
  border: 1px solid var(--border-color) !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  color: var(--text-secondary) !important;
  line-height: 1.15 !important;
}

body.is-master-admin .user-role-badge {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
  color: #34d399 !important;
}

.sidebar-admin-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  flex: 1 !important;
  padding: 2px 4px !important;
  height: 22px !important;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  border: 1px solid #f59e0b !important;
  border-radius: 5px !important;
  font-size: 9.5px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3) !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}

.sidebar-admin-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.45) !important;
}

.sidebar-switch-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  flex: 1 !important;
  padding: 2px 4px !important;
  height: 22px !important;
  background: rgba(30, 41, 59, 0.9) !important;
  color: #94a3b8 !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 5px !important;
  font-size: 9.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}

.sidebar-switch-btn:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
}

@media (max-height: 800px) {
  .app-sidebar {
    padding: 3px 5px 8px 5px !important;
  }
  .sidebar-brand-section {
    padding: 1px 4px 3px 4px !important;
  }
  .sidebar-brand-section svg {
    width: 30px !important;
    height: 30px !important;
  }
  .sidebar-brand-text h2 {
    font-size: 12px !important;
  }
  .sidebar-nav {
    max-height: calc(100vh - 125px) !important;
    max-height: calc(100dvh - 125px) !important;
    padding: 2px 2px 2px 2px !important;
    gap: 1px !important;
  }
  .sidebar-folder-header {
    padding: 4.5px 6px !important;
  }
  .sidebar-subfolder-header {
    padding: 3.5px 5px !important;
  }
  .sidebar-folder-content .sidebar-nav-item {
    padding: 2px 5px !important;
    min-height: 25px !important;
  }
  .sidebar-footer {
    padding: 4px 6px !important;
    margin-bottom: 6px !important;
  }
  .user-role-badge {
    padding: 2px 5px !important;
    font-size: 9.5px !important;
  }
  .sidebar-switch-btn, .sidebar-admin-btn, .sidebar-logout-btn {
    height: 22px !important;
    font-size: 9.5px !important;
    padding: 1px 4px !important;
  }
}

@media (max-height: 650px) {
  .app-sidebar {
    padding: 2px 4px 6px 4px !important;
  }
  .sidebar-brand-section {
    padding: 1px 3px 2px 3px !important;
  }
  .sidebar-brand-section svg {
    width: 26px !important;
    height: 26px !important;
  }
  .sidebar-brand-text h2 {
    font-size: 11px !important;
  }
  .sidebar-nav {
    max-height: calc(100vh - 110px) !important;
    max-height: calc(100dvh - 110px) !important;
    padding: 1px !important;
    gap: 0.5px !important;
  }
  .sidebar-folder-header {
    padding: 3.5px 5px !important;
  }
  .sidebar-subfolder-header {
    padding: 2.5px 4px !important;
  }
  .sidebar-folder-content .sidebar-nav-item {
    padding: 1.5px 4px !important;
    min-height: 22px !important;
  }
  .sidebar-footer {
    padding: 2.5px 5px !important;
    margin-bottom: 4px !important;
  }
  .user-role-badge {
    padding: 1.5px 3px !important;
    font-size: 8.5px !important;
  }
  .sidebar-switch-btn, .sidebar-admin-btn, .sidebar-logout-btn {
    height: 19px !important;
    font-size: 8.5px !important;
    padding: 0 2px !important;
  }
}

.sidebar-logout-btn {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}

.sidebar-logout-btn:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

/* Active User Top Pill */
.user-top-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  user-select: none;
}

[data-theme="light"] .user-top-pill {
  background: rgba(241, 245, 249, 0.9);
}

.user-pill-name {
  font-weight: 700;
  color: #38bdf8;
}

[data-theme="light"] .user-pill-name {
  color: #0284c7;
}

.user-top-logout-btn {
  background: transparent;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.user-top-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ============================================================
   TOP RIGHT CORNER PROMINENT RED SIGNAL BEACON CARD (LARGE BULB & CLEAN TEXT)
   ============================================================ */
.red-signal-beacon-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  border-radius: 50px;
  padding: 6px 16px 6px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 14px rgba(239, 68, 68, 0.15);
  transition: all 0.25s ease;
  user-select: none;
  cursor: default;
  flex-shrink: 0;
}

[data-theme="light"] .red-signal-beacon-card {
  background: #ffffff;
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.red-signal-beacon-card:hover {
  border-color: #ef4444;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

.red-signal-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent !important;
  color: #ffffff;
  border: none;
  padding: 0;
  box-shadow: none !important;
}

.signal-red-lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #ff8a8a 25%, #ef4444 65%, #7f1d1d 100%);
  box-shadow: 0 0 10px #ef4444, 0 0 20px rgba(239, 68, 68, 0.9);
  display: inline-block;
  animation: redLampBreathing 2.6s ease-in-out infinite;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.signal-pill-title {
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
}

[data-theme="light"] .signal-pill-title {
  color: #0f172a;
}

.red-signal-status-box {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-left: 1.5px solid rgba(239, 68, 68, 0.3);
  padding-left: 10px;
}

.red-signal-status-box .red-signal-sub-lbl {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  color: #f87171;
  letter-spacing: 0.05em;
}

[data-theme="light"] .red-signal-status-box .red-signal-sub-lbl {
  color: #dc2626;
}

.red-signal-status-box .red-signal-sub-val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

@keyframes redLampBreathing {
  0% {
    transform: scale(0.9);
    opacity: 0.45;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.35);
  }
  50% {
    transform: scale(1.22);
    opacity: 1;
    box-shadow: 0 0 14px #ef4444, 0 0 28px rgba(239, 68, 68, 0.95);
  }
  100% {
    transform: scale(0.9);
    opacity: 0.45;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.35);
  }
}

/* ============================================================
   MAIN WORKSPACE & VIEWPORT SIZING (NO-ZOOM GUARANTEE)
   ============================================================ */
.app-main-workspace {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: calc(100vw - 260px) !important;
  max-width: calc(100vw - 260px) !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-y: scroll !important; /* Visible Right-Side Scrollbar Track Guaranteed */
  overflow-x: hidden !important;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  box-sizing: border-box !important;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #0284c7 rgba(15, 23, 42, 0.9);
}

/* High-Contrast Beautiful Right-Side Scrollbar for Dashboard Workspace */
.app-main-workspace::-webkit-scrollbar {
  width: 11px !important;
}

.app-main-workspace::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.95) !important;
  border-left: 1px solid rgba(56, 189, 248, 0.25) !important;
}

.app-main-workspace::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
  border-radius: 6px !important;
  border: 2px solid rgba(15, 23, 42, 0.95) !important;
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.35) !important;
}

.app-main-workspace::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%) !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7) !important;
}

/* High-Contrast Scrollbar for All Data Tables on Dashboard */
.table-responsive::-webkit-scrollbar,
#saudi-dispatch-table-container::-webkit-scrollbar,
#inventory-table-container::-webkit-scrollbar,
#packing-inventory-table-container::-webkit-scrollbar,
#consumption-table-container::-webkit-scrollbar,
#packing-consumption-table-container::-webkit-scrollbar,
#prod-table-container::-webkit-scrollbar,
#dpr-summary-table-container::-webkit-scrollbar,
#costing-master-table-container::-webkit-scrollbar,
#prices-master-table-container::-webkit-scrollbar,
#material-bom-active-table-container::-webkit-scrollbar,
#labour-monthly-table-container::-webkit-scrollbar {
  width: 11px !important;
  height: 11px !important;
}

.table-responsive::-webkit-scrollbar-track,
#saudi-dispatch-table-container::-webkit-scrollbar-track,
#inventory-table-container::-webkit-scrollbar-track,
#packing-inventory-table-container::-webkit-scrollbar-track,
#consumption-table-container::-webkit-scrollbar-track,
#packing-consumption-table-container::-webkit-scrollbar-track,
#prod-table-container::-webkit-scrollbar-track,
#dpr-summary-table-container::-webkit-scrollbar-track,
#costing-master-table-container::-webkit-scrollbar-track,
#prices-master-table-container::-webkit-scrollbar-track,
#material-bom-active-table-container::-webkit-scrollbar-track,
#labour-monthly-table-container::-webkit-scrollbar-track {
  background: #0f172a !important;
  border-radius: 6px !important;
}

.table-responsive::-webkit-scrollbar-thumb,
#saudi-dispatch-table-container::-webkit-scrollbar-thumb,
#inventory-table-container::-webkit-scrollbar-thumb,
#packing-inventory-table-container::-webkit-scrollbar-thumb,
#consumption-table-container::-webkit-scrollbar-thumb,
#packing-consumption-table-container::-webkit-scrollbar-thumb,
#prod-table-container::-webkit-scrollbar-thumb,
#dpr-summary-table-container::-webkit-scrollbar-thumb,
#costing-master-table-container::-webkit-scrollbar-thumb,
#prices-master-table-container::-webkit-scrollbar-thumb,
#material-bom-active-table-container::-webkit-scrollbar-thumb,
#labour-monthly-table-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%) !important;
  border-radius: 6px !important;
  border: 2px solid #0f172a !important;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
#saudi-dispatch-table-container::-webkit-scrollbar-thumb:hover,
#inventory-table-container::-webkit-scrollbar-thumb:hover,
#packing-inventory-table-container::-webkit-scrollbar-thumb:hover,
#consumption-table-container::-webkit-scrollbar-thumb:hover,
#packing-consumption-table-container::-webkit-scrollbar-thumb:hover,
#prod-table-container::-webkit-scrollbar-thumb:hover,
#dpr-summary-table-container::-webkit-scrollbar-thumb:hover,
#costing-master-table-container::-webkit-scrollbar-thumb:hover,
#prices-master-table-container::-webkit-scrollbar-thumb:hover,
#material-bom-active-table-container::-webkit-scrollbar-thumb:hover,
#labour-monthly-table-container::-webkit-scrollbar-thumb:hover {
  background: #fbbf24 !important;
  box-shadow: 0 0 8px #f59e0b !important;
}

.workspace-top-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 42px !important;
  height: 42px !important;
  padding: 0 12px !important;
  border-bottom: 1.5px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  width: 100%;
}

[data-theme="light"] .workspace-top-bar {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  height: 32px;
}

.workspace-body-container {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px 14px 12px 14px !important;
  display: flex;
  flex-direction: column;
}

/* Tab View Transitions & Attractive Smooth Entry Animation */
.tab-view-content {
  display: none;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.tab-view-content.active,
.tab-view-content[style*="display: block"],
.tab-view-content[style*="display: flex"] {
  display: block;
  animation: tabViewEnterAnim 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tabViewEnterAnim {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   TAB 1: FULL-WIDTH SCREEN-FIT CRITICAL TABLE & BOTTOM CHART
   ============================================================ */
.critical-alert-card-white {
  background: #ffffff;
  border: 1.5px solid #ef4444;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px -2px rgba(239, 68, 68, 0.14), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
}

.runway-chart-bottom-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px 22px;
  margin-top: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.runway-chart-bottom-card .chart-container {
  width: 100% !important;
  height: 280px !important;
  min-height: 250px;
  position: relative;
}

/* ============================================================
   MANDATORY ENTERPRISE SECURITY LOGIN GATE (v2.20)
   ============================================================ */
.portal-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.portal-gate-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  animation: gateCardPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gateCardPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.gate-brand-header {
  text-align: center;
  margin-bottom: 20px;
}

.gate-logo-wrap {
  margin-bottom: 10px;
}

.gate-logo-img {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

.gate-brand-title {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ffffff 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.gate-brand-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
  font-weight: 500;
}

.gate-security-notice {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11.5px;
  color: #7dd3fc;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
  text-align: center;
}

.gate-form-group {
  margin-bottom: 16px;
}

.gate-form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gate-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.gate-input-icon {
  position: absolute;
  left: 12px;
  font-size: 15px;
  pointer-events: none;
  color: #64748b;
}

.gate-input-wrap input {
  width: 100%;
  padding: 12px 42px 12px 38px;
  border-radius: 10px;
  border: 1.5px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
}

.gate-eye-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.15s ease;
  z-index: 5;
  outline: none;
}

.gate-eye-toggle:hover {
  color: #38bdf8;
  transform: translateY(-50%) scale(1.1);
}

.gate-eye-toggle:active {
  transform: translateY(-50%) scale(0.92);
}

.gate-eye-toggle svg {
  display: block;
}

.gate-input-wrap input:focus {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.gate-error-message {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

.gate-submit-btn {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.4);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gate-submit-btn:hover {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(2, 132, 199, 0.5);
}

.gate-footer-badge {
  text-align: center;
  margin-top: 20px;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

/* ============================================================
   USER MANAGEMENT & RBAC ADMIN PANEL (v2.00)
   ============================================================ */
.admin-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .admin-panel-grid {
    grid-template-columns: 1fr;
  }
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: var(--bg-tertiary);
  font-size: 11.5px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.user-module-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  margin: 2px 2px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.user-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.user-action-login {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-action-login:hover {
  background: #10b981;
  color: #ffffff;
}

.user-action-edit {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.user-action-edit:hover {
  background: #0284c7;
  color: #ffffff;
}

.user-action-del {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.user-action-del:hover {
  background: #ef4444;
  color: #ffffff;
}

.edit-tab-select-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.edit-tab-select-card:hover {
  border-color: rgba(56, 189, 248, 0.5) !important;
  background: rgba(56, 189, 248, 0.08) !important;
  transform: translateY(-1px);
}

/* Master Admin & Security Badge Styles */
.admin-only-control {
  display: none !important;
}

body.is-master-admin .admin-only-control {
  display: inline-flex !important;
}

.viewer-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.35);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  user-select: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.15);
}

.viewer-mode-badge:hover {
  background: rgba(34, 197, 94, 0.22);
  transform: translateY(-1px);
}

[data-theme="light"] .viewer-mode-badge {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

body.is-master-admin .viewer-mode-badge {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

[data-theme="light"] body.is-master-admin .viewer-mode-badge {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

/* Live Sync Badge */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse 2s infinite;
}

.pulse-dot.error {
  background-color: #ef4444;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #0f172a;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-secondary);
}

.btn-critical {
  background: var(--critical-bg);
  color: var(--critical-text);
  border-color: var(--critical-border);
}

.btn-critical:hover {
  background: var(--critical-border);
  color: white;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Main View Navigation Switcher */
.main-view-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 0;
  background: var(--bg-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  width: 100%;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

[data-theme="light"] .main-view-switcher {
  background: #ffffff;
  border-color: rgba(203, 213, 225, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Active File & Report Indicator in Main Navigation */
/* Active File & Report Indicator in Main Navigation (Compact Sleek Pill) */
.active-file-indicator-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 3px 10px;
  height: 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
  flex-shrink: 0;
  max-width: 250px;
  box-sizing: border-box;
}

.active-file-indicator-pill:hover {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.85);
  box-shadow: 0 3px 12px rgba(56, 189, 248, 0.2);
}

.file-pill-left {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.file-pill-icon {
  font-size: 11px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(56, 189, 248, 0.2);
}

.file-pill-text-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  width: 100%;
}

.file-pill-top {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1.1;
}

.file-pill-tag {
  font-size: 7.5px;
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-pill-report-name {
  font-size: 10.5px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.file-pill-bottom {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  line-height: 1.1;
}

.file-pill-source-tag {
  font-size: 7.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.file-pill-filename {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 0px 4px;
  border-radius: 3px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* Light mode support for active file pill */
[data-theme="light"] .active-file-indicator-pill {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .file-pill-report-name {
  color: #0f172a;
}

[data-theme="light"] .file-pill-filename {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #bae6fd;
}

/* Master Live Update Card */
.live-update-round-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  background: rgba(34, 197, 94, 0.08);
  border: 1.2px solid rgba(34, 197, 94, 0.35);
  border-radius: 8px;
  padding: 2px 8px 2px 3px;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.12);
  transition: var(--transition);
  flex-shrink: 0;
  box-sizing: border-box;
}

.live-update-round-card:hover {
  border-color: #22c55e;
  box-shadow: 0 3px 12px rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.14);
}

.round-live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
  transition: all 0.25s ease;
  user-select: none;
  box-sizing: border-box;
  white-space: nowrap;
}

.round-live-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.5);
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.round-live-btn:active {
  transform: scale(0.98);
}

.btn-spinner-icon {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.btn-spinner-icon.spinning {
  animation: spinIcon 0.8s linear infinite;
}

@keyframes spinIcon {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.live-update-timestamp-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}

.live-update-timestamp-box .ts-label {
  font-size: 7.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #16a34a;
  letter-spacing: 0.03em;
}

.live-update-timestamp-box .ts-day-time {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ======================================================== */
/* FIREBASE MANUAL SYNC HEADER CARD */
/* ======================================================== */
.firebase-sync-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  background: rgba(56, 189, 248, 0.08);
  border: 1.2px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 2px 8px 2px 3px;
  box-shadow: 0 2px 6px rgba(56, 189, 248, 0.12);
  transition: var(--transition);
  flex-shrink: 0;
  box-sizing: border-box;
}

.firebase-sync-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 3px 12px rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.14);
}

.round-firebase-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
  transition: all 0.25s ease;
  user-select: none;
  box-sizing: border-box;
  white-space: nowrap;
}

.round-firebase-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.5);
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.round-firebase-btn:active {
  transform: scale(0.98);
}

.firebase-timestamp-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}

.firebase-timestamp-box .fb-ts-label {
  font-size: 7.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0284c7;
  letter-spacing: 0.03em;
}

.firebase-timestamp-box .fb-ts-val {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.view-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.view-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.view-tab-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
  color: #ffffff !important;
  border: 1.5px solid #38bdf8 !important;
  font-weight: 800 !important;
  box-shadow: 
    0 0 15px rgba(56, 189, 248, 0.75), 
    0 0 30px rgba(14, 165, 233, 0.45), 
    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
  transform: translateY(-1px) scale(1.02) !important;
}

.view-tab-btn .tab-icon {
  font-size: 16px;
}

/* Blue Corporate Theme for both Bahrain & Saudia Folder Buttons */
#bahrain-folder-btn,
#saudia-folder-btn {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff;
  border: 1.5px solid #38bdf8;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#bahrain-folder-btn .dropdown-arrow,
#saudia-folder-btn .dropdown-arrow {
  color: #ffffff;
}

#bahrain-folder-btn:hover,
#saudia-folder-btn:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.55);
  transform: translateY(-1px);
}

#bahrain-folder-btn.open,
#saudia-folder-btn.open {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4), 0 4px 16px rgba(56, 189, 248, 0.6);
}

/* Dropdown Folder Menu for Inventory */
.dropdown-folder-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-toggle-btn {
  user-select: none;
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.25s ease;
  color: var(--text-muted);
  margin-left: 2px;
}

.dropdown-toggle-btn.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-toggle-btn.active .dropdown-arrow {
  color: #0f172a;
}

.folder-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #1e293b;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(56, 189, 248, 0.2);
  min-width: 320px;
  z-index: 2000;
  display: none;
  flex-direction: column;
  padding: 8px;
  backdrop-filter: blur(20px);
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .folder-dropdown-menu {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.folder-dropdown-menu.show {
  display: flex;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 12px 8px 12px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

/* Nested Subfolder Styles inside Dropdown */
.subfolder-container {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-top: 2px;
}

.subfolder-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(56, 189, 248, 0.08);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.subfolder-title-bar:hover {
  background: rgba(56, 189, 248, 0.16);
}

.subfolder-title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subfolder-icon {
  font-size: 16px;
}

.subfolder-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.subfolder-chevron {
  font-size: 11px;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.subfolder-title-bar.collapsed .subfolder-chevron {
  transform: rotate(-90deg);
}

.subfolder-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-left: 6px;
  border-left: 2px solid rgba(56, 189, 248, 0.3);
  margin-left: 6px;
}

.subfolder-content.hidden {
  display: none;
}

/* Prominent Dark Emerald Styling for Sale Subfolder */
#btn-toggle-sale-folder:hover {
  background: linear-gradient(135deg, #065f46 0%, #047857 50%, #059669 100%) !important;
  border-color: #34d399 !important;
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  transform: translateY(-1px);
}

#btn-toggle-sale-folder:active {
  transform: translateY(0) scale(0.98);
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.dropdown-menu-item:hover {
  background: var(--bg-tertiary);
}

.dropdown-menu-item.active {
  background: rgba(56, 189, 248, 0.15);
  border-left: 3px solid var(--primary);
}

.dropdown-menu-item .menu-icon {
  font-size: 18px;
}

.dropdown-menu-item .menu-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-menu-item .menu-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.dropdown-menu-item.active .menu-title {
  color: var(--primary);
}

.dropdown-menu-item .menu-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ======================================================== */
/* PRODUCTION QUARTER-WISE BI DASHBOARD STYLES */
/* ======================================================== */
.production-header-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.12) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.prod-badge-icon {
  font-size: 18px;
  background: rgba(16, 185, 129, 0.15);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.production-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.production-banner-actions .btn {
  padding: 4px 10px !important;
  font-size: 11.5px !important;
}

.production-banner-actions .source-tag {
  font-size: 10.5px !important;
  padding: 3px 8px !important;
}

/* 4-Column Executive Production Section Cards */
.kpi-grid-production-4cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 1280px) {
  .kpi-grid-production-4cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .kpi-grid-production-4cols {
    grid-template-columns: 1fr;
  }
}

.prod-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.prod-section-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.prod-card-det {
  border-top: 3.5px solid #38bdf8;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.05) 0%, var(--bg-card) 100%);
}

.prod-card-acid {
  border-top: 3.5px solid #ef4444;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.05) 0%, var(--bg-card) 100%);
}

.prod-card-offer {
  border-top: 3.5px solid #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-card) 100%);
}

.prod-card-bulk {
  border-top: 3.5px solid #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-card) 100%);
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.section-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-badge-icon {
  font-size: 16px;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-card-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.section-card-sub {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.section-metrics-grid {
  display: grid;
  gap: 6px;
  flex: 1;
}

.section-metrics-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.section-metrics-grid.cols-4-compact {
  grid-template-columns: repeat(4, 1fr);
}

.section-metrics-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.metric-sub-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}

.metric-lbl {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.metric-val {
  font-size: 15px;
  font-weight: 900;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.text-cyan { color: #0284c7; }
.text-purple { color: #7c3aed; }
.text-amber { color: #d97706; }
.text-green { color: #059669; }
.text-red { color: #dc2626; }
.text-pink { color: #db2777; }

.metric-footer {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

.section-card-tonnage-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  font-size: 10.5px;
}

.section-card-tonnage-footer .t-lbl {
  color: var(--text-secondary);
  font-weight: 600;
}

.section-card-tonnage-footer .t-val {
  font-weight: 800;
  font-family: var(--font-mono);
}

/* Combined Detergent + Acid Mini Tab (Prominent Executive Yellow) */
.detacid-combined-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(251, 191, 36, 0.25) 50%, rgba(245, 158, 11, 0.14) 100%);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
  position: relative;
}

[data-theme="dark"] .detacid-combined-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.15) 100%);
  border: 2px solid #fbbf24;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}

.comb-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comb-icon {
  font-size: 16px;
  background: #f59e0b;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.comb-title {
  font-size: 12px;
  font-weight: 900;
  color: #b45309;
  letter-spacing: 0.03em;
  display: block;
}

[data-theme="dark"] .comb-title {
  color: #fde047;
}

.comb-sub {
  font-size: 10px;
  color: #78350f;
  font-weight: 600;
  display: block;
}

[data-theme="dark"] .comb-sub {
  color: #fef08a;
}

.comb-metrics-group {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.comb-metric-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.comb-lbl {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comb-val {
  font-size: 16px;
  font-weight: 900;
  font-family: var(--font-mono);
}

.comb-divider {
  color: #f59e0b;
  font-weight: 900;
}

/* Ultra-Compact Production Toolbar */
.prod-toolbar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.prod-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.prod-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 8.5px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  min-width: 55px;
}

.prod-pills-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.prod-pill {
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.2;
}

.prod-pill:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.prod-pill.active {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.35);
}

/* Golden-Yellow Preset Pills for Custom Production Date Range Selector */
#dpr-quick-range-presets .prod-pill {
  background: rgba(45, 36, 12, 0.7);
  color: #fef08a;
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#dpr-quick-range-presets .prod-pill:hover {
  background: rgba(234, 179, 8, 0.25);
  border-color: #facc15;
  color: #ffffff;
  transform: translateY(-1px);
}

#dpr-quick-range-presets .prod-pill.active {
  background: linear-gradient(135deg, #facc15 0%, #eab308 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  border-color: #facc15 !important;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.5) !important;
}

/* Date-Wise Production Filter Controls */
.prod-date-filter-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.prod-days-pills-wrap {
  display: flex;
  gap: 2px !important;
  flex-wrap: wrap;
  align-items: center;
}

.prod-day-pill {
  min-width: 20px !important;
  width: 20px !important;
  height: 19px !important;
  padding: 0 1px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 8.5px !important;
  font-weight: 800 !important;
  border-radius: 3px !important;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  line-height: 1 !important;
}

.prod-day-pill:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.prod-day-pill.active {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%) !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.4) !important;
  transform: translateY(-1px);
}

.prod-day-pill[data-day="ALL"],
.prod-day-pill[data-prod-day="ALL"] {
  min-width: 48px !important;
  width: auto !important;
  padding: 0 6px !important;
  border-radius: 12px !important;
}

.prod-day-pill[data-day="ALL"].active,
.prod-day-pill[data-prod-day="ALL"].active {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.4) !important;
}

#dpr-sum-month-pills .prod-pill,
#dpr-sum-brand-pills .prod-pill {
  padding: 1px 6px !important;
  font-size: 8.5px !important;
  height: 19px !important;
  line-height: 16px !important;
  border-radius: 10px !important;
}

.dpr-custom-range-card input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8) sepia(100%) saturate(500%) hue-rotate(5deg);
  cursor: pointer;
  width: 12px;
  height: 12px;
}

/* ==============================================================================
   SAUDI OPERATIONS: HIDE BAHRAIN 4-SECTIONS DPR WHITE BANNER & GREEN RIBBON
   ============================================================================== */
body.facility-saudi #tab-content-daily-production .dpr-white-round-card,
body.facility-saudi #tab-content-daily-production .dpr-summary-green-ribbon {
  display: none !important;
}

body.facility-saudi #tab-content-daily-production .dpr-saudi-mini-controls {
  display: inline-flex !important;
}

.prod-date-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 50px;
  padding: 2px 10px;
  animation: fadeIn 0.25s ease;
}

/* Compact Production Charts Grid */
.prod-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.prod-charts-grid .chart-card {
  padding: 12px 14px;
}

.prod-charts-grid .chart-body {
  height: 210px !important;
}

/* High-Density Compact Production Master Table (Crisp White Theme) */
#prod-table-container {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  background: #ffffff !important;
  -webkit-overflow-scrolling: touch;
}

#prod-table-container::-webkit-scrollbar {
  height: 9px !important;
  width: 9px !important;
}

#prod-table-container::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
  border-radius: 4px !important;
}

#prod-table-container::-webkit-scrollbar-thumb {
  background: #f59e0b !important;
  border-radius: 4px !important;
}

#prod-table-container::-webkit-scrollbar-thumb:hover {
  background: #d97706 !important;
}

#prod-table,
#prod-table-container .prod-master-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: #ffffff !important;
}

.prod-master-table {
  font-size: 11.5px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff !important;
}

.prod-master-table thead {
  background: #fef08a !important;
}

.prod-master-table th {
  padding: 6px 8px !important;
  font-size: 11.5px !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #713f12 !important;
  border-bottom: 2.5px solid #ca8a04 !important;
  border-right: 1px solid #eab308 !important;
  position: sticky;
  top: 0;
  z-index: 4;
  box-shadow: 0 2px 5px rgba(202, 138, 4, 0.25);
}

.prod-master-table th.prod-sticky-code {
  position: sticky !important;
  left: 0 !important;
  z-index: 15 !important;
  width: 85px !important;
  min-width: 85px !important;
  max-width: 85px !important;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #713f12 !important;
  border-right: 1px solid #eab308 !important;
}

.prod-master-table th.prod-sticky-desc {
  position: sticky !important;
  left: 85px !important;
  z-index: 15 !important;
  width: 250px !important;
  min-width: 250px !important;
  max-width: 250px !important;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #713f12 !important;
  border-right: 1px solid #eab308 !important;
}

.prod-master-table th.prod-sticky-cat {
  position: sticky !important;
  left: 335px !important;
  z-index: 15 !important;
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #713f12 !important;
  border-right: 2px solid #ca8a04 !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.12) !important;
}

.prod-master-table tbody tr {
  background: #ffffff !important;
  transition: background 0.15s ease;
}

.prod-master-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

.prod-master-table tbody tr:hover {
  background: #eff6ff !important;
}

.prod-master-table td {
  padding: 5px 8px !important;
  font-size: 11.5px !important;
  line-height: 1.35 !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #f1f5f9 !important;
}

.prod-master-table tbody td.prod-sticky-code {
  position: sticky !important;
  left: 0 !important;
  z-index: 5 !important;
  width: 85px !important;
  min-width: 85px !important;
  max-width: 85px !important;
  background: #ffffff !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  font-family: var(--font-mono) !important;
  border-right: 1px solid #e2e8f0 !important;
}

.prod-master-table tbody td.prod-sticky-desc {
  position: sticky !important;
  left: 85px !important;
  z-index: 5 !important;
  width: 250px !important;
  min-width: 250px !important;
  max-width: 250px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-right: 1px solid #e2e8f0 !important;
}

.prod-master-table tbody td.prod-sticky-cat {
  position: sticky !important;
  left: 335px !important;
  z-index: 5 !important;
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  background: #ffffff !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08) !important;
  border-right: 1.5px solid #cbd5e1 !important;
}

.prod-master-table tbody tr:nth-child(even) td.prod-sticky-code,
.prod-master-table tbody tr:nth-child(even) td.prod-sticky-desc,
.prod-master-table tbody tr:nth-child(even) td.prod-sticky-cat {
  background: #f8fafc !important;
}

.prod-master-table tbody tr:hover td.prod-sticky-code,
.prod-master-table tbody tr:hover td.prod-sticky-desc,
.prod-master-table tbody tr:hover td.prod-sticky-cat {
  background: #eff6ff !important;
}

/* Category Badge High-Contrast Enhancements for White Table */
.prod-master-table .prod-sticky-cat span {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
  font-weight: 800 !important;
  border-width: 1.5px !important;
}

/* Cases (CS) Pill Badge Rich Highlight */
.prod-master-table tbody td span[style*="linear-gradient(135deg, #bae6fd"] {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
  color: #0369a1 !important;
  border: 1px solid #38bdf8 !important;
  font-weight: 900 !important;
}

/* Bottles, Sets, Tons Bold Vibrant Colors on White */
.prod-master-table tbody td[style*="color: #7c3aed"] {
  color: #7c3aed !important;
  font-weight: 800 !important;
}

.prod-master-table tbody td[style*="color: #db2777"] {
  color: #db2777 !important;
  font-weight: 800 !important;
}

.prod-master-table tbody td[style*="color: #059669"] {
  color: #059669 !important;
  font-weight: 800 !important;
}

/* Bulk Manufacturing & White Text Safety Override (Never invisible on white) */
.prod-master-table tbody td[style*="color: #ffffff"] {
  color: #059669 !important;
  font-weight: 800 !important;
}

/* Clear Grey Contrast for Nil / Dash Values */
.prod-master-table tbody td[style*="color: var(--text-muted)"],
.prod-master-table tbody td span[style*="color: var(--text-muted)"] {
  color: #94a3b8 !important;
  font-weight: 600 !important;
}

/* Total Column Cell Background */
.prod-master-table tbody td:last-child {
  background: #fefce8 !important;
  border-left: 1.5px solid #facc15 !important;
}

.prod-master-table tbody tr:hover td:last-child {
  background: #fef9c3 !important;
}

[data-theme="light"] .prod-master-table tbody td.prod-sticky-code,
[data-theme="light"] .prod-master-table tbody td.prod-sticky-desc,
[data-theme="light"] .prod-master-table tbody td.prod-sticky-cat {
  background: #ffffff !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .prod-master-table tbody tr:hover td.prod-sticky-code,
[data-theme="light"] .prod-master-table tbody tr:hover td.prod-sticky-desc,
[data-theme="light"] .prod-master-table tbody tr:hover td.prod-sticky-cat {
  background: #eff6ff !important;
}

.prod-master-table tfoot {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 50%, #f97316 100%) !important;
  z-index: 5;
  box-shadow: 0 -4px 15px rgba(249, 115, 22, 0.35);
}

.prod-master-table tfoot tr {
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 50%, #f97316 100%) !important;
}

.prod-master-table tfoot td {
  padding: 7px 10px !important;
  font-size: 12.5px !important;
  font-weight: 900 !important;
  border-top: 3.5px solid #ea580c !important;
  border-bottom: 2.5px solid #9a3412 !important;
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 50%, #f97316 100%) !important;
  color: #000000 !important;
}

.prod-master-table tfoot td.prod-sticky-foot-label {
  position: sticky !important;
  left: 0 !important;
  z-index: 16 !important;
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 50%, #f97316 100%) !important;
  color: #000000 !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
}

/* ========================================================
   GLOBAL INTERACTIVE TABLE SIZE & HEIGHT ADJUSTER CONTROLS
   ======================================================== */
.table-size-adjuster {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-secondary);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.table-size-adjuster .adjuster-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-muted);
  margin-right: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-size-adjuster .size-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.table-size-adjuster .size-btn:hover {
  background: var(--bg-card);
  color: var(--primary);
  border-color: var(--border-color);
}

.table-size-adjuster .size-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(56, 189, 248, 0.35);
}

.table-size-adjuster .size-btn.focus-btn {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.3);
}

.table-size-adjuster .size-btn.focus-btn:hover,
.table-size-adjuster .size-btn.focus-btn.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
}

/* User-Draggable Native Vertical Resizing for All Tables */
.table-responsive {
  resize: vertical;
  overflow: auto;
  min-height: 180px;
  transition: max-height 0.25s ease;
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Fullscreen / Focus Mode (True 100% Screen Coverage) */
.fullscreen-focus,
.table-section.fullscreen-focus,
.critical-alert-card-white.fullscreen-focus,
.monthly-table-card.fullscreen-focus {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  z-index: 2147483647 !important;
  background: var(--bg-card, #090d16) !important;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.95) !important;
  border-radius: 0 !important;
  padding: 16px 28px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border: none !important;
}

.fullscreen-focus .table-responsive,
.table-section.fullscreen-focus .table-responsive,
.critical-alert-card-white.fullscreen-focus .table-responsive,
.monthly-table-card.fullscreen-focus .table-responsive,
.table-section.fullscreen-focus #costing-bom-cards-container {
  flex: 1 !important;
  max-height: calc(100vh - 110px) !important;
  height: calc(100vh - 110px) !important;
  overflow-y: auto !important;
  resize: none !important;
}

/* Enhanced Fullscreen Table Readability & Typography */
.fullscreen-focus table {
  width: 100% !important;
  font-size: 13px !important;
}

.fullscreen-focus table th {
  padding: 12px 14px !important;
  font-size: 13.5px !important;
}

.fullscreen-focus table td {
  padding: 11px 14px !important;
  font-size: 13.5px !important;
}

.fullscreen-focus table tfoot td {
  padding: 13px 14px !important;
  font-size: 14.5px !important;
}

.fullscreen-focus .size-btn.focus-btn {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  font-weight: 800 !important;
  padding: 5px 12px !important;
}

/* ============================================================
   ELEVATED FULLSCREEN TABLE POPUP MODAL (POP-UP OVERLAY)
   ============================================================ */
.table-fullscreen-popup-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 2147483647 !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(4, 7, 15, 0.88) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

.table-fullscreen-popup-overlay.active {
  display: flex !important;
  animation: popupOverlayFadeIn 0.2s ease-out forwards;
}

@keyframes popupOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.table-fullscreen-popup-backdrop {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  cursor: pointer !important;
}

.table-fullscreen-popup-dialog {
  position: relative !important;
  z-index: 10 !important;
  width: 94vw !important;
  height: 88vh !important;
  max-width: 1700px !important;
  background: #0f172a !important;
  border: 2px solid #38bdf8 !important;
  border-radius: 14px !important;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 50px rgba(56, 189, 248, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 14px 20px 16px 20px !important;
  overflow: hidden !important;
  animation: popupDialogZoomIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popupDialogZoomIn {
  from {
    transform: scale(0.95) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.table-fullscreen-popup-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding-bottom: 10px !important;
  border-bottom: 1.5px solid rgba(56, 189, 248, 0.2) !important;
  margin-bottom: 10px !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
}

.popup-close-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: #ffffff !important;
  border: 1px solid #f87171 !important;
  border-radius: 8px !important;
  padding: 5px 14px !important;
  font-size: 11.5px !important;
  font-weight: 900 !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.popup-close-btn:hover {
  background: #b91c1c !important;
  transform: scale(1.03) !important;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.65) !important;
}

.table-fullscreen-popup-content {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: #090d16 !important;
  position: relative !important;
}

.table-fullscreen-popup-content table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 11.5px !important;
}

.table-fullscreen-popup-content table th {
  padding: 8px 10px !important;
  font-size: 11.5px !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
}

.table-fullscreen-popup-content table td {
  padding: 6px 10px !important;
  font-size: 11.5px !important;
}

.table-fullscreen-popup-content table tfoot tr {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 25 !important;
}

.table-fullscreen-popup-content table tfoot td {
  padding: 8px 10px !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

/* Chemical Consumption View Specific Styles (Executive Vibrant Blue Theme) */
.consumption-header-banner {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #1d4ed8 100%) !important;
  border: 1.5px solid #38bdf8 !important;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
}

.consumption-header-banner .banner-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.consumption-header-banner .banner-icon {
  font-size: 16px;
  background: rgba(255, 255, 255, 0.18) !important;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff;
}

.consumption-header-banner .banner-title-wrap h2 {
  font-size: 14.5px;
  font-weight: 900;
  color: #ffffff !important;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.consumption-header-banner .banner-title-wrap p {
  font-size: 11px;
  font-weight: 600;
  color: #e0f2fe !important;
  margin: 2px 0 0 0;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.consumption-header-banner #export-consumption-csv-btn {
  background: #ffffff !important;
  color: #0369a1 !important;
  border: 1px solid #ffffff !important;
  font-weight: 900 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
  border-radius: 6px !important;
  transition: all 0.2s ease;
}

.consumption-header-banner #export-consumption-csv-btn:hover {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.consumption-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.consumption-kpi-grid .kpi-card {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.consumption-kpi-grid .kpi-header {
  margin-bottom: 2px;
}

.consumption-kpi-grid .kpi-title {
  font-size: 10.5px;
}

.consumption-kpi-grid .kpi-value {
  font-size: 17px;
  font-weight: 800;
  margin: 2px 0;
  line-height: 1.2;
}

.consumption-kpi-grid .kpi-sub {
  font-size: 10px;
}

#consumption-table-container {
  max-height: calc(100vh - 190px) !important;
  height: calc(100vh - 190px);
  overflow-y: auto;
  overflow-x: auto;
  width: 100%;
}

.consumption-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px !important;
}

/* High-Visibility Prominent Green Header Bar for Chemical Consumption Matrix Table */
.consumption-matrix-table th {
  padding: 6px 8px !important;
  font-size: 10.5px !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, #dcfce7 0%, #86efac 100%) !important;
  color: #064e3b !important;
  border-bottom: 2.5px solid #16a34a !important;
  border-top: 1px solid #bbf7d0 !important;
  position: sticky;
  top: 0;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

.consumption-matrix-table th:hover {
  background: linear-gradient(180deg, #f0fdf4 0%, #4ade80 100%) !important;
  color: #022c22 !important;
}

.consumption-matrix-table th.sticky-col-1 {
  position: sticky !important;
  left: 0 !important;
  z-index: 15 !important;
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  background: linear-gradient(180deg, #dcfce7 0%, #86efac 100%) !important;
}

.consumption-matrix-table th.sticky-col-2 {
  position: sticky !important;
  left: 60px !important;
  z-index: 15 !important;
  min-width: 220px !important;
  background: linear-gradient(180deg, #dcfce7 0%, #86efac 100%) !important;
}

.consumption-matrix-table th.sticky-col-3 {
  position: sticky !important;
  left: 280px !important;
  z-index: 15 !important;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  background: linear-gradient(180deg, #dcfce7 0%, #86efac 100%) !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.35) !important;
}

.consumption-matrix-table td {
  padding: 4px 8px !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}

.consumption-matrix-table tbody td.sticky-col-1 {
  position: sticky !important;
  left: 0 !important;
  z-index: 5 !important;
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  background: #1e293b !important; /* 100% Solid Opaque */
}

.consumption-matrix-table tbody td.sticky-col-2 {
  position: sticky !important;
  left: 60px !important;
  z-index: 5 !important;
  min-width: 220px !important;
  background: #1e293b !important; /* 100% Solid Opaque */
}

.consumption-matrix-table tbody td.sticky-col-3 {
  position: sticky !important;
  left: 280px !important;
  z-index: 5 !important;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  background: #1e293b !important; /* 100% Solid Opaque */
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.35) !important;
}

.consumption-matrix-table tbody tr:hover td.sticky-col-1,
.consumption-matrix-table tbody tr:hover td.sticky-col-2,
.consumption-matrix-table tbody tr:hover td.sticky-col-3 {
  background: #334155 !important;
}

[data-theme="light"] .consumption-matrix-table tbody td.sticky-col-1,
[data-theme="light"] .consumption-matrix-table tbody td.sticky-col-2,
[data-theme="light"] .consumption-matrix-table tbody td.sticky-col-3 {
  background: #ffffff !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .consumption-matrix-table tbody tr:hover td.sticky-col-1,
[data-theme="light"] .consumption-matrix-table tbody tr:hover td.sticky-col-2,
[data-theme="light"] .consumption-matrix-table tbody tr:hover td.sticky-col-3 {
  background: #f8fafc !important;
}

/* Tab 3: Real-Time Live Editor & Sync Styles */
.view-tab-btn.tab-btn-highlight {
  border: 1px solid rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #22c55e;
}

.view-tab-btn.tab-btn-highlight:hover {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.view-tab-btn.tab-btn-highlight.active {
  background: #22c55e;
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.4);
}

.editor-header-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(56, 189, 248, 0.15) 100%);
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-icon-badge {
  font-size: 14px;
  background: rgba(34, 197, 94, 0.2);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #22c55e;
}

.editor-banner-left h2 {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.editor-banner-left p {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.editor-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.editor-banner-actions .btn {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
}

.live-sync-monitor-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  margin-bottom: 6px;
}

.monitor-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.monitor-metric .lbl {
  font-size: 8.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.monitor-metric .val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Quick Editor Table & Input Styles */
.editor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.editor-table th {
  padding: 6px 8px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 10px;
  border-bottom: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 5;
  white-space: nowrap;
}

.editor-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  vertical-align: middle;
}

.editor-table tr:hover {
  background: var(--bg-card-hover);
}

.editor-input {
  width: 100%;
  max-width: 110px;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  text-align: right;
  outline: none;
  transition: var(--transition);
}

.editor-input:focus {
  border-color: #22c55e;
  background: var(--bg-tertiary);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
}

.editor-input.modified {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}

/* Top KPI Row: 6 Professional Round-Shaped Tabs (Ultra-Mini Micro Badges) */
.kpi-round-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  justify-items: center;
  align-items: center;
}

.kpi-round-card {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2px 2px;
  position: relative;
  transition: var(--transition);
  cursor: default;
  user-select: none;
}

.kpi-round-card:hover {
  transform: translateY(-2px) scale(1.04);
}

.kpi-round-icon {
  font-size: 10.5px;
  margin-bottom: 0px;
  line-height: 1;
}

.kpi-round-title {
  font-size: 6.2px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  line-height: 1;
  margin-top: 1px;
}

.kpi-round-value {
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 1px 0 0 0;
  line-height: 1;
}

.kpi-round-value.text-val {
  font-size: 7.5px !important;
  font-weight: 800;
  color: #38bdf8;
  white-space: nowrap;
}

.kpi-round-sub {
  font-size: 5.8px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1;
  margin-top: 1px;
}

/* 1. Chemicals Card */
.kpi-round-card.card-chemicals {
  background: radial-gradient(circle at 35% 35%, var(--bg-card) 45%, rgba(56, 189, 248, 0.15) 100%);
  border: 2.5px solid #38bdf8;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.25), inset 0 0 12px rgba(56, 189, 248, 0.15);
}
.kpi-round-card.card-chemicals .val-chemicals {
  color: #38bdf8;
}

/* 2. Perfumes Card */
.kpi-round-card.card-perfumes {
  background: radial-gradient(circle at 35% 35%, var(--bg-card) 45%, rgba(192, 132, 252, 0.15) 100%);
  border: 2.5px solid #c084fc;
  box-shadow: 0 0 22px rgba(192, 132, 252, 0.25), inset 0 0 12px rgba(192, 132, 252, 0.15);
}
.kpi-round-card.card-perfumes .val-perfumes {
  color: #c084fc;
}

/* 3. Dyes Card */
.kpi-round-card.card-dyes {
  background: radial-gradient(circle at 35% 35%, var(--bg-card) 45%, rgba(251, 191, 36, 0.15) 100%);
  border: 2.5px solid #fbbf24;
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.25), inset 0 0 12px rgba(251, 191, 36, 0.15);
}
.kpi-round-card.card-dyes .val-dyes {
  color: #fbbf24;
}

/* 4. Critical Card (Pulsing Glow) */
.kpi-round-card.card-critical {
  background: radial-gradient(circle at 35% 35%, var(--bg-card) 45%, rgba(239, 68, 68, 0.2) 100%);
  border: 2.5px solid #ef4444;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.35), inset 0 0 14px rgba(239, 68, 68, 0.2);
  animation: pulse-critical-card 2.5s infinite ease-in-out;
}

@keyframes pulse-critical-card {
  0%, 100% {
    box-shadow: 0 0 22px rgba(239, 68, 68, 0.35), inset 0 0 12px rgba(239, 68, 68, 0.2);
  }
  50% {
    box-shadow: 0 0 35px rgba(239, 68, 68, 0.55), inset 0 0 18px rgba(239, 68, 68, 0.35);
  }
}

/* 5. Healthy Card */
.kpi-round-card.card-healthy {
  background: radial-gradient(circle at 35% 35%, var(--bg-card) 45%, rgba(34, 197, 94, 0.15) 100%);
  border: 2.5px solid #22c55e;
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.25), inset 0 0 12px rgba(34, 197, 94, 0.15);
}
.kpi-round-card.card-healthy .text-success {
  color: #22c55e;
}

/* 6. Valuation Card */
.kpi-round-card.card-valuation {
  background: radial-gradient(circle at 35% 35%, var(--bg-card) 45%, rgba(56, 189, 248, 0.18) 100%);
  border: 2.5px solid #38bdf8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.3), inset 0 0 14px rgba(56, 189, 248, 0.2);
}

/* KPI Summary Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
}

.kpi-card.critical-kpi {
  border-left: 4px solid var(--critical-border);
  background: linear-gradient(135deg, var(--bg-card) 60%, rgba(239, 68, 68, 0.15));
}

.kpi-card.warning-kpi {
  border-left: 4px solid var(--warning-border);
}

.kpi-card.healthy-kpi {
  border-left: 4px solid var(--healthy-border);
  background: linear-gradient(135deg, var(--bg-card) 60%, rgba(34, 197, 94, 0.1));
}

.kpi-card.valuation-kpi {
  border-left: 4px solid var(--primary);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kpi-icon {
  font-size: 20px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Live Excel Auto-Sync Panel (Compact) */
.live-sync-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  margin-bottom: 12px;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.live-sync-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.live-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-live 1.6s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.live-sync-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-timer-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 14px;
  background: rgba(34, 197, 94, 0.18);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Critical Stock Alert Center (Full-Width White Theme Card & Table) */
.critical-alert-card-white {
  background: #ffffff;
  border: 1.5px solid #ef4444;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px -2px rgba(239, 68, 68, 0.12), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.critical-alert-card-white.hidden {
  display: none;
}

.alert-header-white {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-icon-pulse-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  font-size: 13px;
  font-weight: 900;
  animation: pulse-critical 1.5s infinite;
}

/* Crisp White Critical Priority Table (Compact & Screen-Fit) */
.critical-table-wrapper-white {
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  flex: 1;
}

.critical-table-white {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse;
  font-size: 9.5px;
  background: #ffffff;
  color: #0f172a;
}

.critical-table-white thead {
  background: #fde047;
  position: sticky;
  top: 0;
  z-index: 5;
}

.critical-table-white th {
  padding: 4px 2px !important;
  font-weight: 800;
  color: #713f12;
  text-transform: uppercase;
  font-size: 8px !important;
  letter-spacing: 0.02em;
  border-bottom: 2px solid #ca8a04;
  white-space: normal !important;
  line-height: 1.15 !important;
  background: #fde047;
  text-align: center;
  vertical-align: middle;
  overflow: hidden;
}

.critical-table-white tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: var(--transition);
  cursor: pointer;
  background: #ffffff;
}

.critical-table-white tbody tr:hover {
  background: #fef2f2 !important;
}

.critical-table-white tbody tr.zero-stock-row {
  background: #fafafa;
  opacity: 0.85;
}

.critical-table-white tbody tr.zero-stock-row:hover {
  background: #fee2e2 !important;
  opacity: 1;
}

.critical-table-white td {
  padding: 3px 2px !important;
  vertical-align: middle;
  color: #0f172a;
  font-size: 9.5px;
  line-height: 1.15;
  overflow: hidden;
}

.critical-table-white td.critical-name {
  font-weight: 700;
  color: #991b1b;
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.15 !important;
  font-size: 9.5px !important;
}

.critical-days-badge-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 1.5px 3px !important;
  border-radius: 8px;
  font-size: 8.5px !important;
  font-weight: 700;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #f87171;
}

.badge-stockout-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 1.5px 3px !important;
  border-radius: 8px;
  font-size: 8px !important;
  font-weight: 700;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* ==============================================================================
   SMART STOCK DEPLETION FORECAST SYSTEM (WHITE TABLE)
   ============================================================================== */
.depletion-forecast-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.depletion-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 5px !important;
  border-radius: 10px;
  font-size: 8.5px !important;
  font-weight: 800;
  line-height: 1.15;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.depletion-chip .depletion-icon-pulse {
  width: 4.5px !important;
  height: 4.5px !important;
  border-radius: 50%;
  display: inline-block;
}
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.depletion-badge-stockout {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.depletion-badge-stockout .depletion-icon-pulse {
  background: #64748b;
}

.depletion-badge-critical {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}
.depletion-badge-critical .depletion-icon-pulse {
  background: #dc2626;
  animation: pulseDepletion 1.5s infinite;
}

.depletion-badge-urgent {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #f97316;
}
.depletion-badge-urgent .depletion-icon-pulse {
  background: #ea580c;
  animation: pulseDepletion 2s infinite;
}

.depletion-badge-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}
.depletion-badge-warning .depletion-icon-pulse {
  background: #d97706;
}

.depletion-badge-moderate {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #38bdf8;
}
.depletion-badge-moderate .depletion-icon-pulse {
  background: #0284c7;
}

.depletion-badge-healthy {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.depletion-badge-healthy .depletion-icon-pulse {
  background: #16a34a;
}

.depletion-badge-surplus {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}
.depletion-badge-surplus .depletion-icon-pulse {
  background: #9333ea;
}

.depletion-badge-inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.depletion-badge-inactive .depletion-icon-pulse {
  background: #94a3b8;
}

.depletion-order-deadline {
  font-size: 7.5px !important;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
  margin-top: 0.5px;
}

.depletion-urgency-danger {
  color: #dc2626;
  font-weight: 800;
}

.depletion-urgency-warning {
  color: #ea580c;
  font-weight: 800;
}

.depletion-urgency-amber {
  color: #b45309;
}

.depletion-urgency-info {
  color: #0284c7;
}

.depletion-urgency-healthy {
  color: #16a34a;
  font-weight: 700;
}

.depletion-urgency-surplus {
  color: #9333ea;
  font-weight: 700;
}

.depletion-urgency-muted {
  color: #94a3b8;
  font-weight: 600;
}

/* Master Chemical Inventory Table (#inventory-table) Dark Theme Styles */
#inventory-table .depletion-forecast-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
#inventory-table .depletion-chip {
  padding: 2px 7px;
  font-size: 10.5px;
  border-radius: 10px;
  font-weight: 800;
}
#inventory-table .depletion-order-deadline {
  font-size: 9px;
  font-weight: 700;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-stockout {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid #475569;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-stockout .depletion-icon-pulse {
  background: #94a3b8;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-critical {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid #ef4444;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-critical .depletion-icon-pulse {
  background: #ef4444;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-urgent {
  background: rgba(249, 115, 22, 0.22);
  color: #fdba74;
  border: 1px solid #f97316;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-urgent .depletion-icon-pulse {
  background: #f97316;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fde047;
  border: 1px solid #f59e0b;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-warning .depletion-icon-pulse {
  background: #f59e0b;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-moderate {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid #38bdf8;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-moderate .depletion-icon-pulse {
  background: #38bdf8;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-healthy {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid #22c55e;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-healthy .depletion-icon-pulse {
  background: #22c55e;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-surplus {
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  border: 1px solid #a855f7;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-surplus .depletion-icon-pulse {
  background: #a855f7;
}

:root:not([data-theme="light"]) #inventory-table .depletion-badge-inactive {
  background: rgba(71, 85, 105, 0.25);
  color: #94a3b8;
  border: 1px solid #475569;
}
:root:not([data-theme="light"]) #inventory-table .depletion-badge-inactive .depletion-icon-pulse {
  background: #64748b;
}

:root:not([data-theme="light"]) #inventory-table .depletion-urgency-danger {
  color: #f87171;
}
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-warning {
  color: #fb923c;
}
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-amber {
  color: #fbbf24;
}
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-info {
  color: #38bdf8;
}
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-healthy {
  color: #4ade80;
}
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-surplus {
  color: #c084fc;
}
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-muted {
  color: #64748b;
}

@keyframes pulseDepletion {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.btn-critical-action-white {
  padding: 1.5px 4px !important;
  font-size: 8px !important;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-critical-action-white:hover {
  background: #0284c7;
  color: white;
  border-color: #0284c7;
}

/* Compact Runway Chart Card */
.chart-card.critical-chart-compact {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.chart-card.critical-chart-compact .chart-header {
  margin-bottom: 6px;
}

.chart-card.critical-chart-compact .chart-header h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-card.critical-chart-compact .chart-container {
  height: 220px;
  flex: 1;
}

.critical-table th {
  padding: 12px 14px;
  font-weight: 700;
  color: #fca5a5;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--critical-border);
  white-space: nowrap;
}

.critical-table tbody tr {
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  transition: var(--transition);
  cursor: pointer;
}

.critical-table tbody tr:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  transform: scale-[1.002];
}

.critical-table td {
  padding: 12px 14px;
  white-space: nowrap;
}

.critical-table td.critical-name {
  font-weight: 800;
  color: #fecaca;
  font-size: 13.5px;
}

.critical-days-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.3);
  border: 1px solid #ef4444;
  color: #fee2e2;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.btn-critical-action {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
  cursor: pointer;
  transition: var(--transition);
}

.btn-critical-action:hover {
  background: #ef4444;
  color: white;
}

.alert-title-wrap p {
  font-size: 13px;
  color: var(--text-secondary);
}

.critical-items-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.critical-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--critical-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.critical-chip:hover {
  background: var(--critical-bg);
  transform: translateY(-1px);
}

.critical-chip .chip-name {
  font-weight: 700;
  color: var(--text-primary);
}

.critical-chip .chip-days {
  font-weight: 800;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Master Table Section (Compact Single-Screen View) */
.table-section {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.search-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  max-width: 780px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-box input {
  width: 100%;
  padding: 5px 10px 5px 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11.5px;
  height: 30px;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.search-box .search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
}

/* High-Visibility Prominent Golden Yellow Search Bar for Stock & Production Tables */
.search-box-yellow input,
#search-input,
#prod-search-input {
  background: linear-gradient(180deg, #fef9c3 0%, #fde047 100%) !important;
  color: #713f12 !important;
  font-weight: 800 !important;
  border: 1.5px solid #ca8a04 !important;
  box-shadow: 0 2px 8px rgba(202, 138, 4, 0.3) !important;
}

.search-box-yellow input::placeholder,
#search-input::placeholder,
#prod-search-input::placeholder {
  color: #854d0e !important;
  font-weight: 700 !important;
  opacity: 0.9;
}

.search-box.search-box-yellow .search-icon,
.search-box:has(#search-input) .search-icon,
.search-box:has(#prod-search-input) .search-icon {
  color: #713f12 !important;
  font-weight: 900 !important;
}

.search-box-yellow input:focus,
#search-input:focus,
#prod-search-input:focus {
  background: #ffffff !important;
  border-color: #b45309 !important;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.45), 0 3px 12px rgba(202, 138, 4, 0.35) !important;
}

/* Full Prominent Golden Yellow Toolbar Line for Consumption Table */
/* Compact & Slim Golden Yellow Toolbar Line for Consumption Table */
.table-toolbar-yellow {
  background: linear-gradient(180deg, #fef9c3 0%, #fde047 100%) !important;
  border: 1px solid #ca8a04 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  margin-bottom: 6px !important;
  box-shadow: 0 1px 4px rgba(202, 138, 4, 0.18) !important;
  min-height: unset !important;
}

.table-toolbar-yellow .search-filter-group {
  gap: 5px !important;
}

.table-toolbar-yellow .search-box {
  flex: 0 0 auto !important;
  width: 190px !important;
  min-width: 140px !important;
}

.table-toolbar-yellow .search-box input {
  background: #ffffff !important;
  border: 1px solid #ca8a04 !important;
  border-radius: 4px !important;
  color: #713f12 !important;
  font-weight: 700 !important;
  font-size: 10px !important;
  height: 25px !important;
  padding: 2px 6px 2px 24px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

.table-toolbar-yellow .search-box input::placeholder {
  color: #854d0e !important;
  font-weight: 600 !important;
  opacity: 0.8 !important;
  font-size: 9.5px !important;
}

.table-toolbar-yellow .search-box .search-icon {
  color: #713f12 !important;
  font-weight: 900 !important;
  font-size: 10px !important;
  left: 6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.table-toolbar-yellow .category-tabs {
  background: rgba(113, 63, 18, 0.10) !important;
  border: 1px solid rgba(113, 63, 18, 0.2) !important;
  padding: 1.5px 2px !important;
  border-radius: 4px !important;
  gap: 2px !important;
}

.table-toolbar-yellow .category-tabs .tab-btn {
  color: #713f12 !important;
  font-weight: 800 !important;
  font-size: 9.5px !important;
  padding: 2px 6px !important;
  border-radius: 3px !important;
  line-height: 1.2 !important;
}

.table-toolbar-yellow .category-tabs .tab-btn.active {
  background: #713f12 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(113, 63, 18, 0.35) !important;
}

.table-toolbar-yellow .table-size-adjuster {
  background: rgba(113, 63, 18, 0.10) !important;
  border: 1px solid rgba(113, 63, 18, 0.2) !important;
  padding: 1.5px 3px !important;
  border-radius: 4px !important;
  gap: 2px !important;
}

.table-toolbar-yellow .table-size-adjuster .adjuster-label {
  color: #713f12 !important;
  font-weight: 900 !important;
  font-size: 9px !important;
}

.table-toolbar-yellow .table-size-adjuster .size-btn {
  color: #713f12 !important;
  font-weight: 800 !important;
  font-size: 9px !important;
  padding: 1px 4px !important;
  min-width: 18px !important;
  height: 18px !important;
  line-height: 16px !important;
}

.table-toolbar-yellow .table-size-adjuster .size-btn.active {
  background: #713f12 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(113, 63, 18, 0.35) !important;
}

.table-toolbar-yellow .btn {
  padding: 2px 7px !important;
  font-size: 10px !important;
  height: 24px !important;
  border-radius: 4px !important;
  line-height: 1.2 !important;
}

.table-toolbar-yellow #consumption-record-count,
.table-toolbar-yellow #packing-consumption-record-count {
  color: #713f12 !important;
  font-weight: 900 !important;
  font-size: 9.5px !important;
}

/* Full Prominent Sunset Orange Toolbar Line for Live Editor Table */
.table-toolbar-orange {
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
  border: 1px solid #c2410c !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 8px !important;
  margin-bottom: 6px !important;
  box-shadow: 0 2px 6px rgba(194, 65, 12, 0.25) !important;
  min-height: unset !important;
  gap: 6px !important;
}

.table-toolbar-orange .search-box {
  height: 28px !important;
}

.table-toolbar-orange .search-box input {
  background: #ffffff !important;
  border: 1px solid #c2410c !important;
  color: #7c2d12 !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  padding: 3px 8px 3px 26px !important;
  height: 28px !important;
  max-width: 220px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}

.table-toolbar-orange .search-box input::placeholder {
  color: #9a3412 !important;
  font-weight: 600 !important;
  opacity: 0.85;
}

.table-toolbar-orange .search-box .search-icon {
  font-size: 11px !important;
  left: 7px !important;
  color: #7c2d12 !important;
  font-weight: 900 !important;
}

.table-toolbar-orange .category-tabs {
  background: rgba(124, 45, 18, 0.12) !important;
  border: 1px solid rgba(124, 45, 18, 0.2) !important;
  padding: 2px !important;
  gap: 2px !important;
}

.table-toolbar-orange .category-tabs .tab-btn {
  color: #7c2d12 !important;
  font-weight: 800 !important;
  font-size: 10.5px !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
}

.table-toolbar-orange .category-tabs .tab-btn.active {
  background: #7c2d12 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(124, 45, 18, 0.3) !important;
}

.table-toolbar-orange .table-size-adjuster {
  background: rgba(124, 45, 18, 0.12) !important;
  border: 1px solid rgba(124, 45, 18, 0.2) !important;
  padding: 2px 4px !important;
}

.table-toolbar-orange .table-size-adjuster .adjuster-label {
  color: #7c2d12 !important;
  font-weight: 900 !important;
  font-size: 10px !important;
}

.table-toolbar-orange .table-size-adjuster .size-btn {
  color: #7c2d12 !important;
  font-weight: 800 !important;
  font-size: 10px !important;
  padding: 2px 5px !important;
  min-width: 20px !important;
  height: 20px !important;
}

.table-toolbar-orange .table-size-adjuster .size-btn.active {
  background: #7c2d12 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(124, 45, 18, 0.3) !important;
}

.table-toolbar-orange #editor-record-count {
  color: #7c2d12 !important;
  font-weight: 900 !important;
  font-size: 10.5px !important;
}

.table-toolbar-orange .btn {
  padding: 3px 8px !important;
  font-size: 11px !important;
}

.table-toolbar-orange span[style*=" "],
.table-toolbar-orange .editor-tip-text {
  color: #7c2d12 !important;
  font-weight: 900 !important;
}

.category-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tab-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 3px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--primary);
  color: #0f172a;
}

.status-filters {
  display: flex;
  gap: 4px;
}

.filter-pill {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--primary);
}

.filter-pill.critical-pill.active {
  background: var(--critical-bg);
  color: var(--critical-text);
  border-color: var(--critical-border);
}

/* Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  max-height: 240px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11.5px;
}

thead {
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 6px 8px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  color: var(--text-primary);
}

th.sort-asc::after {
  content: " ";
  color: var(--primary);
}

th.sort-desc::after {
  content: " ";
  color: var(--primary);
}

/* High-Visibility Prominent Orange Header Bar for Master Chemical Inventory Table & Live Editor Table */
#inventory-table thead th,
.editor-table thead th {
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
  color: #7c2d12 !important;
  font-weight: 900 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2.5px solid #c2410c !important;
  border-top: 1px solid #fed7aa !important;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(194, 65, 12, 0.25);
  padding: 6px 10px;
}

#inventory-table thead th:hover,
.editor-table thead th:hover {
  background: linear-gradient(180deg, #ffedd5 0%, #f97316 100%) !important;
  color: #431407 !important;
}

#inventory-table thead th.sort-asc::after,
#inventory-table thead th.sort-desc::after,
.editor-table thead th.sort-asc::after,
.editor-table thead th.sort-desc::after {
  color: #431407 !important;
  font-weight: 900;
}

#inventory-table,
.editor-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

#inventory-table thead th.inv-sticky-code,
.editor-table thead th.inv-sticky-code {
  position: sticky !important;
  left: 0 !important;
  z-index: 15 !important;
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
}

#inventory-table thead th.inv-sticky-desc,
.editor-table thead th.inv-sticky-desc {
  position: sticky !important;
  left: 60px !important;
  z-index: 15 !important;
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
}

#inventory-table thead th.inv-sticky-cat,
.editor-table thead th.inv-sticky-cat {
  position: sticky !important;
  left: 280px !important;
  z-index: 15 !important;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.35) !important;
}

#inventory-table tbody td.inv-sticky-code,
.editor-table tbody td.inv-sticky-code {
  position: sticky !important;
  left: 0 !important;
  z-index: 5 !important;
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  background: #1e293b !important;
}

#inventory-table tbody td.inv-sticky-desc,
.editor-table tbody td.inv-sticky-desc {
  position: sticky !important;
  left: 60px !important;
  z-index: 5 !important;
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  background: #1e293b !important;
}

#inventory-table tbody td.inv-sticky-cat,
.editor-table tbody td.inv-sticky-cat {
  position: sticky !important;
  left: 280px !important;
  z-index: 5 !important;
  width: 100px !important;
  min-width: 100px !important;
  max-width: 100px !important;
  background: #1e293b !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.35) !important;
}

#inventory-table tbody tr:hover td.inv-sticky-code,
#inventory-table tbody tr:hover td.inv-sticky-desc,
#inventory-table tbody tr:hover td.inv-sticky-cat,
.editor-table tbody tr:hover td.inv-sticky-code,
.editor-table tbody tr:hover td.inv-sticky-desc,
.editor-table tbody tr:hover td.inv-sticky-cat {
  background: #334155 !important;
}

#inventory-table tbody tr.row-critical td.inv-sticky-code,
#inventory-table tbody tr.row-critical td.inv-sticky-desc,
#inventory-table tbody tr.row-critical td.inv-sticky-cat,
.editor-table tbody tr.row-critical td.inv-sticky-code,
.editor-table tbody tr.row-critical td.inv-sticky-desc,
.editor-table tbody tr.row-critical td.inv-sticky-cat {
  background: #3d1a24 !important;
}

#inventory-table tbody tr.row-critical:hover td.inv-sticky-code,
#inventory-table tbody tr.row-critical:hover td.inv-sticky-desc,
#inventory-table tbody tr.row-critical:hover td.inv-sticky-cat,
.editor-table tbody tr.row-critical:hover td.inv-sticky-code,
.editor-table tbody tr.row-critical:hover td.inv-sticky-desc,
.editor-table tbody tr.row-critical:hover td.inv-sticky-cat {
  background: #4c1d28 !important;
}

/* Light Theme Solid Backgrounds */
[data-theme="light"] #inventory-table tbody td.inv-sticky-code,
[data-theme="light"] #inventory-table tbody td.inv-sticky-desc,
[data-theme="light"] #inventory-table tbody td.inv-sticky-cat,
[data-theme="light"] .editor-table tbody td.inv-sticky-code,
[data-theme="light"] .editor-table tbody td.inv-sticky-desc,
[data-theme="light"] .editor-table tbody td.inv-sticky-cat {
  background: #ffffff !important;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] #inventory-table tbody tr:hover td.inv-sticky-code,
[data-theme="light"] #inventory-table tbody tr:hover td.inv-sticky-desc,
[data-theme="light"] #inventory-table tbody tr:hover td.inv-sticky-cat,
[data-theme="light"] .editor-table tbody tr:hover td.inv-sticky-code,
[data-theme="light"] .editor-table tbody tr:hover td.inv-sticky-desc,
[data-theme="light"] .editor-table tbody tr:hover td.inv-sticky-cat {
  background: #f8fafc !important;
}

[data-theme="light"] #inventory-table tbody tr.row-critical td.inv-sticky-code,
[data-theme="light"] #inventory-table tbody tr.row-critical td.inv-sticky-desc,
[data-theme="light"] #inventory-table tbody tr.row-critical td.inv-sticky-cat,
[data-theme="light"] .editor-table tbody tr.row-critical td.inv-sticky-code,
[data-theme="light"] .editor-table tbody tr.row-critical td.inv-sticky-desc,
[data-theme="light"] .editor-table tbody tr.row-critical td.inv-sticky-cat {
  background: #fee2e2 !important;
}

[data-theme="light"] #inventory-table tbody tr.row-critical:hover td.inv-sticky-code,
[data-theme="light"] #inventory-table tbody tr.row-critical:hover td.inv-sticky-desc,
[data-theme="light"] #inventory-table tbody tr.row-critical:hover td.inv-sticky-cat,
[data-theme="light"] .editor-table tbody tr.row-critical:hover td.inv-sticky-code,
[data-theme="light"] .editor-table tbody tr.row-critical:hover td.inv-sticky-desc,
[data-theme="light"] .editor-table tbody tr.row-critical:hover td.inv-sticky-cat {
  background: #fecaca !important;
}

tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

td {
  padding: 5px 8px;
  white-space: nowrap;
}

/* Critical Row Highlighting */
tr.row-critical {
  background: var(--critical-bg) !important;
  font-weight: 600;
}

tr.row-critical td.item-name {
  font-weight: 800 !important;
  color: #fca5a5 !important;
}

tr.row-critical td.runway-cell {
  font-weight: 800 !important;
  color: #ef4444 !important;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-critical {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid #ef4444;
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.badge-healthy {
  background: var(--healthy-bg);
  color: var(--healthy-text);
  border: 1px solid var(--healthy-border);
}

.badge-surplus {
  background: var(--surplus-bg);
  color: var(--surplus-text);
  border: 1px solid var(--surplus-border);
}

.badge-inactive {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Number formats */
.num-bold {
  font-weight: 700;
}

.text-danger {
  color: #ef4444;
  font-weight: 700;
}

.text-success {
  color: #22c55e;
}

.text-warning {
  color: #f59e0b;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100005;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active,
.modal-overlay[style*="display: flex"] {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.modal-stat {
  background: var(--bg-primary);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.modal-stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.modal-stat .val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

/* Footer */
.dashboard-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Prominent Sunset Orange Sticky Bar for Q-Wise Total Filtered Output */
.prod-table-tfoot-orange tr {
  background: linear-gradient(180deg, #fb923c 0%, #f97316 100%) !important;
  border-top: 3.5px solid #c2410c !important;
  border-bottom: 2.5px solid #9a3412 !important;
  box-shadow: 0 -5px 18px rgba(249, 115, 22, 0.45) !important;
}

.prod-table-tfoot-orange td {
  color: #000000 !important;
  font-weight: 900 !important;
  padding: 8px 10px !important;
  border-top: none !important;
  text-shadow: none !important;
}

.prod-table-tfoot-orange td.total-label-orange {
  color: #000000 !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  font-size: 13px !important;
  letter-spacing: 0.05em;
  text-shadow: none !important;
}

/* ======================================================== */
/* DEDICATED TABLE PRINT & EXPORT BUTTON ENHANCEMENTS */
/* ======================================================== */
#print-report-btn,
#consumption-print-btn,
#editor-print-btn,
#prod-print-btn,
#critical-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

#print-report-btn:hover,
#consumption-print-btn:hover,
#editor-print-btn:hover,
#prod-print-btn:hover {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(56, 189, 248, 0.35);
}

#critical-print-btn:hover {
  background: #b91c1c !important;
  border-color: #991b1b !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.45);
}

#consumption-export-btn:hover,
#editor-export-btn:hover,
#prod-export-btn:hover,
#export-csv-btn:hover {
  border-color: #22c55e;
  color: #22c55e;
  transform: translateY(-1px);
}

/* ======================================================== */
/* UNIVERSAL A4 HIGH-FIDELITY PRINT & MULTI-PAGE ENGINE      */
/* Automatically formats all tables for A4 Paper with        */
/* complete multi-page scrolling, custom page selection,     */
/* repeating headers, and zero table truncation.             */
/* ======================================================== */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 8mm 10mm 8mm;
  }

  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-sizing: border-box !important;
  }

  /* Universal Reset: allow natural document height and multi-page flow across A4 */
  html, body {
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 1. ABSOLUTELY HIDE SIDEBAR, HEADERS, BUTTONS & CLUTTER UNDER ALL CIRCUMSTANCES */
  #app-sidebar,
  .app-sidebar,
  aside,
  .sidebar-brand-section,
  .sidebar-logo-wrap,
  .sidebar-brand-text,
  .sidebar-nav,
  .sidebar-folder-group,
  .sidebar-folder-header,
  .sidebar-subfolder-group,
  .sidebar-subfolder-header,
  .sidebar-section-heading,
  .sidebar-nav-item,
  .sidebar-footer,
  .sidebar-user-card,
  #app-header,
  .app-header,
  header,
  .app-navbar,
  .header-actions,
  .table-toolbar,
  .table-size-adjuster,
  .table-scroll-buttons,
  .filter-bar,
  .admin-presence-kpi-bar,
  .dashboard-footer,
  .modal-backdrop,
  .floating-action-btn,
  #gate-lockscreen,
  #login-screen,
  #admin-security-lockout-alert,
  .btn,
  .btn-secondary,
  .btn-excel-export,
  .export-btn,
  .prod-pill,
  .tab-btn,
  .size-btn,
  button,
  input,
  select {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* 2. When printing single isolated table, hide entire main dashboard app layout */
  body.printing-single-table .app-layout,
  body.printing-single-table #app-layout,
  body.printing-single-table .main-content,
  body.printing-single-table .tab-pane,
  body.printing-single-table .tab-content,
  body.printing-single-table .tab-view-content,
  body.printing-single-table #tab-content-material-requisition,
  body.printing-single-table #batch-plan-queue-card,
  body.printing-single-table #batch-combined-requisition-card,
  body.printing-single-table #chemical-requisition-table-container,
  body.printing-single-table #packaging-requisition-table-container,
  body.printing-single-table .modal-overlay,
  body.printing-single-table .modal {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }

  /* Dedicated print isolation container fills page naturally across multiple A4 sheets */
  body.printing-single-table #print-isolation-container {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 4px !important;
    background: #ffffff !important;
    color: #000000 !important;
    box-sizing: border-box !important;
  }

  body.printing-single-table #print-isolation-container * {
    visibility: visible !important;
  }

  /* Table structure for A4: natural pagination, headers repeat on each page */
  #print-isolation-container table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 6px !important;
    margin-bottom: 12px !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
    font-size: 8.5pt !important;
    table-layout: auto !important;
  }

  /* Repeat table headers at top of every single A4 page */
  #print-isolation-container thead {
    display: table-header-group !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Repeat table footers at bottom of table */
  #print-isolation-container tfoot {
    display: table-footer-group !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Never cut a row in half across a page boundary */
  #print-isolation-container tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* High contrast borders and cells */
  #print-isolation-container th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border: 1px solid #94a3b8 !important;
    padding: 5px 6px !important;
    font-weight: 800 !important;
    font-size: 8.5pt !important;
    text-transform: uppercase !important;
    text-align: inherit;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }

  #print-isolation-container table,
  #print-isolation-container .print-clean-data-table,
  #print-isolation-container tr {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  #print-isolation-container td,
  #print-isolation-container td:nth-child(1),
  #print-isolation-container td:nth-child(2),
  #print-isolation-container td:nth-child(3),
  #print-isolation-container .sticky-col-1,
  #print-isolation-container .sticky-col-2,
  #print-isolation-container .sticky-col-3 {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    padding: 4px 6px !important;
    font-size: 8.5pt !important;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }

  #print-isolation-container tbody tr:nth-child(even) td,
  #print-isolation-container tbody tr:nth-child(even) td:nth-child(1),
  #print-isolation-container tbody tr:nth-child(even) td:nth-child(2),
  #print-isolation-container tbody tr:nth-child(even) td:nth-child(3) {
    background: #f8fafc !important;
  }

  #print-isolation-container span,
  #print-isolation-container .badge {
    background: transparent !important;
    color: #0f172a !important;
    border: none !important;
    box-shadow: none !important;
  }

  #print-isolation-container tfoot td,
  #print-isolation-container tfoot th {
    background: #fef08a !important;
    color: #000000 !important;
    font-weight: 900 !important;
    border: 1.5px solid #ca8a04 !important;
    font-size: 8.5pt !important;
  }

  /* Signatures block and headers avoid page breaks inside themselves */
  #print-isolation-container .print-header-block,
  #print-isolation-container .print-meta-grid,
  #print-isolation-container .print-signatures-block,
  #print-isolation-container .print-footer-block {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Remove all sticky positionings, box shadows, and fixed max-heights */
  #print-isolation-container .table-responsive,
  #print-isolation-container [style*="overflow"],
  #print-isolation-container [style*="max-height"] {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    border: none !important;
  }

  /* 3. ROBUST FALLBACK FOR NATIVE PRINT (Ctrl+P or Browser Menu): NEVER CLIP TO 1 PAGE */
  body:not(.printing-single-table) .app-layout {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body:not(.printing-single-table) .main-content {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body:not(.printing-single-table) .tab-pane:not(.active),
  body:not(.printing-single-table) .tab-view-content:not(.active) {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  body:not(.printing-single-table) .tab-pane.active,
  body:not(.printing-single-table) .tab-view-content.active {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    position: static !important;
  }

  body:not(.printing-single-table) .card,
  body:not(.printing-single-table) .table-container,
  body:not(.printing-single-table) .data-table-container,
  body:not(.printing-single-table) #batch-plan-queue-card,
  body:not(.printing-single-table) #batch-combined-requisition-card,
  body:not(.printing-single-table) #chemical-requisition-table-container,
  body:not(.printing-single-table) #packaging-requisition-table-container,
  body:not(.printing-single-table) [id$="-table-container"],
  body:not(.printing-single-table) [id$="-table-wrapper"] {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  body:not(.printing-single-table) table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  body:not(.printing-single-table) thead {
    display: table-header-group !important;
  }

  body:not(.printing-single-table) tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* ======================================================== */
/* ADVANCED MULTI-DEVICE RESPONSIVE & MOBILE ENGINE */
/* Auto-Adjusts for Desktops, Laptops, Tablets & Smartphones */
/* ======================================================== */

/* Universal Touch & Click Optimizations */
button, input, select, a, .tab-btn, .prod-day-pill, .dropdown-menu-item, .dropdown-toggle-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Horizontal Swipe Optimization for Touch Devices */
.main-view-switcher,
.category-tabs,
.brand-tabs,
#prod-day-pills,
.table-responsive {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.main-view-switcher::-webkit-scrollbar,
.category-tabs::-webkit-scrollbar,
.brand-tabs::-webkit-scrollbar,
#prod-day-pills::-webkit-scrollbar {
  height: 4px;
}

.main-view-switcher::-webkit-scrollbar-thumb,
.category-tabs::-webkit-scrollbar-thumb,
.brand-tabs::-webkit-scrollbar-thumb,
#prod-day-pills::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 4px;
}

/* ======================================================== */
/* 1. TABLET & MEDIUM DESKTOP OPTIMIZATIONS (<= 1024px) */
/* ======================================================== */
@media (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 10px 14px;
  }

  .kpi-round-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .kpi-grid,
  .consumption-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .chart-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .kpi-grid-production-4cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .detacid-combined-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .comb-metrics-group {
    width: 100%;
    justify-content: space-between;
  }
}

.mobile-table-swipe-hint {
  display: none;
}

/* ======================================================== */
/* 2. TABLET PORTRAIT & SMARTPHONES (<= 768px) */
/* ======================================================== */
@media (max-width: 768px) {
  .container {
    padding: 6px 8px;
  }

  .sticky-master-header-bar {
    padding: 6px 0;
    margin-bottom: 12px;
  }

  /* Header Layout */
  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-bottom: 8px;
  }

  .brand-section {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
  }

  .brand-title h1 {
    font-size: 14px;
    letter-spacing: -0.01em;
    line-height: 1.2;
  }

  .brand-title p {
    font-size: 9.5px;
    line-height: 1.3;
  }

  .brand-logo-container {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .brand-logo-container svg {
    width: 32px;
    height: 32px;
  }

  /* Header Actions Touch Bar */
  .header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .header-actions .btn {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 36px;
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .sync-badge {
    padding: 4px 8px;
    font-size: 10.5px;
    width: 100%;
    justify-content: center;
    order: -1;
  }

  /* Firebase Manual Sync Card on Mobile */
  .firebase-sync-card {
    width: 100%;
    justify-content: space-between;
    padding: 4px 10px 4px 6px;
    border-radius: 12px;
    order: 5;
    flex: 1 1 100%;
  }

  .round-firebase-btn {
    padding: 6px 12px;
    font-size: 11.5px;
    min-height: 34px;
  }

  .firebase-timestamp-box .fb-ts-label {
    font-size: 8px;
  }

  .firebase-timestamp-box .fb-ts-val {
    font-size: 10.5px;
  }

  /* Main View Navigation Switcher */
  .main-view-switcher {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
  }

  [data-theme="light"] .main-view-switcher {
    background: #ffffff;
  }

  .dropdown-folder-wrapper {
    width: 100%;
  }

  #bahrain-folder-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 14px;
    font-size: 13px;
    min-height: 38px;
  }

  .folder-dropdown-menu {
    position: fixed;
    top: 120px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    z-index: 99999;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8);
  }

  .active-file-indicator-pill {
    max-width: 100%;
    width: 100%;
    padding: 6px 10px;
    gap: 8px;
  }

  .file-pill-icon {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .file-pill-report-name {
    font-size: 11.5px;
  }

  .file-pill-filename {
    font-size: 10px;
    max-width: 100%;
  }

  /* Sticky Live Update Bar */
  .live-update-round-card {
    width: 100%;
    justify-content: space-between;
    padding: 4px 10px 4px 6px;
    border-radius: 12px;
  }

  .round-live-btn {
    padding: 6px 12px;
    font-size: 11.5px;
    min-height: 34px;
  }

  /* Top 6 KPI Round Cards on Mobile (3 columns x 2 rows) */
  .kpi-round-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
  }

  .kpi-round-card {
    width: 100px;
    height: 100px;
    padding: 6px 4px;
    border-width: 2px;
  }

  .kpi-round-icon {
    font-size: 15px;
    margin-bottom: 0px;
  }

  .kpi-round-title {
    font-size: 8.5px;
    letter-spacing: 0.02em;
  }

  .kpi-round-value {
    font-size: 16px;
    margin: 0;
  }

  .kpi-round-value.text-val {
    font-size: 10px !important;
  }

  .kpi-round-sub {
    font-size: 7.5px;
  }

  /* Live Sync Panel */
  .live-sync-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
  }

  .live-sync-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .live-sync-actions .btn {
    flex: 1;
  }

  /* Critical Alert Section */
  .critical-alert-card-white {
    padding: 10px 12px;
  }

  .alert-header-white {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #critical-count-header {
    font-size: 13px !important;
    line-height: 1.3;
  }

  #critical-count-header span {
    font-size: 14px !important;
    margin-left: 0 !important;
    display: block !important;
    margin-top: 2px;
  }

  /* Combined Detergent + Acid Banner */
  .detacid-combined-banner {
    padding: 10px 12px;
    gap: 10px;
  }

  .comb-left {
    width: 100%;
  }

  .comb-title {
    font-size: 11px;
  }

  .comb-metrics-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
  }

  .comb-divider {
    display: none;
  }

  .comb-metric-item {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 6px;
    border-radius: 6px;
    text-align: center;
  }

  .comb-lbl {
    font-size: 8px;
  }

  .comb-val {
    font-size: 11.5px;
    font-weight: 800;
  }

  /* Overview KPI Cards */
  .kpi-grid,
  .consumption-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .kpi-card {
    padding: 10px 12px;
  }

  .kpi-card .kpi-value {
    font-size: 18px;
  }

  .kpi-card .kpi-label,
  .kpi-card .kpi-sub {
    font-size: 9.5px;
  }

  /* Production Section KPI Cards */
  .kpi-grid-production-4cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .prod-section-card {
    padding: 10px 12px;
  }

  .prod-section-title {
    font-size: 12px;
  }

  /* Table Toolbars & Search */
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
  }

  .search-filter-group {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .search-box {
    width: 100% !important;
    min-width: 100% !important;
  }

  .search-box input {
    width: 100%;
    font-size: 13.5px !important;
    min-height: 38px;
    padding-left: 36px;
  }

  .category-tabs,
  .brand-tabs,
  .status-filters,
  .prod-pills-wrap {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding-bottom: 4px;
    gap: 4px;
  }

  .category-tabs .tab-btn,
  .brand-tabs .tab-btn,
  .status-filters .filter-pill,
  .prod-pill {
    padding: 6px 12px;
    font-size: 11px;
    min-height: 34px;
    flex-shrink: 0;
  }

  /* Production Day Pills (1-31) Touch Swiper */
  #prod-day-pills {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 4px !important;
    padding: 4px 0 !important;
    width: 100% !important;
  }

  .prod-day-pill {
    min-width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
    text-align: center !important;
  }

  /* Hide Table Size Adjusters on mobile to reduce clutter */
  .table-size-adjuster {
    display: none !important;
  }

  /* ==========================================================================
     COMPACT MOBILE TABLES & TOUCH SWIPING ENGINE (<= 768px & SMARTPHONES)
     ========================================================================== */

  /* 1. All Table Containers: Force Horizontal Touch Scroll & Inertial Glide */
  .table-responsive,
  #inventory-table-container,
  #packing-inventory-table-container,
  #packing-consumption-table-container,
  #packing-critical-table-container,
  #prod-table-container,
  #dpr-summary-table-container,
  #costing-master-table-container,
  #labour-monthly-table-container,
  #consumption-table-container,
  #prices-master-table-container,
  #sales-table-container {
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 8px !important;
  }

  /* 2. Global Table & Cell Compact Sizing for Mobile Screens */
  table {
    font-size: 10px !important;
  }

  th {
    padding: 6px 5px !important;
    font-size: 9.5px !important;
    letter-spacing: 0.01em !important;
    white-space: nowrap !important;
    height: 30px !important;
  }

  td {
    padding: 5px 5px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
    height: 30px !important;
  }

  /* Compact Table min-widths on Mobile (replaces rigid 1500px/1650px desktop sprawl) */
  #inventory-table,
  #packing-inventory-table,
  #packing-consumption-table,
  #prod-table,
  #dpr-breakdown-table,
  #costing-master-summary-table,
  #labour-monthly-summary-table,
  #consumption-table {
    min-width: 820px !important;
    width: max-content !important;
  }

  /* 3. CHEMICAL INVENTORY TABLE (#inventory-table):
        Freeze only Code (46px) + Desc (114px) = 160px.
        Unfreeze Category & rest of columns so 200px+ is free for smooth swiping! */
  #inventory-table thead th.inv-sticky-code,
  .editor-table thead th.inv-sticky-code,
  #inventory-table tbody td.inv-sticky-code,
  .editor-table tbody td.inv-sticky-code {
    position: sticky !important;
    left: 0 !important;
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    z-index: 12 !important;
    padding: 5px 4px !important;
    text-align: center !important;
    background: #1e293b !important;
  }

  #inventory-table thead th.inv-sticky-desc,
  .editor-table thead th.inv-sticky-desc,
  #inventory-table tbody td.inv-sticky-desc,
  .editor-table tbody td.inv-sticky-desc {
    position: sticky !important;
    left: 46px !important;
    width: 114px !important;
    min-width: 114px !important;
    max-width: 114px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    z-index: 12 !important;
    padding: 5px 6px !important;
    border-right: 2px solid #38bdf8 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.28) !important;
    background: #1e293b !important;
  }

  /* Unfreeze Category on Mobile */
  #inventory-table thead th.inv-sticky-cat,
  .editor-table thead th.inv-sticky-cat,
  #inventory-table tbody td.inv-sticky-cat,
  .editor-table tbody td.inv-sticky-cat {
    position: static !important;
    left: auto !important;
    width: 75px !important;
    min-width: 75px !important;
    max-width: 75px !important;
    box-shadow: none !important;
    border-right: none !important;
    z-index: 1 !important;
  }

  /* Light Theme overrides for Chemical Sticky */
  [data-theme="light"] #inventory-table thead th.inv-sticky-code,
  [data-theme="light"] #inventory-table tbody td.inv-sticky-code,
  [data-theme="light"] .editor-table tbody td.inv-sticky-code {
    background: #ffffff !important;
  }
  [data-theme="light"] #inventory-table thead th.inv-sticky-desc,
  [data-theme="light"] #inventory-table tbody td.inv-sticky-desc,
  [data-theme="light"] .editor-table tbody td.inv-sticky-desc {
    background: #ffffff !important;
  }

  /* 4. PACKAGING STOCK MASTER TABLE (#packing-inventory-table):
        Col 1 (#): Unfreeze on mobile.
        Col 2 (Code): Sticky left 0 (48px).
        Col 3 (Desc): Sticky left 48px (112px).
        Total sticky = 160px! */
  #packing-inventory-table thead th:nth-child(1),
  #packing-inventory-table tbody td:nth-child(1) {
    position: static !important;
    left: auto !important;
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    z-index: 1 !important;
    box-shadow: none !important;
    border-right: none !important;
  }

  #packing-inventory-table thead th:nth-child(2),
  #packing-inventory-table tbody td:nth-child(2) {
    position: sticky !important;
    left: 0 !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    z-index: 12 !important;
    padding: 5px 4px !important;
    text-align: center !important;
    background: #eab308 !important;
    color: #000000 !important;
  }
  #packing-inventory-table tbody td:nth-child(2) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  #packing-inventory-table thead th:nth-child(3),
  #packing-inventory-table tbody td:nth-child(3) {
    position: sticky !important;
    left: 48px !important;
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    z-index: 12 !important;
    padding: 5px 6px !important;
    border-right: 2.5px solid #ca8a04 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
    background: #eab308 !important;
    color: #000000 !important;
  }
  #packing-inventory-table tbody td:nth-child(3) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* 5. PACKAGING CONSUMPTION TABLE (#packing-consumption-table):
        Col 1 (#): Unfreeze.
        Col 2 (Code): Sticky left 0 (48px).
        Col 3 (Desc): Sticky left 48px (112px). */
  #packing-consumption-table thead th:nth-child(1),
  #packing-consumption-table tbody td:nth-child(1) {
    position: static !important;
    left: auto !important;
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    z-index: 1 !important;
    box-shadow: none !important;
    border-right: none !important;
  }

  #packing-consumption-table thead th:nth-child(2),
  #packing-consumption-table tbody td:nth-child(2) {
    position: sticky !important;
    left: 0 !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    z-index: 12 !important;
    padding: 5px 4px !important;
    text-align: center !important;
    background: #eab308 !important;
    color: #000000 !important;
  }
  #packing-consumption-table tbody td:nth-child(2) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  #packing-consumption-table thead th:nth-child(3),
  #packing-consumption-table tbody td:nth-child(3) {
    position: sticky !important;
    left: 48px !important;
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    z-index: 12 !important;
    padding: 5px 6px !important;
    border-right: 2.5px solid #ca8a04 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
    background: #eab308 !important;
    color: #000000 !important;
  }
  #packing-consumption-table tbody td:nth-child(3) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* 6. DAILY PRODUCTION REPORT (#dpr-breakdown-table):
        Col 1 (Date): Sticky left 0 (62px).
        Col 2 (SKU Description): Sticky left 62px (108px).
        Total = 170px! */
  #dpr-breakdown-table thead th.prod-sticky-col-date,
  #dpr-breakdown-table thead th.col-lane-date,
  #dpr-breakdown-table tbody td.prod-sticky-col-date,
  #dpr-breakdown-table tbody td.col-lane-date {
    position: sticky !important;
    left: 0 !important;
    width: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 5px 4px !important;
    z-index: 12 !important;
    background: #fef08a !important;
    color: #000000 !important;
  }
  #dpr-breakdown-table tbody td.prod-sticky-col-date,
  #dpr-breakdown-table tbody td.col-lane-date {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  #dpr-breakdown-table thead th.prod-sticky-col-sku,
  #dpr-breakdown-table thead th.col-lane-desc,
  #dpr-breakdown-table tbody td.prod-sticky-col-sku,
  #dpr-breakdown-table tbody td.col-lane-desc {
    position: sticky !important;
    left: 62px !important;
    width: 108px !important;
    min-width: 108px !important;
    max-width: 108px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    padding: 5px 6px !important;
    z-index: 12 !important;
    border-right: 2px solid #ca8a04 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
    background: #fef08a !important;
    color: #000000 !important;
  }
  #dpr-breakdown-table tbody td.prod-sticky-col-sku,
  #dpr-breakdown-table tbody td.col-lane-desc {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* 7. Q-WISE PRODUCTION REPORT (#prod-table):
        Col 1 (Code): Sticky left 0 (48px).
        Col 2 (Description): Sticky left 48px (112px).
        Col 3 (Category): Unfreeze! */
  #prod-table thead th.prod-sticky-code {
    position: sticky !important;
    left: 0 !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 5px 4px !important;
    z-index: 15 !important;
    text-align: center !important;
    background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
    color: #713f12 !important;
  }

  #prod-table tbody td.prod-sticky-code {
    position: sticky !important;
    left: 0 !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 5px 4px !important;
    z-index: 12 !important;
    text-align: center !important;
    background: #ffffff !important;
    color: #0284c7 !important;
  }

  #prod-table thead th.prod-sticky-desc {
    position: sticky !important;
    left: 48px !important;
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    padding: 5px 6px !important;
    z-index: 15 !important;
    border-right: 2px solid #ca8a04 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.12) !important;
    background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
    color: #713f12 !important;
  }

  #prod-table tbody td.prod-sticky-desc {
    position: sticky !important;
    left: 48px !important;
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    padding: 5px 6px !important;
    z-index: 12 !important;
    border-right: 2px solid #cbd5e1 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.08) !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  #prod-table thead th.prod-sticky-cat,
  #prod-table tbody td.prod-sticky-cat {
    position: static !important;
    left: auto !important;
    width: 75px !important;
    min-width: 75px !important;
    max-width: 75px !important;
    box-shadow: none !important;
    border-right: none !important;
    z-index: 1 !important;
  }

  /* 8. CHEMICAL CONSUMPTION TABLE (#consumption-table):
        Col 1 (Code): Sticky left 0 (48px).
        Col 2 (Desc): Sticky left 48px (112px).
        Col 3 (Cat): Unfreeze! */
  #consumption-table thead th:nth-child(1),
  #consumption-table tbody td:nth-child(1) {
    position: sticky !important;
    left: 0 !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 5px 4px !important;
    z-index: 12 !important;
    text-align: center !important;
    background: #1e293b !important;
  }

  #consumption-table thead th:nth-child(2),
  #consumption-table tbody td:nth-child(2) {
    position: sticky !important;
    left: 48px !important;
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    padding: 5px 6px !important;
    z-index: 12 !important;
    border-right: 2px solid #818cf8 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
    background: #1e293b !important;
  }

  #consumption-table thead th:nth-child(3),
  #consumption-table tbody td:nth-child(3) {
    position: static !important;
    left: auto !important;
    width: 75px !important;
    min-width: 75px !important;
    max-width: 75px !important;
    box-shadow: none !important;
    border-right: none !important;
    z-index: 1 !important;
  }

  /* 9. LABOUR COSTING TABLE (#labour-monthly-summary-table):
        Col 1 (Date): Sticky left 0 (72px). */
  #labour-monthly-summary-table thead th:nth-child(1),
  #labour-monthly-summary-table tbody td:nth-child(1) {
    position: sticky !important;
    left: 0 !important;
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 5px 4px !important;
    z-index: 12 !important;
    border-right: 2px solid #0284c7 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
    background: #0284c7 !important;
    color: #ffffff !important;
  }
  #labour-monthly-summary-table tbody td:nth-child(1) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* 10. PRODUCT COSTING MASTER SUMMARY TABLE (#costing-master-summary-table):
        Col 1 (#): Unfreeze on mobile.
        Col 2 (Code): Sticky left 0 (46px).
        Col 3 (Product Description): Sticky left 46px (114px). */
  #costing-master-summary-table thead th:nth-child(1),
  #costing-master-summary-table tbody td:nth-child(1) {
    position: static !important;
    left: auto !important;
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    z-index: 1 !important;
    box-shadow: none !important;
    border-right: none !important;
  }

  #costing-master-summary-table thead th:nth-child(2),
  #costing-master-summary-table tbody td:nth-child(2) {
    position: sticky !important;
    left: 0 !important;
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 5px 4px !important;
    z-index: 12 !important;
    text-align: center !important;
    background: #eab308 !important;
    color: #000000 !important;
  }
  #costing-master-summary-table tbody td:nth-child(2) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  #costing-master-summary-table thead th:nth-child(3),
  #costing-master-summary-table tbody td:nth-child(3) {
    position: sticky !important;
    left: 46px !important;
    width: 114px !important;
    min-width: 114px !important;
    max-width: 114px !important;
    font-size: 9.5px !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    padding: 5px 6px !important;
    z-index: 12 !important;
    border-right: 2px solid #ca8a04 !important;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.25) !important;
    background: #eab308 !important;
    color: #000000 !important;
  }
  #costing-master-summary-table tbody td:nth-child(3) {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* Visual indicator for horizontal swipe */
  .mobile-table-swipe-hint {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 10px !important;
    margin-bottom: 6px !important;
    border-radius: 20px !important;
    background: rgba(56, 189, 248, 0.12) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    color: #38bdf8 !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em !important;
  }

  /* Quick Live Editor Input Touch Targets */
  .editor-table input[type="number"],
  .editor-table input[type="text"] {
    min-height: 36px;
    font-size: 13.5px !important;
    padding: 4px 8px;
  }

  /* Modal Dialog for Chemical History */
  .modal-content {
    width: 96vw;
    max-width: 96vw;
    max-height: 88vh;
    padding: 12px;
    border-radius: 12px;
  }

  .modal-stats-grid,
  .modal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .modal-stat {
    padding: 8px 10px;
  }

  .modal-stat .val {
    font-size: 14px;
  }

  .modal-close {
    font-size: 26px;
    padding: 4px 8px;
  }

  /* Toast Notification */
  #dashboard-toast {
    left: 8px !important;
    right: 8px !important;
    top: 8px !important;
    text-align: center;
    font-size: 11.5px !important;
    padding: 8px 12px !important;
  }

  /* Table Footers Sticky Alignment on Mobile */
  #packing-inventory-table tfoot td[colspan="3"],
  #packing-consumption-table tfoot td[colspan="3"],
  #dpr-breakdown-table tfoot td.prod-sticky-col-foot,
  #dpr-breakdown-table tfoot td[colspan="2"] {
    position: sticky !important;
    left: 0 !important;
    width: 170px !important;
    max-width: 170px !important;
    z-index: 15 !important;
    font-size: 10px !important;
    padding: 6px 8px !important;
  }
}

/* ======================================================== */
/* 3. SMALL SMARTPHONES (<= 480px) */
/* ======================================================== */
@media (max-width: 480px) {
  .brand-title h1 {
    font-size: 12.5px;
  }

  .brand-title p {
    font-size: 9px;
  }

  /* 3 columns x 2 rows for Round Cards on small phone */
  .kpi-round-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .kpi-round-card {
    width: 88px;
    height: 88px;
    padding: 4px 2px;
  }

  .kpi-round-icon {
    font-size: 13px;
  }

  .kpi-round-title {
    font-size: 7.5px;
  }

  .kpi-round-value {
    font-size: 14px;
  }

  .kpi-round-value.text-val {
    font-size: 9px !important;
  }

  .kpi-round-sub {
    font-size: 7px;
  }

  .kpi-grid,
  .consumption-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .kpi-card {
    padding: 8px 10px;
  }

  .kpi-card .kpi-value {
    font-size: 15px;
  }

  .kpi-grid-production-4cols {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .prod-section-card {
    padding: 8px 10px;
  }

  .prod-day-pill {
    min-width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 11px !important;
  }

  .header-actions .btn {
    font-size: 10.5px;
    padding: 5px 6px;
  }

  .comb-metrics-group {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .modal-stats-grid,
  .modal-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  /* Ultra-compact sticky column widths for 360px-390px screens */
  #inventory-table thead th.inv-sticky-desc,
  .editor-table thead th.inv-sticky-desc,
  #inventory-table tbody td.inv-sticky-desc,
  .editor-table tbody td.inv-sticky-desc,
  #packing-inventory-table thead th:nth-child(3),
  #packing-inventory-table tbody td:nth-child(3),
  #packing-consumption-table thead th:nth-child(3),
  #packing-consumption-table tbody td:nth-child(3),
  #prod-table thead th.prod-sticky-desc,
  #prod-table tbody td.prod-sticky-desc,
  #consumption-table thead th:nth-child(2),
  #consumption-table tbody td:nth-child(2),
  #costing-master-summary-table thead th:nth-child(3),
  #costing-master-summary-table tbody td:nth-child(3) {
    width: 102px !important;
    min-width: 102px !important;
    max-width: 102px !important;
    font-size: 8.5px !important;
    line-height: 1.15 !important;
  }
}

/* ==============================================================================
   DAILY PRODUCTION REPORT (DPR) INTELLIGENCE STYLES
   ============================================================================== */

.dpr-sec-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.dpr-sec-pill:hover {
  border-color: #06b6d4;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.08);
}

.dpr-sec-pill.active {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #ffffff;
  border-color: #0891b2;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.dpr-month-pill {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dpr-month-pill:hover {
  border-color: #38bdf8;
  color: #38bdf8;
}

.dpr-month-pill.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.dpr-day-pill {
  min-width: 30px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dpr-day-pill:hover {
  border-color: #06b6d4;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
}

.dpr-day-pill.active {
  background: #06b6d4;
  color: #ffffff;
  border-color: #06b6d4;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.3);
}

.dpr-status-pill {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dpr-status-pill:hover {
  border-color: #10b981;
  color: #10b981;
}

.dpr-status-pill.active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.search-box-cyan {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(6, 182, 212, 0.35);
  border-radius: 8px;
  padding: 4px 10px;
  transition: all 0.2s ease;
}

.search-box-cyan:focus-within {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.search-box-cyan input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  outline: none;
}

.dpr-table-thead-cyan th {
  background: linear-gradient(180deg, #0e7490 0%, #155e75 100%) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2.5px solid #06b6d4 !important;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 10px;
}

.dpr-master-table tbody tr:hover {
  background: rgba(6, 182, 212, 0.06) !important;
}

.dpr-master-table td {
  padding: 7px 10px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-color);
}

.badge-released {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  font-weight: 800;
  font-size: 10.5px;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-under-ins {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  font-weight: 800;
  font-size: 10.5px;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.dpr-section-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Q-Wise Matching Golden-Orange Header for DPR Table */
#dpr-table-thead th {
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
  color: #7c2d12 !important;
  font-weight: 900 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2.5px solid #c2410c !important;
  border-top: 1px solid #fed7aa !important;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 7px 10px;
  box-shadow: 0 2px 6px rgba(194, 65, 12, 0.25);
}

#dpr-table-thead th:hover {
  background: linear-gradient(180deg, #ffedd5 0%, #f97316 100%) !important;
  color: #431407 !important;
}

/* ======================================================== */
/* DPR DEDICATED ROUNDED WHITE THEME SECTION CARDS */
/* ======================================================== */
.dpr-white-round-card {
  background: #ffffff !important;
  border-radius: 20px !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03) !important;
  padding: 14px 16px !important;
  color: #0f172a !important;
  transition: all 0.25s ease !important;
}

.dpr-white-round-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08) !important;
}

.dpr-white-round-card .section-card-title {
  color: #0f172a !important;
  font-weight: 900 !important;
  font-size: 13.5px !important;
}

.dpr-white-round-card .metric-sub-block {
  background: #f8fafc !important;
  border-radius: 12px !important;
  border: 1px solid #f1f5f9 !important;
  padding: 8px 10px !important;
}

.dpr-white-round-card .metric-lbl {
  color: #64748b !important;
  font-weight: 800 !important;
  font-size: 9.5px !important;
}

.dpr-white-round-card .metric-footer {
  color: #94a3b8 !important;
  font-weight: 600 !important;
  font-size: 9px !important;
}

.dpr-white-round-card .section-card-tonnage-footer {
  border-top: 1px dashed #e2e8f0 !important;
  margin-top: 8px !important;
  padding-top: 8px !important;
}

.dpr-white-round-card .section-badge-icon {
  border-radius: 12px !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.dpr-white-round-card .pill-badge {
  border-radius: 20px !important;
  padding: 3px 8px !important;
}

/* Specific Accent Border Highlights on hover/active */
.dpr-card-det.dpr-white-round-card {
  border-left: 5px solid #0284c7 !important;
}

.dpr-card-acid.dpr-white-round-card {
  border-left: 5px solid #dc2626 !important;
}

.dpr-card-offer.dpr-white-round-card {
  border-left: 5px solid #d97706 !important;
}

.dpr-card-bulk.dpr-white-round-card {
  border-left: 5px solid #059669 !important;
}

/* Search Input Normalization (Remove default cancel button & autofill background) */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

/* Secure Pin Masked Input (Only masks when type is password, reveals clearly when toggled to text) */
.pin-masked-input {
  font-family: var(--font-mono), monospace !important;
}

.pin-masked-input[type="password"] {
  -webkit-text-security: disc;
  text-security: disc;
}

/* ======================================================== */
/* LIVE USER PRESENCE & DAILY LOGIN ACTIVITY TRACKER STYLES */
/* ======================================================== */
.status-dot-online {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse-presence 1.8s infinite;
  flex-shrink: 0;
}

@keyframes pulse-presence {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.status-dot-offline {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}

.presence-badge-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.35);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.presence-badge-offline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 11px;
  font-weight: 700;
}

.activity-pill-today {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.14);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  letter-spacing: 0.02em;
}

[data-theme="light"] .activity-pill-today {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.3);
}

.admin-presence-kpi-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-presence-kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 12px;
  font-weight: 700;
}

.live-stream-chip {
  background: rgba(34, 197, 94, 0.12) !important;
  border: 1.5px solid rgba(34, 197, 94, 0.35) !important;
  color: #22c55e !important;
  letter-spacing: 0.02em;
}

[data-theme="light"] .live-stream-chip {
  background: rgba(22, 163, 74, 0.1) !important;
  border-color: rgba(22, 163, 74, 0.3) !important;
  color: #16a34a !important;
}

/* ========================================================
   ULTRA-COLORFUL & VIBRANT SUMMARY BREAKDOWN STYLES
   ======================================================== */
.dpr-summary-premium-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(26, 31, 56, 0.94) 50%, rgba(15, 23, 42, 0.96) 100%);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  box-shadow: 0 15px 40px -5px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  margin-top: 28px;
  backdrop-filter: blur(18px);
}

[data-theme="light"] .dpr-summary-premium-card {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 2px solid rgba(2, 132, 199, 0.35);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.1);
}

/* 5 Colorful Floating KPI Cards */
.dpr-sum-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 18px 0 14px 0;
}

.dpr-sum-kpi-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.dpr-sum-kpi-card:hover {
  transform: translateY(-3px) scale(1.02);
}

.dpr-sum-kpi-card.kpi-det {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.25) 0%, rgba(14, 165, 233, 0.12) 100%);
  border-color: rgba(56, 189, 248, 0.45);
}
.dpr-sum-kpi-card.kpi-det:hover {
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4);
}

.dpr-sum-kpi-card.kpi-acid {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.25) 0%, rgba(239, 68, 68, 0.12) 100%);
  border-color: rgba(248, 113, 113, 0.45);
}
.dpr-sum-kpi-card.kpi-acid:hover {
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.4);
}

.dpr-sum-kpi-card.kpi-offer {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.25) 0%, rgba(245, 158, 11, 0.12) 100%);
  border-color: rgba(251, 191, 36, 0.45);
}
.dpr-sum-kpi-card.kpi-offer:hover {
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.4);
}

.dpr-sum-kpi-card.kpi-bulk {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.25) 0%, rgba(16, 185, 129, 0.12) 100%);
  border-color: rgba(52, 211, 153, 0.45);
}
.dpr-sum-kpi-card.kpi-bulk:hover {
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.4);
}

.dpr-sum-kpi-card.kpi-combined {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.35) 0%, rgba(147, 51, 234, 0.28) 100%);
  border-color: rgba(251, 146, 60, 0.65);
  box-shadow: 0 4px 18px rgba(234, 88, 12, 0.3);
}
.dpr-sum-kpi-card.kpi-combined:hover {
  box-shadow: 0 8px 28px rgba(234, 88, 12, 0.55);
}

.kpi-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.kpi-number {
  font-family: 'JetBrains Mono', 'Fira Code', var(--font-mono);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.kpi-sub {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.85;
  margin-top: 3px;
}

/* Colorful Brand Pills */
.sum-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sum-pill-label {
  font-size: 11px;
  font-weight: 900;
  color: #38bdf8 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-width: 68px;
  user-select: none;
}

[data-theme="light"] .sum-pill-label {
  color: #0284c7 !important;
}

.sum-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

[data-theme="light"] .sum-pill-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.sum-pill-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.sum-pill-btn.active[data-brand="ALL"] {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: #34d399 !important;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
}

.sum-pill-btn.active[data-brand="DEXIN"] {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.5);
}

.sum-pill-btn.active[data-brand="MARVEL"] {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%) !important;
  color: #ffffff !important;
  border-color: #c084fc !important;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5);
}

.sum-pill-btn.active[data-brand="SPARKLE"] {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%) !important;
  color: #ffffff !important;
  border-color: #f472b6 !important;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.5);
}

.sum-pill-btn.active[data-brand="HELI"] {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  border-color: #fcd34d !important;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5);
}

.sum-pill-btn.active[data-month] {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%) !important;
  color: #ffffff !important;
  border-color: #34d399 !important;
  font-weight: 900;
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.5);
}

.sum-day-pill {
  min-width: 32px;
  height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

[data-theme="light"] .sum-day-pill {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.sum-day-pill:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

.sum-day-pill.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.6);
  transform: translateY(-2px);
}

/* Beautiful High-Vibrancy Table Styling */
.dpr-beauty-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.dpr-beauty-table thead th {
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.dpr-beauty-table tbody tr {
  transition: all 0.15s ease;
}

.dpr-beauty-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.12) !important;
}

.dpr-beauty-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  color: #ffffff;
}

/* Colorful Vertical Column Lane Backgrounds */
.col-lane-date {
  background: rgba(15, 23, 42, 0.4);
}
.col-lane-det {
  background: rgba(2, 132, 199, 0.07);
}
.col-lane-acid {
  background: rgba(220, 38, 38, 0.07);
}
.col-lane-offer {
  background: rgba(217, 119, 6, 0.07);
}
.col-lane-bulk {
  background: rgba(5, 150, 105, 0.07);
}
.col-lane-comb {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.14) 0%, rgba(147, 51, 234, 0.1) 100%);
  border-left: 2px solid rgba(251, 146, 60, 0.45);
}

/* ==========================================================================
   DAILY PRODUCTION REPORT TABLE - EXACT MATERIAL BOM COLORFUL THEME
   ========================================================================== */
#dpr-summary-table-container {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08) !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
}

#dpr-breakdown-table {
  background: #ffffff !important;
  color: #0f172a !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

#dpr-breakdown-table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
}

#dpr-breakdown-table thead tr {
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #000000 !important;
  border-bottom: 2px solid #ca8a04 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18) !important;
}

#dpr-breakdown-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 25 !important;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #000000 !important;
  padding: 8px 10px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  border-bottom: 2px solid #ca8a04 !important;
  border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Sticky Frozen Columns for Table Header */
#dpr-breakdown-table thead th.prod-sticky-col-date,
#dpr-breakdown-table thead th.col-lane-date {
  position: sticky !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 35 !important;
  width: 115px !important;
  min-width: 115px !important;
  max-width: 115px !important;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
}

#dpr-breakdown-table thead th.prod-sticky-col-sku,
#dpr-breakdown-table thead th.col-lane-desc {
  position: sticky !important;
  left: 115px !important;
  top: 0 !important;
  z-index: 35 !important;
  width: 260px !important;
  min-width: 260px !important;
  max-width: 260px !important;
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  border-right: 2px solid #ca8a04 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.12) !important;
}

#dpr-breakdown-table thead th.col-lane-comb {
  background: #fbbf24 !important;
  border-left: 2px solid #ca8a04 !important;
}

#dpr-breakdown-table tbody tr {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  transition: background 0.10s ease !important;
}

#dpr-breakdown-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

#dpr-breakdown-table tbody tr:hover {
  background: #f1f5f9 !important;
}

#dpr-breakdown-table tbody td {
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 6px 10px !important;
  font-size: 11.5px !important;
}

/* Sticky Frozen Columns for Table Body (Solid Opaque, Zero Transparency) */
#dpr-breakdown-table tbody td.prod-sticky-col-date,
#dpr-breakdown-table tbody td.col-lane-date {
  position: sticky !important;
  left: 0 !important;
  z-index: 15 !important;
  width: 115px !important;
  min-width: 115px !important;
  max-width: 115px !important;
  border-right: 1px solid #e2e8f0 !important;
  text-align: center !important;
  background: #ffffff !important;
}

#dpr-breakdown-table tbody tr:nth-child(even) td.prod-sticky-col-date,
#dpr-breakdown-table tbody tr:nth-child(even) td.col-lane-date {
  background: #f8fafc !important;
}

#dpr-breakdown-table tbody td.prod-sticky-col-sku,
#dpr-breakdown-table tbody td.col-lane-desc {
  position: sticky !important;
  left: 115px !important;
  z-index: 15 !important;
  width: 260px !important;
  min-width: 260px !important;
  max-width: 260px !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.08) !important;
  background: #ffffff !important;
}

#dpr-breakdown-table tbody tr:nth-child(even) td.prod-sticky-col-sku,
#dpr-breakdown-table tbody tr:nth-child(even) td.col-lane-desc {
  background: #f8fafc !important;
}

#dpr-breakdown-table tbody tr:hover td.prod-sticky-col-date,
#dpr-breakdown-table tbody tr:hover td.col-lane-date,
#dpr-breakdown-table tbody tr:hover td.prod-sticky-col-sku,
#dpr-breakdown-table tbody tr:hover td.col-lane-desc {
  background: #f1f5f9 !important;
}

#dpr-breakdown-table tbody td.col-lane-det {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  font-weight: 800 !important;
  border-right: 1px solid #e0f2fe !important;
}

#dpr-breakdown-table tbody td.col-lane-acid {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  font-weight: 800 !important;
  border-right: 1px solid #ffe4e6 !important;
}

#dpr-breakdown-table tbody td.col-lane-offer {
  background: #fefce8 !important;
  color: #d97706 !important;
  font-weight: 800 !important;
  border-right: 1px solid #fef3c7 !important;
}

#dpr-breakdown-table tbody td.col-lane-bulk {
  background: #ecfdf5 !important;
  color: #047857 !important;
  font-weight: 900 !important;
  border-left: 1px solid #d1fae5 !important;
  border-right: 1px solid #d1fae5 !important;
}

#dpr-breakdown-table tbody td.col-lane-comb {
  background: #ffedd5 !important;
  color: #c2410c !important;
  font-weight: 900 !important;
  border-left: 2px solid #fdba74 !important;
}

#dpr-breakdown-table tbody tr:hover td.col-lane-det {
  background: #e0f2fe !important;
}
#dpr-breakdown-table tbody tr:hover td.col-lane-acid {
  background: #ffe4e6 !important;
}
#dpr-breakdown-table tbody tr:hover td.col-lane-offer {
  background: #fef3c7 !important;
}
#dpr-breakdown-table tbody tr:hover td.col-lane-bulk {
  background: #dcfce7 !important;
}
#dpr-breakdown-table tbody tr:hover td.col-lane-comb {
  background: #fed7aa !important;
}

/* Material BOM Style Footer (Emerald Green with White & Yellow Highlights) */
#dpr-breakdown-table tfoot {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 20 !important;
}

#dpr-breakdown-table tfoot tr {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  border-top: 2px solid #047857 !important;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2) !important;
}

#dpr-breakdown-table tfoot td {
  background: transparent !important;
  color: #ffffff !important;
  border-top: 2px solid #047857 !important;
  padding: 8px 10px !important;
}

#dpr-breakdown-table tfoot td.prod-sticky-col-foot,
#dpr-breakdown-table tfoot td[colspan="2"] {
  position: sticky !important;
  left: 0 !important;
  z-index: 30 !important;
  width: 375px !important;
  min-width: 375px !important;
  max-width: 375px !important;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  border-right: 2px solid #047857 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.15) !important;
}

#dpr-breakdown-table tfoot td.col-lane-comb {
  background: rgba(0, 0, 0, 0.2) !important;
  color: #fef08a !important;
  border-left: 2px solid rgba(255, 255, 255, 0.3) !important;
}

/* Cell Value Badges */
.dpr-cell-val {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: 'JetBrains Mono', 'Fira Code', var(--font-mono);
  font-weight: 800;
  font-size: 13.5px;
  padding: 4px 10px;
  border-radius: 8px;
}

.dpr-val-det {
  background: rgba(2, 132, 199, 0.22);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.dpr-val-acid {
  background: rgba(220, 38, 38, 0.22);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.dpr-val-offer {
  background: rgba(217, 119, 6, 0.22);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.dpr-val-bulk {
  background: rgba(5, 150, 105, 0.22);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.dpr-val-combined {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.4) 0%, rgba(147, 51, 234, 0.35) 100%);
  color: #ffedd5;
  border: 1.5px solid rgba(251, 146, 60, 0.7);
  font-size: 14.5px;
  font-weight: 900;
  box-shadow: 0 0 14px rgba(234, 88, 12, 0.35);
}

/* ============================================================
   PRODUCT COSTING & PRICING BI MODULE STYLES (TAB 5)
   ============================================================ */
.costing-brand-badge-dexin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
}

.costing-brand-badge-marvel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
}

.costing-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.costing-rank-row:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(3px);
}

.costing-rank-badge {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
}

.costing-rank-badge-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.costing-rank-badge-silver {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.costing-rank-badge-bronze {
  background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
}

.costing-rank-badge-normal {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.costing-tier-badge-high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
}

.costing-tier-badge-std {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
}

.costing-tier-badge-low {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
}

.costing-margin-badge {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.costing-format-tag {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* ============================================================
   BOM PACKAGING TABLES (EXACT SCREENSHOT LAYOUT)
   ============================================================ */
.bom-variant-card {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0 !important;
  min-height: min-content !important;
}

.bom-variant-card > * {
  flex-shrink: 0 !important;
  min-height: min-content !important;
}

.bom-variant-card:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.12);
}

.bom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.bom-table-head th {
  background: #1e293b;
  color: #ffffff !important;
  font-weight: 900;
  padding: 6px 12px;
  border: 1px solid #334155;
  font-size: 11px;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .bom-table-head th {
  background: #1e293b;
  color: #ffffff !important;
  border-color: #334155;
}

.bom-variant-title-th {
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  font-size: 14.5px !important;
  padding: 10px 14px !important;
  border: 1.5px solid #eab308 !important;
  letter-spacing: 0.01em;
}

.bom-cost-head-th {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  font-size: 11px !important;
  text-align: right !important;
  padding: 6px 12px !important;
  border: 1px solid #1e40af !important;
  white-space: nowrap;
}

[data-theme="dark"] .bom-cost-head-th {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border-color: #1e40af !important;
}

.bom-table td {
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
}

.bom-cell-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
  width: 130px;
}

.bom-cell-desc {
  font-weight: 600;
}

.bom-cell-cost {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 800;
  width: 130px;
}

.bom-row-bulk td {
  background: rgba(245, 158, 11, 0.07);
  font-weight: 800;
}

.bom-row-bulk .bom-cell-cost {
  color: #fbbf24;
}

.bom-table-foot td {
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  border: 1.5px solid #16a34a !important;
  padding: 9px 14px !important;
  letter-spacing: 0.02em;
}



/* ============================================================
   CHEMICAL FORMULATION RECIPE TABLE (EXACT SCREENSHOT LAYOUT)
   ============================================================ */
.formulation-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  flex-shrink: 0 !important;
  min-height: min-content !important;
}

.formulation-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.formulation-title-th {
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%) !important;
  color: #0369a1 !important;
  font-weight: 900 !important;
  padding: 8px 12px !important;
  border: 1px solid #7dd3fc !important;
}

[data-theme="dark"] .formulation-title-th {
  background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%) !important;
  color: #93c5fd !important;
  border-color: #1e40af !important;
}

.formulation-head-row th,
[data-theme="dark"] .formulation-head-row th {
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%) !important;
  color: #000000 !important;
  font-weight: 800 !important;
  padding: 6px 10px !important;
  border: 1.5px solid #eab308 !important;
  font-size: 11.5px !important;
  white-space: nowrap;
}

.formulation-table td {
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  white-space: nowrap;
}

.formulation-foot-row,
.formulation-foot-row td {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  padding: 8px 10px !important;
  border: 1.5px solid #047857 !important;
  font-size: 12.5px !important;
  white-space: nowrap;
}

/* Costing Modal High-Contrast Solid Black Font & Precision Compact Fit Rules */
#costing-item-focus-modal .formulation-table td,
#costing-item-focus-modal .bom-table td,
#costing-item-focus-modal .formulation-table th,
#costing-item-focus-modal .bom-table .bom-variant-title-th {
  color: #000000 !important;
}
#costing-item-focus-modal .bom-table-head th,
#costing-item-focus-modal .bom-cost-head-th {
  color: #ffffff !important;
}
#costing-item-focus-modal .formulation-table tr td {
  color: #000000 !important;
  font-weight: 700 !important;
  padding: 3px 3px !important;
  font-size: 10.5px !important;
}
#costing-item-focus-modal .bom-table tr td {
  color: #000000 !important;
  font-weight: 700 !important;
  padding: 3px 6px !important;
  font-size: 10.5px !important;
}

#costing-item-modal-body::-webkit-scrollbar {
  width: 10px;
}
#costing-item-modal-body::-webkit-scrollbar-track {
  background: #0b132b;
  border-radius: 6px;
}
#costing-item-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #facc15 0%, #ca8a04 100%);
  border-radius: 6px;
  border: 2px solid #0b132b;
}

@media (max-width: 1100px) {
  #costing-modal-tables-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   COSTING SEARCH EXPANDED DROPDOWN (WIDE & COMPLETE DETAILS)
   ============================================================ */
.costing-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 780px;
  min-width: 100%;
  max-width: min(850px, calc(100vw - 36px));
  z-index: 10000;
  background: #0b132b !important;
  border: 2px solid #3b82f6 !important;
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.85), 0 0 20px rgba(59, 130, 246, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.costing-autocomplete-header {
  padding: 8px 14px;
  background: #0c1527;
  border-bottom: 1.5px solid #1e293b;
  flex-shrink: 0;
}

.costing-autocomplete-body {
  max-height: 380px;
  overflow-y: auto !important;
  overflow-x: auto !important;
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #0b132b;
}

/* Custom Sleek Scrollbar */
.costing-autocomplete-body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.costing-autocomplete-body::-webkit-scrollbar-track {
  background: #0b132b;
  border-radius: 0 0 10px 0;
}

.costing-autocomplete-body::-webkit-scrollbar-thumb {
  background: #3b82f6;
  border-radius: 5px;
}

.costing-autocomplete-body::-webkit-scrollbar-thumb:hover {
  background: #60a5fa;
}

.costing-mini-table {
  width: 100%;
  min-width: 740px;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.costing-mini-table thead th {
  position: sticky;
  top: 0;
  background: #1e293b;
  color: #facc15;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  border-bottom: 2px solid #3b82f6;
  z-index: 10;
  white-space: nowrap;
}

.costing-mini-table tbody tr {
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.1s ease;
}

.costing-mini-table tbody tr:hover,
.costing-mini-table tbody tr.selected {
  background: #1d4ed8 !important;
}

.costing-mini-table tbody tr:hover td,
.costing-mini-table tbody tr.selected td {
  color: #ffffff !important;
}

.costing-mini-table tbody td {
  padding: 7px 10px;
  color: #f1f5f9;
  font-size: 12px;
  vertical-align: middle;
}

.costing-mini-table .costing-sku-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #facc15;
  font-family: monospace;
  font-weight: 800;
  font-size: 11px;
}

.costing-mini-table .costing-variant-cell {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  font-weight: 600;
  color: #ffffff;
}

.costing-mini-table .costing-brand-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 10.5px;
  text-align: center;
  letter-spacing: 0.02em;
}

.costing-mini-table .costing-pack-badge {
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
}

.costing-mini-table .costing-cost-unit {
  font-family: monospace;
  font-weight: 800;
  font-size: 12px;
  color: #4ade80;
}

.costing-mini-table .costing-cost-carton {
  font-family: monospace;
  font-weight: 800;
  font-size: 12px;
  color: #38bdf8;
}

/* ============================================================
   PRICES: CHEMICAL & PACKING MATERIAL MASTER TABLE STYLES
   ============================================================ */
.prices-master-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  font-size: 12px;
}

.prices-golden-header th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%) !important;
  color: #000000 !important;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  border-bottom: 2px solid #ca8a04;
  z-index: 15;
  white-space: nowrap;
}

.prices-master-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.12s ease;
}

.prices-master-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.12) !important;
}

.prices-master-table tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  color: var(--text-primary);
}

.price-code-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #facc15;
  font-family: monospace;
  font-weight: 800;
  font-size: 11.5px;
}

.price-rate-chem {
  font-family: monospace;
  font-weight: 900;
  font-size: 13px;
  color: #34d399;
}

.price-rate-pkg {
  font-family: monospace;
  font-weight: 900;
  font-size: 13px;
  color: #38bdf8;
}

.price-section-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
}

.price-section-chem {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.price-section-pkg {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.price-subcat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

/* Costing & Labour Table Fullscreen Mode */
#prices-table-container.costing-fullscreen-mode,
#costing-bom-cards-container.costing-fullscreen-mode,
#labour-table-container.costing-fullscreen-mode,
#labour-worker-table-container.costing-fullscreen-mode,
#labour-active-table-container.costing-fullscreen-mode {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  background: var(--bg-primary) !important;
  z-index: 99999 !important;
  padding: 24px !important;
  overflow-y: auto !important;
  box-shadow: 0 0 40px rgba(0,0,0,0.85) !important;
}

#labour-view-tabs .tab-btn {
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

#labour-view-tabs .tab-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: #10b981;
}

#labour-view-tabs .tab-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: #059669 !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Worker Tag Badges & Shift Detail Cards */
.worker-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 2px;
  white-space: nowrap;
}

.worker-tag:hover {
  background: rgba(56, 189, 248, 0.28);
  border-color: #38bdf8;
  transform: translateY(-1px);
  color: #ffffff;
}

.worker-tag small {
  color: #34d399;
  font-weight: 800;
  font-family: var(--font-mono);
}

.shift-card-panel {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  transition: var(--transition);
}

.shift-card-panel:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ======================================================== */
/* LABOUR COSTING EXECUTIVE SHIFT MASTER TABLES */
/* ======================================================== */
.labour-master-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 11px;
}

.labour-master-table thead th {
  position: static;
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 40%, #0369a1 100%) !important;
  color: #ffffff !important;
  padding: 8px 4px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  border-bottom: 2.5px solid #075985 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.25);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ======================================================== */
/* LABOUR MONTH SELECTOR BAR (HIGH-CONTRAST DARK THEME) */
/* ======================================================== */
#labour-month-tabs-bar {
  transition: all 0.3s ease;
}

.labour-month-selector-btn:hover:not(.active) {
  background: #334155 !important;
  color: #38bdf8 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45) !important;
  transform: translateY(-1px);
}

#labour-monthly-summary-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 25 !important;
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 40%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  border-bottom: 2.5px solid #075985 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35) !important;
}

.labour-master-table tbody td {
  padding: 7px 5px !important;
  border-bottom: 1px solid #e0f2fe;
  color: #0f172a;
}

.labour-master-table tfoot {
  position: static !important;
  bottom: auto !important;
  box-shadow: none !important;
}

.labour-master-table tfoot tr {
  background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 50%, #0284c7 100%) !important;
  border-top: 2.5px solid #38bdf8 !important;
  color: #ffffff !important;
}

.labour-master-table tfoot td {
  position: static !important;
  padding: 10px 10px !important;
  border-top: none !important;
  border-bottom: none !important;
  color: #ffffff !important;
}

/* ======================================================== */
/* PRODUCT COSTING MASTER SUMMARY CATALOG TABLE */
/* ======================================================== */
.costing-master-catalog-table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  table-layout: fixed !important;
  font-size: 11px !important;
  background: #ffffff !important;
}

.costing-master-catalog-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%) !important;
  color: #000000 !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
  text-shadow: none !important;
  border-bottom: 2.5px solid #ca8a04 !important;
  border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 2px 5px rgba(234, 179, 8, 0.25) !important;
  white-space: normal !important;
  line-height: 1.15 !important;
  padding: 6px 3px !important;
  text-align: center !important;
  box-sizing: border-box !important;
  vertical-align: middle !important;
}

.costing-master-catalog-table tbody td {
  padding: 5px 4px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  vertical-align: middle !important;
  color: #0f172a !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.costing-master-catalog-table tbody tr:hover {
  background: #e0f2fe !important;
}

.costing-master-catalog-table tfoot {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 10 !important;
}

.costing-master-catalog-table tfoot tr {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  border-top: 2.5px solid #047857 !important;
}

.costing-master-catalog-table tfoot td {
  position: sticky !important;
  bottom: 0 !important;
  padding: 6px 4px !important;
  color: #000000 !important;
  font-weight: 900 !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  vertical-align: middle !important;
}

/* ==========================================================================
   PACKAGING MATERIAL TABLES - SMOOTH HORIZONTAL SCROLL FOR RIGHT-SIDE DATA
   ========================================================================== */
#packing-critical-table-container {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

#packing-critical-table {
  min-width: 1100px !important;
  width: 100% !important;
  table-layout: fixed !important;
  font-size: 10px !important;
}

#packing-critical-table th {
  padding: 5px 3px !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  text-transform: none !important;
  line-height: 1.15 !important;
  vertical-align: middle !important;
}

#packing-critical-table td {
  padding: 4px 3px !important;
  font-size: 9.5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
}

#packing-critical-table th:nth-child(3),
#packing-critical-table td:nth-child(3) {
  white-space: normal !important;
  word-break: break-word !important;
  line-height: 1.15 !important;
  font-size: 10px !important;
}

/* Master Packaging Inventory & Consumption Tables - Smooth Horizontal Scroll for Right-Side Data */
#packing-inventory-table-container,
#packing-consumption-table-container {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Attractive Gold Scrollbars for Packaging Tables */
#packing-inventory-table-container,
#packing-consumption-table-container,
#packing-critical-table-container {
  overflow-x: auto !important;
  overflow-y: auto !important;
  scrollbar-width: auto !important;
  scrollbar-color: #f59e0b #0f172a !important;
  -webkit-overflow-scrolling: touch;
}

#packing-inventory-table-container::-webkit-scrollbar,
#packing-consumption-table-container::-webkit-scrollbar,
#packing-critical-table-container::-webkit-scrollbar {
  height: 12px !important;
  width: 10px !important;
}

#packing-inventory-table-container::-webkit-scrollbar-track,
#packing-consumption-table-container::-webkit-scrollbar-track,
#packing-critical-table-container::-webkit-scrollbar-track {
  background: #0f172a !important;
  border-radius: 6px !important;
}

#packing-inventory-table-container::-webkit-scrollbar-thumb,
#packing-consumption-table-container::-webkit-scrollbar-thumb,
#packing-critical-table-container::-webkit-scrollbar-thumb {
  background: #f59e0b !important;
  border-radius: 6px !important;
  border: 2px solid #0f172a !important;
}

#packing-inventory-table-container::-webkit-scrollbar-thumb:hover,
#packing-consumption-table-container::-webkit-scrollbar-thumb:hover,
#packing-critical-table-container::-webkit-scrollbar-thumb:hover {
  background: #fbbf24 !important;
}

#packing-inventory-table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 11px !important;
}

#packing-consumption-table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 11px !important;
}

#packing-inventory-table th,
#packing-consumption-table th {
  padding: 8px 6px !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  line-height: 1.25 !important;
  letter-spacing: 0.02em !important;
  white-space: normal !important;
  vertical-align: middle !important;
}

#packing-inventory-table td,
#packing-consumption-table td {
  padding: 5px 6px !important;
  font-size: 10.5px !important;
  white-space: nowrap !important;
  vertical-align: middle !important;
}

#packing-inventory-table th:nth-child(3),
#packing-inventory-table td:nth-child(3),
#packing-consumption-table th:nth-child(3),
#packing-consumption-table td:nth-child(3) {
  white-space: normal !important;
  word-break: break-word !important;
  min-width: 260px !important;
  max-width: 320px !important;
  line-height: 1.2 !important;
  font-size: 11px !important;
}

/* ==========================================================================
   PACKAGING MASTER & CONSUMPTION TABLES - FREEZE PANES & FIXED HEADER ROW
   ========================================================================== */
/* Entire Yellow Header Row Sticky Top Lock on Vertical Scroll */
#packing-inventory-table thead,
#packing-consumption-table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
}

#packing-inventory-table thead tr,
#packing-consumption-table thead tr {
  position: sticky !important;
  top: 0 !important;
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%) !important;
}

#packing-inventory-table thead th,
#packing-consumption-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  background: linear-gradient(180deg, #facc15 0%, #eab308 100%) !important;
  color: #000000 !important;
}

/* Corner Header Freeze: Columns 1, 2, 3 (Sticky Top + Sticky Left) */
#packing-inventory-table thead th:nth-child(1),
#packing-consumption-table thead th:nth-child(1) {
  position: sticky !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 45 !important;
  width: 45px !important;
  min-width: 45px !important;
  max-width: 45px !important;
  background: #eab308 !important;
}

#packing-inventory-table thead th:nth-child(2),
#packing-consumption-table thead th:nth-child(2) {
  position: sticky !important;
  left: 45px !important;
  top: 0 !important;
  z-index: 45 !important;
  width: 95px !important;
  min-width: 95px !important;
  max-width: 95px !important;
  background: #eab308 !important;
}

#packing-inventory-table thead th:nth-child(3),
#packing-consumption-table thead th:nth-child(3) {
  position: sticky !important;
  left: 140px !important;
  top: 0 !important;
  z-index: 45 !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  background: #eab308 !important;
  border-right: 2.5px solid #ca8a04 !important;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.25) !important;
}

/* ==========================================================================
   PACKAGING CONSUMPTION TABLE - LUXURY WHITE THEME & BLACK VALUES
   ========================================================================== */
#packing-consumption-table {
  background: #ffffff !important;
  color: #0f172a !important;
}

#packing-consumption-table tbody tr {
  background: #ffffff !important;
}

#packing-consumption-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

#packing-consumption-table tbody tr:hover,
#packing-consumption-table tbody tr:hover td {
  background: #f1f5f9 !important;
}

#packing-consumption-table tbody td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

#packing-consumption-table tbody td:nth-child(1) {
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  width: 45px !important;
  min-width: 45px !important;
  max-width: 45px !important;
  background: #ffffff !important;
  color: #64748b !important;
}

#packing-consumption-table tbody tr:nth-child(even) td:nth-child(1) {
  background: #f8fafc !important;
}

#packing-consumption-table tbody td:nth-child(2) {
  position: sticky !important;
  left: 45px !important;
  z-index: 10 !important;
  width: 95px !important;
  min-width: 95px !important;
  max-width: 95px !important;
  background: #ffffff !important;
  color: #0284c7 !important;
}

#packing-consumption-table tbody tr:nth-child(even) td:nth-child(2) {
  background: #f8fafc !important;
}

#packing-consumption-table tbody td:nth-child(3) {
  position: sticky !important;
  left: 140px !important;
  z-index: 10 !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.06) !important;
}

#packing-consumption-table tbody tr:nth-child(even) td:nth-child(3) {
  background: #f8fafc !important;
}

#packing-consumption-table tbody tr:hover td:nth-child(1),
#packing-consumption-table tbody tr:hover td:nth-child(2),
#packing-consumption-table tbody tr:hover td:nth-child(3) {
  background: #f1f5f9 !important;
}

#packing-consumption-table tfoot tr {
  background: #f8fafc !important;
  color: #000000 !important;
  border-top: 2.5px solid #cbd5e1 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

#packing-consumption-table tfoot td {
  background: #f8fafc !important;
  color: #000000 !important;
  border-top: 2.5px solid #cbd5e1 !important;
}

#packing-consumption-table tfoot td:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 35 !important;
  background: #f8fafc !important;
  color: #000000 !important;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.06) !important;
}

/* ==========================================================================
   PACKAGING INVENTORY MASTER TABLE - LUXURY WHITE THEME & BLACK VALUES
   ========================================================================== */
#packing-inventory-table {
  background: #ffffff !important;
  color: #0f172a !important;
}

#packing-inventory-table tbody tr {
  background: #ffffff !important;
}

#packing-inventory-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

#packing-inventory-table tbody tr:hover,
#packing-inventory-table tbody tr:hover td {
  background: #f1f5f9 !important;
}

#packing-inventory-table tbody td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

#packing-inventory-table tbody td:nth-child(1) {
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  width: 45px !important;
  min-width: 45px !important;
  max-width: 45px !important;
  background: #ffffff !important;
  color: #475569 !important;
}

#packing-inventory-table tbody tr:nth-child(even) td:nth-child(1) {
  background: #f8fafc !important;
}

#packing-inventory-table tbody td:nth-child(2) {
  position: sticky !important;
  left: 45px !important;
  z-index: 10 !important;
  width: 95px !important;
  min-width: 95px !important;
  max-width: 95px !important;
  background: #ffffff !important;
  color: #0284c7 !important;
}

#packing-inventory-table tbody tr:nth-child(even) td:nth-child(2) {
  background: #f8fafc !important;
}

#packing-inventory-table tbody td:nth-child(3) {
  position: sticky !important;
  left: 140px !important;
  z-index: 10 !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.06) !important;
}

#packing-inventory-table tbody tr:nth-child(even) td:nth-child(3) {
  background: #f8fafc !important;
}

#packing-inventory-table tbody tr:hover td:nth-child(1),
#packing-inventory-table tbody tr:hover td:nth-child(2),
#packing-inventory-table tbody tr:hover td:nth-child(3) {
  background: #f1f5f9 !important;
}

/* Packaging Inventory Footer - Clean White/Light Slate with bold black text */
#packing-inventory-table tfoot tr {
  background: #f8fafc !important;
  color: #000000 !important;
  border-top: 2.5px solid #cbd5e1 !important;
}

#packing-inventory-table tfoot td {
  background: #f8fafc !important;
  color: #000000 !important;
  border-top: 2.5px solid #cbd5e1 !important;
}

#packing-inventory-table tfoot td:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 35 !important;
  background: #f8fafc !important;
  color: #000000 !important;
  border-right: 2px solid #cbd5e1 !important;
  box-shadow: 3px 0 6px rgba(0, 0, 0, 0.06) !important;
}

/* Packaging Master Table - Bold Prominent Unit Rate Styling */
.packing-unit-rate-cell {
  text-align: right !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
}

.packing-unit-rate-badge {
  display: inline-block !important;
  text-align: right !important;
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  font-family: ui-monospace, SFMono-Regular, monospace !important;
  font-weight: 800 !important;
  font-size: 10.5px !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
}

.packing-unit-rate-badge .rate-unit {
  font-size: 8.5px !important;
  font-weight: 700 !important;
  color: #64748b !important;
  margin-left: 2px !important;
}

/* ==========================================================================
   PACKAGING MASTER TABLE - SEARCH AUTOCOMPLETE DROPDOWN & QUICK SELECTOR
   ========================================================================== */
.packing-search-wrapper {
  position: relative;
  min-width: 270px;
  max-width: 420px;
  flex: 1;
}

.packing-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 650px;
  min-width: 100%;
  max-width: min(720px, calc(100vw - 32px));
  background: #ffffff !important;
  border: 2px solid #ca8a04 !important;
  border-radius: 10px !important;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.45) !important;
  max-height: 440px;
  overflow: hidden;
  z-index: 10005 !important;
  display: flex;
  flex-direction: column;
}

.packing-search-dropdown-header {
  padding: 8px 12px;
  background: linear-gradient(180deg, #fef9c3 0%, #fde047 100%) !important;
  border-bottom: 1.5px solid #ca8a04 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 800;
  color: #713f12 !important;
  flex-shrink: 0;
}

.packing-search-dropdown-items {
  max-height: 380px;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  list-style: none;
  background: #ffffff !important;
}

.packing-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #0f172a !important;
  background: #ffffff !important;
  transition: background 0.1s ease, color 0.1s ease;
  user-select: none;
}

.packing-dropdown-item:last-child {
  border-bottom: none;
}

.packing-dropdown-item:hover,
.packing-dropdown-item.active {
  background: #1d4ed8 !important;
  color: #ffffff !important;
}

.packing-dropdown-item .item-code {
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.packing-dropdown-item:hover .item-code,
.packing-dropdown-item.active .item-code {
  background: #1e3a8a !important;
  border-color: #3b82f6 !important;
  color: #fef08a !important;
}

.packing-dropdown-item .item-name {
  font-weight: 700;
  flex: 1;
  white-space: normal;
  line-height: 1.3;
  word-break: break-word;
  color: #0f172a;
}

.packing-dropdown-item:hover .item-name,
.packing-dropdown-item.active .item-name {
  color: #ffffff !important;
}

.packing-dropdown-item .item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 11px;
}

.packing-dropdown-item .item-meta .badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 4px;
  white-space: nowrap;
}

.packing-dropdown-item:hover .item-meta .badge,
.packing-dropdown-item.active .item-meta .badge {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

.packing-dropdown-item .item-stock {
  font-weight: 800;
  color: #0f172a;
  font-family: monospace;
  font-size: 11px;
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

.packing-dropdown-item:hover .item-stock,
.packing-dropdown-item.active .item-stock {
  color: #fef08a !important;
}

.packing-quick-select {
  height: 32px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  border: 1.5px solid #ca8a04 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  outline: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.packing-quick-select:focus {
  border-color: #eab308 !important;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.35) !important;
}

/* ==========================================================================
   MATERIAL BOM ACTIVE RECIPE SCROLLABLE TABLE STYLES (SIRF IS TABLE MA)
   ========================================================================== */
#material-bom-active-table-container {
  max-height: 480px;
  overflow-y: auto !important;
  overflow-x: auto !important;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #10b981 rgba(15, 23, 42, 0.6);
  background: var(--bg-card);
}

#material-bom-active-table-container::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

#material-bom-active-table-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 6px;
}

#material-bom-active-table-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-radius: 6px;
  border: 2px solid rgba(15, 23, 42, 0.7);
}

#material-bom-active-table-container::-webkit-scrollbar-thumb:hover {
  background: #34d399;
}

#material-bom-active-table thead tr {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

#material-bom-active-table tfoot tr {
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.25);
}

/* ==============================================================================
   UNIVERSAL DASHBOARD EXCEL EXPORT BUTTON STYLES (EMERALD GREEN THEME)
   ============================================================================== */
.btn-excel-export {
  background: #10b981 !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 5px rgba(16, 185, 129, 0.3) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  text-decoration: none !important;
}

.btn-excel-export:hover {
  background: #059669 !important;
  border-color: #047857 !important;
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.45) !important;
  transform: translateY(-1px) !important;
}

.btn-excel-export:active {
  transform: translateY(0px) !important;
}

/* ==========================================================================
   PRICES: CHEMICAL & PACKING MATERIAL MASTER TABLE (v5.0.7.2 - NO HORIZONTAL SCROLL)
   ========================================================================== */
.prices-master-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: auto !important;
  border-collapse: collapse;
  font-size: 11.5px;
  background: #ffffff !important;
  color: #0f172a !important;
}

.prices-golden-header {
  position: sticky;
  top: 0;
  z-index: 25;
}

.prices-golden-header th {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #facc15 0%, #eab308 100%) !important;
  color: #000000 !important;
  font-weight: 900 !important;
  font-size: 10.5px !important;
  letter-spacing: 0.03em !important;
  text-transform: uppercase !important;
  padding: 8px 4px !important;
  border-bottom: 2.5px solid #ca8a04 !important;
  border-right: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
  white-space: normal !important;
  line-height: 1.25 !important;
}

.prices-master-table tbody {
  background: #ffffff !important;
}

.prices-master-table tbody tr {
  background: #ffffff !important;
  color: #0f172a !important;
  transition: background 0.15s ease;
}

.prices-master-table tbody td {
  padding: 6px 4px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
  font-size: 11.5px !important;
  color: #0f172a !important;
}

.prices-master-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

.prices-master-table tbody tr:hover {
  background: #fef9c3 !important; /* Soft warm yellow hover row */
}

.prices-master-table .price-sno-cell {
  text-align: center;
  color: #64748b !important;
  font-weight: 800;
  font-size: 11px;
  padding: 6px 2px !important;
}

.prices-master-table .price-desc-cell {
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.3;
  padding: 6px 8px !important;
  word-break: break-word;
}

.prices-master-table .price-uom-chem {
  color: #047857 !important;
  font-weight: 900 !important;
  font-size: 11px;
}

.prices-master-table .price-uom-pkg {
  color: #1d4ed8 !important;
  font-weight: 900 !important;
  font-size: 11px;
}

.prices-master-table .price-supplier-cell {
  color: #64748b !important;
  font-size: 10.5px !important;
  text-align: center;
  padding: 6px 2px !important;
}

.price-code-badge {
  font-family: monospace;
  font-weight: 800;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #fcd34d !important;
  display: inline-block;
  white-space: nowrap;
}

.price-rate-chem {
  font-family: monospace;
  font-weight: 900;
  font-size: 12px;
  color: #047857 !important;
  background: #ecfdf5 !important;
  padding: 2.5px 6px;
  border-radius: 5px;
  border: 1.5px solid #10b981 !important;
  display: inline-block;
  white-space: nowrap;
}

.price-rate-pkg {
  font-family: monospace;
  font-weight: 900;
  font-size: 12px;
  color: #1d4ed8 !important;
  background: #eff6ff !important;
  padding: 2.5px 6px;
  border-radius: 5px;
  border: 1.5px solid #3b82f6 !important;
  display: inline-block;
  white-space: nowrap;
}

.price-section-badge {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 8px;
  text-transform: uppercase;
  display: inline-block;
  white-space: nowrap;
}

.price-section-badge.chem,
.price-section-badge.price-section-chem,
.price-section-chem {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}

.price-section-badge.pkg,
.price-section-badge.price-section-pkg,
.price-section-pkg {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #93c5fd !important;
}

.price-subcat-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  display: inline-block;
  white-space: nowrap;
}

#prices-table-container,
#plan-table-container {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#prices-table-footer {
  background: #f8fafc !important;
  border-top: 2px solid #ca8a04 !important;
  color: #0f172a !important;
}

#prices-table-footer td {
  border-top: 2px solid #ca8a04 !important;
  background: #f8fafc !important;
  padding: 8px 6px !important;
}

#prices-footer-count {
  color: #854d0e !important;
  font-weight: 800 !important;
}

#prices-footer-avg-rate {
  color: #047857 !important;
  font-weight: 900 !important;
  font-size: 13.5px !important;
  font-family: monospace !important;
}

#prices-table-container.compact {
  max-height: 520px;
}

#prices-table-container.medium {
  max-height: 720px;
}

#prices-table-container.large {
  max-height: 960px;
}

#prices-table-container.auto {
  max-height: none !important;
}

#prices-table-container.costing-fullscreen-mode {
  position: fixed !important;
  top: 15px !important;
  left: 15px !important;
  right: 15px !important;
  bottom: 15px !important;
  max-height: calc(100vh - 30px) !important;
  z-index: 99999 !important;
  background: var(--bg-primary) !important;
  border: 2px solid #eab308 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9) !important;
  border-radius: 12px !important;
  padding: 10px !important;
}

/* ==========================================================================
   SELECTED MATERIALS COSTING PLAN TABLE & CONTROLS (v5.0.7.2)
   ========================================================================== */
.btn-plan-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  border: 1px solid #047857;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
  white-space: nowrap;
}

.btn-plan-add:hover {
  background: #047857 !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.45);
}

.btn-plan-add.added {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
}

.btn-plan-add.added:hover {
  background: #0369a1 !important;
}

.btn-plan-remove {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.btn-plan-remove:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.plan-qty-input {
  width: 95px;
  padding: 4px 6px;
  font-family: monospace;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.plan-qty-input:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}

#prices-plan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: #ffffff !important;
  color: #0f172a !important;
}

#prices-plan-table tbody tr {
  background: #ffffff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
  transition: background 0.15s ease;
}

#prices-plan-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

#prices-plan-table tbody tr:hover {
  background: #ecfdf5 !important; /* Soft mint highlight on hover */
}

#prices-plan-table tbody td {
  padding: 8px 10px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
  font-size: 12px !important;
  color: #0f172a !important;
}

.plan-cost-cell {
  font-family: monospace;
  font-weight: 900;
  font-size: 13.5px;
  color: #047857 !important;
  background: #ecfdf5;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #a7f3d0;
  display: inline-block;
}

/* ============================================================
   UI/UX & VISUAL ENHANCEMENTS ("LOOK & FEEL") v5.1.0.0
   ============================================================ */

/* 1. Header Notification Center & Action Buttons */
.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.2px solid rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.header-icon-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.header-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 999px;
  min-width: 16px;
  line-height: 1;
  text-align: center;
  border: 1.5px solid #0f172a;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: pulseNotifBadge 2.2s infinite ease-in-out;
}

@keyframes pulseNotifBadge {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.95);
  }
}

/* 2. Modern Ergonomic Theme Switcher */
.header-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.2px solid rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.header-theme-toggle:hover {
  border-color: #facc15;
  color: #facc15;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(250, 204, 21, 0.25);
}

[data-theme="light"] .header-theme-toggle {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .header-theme-toggle:hover {
  border-color: #0284c7;
  color: #0284c7;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.2);
}

/* 3. Notification Center Modal Content */
.notif-filter-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notif-filter-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.notif-filter-pill.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.notif-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.notif-card-item:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .notif-card-item {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}

[data-theme="light"] .notif-card-item:hover {
  background: #f8fafc;
  border-color: #38bdf8;
}

/* 4. Table Row Micro-Interactions & Hover Elevation */
.inventory-table tbody tr {
  transition: all 0.16s ease-in-out;
}

.inventory-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.09) !important;
  box-shadow: inset 3.5px 0 0 #38bdf8;
}

[data-theme="light"] .inventory-table tbody tr:hover {
  background: rgba(2, 132, 199, 0.08) !important;
  box-shadow: inset 3.5px 0 0 #0284c7;
}

/* 5. Pulsing Status Dots */
.status-pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  animation: statusPulse 1.8s infinite ease-in-out;
}

@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.3);
  }
}

.status-pulse-dot.critical {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.status-pulse-dot.warning {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.status-pulse-dot.healthy {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

/* 6. High-End Glassmorphic Card Wrappers */
.glass-card-elevated {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  transition: all 0.25s ease;
}

.glass-card-elevated:hover {
  border-color: var(--border-focus);
  box-shadow: 0 14px 30px -5px rgba(0, 0, 0, 0.35), 0 0 18px var(--primary-glow);
}

/* 7. PDF Report Generator & Export Button Styling */
#btn-export-pdf-report {
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#btn-export-pdf-report:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.55) !important;
  border-color: #7dd3fc !important;
  filter: brightness(1.1);
}

#btn-export-pdf-report:active {
  transform: translateY(0);
}

#pdf-report-generator-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999999 !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

#pdf-report-generator-modal.active,
#pdf-report-generator-modal[style*="display: flex"] {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

#pdf-report-generator-modal select:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

/* ============================================================
   LABOUR DATE DETAIL SHEET MODAL STYLES
   ============================================================ */
.labour-modal-sec-btn {
  transition: all 0.15s ease !important;
}
.labour-modal-sec-btn:hover {
  filter: brightness(1.15);
}
.labour-modal-shift-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.labour-modal-shift-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.2) !important;
}
@media (max-width: 768px) {
  #labour-date-detail-modal .table-fullscreen-popup-dialog {
    width: 98vw !important;
    max-height: 96vh !important;
    padding: 10px 10px !important;
  }
  #labour-date-modal-body {
    padding: 10px 8px 30px 8px !important;
  }
}

/* ========================================================
   PACKAGING MATERIAL PICTURE PILL & LIGHTBOX MODAL
   ======================================================== */
.packing-photo-pill {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.packing-photo-pill:hover {
  transform: translateY(-1px) scale(1.05) !important;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.5) !important;
  filter: brightness(1.15) !important;
}
.packing-photo-pill:active {
  transform: translateY(0) scale(0.98) !important;
}

#packing-material-image-modal .table-fullscreen-popup-dialog {
  animation: packingModalZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes packingModalZoomIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 768px) {
  #packing-material-image-modal .table-fullscreen-popup-dialog {
    width: 96vw !important;
    max-height: 94vh !important;
  }
}

/* ========================================================================= */
/* PACKAGING TABLE COLUMN FILTER BUTTONS & POPOVER STYLES                    */
/* ========================================================================= */
.pack-th-filter-btn {
  background: rgba(0, 0, 0, 0.12) !important;
  border: 1px solid rgba(0, 0, 0, 0.25) !important;
  border-radius: 4px !important;
  padding: 2px 4px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #000000 !important;
  transition: all 0.15s ease !important;
}

.pack-th-filter-btn:hover {
  background: rgba(0, 0, 0, 0.28) !important;
  color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.4) !important;
}

.pack-th-filter-btn.active-filter {
  background: #059669 !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.7) !important;
}

.pack-popover-item {
  transition: background 0.12s ease !important;
}

.pack-popover-item:hover {
  background: #f1f5f9 !important;
}





/* ============================================================
   BILINGUAL INTERNATIONALIZATION (i18n) & ARABIC RTL STYLING
   ============================================================ */
html[dir="rtl"], body[dir="rtl"] {
  direction: rtl;
  text-align: right;
  font-family: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

html[dir="rtl"] .app-layout {
  flex-direction: row-reverse;
}

html[dir="rtl"] .app-sidebar {
  border-right: none;
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] html[dir="rtl"] .app-sidebar {
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.05);
}

html[dir="rtl"] .sidebar-subfolder-content {
  padding-left: 0;
  padding-right: 2px;
}

html[dir="rtl"] .sidebar-nav-item {
  text-align: right;
}

html[dir="rtl"] .nav-text-wrap {
  text-align: right;
}

html[dir="rtl"] .nav-badge-count,
html[dir="rtl"] .nav-badge-pill {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .top-bar-actions {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .search-box input {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] table th,
html[dir="rtl"] table td {
  text-align: right;
}

html[dir="rtl"] .text-right {
  text-align: left !important;
}

html[dir="rtl"] .text-left {
  text-align: right !important;
}

html[dir="rtl"] .text-center {
  text-align: center !important;
}

html[dir="rtl"] .kpi-round-card {
  text-align: center;
}

html[dir="rtl"] .live-update-timestamp-box,
html[dir="rtl"] .firebase-timestamp-box {
  text-align: right;
}

html[dir="rtl"] .modal-header,
html[dir="rtl"] .popup-header,
html[dir="rtl"] .alert-header-white {
  flex-direction: row-reverse;
}

/* Language Switcher Button Styling */
.lang-quick-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 9px;
  padding: 2px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  user-select: none;
  backdrop-filter: blur(8px);
}

.lang-btn {
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 7px;
  border: none;
  font-size: 11.5px;
  font-weight: 800;
  background: transparent;
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.lang-btn:hover {
  color: #ffffff;
}

.lang-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.45) !important;
}

[data-theme="light"] .lang-quick-toggle {
  background: rgba(241, 245, 249, 0.9);
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .lang-btn {
  color: #475569;
}

[data-theme="light"] .lang-btn:hover {
  color: #0f172a;
}

[data-theme="light"] .lang-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
}

/* ======================================================== */
/* HIDE ROUND KPI CIRCLES FOR SAUDI OPERATIONS             */
/* ======================================================== */
body.facility-saudi .kpi-round-row,
body.facility-saudi #chemical-kpi-round-row,
.is-saudi-context .kpi-round-row {
  display: none !important;
}

/* ============================================================
   TAB CONNECTED EXCEL SOURCE BANNER (Universal Metadata Header)
   ============================================================ */
.tab-excel-source-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-left: 3.5px solid #10b981;
  border-radius: 8px;
  padding: 3px 10px !important;
  margin: 0 0 5px 0 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  z-index: 10;
}

[data-theme="light"] .tab-excel-source-banner {
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  border: 1px solid #cbd5e1;
  border-left: 3.5px solid #059669;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tab-excel-source-banner.is-saudi {
  border-left-color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
}

.tab-excel-source-banner.is-bahrain {
  border-left-color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}

.excel-banner-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.excel-banner-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.excel-banner-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 5px;
  font-size: 11px;
  color: #34d399;
  flex-shrink: 0;
}

.excel-banner-title-text {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .excel-banner-title-text {
  color: #0284c7;
}

.excel-banner-desc-text {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.85;
}

.excel-banner-facility-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.excel-banner-facility-badge.badge-saudi {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid #10b981;
  color: #34d399;
}

.excel-banner-facility-badge.badge-bahrain {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
  color: #fbbf24;
}

.excel-banner-facility-badge .fac-tag {
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 800;
  font-size: 8.5px;
}

.excel-banner-pills-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.excel-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .excel-source-pill {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

.excel-source-pill-label {
  font-size: 8.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: #94a3b8;
}

.excel-source-pill.pill-workbook {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(14, 116, 144, 0.2);
}

.excel-source-pill.pill-workbook .excel-source-pill-value {
  color: #38bdf8;
  font-weight: 700;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 10px;
}

.excel-source-pill.pill-sheet {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(180, 83, 9, 0.2);
}

.excel-source-pill.pill-sheet .excel-source-pill-value {
  color: #fbbf24;
  font-weight: 700;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 10px;
}

.excel-source-pill.pill-folder {
  border-color: rgba(148, 163, 184, 0.3);
  font-size: 9.5px;
}

.excel-source-pill.pill-folder .excel-source-pill-value {
  color: #cbd5e1;
}

.excel-source-copy-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: all 0.2s ease;
}

.excel-source-copy-btn:hover {
  background: #38bdf8;
  color: #0f172a;
}

.excel-banner-bottom-note {
  display: none !important;
}

.excel-banner-live-sync {
  font-size: 9.5px;
  font-weight: 600;
  color: #34d399;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}



/* ======================================================== */
/* PREVENT CHROME / EDGE BROWSER AUTOFILL ON LOGIN GATE     */
/* ======================================================== */
#gate-username-input:-webkit-autofill,
#gate-username-input:-webkit-autofill:hover, 
#gate-username-input:-webkit-autofill:focus, 
#gate-pin-input:-webkit-autofill,
#gate-pin-input:-webkit-autofill:hover,
#gate-pin-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #f8fafc inset !important;
  -webkit-text-fill-color: #0f172a !important;
  transition: background-color 5000s ease-in-out 0s;
}


/* ==========================================================================
   SAUDI OPERATIONS: MASTER PACKAGING INVENTORY TABLE 100% SCREEN FIT
   Eliminate left/right horizontal scroll; fit 100% across screen width;
   Hide empty Store (N/A) column; unfreeze sticky horizontal columns;
   Hide horizontal scroll buttons and display 100% Fit badge.
   ========================================================================== */

@media (min-width: 769px) {
  #packing-inventory-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    scrollbar-width: thin !important;
  }

  #packing-inventory-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 10.5px !important;
  }

  #packing-inventory-table thead th {
    font-size: 9px !important;
    padding: 5px 2px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  #packing-inventory-table tbody td {
    padding: 5px 2.5px !important;
    font-size: 10px !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  /* Unfreeze sticky horizontal columns on desktop so columns flow naturally without overlap */
  #packing-inventory-table thead th:nth-child(1),
  #packing-inventory-table thead th:nth-child(2),
  #packing-inventory-table thead th:nth-child(3) {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    z-index: 25 !important;
    box-shadow: none !important;
    border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  #packing-inventory-table tbody td:nth-child(1),
  #packing-inventory-table tbody td:nth-child(2),
  #packing-inventory-table tbody td:nth-child(3) {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  #packing-inventory-table tfoot td:first-child {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    border-right: 1px solid #cbd5e1 !important;
  }

  /* Bahrain (13 Proportional Columns = 100.0%) */
  #packing-inventory-table thead th:nth-child(1),
  #packing-inventory-table tbody td:nth-child(1) {
    width: 3.5% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: center !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(2),
  #packing-inventory-table tbody td:nth-child(2) {
    width: 7% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: center !important;
    padding: 5px 2px !important;
    word-break: break-all !important;
  }

  #packing-inventory-table thead th:nth-child(3),
  #packing-inventory-table tbody td:nth-child(3) {
    width: 18.8% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word !important;
    padding: 5px 5px !important;
  }

  #packing-inventory-table thead th:nth-child(4),
  #packing-inventory-table tbody td:nth-child(4) {
    width: 7% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    font-size: 9.5px !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(5),
  #packing-inventory-table tbody td:nth-child(5) {
    width: 6.8% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(6),
  #packing-inventory-table tbody td:nth-child(6) {
    width: 6.2% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(7),
  #packing-inventory-table tbody td:nth-child(7) {
    width: 7% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(8),
  #packing-inventory-table tbody td:nth-child(8) {
    width: 5.5% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(9),
  #packing-inventory-table tbody td:nth-child(9) {
    width: 9.5% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: center !important;
    padding: 3px 1px !important;
  }

  #packing-inventory-table thead th:nth-child(10),
  #packing-inventory-table tbody td:nth-child(10) {
    width: 7.3% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 4px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(11),
  #packing-inventory-table tbody td:nth-child(11) {
    width: 5.2% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 5px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(12),
  #packing-inventory-table tbody td:nth-child(12) {
    width: 9% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: right !important;
    padding: 4px 2px !important;
  }

  #packing-inventory-table thead th:nth-child(13),
  #packing-inventory-table tbody td:nth-child(13) {
    width: 7.2% !important;
    min-width: 0 !important;
    max-width: none !important;
    text-align: center !important;
    padding: 4px 2px !important;
  }

  #packing-inventory-table tbody td:nth-child(13) .badge {
    font-size: 8.5px !important;
    padding: 1.5px 4px !important;
    letter-spacing: 0 !important;
  }

  /* Compact header filter buttons and rate badge so nothing clips */
  #packing-inventory-table thead th .pack-th-filter-btn {
    padding: 1.5px 2.5px !important;
    flex-shrink: 0;
  }

  #packing-inventory-table .packing-unit-rate-badge {
    padding: 1.5px 3px !important;
    font-size: 9.5px !important;
  }

  /* Hide Store (N/A) Column in Saudi Operations and rebalance 12 cols = 100.0% */
  body.facility-saudi #th-pack-store,
  body.facility-saudi #packing-inventory-table thead th:nth-child(5),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(5),
  body.facility-saudi #packing-inventory-table tbody td.col-pack-store,
  body.facility-saudi #packing-inventory-table tfoot td.col-pack-store {
    display: none !important;
  }

  body.facility-saudi #packing-inventory-table thead th:nth-child(3),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(3) {
    width: 21.3% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(4),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(4) {
    width: 7.5% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(6),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(6) {
    width: 6.5% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(7),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(7) {
    width: 7.5% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(8),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(8) {
    width: 6% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(9),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(9) {
    width: 10.5% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(10),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(10) {
    width: 8% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(11),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(11) {
    width: 5.5% !important;
  }
  body.facility-saudi #packing-inventory-table thead th:nth-child(12),
  body.facility-saudi #packing-inventory-table tbody td:nth-child(12) {
    width: 9.5% !important;
  }
}

/* Hide Quick Horizontal Scroll buttons in Packing Inventory (Bahrain & Saudi) and show 100% Fit badge */
#packing-quick-scroll-btns,
body.facility-saudi #packing-consump-quick-scroll-btns,
body.facility-saudi #prod-quick-scroll-btns {
  display: none !important;
}

.consumption-year-tabs {
  display: inline-flex;
  align-items: center;
  border-color: rgba(2, 132, 199, 0.35) !important;
  background: rgba(2, 132, 199, 0.10) !important;
}

.consumption-year-tabs .year-tabs-label {
  font-size: 9.5px;
  font-weight: 900;
  color: #0369a1;
  padding: 0 5px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table-toolbar-yellow .consumption-year-tabs .tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.4) !important;
}

body.facility-saudi #consumption-year-tabs,
body.facility-saudi #packing-consumption-year-tabs {
  display: none !important;
}

#packing-saudi-fit-badge,
#chem-consump-saudi-fit-badge,
#packing-consump-saudi-fit-badge,
#prod-saudi-fit-badge {
  display: inline-flex !important;
  align-items: center;
}

/* Hide Quick Horizontal Scroll buttons in Packing & Q-Wise Tables (Bahrain & Saudi) */
#packing-quick-scroll-btns,
#packing-consump-quick-scroll-btns,
#prod-quick-scroll-btns {
  display: none !important;
}

/* ==========================================================================
   BAHRAIN & SAUDI OPERATIONS: 100% SCREEN FIT FOR CONSUMPTION & Q-WISE TABLES
   1. Chemical Monthly Consumption History (#consumption-table)
   2. Packing Material Consumption History (#packing-consumption-table)
   3. Q-Wise Production Output Table (#prod-table)
   ========================================================================== */

@media (min-width: 769px) {
  /* 1A. BAHRAIN CHEMICAL MONTHLY CONSUMPTION HISTORY (#consumption-table - 24 cols) */
  body:not(.facility-saudi) #consumption-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body:not(.facility-saudi) #consumption-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  body:not(.facility-saudi) #consumption-table th {
    white-space: normal !important;
    word-break: break-word !important;
    font-size: 7.5px !important;
    padding: 5px 1px !important;
    line-height: 1.12 !important;
    letter-spacing: 0 !important;
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    z-index: 15 !important;
  }

  body:not(.facility-saudi) #consumption-table td {
    padding: 3.5px 1px !important;
    font-size: 7.5px !important;
    line-height: 1.15 !important;
    font-variant-numeric: tabular-nums !important;
    position: static !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
  }

  body:not(.facility-saudi) #consumption-table thead th:nth-child(1),
  body:not(.facility-saudi) #consumption-table tbody td:nth-child(1) {
    width: 3.5% !important;
    text-align: center !important;
  }

  body:not(.facility-saudi) #consumption-table thead th:nth-child(2),
  body:not(.facility-saudi) #consumption-table tbody td:nth-child(2) {
    width: 10.0% !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    text-align: left !important;
    padding: 3.5px 3px !important;
  }

  body:not(.facility-saudi) #consumption-table thead th:nth-child(3),
  body:not(.facility-saudi) #consumption-table tbody td:nth-child(3) {
    width: 4.8% !important;
    text-align: center !important;
    white-space: normal !important;
  }

  body:not(.facility-saudi) #consumption-table tbody td:nth-child(3) span {
    font-size: 7.2px !important;
    padding: 1px 3px !important;
    white-space: normal !important;
    display: inline-block !important;
    line-height: 1.1 !important;
  }

  /* 16 Monthly Columns (All Years: cols 4..19, summary cols 20..24) */
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] thead th:nth-child(n+4):nth-child(-n+19),
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] tbody td:nth-child(n+4):nth-child(-n+19) {
    width: 3.85% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] thead th:nth-child(20),
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] tbody td:nth-child(20) {
    width: 5.1% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] thead th:nth-child(21),
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] tbody td:nth-child(21) {
    width: 4.3% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] thead th:nth-child(22),
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] tbody td:nth-child(22) {
    width: 4.1% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] thead th:nth-child(23),
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] tbody td:nth-child(23) {
    width: 3.6% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] thead th:nth-child(24),
  body:not(.facility-saudi) #consumption-table[data-year-mode="ALL"] tbody td:nth-child(24) {
    width: 3.0% !important;
    text-align: center !important;
  }

  /* Year 2026 View (11 Months: cols 4..14, summary cols 15..19 = 19 cols total) */
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] th {
    font-size: 8.3px !important;
    padding: 5px 1.5px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] td {
    font-size: 8.4px !important;
    padding: 4px 1.5px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(1),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(1) {
    width: 4.0% !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(2),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(2) {
    width: 12.1% !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(3),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(3) {
    width: 5.8% !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(3) span {
    font-size: 7.8px !important;
    padding: 1.5px 3.5px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(n+4):nth-child(-n+14),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(n+4):nth-child(-n+14) {
    width: 4.7% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(15),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(15) {
    width: 6.4% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(16),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(16) {
    width: 5.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(17),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(17) {
    width: 5.3% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(18),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(18) {
    width: 4.8% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] thead th:nth-child(19),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] tbody td:nth-child(19) {
    width: 4.4% !important;
    text-align: center !important;
  }

  /* Year 2025 View (5 Months: cols 4..8, summary cols 9..13 = 13 cols total) */
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] th {
    font-size: 9.5px !important;
    padding: 6px 4px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] td {
    font-size: 10px !important;
    padding: 4.5px 4px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(1),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(1) {
    width: 5.5% !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(2),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(2) {
    width: 21.0% !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(3),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(3) {
    width: 8.0% !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(3) span {
    font-size: 9.5px !important;
    padding: 2px 6px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(n+4):nth-child(-n+8),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(n+4):nth-child(-n+8) {
    width: 6.8% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(9),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(9) {
    width: 8.0% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(10),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(10) {
    width: 6.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(11),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(11) {
    width: 6.0% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(12),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(12) {
    width: 5.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] thead th:nth-child(13),
  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] tbody td:nth-child(13) {
    width: 5.5% !important;
    text-align: center !important;
  }

  body:not(.facility-saudi) #consumption-table .btn-icon {
    font-size: 7.5px !important;
    padding: 2px 3px !important;
    line-height: 1 !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2026"] .btn-icon {
    font-size: 8px !important;
    padding: 2px 4px !important;
  }

  body:not(.facility-saudi) #consumption-table[data-year-mode="2025"] .btn-icon {
    font-size: 9px !important;
    padding: 2px 5px !important;
  }

  body:not(.facility-saudi) #consumption-table tbody td.sticky-col-1,
  body:not(.facility-saudi) #consumption-table tbody td.sticky-col-2,
  body:not(.facility-saudi) #consumption-table tbody td.sticky-col-3 {
    background: transparent !important;
    box-shadow: none !important;
  }

  body:not(.facility-saudi) #consumption-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.45) !important;
  }

  body:not(.facility-saudi) #consumption-table tbody tr:hover td.sticky-col-1,
  body:not(.facility-saudi) #consumption-table tbody tr:hover td.sticky-col-2,
  body:not(.facility-saudi) #consumption-table tbody tr:hover td.sticky-col-3 {
    background: transparent !important;
  }

  [data-theme="light"] body:not(.facility-saudi) #consumption-table tbody td.sticky-col-1,
  [data-theme="light"] body:not(.facility-saudi) #consumption-table tbody td.sticky-col-2,
  [data-theme="light"] body:not(.facility-saudi) #consumption-table tbody td.sticky-col-3 {
    background: transparent !important;
  }

  [data-theme="light"] body:not(.facility-saudi) #consumption-table tbody tr:hover {
    background: #f8fafc !important;
  }

  /* 1B. SAUDI CHEMICAL MONTHLY CONSUMPTION HISTORY (#consumption-table) */
  body.facility-saudi #consumption-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.facility-saudi #consumption-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  body.facility-saudi #consumption-table th {
    white-space: normal !important;
    word-break: break-word !important;
    font-size: 9.5px !important;
    padding: 6px 3px !important;
    line-height: 1.15 !important;
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    z-index: 15 !important;
  }

  body.facility-saudi #consumption-table td {
    padding: 4px 4px !important;
    font-size: 10.5px !important;
    position: static !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
  }

  body.facility-saudi #consumption-table th.sticky-col-1,
  body.facility-saudi #consumption-table tbody td.sticky-col-1 {
    width: 7.5% !important;
  }

  body.facility-saudi #consumption-table th.sticky-col-2,
  body.facility-saudi #consumption-table tbody td.sticky-col-2 {
    width: auto !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.2 !important;
  }

  body.facility-saudi #consumption-table th.sticky-col-3,
  body.facility-saudi #consumption-table tbody td.sticky-col-3 {
    width: 9.5% !important;
    text-align: center !important;
  }

  body.facility-saudi #consumption-table tbody td.sticky-col-3 span {
    font-size: 9.5px !important;
    padding: 2px 5px !important;
    white-space: normal !important;
    display: inline-block !important;
    line-height: 1.15 !important;
  }

  body.facility-saudi #consumption-table .btn-icon {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }

  body.facility-saudi #consumption-table tbody td.sticky-col-1,
  body.facility-saudi #consumption-table tbody td.sticky-col-2,
  body.facility-saudi #consumption-table tbody td.sticky-col-3 {
    background: transparent !important;
    box-shadow: none !important;
  }

  body.facility-saudi #consumption-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.45) !important;
  }

  body.facility-saudi #consumption-table tbody tr:hover td.sticky-col-1,
  body.facility-saudi #consumption-table tbody tr:hover td.sticky-col-2,
  body.facility-saudi #consumption-table tbody tr:hover td.sticky-col-3 {
    background: transparent !important;
  }

  [data-theme="light"] body.facility-saudi #consumption-table tbody td.sticky-col-1,
  [data-theme="light"] body.facility-saudi #consumption-table tbody td.sticky-col-2,
  [data-theme="light"] body.facility-saudi #consumption-table tbody td.sticky-col-3 {
    background: transparent !important;
  }

  [data-theme="light"] body.facility-saudi #consumption-table tbody tr:hover {
    background: #f8fafc !important;
  }

  /* 2A. BAHRAIN PACKAGING MATERIAL CONSUMPTION ANALYTICS (#packing-consumption-table) */
  body:not(.facility-saudi) #packing-consumption-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body:not(.facility-saudi) #packing-consumption-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  body:not(.facility-saudi) #packing-consumption-table thead th {
    font-size: 8px !important;
    padding: 5px 1.5px !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    word-break: break-word !important;
    letter-spacing: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    left: auto !important;
    box-shadow: none !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 25 !important;
    border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  body:not(.facility-saudi) #packing-consumption-table tbody td,
  body:not(.facility-saudi) #packing-consumption-table tfoot td,
  body:not(.facility-saudi) #packing-consumption-table tfoot td:first-child {
    padding: 4px 1.5px !important;
    font-size: 8.5px !important;
    line-height: 1.15 !important;
    font-variant-numeric: tabular-nums !important;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body:not(.facility-saudi) #packing-consumption-table thead th:nth-child(1),
  body:not(.facility-saudi) #packing-consumption-table tbody td:nth-child(1) {
    text-align: center !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body:not(.facility-saudi) #packing-consumption-table thead th:nth-child(2),
  body:not(.facility-saudi) #packing-consumption-table tbody td:nth-child(2) {
    text-align: center !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body:not(.facility-saudi) #packing-consumption-table thead th:nth-child(3),
  body:not(.facility-saudi) #packing-consumption-table tbody td:nth-child(3) {
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.18 !important;
    padding: 4px 3px !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body:not(.facility-saudi) #packing-consumption-table thead th:nth-child(4),
  body:not(.facility-saudi) #packing-consumption-table tbody td:nth-child(4) {
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.12 !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  /* ALL Years (13 Months: Nov25..Nov26 = 19 columns) */
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(1),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(1) {
    width: 3.0% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(2),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(2) {
    width: 5.2% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(3),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(3) {
    width: 14.5% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(4),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(4) {
    width: 6.4% !important;
    font-size: 8px !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(n+5):nth-child(-n+17),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(n+5):nth-child(-n+17) {
    width: 4.5% !important;
    text-align: right !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(18),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(18) {
    width: 6.7% !important;
    text-align: right !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] thead th:nth-child(19),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="ALL"] tbody td:nth-child(19) {
    width: 5.7% !important;
    text-align: right !important;
  }

  /* Year 2026 View (11 Months: Jan26..Nov26 = 17 columns) */
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th {
    font-size: 8.5px !important;
    padding: 5px 2px !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td,
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tfoot td {
    font-size: 9px !important;
    padding: 4.5px 2px !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(1),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(1) {
    width: 3.2% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(2),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(2) {
    width: 5.5% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(3),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(3) {
    width: 18.0% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(4),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(4) {
    width: 7.0% !important;
    font-size: 8.5px !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(n+5):nth-child(-n+15),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(n+5):nth-child(-n+15) {
    width: 4.8% !important;
    text-align: right !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(16),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(16) {
    width: 7.2% !important;
    text-align: right !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] thead th:nth-child(17),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2026"] tbody td:nth-child(17) {
    width: 6.3% !important;
    text-align: right !important;
  }

  /* Year 2025 View (2 Months: Nov25, Dec25 = 8 columns) */
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th {
    font-size: 10px !important;
    padding: 6px 5px !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td,
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tfoot td {
    font-size: 10.5px !important;
    padding: 5px 5px !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(1),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(1) {
    width: 5.0% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(2),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(2) {
    width: 9.0% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(3),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(3) {
    width: 36.0% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(4),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(4) {
    width: 12.0% !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(n+5):nth-child(-n+6),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(n+5):nth-child(-n+6) {
    width: 9.5% !important;
    text-align: right !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(7),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(7) {
    width: 10.0% !important;
    text-align: right !important;
  }
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] thead th:nth-child(8),
  body:not(.facility-saudi) #packing-consumption-table[data-year-mode="2025"] tbody td:nth-child(8) {
    width: 9.0% !important;
    text-align: right !important;
  }

  /* 2B. SAUDI PACKAGING MATERIAL CONSUMPTION ANALYTICS (#packing-consumption-table) */
  body.facility-saudi #packing-consumption-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.facility-saudi #packing-consumption-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    font-size: 10.5px !important;
  }

  body.facility-saudi #packing-consumption-table thead th {
    font-size: 9.5px !important;
    padding: 5px 3px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 0 !important;
    max-width: none !important;
    left: auto !important;
    box-shadow: none !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 25 !important;
    border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  }

  body.facility-saudi #packing-consumption-table tbody td,
  body.facility-saudi #packing-consumption-table tfoot td,
  body.facility-saudi #packing-consumption-table tfoot td:first-child {
    padding: 5px 4px !important;
    font-size: 10px !important;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body.facility-saudi #packing-consumption-table thead th:nth-child(1),
  body.facility-saudi #packing-consumption-table tbody td:nth-child(1) {
    width: 4.5% !important;
    text-align: center !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body.facility-saudi #packing-consumption-table thead th:nth-child(2),
  body.facility-saudi #packing-consumption-table tbody td:nth-child(2) {
    width: 8.5% !important;
    text-align: center !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body.facility-saudi #packing-consumption-table thead th:nth-child(3),
  body.facility-saudi #packing-consumption-table tbody td:nth-child(3) {
    width: auto !important;
    text-align: left !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.25 !important;
    padding: 5px 7px !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body.facility-saudi #packing-consumption-table thead th:nth-child(4),
  body.facility-saudi #packing-consumption-table tbody td:nth-child(4) {
    width: 11% !important;
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.15 !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  /* 3A. BAHRAIN PRODUCTION Q-WISE MASTER OUTPUT TABLE (#prod-table) */
  body:not(.facility-saudi) #prod-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body:not(.facility-saudi) #prod-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  body:not(.facility-saudi) #prod-table th {
    padding: 5px 2px !important;
    font-size: 9.5px !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    word-break: break-word !important;
    letter-spacing: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    box-shadow: none !important;
    z-index: 10 !important;
  }

  body:not(.facility-saudi) #prod-table td {
    padding: 4px 3px !important;
    font-size: 10px !important;
    font-variant-numeric: tabular-nums !important;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body:not(.facility-saudi) #prod-table th.prod-sticky-desc,
  body:not(.facility-saudi) #prod-table tbody td.prod-sticky-desc {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.18 !important;
    text-align: left !important;
  }

  body:not(.facility-saudi) #prod-table th.prod-sticky-cat,
  body:not(.facility-saudi) #prod-table tbody td.prod-sticky-cat {
    text-align: center !important;
    border-right: 1px solid #e2e8f0 !important;
    white-space: normal !important;
  }

  body:not(.facility-saudi) #prod-table th.prod-sticky-code,
  body:not(.facility-saudi) #prod-table th.prod-sticky-desc,
  body:not(.facility-saudi) #prod-table th.prod-sticky-cat {
    border-right: 1px solid #eab308 !important;
  }

  body:not(.facility-saudi) #prod-table tfoot td.prod-sticky-foot-label {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body:not(.facility-saudi) #prod-table tfoot td {
    padding: 5px 3px !important;
    font-size: 10.5px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="0"] tbody td span {
    font-size: 9.5px !important;
    padding: 1.5px 5px !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="0"] .prod-sticky-cat span {
    font-size: 8.5px !important;
    padding: 1.5px 4px !important;
    white-space: normal !important;
    display: inline-block !important;
    line-height: 1.1 !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="1"] th {
    padding: 4.5px 1px !important;
    font-size: 7.5px !important;
    line-height: 1.1 !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="1"] tbody td {
    padding: 3.5px 1.5px !important;
    font-size: 7.8px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="1"] tbody td:nth-child(n+4) {
    white-space: normal !important;
    line-height: 1.1 !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="1"] tbody td span {
    font-size: 7.5px !important;
    padding: 1px 3px !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    display: inline-block !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="1"] .prod-sticky-cat span {
    font-size: 7px !important;
    padding: 1px 2px !important;
  }

  body:not(.facility-saudi) #prod-table[data-period-dense="1"] tfoot td {
    padding: 4.5px 1.5px !important;
    font-size: 8.5px !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  /* 3B. SAUDI PRODUCTION Q-WISE MASTER OUTPUT TABLE (#prod-table) */
  body.facility-saudi #prod-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.facility-saudi #prod-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  body.facility-saudi #prod-table th {
    padding: 5px 3px !important;
    font-size: 9.5px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 0 !important;
    max-width: none !important;
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    box-shadow: none !important;
    z-index: 10 !important;
  }

  body.facility-saudi #prod-table td {
    padding: 4px 4px !important;
    font-size: 10.5px !important;
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body.facility-saudi #prod-table th.prod-sticky-code,
  body.facility-saudi #prod-table tbody td.prod-sticky-code {
    width: 7.5% !important;
  }

  body.facility-saudi #prod-table th.prod-sticky-desc,
  body.facility-saudi #prod-table tbody td.prod-sticky-desc {
    width: auto !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.2 !important;
  }

  body.facility-saudi #prod-table th.prod-sticky-cat,
  body.facility-saudi #prod-table tbody td.prod-sticky-cat {
    width: 9.5% !important;
    text-align: center !important;
    border-right: 1px solid #e2e8f0 !important;
  }

  body.facility-saudi #prod-table th.prod-sticky-code,
  body.facility-saudi #prod-table th.prod-sticky-desc,
  body.facility-saudi #prod-table th.prod-sticky-cat {
    border-right: 1px solid #eab308 !important;
  }

  body.facility-saudi #prod-table tbody td span {
    font-size: 10px !important;
    padding: 1.5px 5px !important;
  }

  body.facility-saudi #prod-table .prod-sticky-cat span {
    font-size: 8.5px !important;
    padding: 1.5px 4px !important;
    white-space: normal !important;
    display: inline-block;
    line-height: 1.1;
  }

  body.facility-saudi #prod-table tbody td:nth-child(3),
  body.facility-saudi #prod-table tbody td:last-child {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.2 !important;
  }

  body.facility-saudi #prod-table tfoot td.prod-sticky-foot-label {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }

  body.facility-saudi #prod-table tfoot td {
    padding: 6px 4px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  /* 4. SAUDI LABOUR COSTING HEADER WRAPPING (Avoid ellipsis on 'Saudi Riyal' labels) */
  body.facility-saudi #labour-monthly-summary-table thead th,
  body.facility-saudi .labour-master-table thead th {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.2 !important;
    padding: 7px 4px !important;
    font-size: 10.5px !important;
  }
}

#inventory-bahrain-fit-badge {
  display: inline-flex !important;
  align-items: center;
}

/* ==========================================================================
   BAHRAIN & SAUDI CHEMICAL STOCK & ALERTS: 100% SCREEN FIT
   - Bahrain: Up to Daily Consump (KG) (cols 1..10)
   - Saudi:   Up to Monthly Max Consumption (KG) (cols 1..11)
   ========================================================================== */
@media (min-width: 769px) {
  #inventory-table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  #inventory-table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  /* Bahrain shows columns 1..10 (up to Daily Consump); Saudi shows 1..11 (up to Monthly Max Consumption) */
  body:not(.facility-saudi) #inventory-table thead th:nth-child(n+11),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(n+11) {
    display: none !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(n+12),
  body.facility-saudi #inventory-table tbody td:nth-child(n+12) {
    display: none !important;
  }

  #inventory-table thead th {
    white-space: normal !important;
    word-break: break-word !important;
    font-size: 9px !important;
    padding: 6px 3px !important;
    line-height: 1.15 !important;
    letter-spacing: 0.01em !important;
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    z-index: 15 !important;
  }

  #inventory-table tbody td {
    padding: 5px 3px !important;
    font-size: 10px !important;
    position: static !important;
    left: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    font-variant-numeric: tabular-nums !important;
  }

  #inventory-table tbody td.inv-sticky-code,
  #inventory-table tbody td.inv-sticky-desc,
  #inventory-table tbody td.inv-sticky-cat,
  #inventory-table tbody tr:hover td.inv-sticky-code,
  #inventory-table tbody tr:hover td.inv-sticky-desc,
  #inventory-table tbody tr:hover td.inv-sticky-cat,
  #inventory-table tbody tr.row-critical td.inv-sticky-code,
  #inventory-table tbody tr.row-critical td.inv-sticky-desc,
  #inventory-table tbody tr.row-critical td.inv-sticky-cat,
  [data-theme="light"] #inventory-table tbody td.inv-sticky-code,
  [data-theme="light"] #inventory-table tbody td.inv-sticky-desc,
  [data-theme="light"] #inventory-table tbody td.inv-sticky-cat,
  [data-theme="light"] #inventory-table tbody tr:hover td.inv-sticky-code,
  [data-theme="light"] #inventory-table tbody tr:hover td.inv-sticky-desc,
  [data-theme="light"] #inventory-table tbody tr:hover td.inv-sticky-cat,
  [data-theme="light"] #inventory-table tbody tr.row-critical td.inv-sticky-code,
  [data-theme="light"] #inventory-table tbody tr.row-critical td.inv-sticky-desc,
  [data-theme="light"] #inventory-table tbody tr.row-critical td.inv-sticky-cat,
  [data-theme="light"] #inventory-table tbody tr.row-critical:hover td.inv-sticky-code,
  [data-theme="light"] #inventory-table tbody tr.row-critical:hover td.inv-sticky-desc,
  [data-theme="light"] #inventory-table tbody tr.row-critical:hover td.inv-sticky-cat {
    background: transparent !important;
  }

  #inventory-table .depletion-forecast-box {
    max-width: 100% !important;
  }

  #inventory-table .depletion-chip,
  #inventory-table .depletion-order-deadline {
    white-space: normal !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }

  /* BAHRAIN 10-column widths summing to 100% */
  body:not(.facility-saudi) #inventory-table thead th:nth-child(1),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(1) {
    width: 5.5% !important;
    text-align: center !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(2),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(2) {
    width: 23.5% !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.22 !important;
    text-align: left !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(3),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(3) {
    width: 8.5% !important;
    text-align: center !important;
    white-space: normal !important;
  }

  body:not(.facility-saudi) #inventory-table tbody td:nth-child(3) span {
    font-size: 9.5px !important;
    padding: 2px 5px !important;
    white-space: normal !important;
    display: inline-block !important;
    line-height: 1.15 !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(4),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(4) {
    width: 8.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(5),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(5) {
    width: 8.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(6),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(6) {
    width: 8.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(7),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(7) {
    width: 8.5% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(8),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(8) {
    width: 12.5% !important;
    text-align: center !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(9),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(9) {
    width: 8.0% !important;
    text-align: right !important;
  }

  body:not(.facility-saudi) #inventory-table thead th:nth-child(10),
  body:not(.facility-saudi) #inventory-table tbody td:nth-child(10) {
    width: 8.0% !important;
    text-align: right !important;
  }

  /* SAUDI 11-column widths summing to 100% (up to Monthly Max Consumption) */
  body.facility-saudi #inventory-table thead th:nth-child(1),
  body.facility-saudi #inventory-table tbody td:nth-child(1) {
    width: 6.5% !important;
    text-align: center !important;
    font-size: 9.5px !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(2),
  body.facility-saudi #inventory-table tbody td:nth-child(2) {
    width: 20.0% !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.22 !important;
    text-align: left !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(3),
  body.facility-saudi #inventory-table tbody td:nth-child(3) {
    width: 8.3% !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  body.facility-saudi #inventory-table tbody td:nth-child(3) span {
    font-size: 9px !important;
    padding: 2px 4px !important;
    white-space: normal !important;
    display: inline-block !important;
    line-height: 1.15 !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(4),
  body.facility-saudi #inventory-table tbody td:nth-child(4) {
    width: 8.0% !important;
    text-align: right !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(5),
  body.facility-saudi #inventory-table tbody td:nth-child(5) {
    width: 8.0% !important;
    text-align: right !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(6),
  body.facility-saudi #inventory-table tbody td:nth-child(6) {
    width: 8.0% !important;
    text-align: right !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(7),
  body.facility-saudi #inventory-table tbody td:nth-child(7) {
    width: 7.5% !important;
    text-align: right !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(8),
  body.facility-saudi #inventory-table tbody td:nth-child(8) {
    width: 11.7% !important;
    text-align: center !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(9),
  body.facility-saudi #inventory-table tbody td:nth-child(9) {
    width: 7.0% !important;
    text-align: right !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(10),
  body.facility-saudi #inventory-table tbody td:nth-child(10) {
    width: 7.0% !important;
    text-align: right !important;
  }

  body.facility-saudi #inventory-table thead th:nth-child(11),
  body.facility-saudi #inventory-table tbody td:nth-child(11) {
    width: 8.0% !important;
    text-align: right !important;
  }
}

/* ==========================================================================
   MASTER CHEMICAL INVENTORY TABLE (#inventory-table) - LUXURY WHITE THEME
   Applies to Saudi & Bahrain Operations Chemical Stock & Alert Tables:
   Crisp White Body, Alternate Slate-50 Zebra Rows, High-Contrast Dark Typography,
   Soft Pastel Red Critical Alerts, and Light-Themed Forecast Chips
   ========================================================================== */
#inventory-table-container {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08) !important;
}

#inventory-table {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* Master Chemical Inventory Table Rows */
#inventory-table tbody tr {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  transition: background-color 0.15s ease !important;
}

#inventory-table tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

#inventory-table tbody tr:hover,
#inventory-table tbody tr:hover td {
  background: #f1f5f9 !important;
}

/* Master Chemical Inventory Table Cells */
#inventory-table tbody td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
  vertical-align: middle !important;
}

/* Critical Rows in Master Chemical Inventory (Clean Pastel Rose / Soft Crimson) */
#inventory-table tbody tr.row-critical {
  background: #fff5f5 !important;
  border-left: 3.5px solid #ef4444 !important;
}

#inventory-table tbody tr.row-critical:nth-child(even) {
  background: #fef2f2 !important;
}

#inventory-table tbody tr.row-critical:hover,
#inventory-table tbody tr.row-critical:hover td {
  background: #fee2e2 !important;
}

#inventory-table tbody tr.row-critical td.item-name {
  color: #991b1b !important;
  font-weight: 800 !important;
}

#inventory-table tbody tr.row-critical td.runway-cell {
  color: #dc2626 !important;
  font-weight: 800 !important;
}

/* Sticky / Frozen Columns solid backgrounds across normal, even, hover, critical */
#inventory-table tbody td.inv-sticky-code,
#inventory-table tbody td.inv-sticky-desc,
#inventory-table tbody td.inv-sticky-cat,
.editor-table tbody td.inv-sticky-code,
.editor-table tbody td.inv-sticky-desc,
.editor-table tbody td.inv-sticky-cat {
  background: #ffffff !important;
  color: #0f172a !important;
}

#inventory-table tbody tr:nth-child(even) td.inv-sticky-code,
#inventory-table tbody tr:nth-child(even) td.inv-sticky-desc,
#inventory-table tbody tr:nth-child(even) td.inv-sticky-cat {
  background: #f8fafc !important;
}

#inventory-table tbody tr:hover td.inv-sticky-code,
#inventory-table tbody tr:hover td.inv-sticky-desc,
#inventory-table tbody tr:hover td.inv-sticky-cat {
  background: #f1f5f9 !important;
}

#inventory-table tbody tr.row-critical td.inv-sticky-code,
#inventory-table tbody tr.row-critical td.inv-sticky-desc,
#inventory-table tbody tr.row-critical td.inv-sticky-cat {
  background: #fff5f5 !important;
  color: #0f172a !important;
}

#inventory-table tbody tr.row-critical:nth-child(even) td.inv-sticky-code,
#inventory-table tbody tr.row-critical:nth-child(even) td.inv-sticky-desc,
#inventory-table tbody tr.row-critical:nth-child(even) td.inv-sticky-cat {
  background: #fef2f2 !important;
}

#inventory-table tbody tr.row-critical:hover td.inv-sticky-code,
#inventory-table tbody tr.row-critical:hover td.inv-sticky-desc,
#inventory-table tbody tr.row-critical:hover td.inv-sticky-cat {
  background: #fee2e2 !important;
}

/* Col 1: Chemical Code */
#inventory-table tbody td.inv-sticky-code {
  color: #334155 !important;
  font-weight: 700 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 10.5px !important;
}

/* Col 2: Chemical Description */
#inventory-table tbody td.item-name {
  color: #0f172a !important;
  font-weight: 700 !important;
}
#inventory-table tbody td.item-name:hover {
  color: #0284c7 !important;
}

/* Col 3: Category Badge */
#inventory-table tbody td.inv-sticky-cat span {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
  font-size: 9.5px !important;
  padding: 2.5px 6px !important;
  border-radius: 4px !important;
  display: inline-block !important;
}

/* Col 4, 5, 6: Stocks */
#inventory-table tbody td:nth-child(4) {
  color: #475569 !important;
  font-weight: 600 !important;
}
#inventory-table tbody td:nth-child(5) {
  color: #0f172a !important;
  font-weight: 700 !important;
}
#inventory-table tbody td:nth-child(6) {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* Col 7: Stock Runway */
#inventory-table tbody td.runway-cell {
  font-weight: 700 !important;
  color: #0f172a !important;
}
#inventory-table tbody td.runway-cell.text-danger {
  color: #dc2626 !important;
  font-weight: 800 !important;
}

/* Col 8: Smart Depletion Forecast Chips & Urgency Subtext */
#inventory-table .depletion-chip {
  padding: 2.5px 8px !important;
  font-size: 10px !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  white-space: nowrap !important;
}

#inventory-table .depletion-order-deadline {
  font-size: 8.5px !important;
  font-weight: 700 !important;
  margin-top: 1px !important;
  white-space: nowrap !important;
}

/* Depletion Badges Light / Crisp Color Palette */
#inventory-table .depletion-badge-stockout,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-stockout {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}
#inventory-table .depletion-badge-stockout .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-stockout .depletion-icon-pulse {
  background: #64748b !important;
}

#inventory-table .depletion-badge-critical,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-critical {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border: 1px solid #f87171 !important;
}
#inventory-table .depletion-badge-critical .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-critical .depletion-icon-pulse {
  background: #dc2626 !important;
  animation: pulseDepletion 1.5s infinite !important;
}

#inventory-table .depletion-badge-urgent,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-urgent {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border: 1px solid #fb923c !important;
}
#inventory-table .depletion-badge-urgent .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-urgent .depletion-icon-pulse {
  background: #ea580c !important;
  animation: pulseDepletion 2s infinite !important;
}

#inventory-table .depletion-badge-warning,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-warning {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #f59e0b !important;
}
#inventory-table .depletion-badge-warning .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-warning .depletion-icon-pulse {
  background: #d97706 !important;
}

#inventory-table .depletion-badge-moderate,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-moderate {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #38bdf8 !important;
}
#inventory-table .depletion-badge-moderate .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-moderate .depletion-icon-pulse {
  background: #0284c7 !important;
}

#inventory-table .depletion-badge-healthy,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-healthy {
  background: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #86efac !important;
}
#inventory-table .depletion-badge-healthy .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-healthy .depletion-icon-pulse {
  background: #16a34a !important;
}

#inventory-table .depletion-badge-surplus,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-surplus {
  background: #f3e8ff !important;
  color: #6b21a8 !important;
  border: 1px solid #d8b4fe !important;
}
#inventory-table .depletion-badge-surplus .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-surplus .depletion-icon-pulse {
  background: #9333ea !important;
}

#inventory-table .depletion-badge-inactive,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-inactive {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #cbd5e1 !important;
}
#inventory-table .depletion-badge-inactive .depletion-icon-pulse,
:root:not([data-theme="light"]) #inventory-table .depletion-badge-inactive .depletion-icon-pulse {
  background: #94a3b8 !important;
}

/* Depletion Urgency Deadline Subtext Colors */
#inventory-table .depletion-urgency-danger,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-danger {
  color: #dc2626 !important;
}
#inventory-table .depletion-urgency-warning,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-warning {
  color: #ea580c !important;
}
#inventory-table .depletion-urgency-amber,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-amber {
  color: #b45309 !important;
}
#inventory-table .depletion-urgency-info,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-info {
  color: #0284c7 !important;
}
#inventory-table .depletion-urgency-healthy,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-healthy {
  color: #166534 !important;
}
#inventory-table .depletion-urgency-surplus,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-surplus {
  color: #9333ea !important;
}
#inventory-table .depletion-urgency-muted,
:root:not([data-theme="light"]) #inventory-table .depletion-urgency-muted {
  color: #64748b !important;
}

/* Col 9: Unit Cost */
#inventory-table tbody td:nth-child(9) {
  color: #b45309 !important;
  font-weight: 800 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Col 10: Daily Consumption */
#inventory-table tbody td:nth-child(10) {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* Col 11: Monthly Max Consumption */
#inventory-table tbody td:nth-child(11) {
  color: #c2410c !important;
  font-weight: 700 !important;
}

/* Status Badges */
#inventory-table .badge-critical {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border: 1px solid #f87171 !important;
}
#inventory-table .badge-warning {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #f59e0b !important;
}
#inventory-table .badge-healthy {
  background: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #86efac !important;
}
#inventory-table .badge-surplus {
  background: #f3e8ff !important;
  color: #6b21a8 !important;
  border: 1px solid #d8b4fe !important;
}
#inventory-table .badge-inactive {
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #cbd5e1 !important;
}


/* ==========================================================================
   BOTTOM-RIGHT REAL-TIME TEAM CHAT & DIRECT MESSAGING WIDGET
   ========================================================================== */
.team-chat-root {
  position: fixed;
  right: 62px;
  bottom: 20px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
}

.team-chat-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a 0%, #064e3b 100%);
  border: 1.5px solid #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(16, 185, 129, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.team-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55), 0 0 18px rgba(16, 185, 129, 0.45);
}

.team-chat-launcher-icon {
  display: inline-flex;
  align-items: center;
  color: #34d399;
}

.team-chat-online-pill {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}

.team-chat-unread-badge {
  position: absolute;
  top: -7px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.65);
}

.team-chat-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 290px;
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1.5px solid #38bdf8;
  color: #f8fafc;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.team-chat-toast-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 5px;
  flex-shrink: 0;
}

.team-chat-toast-body {
  min-width: 0;
}

.team-chat-toast-sender {
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chat-toast-text {
  font-size: 11px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chat-drawer {
  width: 355px;
  max-width: calc(100vw - 32px);
  height: 475px;
  max-height: calc(100vh - 105px);
  border-radius: 14px;
  background: #0f172a;
  border: 1.5px solid #10b981;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 24px rgba(16, 185, 129, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f8fafc;
}

.team-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #064e3b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.team-chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-chat-header-meta {
  min-width: 0;
}

.team-chat-header-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chat-header-sub {
  font-size: 10px;
  font-weight: 700;
  color: #6ee7b7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.team-chat-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.team-chat-icon-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
}

.team-chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.team-chat-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.8);
}

.team-chat-search-input {
  width: 100%;
  height: 32px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: #1e293b;
  color: #f8fafc;
  font-size: 12px;
  outline: none;
}

.team-chat-search-input:focus {
  border-color: #10b981;
}

.team-chat-contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.team-chat-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(30, 41, 59, 0.55);
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.team-chat-contact-item:hover {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
}

.team-chat-contact-item.is-broadcast {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.22) 0%, rgba(16, 185, 129, 0.16) 100%);
  border-color: rgba(56, 189, 248, 0.35);
}

.team-chat-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.team-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.team-chat-avatar-group {
  background: linear-gradient(135deg, #10b981 0%, #0284c7 100%);
}

.team-chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0f172a;
}

.team-chat-status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.team-chat-status-dot.offline {
  background: #64748b;
}

.team-chat-contact-main {
  flex: 1;
  min-width: 0;
}

.team-chat-contact-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.team-chat-contact-name {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chat-contact-time {
  font-size: 9.5px;
  color: #94a3b8;
  font-weight: 600;
  flex-shrink: 0;
}

.team-chat-contact-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 2px;
}

.team-chat-contact-preview {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-chat-contact-preview.is-online {
  color: #34d399;
  font-weight: 700;
}

.team-chat-item-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.team-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0b1220;
}

.team-chat-empty {
  margin: auto;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  padding: 18px;
}

.team-chat-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.team-chat-msg-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.team-chat-msg-row.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.team-chat-msg-sender {
  font-size: 10px;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 2px;
  padding: 0 4px;
}

.team-chat-msg-bubble {
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

.team-chat-msg-row.mine .team-chat-msg-bubble {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.team-chat-msg-row.theirs .team-chat-msg-bubble {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom-left-radius: 4px;
}

.team-chat-msg-time {
  font-size: 9px;
  color: #64748b;
  margin-top: 2px;
  padding: 0 4px;
}

.team-chat-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.team-chat-input {
  flex: 1;
  height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #1e293b;
  color: #ffffff;
  font-size: 12px;
  outline: none;
}

.team-chat-input:focus {
  border-color: #10b981;
}

.team-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.team-chat-send-btn:hover {
  transform: scale(1.05);
}

[data-theme="light"] .team-chat-drawer {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
}

[data-theme="light"] .team-chat-search-wrap,
[data-theme="light"] .team-chat-form {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .team-chat-search-input,
[data-theme="light"] .team-chat-input {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .team-chat-messages {
  background: #f1f5f9;
}

[data-theme="light"] .team-chat-contact-item {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .team-chat-contact-name {
  color: #0f172a;
}

[data-theme="light"] .team-chat-msg-row.theirs .team-chat-msg-bubble {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

@media (max-width: 560px) {
  .team-chat-root {
    right: 16px;
    bottom: 104px;
  }
  .team-chat-drawer {
    width: calc(100vw - 24px);
    height: 410px;
  }
}


/* =========================================================================
   REAL-TIME WEBRTC AUDIO & VIDEO CALLING ENGINE STYLES
   ========================================================================= */

.team-chat-call-btn {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  transition: all 0.2s ease !important;
}

.team-chat-call-btn:hover {
  background: #10b981 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.team-chat-contact-call-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  opacity: 0;
  transform: translateX(4px);
  transition: all 0.2s ease;
}

.team-chat-contact-item:hover .team-chat-contact-call-actions {
  opacity: 1;
  transform: translateX(0);
}

.team-chat-contact-call-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.team-chat-contact-call-btn:hover {
  background: #10b981;
  color: #ffffff;
  transform: scale(1.1);
}

/* Incoming Call Dialog Modal */
.team-call-incoming-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.team-call-incoming-card {
  width: 360px;
  max-width: 90vw;
  background: #0f172a;
  border: 1.5px solid #10b981;
  border-radius: 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(16, 185, 129, 0.25);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #f8fafc;
  position: relative;
  overflow: hidden;
}

.team-call-pulse-avatar-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.team-call-pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid #10b981;
  opacity: 0;
  animation: callPulse 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.team-call-pulse-ring.ring-2 {
  animation-delay: 0.6s;
}

@keyframes callPulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { opacity: 0.3; }
  100% { transform: scale(1.45); opacity: 0; }
}

.team-call-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 2;
}

.team-call-incoming-name {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.team-call-incoming-type {
  font-size: 13px;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-call-incoming-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.team-call-btn-decline,
.team-call-btn-accept {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.team-call-btn-decline {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
}

.team-call-btn-decline:hover {
  background: #ef4444;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.5);
}

.team-call-btn-accept {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
  animation: acceptBounce 1.6s infinite ease-in-out;
}

@keyframes acceptBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.team-call-btn-accept:hover {
  background: #34d399;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.6);
}

/* Active Audio / Video Call Window */
.team-call-active-window {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 440px;
  height: 330px;
  background: #090d16;
  border: 1.5px solid #10b981;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(16, 185, 129, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999998;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.team-call-active-window.is-fullscreen {
  width: min(1100px, 92vw);
  height: min(720px, 86vh);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  right: auto;
  bottom: auto;
}

.team-call-active-window.is-minimized {
  width: 320px;
  height: 54px;
  border-radius: 12px;
}

.team-call-active-window.is-minimized .team-call-media-viewport,
.team-call-active-window.is-minimized .team-call-toolbar {
  display: none !important;
}

.team-call-window-header {
  height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #064e3b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
  user-select: none;
}

.team-call-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.team-call-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: dotBlink 1.4s infinite ease-in-out;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.team-call-partner-name {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.team-call-type-badge {
  font-size: 9.5px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.team-call-timer {
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
}

.team-call-header-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.team-call-control-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.team-call-control-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.team-call-media-viewport {
  flex: 1;
  position: relative;
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.team-call-remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #020617;
}

.team-call-audio-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  color: #f8fafc;
  z-index: 1;
}

.team-call-placeholder-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.team-call-placeholder-name {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.team-call-placeholder-status {
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
  margin-bottom: 16px;
}

.team-call-audio-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
}

.team-call-audio-wave span {
  width: 4px;
  background: #10b981;
  border-radius: 2px;
  animation: waveBar 1.2s infinite ease-in-out;
}

.team-call-audio-wave span:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.team-call-audio-wave span:nth-child(2) { height: 16px; animation-delay: 0.2s; }
.team-call-audio-wave span:nth-child(3) { height: 22px; animation-delay: 0.3s; }
.team-call-audio-wave span:nth-child(4) { height: 14px; animation-delay: 0.4s; }
.team-call-audio-wave span:nth-child(5) { height: 9px; animation-delay: 0.5s; }

@keyframes waveBar {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.2); }
}

.team-call-local-pip {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 104px;
  height: 78px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
  border: 1.5px solid rgba(16, 185, 129, 0.6);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
  z-index: 2;
  transition: all 0.2s ease;
}

.team-call-local-pip:hover {
  transform: scale(1.05);
}

.team-call-local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror selfie view */
}

.team-call-pip-label {
  position: absolute;
  bottom: 4px;
  left: 6px;
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
}

.team-call-toolbar {
  height: 60px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-shrink: 0;
  padding: 0 16px;
}

.team-call-tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(30, 41, 59, 0.9);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.team-call-tool-btn:hover {
  background: #334155;
  color: #ffffff;
  transform: translateY(-2px);
}

.team-call-tool-btn.is-active-off {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

.team-call-tool-btn.is-screen-sharing {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
}

.team-call-hangup-btn {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  width: 44px !important;
  height: 44px !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
}

.team-call-hangup-btn:hover {
  background: #b91c1c !important;
  transform: translateY(-2px) scale(1.06) !important;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.65) !important;
}

/* Light Theme overrides */
[data-theme="light"] .team-call-incoming-card {
  background: #ffffff;
  color: #0f172a;
  border-color: #10b981;
}

[data-theme="light"] .team-call-incoming-name {
  color: #0f172a;
}

[data-theme="light"] .team-call-active-window {
  background: #ffffff;
  border-color: #10b981;
  color: #0f172a;
}

[data-theme="light"] .team-call-partner-name {
  color: #ffffff;
}

[data-theme="light"] .team-call-toolbar {
  background: #f8fafc;
  border-top-color: #e2e8f0;
}

[data-theme="light"] .team-call-tool-btn {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .team-call-tool-btn:hover {
  background: #cbd5e1;
}
