/* ==========================================================================
   COSTOQ — MODERN HIGH-DENSITY ERP INVENTORY STYLESHEET (BLING DENSITY)
   ========================================================================== */

:root {
  /* Brand Colors */
  --color-lotus: #a855f7;      /* Purple */
  --color-aquarius: #06b6d4;   /* Cyan */
  --color-aya: #10b981;        /* Emerald */
  --color-group: #f59e0b;      /* Amber */
  --color-money: #34d399;      /* Bright Emerald for Financial */
  
  /* Dark Theme Palette (Bling / Linear Style) */
  --bg-primary: #0e1217;
  --bg-secondary: #141922;
  --bg-card: rgba(20, 25, 34, 0.85);
  --bg-card-hover: rgba(30, 38, 52, 0.8);
  --bg-table-stripe: rgba(255, 255, 255, 0.018);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;
  
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace, sans-serif;
  
  --sidebar-width: 250px;
}

/* Light Theme Variables (High Contrast ERP Palette) */
body.light-theme {
  /* Rich, accessible brand colors (WCAG AA compliant against white & light-slate) */
  --color-lotus: #7e22ce;        /* Deep Royal Purple */
  --color-aquarius: #0284c7;     /* Deep Sky Blue */
  --color-aya: #047857;          /* Deep Emerald Green */
  --color-group: #b45309;        /* Warm Amber Bronze */
  --color-money: #15803d;        /* Deep Forest Green for Valuations */

  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-table-stripe: #f8fafc;
  
  --border-color: #cbd5e1;
  --border-subtle: #e2e8f0;
  
  --text-primary: #0f172a;       /* Slate 900 */
  --text-secondary: #334155;     /* Slate 700 */
  --text-muted: #64748b;         /* Slate 500 */
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden; /* App layout manages its own scrolling */
}

/* Glassmorphism Surface */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
}

/* Overall App Flex Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==========================================================================
   1. TOP SLIM STICKY HEADER (Min Height ~48px)
   ========================================================================== */
.app-header {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  z-index: 50;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}

.btn-sidebar-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-lotus), var(--color-aquarius));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}

.unified-brand-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 3px 9px 3px 4px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.unified-brand-box:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-title h1 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1;
}

.brand-hub-tag {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

.badge-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
}

.badge-live {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-live i {
  font-size: 6px;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

.subtitle {
  display: none; /* Hidden on compact view to keep ultra-sleek */
}

/* Compact Inline KPIs in Header */
.header-kpis-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-grow: 1;
  justify-content: center;
  overflow: visible; /* Allows hover dropdowns to display without clipping */
}

.kpi-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  height: 34px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  z-index: 150;
}

/* Active State for Header KPI Pills */
.kpi-pill.active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.kpi-pill-group.active {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: var(--color-group) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35) !important;
}

.kpi-pill-lotus.active {
  background: rgba(168, 85, 247, 0.22) !important;
  border-color: var(--color-lotus) !important;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4) !important;
}

.kpi-pill-aquarius.active {
  background: rgba(6, 182, 212, 0.22) !important;
  border-color: var(--color-aquarius) !important;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4) !important;
}

.kpi-pill-aya.active {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: var(--color-aya) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4) !important;
}

.kpi-pill-health.active {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4) !important;
}

.pill-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.kpi-pill-group .pill-icon { background: rgba(245, 158, 11, 0.2); color: var(--color-group); }
.kpi-pill-lotus .pill-icon { background: rgba(168, 85, 247, 0.2); color: var(--color-lotus); }
.kpi-pill-aquarius .pill-icon { background: rgba(6, 182, 212, 0.2); color: var(--color-aquarius); }
.kpi-pill-aya .pill-icon { background: rgba(16, 185, 129, 0.2); color: var(--color-aya); }
.kpi-pill-health .pill-icon { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.pill-body {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.pill-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}

.pill-value {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.pill-value small {
  font-size: 9px;
  color: var(--text-muted);
}

/* Subtle chevron indicator */
.pill-chevron {
  font-size: 8px;
  color: var(--text-muted);
  margin-left: 2px;
  transition: transform 0.2s ease, color 0.15s ease;
  opacity: 0.6;
}
.kpi-pill:hover .pill-chevron {
  transform: rotate(180deg);
  color: var(--text-primary);
  opacity: 1;
}

/* ==========================================================================
   DROPDOWN FLUTUANTE EXPANSÍVEL NO HOVER
   ========================================================================== */
.pill-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 215px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s ease;
  z-index: 1000;
  cursor: default;
}
/* Ponte invisível para o cursor não perder o hover */
.pill-dropdown::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}
.kpi-pill:hover .pill-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
body.light-theme .pill-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-color: #cbd5e1;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.pill-dropdown-header {
  padding-bottom: 5px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pill-dropdown-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
}
.pill-tag-group { background: rgba(245, 158, 11, 0.2); color: var(--color-group); }
.pill-tag-lotus { background: rgba(168, 85, 247, 0.2); color: var(--color-lotus); }
.pill-tag-aquarius { background: rgba(6, 182, 212, 0.2); color: var(--color-aquarius); }
.pill-tag-aya { background: rgba(16, 185, 129, 0.2); color: var(--color-aya); }
.pill-tag-alerts { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.pill-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pill-dropdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}
.pdd-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
}
.pdd-label i {
  font-size: 10px;
  width: 12px;
  text-align: center;
}
.pdd-value {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.text-money {
  color: var(--color-money) !important;
}
.badge-share {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
body.light-theme .badge-share {
  background: rgba(0, 0, 0, 0.06);
}
.alert-badge-sm {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.alert-zero { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.alert-crit { background: rgba(249, 115, 22, 0.2); color: #fb923c; }

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-lotus), #7c3aed);
  color: #ffffff;
}
.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   2. MAIN APP LAYOUT (SIDEBAR ESQUERDA + TABELA DIREITA)
   ========================================================================== */
.main-layout-wrapper {
  display: flex;
  flex-grow: 1;
  height: calc(100vh - 48px);
  overflow: hidden;
  position: relative;
}

/* COLLAPSIBLE SIDEBAR */
.filter-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              padding 0.25s ease;
  overflow: hidden;
  z-index: 30;
}

/* Sidebar Collapsed State */
.filter-sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border-right: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.btn-sidebar-collapse {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-sidebar-collapse:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-grow: 1;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Search Box inside Sidebar */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 26px 6px 8px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--color-lotus);
}

.btn-clear {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
}

/* Vertical Store Tabs inside Sidebar */
.store-tabs-vertical {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.store-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.store-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.store-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
}

.store-tab.lotus-tab.active { background: var(--color-lotus); color: #ffffff; }
.store-tab.aquarius-tab.active { background: var(--color-aquarius); color: #0f172a; }
.store-tab.aya-tab.active { background: var(--color-aya); color: #0f172a; }

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lotus-dot { background: var(--color-lotus); }
.aquarius-dot { background: var(--color-aquarius); }
.aya-dot { background: var(--color-aya); }

/* Vertical Toggle Group (UN vs CX) */
.toggle-group-vertical {
  display: flex;
  gap: 3px;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.toggle-group-vertical .toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 6px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-group-vertical .toggle-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
}

/* Sidebar Selects */
.sidebar-select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 11.5px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
  width: 100%;
}
.sidebar-select:focus {
  border-color: var(--color-lotus);
}

/* Brand / Supplier Checkboxes */
.sidebar-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.brand-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 7px;
  max-height: 145px;
  overflow-y: auto;
}
body.light-theme .brand-checkbox-list {
  background: rgba(0, 0, 0, 0.03);
}
.brand-checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  padding: 3px 5px;
  border-radius: var(--radius-xs);
  transition: background 0.12s ease;
}
.brand-checkbox-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.light-theme .brand-checkbox-item:hover {
  background: rgba(0, 0, 0, 0.05);
}
.brand-checkbox-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--color-lotus);
  width: 13px;
  height: 13px;
  margin: 0;
  flex-shrink: 0;
}
.brand-checkbox-name {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.brand-checkbox-badge {
  font-size: 9.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 8px;
  flex-shrink: 0;
}
body.light-theme .brand-checkbox-badge {
  background: rgba(0, 0, 0, 0.06);
}
.btn-link-xs {
  background: none;
  border: none;
  color: var(--color-lotus);
  font-size: 10.5px;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
  transition: opacity 0.15s ease;
}
.btn-link-xs:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ==========================================================================
   3. RIGHT MAIN CONTENT AREA & BLING-DENSITY TABLE
   ========================================================================== */
.content-scrollable {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Sub-bar above table: results info, center switch & totals */
.table-sub-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 34px;
  gap: 12px;
}

.sub-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.sub-bar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.sub-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}

/* Central Unit Switch Interruptor */
.unit-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.unit-switch-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.unit-switch-btn:active {
  transform: translateY(0);
}

.switch-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.2);
  color: var(--color-lotus);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all 0.2s ease;
}

.unit-switch-btn.cx-mode .switch-indicator {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-group);
}

.switch-label {
  font-family: var(--font-display);
  letter-spacing: 0.3px;
  color: var(--text-primary);
}

.switch-toggle-icon {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: 2px;
  transition: opacity 0.15s ease, transform 0.25s ease;
}

.unit-switch-btn:hover .switch-toggle-icon {
  opacity: 1;
  color: var(--text-primary);
  transform: rotate(180deg);
}

.btn-expand-sidebar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-expand-sidebar:hover {
  background: rgba(255, 255, 255, 0.12);
}

.results-info {
  font-size: 11.5px;
  color: var(--text-muted);
}
.results-info strong {
  color: var(--text-primary);
}

.filtered-sum {
  font-size: 11.5px;
  color: var(--text-muted);
}
.filtered-sum strong {
  color: var(--color-group);
}

/* Table Container (Fills rest of screen and scrolls) */
.table-container {
  flex-grow: 1;
  overflow: auto;
  position: relative;
}

/* BLING TABLE STYLES (High Density, Sleek, 32px Row Height) */
.costoq-table.bling-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
  table-layout: fixed;
}

.costoq-table.bling-table thead {
  position: sticky;
  top: 0;
  background: #11161f;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.costoq-table.bling-table th {
  position: relative;
  padding: 6px 12px 6px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: #8899a6;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.costoq-table.bling-table th:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

body.light-theme .costoq-table.bling-table th:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}

.costoq-table.bling-table th.text-right .th-content {
  justify-content: flex-end;
  width: 100%;
}

.costoq-table.bling-table th.text-center .th-content {
  justify-content: center;
  width: 100%;
}

.th-sort-icon {
  font-size: 9px;
  opacity: 0.35;
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.costoq-table.bling-table th:hover .th-sort-icon {
  opacity: 0.85;
  color: var(--text-primary);
}

.costoq-table.bling-table th.sorted-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}

body.light-theme .costoq-table.bling-table th.sorted-active {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}

.costoq-table.bling-table th.sorted-active .th-sort-icon {
  opacity: 1;
  color: var(--color-lotus);
}

/* Resizable Column Handle */
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 15;
  transition: background 0.15s ease;
}

.col-resizer:hover,
.col-resizer.is-resizing {
  background: var(--color-lotus);
  opacity: 0.9;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.costoq-table.bling-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  height: 32px; /* Ultra-compact Bling height */
  transition: background 0.1s ease;
  cursor: pointer;
}

.costoq-table.bling-table tbody tr:nth-child(even) {
  background: var(--bg-table-stripe);
}

.costoq-table.bling-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.costoq-table.bling-table td {
  padding: 4px 8px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* SKU Code Cell (Bling Style with Copy Icon) */
.sku-cell-compact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.sku-copy-icon {
  font-size: 10px;
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.sku-cell-compact:hover .sku-copy-icon {
  opacity: 1;
  color: var(--color-lotus);
}

/* Product Description (Responsive & Expandable) */
.product-cell-compact {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  overflow: hidden;
}

.product-name-compact {
  font-size: clamp(10.5px, 0.85vw, 12px);
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 60px;
}

/* Fragrance / Variation Badge */
.fragrance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: rgba(168, 85, 247, 0.18);
  color: #e9d5ff;
  border: 1px solid rgba(168, 85, 247, 0.4);
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(168, 85, 247, 0.15);
}

.fragrance-badge i {
  font-size: 8px;
  opacity: 0.8;
}

.product-meta-inline {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.85;
}

/* Compact Tags */
.category-tag-compact {
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  display: inline-block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.box-factor-compact {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--color-group);
  background: rgba(245, 158, 11, 0.1);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Numbers & Values */
.cost-price-compact {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stock-num {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.stock-num.col-lotus { color: var(--color-lotus); }
.stock-num.col-aquarius { color: var(--color-aquarius); }
.stock-num.col-aya { color: var(--color-aya); }
.stock-num.col-total { color: var(--text-primary); font-weight: 700; }

.val-money {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-money);
}

.val-money-sub {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 500;
  color: #6ee7b7;
}

/* Compact Status Badge */
.status-pill-compact {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  display: inline-block;
  white-space: nowrap;
}

.status-healthy { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-low { background: rgba(234, 179, 8, 0.15); color: #facc15; }
.status-critical { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.status-zero { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 36px;
  color: var(--text-muted);
}

/* Modal Details */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title-group h2 {
  font-size: 16px;
  margin-top: 4px;
  color: var(--text-primary);
}

.modal-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.breakdown-card {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.lotus-card { border-top: 3px solid var(--color-lotus); }
.aquarius-card { border-top: 3px solid var(--color-aquarius); }
.aya-card { border-top: 3px solid var(--color-aya); }
.total-card { border-top: 3px solid var(--color-group); }

.store-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.store-un {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.store-un small { font-size: 10px; color: var(--text-muted); }

.store-cx {
  font-size: 10.5px;
  color: var(--text-muted);
}

.store-financial {
  font-size: 10.5px;
  color: var(--color-money);
  margin-top: 4px;
  font-weight: 600;
}

.modal-section h3 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.financial-summary-card {
  display: flex;
  gap: 16px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.fin-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fin-label { font-size: 10px; color: var(--text-muted); }
.fin-val { font-size: 13px; color: var(--color-money); }

.sub-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.sub-table th, .sub-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.sub-table th { background: rgba(0, 0, 0, 0.3); color: var(--text-muted); font-size: 10px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1e293b;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  z-index: 10000;
}
.toast-icon { color: #34d399; }

.hidden { display: none !important; }

/* ==========================================================================
   AUTHENTICATION GATE OVERLAY (TEAM PASSWORD)
   ========================================================================== */
.auth-gate-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 14, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-gate-backdrop.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.auth-gate-card {
  width: 100%;
  max-width: 400px;
  background: #141922;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.auth-logo-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-lotus), var(--color-aquarius));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4);
  margin-bottom: 4px;
}

.auth-gate-card h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1;
}

.auth-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 10px;
  line-height: 1.4;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-input-group input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.auth-input-group input:focus {
  border-color: var(--color-lotus);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}

.auth-error-msg {
  font-size: 11.5px;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.btn-lg {
  padding: 9px 16px;
  font-size: 13px;
}

.auth-footer-note {
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

/* ==========================================================================
   LIGHT THEME COMPLETE OVERRIDES & HIGH-CONTRAST ERP STYLING
   ========================================================================== */

/* 1. Header & Brand Box */
body.light-theme .app-header {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .btn-sidebar-toggle {
  color: #334155;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

body.light-theme .btn-sidebar-toggle:hover {
  color: #0f172a;
  background: #e2e8f0;
}

body.light-theme .unified-brand-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .unified-brand-box:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

body.light-theme .brand-title h1 {
  color: #0f172a;
}

body.light-theme .brand-hub-tag {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 700;
}

body.light-theme .badge-live {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 700;
}

body.light-theme .badge-live i {
  color: #16a34a;
}

body.light-theme .logo-badge {
  background: linear-gradient(135deg, #7e22ce, #0284c7);
  box-shadow: 0 2px 6px rgba(126, 34, 206, 0.25);
}

/* 2. Top KPI Pills (Resting & Active) */
body.light-theme .kpi-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .kpi-pill:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

body.light-theme .pill-label {
  color: #475569;
}

body.light-theme .pill-value {
  color: #0f172a;
}

body.light-theme .pill-value small {
  color: #64748b;
}

body.light-theme .pill-chevron {
  color: #64748b;
}

/* Active states for KPI Pills */
body.light-theme .kpi-pill-group.active {
  background: #fffbeb !important;
  border-color: #d97706 !important;
  box-shadow: 0 0 0 1.5px #d97706 !important;
}

body.light-theme .kpi-pill-lotus.active {
  background: #faf5ff !important;
  border-color: #7e22ce !important;
  box-shadow: 0 0 0 1.5px #7e22ce !important;
}

body.light-theme .kpi-pill-aquarius.active {
  background: #f0f9ff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 1.5px #0284c7 !important;
}

body.light-theme .kpi-pill-aya.active {
  background: #f0fdf4 !important;
  border-color: #047857 !important;
  box-shadow: 0 0 0 1.5px #047857 !important;
}

body.light-theme .kpi-pill-health.active {
  background: #fef2f2 !important;
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1.5px #dc2626 !important;
}

/* KPI Pill Icons */
body.light-theme .kpi-pill-group .pill-icon { background: #fef3c7; color: #b45309; }
body.light-theme .kpi-pill-lotus .pill-icon { background: #f3e8ff; color: #7e22ce; }
body.light-theme .kpi-pill-aquarius .pill-icon { background: #e0f2fe; color: #0284c7; }
body.light-theme .kpi-pill-aya .pill-icon { background: #dcfce7; color: #047857; }
body.light-theme .kpi-pill-health .pill-icon { background: #fee2e2; color: #dc2626; }

/* KPI Pill Hover Dropdown */
body.light-theme .pill-dropdown {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
}

body.light-theme .pill-dropdown-header {
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .pill-dropdown-tag {
  color: #475569;
}

body.light-theme .pill-dropdown-row {
  border-bottom: 1px solid #f1f5f9;
}

body.light-theme .pdd-label {
  color: #475569;
}

body.light-theme .pdd-value {
  color: #0f172a;
}

body.light-theme .pdd-sub {
  color: #64748b;
}

/* 3. Sub-bar (Central Switch, Counter & Financial Total) */
body.light-theme .table-sub-bar {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
}

body.light-theme .results-info {
  color: #475569;
}

body.light-theme .results-info strong {
  color: #0f172a;
}

body.light-theme .filtered-sum {
  color: #475569;
}

body.light-theme .filtered-sum strong {
  color: #b45309;
}

body.light-theme .unit-switch-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

body.light-theme .unit-switch-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

body.light-theme .unit-switch-btn .switch-indicator {
  background: #f3e8ff;
  color: #7e22ce;
}

body.light-theme .unit-switch-btn.cx-mode .switch-indicator {
  background: #fef3c7;
  color: #b45309;
}

body.light-theme .switch-label {
  color: #0f172a;
  font-weight: 600;
}

body.light-theme .switch-toggle-icon {
  color: #64748b;
}

body.light-theme .btn-expand-sidebar {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

/* 4. Table Header & Sorting */
body.light-theme .costoq-table.bling-table thead {
  background: #f1f5f9 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

body.light-theme .costoq-table.bling-table th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #cbd5e1 !important;
  border-right: 1px solid #e2e8f0;
}

body.light-theme .costoq-table.bling-table th:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .costoq-table.bling-table th.sorted-active {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .costoq-table.bling-table th .th-sort-icon {
  color: #64748b;
  opacity: 0.5;
}

body.light-theme .costoq-table.bling-table th:hover .th-sort-icon {
  color: #0f172a;
  opacity: 0.9;
}

body.light-theme .costoq-table.bling-table th.sorted-active .th-sort-icon {
  color: #7e22ce;
  opacity: 1;
}

body.light-theme .col-resizer {
  border-right: 1px solid #cbd5e1;
}

body.light-theme .col-resizer:hover,
body.light-theme .col-resizer.is-resizing {
  background: #7e22ce;
  box-shadow: 0 0 6px rgba(126, 34, 206, 0.4);
}

/* 5. Table Rows & Cells */
body.light-theme .costoq-table.bling-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .costoq-table.bling-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

body.light-theme .costoq-table.bling-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

body.light-theme .costoq-table.bling-table tbody tr:hover {
  background: #eff6ff !important; /* Soft highlight blue-50 */
}

/* SKU Cell */
body.light-theme .sku-cell-compact {
  color: #0f172a;
  font-weight: 600;
}

body.light-theme .sku-copy-icon {
  color: #64748b;
  opacity: 0.6;
}

body.light-theme .sku-cell-compact:hover .sku-copy-icon {
  color: #7e22ce;
  opacity: 1;
}

/* Product Description */
body.light-theme .product-name-compact {
  color: #0f172a;
  font-weight: 600;
}

/* Fragrance Badge */
body.light-theme .fragrance-badge {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
  font-weight: 700;
  box-shadow: none;
}

body.light-theme .product-meta-inline {
  color: #475569;
  font-weight: 500;
  opacity: 1;
}

/* Category & Packaging Tags */
body.light-theme .category-tag-compact {
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-weight: 500;
}

body.light-theme .box-factor-compact {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  font-weight: 600;
}

/* Price & Values */
body.light-theme .cost-price-compact {
  color: #0f172a;
  font-weight: 600;
}

body.light-theme .stock-num.col-total {
  color: #0f172a;
  font-weight: 700;
}

body.light-theme .val-money {
  color: #15803d;
  font-weight: 700;
}

body.light-theme .val-money-sub {
  color: #047857;
  font-weight: 600;
}

/* Health Status Pills */
body.light-theme .status-healthy {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-weight: 700;
}

body.light-theme .status-low {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fef08a;
  font-weight: 700;
}

body.light-theme .status-critical {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-weight: 700;
}

body.light-theme .status-zero {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-weight: 700;
}

/* 6. Sidebar & Form Controls */
body.light-theme .filter-sidebar {
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
}

body.light-theme .sidebar-header {
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
}

body.light-theme .sidebar-title {
  color: #1e293b;
  font-weight: 700;
}

body.light-theme .sidebar-label {
  color: #334155;
  font-weight: 600;
}

body.light-theme .btn-sidebar-collapse {
  color: #64748b;
}

body.light-theme .btn-sidebar-collapse:hover {
  background: #e2e8f0;
  color: #0f172a;
}

body.light-theme .search-box input {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body.light-theme .search-box input::placeholder {
  color: #94a3b8;
}

body.light-theme .search-box input:focus {
  border-color: #7e22ce;
  box-shadow: 0 0 0 2px rgba(126, 34, 206, 0.15);
}

body.light-theme .btn-clear {
  color: #64748b;
}

body.light-theme .toggle-group-vertical {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

body.light-theme .toggle-group-vertical .toggle-btn {
  color: #475569;
  font-weight: 500;
}

body.light-theme .toggle-group-vertical .toggle-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}

body.light-theme .toggle-group-vertical .toggle-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.light-theme .brand-checkbox-list {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

body.light-theme .brand-checkbox-item {
  color: #1e293b;
}

body.light-theme .brand-checkbox-item:hover {
  background: #e2e8f0;
}

body.light-theme .brand-checkbox-badge {
  background: #e2e8f0;
  color: #334155;
  font-weight: 600;
}

body.light-theme .sidebar-select {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-weight: 500;
}

body.light-theme .sidebar-select:focus {
  border-color: #7e22ce;
}

body.light-theme .btn-secondary {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-weight: 600;
}

body.light-theme .btn-secondary:hover {
  background: #e2e8f0;
}

body.light-theme .btn-icon {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
}

body.light-theme .btn-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* 7. Modal Breakdown & Details */
body.light-theme .modal-backdrop {
  background: rgba(15, 23, 42, 0.55);
}

body.light-theme .modal-content {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
  color: #0f172a;
}

body.light-theme .modal-header {
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .breakdown-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

body.light-theme .store-un {
  color: #0f172a;
}

body.light-theme .store-financial {
  color: #15803d;
  font-weight: 700;
}

body.light-theme .financial-summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

body.light-theme .fin-val {
  color: #15803d;
  font-weight: 700;
}

body.light-theme .sub-table-wrapper {
  border: 1px solid #cbd5e1;
}

body.light-theme .sub-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

body.light-theme .sub-table td {
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

body.light-theme .modal-footer {
  border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   SYNC FAILURE WARNING BADGE & CENTRAL ERROR POP-UP MODAL
   ========================================================================== */

/* Warning Badge next to V3 in Brand Box */
.badge-sync-warning {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  user-select: none;
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
  transition: all 0.15s ease;
  animation: pulse-warning 2.5s infinite;
}

.badge-sync-warning:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #f87171;
  transform: scale(1.03);
}

@keyframes pulse-warning {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

body.light-theme .badge-sync-warning {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #f87171;
  font-weight: 700;
}

body.light-theme .badge-sync-warning:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}

/* Central Sync Error Modal Card */
.modal-sync-error-card {
  max-width: 500px !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 25px rgba(239, 68, 68, 0.2) !important;
  padding: 24px !important;
  gap: 16px !important;
}

.sync-error-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.sync-error-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.sync-error-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.sync-error-body h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.sync-error-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.sync-error-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #fbbf24;
}

.sync-error-alert-banner i {
  font-size: 14px;
  color: #f59e0b;
  margin-top: 1px;
  flex-shrink: 0;
}

.sync-error-detail-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}

.sync-error-detail-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

#syncErrorMessageText {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #f87171;
  word-break: break-word;
  white-space: pre-wrap;
  display: block;
}

.sync-error-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  width: 100%;
}

/* Light theme adjustments for the modal */
body.light-theme .modal-sync-error-card {
  background: #ffffff !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18), 0 0 15px rgba(239, 68, 68, 0.15) !important;
}

body.light-theme .sync-error-icon-circle {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

body.light-theme .sync-error-alert-banner {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

body.light-theme .sync-error-alert-banner i {
  color: #d97706;
}

body.light-theme .sync-error-detail-box {
  background: #f8fafc;
  border-color: #cbd5e1;
}

body.light-theme #syncErrorMessageText {
  color: #b91c1c;
}
