/* ==========================================================================
   KHANDELIA OIL & GENERAL MILLS PVT. LTD. — 42 COSTING PLATFORM
   Design System: Premium Industrial Luxury & Analytics
   Palettes: Mustard Gold, Navy Slate, Emerald Green, Crimson Red
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-input: #1f293d;
  --bg-glass: rgba(255, 255, 255, 0.03);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(245, 158, 11, 0.35);
  --border-active: #f59e0b;

  /* Brand Colors */
  --mustard-gold: #f59e0b;
  --mustard-amber: #d97706;
  --mustard-dark: #b45309;
  --mustard-glow: rgba(245, 158, 11, 0.2);

  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --success-green: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning-orange: #f97316;
  --warning-bg: rgba(249, 115, 22, 0.12);
  --danger-red: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);
  --shadow-gold: 0 0 25px rgba(245, 158, 11, 0.18);

  /* Geometry */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Light Theme overrides */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-input: #f1f5f9;
  --bg-glass: rgba(0, 0, 0, 0.02);
  --border-subtle: #e2e8f0;
  --border-hover: rgba(217, 119, 6, 0.4);
  --border-active: #d97706;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --shadow-gold: 0 0 20px rgba(217, 119, 6, 0.12);
}

/* Global Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16.5px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
.font-display {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Top Branding Bar */
.top-header {
  background: var(--bg-secondary);
  border-bottom: 1.5px solid var(--border-subtle);
  padding: 0.65rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.brand-logos {
  display: flex;
  align-items: center;
}

.logo-badge-container {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  background: #ffffff;
  padding: 6px 15px;
  border-radius: 12px;
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-badge-container:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.28);
  border-color: var(--mustard-gold);
}

.brand-logo-kogm {
  height: 40px;
  max-width: 115px;
  object-fit: contain;
  display: block;
  filter: contrast(1.08);
}

.logo-divider {
  width: 1.5px;
  height: 32px;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.25), transparent);
}

.brand-logo-mashal {
  height: 46px;
  max-width: 100px;
  object-fit: contain;
  display: block;
  filter: contrast(1.06);
}

.brand-title-group h1 {
  font-size: 1.30rem;
  font-weight: 800;
  font-family: 'Outfit', 'Inter', sans-serif;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2.5px 8.5px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000000;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-subtitle {
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.brand-subtitle .subtitle-separator {
  color: var(--border-subtle);
  font-size: 0.7rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.theme-toggle-btn,
.btn-icon {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.theme-toggle-btn:hover,
.btn-icon:hover {
  transform: translateY(-1.5px);
  color: var(--text-primary);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.theme-toggle-btn:active,
.btn-icon:active {
  transform: translateY(0);
}

.header-btn-email {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #60a5fa !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
}
.header-btn-email:hover {
  background: rgba(37, 99, 235, 0.22) !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25) !important;
}

.header-btn-upload {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
.header-btn-upload:hover {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
}

.header-btn-export:hover {
  border-color: var(--mustard-gold) !important;
  color: var(--mustard-gold) !important;
}

.sync-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(16, 185, 129, 0.10);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.80rem;
  font-weight: 700;
  color: var(--success-green);
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.08);
}

.status-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  background-color: var(--success-green);
  box-shadow: 0 0 8px var(--success-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

/* ==========================================================================
   Global Navigation Bar & Interactive Tabs
   ========================================================================== */
.app-nav {
  background: var(--bg-card);
  border-bottom: 1.5px solid var(--border-subtle);
  padding: 0.38rem clamp(0.40rem, 0.6vw, 0.85rem);
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: clamp(0.20rem, 0.35vw, 0.45rem);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.nav-tab {
  flex: 1 1 auto;
  height: 36px;
  padding: 0 clamp(0.35rem, 0.55vw, 0.75rem);
  font-size: clamp(0.70rem, 0.76vw, 0.82rem);
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.035);
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  text-align: center;
}

.nav-tab i {
  font-size: clamp(0.74rem, 0.80vw, 0.86rem);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-tab span {
  white-space: nowrap;
}

.nav-tab[data-tab="owner-dashboard"] i { color: var(--mustard-gold); }
.nav-tab[data-tab="debit-note-analysis"] i { color: var(--accent-cyan); }
.nav-tab[data-tab="employee-hub"] i { color: var(--accent-blue); }
.nav-tab[data-tab="supplier-intelligence"] i { color: #c084fc; }
.nav-tab[data-tab="quality-analytics"] i { color: #ec4899; }
.nav-tab[data-tab="sarso-prediction"] i { color: #10b981; }
.nav-tab[data-tab="global-commodities"] i { color: #38bdf8; }
.nav-tab[data-tab="ai-anomalies"] i { color: #ef4444; }
.nav-tab[data-tab="data-audit"] i { color: #a78bfa; }
.nav-tab[data-tab="formula-guide"] i { color: #f59e0b; }
.nav-tab[data-tab="google-sync"] i { color: #06b6d4; }

.nav-tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(245, 158, 11, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-tab:hover:not(.active) i {
  transform: scale(1.12);
}

.nav-tab:active {
  transform: translateY(0px) scale(0.98);
}

.nav-tab.active {
  color: var(--mustard-gold);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(217, 119, 6, 0.10) 100%);
  border-color: var(--mustard-gold);
  font-weight: 800;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.22), 0 2px 4px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.nav-tab.active i {
  color: var(--mustard-gold) !important;
  transform: scale(1.08);
}

.nav-tab .tab-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: clamp(0.62rem, 0.66vw, 0.70rem);
  color: var(--text-muted);
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.nav-tab.active .tab-badge {
  background: var(--mustard-gold);
  color: #000000;
  border-color: var(--mustard-gold);
}

/* Light theme high-contrast active tab */
[data-theme="light"] .nav-tab.active {
  color: #92400e;
  background: rgba(245, 158, 11, 0.12);
  border-color: #d97706;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .nav-tab.active i {
  color: #d97706 !important;
}

[data-theme="light"] .nav-tab.active .tab-badge {
  background: #fde68a;
  color: #78350f;
  border-color: #d97706;
}

/* ==========================================================================
   TRANSACTIONS TAB FILTERED BLINK & PULSE ANIMATION (ELECTRIC SKY BLUE)
   Distinct from Mustard Gold Active Tab so Active vs Filtered is 100% Clear
   ========================================================================== */

/* Light Theme Animation (Crisp Sky Blue) */
@keyframes txTabBlinkPulseLight {
  0%, 100% {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border-color: var(--border-subtle);
    background: #ffffff;
    transform: translateY(0) scale(1);
    color: var(--text-secondary);
  }
  30%, 70% {
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.4), 0 2px 6px rgba(2, 132, 199, 0.18);
    border-color: #0284c7;
    background: #e0f2fe;
    color: #0369a1 !important;
    transform: translateY(-2px) scale(1.03);
  }
}

@keyframes txBadgePulseLight {
  0%, 100% {
    background: rgba(2, 132, 199, 0.15);
    color: #0369a1;
    border-color: rgba(2, 132, 199, 0.35);
    transform: scale(1);
  }
  30%, 70% {
    background: #0284c7;
    color: #ffffff;
    border-color: #0369a1;
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.45);
    transform: scale(1.12);
  }
}

/* Dark Theme Animation (Vibrant Electric Cyan/Blue) */
@keyframes txTabBlinkPulseDark {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    border-color: var(--border-subtle);
    background: rgba(255, 255, 255, 0.035);
    transform: translateY(0) scale(1);
    color: var(--text-secondary);
  }
  30%, 70% {
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.65), 0 0 28px rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22) 0%, rgba(2, 132, 199, 0.14) 100%);
    color: #e0f2fe !important;
    transform: translateY(-2px) scale(1.03);
  }
}

@keyframes txBadgePulseDark {
  0%, 100% {
    background: rgba(56, 189, 248, 0.22);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.5);
    transform: scale(1);
  }
  30%, 70% {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
    transform: scale(1.12);
  }
}

/* Default / Dark Theme Blink Rule (Electric Cyan) */
.nav-tab[data-tab="employee-hub"].tab-filtered-blink {
  animation: txTabBlinkPulseDark 1.4s cubic-bezier(0.4, 0, 0.2, 1) 4;
  z-index: 10;
  border-color: #38bdf8 !important;
  color: #e0f2fe !important;
  font-weight: 800 !important;
}

.nav-tab[data-tab="employee-hub"].tab-filtered-blink i {
  color: #38bdf8 !important;
  transform: scale(1.18);
  filter: drop-shadow(0 0 8px #38bdf8);
}

.nav-tab[data-tab="employee-hub"].tab-filtered-blink .tab-badge {
  animation: txBadgePulseDark 1.4s cubic-bezier(0.4, 0, 0.2, 1) 4;
  border-color: #38bdf8 !important;
}

/* Light Theme Specific Blink Overrides */
[data-theme="light"] .nav-tab[data-tab="employee-hub"].tab-filtered-blink {
  animation: txTabBlinkPulseLight 1.4s cubic-bezier(0.4, 0, 0.2, 1) 4;
  border-color: #0284c7 !important;
  color: #0369a1 !important;
}

[data-theme="light"] .nav-tab[data-tab="employee-hub"].tab-filtered-blink i {
  color: #0284c7 !important;
  filter: drop-shadow(0 1px 2px rgba(2, 132, 199, 0.3));
}

[data-theme="light"] .nav-tab[data-tab="employee-hub"].tab-filtered-blink .tab-badge {
  animation: txBadgePulseLight 1.4s cubic-bezier(0.4, 0, 0.2, 1) 4;
  border-color: #0284c7 !important;
}

/* Gentle persistent indicator when filters are active on non-active Transactions tab (Dark Theme) */
.nav-tab[data-tab="employee-hub"].has-filtered-data:not(.active):not(.tab-filtered-blink) {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.08);
  color: #e2e8f0;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

.nav-tab[data-tab="employee-hub"].has-filtered-data:not(.active):not(.tab-filtered-blink) i {
  color: #38bdf8;
}

.nav-tab[data-tab="employee-hub"].has-filtered-data:not(.active):not(.tab-filtered-blink) .tab-badge {
  background: rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.55);
  font-weight: 800;
}

/* Gentle persistent indicator (Light Theme) */
[data-theme="light"] .nav-tab[data-tab="employee-hub"].has-filtered-data:not(.active):not(.tab-filtered-blink) {
  border-color: rgba(2, 132, 199, 0.5);
  background: #f0f9ff;
  color: #0369a1;
  font-weight: 700;
}

[data-theme="light"] .nav-tab[data-tab="employee-hub"].has-filtered-data:not(.active):not(.tab-filtered-blink) i {
  color: #0284c7;
}

[data-theme="light"] .nav-tab[data-tab="employee-hub"].has-filtered-data:not(.active):not(.tab-filtered-blink) .tab-badge {
  background: #bae6fd;
  color: #075985;
  border-color: rgba(2, 132, 199, 0.5);
  font-weight: 800;
}

/* Dynamic Responsive Auto-Fit across All Screen Sizes - 100% Full Width Edge-to-Edge */
@media (max-width: 1650px) {
  .app-nav {
    flex-wrap: wrap;
    gap: 0.30rem 0.38rem;
  }
  .nav-tab {
    flex: 1 1 calc(16.666% - 0.35rem);
    height: 35px;
    font-size: 0.74rem;
  }
}

@media (max-width: 1024px) {
  .app-nav {
    padding: 0.32rem 0.40rem;
    gap: 0.26rem 0.30rem;
  }
  .nav-tab {
    flex: 1 1 calc(25% - 0.30rem);
    min-width: 110px;
    height: 34px;
    font-size: 0.72rem;
  }
}

@media (max-width: 768px) {
  .app-nav {
    padding: 0.28rem 0.35rem;
    gap: 0.22rem 0.25rem;
  }
  .nav-tab {
    flex: 1 1 calc(33.333% - 0.25rem);
    min-width: 90px;
    height: 33px;
    font-size: 0.70rem;
  }
}

@media (max-width: 480px) {
  .app-nav {
    padding: 0.25rem 0.25rem;
    gap: 0.20rem;
  }
  .nav-tab {
    flex: 1 1 calc(50% - 0.20rem);
    min-width: 75px;
    height: 32px;
    font-size: 0.67rem;
  }
}

/* Global Filter Toolbar */
.filter-toolbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
  font-size: 0.90rem;
  color: var(--text-secondary);
}

.filter-item select,
.filter-item input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.90rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.filter-item select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Custom Styled Date Range Picker with Formatted Month Names */
.date-range-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.65rem;
  transition: var(--transition-fast);
}

.date-range-picker-wrap:hover {
  border-color: var(--mustard-gold);
}

/* ==============================================================================
   Active Filter Indicators, Inputs & Interactive Chips Bar (Light & Dark Ready)
   ============================================================================== */
.dn-filter-input,
.dn-filter-select,
select.dn-filter-select,
input.dn-filter-input {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  outline: none;
}

.dn-filter-input:focus,
.dn-filter-select:focus {
  border-color: var(--mustard-gold) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

[data-theme="light"] .dn-filter-input,
[data-theme="light"] .dn-filter-select,
[data-theme="light"] select.dn-filter-select,
[data-theme="light"] input.dn-filter-input {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .dn-filter-input::placeholder {
  color: #64748b !important;
  opacity: 1;
}

[data-theme="light"] select option {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* Active Highlight when filter is engaged */
.filter-active-control,
select.filter-active-control,
input.filter-active-control {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.18) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35), 0 2px 8px rgba(245, 158, 11, 0.15) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  transition: all 0.2s ease;
}

.filter-active-control::placeholder {
  color: #fde68a !important;
}

/* Light theme Active Filter Highlight - High Contrast Amber */
[data-theme="light"] .filter-active-control,
[data-theme="light"] select.filter-active-control,
[data-theme="light"] input.filter-active-control {
  background: #fef3c7 !important;
  border-color: #d97706 !important;
  color: #78350f !important;
  font-weight: 800 !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.3), 0 2px 6px rgba(217, 119, 6, 0.12) !important;
}

[data-theme="light"] .filter-active-control::placeholder {
  color: #92400e !important;
}

.filter-active-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59e0b;
  color: #000;
  font-size: 0.70rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}

.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  margin-top: 0.65rem;
  animation: fadeIn 0.25s ease-in-out;
}

[data-theme="light"] .active-filters-bar {
  background: #fffbeb !important;
  border: 1.5px solid #fcd34d !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.06);
}

.active-filters-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--mustard-gold);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="light"] .active-filters-label {
  color: #92400e !important;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .active-filter-chip {
  background: #ffffff !important;
  border: 1.5px solid #d97706 !important;
  color: #1e293b !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.12) !important;
}

.active-filter-chip strong {
  color: var(--mustard-gold);
}

[data-theme="light"] .active-filter-chip strong {
  color: #b45309 !important;
  font-weight: 800 !important;
}

.active-filter-chip .btn-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  border: none;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  font-size: 0.70rem;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

[data-theme="light"] .active-filter-chip .btn-chip-remove {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  font-weight: 800;
}

.active-filter-chip .btn-chip-remove:hover {
  background: var(--danger-red) !important;
  color: #fff !important;
  transform: scale(1.15);
}

.btn-clear-all-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px dashed rgba(239, 68, 68, 0.5);
  color: var(--danger-red);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
}

[data-theme="light"] .btn-clear-all-chips {
  background: #fee2e2 !important;
  border: 1px solid #f87171 !important;
  color: #b91c1c !important;
  font-weight: 800 !important;
}

.btn-clear-all-chips:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger-red);
  color: #ef4444;
}

.custom-date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

[data-theme="light"] .custom-date-field {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.09);
}

.custom-date-field:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
}

.custom-date-field .date-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--mustard-gold);
  white-space: nowrap;
  letter-spacing: 0.01em;
  pointer-events: none;
}

[data-theme="light"] .custom-date-field .date-text {
  color: #b45309;
}

.custom-date-field .hidden-date-picker {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  border: none;
  padding: 0;
  margin: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--mustard-amber), var(--mustard-gold));
  color: #000;
  border: none;
  font-weight: 600;
  font-size: 0.90rem;
  padding: 0.48rem 1.05rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-weight: 500;
  font-size: 0.90rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--mustard-gold);
}

/* Main Content Area - Full Screen Responsive */
.app-container {
  width: 98%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

/* Tab Views */
.tab-view {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.tab-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* KPI Card Grid — Flexible & Auto-Filling across all screen sizes */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

/* 7-Card Grid (Owner Dashboard) */
.kpi-grid-7 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

@media (min-width: 600px) {
  .kpi-grid-7 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .kpi-grid-7 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .kpi-grid-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }
}

/* 6-Card Grid (Debit Note & Costing Analysis — 100% Full Width Auto Fill) */
.kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

@media (min-width: 600px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.75rem;
  position: relative;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 148px;
}

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

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

.kpi-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.kpi-icon {
  font-size: 1.3rem;
  color: var(--mustard-gold);
}

.kpi-value {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 2.25rem;
  font-weight: 850;
  color: var(--text-primary);
  line-height: 1.1;
  margin-top: 0.15rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  letter-spacing: -0.035em;
}

/* Refined, eye-friendly semantic accents */
.kpi-value-red {
  color: #dc2626 !important;
}
[data-theme="dark"] .kpi-value-red {
  color: #f87171 !important;
}

.kpi-value-green {
  color: #059669 !important;
}
[data-theme="dark"] .kpi-value-green {
  color: #34d399 !important;
}

.kpi-value-blue,
.kpi-value-purple,
.kpi-value-cyan,
.kpi-value-gold,
.kpi-value-orange {
  color: var(--text-primary) !important;
}

.kpi-unit {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0;
  margin-left: 3px;
}

.kpi-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* Date Summary Pills in Chart Header */
.date-summary-pill {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.date-summary-pill.interactive-pill {
  cursor: pointer;
  user-select: none;
}
.date-summary-pill.interactive-pill:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  filter: brightness(1.05);
}
.date-summary-pill.interactive-pill:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.date-summary-pill.interactive-pill:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* KPI Card Action / Popup Buttons — Modern SaaS Pill Badge */
.kpi-action-btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  outline: none !important;
  border: 1px solid transparent !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  margin-top: 0.45rem;
  width: 100%;
  height: 29px;
  padding: 0 8px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box !important;
}

.kpi-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.kpi-action-btn:active {
  transform: translateY(0);
  transform: scale(0.98);
}

.kpi-action-btn.btn-gold {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #f59e0b !important;
}

.kpi-action-btn.btn-gold:hover {
  background: rgba(245, 158, 11, 0.22) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.25) !important;
}

.kpi-action-btn.btn-red {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #ef4444 !important;
}

.kpi-action-btn.btn-red:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.25) !important;
}

.kpi-action-btn.btn-neutral {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
  color: #3b82f6 !important;
}

.kpi-action-btn.btn-neutral:hover {
  background: rgba(59, 130, 246, 0.22) !important;
  border-color: #3b82f6 !important;
  color: #60a5fa !important;
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.25) !important;
}

[data-theme="light"] .kpi-action-btn.btn-gold {
  background: #fef3c7 !important;
  border-color: #fde68a !important;
  color: #b45309 !important;
}

[data-theme="light"] .kpi-action-btn.btn-gold:hover {
  background: #fde68a !important;
  border-color: #f59e0b !important;
  color: #92400e !important;
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.2) !important;
}

[data-theme="light"] .kpi-action-btn.btn-red {
  background: #fee2e2 !important;
  border-color: #fecaca !important;
  color: #dc2626 !important;
}

[data-theme="light"] .kpi-action-btn.btn-red:hover {
  background: #fecaca !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.2) !important;
}

[data-theme="light"] .kpi-action-btn.btn-neutral {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #2563eb !important;
}

[data-theme="light"] .kpi-action-btn.btn-neutral:hover {
  background: #dbeafe !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.2) !important;
}

/* Subtle KPI Status Tag for non-button cards */
.kpi-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  margin-top: 0.45rem;
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

.kpi-status-tag.tag-blue {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #38bdf8;
}

.kpi-status-tag.tag-purple {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #a78bfa;
}

.kpi-status-tag.tag-cyan {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: #22d3ee;
}

.kpi-status-tag.tag-emerald {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
}

[data-theme="light"] .kpi-status-tag.tag-blue {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0284c7;
}

[data-theme="light"] .kpi-status-tag.tag-purple {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #7c3aed;
}

[data-theme="light"] .kpi-status-tag.tag-cyan {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #0891b2;
}

[data-theme="light"] .kpi-status-tag.tag-emerald {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

.trend-badge {
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.trend-badge.danger {
  background: var(--danger-bg);
  color: var(--danger-red);
}

.trend-badge.success {
  background: var(--success-bg);
  color: var(--success-green);
}

.trend-badge.neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* Dashboard Sections Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.grid-full {
  grid-column: 1 / -1;
}

/* Card Component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  min-width: 0;
}

.dashboard-grid>* {
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.18rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.chart-container-tall {
  height: 340px;
}

.chart-container-large {
  height: 460px;
}

/* Tables — Zero Horizontal Sliding across all pages */
.table-responsive,
.table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  /* Zero sliding / horizontal scrollbars across all tables! */
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
}

/* Completely suppress horizontal scrollbar tracks */
.table-responsive::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  height: 0px !important;
  width: 6px;
}

.data-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 0.94rem;
  text-align: left;
  table-layout: auto;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 25;
}

.data-table th {
  background: linear-gradient(180deg, #1e293b 0%, #111e33 100%);
  color: #f8fafc;
  font-weight: 800;
  font-size: 0.86rem;
  padding: 0.85rem 0.95rem;
  border-top: none;
  border-bottom: 2.5px solid #475569;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  white-space: normal;
  /* Allow clean cell wrapping so table fits 100% width without sliding! */
  position: sticky;
  top: 0;
  z-index: 25;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background-color 0.2s ease, filter 0.2s ease;
  background-clip: padding-box;
}

/* Upward flush shield: Prevents scrolled row data from leaking above the header */
.data-table th::before,
.data-table thead th::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 9px;
  background: inherit;
  z-index: 26;
  pointer-events: none;
}

[data-theme="light"] .data-table th {
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%) !important;
  color: #0f172a !important;
  border-top: none !important;
  border-bottom: 2.5px solid #94a3b8 !important;
  border-right: 1px solid #cbd5e1 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08) !important;
}

.data-table th:hover {
  filter: brightness(1.08);
}

.data-table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.94rem;
  white-space: normal;
  /* No horizontal overflow! Fits full screen without sliding! */
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.80rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-green);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-orange);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-red);
}

.badge-gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--mustard-gold);
}

.badge-gray {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* AI Insight Alert Cards */
.ai-insight-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ai-insight-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--mustard-gold);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: var(--transition-fast);
}

.ai-insight-card:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.ai-insight-card.alert {
  border-left-color: var(--danger-red);
}

.ai-insight-card.success {
  border-left-color: var(--success-green);
}

.ai-insight-card.info {
  border-left-color: var(--accent-blue);
}

.insight-cat {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mustard-gold);
  margin-bottom: 0.2rem;
}

.insight-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.insight-body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0.6rem;
}

.citation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.citation-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Interactive Calculator */
.calc-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input-field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-field input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
  transition: var(--transition-fast);
}

.input-field input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px var(--mustard-glow);
}

.calc-result-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.calc-result-title {
  font-size: 0.94rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.calc-result-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.65rem;
  font-weight: 800;
  color: var(--mustard-gold);
  margin: 0.25rem 0;
}

.calc-result-diff {
  font-size: 1.02rem;
  font-weight: 700;
}

.formula-math-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: monospace;
  font-size: 0.98rem;
  color: var(--accent-blue);
  margin-top: 0.75rem;
  width: 100%;
}

/* Modal Overlay & Dialogs — Ultra-Clean Enterprise SaaS Style */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  max-width: 1060px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: modalScale 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="light"] .modal-dialog {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

@keyframes modalScale {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .modal-header {
  border-bottom: 1px solid #e2e8f0;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  transform: rotate(90deg);
}

[data-theme="light"] .modal-close-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

[data-theme="light"] .modal-close-btn:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
}

.modal-body {
  padding: 1.25rem 1.4rem;
}

/* Modal Stat Card */
.modal-stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  transition: all 0.2s ease;
}

[data-theme="light"] .modal-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Modal Formula Card */
.modal-formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.85rem;
}

[data-theme="light"] .modal-formula-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* Modal Formula Pill / Code Block */
.modal-formula-pill {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
  padding: 6px 9px;
  border-radius: 5px;
  margin-bottom: 7px;
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .modal-formula-pill {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

/* Modal Callout Note */
.modal-callout {
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

.modal-callout.callout-red {
  background: rgba(239, 68, 68, 0.08);
  border-left: 4px solid #ef4444;
  color: var(--text-primary);
}

[data-theme="light"] .modal-callout.callout-red {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
  color: #1e293b;
}

.modal-callout.callout-amber {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid #f59e0b;
  color: var(--text-primary);
}

[data-theme="light"] .modal-callout.callout-amber {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  color: #1e293b;
}

/* ========================================================================== */
/* Executive Audit Modal 6-Card Grid & High-Contrast Cards                     */
/* ========================================================================== */
.modal-section-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

[data-theme="light"] .modal-section-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.audit-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

@media (max-width: 1040px) {
  .audit-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .audit-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.audit-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .audit-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.audit-card-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

[data-theme="light"] .audit-card-title {
  color: #475569;
}

.audit-card-value {
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0.25rem 0;
}

.audit-card-sub {
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Card 1: Blue (Purchase Rate) */
.audit-card-blue .audit-card-value { color: #0284c7; }
[data-theme="dark"] .audit-card-blue .audit-card-value { color: #38bdf8; }
.audit-card-blue .audit-card-sub { color: #0369a1; }
[data-theme="dark"] .audit-card-blue .audit-card-sub { color: #94a3b8; }

/* Card 2: Red (Net Deductions) */
.audit-card-red .audit-card-value { color: #dc2626; }
[data-theme="dark"] .audit-card-red .audit-card-value { color: #f87171; }
.audit-card-red .audit-card-sub { color: #b91c1c; }
[data-theme="dark"] .audit-card-red .audit-card-sub { color: #fca5a5; }

/* Card 3: Green (Landing Cost) */
.audit-card-green .audit-card-value { color: #059669; }
[data-theme="dark"] .audit-card-green .audit-card-value { color: #34d399; }
.audit-card-green .audit-card-sub { color: #047857; }
[data-theme="dark"] .audit-card-green .audit-card-sub { color: #6ee7b7; }

/* Card 4: Purple (Lab Oil) */
.audit-card-purple .audit-card-value { color: #7c3aed; }
[data-theme="dark"] .audit-card-purple .audit-card-value { color: #c084fc; }
.audit-card-purple .audit-card-sub { color: #6d28d9; }
[data-theme="dark"] .audit-card-purple .audit-card-sub { color: #d8b4fe; }

/* Card 5: Gold (42% Costing) */
.audit-card-gold .audit-card-value { color: #d97706; }
[data-theme="dark"] .audit-card-gold .audit-card-value { color: #fbbf24; }
.audit-card-gold .audit-card-sub { color: #b45309; }
[data-theme="dark"] .audit-card-gold .audit-card-sub { color: #fde68a; }

/* Card 6: Loss vs Profit Result */
.audit-card-result-loss {
  background: #fef2f2 !important;
  border: 2px solid #ef4444 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15) !important;
}
.audit-card-result-loss .audit-card-title {
  color: #991b1b !important;
  font-weight: 800 !important;
}
.audit-card-result-loss .audit-card-value {
  color: #dc2626 !important;
  font-weight: 900 !important;
}
.audit-card-result-loss .audit-card-sub {
  color: #b91c1c !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .audit-card-result-loss {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.35) 0%, rgba(185, 28, 28, 0.45) 100%) !important;
  border: 2px solid #ef4444 !important;
}
[data-theme="dark"] .audit-card-result-loss .audit-card-title {
  color: #fee2e2 !important;
}
[data-theme="dark"] .audit-card-result-loss .audit-card-value {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
[data-theme="dark"] .audit-card-result-loss .audit-card-sub {
  color: #fca5a5 !important;
}

.audit-card-result-profit {
  background: #ecfdf5 !important;
  border: 2px solid #10b981 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15) !important;
}
.audit-card-result-profit .audit-card-title {
  color: #065f46 !important;
  font-weight: 800 !important;
}
.audit-card-result-profit .audit-card-value {
  color: #059669 !important;
  font-weight: 900 !important;
}
.audit-card-result-profit .audit-card-sub {
  color: #047857 !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .audit-card-result-profit {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.45) 100%) !important;
  border: 2px solid #10b981 !important;
}
[data-theme="dark"] .audit-card-result-profit .audit-card-title {
  color: #d1fae5 !important;
}
[data-theme="dark"] .audit-card-result-profit .audit-card-value {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
[data-theme="dark"] .audit-card-result-profit .audit-card-sub {
  color: #6ee7b7 !important;
}

/* Modal Table Wrapper — Zero extra vertical whitespace */
.modal-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: none !important;
  min-height: unset !important;
  height: auto !important;
}

[data-theme="light"] .modal-table-wrap {
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.modal-body .table-container,
.modal-body .table-responsive {
  min-height: unset !important;
  height: auto !important;
  max-height: 420px !important;
  box-shadow: none !important;
}

.modal-table-wrap .data-table,
.modal-body .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.modal-table-wrap .data-table th,
.modal-body .data-table th {
  padding: 0.65rem 0.6rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .modal-table-wrap .data-table th,
[data-theme="light"] .modal-body .data-table th {
  background: #f1f5f9;
  color: #334155;
  border-bottom: 1px solid #cbd5e1;
}

.modal-table-wrap .data-table td,
.modal-body .data-table td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .modal-table-wrap .data-table td,
[data-theme="light"] .modal-body .data-table td {
  border-bottom: 1px solid #e2e8f0;
}

/* Pagination Controls */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  margin-top: 0.5rem;
  font-size: 0.90rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 0.35rem;
}

.page-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.90rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  color: var(--mustard-gold);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn.active {
  background: var(--mustard-gold);
  color: #000;
  border-color: var(--mustard-gold);
}

/* Universal Responsive Table Pagination Bar: Balanced Left & Right */
.table-pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.10);
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

.table-pagination-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.table-pagination-summary {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.table-pagination-pagesize {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-pagination-pagesize select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.table-pagination-pagesize select:focus {
  border-color: var(--mustard-gold);
}

/* Right Side: Page navigation buttons pushed to the far right */
.table-pagination-right,
.table-pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  /* Always keeps buttons right-aligned */
}

.table-pagination-right .pagination-buttons,
.table-pagination-controls .pagination-buttons,
.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 640px) {
  .table-pagination-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 0.6rem;
  }

  .table-pagination-left {
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
  }

  .table-pagination-right,
  .table-pagination-controls {
    justify-content: center;
    width: 100%;
    margin-left: 0;
  }

  .table-pagination-right .pagination-buttons,
  .table-pagination-controls .pagination-buttons,
  .pagination-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .calc-box {
    grid-template-columns: 1fr;
  }

  .brand-title-group h1 {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cost-story-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-arrow {
    display: none;
  }

  .chart-container-large {
    height: 350px;
  }
}

/* Ensure no horizontal page overflow */
html,
body {
  max-width: 100vw;
  overflow-x: hidden;
}

/* FULL VIEW Large Screen Table Container */
.table-container,
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  /* Full view! Zero horizontal scrollbar or sliding! */
  overflow-y: auto;
  max-height: 74vh !important;
  /* Expands to fill screen height! */
  min-height: 520px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.table-container::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  height: 0px !important;
  /* Zero horizontal sliding bar at bottom */
  width: 6px;
}

@media (max-width: 768px) {

  .table-container,
  .table-responsive {
    overflow-x: auto !important;
    /* Only fallback on mobile */
    -webkit-overflow-scrolling: touch;
    max-height: 600px !important;
  }
}

.data-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 0.95rem;
  /* Enlarged high-visibility font */
  text-align: left;
  table-layout: auto;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 25;
}

.data-table thead th {
  padding: 0.90rem 1rem;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #1e293b 0%, #111e33 100%);
  color: #f8fafc;
  border-top: none !important;
  border-bottom: 2.5px solid #475569;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  position: sticky;
  top: 0;
  z-index: 25;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  vertical-align: middle;
  background-clip: padding-box;
}

/* Upward flush shield on all table headers: blocks scrolled content from ever peeking above the header */
.data-table th::before,
.data-table thead th::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 9px;
  background-color: #1e293b;
  z-index: 26;
  pointer-events: none;
}

[data-theme="light"] .data-table th::before,
[data-theme="light"] .data-table thead th::before {
  background-color: #f8fafc !important;
}

[data-theme="light"] .data-table thead th {
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%) !important;
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-top: none !important;
  border-bottom: 2.5px solid #94a3b8 !important;
  border-right: 1px solid #cbd5e1 !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08) !important;
}

/* ==========================================================================
   DISTINCT COLOR-CODED FINANCIAL COLUMN HEADERS (DARK & LIGHT)
   ========================================================================== */

/* 1. Purchase / Mandi Rate (Blue Accent) */
.th-col-rate,
.th-col-billed {
  text-align: right;
  color: #60a5fa !important;
  background: linear-gradient(180deg, #172554 0%, #1e3a8a 100%) !important;
  background-color: #172554 !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #3b82f6, 0 4px 10px rgba(0, 0, 0, 0.35) !important;
  border-bottom: 3px solid #2563eb !important;
  border-right: 1px solid rgba(59, 130, 246, 0.25) !important;
}
.th-col-rate::before,
.th-col-billed::before {
  background-color: #172554 !important;
}
[data-theme="light"] .th-col-rate,
[data-theme="light"] .th-col-billed {
  color: #1e40af !important;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%) !important;
  background-color: #eff6ff !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #3b82f6, 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 3px solid #2563eb !important;
  border-right: 1px solid #bfdbfe !important;
}
[data-theme="light"] .th-col-rate::before,
[data-theme="light"] .th-col-billed::before {
  background-color: #eff6ff !important;
}

/* 2. Katoti Cuts / Deductions (Red Accent) */
.th-col-cuts,
.th-col-katoti {
  text-align: right;
  color: #f87171 !important;
  background: linear-gradient(180deg, #450a0a 0%, #7f1d1d 100%) !important;
  background-color: #450a0a !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #ef4444, 0 4px 10px rgba(0, 0, 0, 0.35) !important;
  border-bottom: 3px solid #dc2626 !important;
  border-right: 1px solid rgba(239, 68, 68, 0.25) !important;
}
.th-col-cuts::before,
.th-col-katoti::before {
  background-color: #450a0a !important;
}
[data-theme="light"] .th-col-cuts,
[data-theme="light"] .th-col-katoti {
  color: #991b1b !important;
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%) !important;
  background-color: #fef2f2 !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #ef4444, 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 3px solid #dc2626 !important;
  border-right: 1px solid #fecaca !important;
}
[data-theme="light"] .th-col-cuts::before,
[data-theme="light"] .th-col-katoti::before {
  background-color: #fef2f2 !important;
}

/* 3. Factory Landing Cost (Green Accent) */
.th-col-landing {
  text-align: right;
  color: #34d399 !important;
  background: linear-gradient(180deg, #064e3b 0%, #065f46 100%) !important;
  background-color: #064e3b !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #10b981, 0 4px 10px rgba(0, 0, 0, 0.35) !important;
  border-bottom: 3px solid #059669 !important;
  border-right: 1px solid rgba(160, 185, 129, 0.25) !important;
}
.th-col-landing::before {
  background-color: #064e3b !important;
}
[data-theme="light"] .th-col-landing {
  color: #166534 !important;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%) !important;
  background-color: #f0fdf4 !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #10b981, 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 3px solid #16a34a !important;
  border-right: 1px solid #bbf7d0 !important;
}
[data-theme="light"] .th-col-landing::before {
  background-color: #f0fdf4 !important;
}

/* 4. Laboratory Tested Oil % (Purple Accent) */
.th-col-oil {
  text-align: center;
  color: #c084fc !important;
  background: linear-gradient(180deg, #3b0764 0%, #581c87 100%) !important;
  background-color: #3b0764 !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #a855f7, 0 4px 10px rgba(0, 0, 0, 0.35) !important;
  border-bottom: 3px solid #9333ea !important;
  border-right: 1px solid rgba(168, 85, 247, 0.25) !important;
}
.th-col-oil::before {
  background-color: #3b0764 !important;
}
[data-theme="light"] .th-col-oil {
  color: #581c87 !important;
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%) !important;
  background-color: #faf5ff !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #a855f7, 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 3px solid #9333ea !important;
  border-right: 1px solid #e9d5ff !important;
}
[data-theme="light"] .th-col-oil::before {
  background-color: #faf5ff !important;
}

/* 5. 42% Standard Benchmark Cost (Gold / Amber Accent) */
.th-col-cost42 {
  text-align: right;
  color: #fbbf24 !important;
  font-weight: 800 !important;
  background: linear-gradient(180deg, #451a03 0%, #78350f 100%) !important;
  background-color: #451a03 !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #f59e0b, 0 4px 10px rgba(0, 0, 0, 0.35) !important;
  border-bottom: 3px solid #d97706 !important;
  border-right: 1px solid rgba(245, 158, 11, 0.3) !important;
}
.th-col-cost42::before {
  background-color: #451a03 !important;
}
[data-theme="light"] .th-col-cost42 {
  color: #78350f !important;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%) !important;
  background-color: #fffbeb !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #f59e0b, 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 3px solid #d97706 !important;
  border-right: 1px solid #fde68a !important;
}
[data-theme="light"] .th-col-cost42::before {
  background-color: #fffbeb !important;
}

/* 6. Rate Difference / Financial Impact (Dark Slate & Amber Accent) */
.th-col-diff,
.th-col-impact {
  text-align: right;
  color: #f1f5f9 !important;
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%) !important;
  background-color: #1e293b !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #f59e0b, 0 4px 10px rgba(0, 0, 0, 0.35) !important;
  border-bottom: 3px solid #475569 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.th-col-diff::before,
.th-col-impact::before {
  background-color: #1e293b !important;
}
[data-theme="light"] .th-col-diff,
[data-theme="light"] .th-col-impact {
  color: #0f172a !important;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%) !important;
  background-color: #f8fafc !important;
  border-top: none !important;
  box-shadow: inset 0 3px 0 #d97706, 0 3px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 3px solid #94a3b8 !important;
  border-right: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .th-col-diff::before,
[data-theme="light"] .th-col-impact::before {
  background-color: #f8fafc !important;
}

/* 7. Action / Audit Column */
.th-col-audit {
  text-align: center;
  color: var(--text-muted) !important;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
  background-color: #0f172a !important;
  border-top: none !important;
  border-bottom: 2.5px solid #475569 !important;
}
.th-col-audit::before {
  background-color: #0f172a !important;
}
[data-theme="light"] .th-col-audit {
  color: #475569 !important;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%) !important;
  background-color: #f1f5f9 !important;
  border-top: none !important;
  border-bottom: 2.5px solid #94a3b8 !important;
}
[data-theme="light"] .th-col-audit::before {
  background-color: #f1f5f9 !important;
}

.data-table td {
  padding: 0.85rem 1rem;
  /* Spacious, readable row height */
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.95rem;
  vertical-align: middle;
  white-space: normal;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

/* Premium Financial Inputs with Zero Overlap */
.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.calc-input-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.currency-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.currency-prefix {
  position: absolute;
  left: 0.85rem;
  color: var(--mustard-gold);
  font-weight: 700;
  font-size: 1.08rem;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.styled-calc-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 600;
  padding: 0.6rem 0.85rem;
  transition: var(--transition-fast);
  outline: none;
  box-sizing: border-box;
}

.styled-calc-input.has-prefix {
  padding-left: 2.25rem !important;
  /* 36px clearance so typed numbers NEVER touch or overlap the ₹ icon */
}

.styled-calc-input:focus {
  border-color: var(--mustard-gold) !important;
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

/* Light Theme Inputs */
[data-theme="light"] .styled-calc-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .styled-calc-input:focus {
  background: #ffffff !important;
  border-color: #d97706 !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2) !important;
}

/* Story Highlight Step Banner — Dual Theme High Contrast */
.cost-story-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.story-step {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 135px;
}

.story-step-label {
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #cbd5e1;
  /* Clear silver-white in dark theme */
}

.story-step-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.story-step-sub {
  font-size: 0.86rem;
  color: #94a3b8;
  /* Clear legible grey in dark theme */
  font-weight: 500;
}

.story-arrow {
  color: var(--mustard-gold);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  opacity: 0.9;
}

.story-step-danger {
  background: rgba(239, 68, 68, 0.15);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--danger-red);
}

.story-step-danger .story-step-label {
  color: #fca5a5;
}

.story-step-danger .story-step-sub {
  color: #fca5a5;
  font-weight: 600;
}

.story-step-success {
  background: rgba(34, 197, 94, 0.15);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--success-green);
}

.story-step-success .story-step-label {
  color: #86efac;
}

.story-step-success .story-step-sub {
  color: #86efac;
  font-weight: 600;
}

/* Light Theme Story Banner Styles */
[data-theme="light"] .cost-story-banner {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .story-step-label {
  color: #475569 !important;
  /* Bold legible dark slate in light theme */
}

[data-theme="light"] .story-step-sub {
  color: #64748b !important;
  /* Crisp dark grey in light theme */
}

[data-theme="light"] .story-step-value {
  color: #0f172a !important;
}

[data-theme="light"] .story-arrow {
  color: #d97706 !important;
}

[data-theme="light"] .story-step-danger {
  background: #fef2f2 !important;
  border-left: 3px solid #dc2626 !important;
}

[data-theme="light"] .story-step-danger .story-step-label {
  color: #991b1b !important;
  /* Rich deep red in light theme */
}

[data-theme="light"] .story-step-danger .story-step-sub {
  color: #b91c1c !important;
  /* Rich deep red in light theme */
}

[data-theme="light"] .story-step-success {
  background: #f0fdf4 !important;
  border-left: 3px solid #16a34a !important;
}

[data-theme="light"] .story-step-success .story-step-label {
  color: #166534 !important;
}

[data-theme="light"] .story-step-success .story-step-sub {
  color: #15803d !important;
}

/* Custom Column Badges for Clear Story — Scaled for Large Screen Visibility */
/* ==========================================================================
   DISTINCT FINANCIAL VALUE BADGES (PURCHASE RATE VS 42% COST)
   ========================================================================== */

/* 1. Purchase Rate: Cool Sapphire Blue Theme with distinct border & cart cue */
.badge-rate {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(59, 130, 246, 0.22) 100%);
  color: #1d4ed8;
  font-weight: 800;
  font-size: 0.96rem;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px solid rgba(59, 130, 246, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .badge-rate {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35) 0%, rgba(37, 99, 235, 0.22) 100%);
  color: #60a5fa;
  border: 1.5px solid rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .badge-rate {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1.5px solid #93c5fd;
}

.badge-ded {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-red);
  font-weight: 800;
  font-size: 0.96rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.badge-landing {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-green);
  font-weight: 800;
  font-size: 0.96rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.badge-oil {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  font-weight: 800;
  font-size: 0.96rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* 2. 42% Standard Cost: Premium Amber-Gold Star Benchmark with luxury glow */
.badge-cost42 {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.20) 0%, rgba(217, 119, 6, 0.30) 100%);
  color: #92400e;
  font-weight: 900;
  font-size: 1.02rem;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1.5px solid rgba(245, 158, 11, 0.75);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.20);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .badge-cost42 {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.50) 0%, rgba(180, 83, 9, 0.40) 100%);
  color: #fbbf24;
  border: 1.5px solid rgba(251, 191, 36, 0.75);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.30);
}

[data-theme="light"] .badge-cost42 {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #78350f;
  border: 1.5px solid #d97706;
}

/* Subtle Column Scanning Tints */
.td-col-rate {
  background-color: rgba(59, 130, 246, 0.025);
  border-left: 1px dashed rgba(59, 130, 246, 0.15) !important;
  border-right: 1px dashed rgba(59, 130, 246, 0.15) !important;
}

.td-col-cost42 {
  background-color: rgba(245, 158, 11, 0.04);
  border-left: 1px dashed rgba(245, 158, 11, 0.22) !important;
  border-right: 1px dashed rgba(245, 158, 11, 0.22) !important;
}

.badge-diff-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-weight: 800;
  font-size: 0.96rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--danger-red);
  display: inline-block;
}

.badge-diff-success {
  background: rgba(16, 185, 129, 0.2);
  color: #4ade80;
  font-weight: 800;
  font-size: 0.96rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--success-green);
  display: inline-block;
}

[data-theme="light"] .badge-diff-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-left: 3px solid #ef4444;
}

[data-theme="light"] .badge-diff-success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #6ee7b7;
  border-left: 3px solid #10b981;
}

/* Anomaly Distribution Interactive Legend Cards */
.anomaly-legend-card {
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-card);
  transition: all 0.22s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-height: 105px;
}

.anomaly-legend-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  border-color: var(--border-hover);
}

.anomaly-legend-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.anomaly-legend-title {
  font-size: 0.92rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.25;
}

.anomaly-legend-badge {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.anomaly-legend-desc {
  font-size: 0.80rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 3px;
}

.anomaly-legend-card.active-legend-card {
  border-width: 2px !important;
  opacity: 1 !important;
}

.chartjs-custom-tooltip {
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* High-Contrast Math Proof Verification Box */
.math-proof-box {
  background: #090e17 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  border-radius: var(--radius-md) !important;
  padding: 1rem 1.25rem !important;
  color: #ffffff !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important;
}

.math-proof-title {
  color: var(--mustard-gold) !important;
  font-weight: 700 !important;
  font-size: 1.02rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  margin-bottom: 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.math-proof-line {
  font-family: 'Consolas', 'Courier New', monospace !important;
  font-size: 1.02rem !important;
  line-height: 1.85 !important;
  color: #f1f5f9 !important;
  padding: 0.4rem 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 0.5rem !important;
}

.math-proof-line:last-child {
  border-bottom: none !important;
}

.math-step-label {
  color: #94a3b8 !important;
  font-weight: 600 !important;
  min-width: 185px !important;
  font-size: 0.96rem !important;
}

.math-formula {
  color: #e2e8f0 !important;
  font-size: 1.02rem !important;
}

.math-res-green {
  color: #34d399 !important;
  font-weight: 800 !important;
  font-size: 1.12rem !important;
}

.math-res-gold {
  color: #fbbf24 !important;
  font-weight: 800 !important;
  font-size: 1.12rem !important;
}

.math-res-diff-danger {
  color: #f87171 !important;
  font-weight: 800 !important;
  font-size: 1.06rem !important;
  background: rgba(239, 68, 68, 0.2) !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
}

.math-res-diff-success {
  color: #4ade80 !important;
  font-weight: 800 !important;
  font-size: 1.06rem !important;
  background: rgba(16, 185, 129, 0.2) !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
}

/* Light Theme Math Proof Box */
[data-theme="light"] .math-proof-box {
  background: #ffffff !important;
  border: 1px solid rgba(217, 119, 6, 0.45) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06) !important;
  color: #0f172a !important;
}

[data-theme="light"] .math-proof-title {
  color: #b45309 !important;
}

[data-theme="light"] .math-proof-line {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .math-step-label {
  color: #475569 !important;
}

[data-theme="light"] .math-formula {
  color: #1e293b !important;
}

[data-theme="light"] .math-res-green {
  color: #059669 !important;
}

[data-theme="light"] .math-res-gold {
  color: #b45309 !important;
}

[data-theme="light"] .math-res-diff-danger {
  color: #dc2626 !important;
  background: #fee2e2 !important;
  border: 1px solid rgba(220, 38, 38, 0.3) !important;
}

[data-theme="light"] .math-res-diff-success {
  color: #059669 !important;
  background: #dcfce7 !important;
  border: 1px solid rgba(5, 150, 105, 0.3) !important;
}

/* ==========================================================================
   Unit Toggle Control (₹/Quintal vs ₹/MT)
   ========================================================================== */
.unit-toggle-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.unit-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.unit-toggle-btn:hover {
  color: var(--text-primary);
}

.unit-toggle-btn.active {
  background: var(--mustard-gold);
  color: #000000;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Dropzone Hover Effects */
#dropZone.dragover {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  transform: scale(1.01);
}

/* Specific Quality Alert Badges */
.badge-low-oil {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.badge-high-moisture {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.badge-excess-fm {
  background: rgba(217, 119, 6, 0.15);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* ==========================================================================
   Executive Costing Summary & Direct Calculator — 100% Responsive & Zero Overlap
   ========================================================================== */
.story-table-card {
  width: 100%;
  border-top: 3px solid var(--accent-cyan);
}

.story-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible !important;
  /* Zero vertical clipping of rows */
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

#tableCalcStory {
  width: 100%;
  min-width: 660px;
  /* Prevents column squishing on mobile screens */
  border-collapse: collapse;
}

#tableCalcStory th {
  position: static !important;
  /* Non-sticky so it NEVER clips or obscures row 1 */
  top: auto !important;
  background-color: var(--bg-secondary) !important;
  box-shadow: none !important;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}

[data-theme="light"] #tableCalcStory th {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

#tableCalcStory td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 0.95rem;
}

#tableCalcStory tbody tr:last-child td {
  border-bottom: none;
}

/* Calculator Mode Switcher Panels */
.calc-mode-panel {
  display: none;
  animation: calcPanelFade 0.2s ease-in-out;
}

.calc-mode-panel.active {
  display: block;
}

@keyframes calcPanelFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   KPI Proof & Audit Breakdown Boxes — High Contrast in Light & Dark Mode
   ========================================================================== */
.kpi-formula-box {
  margin-top: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  line-height: 1.5;
  box-sizing: border-box;
  width: 100%;
}

/* 42 Costing Formula Box */
.kpi-proof-gold {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 3px solid var(--mustard-gold);
}

[data-theme="light"] .kpi-proof-gold {
  background: #fefce8 !important;
  border: 1px solid #fde047 !important;
  border-left: 3px solid #d97706 !important;
}

/* Net Quality Cost Impact Box */
.kpi-proof-red {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-left: 3px solid #ef4444;
}

[data-theme="light"] .kpi-proof-red {
  background: #fff1f2 !important;
  border: 1px solid #fca5a5 !important;
  border-left: 3px solid #ef4444 !important;
}

.proof-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 1px;
  font-size: 0.80rem;
  width: 100%;
}

.proof-row .proof-label {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

[data-theme="light"] .proof-row .proof-label {
  color: #1e293b !important;
  font-weight: 600 !important;
}

.proof-row .proof-val {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* Secondary Subtext for Exact Pure Numbers */
.proof-subtext {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.01em;
  margin-top: -1px;
  margin-bottom: 4px;
  white-space: nowrap;
}

[data-theme="light"] .proof-subtext {
  color: #64748b !important;
  font-weight: 500 !important;
}

/* High Contrast Value Token Colors */
.proof-val-muted {
  color: #f8fafc;
}

[data-theme="light"] .proof-val-muted {
  color: #0f172a !important;
}

.proof-val-green {
  color: #34d399;
}

[data-theme="light"] .proof-val-green {
  color: #047857 !important;
}

.proof-val-blue {
  color: #60a5fa;
}

[data-theme="light"] .proof-val-blue {
  color: #1d4ed8 !important;
}

.proof-val-amber {
  color: #fbbf24;
}

[data-theme="light"] .proof-val-amber {
  color: #b45309 !important;
}

.proof-val-red {
  color: #f87171;
}

[data-theme="light"] .proof-val-red {
  color: #b91c1c !important;
}

.proof-divider {
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  margin: 4px 0;
}

[data-theme="light"] .proof-divider {
  border-top: 1px dashed #cbd5e1 !important;
}

.proof-net-row {
  border-top: 1.5px solid rgba(239, 68, 68, 0.5);
  padding-top: 4px;
  margin-top: 4px;
}

[data-theme="light"] .proof-net-row {
  border-top: 1.5px solid #f87171 !important;
}

[data-theme="light"] .proof-net-row .proof-label,
[data-theme="light"] .proof-net-row .proof-val {
  color: #991b1b !important;
  font-weight: 800 !important;
}

.btn-audit-sheet-modal-trigger:hover {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: #ef4444 !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   VIEW 7: DATA QUALITY AUDIT - FULL-WIDTH 4-CARD KPI GRID & DRILLDOWN MODAL
   ========================================================================== */
.audit-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 1.25rem !important;
  margin-bottom: 1.5rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 1200px) {
  .audit-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }
}

@media (max-width: 640px) {
  .audit-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }
}

.audit-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1rem 1.25rem;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 175px;
  box-sizing: border-box;
}

[data-theme="light"] .audit-kpi-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.audit-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, var(--accent-blue));
  transition: height 0.2s ease, opacity 0.2s ease;
}

.audit-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  border-color: var(--card-accent, var(--accent-blue));
}

[data-theme="light"] .audit-kpi-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.09);
}

.audit-kpi-card:hover::before {
  height: 6px;
}

.audit-kpi-card:active {
  transform: translateY(-1px);
}

/* Card Accent Themes */
.audit-card-blue {
  --card-accent: #3b82f6;
  --icon-bg: rgba(59, 130, 246, 0.14);
}

[data-theme="light"] .audit-card-blue {
  --card-accent: #2563eb;
  --icon-bg: rgba(37, 99, 235, 0.1);
}

.audit-card-orange {
  --card-accent: #f97316;
  --icon-bg: rgba(249, 115, 22, 0.14);
}

[data-theme="light"] .audit-card-orange {
  --card-accent: #ea580c;
  --icon-bg: rgba(234, 88, 12, 0.1);
}

.audit-card-gold {
  --card-accent: #f59e0b;
  --icon-bg: rgba(245, 158, 11, 0.14);
}

[data-theme="light"] .audit-card-gold {
  --card-accent: #d97706;
  --icon-bg: rgba(217, 119, 6, 0.1);
}

.audit-card-cyan {
  --card-accent: #06b6d4;
  --icon-bg: rgba(6, 182, 212, 0.14);
}

[data-theme="light"] .audit-card-cyan {
  --card-accent: #0891b2;
  --icon-bg: rgba(8, 145, 178, 0.1);
}

/* Card Content Elements */
.audit-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.audit-card-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.audit-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--icon-bg);
  color: var(--card-accent);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.audit-kpi-card:hover .audit-card-icon {
  transform: scale(1.12);
}

.audit-card-val {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.45rem;
  font-variant-numeric: tabular-nums;
  color: var(--card-accent);
}

.audit-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.85rem;
}

[data-theme="light"] .audit-card-desc {
  color: #64748b;
}

.audit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--card-accent);
}

[data-theme="light"] .audit-card-footer {
  border-top-color: #f1f5f9;
}

.audit-card-footer i {
  transition: transform 0.2s ease;
}

.audit-kpi-card:hover .audit-card-footer i {
  transform: translateX(5px);
}

/* Audit Drilldown Modal Custom Elements */
.audit-canonical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.audit-canonical-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

[data-theme="light"] .audit-canonical-chip {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.audit-canonical-chip .mapping-from {
  font-family: monospace;
  font-weight: 600;
  color: var(--warning-orange);
  background: rgba(249, 115, 22, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.audit-canonical-chip .mapping-to {
  font-weight: 700;
  color: var(--success-green);
}

/* ==============================================================================
   INDIA MUSTARD (SARSO) PRICE ANALYSIS & PREDICTION STYLING TOKENS
   ============================================================================== */
.bias-bullish,
.sarso-bias-badge.bullish {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

.bias-bearish,
.sarso-bias-badge.bearish {
  background: rgba(244, 63, 94, 0.15) !important;
  color: #f43f5e !important;
  border: 1px solid rgba(244, 63, 94, 0.35) !important;
}

.bias-neutral,
.sarso-bias-badge.neutral {
  background: rgba(100, 116, 139, 0.22) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
}

[data-theme="light"] .bias-bullish,
[data-theme="light"] .sarso-bias-badge.bullish {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
}

[data-theme="light"] .bias-bearish,
[data-theme="light"] .sarso-bias-badge.bearish {
  background: #fff1f2 !important;
  color: #be123c !important;
  border: 1px solid #fecdd3 !important;
}

[data-theme="light"] .bias-neutral,
[data-theme="light"] .sarso-bias-badge.neutral {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
  font-weight: 800 !important;
}

[data-theme="light"] #cardPredictionResult {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: #d97706 !important;
  box-shadow: 0 10px 25px rgba(217, 119, 6, 0.12) !important;
}

[data-theme="light"] #cardPredictionResult h3 {
  color: #0f172a !important;
}

[data-theme="light"] #predValCurrentPrice {
  color: #0f172a !important;
}

[data-theme="light"] #predValExpectedRange {
  color: #b45309 !important;
}

[data-theme="light"] #predDisclaimerText {
  color: #92400e !important;
}

[data-theme="light"] #predPositiveFactorsList li span,
[data-theme="light"] #predNegativeFactorsList li span,
[data-theme="light"] #predRiskFactorsList li span {
  color: #334155 !important;
}

[data-theme="light"] #predIntlImpact,
[data-theme="light"] #predMandiImpact,
[data-theme="light"] #predHistoricalImpact,
[data-theme="light"] #predNewsImpact {
  color: #1e293b !important;
}

[data-theme="light"] #predAiAnalysisText {
  color: #475569 !important;
}

/* ==============================================================================
   GLOBAL COMMODITIES & TRADINGECONOMICS OVERVIEW STYLING
   ============================================================================== */
.spotlight-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.spotlight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="light"] .spotlight-soybeans {
  background: linear-gradient(165deg, #ffffff 0%, #fefce8 100%) !important;
  border-color: #eab308 !important;
  box-shadow: 0 6px 20px rgba(234, 179, 8, 0.12) !important;
}

[data-theme="light"] .spotlight-palm {
  background: linear-gradient(165deg, #ffffff 0%, #fff7ed 100%) !important;
  border-color: #f97316 !important;
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.12) !important;
}

[data-theme="light"] .spotlight-canola {
  background: linear-gradient(165deg, #ffffff 0%, #f0fdf4 100%) !important;
  border-color: #10b981 !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.12) !important;
}

[data-theme="light"] .spotlight-crude {
  background: linear-gradient(165deg, #ffffff 0%, #f0f9ff 100%) !important;
  border-color: #0284c7 !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.12) !important;
}

[data-theme="light"] .spotlight-card .spotlight-badge {
  filter: brightness(0.9);
}

[data-theme="light"] .spotlight-card h3,
[data-theme="light"] .spotlight-card div[style*="font-size: 1.05rem"],
[data-theme="light"] .spotlight-card span[style*="font-size: 1.95rem"] {
  color: #0f172a !important;
}

[data-theme="light"] .spotlight-card div[style*="background: rgba(15, 23, 42"] {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] #teWidgetContainer {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* ==========================================================================
   MUSTARD SEED AI (SARSO PREDICTION) COMPONENT STYLES
   ========================================================================== */
.sarso-hero-card {
  margin-bottom: 1.5rem;
  background: radial-gradient(circle at 15% 20%, rgba(245, 158, 11, 0.08) 0%, transparent 40%), linear-gradient(145deg, rgba(26, 34, 52, 0.95) 0%, rgba(13, 19, 33, 0.98) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.25);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(245, 158, 11, 0.12);
}

.sarso-hero-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sarso-hero-desc {
  color: #94a3b8;
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.55;
}

.sarso-result-card {
  margin-bottom: 1.75rem;
  background: linear-gradient(180deg, rgba(22, 30, 48, 0.95) 0%, rgba(13, 18, 30, 0.98) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6), 0 0 25px rgba(245, 158, 11, 0.12);
  border-radius: 14px;
  padding: 1.75rem;
}

.sarso-result-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.01em;
}

.sarso-result-sub {
  font-size: 0.84rem;
  color: #94a3b8;
  margin-top: 3px;
}

.sarso-purpose-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.06) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.sarso-purpose-headline {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 4px;
  line-height: 1.4;
}

.sarso-spec-box {
  background: rgba(15, 23, 42, 0.65);
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  text-align: right;
}

.sarso-spec-subtitle {
  color: #fef08a;
}

.sarso-kpi-card {
  background: rgba(15, 23, 42, 0.65);
  padding: 1.35rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.sarso-kpi-card.sarso-kpi-expected {
  border: 1.5px solid rgba(245, 158, 11, 0.45);
}

.sarso-kpi-card.sarso-kpi-range {
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.sarso-kpi-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #94a3b8;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sarso-kpi-sub {
  color: #64748b;
}

.sarso-range-num {
  color: #38bdf8;
}

.sarso-conf-num {
  color: #f8fafc;
}

.sarso-disclaimer-card {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid #f59e0b;
  padding: 0.95rem 1.35rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.sarso-disclaimer-card i {
  color: #f59e0b;
}

.sarso-disclaimer-text {
  font-size: 0.86rem;
  color: #fef08a;
  line-height: 1.45;
}

.sarso-disclaimer-title {
  color: #ffffff;
}

.sarso-history-card {
  border-radius: 14px;
  padding: 1.5rem;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.sarso-history-title {
  font-size: 1.15rem;
  color: #f8fafc;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.sarso-history-sub {
  color: #94a3b8;
  font-size: 0.85rem;
  margin: 0.25rem 0 0 0;
}

.sarso-history-search {
  padding: 0.45rem 0.85rem 0.45rem 2rem;
  font-size: 0.84rem;
  width: 220px;
  background: var(--bg-surface-elevated);
  color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
}

.sarso-btn-refresh {
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface-elevated);
  color: #cbd5e1;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.sarso-btn-delete-all {
  padding: 0.45rem 0.95rem;
  font-size: 0.84rem;
  border-radius: 8px;
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sarso-history-pagesize {
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  background: var(--bg-surface-elevated);
  color: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
}

#tableSarsoHistory th {
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: #cbd5e1 !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
}

#tableSarsoHistory td {
  color: #f8fafc !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.sarso-cell-time {
  font-size: 0.8rem;
  color: #f8fafc !important;
  font-weight: 700;
}

.sarso-cell-mandi {
  font-weight: 700;
  color: #f8fafc !important;
}

.sarso-sub-state {
  font-size: 0.72rem;
  color: #94a3b8 !important;
}

.sarso-cell-variety {
  font-size: 0.75rem;
  color: #cbd5e1 !important;
}

.sarso-cell-current {
  font-weight: 700;
  color: #cbd5e1 !important;
}

.sarso-cell-range {
  font-weight: 700;
  color: #38bdf8 !important;
}

.sarso-cell-likely {
  font-weight: 800;
  color: var(--mustard-gold) !important;
  font-size: 0.95rem;
}

/* ==========================================================================
   LIGHT THEME (WHITE MODE) OVERRIDES FOR MUSTARD SEED AI
   ========================================================================== */
[data-theme="light"] .sarso-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.35) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 0 15px rgba(245, 158, 11, 0.08) !important;
}

[data-theme="light"] .sarso-hero-title {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-hero-desc {
  color: #475569 !important;
}

[data-theme="light"] .sarso-result-card {
  background: #ffffff !important;
  border: 1.5px solid rgba(245, 158, 11, 0.35) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .sarso-result-title {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-result-sub {
  color: #64748b !important;
}

[data-theme="light"] .sarso-result-header {
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .sarso-purpose-banner {
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.6) 0%, rgba(253, 230, 138, 0.25) 100%) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="light"] .sarso-purpose-headline {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-purpose-headline span {
  color: #b45309 !important;
  text-shadow: none !important;
}

[data-theme="light"] .sarso-spec-box {
  background: #ffffff !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

[data-theme="light"] .sarso-spec-subtitle {
  color: #b45309 !important;
}

[data-theme="light"] .sarso-kpi-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .sarso-kpi-card.sarso-kpi-expected {
  background: rgba(245, 158, 11, 0.06) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="light"] .sarso-kpi-card.sarso-kpi-range {
  background: rgba(56, 189, 248, 0.05) !important;
  border: 1px solid rgba(2, 132, 199, 0.3) !important;
}

[data-theme="light"] .sarso-kpi-label {
  color: #475569 !important;
}

[data-theme="light"] .sarso-kpi-sub {
  color: #64748b !important;
}

[data-theme="light"] .sarso-range-num {
  color: #0284c7 !important;
}

[data-theme="light"] .sarso-conf-num {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-disclaimer-card {
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-left: 4px solid #f59e0b !important;
}

[data-theme="light"] .sarso-disclaimer-text {
  color: #92400e !important;
}

[data-theme="light"] .sarso-disclaimer-title {
  color: #78350f !important;
}

[data-theme="light"] .sarso-history-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .sarso-history-title {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-history-sub {
  color: #64748b !important;
}

[data-theme="light"] .sarso-history-search {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] .sarso-btn-refresh {
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

[data-theme="light"] #tableSarsoHistory th {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

[data-theme="light"] #tableSarsoHistory td {
  color: #0f172a !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

[data-theme="light"] .sarso-cell-time {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-cell-mandi {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-sub-state {
  color: #64748b !important;
}

[data-theme="light"] .sarso-cell-variety {
  color: #475569 !important;
}

[data-theme="light"] .sarso-cell-current {
  color: #334155 !important;
}

[data-theme="light"] .sarso-cell-range {
  color: #0284c7 !important;
}

[data-theme="light"] .sarso-cell-likely {
  color: #b45309 !important;
}

/* SOURCES CITATION CARDS */
.sarso-sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.95rem;
  margin-top: 1rem;
}

.sarso-source-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.sarso-source-card:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

[data-theme="light"] .sarso-source-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .sarso-source-card:hover {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}

.sarso-source-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--mustard-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

[data-theme="light"] .sarso-source-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.sarso-source-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

[data-theme="light"] .sarso-source-name {
  color: #0f172a;
}

.sarso-source-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 3px;
  line-height: 1.35;
}

[data-theme="light"] .sarso-source-desc {
  color: #64748b;
}

/* ==========================================================================
   GLOBAL COMMODITY MARKETS COMPONENT STYLES
   ========================================================================== */
.global-hero-card {
  margin-bottom: 1.15rem;
  background: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 40%), linear-gradient(145deg, rgba(26, 34, 52, 0.95) 0%, rgba(13, 19, 33, 0.98) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  box-shadow: 0 6px 20px -3px rgba(0, 0, 0, 0.35);
}

.global-hero-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.global-hero-desc {
  color: #94a3b8;
  font-size: 0.82rem;
  margin: 0;
  line-height: 1.45;
}

.global-timestamp-box {
  text-align: right;
  background: rgba(2, 132, 199, 0.12);
  padding: 0.4rem 0.85rem;
  border-radius: 9px;
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.global-updated-label {
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.global-updated-time {
  color: #f8fafc;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.spotlight-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.01em;
}

.spotlight-section-sub {
  font-size: 0.78rem;
  color: #64748b;
}

.spotlight-card {
  border-radius: 12px;
  padding: 1.05rem 1.15rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.spotlight-card.spotlight-soybeans {
  background: linear-gradient(165deg, rgba(26, 38, 57, 0.9) 0%, rgba(13, 21, 33, 0.95) 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.35);
}

.spotlight-card.spotlight-palm {
  background: linear-gradient(165deg, rgba(34, 28, 48, 0.9) 0%, rgba(18, 14, 28, 0.95) 100%);
  border: 1.5px solid rgba(249, 115, 22, 0.35);
}

.spotlight-card.spotlight-canola {
  background: linear-gradient(165deg, rgba(20, 37, 44, 0.9) 0%, rgba(10, 20, 26, 0.95) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
}

.spotlight-card.spotlight-crude {
  background: linear-gradient(165deg, rgba(22, 33, 50, 0.9) 0%, rgba(11, 18, 30, 0.95) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
}

.spotlight-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.spotlight-card-sub {
  font-size: 0.74rem;
  color: #94a3b8;
  font-weight: 600;
}

.spotlight-price {
  font-size: 1.95rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.spotlight-unit {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 700;
  margin-left: 3px;
}

.spotlight-metrics-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
}

.spotlight-label {
  color: #94a3b8;
}

.spotlight-metric-val {
  color: #cbd5e1;
}

.spotlight-canola-brassica {
  color: #a7f3d0;
}

.spotlight-impact-box {
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.spotlight-impact-soybeans {
  background: rgba(234, 179, 8, 0.08);
  border-left: 3px solid #eab308;
  color: #fef08a;
}

.spotlight-impact-palm {
  background: rgba(249, 115, 22, 0.08);
  border-left: 3px solid #f97316;
  color: #fed7aa;
}

.spotlight-impact-canola {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid #10b981;
  color: #a7f3d0;
}

.spotlight-impact-crude {
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid #38bdf8;
  color: #bae6fd;
}

.global-comm-table-card {
  background: linear-gradient(180deg, rgba(22, 30, 48, 0.95) 0%, rgba(13, 18, 30, 0.98) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6);
  border-radius: 14px;
  padding: 1.75rem;
}

.comm-section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.01em;
}

.comm-search-input {
  padding: 0.48rem 0.75rem 0.48rem 2.1rem;
  font-size: 0.82rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #f8fafc;
  width: 200px;
  outline: none;
}

.comm-table-wrapper {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow-x: auto;
  background: rgba(15, 23, 42, 0.5);
}

.comm-thead-row {
  background: rgba(15, 23, 42, 0.9);
}

#globalCommoditiesTable td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

#globalCommoditiesTable tbody tr:hover {
  background: rgba(56, 189, 248, 0.04);
}

.comm-row-core {
  background: rgba(56, 189, 248, 0.05) !important;
  font-weight: 600;
}

.comm-item-name {
  font-weight: 800;
  color: #f8fafc;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.comm-cell-price {
  padding: 0.85rem 1rem;
  font-weight: 900;
  font-size: 1.08rem;
  color: #ffffff;
  font-family: monospace;
  text-align: right;
}

.comm-cell-range {
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  color: #cbd5e1;
  font-family: monospace;
}

.comm-cell-impact {
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.35;
  max-width: 320px;
}

/* ==========================================================================
   PERFECT LIGHT MODE OVERRIDES: MUSTARD SEED AI & GLOBAL MARKETS
   Guarantees 100% text legibility, crisp contrast and luxury aesthetics
   ========================================================================== */

/* --- 1. MUSTARD SEED AI LIGHT THEME COMPATIBILITY ---
   Luxury high-contrast styling for executive light mode with zero dark patches */

[data-theme="light"] .sarso-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%) !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .sarso-hero-title {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-hero-desc {
  color: #475569 !important;
}

[data-theme="light"] .sarso-result-card {
  background: #ffffff !important;
  border-color: #fcd34d !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .sarso-result-header {
  border-bottom-color: #e2e8f0 !important;
}

[data-theme="light"] .sarso-result-title {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-result-sub {
  color: #475569 !important;
}

[data-theme="light"] .sarso-purpose-banner {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%) !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.1) !important;
}

[data-theme="light"] .sarso-purpose-headline {
  color: #0f172a !important;
}

[data-theme="light"] .sarso-purpose-headline span {
  color: #b45309 !important;
  text-shadow: none !important;
}

[data-theme="light"] .sarso-spec-box {
  background: #ffffff !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

[data-theme="light"] .sarso-spec-subtitle {
  color: #b45309 !important;
}

/* 4 KPI cards: high-contrast white cards with crisp slate labels */
[data-theme="light"] .sarso-kpi-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .sarso-kpi-card.sarso-kpi-expected {
  background: rgba(245, 158, 11, 0.06) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.45) !important;
}

[data-theme="light"] .sarso-kpi-card.sarso-kpi-range {
  background: rgba(56, 189, 248, 0.05) !important;
  border: 1.5px solid rgba(2, 132, 199, 0.35) !important;
}

[data-theme="light"] .sarso-kpi-label {
  color: #475569 !important;
}

[data-theme="light"] .sarso-kpi-sub {
  color: #64748b !important;
}

[data-theme="light"] .sarso-conf-num {
  color: #0f172a !important;
}

/* Market Advisory banner in Light Mode */
[data-theme="light"] .sarso-disclaimer-card {
  background: #fffbeb !important;
  border-color: #fcd34d !important;
  border-left-color: #f59e0b !important;
}

[data-theme="light"] .sarso-disclaimer-card i {
  color: #d97706 !important;
}

[data-theme="light"] .sarso-disclaimer-text {
  color: #78350f !important;
}

[data-theme="light"] .sarso-disclaimer-body {
  color: #92400e !important;
}

/* AI Config Modal Styling (Dark & Light) */
.sarso-modal-info-box {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #cbd5e1;
}

[data-theme="light"] .sarso-modal-info-box {
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  color: #0369a1 !important;
}

.sarso-cfg-box.sarso-cfg-openai {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .sarso-cfg-box.sarso-cfg-openai {
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
}

.sarso-cfg-box.sarso-cfg-gemini {
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

[data-theme="light"] .sarso-cfg-box.sarso-cfg-gemini {
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
}

.sarso-cfg-label {
  color: #f8fafc;
}

[data-theme="light"] .sarso-cfg-label {
  color: #1e293b !important;
}

.sarso-cfg-input, .sarso-cfg-select {
  background: var(--bg-surface-elevated);
  color: #f8fafc;
  border: 1px solid var(--border-subtle);
}

[data-theme="light"] .sarso-cfg-input, [data-theme="light"] .sarso-cfg-select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

/* --- 2. GLOBAL MARKETS LIGHT THEME COMPATIBILITY ---
   Preserves previous distinctive pastel gradient cards while fixing text visibility */

[data-theme="light"] .global-hero-card {
  background: linear-gradient(145deg, #ffffff 0%, #f0f9ff 100%) !important;
  border-color: #bae6fd !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .global-hero-title {
  color: #0f172a !important;
}

[data-theme="light"] .global-hero-desc {
  color: #475569 !important;
}

[data-theme="light"] .global-timestamp-box {
  background: #ffffff !important;
  border: 1.5px solid #0284c7 !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.12) !important;
}

[data-theme="light"] .global-updated-label {
  color: #0284c7 !important;
  font-weight: 800 !important;
}

[data-theme="light"] .global-updated-time {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* Section title: previously white on white */
[data-theme="light"] .spotlight-section-title {
  color: #0f172a !important;
}

[data-theme="light"] .spotlight-section-sub {
  color: #475569 !important;
}

/* Retain previous pastel gradient cards and fix text contrast */
[data-theme="light"] .spotlight-card-title {
  color: #0f172a !important;
}

[data-theme="light"] .spotlight-card-sub {
  color: #475569 !important;
}

[data-theme="light"] .spotlight-price {
  color: #0f172a !important;
}

[data-theme="light"] .spotlight-unit {
  color: #475569 !important;
}

[data-theme="light"] .spotlight-metrics-box {
  background: rgba(255, 255, 255, 0.65) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .spotlight-label {
  color: #475569 !important;
}

[data-theme="light"] .spotlight-metric-val {
  color: #0f172a !important;
}

[data-theme="light"] .spotlight-canola-brassica {
  color: #047857 !important;
  font-weight: 800 !important;
}

[data-theme="light"] .spotlight-impact-soybeans {
  background: #fefce8 !important;
  border-left-color: #ca8a04 !important;
  color: #713f12 !important;
}

[data-theme="light"] .spotlight-impact-soybeans strong {
  color: #713f12 !important;
}

[data-theme="light"] .spotlight-impact-palm {
  background: #fff7ed !important;
  border-left-color: #ea580c !important;
  color: #7c2d12 !important;
}

[data-theme="light"] .spotlight-impact-palm strong {
  color: #7c2d12 !important;
}

[data-theme="light"] .spotlight-impact-canola {
  background: #ecfdf5 !important;
  border-left-color: #059669 !important;
  color: #064e3b !important;
}

[data-theme="light"] .spotlight-impact-canola strong {
  color: #064e3b !important;
}

[data-theme="light"] .spotlight-impact-crude {
  background: #f0f9ff !important;
  border-left-color: #0284c7 !important;
  color: #0c4a6e !important;
}

[data-theme="light"] .spotlight-impact-crude strong {
  color: #0c4a6e !important;
}

[data-theme="light"] .global-comm-table-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .comm-section-title {
  color: #0f172a !important;
}

[data-theme="light"] .comm-search-input {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .comm-table-wrapper {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .comm-thead-row {
  background: #f1f5f9 !important;
}

[data-theme="light"] #globalCommoditiesTable thead th {
  color: #1e293b !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

[data-theme="light"] #globalCommoditiesTable td {
  border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="light"] .comm-row-core {
  background: rgba(56, 189, 248, 0.08) !important;
}

[data-theme="light"] .comm-item-name {
  color: #0f172a !important;
}

[data-theme="light"] .comm-cell-price {
  color: #0f172a !important;
}

[data-theme="light"] .comm-cell-range {
  color: #334155 !important;
}

[data-theme="light"] .comm-cell-impact {
  color: #334155 !important;
}

/* ==========================================================================
   SARSO PREDICTION DATE-TIME CHIP & DETAIL MODAL ENHANCEMENTS
   ========================================================================== */

/* 1. Stacked Professional Date & Time Chip */
.sarso-datetime-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
}

[data-theme="light"] .sarso-datetime-chip {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

.sarso-dt-date {
  font-size: 0.83rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #f8fafc;
}

[data-theme="light"] .sarso-dt-date {
  color: #0f172a !important;
}

.sarso-dt-time {
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #94a3b8;
}

[data-theme="light"] .sarso-dt-time {
  color: #64748b !important;
}

/* 2. Detail Modal Top 4-Column Grid */
.sarso-dtl-top-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

@media (max-width: 840px) {
  .sarso-dtl-top-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sarso-dtl-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.95rem;
  transition: all 0.2s ease;
}

[data-theme="light"] .sarso-dtl-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

.sarso-dtl-card-range {
  background: rgba(245, 158, 11, 0.08);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
}

[data-theme="light"] .sarso-dtl-card-range {
  background: #fffbeb !important;
  border: 1.5px solid #fde68a !important;
}

.sarso-dtl-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[data-theme="light"] .sarso-dtl-label {
  color: #64748b !important;
}

.sarso-dtl-val {
  font-size: 1.25rem;
  font-weight: 900;
  color: #f8fafc;
  margin-top: 3px;
  letter-spacing: -0.01em;
}

[data-theme="light"] .sarso-dtl-val {
  color: #0f172a !important;
}

.sarso-dtl-sub {
  font-size: 0.74rem;
  font-weight: 600;
  color: #94a3b8;
  margin-top: 2px;
}

[data-theme="light"] .sarso-dtl-sub {
  color: #64748b !important;
}

/* 3. Detail Modal Market Advisory Banner */
.sarso-dtl-advisory-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.15rem;
}

[data-theme="light"] .sarso-dtl-advisory-card {
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-left: 4px solid #f59e0b !important;
}

.sarso-dtl-advisory-title {
  color: #fef08a;
  font-size: 0.82rem;
  font-weight: 800;
  display: inline-block;
  margin-right: 4px;
}

[data-theme="light"] .sarso-dtl-advisory-title {
  color: #78350f !important;
}

.sarso-dtl-advisory-body {
  color: #fef08a;
  font-size: 0.82rem;
  line-height: 1.45;
}

[data-theme="light"] .sarso-dtl-advisory-body {
  color: #92400e !important;
}

/* 4. Full Analytical Reasoning Box */
.sarso-dtl-reasoning-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.15rem;
}

[data-theme="light"] .sarso-dtl-reasoning-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

.sarso-dtl-reasoning-header {
  font-size: 0.8rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .sarso-dtl-reasoning-header {
  color: #475569 !important;
}

.sarso-dtl-reasoning-text {
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.55;
  font-style: italic;
}

[data-theme="light"] .sarso-dtl-reasoning-text {
  color: #1e293b !important;
}

/* 5. Positive & Negative Factor Breakdown */
.sarso-dtl-factors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

@media (max-width: 640px) {
  .sarso-dtl-factors-grid {
    grid-template-columns: 1fr;
  }
}

.sarso-dtl-factor-box.sarso-dtl-factor-pos {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 0.95rem;
}

[data-theme="light"] .sarso-dtl-factor-box.sarso-dtl-factor-pos {
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
}

.sarso-dtl-factor-header.pos {
  font-size: 0.8rem;
  font-weight: 800;
  color: #34d399;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .sarso-dtl-factor-header.pos {
  color: #15803d !important;
}

.sarso-dtl-factor-list.pos {
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: #cbd5e1;
}

[data-theme="light"] .sarso-dtl-factor-list.pos {
  color: #166534 !important;
}

.sarso-dtl-factor-list li {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  line-height: 1.4;
}

.sarso-dtl-factor-box.sarso-dtl-factor-neg {
  background: rgba(244, 63, 94, 0.06);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 8px;
  padding: 0.95rem;
}

[data-theme="light"] .sarso-dtl-factor-box.sarso-dtl-factor-neg {
  background: #fff1f2 !important;
  border: 1px solid #fecdd3 !important;
}

.sarso-dtl-factor-header.neg {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fb7185;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .sarso-dtl-factor-header.neg {
  color: #be123c !important;
}

.sarso-dtl-factor-list.neg {
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: #cbd5e1;
}

[data-theme="light"] .sarso-dtl-factor-list.neg {
  color: #9f1239 !important;
}

/* 6. International Commodities at Prediction Time */
.sarso-dtl-intl-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
}

[data-theme="light"] .sarso-dtl-intl-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

.sarso-dtl-intl-header {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="light"] .sarso-dtl-intl-header {
  color: #0369a1 !important;
}

.sarso-dtl-intl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
}

.sarso-dtl-symbol-box {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
}

[data-theme="light"] .sarso-dtl-symbol-box {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02) !important;
}

.sarso-dtl-symbol-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
}

[data-theme="light"] .sarso-dtl-symbol-name {
  color: #64748b !important;
}

.sarso-dtl-symbol-price {
  font-size: 0.95rem;
  font-weight: 900;
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}

[data-theme="light"] .sarso-dtl-symbol-price {
  color: #0f172a !important;
}

.sarso-dtl-symbol-change.pos {
  font-size: 0.75rem;
  font-weight: 800;
  color: #16a34a;
}

.sarso-dtl-symbol-change.neg {
  font-size: 0.75rem;
  font-weight: 800;
  color: #dc2626;
}

/* ==========================================================================
   Global Commodities Category Filter Pills (Enhanced Readability & Sizing)
   ========================================================================== */
.comm-category-pills {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

#commCategoryPills .unit-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

#commCategoryPills .unit-toggle-btn i {
  font-size: 1.02rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

#commCategoryPills .unit-toggle-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

#commCategoryPills .unit-toggle-btn:hover i {
  transform: scale(1.15);
}

#commCategoryPills .unit-toggle-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #000000 !important;
  font-weight: 800 !important;
  border: 1.5px solid #f59e0b !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45) !important;
  transform: translateY(-1px);
}

#commCategoryPills .unit-toggle-btn.active i {
  color: #000000 !important;
  transform: scale(1.1);
}

#commCategoryPills .unit-toggle-btn span[id^="commCount"] {
  font-weight: 800;
}

[data-theme="light"] #commCategoryPills .unit-toggle-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] #commCategoryPills .unit-toggle-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
  color: #0f172a;
}

[data-theme="light"] #commCategoryPills .unit-toggle-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #000000 !important;
  border-color: #d97706 !important;
}

/* ==========================================================================
   GLOBAL APP LOADING & ENTERPRISE DATA SYNC OVERLAY
   ========================================================================== */
.global-sync-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeInOverlay 0.25s ease forwards;
}

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

.global-sync-card {
  background: linear-gradient(145deg, #131b2e 0%, #0c1220 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 35px rgba(245, 158, 11, 0.2);
  width: 100%;
  max-width: 520px;
  padding: 2.2rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transform: scale(0.96);
  animation: popInCard 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popInCard {
  to { transform: scale(1); }
}

.sync-spinner-ring {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 3px solid rgba(245, 158, 11, 0.15);
  border-top-color: #f59e0b;
  border-right-color: #10b981;
  animation: spinRing 1s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

.sync-spinner-core {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f59e0b;
  font-size: 1.35rem;
  animation: counterRotate 1s linear infinite;
}

@keyframes counterRotate {
  to { transform: rotate(-360deg); }
}

.sync-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.sync-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  line-height: 1.45;
}

.sync-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  position: relative;
}

.sync-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.sync-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.sync-step {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: #64748b;
  transition: color 0.3s ease;
}

.sync-step i {
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
}

.sync-step.active {
  color: #f59e0b;
  font-weight: 700;
}

.sync-step.active i {
  color: #f59e0b;
  animation: pulseIcon 1.2s infinite;
}

.sync-step.completed {
  color: #34d399;
  font-weight: 600;
}

.sync-step.completed i {
  color: #10b981;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.sync-footer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* ==========================================================================
   PARTY & INWARD LOT Consolidated Cell Styles
   ========================================================================== */
.th-col-party {
  min-width: 280px !important;
  text-align: left !important;
}

.td-col-party {
  min-width: 280px !important;
  padding: 10px 14px !important;
  vertical-align: middle !important;
  text-align: left !important;
}

.td-col-party:hover {
  background: rgba(245, 158, 11, 0.03);
}

.kpi-value-green {
  color: #10b981 !important;
}