/**
 * AI Command Center — Base Styles
 * Variables, typography, color tokens, and scrollbars.
 * Executive Modern Light Theme (Default) with Cyber Dark Theme Support.
 */
:root,
[data-theme="light"] {
  /* Color Palette — Executive High-Contrast Light Theme (WCAG AAA) */
  --bg-dark: #f1f5f9;
  --bg-canvas: #f1f5f9;
  --bg-panel: rgba(255, 255, 255, 0.98);
  --bg-panel-solid: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --bg-subtle: #f8fafc;

  --border-color: #cbd5e1;
  --border-color-subtle: #e2e8f0;
  --border-color-glow: rgba(67, 56, 202, 0.35);
  --border-color-accent: rgba(3, 105, 161, 0.35);

  /* Gradients & Accents (Executive high-contrast palette) */
  --accent-primary: #4338ca;
  --accent-primary-hover: #3730a3;
  --accent-cyan: #0369a1;
  --accent-purple: #7e22ce;
  --accent-pink: #be185d;
  --accent-emerald: #047857;
  --accent-amber: #b45309;
  --accent-rose: #be123c;

  --grad-ceo: linear-gradient(135deg, rgba(190, 24, 93, 0.12), rgba(126, 34, 206, 0.12));
  --grad-cmo: linear-gradient(135deg, rgba(3, 105, 161, 0.12), rgba(67, 56, 202, 0.12));
  --grad-cto: linear-gradient(135deg, rgba(4, 120, 87, 0.12), rgba(15, 118, 110, 0.12));
  --grad-btn: linear-gradient(135deg, #4338ca, #6d28d9);
  --grad-btn-hover: linear-gradient(135deg, #3730a3, #5b21b6);

  /* Status Colors */
  --status-pending: #475569;
  --status-running: #b45309;
  --status-completed: #047857;
  --status-failed: #be123c;
  --status-waiting: #1d4ed8;

  /* Text Colors — High Contrast */
  --text-main: #020617;
  --text-secondary: #0f172a;
  --text-muted: #334155;
  --text-dim: #475569;

  /* Typography */
  --font-sans: 'Inter', 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows — Crisp Separation */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-panel: 0 4px 20px -2px rgba(15, 23, 42, 0.1), 0 2px 6px -1px rgba(15, 23, 42, 0.06);
  --shadow-dropdown: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.3);
  --shadow-glow-indigo: 0 0 20px rgba(67, 56, 202, 0.2);
  --shadow-glow-cyan: 0 0 20px rgba(3, 105, 161, 0.2);

  color-scheme: light;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-dark: #070a12;
  --bg-canvas: #070a12;
  --bg-panel: rgba(15, 23, 42, 0.75);
  --bg-panel-solid: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  --bg-subtle: rgba(15, 23, 42, 0.5);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-subtle: rgba(255, 255, 255, 0.04);
  --border-color-glow: rgba(99, 102, 241, 0.4);
  --border-color-accent: rgba(6, 182, 212, 0.3);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --grad-ceo: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(168, 85, 247, 0.2));
  --grad-cmo: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.2));
  --grad-cto: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(20, 184, 166, 0.2));
  --grad-btn: linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-btn-hover: linear-gradient(135deg, #4f46e5, #7c3aed);

  --status-pending: #94a3b8;
  --status-running: #f59e0b;
  --status-completed: #10b981;
  --status-failed: #f43f5e;
  --status-waiting: #3b82f6;

  --text-main: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-panel: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 2px rgba(255, 255, 255, 0.05);
  --shadow-dropdown: 0 20px 40px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.2);
  --shadow-modal: 0 25px 60px rgba(0, 0, 0, 0.8);
  --shadow-glow-indigo: 0 0 25px rgba(99, 102, 241, 0.25);
  --shadow-glow-cyan: 0 0 25px rgba(6, 182, 212, 0.25);

  color-scheme: dark;
}

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

.hidden {
  display: none !important;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(ellipse at 15% 10%, rgba(79, 70, 229, 0.07) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(2, 132, 199, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.03) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body,
body[data-theme="dark"] {
  background-color: #070a12;
  background-image: 
    radial-gradient(ellipse at 15% 10%, rgba(99, 102, 241, 0.15) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(6, 182, 212, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 70, 229, 0.6);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   GLOBAL LIGHT THEME OVERRIDES FOR LEGACY / INLINE TEMPLATE STYLES
   Ensures seamless, high-contrast, crisp rendering across all modules
   ========================================================================== */

/* Universal Form Controls Override in Light Theme — Prevents white-on-white text */
:root:not([data-theme="dark"]) input,
:root:not([data-theme="dark"]) select,
:root:not([data-theme="dark"]) textarea,
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  color: #020617 !important;
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

:root:not([data-theme="dark"]) input::placeholder,
:root:not([data-theme="dark"]) textarea::placeholder,
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}

:root:not([data-theme="dark"]) select option,
[data-theme="light"] select option {
  background-color: #ffffff !important;
  color: #020617 !important;
}

/* Card & Container Backgrounds */
:root:not([data-theme="dark"]) [style*="rgba(15, 23, 42"],
:root:not([data-theme="dark"]) [style*="rgba(15,23,42"],
:root:not([data-theme="dark"]) [style*="rgba(30, 41, 59"],
:root:not([data-theme="dark"]) [style*="rgba(30,41,59"],
:root:not([data-theme="dark"]) [style*="rgba(18, 24, 38"],
:root:not([data-theme="dark"]) [style*="rgba(18,24,38"],
:root:not([data-theme="dark"]) [style*="rgba(10, 14, 23"],
:root:not([data-theme="dark"]) [style*="rgba(10,14,23"],
[data-theme="light"] [style*="rgba(15, 23, 42"],
[data-theme="light"] [style*="rgba(15,23,42"],
[data-theme="light"] [style*="rgba(30, 41, 59"],
[data-theme="light"] [style*="rgba(30,41,59"],
[data-theme="light"] [style*="rgba(18, 24, 38"],
[data-theme="light"] [style*="rgba(18,24,38"],
[data-theme="light"] [style*="rgba(10, 14, 23"],
[data-theme="light"] [style*="rgba(10,14,23"] {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

:root:not([data-theme="dark"]) [style*="#0f172a"],
:root:not([data-theme="dark"]) [style*="#0b0f19"],
:root:not([data-theme="dark"]) [style*="#030712"],
:root:not([data-theme="dark"]) [style*="#090d16"],
[data-theme="light"] [style*="#0f172a"],
[data-theme="light"] [style*="#0b0f19"],
[data-theme="light"] [style*="#030712"],
[data-theme="light"] [style*="#090d16"] {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

:root:not([data-theme="dark"]) div:not(.modal-backdrop)[style*="rgba(0,0,0"],
:root:not([data-theme="dark"]) div:not(.modal-backdrop)[style*="rgba(0, 0, 0"],
[data-theme="light"] div:not(.modal-backdrop)[style*="rgba(0,0,0"],
[data-theme="light"] div:not(.modal-backdrop)[style*="rgba(0, 0, 0"] {
  background: var(--bg-subtle) !important;
  border-color: var(--border-color) !important;
}

/* Replace faint or invisible white borders in Light Theme with crisp Slate borders */
:root:not([data-theme="dark"]) [style*="rgba(255, 255, 255"],
:root:not([data-theme="dark"]) [style*="rgba(255,255,255"],
[data-theme="light"] [style*="rgba(255, 255, 255"],
[data-theme="light"] [style*="rgba(255,255,255"] {
  border-color: var(--border-color) !important;
}

/* Ensure Headings & Titles have Crisp Contrast */
:root:not([data-theme="dark"]) h1,
:root:not([data-theme="dark"]) h2,
:root:not([data-theme="dark"]) h3,
:root:not([data-theme="dark"]) h4,
:root:not([data-theme="dark"]) h5,
:root:not([data-theme="dark"]) h6,
:root:not([data-theme="dark"]) h1[style*="color:"],
:root:not([data-theme="dark"]) h2[style*="color:"],
:root:not([data-theme="dark"]) h3[style*="color:"],
:root:not([data-theme="dark"]) h4[style*="color:"],
:root:not([data-theme="dark"]) h5[style*="color:"],
:root:not([data-theme="dark"]) h6[style*="color:"],
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6,
[data-theme="light"] h1[style*="color:"],
[data-theme="light"] h2[style*="color:"],
[data-theme="light"] h3[style*="color:"],
[data-theme="light"] h4[style*="color:"],
[data-theme="light"] h5[style*="color:"],
[data-theme="light"] h6[style*="color:"] {
  color: var(--text-main) !important;
}

/* Override inline white/light colors on content text in Light Theme (excluding buttons and status badges) */
:root:not([data-theme="dark"]) div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: white"],
:root:not([data-theme="dark"]) div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:white"],
:root:not([data-theme="dark"]) div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #ffffff"],
:root:not([data-theme="dark"]) div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:#ffffff"],
:root:not([data-theme="dark"]) div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #fff"],
:root:not([data-theme="dark"]) div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:#fff"],
:root:not([data-theme="dark"]) span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: white"],
:root:not([data-theme="dark"]) span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:white"],
:root:not([data-theme="dark"]) span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #ffffff"],
:root:not([data-theme="dark"]) span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:#ffffff"],
:root:not([data-theme="dark"]) span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #f8fafc"],
:root:not([data-theme="dark"]) span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #f1f5f9"],
:root:not([data-theme="dark"]) strong:not(.btn)[style*="color: white"],
:root:not([data-theme="dark"]) strong:not(.btn)[style*="color:white"],
:root:not([data-theme="dark"]) strong:not(.btn)[style*="color: #ffffff"],
:root:not([data-theme="dark"]) strong:not(.btn)[style*="color:#ffffff"],
:root:not([data-theme="dark"]) strong:not(.btn)[style*="color: #f8fafc"],
:root:not([data-theme="dark"]) strong:not(.btn)[style*="color: #f1f5f9"],
:root:not([data-theme="dark"]) td[style*="color: white"],
:root:not([data-theme="dark"]) td[style*="color:white"],
:root:not([data-theme="dark"]) td[style*="color: #ffffff"],
:root:not([data-theme="dark"]) td[style*="color:#ffffff"],
:root:not([data-theme="dark"]) td[style*="color: #f8fafc"],
:root:not([data-theme="dark"]) td[style*="color: #f1f5f9"],
:root:not([data-theme="dark"]) label[style*="color: white"],
:root:not([data-theme="dark"]) label[style*="color:white"],
:root:not([data-theme="dark"]) label[style*="color: #ffffff"],
:root:not([data-theme="dark"]) label[style*="color:#ffffff"],
:root:not([data-theme="dark"]) p[style*="color: white"],
:root:not([data-theme="dark"]) p[style*="color:white"],
:root:not([data-theme="dark"]) p[style*="color: #ffffff"],
:root:not([data-theme="dark"]) p[style*="color:#ffffff"],
:root:not([data-theme="dark"]) p[style*="color: #f8fafc"],
:root:not([data-theme="dark"]) p[style*="color: #f1f5f9"],
[data-theme="light"] div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: white"],
[data-theme="light"] div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:white"],
[data-theme="light"] div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #ffffff"],
[data-theme="light"] div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:#ffffff"],
[data-theme="light"] div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: #fff"],
[data-theme="light"] div:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:#fff"],
[data-theme="light"] span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color: white"],
[data-theme="light"] span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:white"],
[data-theme="light"] span:not(.btn):not([class*="badge-"]):not([class*="badge-"]):not(.status-pill)[style*="color: #ffffff"],
[data-theme="light"] span:not(.btn):not([class*="badge-"]):not([class*="btn-"]):not(.status-pill)[style*="color:#ffffff"],
[data-theme="light"] span:not(.btn):not([class*="badge-"]):not([class*="badge-"]):not(.status-pill)[style*="color: #f8fafc"],
[data-theme="light"] span:not(.btn):not([class*="badge-"]):not([class*="badge-"]):not(.status-pill)[style*="color: #f1f5f9"],
[data-theme="light"] strong:not(.btn)[style*="color: white"],
[data-theme="light"] strong:not(.btn)[style*="color:white"],
[data-theme="light"] strong:not(.btn)[style*="color: #ffffff"],
[data-theme="light"] strong:not(.btn)[style*="color:#ffffff"],
[data-theme="light"] strong:not(.btn)[style*="color: #f8fafc"],
[data-theme="light"] strong:not(.btn)[style*="color: #f1f5f9"],
[data-theme="light"] td[style*="color: white"],
[data-theme="light"] td[style*="color:white"],
[data-theme="light"] td[style*="color: #ffffff"],
[data-theme="light"] td[style*="color:#ffffff"],
[data-theme="light"] td[style*="color: #f8fafc"],
[data-theme="light"] td[style*="color: #f1f5f9"],
[data-theme="light"] label[style*="color: white"],
[data-theme="light"] label[style*="color:white"],
[data-theme="light"] label[style*="color: #ffffff"],
[data-theme="light"] label[style*="color:#ffffff"],
[data-theme="light"] p[style*="color: white"],
[data-theme="light"] p[style*="color:white"],
[data-theme="light"] p[style*="color: #ffffff"],
[data-theme="light"] p[style*="color:#ffffff"],
[data-theme="light"] p[style*="color: #f8fafc"],
[data-theme="light"] p[style*="color: #f1f5f9"] {
  color: var(--text-main) !important;
}

/* Sub-labels and Muted Text */
:root:not([data-theme="dark"]) [style*="color: #cbd5e1"],
:root:not([data-theme="dark"]) [style*="color:#cbd5e1"],
:root:not([data-theme="dark"]) [style*="color: #e2e8f0"],
:root:not([data-theme="dark"]) [style*="color:#e2e8f0"],
[data-theme="light"] [style*="color: #cbd5e1"],
[data-theme="light"] [style*="color:#cbd5e1"],
[data-theme="light"] [style*="color: #e2e8f0"],
[data-theme="light"] [style*="color:#e2e8f0"] {
  color: var(--text-secondary) !important;
}

:root:not([data-theme="dark"]) [style*="color: #94a3b8"],
[data-theme="light"] [style*="color: #94a3b8"] {
  color: var(--text-muted) !important;
}

/* Transform Dark Mode Pastel/Neon Inline Colors to High-Contrast Executive Tones */
:root:not([data-theme="dark"]) [style*="color: #a5f3fc"],
:root:not([data-theme="dark"]) [style*="color:#a5f3fc"],
[data-theme="light"] [style*="color: #a5f3fc"],
[data-theme="light"] [style*="color:#a5f3fc"] {
  color: #0369a1 !important; /* Sky 700 */
}

:root:not([data-theme="dark"]) [style*="color: #38bdf8"],
:root:not([data-theme="dark"]) [style*="color:#38bdf8"],
[data-theme="light"] [style*="color: #38bdf8"],
[data-theme="light"] [style*="color:#38bdf8"] {
  color: #0284c7 !important; /* Sky 600 */
}

:root:not([data-theme="dark"]) [style*="color: #4ade80"],
:root:not([data-theme="dark"]) [style*="color:#4ade80"],
:root:not([data-theme="dark"]) [style*="color: #34d399"],
:root:not([data-theme="dark"]) [style*="color:#34d399"],
:root:not([data-theme="dark"]) [style*="color: #22c55e"],
:root:not([data-theme="dark"]) [style*="color:#22c55e"],
[data-theme="light"] [style*="color: #4ade80"],
[data-theme="light"] [style*="color:#4ade80"],
[data-theme="light"] [style*="color: #34d399"],
[data-theme="light"] [style*="color:#34d399"],
[data-theme="light"] [style*="color: #22c55e"],
[data-theme="light"] [style*="color:#22c55e"] {
  color: #15803d !important; /* Green 700 */
}

:root:not([data-theme="dark"]) [style*="color: #a78bfa"],
:root:not([data-theme="dark"]) [style*="color:#a78bfa"],
:root:not([data-theme="dark"]) [style*="color: #c084fc"],
:root:not([data-theme="dark"]) [style*="color:#c084fc"],
:root:not([data-theme="dark"]) [style*="color: #a855f7"],
:root:not([data-theme="dark"]) [style*="color:#a855f7"],
[data-theme="light"] [style*="color: #a78bfa"],
[data-theme="light"] [style*="color:#a78bfa"],
[data-theme="light"] [style*="color: #c084fc"],
[data-theme="light"] [style*="color:#c084fc"],
[data-theme="light"] [style*="color: #a855f7"],
[data-theme="light"] [style*="color:#a855f7"] {
  color: #7e22ce !important; /* Purple 700 */
}

:root:not([data-theme="dark"]) [style*="color: #fbbf24"],
:root:not([data-theme="dark"]) [style*="color:#fbbf24"],
:root:not([data-theme="dark"]) [style*="color: #facc15"],
:root:not([data-theme="dark"]) [style*="color:#facc15"],
[data-theme="light"] [style*="color: #fbbf24"],
[data-theme="light"] [style*="color:#fbbf24"],
[data-theme="light"] [style*="color: #facc15"],
[data-theme="light"] [style*="color:#facc15"] {
  color: #b45309 !important; /* Amber 700 */
}

:root:not([data-theme="dark"]) [style*="color: #fb7185"],
:root:not([data-theme="dark"]) [style*="color:#fb7185"],
:root:not([data-theme="dark"]) [style*="color: #f87171"],
:root:not([data-theme="dark"]) [style*="color:#f87171"],
[data-theme="light"] [style*="color: #fb7185"],
[data-theme="light"] [style*="color:#fb7185"],
[data-theme="light"] [style*="color: #f87171"],
[data-theme="light"] [style*="color:#f87171"] {
  color: #be123c !important; /* Rose 700 */
}

:root:not([data-theme="dark"]) [style*="color: #fb923c"],
:root:not([data-theme="dark"]) [style*="color:#fb923c"],
[data-theme="light"] [style*="color: #fb923c"],
[data-theme="light"] [style*="color:#fb923c"] {
  color: #c2410c !important; /* Orange 700 */
}

:root:not([data-theme="dark"]) [style*="color: #2dd4bf"],
:root:not([data-theme="dark"]) [style*="color:#2dd4bf"],
[data-theme="light"] [style*="color: #2dd4bf"],
[data-theme="light"] [style*="color:#2dd4bf"] {
  color: #0f766e !important; /* Teal 700 */
}

:root:not([data-theme="dark"]) [style*="color: #60a5fa"],
:root:not([data-theme="dark"]) [style*="color:#60a5fa"],
:root:not([data-theme="dark"]) [style*="color: #818cf8"],
:root:not([data-theme="dark"]) [style*="color:#818cf8"],
[data-theme="light"] [style*="color: #60a5fa"],
[data-theme="light"] [style*="color:#60a5fa"],
[data-theme="light"] [style*="color: #818cf8"],
[data-theme="light"] [style*="color:#818cf8"] {
  color: #1d4ed8 !important; /* Blue 700 */
}

/* Transform Dark Mode Pastel Badges into High-Contrast Polished Pills */
:root:not([data-theme="dark"]) .badge[style*="56, 189, 248"],
[data-theme="light"] .badge[style*="56, 189, 248"] {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
  font-weight: 700 !important;
}

:root:not([data-theme="dark"]) .badge[style*="74, 222, 128"],
:root:not([data-theme="dark"]) .badge[style*="34, 197, 94"],
[data-theme="light"] .badge[style*="74, 222, 128"],
[data-theme="light"] .badge[style*="34, 197, 94"] {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
  font-weight: 700 !important;
}

:root:not([data-theme="dark"]) .badge[style*="168, 85, 247"],
:root:not([data-theme="dark"]) .badge[style*="167, 139, 250"],
[data-theme="light"] .badge[style*="168, 85, 247"],
[data-theme="light"] .badge[style*="167, 139, 250"] {
  background: #f3e8ff !important;
  color: #6b21a8 !important;
  border: 1px solid #d8b4fe !important;
  font-weight: 700 !important;
}

:root:not([data-theme="dark"]) .badge[style*="245, 158, 11"],
[data-theme="light"] .badge[style*="245, 158, 11"] {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
  font-weight: 700 !important;
}

:root:not([data-theme="dark"]) .badge[style*="244, 63, 94"],
:root:not([data-theme="dark"]) .badge[style*="225, 48, 108"],
[data-theme="light"] .badge[style*="244, 63, 94"],
[data-theme="light"] .badge[style*="225, 48, 108"] {
  background: #ffe4e6 !important;
  color: #be123c !important;
  border: 1px solid #fecdd3 !important;
  font-weight: 700 !important;
}

:root:not([data-theme="dark"]) .badge[style*="24, 119, 242"],
:root:not([data-theme="dark"]) .badge[style*="59, 130, 246"],
[data-theme="light"] .badge[style*="24, 119, 242"],
[data-theme="light"] .badge[style*="59, 130, 246"] {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #93c5fd !important;
  font-weight: 700 !important;
}

/* Secondary Button Contrast in Light Mode */
:root:not([data-theme="dark"]) .btn-secondary,
[data-theme="light"] .btn-secondary {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: var(--shadow-sm);
  font-weight: 700 !important;
}

:root:not([data-theme="dark"]) .btn-secondary:hover,
[data-theme="light"] .btn-secondary:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #020617 !important;
}

/* Utility Class Contrast */
:root:not([data-theme="dark"]) .text-white,
[data-theme="light"] .text-white {
  color: var(--text-main) !important;
}

:root:not([data-theme="dark"]) .text-muted,
[data-theme="light"] .text-muted {
  color: var(--text-muted) !important;
}

:root:not([data-theme="dark"]) .text-dim,
[data-theme="light"] .text-dim {
  color: var(--text-dim) !important;
}

:root:not([data-theme="dark"]) .text-accent,
[data-theme="light"] .text-accent {
  color: var(--accent-primary) !important;
  font-weight: 600;
}

:root:not([data-theme="dark"]) .text-success,
[data-theme="light"] .text-success {
  color: #15803d !important;
  font-weight: 600;
}

:root:not([data-theme="dark"]) .text-danger,
[data-theme="light"] .text-danger {
  color: #be123c !important;
  font-weight: 600;
}

:root:not([data-theme="dark"]) .text-warning,
[data-theme="light"] .text-warning {
  color: #b45309 !important;
  font-weight: 600;
}

/* =========================================================================
   Flowchart & Contextual Inspector Dark Cyber Canvas Exemption
   Canvas (#070a12) and Drawer (#0f172a) are permanently dark-themed.
   Preserve and enforce high-contrast light text & luminous status colors.
   ========================================================================= */
#pageSystemFlowchart,
.flowchart-page,
#fcDrawer,
.fc-drawer {
  color-scheme: dark !important;
}

#pageSystemFlowchart,
.flowchart-page,
#fcDrawer,
.fc-drawer,
#pageSystemFlowchart *,
.flowchart-page *,
#fcDrawer *,
.fc-drawer * {
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #ffffff"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #ffffff"],
:root:not([data-theme="dark"]) #pageSystemFlowchart [style*="color: #ffffff"],
:root:not([data-theme="dark"]) .flowchart-page [style*="color: #ffffff"],
[data-theme="light"] #fcDrawer [style*="color: #ffffff"],
[data-theme="light"] .fc-drawer [style*="color: #ffffff"],
[data-theme="light"] #pageSystemFlowchart [style*="color: #ffffff"],
[data-theme="light"] .flowchart-page [style*="color: #ffffff"],
:root:not([data-theme="dark"]) #fcDrawer [style*="color: white"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: white"],
[data-theme="light"] #fcDrawer [style*="color: white"],
[data-theme="light"] .fc-drawer [style*="color: white"] {
  color: #ffffff !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #94a3b8"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #94a3b8"],
:root:not([data-theme="dark"]) #pageSystemFlowchart [style*="color: #94a3b8"],
:root:not([data-theme="dark"]) .flowchart-page [style*="color: #94a3b8"],
[data-theme="light"] #fcDrawer [style*="color: #94a3b8"],
[data-theme="light"] .fc-drawer [style*="color: #94a3b8"],
[data-theme="light"] #pageSystemFlowchart [style*="color: #94a3b8"],
[data-theme="light"] .flowchart-page [style*="color: #94a3b8"] {
  color: #94a3b8 !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #cbd5e1"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #cbd5e1"],
:root:not([data-theme="dark"]) #pageSystemFlowchart [style*="color: #cbd5e1"],
:root:not([data-theme="dark"]) .flowchart-page [style*="color: #cbd5e1"],
[data-theme="light"] #fcDrawer [style*="color: #cbd5e1"],
[data-theme="light"] .fc-drawer [style*="color: #cbd5e1"],
[data-theme="light"] #pageSystemFlowchart [style*="color: #cbd5e1"],
[data-theme="light"] .flowchart-page [style*="color: #cbd5e1"] {
  color: #cbd5e1 !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #c084fc"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #c084fc"],
[data-theme="light"] #fcDrawer [style*="color: #c084fc"],
[data-theme="light"] .fc-drawer [style*="color: #c084fc"] {
  color: #c084fc !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #38bdf8"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #38bdf8"],
[data-theme="light"] #fcDrawer [style*="color: #38bdf8"],
[data-theme="light"] .fc-drawer [style*="color: #38bdf8"] {
  color: #38bdf8 !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #34d399"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #34d399"],
[data-theme="light"] #fcDrawer [style*="color: #34d399"],
[data-theme="light"] .fc-drawer [style*="color: #34d399"] {
  color: #34d399 !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #fbbf24"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #fbbf24"],
[data-theme="light"] #fcDrawer [style*="color: #fbbf24"],
[data-theme="light"] .fc-drawer [style*="color: #fbbf24"] {
  color: #fbbf24 !important;
}

:root:not([data-theme="dark"]) #fcDrawer [style*="color: #60a5fa"],
:root:not([data-theme="dark"]) .fc-drawer [style*="color: #60a5fa"],
[data-theme="light"] #fcDrawer [style*="color: #60a5fa"],
[data-theme="light"] .fc-drawer [style*="color: #60a5fa"] {
  color: #60a5fa !important;
}




