/* ═══════════════════════════════════════════════════════════════════
   LOFT LEARN — Global Dual Theme System (Dark & Light Mode) 2026
   Mobile-first · Ultra-clean · WCAG AA Contrast · Fluid Transitions
   Comprehensive Universal Theme Engine (Tier 1 Architecture)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables Definitions ───────────────────────────────── */
:root {
  /* Default Dark Mode Theme Tokens */
  --loft-bg: #0b1120;
  --loft-bg-subtle: #0f172a;
  --loft-card: #0f172a;
  --loft-card-hover: #1e293b;
  --loft-card-border: rgba(51, 65, 85, 0.7);
  --loft-text: #f1f5f9;
  --loft-text-muted: #94a3b8;
  --loft-text-subtle: #64748b;
  --loft-input-bg: rgba(15, 23, 42, 0.95);
  --loft-input-border: rgba(51, 65, 85, 0.8);
  --loft-header-bg: rgba(15, 23, 42, 0.9);
  --loft-sidebar-bg: #0f172a;
  --loft-sidebar-border: rgba(51, 65, 85, 0.8);
  --loft-bottomnav-bg: rgba(2, 6, 23, 0.95);
  --loft-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

html.light,
html:not(.dark) {
  /* High-Contrast Crisp Light Mode Theme Tokens */
  --loft-bg: #f8fafc;
  --loft-bg-subtle: #f1f5f9;
  --loft-card: #ffffff;
  --loft-card-hover: #f8fafc;
  --loft-card-border: #e2e8f0;
  --loft-text: #0f172a;
  --loft-text-muted: #475569;
  --loft-text-subtle: #64748b;
  --loft-input-bg: #ffffff;
  --loft-input-border: #cbd5e1;
  --loft-header-bg: rgba(255, 255, 255, 0.94);
  --loft-sidebar-bg: #ffffff;
  --loft-sidebar-border: #e2e8f0;
  --loft-bottomnav-bg: rgba(255, 255, 255, 0.97);
  --loft-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
  color-scheme: light;
}

/* ─── Global Transitions during Theme Toggle ─────────────────── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.18s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   LIGHT MODE OVERRIDES (Applied when html.light or html:not(.dark))
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Page Background & Base Text ── */
html.light,
html.light body,
html.light #app-main-wrapper,
html.light #app-main-layout,
html:not(.dark) body,
html:not(.dark) #app-main-wrapper,
html:not(.dark) #app-main-layout {
  background-color: #f8fafc !important;
  background: #f8fafc !important;
  background-image: 
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(16, 185, 129, 0.09) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 120%, rgba(245, 158, 11, 0.06) 0%, transparent 60%) !important;
  color: #0f172a !important;
}

/* ── 2. Header & Glass Nav ── */
html.light header,
html:not(.dark) header,
html.light .glass-nav,
html:not(.dark) .glass-nav,
html.light .sticky.top-0 {
  background-color: rgba(255, 255, 255, 0.94) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04) !important;
}

html.light header h1,
html.light header h2,
html:not(.dark) header h1,
html:not(.dark) header h2 {
  color: #0f172a !important;
}

/* ── 3. Desktop Sidebar ── */
html.light #app-desktop-sidebar,
html.light .desktop-sidebar,
html:not(.dark) #app-desktop-sidebar,
html:not(.dark) .desktop-sidebar {
  background-color: #ffffff !important;
  background: rgba(255, 255, 255, 0.98) !important;
  border-right-color: #e2e8f0 !important;
  box-shadow: 10px 0 30px -5px rgba(0, 0, 0, 0.05) !important;
}

html.light .desktop-sidebar .sidebar-brand-text,
html.light .desktop-sidebar .text-white,
html:not(.dark) .desktop-sidebar .sidebar-brand-text,
html:not(.dark) .desktop-sidebar .text-white {
  color: #0f172a !important;
}

html.light .desktop-sidebar .sidebar-heading,
html:not(.dark) .desktop-sidebar .sidebar-heading {
  color: #94a3b8 !important;
}

html.light .desktop-sidebar .sidebar-item,
html:not(.dark) .desktop-sidebar .sidebar-item {
  color: #334155 !important;
}

html.light .desktop-sidebar .sidebar-item:hover,
html:not(.dark) .desktop-sidebar .sidebar-item:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .desktop-sidebar .sidebar-item .w-7.h-7.bg-slate-800,
html:not(.dark) .desktop-sidebar .sidebar-item .w-7.h-7.bg-slate-800 {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
}

html.light .desktop-sidebar .sidebar-item:hover .w-7.h-7.bg-slate-800,
html:not(.dark) .desktop-sidebar .sidebar-item:hover .w-7.h-7.bg-slate-800 {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html.light #app-desktop-sidebar .sidebar-item.is-active-nav,
html:not(.dark) #app-desktop-sidebar .sidebar-item.is-active-nav,
html.light .desktop-sidebar .sidebar-item.bg-amber-500\/20,
html:not(.dark) .desktop-sidebar .sidebar-item.bg-amber-500\/20 {
  background-color: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #78350f !important;
}

html.light #app-desktop-sidebar .sidebar-item.is-active-nav .sidebar-label,
html:not(.dark) #app-desktop-sidebar .sidebar-item.is-active-nav .sidebar-label,
html.light .desktop-sidebar .sidebar-item.bg-amber-500\/20 .sidebar-label,
html:not(.dark) .desktop-sidebar .sidebar-item.bg-amber-500\/20 .sidebar-label {
  color: #78350f !important;
}

html.light #app-desktop-sidebar .sidebar-item.is-active-nav > div:first-child,
html:not(.dark) #app-desktop-sidebar .sidebar-item.is-active-nav > div:first-child,
html.light .desktop-sidebar .sidebar-item.bg-amber-500\/20 > div:first-child,
html:not(.dark) .desktop-sidebar .sidebar-item.bg-amber-500\/20 > div:first-child {
  background-color: #f59e0b !important;
  color: #ffffff !important;
}

html.light #app-desktop-sidebar .sidebar-item.is-active-nav > div:first-child i,
html:not(.dark) #app-desktop-sidebar .sidebar-item.is-active-nav > div:first-child i,
html.light .desktop-sidebar .sidebar-item.bg-amber-500\/20 > div:first-child i,
html:not(.dark) .desktop-sidebar .sidebar-item.bg-amber-500\/20 > div:first-child i {
  color: #ffffff !important;
}

html.light #app-desktop-sidebar .sidebar-item.is-active-nav .sidebar-badge,
html:not(.dark) #app-desktop-sidebar .sidebar-item.is-active-nav .sidebar-badge {
  background-color: #d97706 !important;
  color: #ffffff !important;
}

html.light #sidebar-toggle-btn,
html:not(.dark) #sidebar-toggle-btn {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}
html.light #sidebar-toggle-btn:hover,
html:not(.dark) #sidebar-toggle-btn:hover {
  background-color: #fbbf24 !important;
  color: #0f172a !important;
}

/* ── 4. Mobile Bottom Navigation ── */
html.light #app-mobile-bottom-nav,
html.light .mobile-bottom-nav,
html:not(.dark) #app-mobile-bottom-nav,
html:not(.dark) .mobile-bottom-nav {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-top-color: #e2e8f0 !important;
  color: #64748b !important;
  box-shadow: 0 -4px 20px -2px rgba(0, 0, 0, 0.05) !important;
}

html.light #app-mobile-bottom-nav a,
html.light #app-mobile-bottom-nav button,
html:not(.dark) #app-mobile-bottom-nav a,
html:not(.dark) #app-mobile-bottom-nav button {
  color: #64748b !important;
}

html.light #app-mobile-bottom-nav a.text-amber-400,
html.light #app-mobile-bottom-nav button.text-amber-300,
html.light #app-mobile-bottom-nav .text-amber-400,
html.light #app-mobile-bottom-nav .text-amber-300,
html:not(.dark) #app-mobile-bottom-nav a.text-amber-400,
html:not(.dark) #app-mobile-bottom-nav button.text-amber-300,
html:not(.dark) #app-mobile-bottom-nav .text-amber-400,
html:not(.dark) #app-mobile-bottom-nav .text-amber-300 {
  color: #d97706 !important;
}

/* ── 5. Dark Gradient Banners & Hero Sections Inversion ── */
/* Inverts hero cards that use from-slate-900, from-slate-950, from-purple-950, from-amber-950, from-rose-950 */
html.light [class*="from-slate-900"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="from-slate-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="from-slate-800"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="from-purple-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="from-amber-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="from-rose-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="from-emerald-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="via-slate-900"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="via-slate-800"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="to-slate-900"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="to-slate-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html.light [class*="to-slate-800"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-slate-900"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-slate-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-slate-800"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-purple-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-amber-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-rose-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="from-emerald-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="via-slate-900"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="via-slate-800"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="to-slate-900"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="to-slate-950"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]),
html:not(.dark) [class*="to-slate-800"]:not(.absolute):not([class*="inset-0"]):not([style*="background-image"]) {
  background-color: #ffffff !important;
  background-image: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
}

/* ── 5.0 Image Cover & Gradient Scrim Protection in Light Mode ── */
/* Prevents photo overlays from becoming opaque solid white/gray blocks */
html.light .absolute[class*="inset-0"][class*="from-slate"],
html.light .absolute[class*="inset-0"][class*="bg-slate"],
html.light .absolute[class*="inset-0"][class*="bg-gradient"],
html.light [class*="inset-0"][class*="from-slate"],
html.light [class*="inset-0"][class*="bg-slate"],
html.light [class*="inset-0"][class*="bg-gradient"],
html.light .absolute[class*="inset-0"][class*="to-black"],
html.light [class*="inset-0"][class*="to-black"],
html:not(.dark) .absolute[class*="inset-0"][class*="from-slate"],
html:not(.dark) .absolute[class*="inset-0"][class*="bg-slate"],
html:not(.dark) .absolute[class*="inset-0"][class*="bg-gradient"],
html:not(.dark) [class*="inset-0"][class*="from-slate"],
html:not(.dark) [class*="inset-0"][class*="bg-slate"],
html:not(.dark) [class*="inset-0"][class*="bg-gradient"],
html:not(.dark) .absolute[class*="inset-0"][class*="to-black"],
html:not(.dark) [class*="inset-0"][class*="to-black"] {
  background-color: transparent !important;
  background-image: linear-gradient(to top, rgba(15, 23, 42, 0.75) 0%, rgba(15, 23, 42, 0.2) 50%, transparent 100%) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html.light .absolute[class*="inset-0"][class*="bg-slate-950/"],
html.light .absolute[class*="inset-0"][class*="bg-slate-900/"],
html.light [class*="inset-0"][class*="bg-slate-950/"],
html.light [class*="inset-0"][class*="bg-slate-900/"],
html:not(.dark) .absolute[class*="inset-0"][class*="bg-slate-950/"],
html:not(.dark) .absolute[class*="inset-0"][class*="bg-slate-900/"],
html:not(.dark) [class*="inset-0"][class*="bg-slate-950/"],
html:not(.dark) [class*="inset-0"][class*="bg-slate-900/"] {
  background-color: rgba(15, 23, 42, 0.35) !important;
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Titles and labels on top of photo covers must keep readable white text */
html.light .relative .absolute h1.text-white,
html.light .relative .absolute h2.text-white,
html.light .relative .absolute h3.text-white,
html.light .relative .absolute h4.text-white,
html:not(.dark) .relative .absolute h1.text-white,
html:not(.dark) .relative .absolute h2.text-white,
html:not(.dark) .relative .absolute h3.text-white,
html:not(.dark) .relative .absolute h4.text-white {
  color: #ffffff !important;
}

/* Ensure headings & descriptions in hero banners have high contrast in Light Mode */
html.light [class*="from-slate-"] h2,
html.light [class*="from-slate-"] h3,
html.light [class*="from-purple-950"] h2,
html.light [class*="from-amber-950"] h2,
html.light [class*="from-rose-950"] h2,
html.light [class*="from-slate-"] p,
html.light [class*="from-purple-950"] p,
html.light [class*="from-amber-950"] p,
html.light [class*="from-rose-950"] p,
html:not(.dark) [class*="from-slate-"] h2,
html:not(.dark) [class*="from-slate-"] h3,
html:not(.dark) [class*="from-purple-950"] h2,
html:not(.dark) [class*="from-amber-950"] h2,
html:not(.dark) [class*="from-rose-950"] h2,
html:not(.dark) [class*="from-slate-"] p,
html:not(.dark) [class*="from-purple-950"] p,
html:not(.dark) [class*="from-amber-950"] p,
html:not(.dark) [class*="from-rose-950"] p {
  color: #0f172a !important;
}
html.light [class*="from-slate-"] p,
html.light [class*="from-purple-950"] p,
html.light [class*="from-amber-950"] p,
html.light [class*="from-rose-950"] p,
html:not(.dark) [class*="from-slate-"] p,
html:not(.dark) [class*="from-purple-950"] p,
html:not(.dark) [class*="from-amber-950"] p,
html:not(.dark) [class*="from-rose-950"] p {
  color: #334155 !important;
}

/* ── 5.1 Custom Classes (.glass-card, .track-card, .rank-card) ── */
html.light .glass-card,
html:not(.dark) .glass-card {
  background-color: #ffffff !important;
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.04) !important;
}

html.light .track-card,
html:not(.dark) .track-card {
  background-color: #ffffff !important;
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}
html.light .track-card:hover,
html:not(.dark) .track-card:hover {
  background-color: #f8fafc !important;
  border-color: #f59e0b !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(245, 158, 11, 0.15) !important;
}
html.light .track-card.active,
html:not(.dark) .track-card.active {
  background: #fffbeb !important; /* amber-50 */
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 2px #f59e0b, 0 8px 16px -4px rgba(245, 158, 11, 0.2) !important;
}
html.light .track-card h4,
html:not(.dark) .track-card h4 {
  color: #0f172a !important;
}
html.light .track-card p,
html:not(.dark) .track-card p {
  color: #475569 !important;
}

html.light .rank-card,
html:not(.dark) .rank-card {
  background-color: #ffffff !important;
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}
html.light .rank-card:hover,
html:not(.dark) .rank-card:hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

/* ── 5.2 Universal Cards & Containers (All Slate, Gray, Zinc Dark Opacities) ── */
html.light [class*="bg-slate-900"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]):not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-blue"]):not([class*="bg-pink"]):not([class*="bg-green"]):not([class*="bg-yellow"]),
html.light [class*="bg-slate-950"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]):not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-blue"]):not([class*="bg-pink"]):not([class*="bg-green"]):not([class*="bg-yellow"]),
html.light [class*="bg-slate-800"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]):not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-blue"]):not([class*="bg-pink"]):not([class*="bg-green"]):not([class*="bg-yellow"]),
html.light [class*="bg-gray-900"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html.light [class*="bg-gray-950"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html.light [class*="bg-gray-800"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html.light [class*="bg-zinc-900"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html.light [class*="bg-zinc-800"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html.light .custom-card,
html.light .source-card,
html.light .base-card,
html.light .quiz-card,
html.light .inst-card,
html.light .loft-card,
html.light .mgmt-stat-card,
html.light .page-section,
html:not(.dark) [class*="bg-slate-900"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]):not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-blue"]):not([class*="bg-pink"]):not([class*="bg-green"]):not([class*="bg-yellow"]),
html:not(.dark) [class*="bg-slate-950"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]):not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-blue"]):not([class*="bg-pink"]):not([class*="bg-green"]):not([class*="bg-yellow"]),
html:not(.dark) [class*="bg-slate-800"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]):not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-blue"]):not([class*="bg-pink"]):not([class*="bg-green"]):not([class*="bg-yellow"]),
html:not(.dark) [class*="bg-gray-900"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) [class*="bg-gray-950"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) [class*="bg-gray-800"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) [class*="bg-zinc-900"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) [class*="bg-zinc-800"]:not(.absolute):not([class*="inset-0"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) .custom-card,
html:not(.dark) .source-card,
html:not(.dark) .base-card,
html:not(.dark) .quiz-card,
html:not(.dark) .inst-card,
html:not(.dark) .loft-card,
html:not(.dark) .mgmt-stat-card,
html:not(.dark) .page-section {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.02) !important;
}

/* ── 5.3 Sub-Panels, Wells & Subtle Boxes (Lower Opacity: /50, /40, /30, /20, /10) ── */
html.light [class*="bg-slate-900/50"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-900/40"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-900/30"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-900/20"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-900/10"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-950/50"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-950/60"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-950/40"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-950/30"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-950/20"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-800/50"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-800/40"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-800/30"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-800/20"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-700/50"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-700/40"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-700/30"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-700/60"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-slate-700/70"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-black/10"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-black/20"]:not(.absolute):not([class*="inset-0"]),
html.light [class*="bg-black/30"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-900/50"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-900/40"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-900/30"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-900/20"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-900/10"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-950/50"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-950/60"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-950/40"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-950/30"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-950/20"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-800/50"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-800/40"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-800/30"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-800/20"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-700/50"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-700/40"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-700/30"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-700/60"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-slate-700/70"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-black/10"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-black/20"]:not(.absolute):not([class*="inset-0"]),
html:not(.dark) [class*="bg-black/30"]:not(.absolute):not([class*="inset-0"]) {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

/* ── 5.3.1 Video & Media Overlays & Badges Protection (Never Turn Opaque White) ── */
html.light .absolute[class*="inset-0"],
html.light [class*="absolute"][class*="inset-0"],
html:not(.dark) .absolute[class*="inset-0"],
html:not(.dark) [class*="absolute"][class*="inset-0"] {
  box-shadow: none !important;
}

/* ── 5.4 Neutral Buttons, Labels & Dashed Upload Dropzones ── */
html.light button[class*="bg-slate-800"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light a[class*="bg-slate-800"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light label[class*="bg-slate-800"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light button[class*="bg-slate-700"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light a[class*="bg-slate-700"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light label[class*="bg-slate-700"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light button[class*="bg-slate-900"]:not([class*="bg-gradient"]):not([class*="from-"]),
html.light label[class*="bg-slate-900"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) button[class*="bg-slate-800"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) a[class*="bg-slate-800"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) label[class*="bg-slate-800"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) button[class*="bg-slate-700"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) a[class*="bg-slate-700"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) label[class*="bg-slate-700"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) button[class*="bg-slate-900"]:not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) label[class*="bg-slate-900"]:not([class*="bg-gradient"]):not([class*="from-"]) {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

html.light button[class*="bg-slate-800"]:hover:not([class*="bg-gradient"]),
html.light a[class*="bg-slate-800"]:hover:not([class*="bg-gradient"]),
html.light label[class*="bg-slate-800"]:hover:not([class*="bg-gradient"]),
html.light button[class*="bg-slate-700"]:hover:not([class*="bg-gradient"]),
html.light a[class*="bg-slate-700"]:hover:not([class*="bg-gradient"]),
html.light label[class*="bg-slate-700"]:hover:not([class*="bg-gradient"]),
html.light button[class*="bg-slate-900"]:hover:not([class*="bg-gradient"]),
html.light label[class*="bg-slate-900"]:hover:not([class*="bg-gradient"]),
html:not(.dark) button[class*="bg-slate-800"]:hover:not([class*="bg-gradient"]),
html:not(.dark) a[class*="bg-slate-800"]:hover:not([class*="bg-gradient"]),
html:not(.dark) label[class*="bg-slate-800"]:hover:not([class*="bg-gradient"]),
html:not(.dark) button[class*="bg-slate-700"]:hover:not([class*="bg-gradient"]),
html:not(.dark) a[class*="bg-slate-700"]:hover:not([class*="bg-gradient"]),
html:not(.dark) label[class*="bg-slate-700"]:hover:not([class*="bg-gradient"]),
html:not(.dark) button[class*="bg-slate-900"]:hover:not([class*="bg-gradient"]),
html:not(.dark) label[class*="bg-slate-900"]:hover:not([class*="bg-gradient"]) {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Upload dropzones & dashed add-photo boxes across all pages */
html.light [class*="border-dashed"],
html:not(.dark) [class*="border-dashed"] {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #1e293b !important;
}
html.light [class*="border-dashed"]:hover,
html:not(.dark) [class*="border-dashed"]:hover {
  background-color: #f1f5f9 !important;
  border-color: #059669 !important;
}
html.light [class*="border-dashed"] .text-slate-400,
html.light [class*="border-dashed"] .text-slate-500,
html:not(.dark) [class*="border-dashed"] .text-slate-400,
html:not(.dark) [class*="border-dashed"] .text-slate-500 {
  color: #475569 !important;
}

/* ── 5.4.1 Translucent Colored Buttons, Labels & Info Wells ── */
html.light button[class*="bg-purple-600/"], html.light button[class*="bg-purple-500/"],
html.light a[class*="bg-purple-600/"], html.light a[class*="bg-purple-500/"],
html.light label[class*="bg-purple-600/"], html.light label[class*="bg-purple-500/"],
html:not(.dark) button[class*="bg-purple-600/"], html:not(.dark) button[class*="bg-purple-500/"],
html:not(.dark) a[class*="bg-purple-600/"], html:not(.dark) a[class*="bg-purple-500/"],
html:not(.dark) label[class*="bg-purple-600/"], html:not(.dark) label[class*="bg-purple-500/"] {
  background-color: #f3e8ff !important;
  border-color: #c084fc !important;
  color: #6b21a8 !important;
}
html.light button[class*="bg-purple-600/"]:hover, html.light button[class*="bg-purple-500/"]:hover,
html:not(.dark) button[class*="bg-purple-600/"]:hover, html:not(.dark) button[class*="bg-purple-500/"]:hover {
  background-color: #e9d5ff !important;
}

html.light button[class*="bg-emerald-600/"], html.light button[class*="bg-emerald-500/"],
html.light a[class*="bg-emerald-600/"], html.light a[class*="bg-emerald-500/"],
html.light label[class*="bg-emerald-600/"], html.light label[class*="bg-emerald-500/"],
html:not(.dark) button[class*="bg-emerald-600/"], html:not(.dark) button[class*="bg-emerald-500/"],
html:not(.dark) a[class*="bg-emerald-600/"], html:not(.dark) a[class*="bg-emerald-500/"],
html:not(.dark) label[class*="bg-emerald-600/"], html:not(.dark) label[class*="bg-emerald-500/"] {
  background-color: #d1fae5 !important;
  border-color: #34d399 !important;
  color: #065f46 !important;
}
html.light button[class*="bg-emerald-600/"]:hover, html.light button[class*="bg-emerald-500/"]:hover,
html:not(.dark) button[class*="bg-emerald-600/"]:hover, html:not(.dark) button[class*="bg-emerald-500/"]:hover {
  background-color: #a7f3d0 !important;
}

html.light button[class*="bg-sky-600/"], html.light button[class*="bg-sky-500/"],
html.light a[class*="bg-sky-600/"], html.light a[class*="bg-sky-500/"],
html.light label[class*="bg-sky-600/"], html.light label[class*="bg-sky-500/"],
html:not(.dark) button[class*="bg-sky-600/"], html:not(.dark) button[class*="bg-sky-500/"],
html:not(.dark) a[class*="bg-sky-600/"], html:not(.dark) a[class*="bg-sky-500/"],
html:not(.dark) label[class*="bg-sky-600/"], html:not(.dark) label[class*="bg-sky-500/"] {
  background-color: #e0f2fe !important;
  border-color: #38bdf8 !important;
  color: #075985 !important;
}
html.light button[class*="bg-sky-600/"]:hover, html.light button[class*="bg-sky-500/"]:hover,
html:not(.dark) button[class*="bg-sky-600/"]:hover, html:not(.dark) button[class*="bg-sky-500/"]:hover {
  background-color: #bae6fd !important;
}

html.light button[class*="bg-indigo-600/"], html.light button[class*="bg-indigo-500/"],
html.light a[class*="bg-indigo-600/"], html.light a[class*="bg-indigo-500/"],
html.light label[class*="bg-indigo-600/"], html.light label[class*="bg-indigo-500/"],
html:not(.dark) button[class*="bg-indigo-600/"], html:not(.dark) button[class*="bg-indigo-500/"],
html:not(.dark) a[class*="bg-indigo-600/"], html:not(.dark) a[class*="bg-indigo-500/"],
html:not(.dark) label[class*="bg-indigo-600/"], html:not(.dark) label[class*="bg-indigo-500/"] {
  background-color: #e0e7ff !important;
  border-color: #818cf8 !important;
  color: #3730a3 !important;
}
html.light label[class*="bg-indigo-600/"]:hover, html.light button[class*="bg-indigo-600/"]:hover, html.light button[class*="bg-indigo-500/"]:hover,
html:not(.dark) label[class*="bg-indigo-600/"]:hover, html:not(.dark) button[class*="bg-indigo-600/"]:hover, html:not(.dark) button[class*="bg-indigo-500/"]:hover {
  background-color: #c7d2fe !important;
}

html.light button[class*="bg-amber-600/"], html.light button[class*="bg-amber-500/"],
html.light a[class*="bg-amber-600/"]:not(.is-active-nav), html.light a[class*="bg-amber-500/"]:not(.is-active-nav),
html.light label[class*="bg-amber-600/"], html.light label[class*="bg-amber-500/"],
html:not(.dark) button[class*="bg-amber-600/"], html:not(.dark) button[class*="bg-amber-500/"],
html:not(.dark) a[class*="bg-amber-600/"]:not(.is-active-nav), html:not(.dark) a[class*="bg-amber-500/"]:not(.is-active-nav),
html:not(.dark) label[class*="bg-amber-600/"], html:not(.dark) label[class*="bg-amber-500/"] {
  background-color: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #92400e !important;
}

html.light button[class*="bg-teal-600/"], html.light button[class*="bg-teal-500/"],
html.light label[class*="bg-teal-600/"], html.light label[class*="bg-teal-500/"],
html:not(.dark) button[class*="bg-teal-600/"], html:not(.dark) button[class*="bg-teal-500/"],
html:not(.dark) label[class*="bg-teal-600/"], html:not(.dark) label[class*="bg-teal-500/"] {
  background-color: #ccfbf1 !important;
  border-color: #2dd4bf !important;
  color: #115e59 !important;
}

html.light button[class*="bg-rose-600/"], html.light button[class*="bg-rose-500/"],
html.light label[class*="bg-rose-600/"], html.light label[class*="bg-rose-500/"],
html:not(.dark) button[class*="bg-rose-600/"], html:not(.dark) button[class*="bg-rose-500/"],
html:not(.dark) label[class*="bg-rose-600/"], html:not(.dark) label[class*="bg-rose-500/"] {
  background-color: #ffe4e6 !important;
  border-color: #fb7185 !important;
  color: #9f1239 !important;
}

/* Soft tinted settings boxes (-950/20..30) inside modals/cards */
html.light [class*="bg-emerald-950/"],
html:not(.dark) [class*="bg-emerald-950/"] {
  background-color: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #064e3b !important;
}
html.light [class*="bg-indigo-950/"],
html:not(.dark) [class*="bg-indigo-950/"] {
  background-color: #eef2ff !important;
  border-color: #a5b4fc !important;
  color: #312e81 !important;
}
html.light [class*="bg-purple-950/"],
html:not(.dark) [class*="bg-purple-950/"] {
  background-color: #faf5ff !important;
  border-color: #d8b4fe !important;
  color: #581c87 !important;
}
html.light [class*="bg-amber-950/"],
html:not(.dark) [class*="bg-amber-950/"] {
  background-color: #fffbeb !important;
  border-color: #fcd34d !important;
  color: #78350f !important;
}

/* ── 5.5 Neutral Badges, Chips & Pills ── */
html.light span[class*="bg-slate-800"]:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-teal"]):not([class*="bg-indigo"]):not([class*="bg-gradient"]):not([class*="from-"]),
html.light span[class*="bg-slate-900"]:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-teal"]):not([class*="bg-indigo"]):not([class*="bg-gradient"]):not([class*="from-"]),
html.light span[class*="bg-slate-950"]:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-teal"]):not([class*="bg-indigo"]):not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) span[class*="bg-slate-800"]:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-teal"]):not([class*="bg-indigo"]):not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) span[class*="bg-slate-900"]:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-teal"]):not([class*="bg-indigo"]):not([class*="bg-gradient"]):not([class*="from-"]),
html:not(.dark) span[class*="bg-slate-950"]:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-sky"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-teal"]):not([class*="bg-indigo"]):not([class*="bg-gradient"]):not([class*="from-"]) {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}

/* ── 6. Typography & Text Colors in Light Mode ── */
html.light h1, html.light h2, html.light h3,
html.light h4, html.light h5, html.light h6,
html:not(.dark) h1, html:not(.dark) h2, html:not(.dark) h3,
html:not(.dark) h4, html:not(.dark) h5, html:not(.dark) h6 {
  color: #0f172a !important;
}

html.light .text-slate-100,
html.light .text-slate-200,
html.light .text-gray-100,
html.light .text-gray-200,
html:not(.dark) .text-slate-100,
html:not(.dark) .text-slate-200,
html:not(.dark) .text-gray-100,
html:not(.dark) .text-gray-200 {
  color: #1e293b !important;
}

html.light .text-slate-300,
html.light .text-gray-300,
html:not(.dark) .text-slate-300,
html:not(.dark) .text-gray-300 {
  color: #334155 !important;
}

html.light .text-slate-400,
html.light .text-gray-400,
html:not(.dark) .text-slate-400,
html:not(.dark) .text-gray-400 {
  color: #475569 !important;
}

html.light .text-slate-500,
html.light .text-gray-500,
html:not(.dark) .text-slate-500,
html:not(.dark) .text-gray-500 {
  color: #64748b !important;
}

/* Soft text adjustments (-200 / -300 / -400) for readable colors on light surfaces */
html.light .text-amber-200,
html.light .text-amber-300,
html:not(.dark) .text-amber-200,
html:not(.dark) .text-amber-300 {
  color: #b45309 !important;
}
html.light .text-rose-200,
html.light .text-rose-300,
html:not(.dark) .text-rose-200,
html:not(.dark) .text-rose-300 {
  color: #be123c !important;
}
html.light .text-purple-200,
html.light .text-purple-300,
html:not(.dark) .text-purple-200,
html:not(.dark) .text-purple-300 {
  color: #6d28d9 !important;
}
html.light .text-emerald-200,
html.light .text-emerald-300,
html:not(.dark) .text-emerald-200,
html:not(.dark) .text-emerald-300 {
  color: #047857 !important;
}
html.light .text-teal-200,
html.light .text-teal-300,
html:not(.dark) .text-teal-200,
html:not(.dark) .text-teal-300 {
  color: #0f766e !important;
}
html.light .text-indigo-200,
html.light .text-indigo-300,
html:not(.dark) .text-indigo-200,
html:not(.dark) .text-indigo-300 {
  color: #3730a3 !important;
}
html.light .text-sky-200,
html.light .text-sky-300,
html:not(.dark) .text-sky-200,
html:not(.dark) .text-sky-300 {
  color: #0369a1 !important;
}
html.light .text-blue-200,
html.light .text-blue-300,
html:not(.dark) .text-blue-200,
html:not(.dark) .text-blue-300 {
  color: #1d4ed8 !important;
}
html.light .text-cyan-200,
html.light .text-cyan-300,
html:not(.dark) .text-cyan-200,
html:not(.dark) .text-cyan-300 {
  color: #0e7490 !important;
}
html.light .text-pink-200,
html.light .text-pink-300,
html:not(.dark) .text-pink-200,
html:not(.dark) .text-pink-300 {
  color: #be185d !important;
}

/* Darken -400 icons/labels inside light buttons, labels & dropzones */
html.light [class*="border-dashed"] .text-emerald-400,
html.light label .text-emerald-400,
html.light button:not([class*="bg-gradient"]) .text-emerald-400,
html:not(.dark) [class*="border-dashed"] .text-emerald-400,
html:not(.dark) label .text-emerald-400,
html:not(.dark) button:not([class*="bg-gradient"]) .text-emerald-400 {
  color: #059669 !important;
}
html.light [class*="border-dashed"] .text-amber-400,
html.light label .text-amber-400,
html.light button:not([class*="bg-gradient"]) .text-amber-400,
html:not(.dark) [class*="border-dashed"] .text-amber-400,
html:not(.dark) label .text-amber-400,
html:not(.dark) button:not([class*="bg-gradient"]) .text-amber-400 {
  color: #b45309 !important;
}
html.light [class*="border-dashed"] .text-indigo-400,
html.light label .text-indigo-400,
html.light button:not([class*="bg-gradient"]) .text-indigo-400,
html:not(.dark) [class*="border-dashed"] .text-indigo-400,
html:not(.dark) label .text-indigo-400,
html:not(.dark) button:not([class*="bg-gradient"]) .text-indigo-400 {
  color: #4338ca !important;
}
html.light [class*="border-dashed"] .text-sky-400,
html.light label .text-sky-400,
html.light button:not([class*="bg-gradient"]) .text-sky-400,
html:not(.dark) [class*="border-dashed"] .text-sky-400,
html:not(.dark) label .text-sky-400,
html:not(.dark) button:not([class*="bg-gradient"]) .text-sky-400 {
  color: #0284c7 !important;
}
html.light [class*="border-dashed"] .text-purple-400,
html.light label .text-purple-400,
html.light button:not([class*="bg-gradient"]) .text-purple-400,
html:not(.dark) [class*="border-dashed"] .text-purple-400,
html:not(.dark) label .text-purple-400,
html:not(.dark) button:not([class*="bg-gradient"]) .text-purple-400 {
  color: #7e22ce !important;
}

/* Selectively handle text-white: DO NOT override when inside buttons, badges or vibrant backgrounds */
html.light p.text-white,
html.light h1.text-white,
html.light h2.text-white,
html.light h3.text-white,
html.light h4.text-white,
html.light h5.text-white,
html.light h6.text-white,
html.light div.text-white:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-blue"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-sky"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html.light span.text-white:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-blue"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-sky"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) p.text-white,
html:not(.dark) h1.text-white,
html:not(.dark) h2.text-white,
html:not(.dark) h3.text-white,
html:not(.dark) h4.text-white,
html:not(.dark) h5.text-white,
html:not(.dark) h6.text-white,
html:not(.dark) div.text-white:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-blue"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-sky"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]),
html:not(.dark) span.text-white:not([class*="bg-amber"]):not([class*="bg-emerald"]):not([class*="bg-blue"]):not([class*="bg-rose"]):not([class*="bg-purple"]):not([class*="bg-indigo"]):not([class*="bg-teal"]):not([class*="bg-sky"]):not([class*="bg-gradient"]):not([class*="from-"]):not([class*="to-"]) {
  color: #0f172a !important;
}

/* Preserve white/gold text inside dark gradient buttons & fullscreen photo lightbox */
html.light button[class*="bg-gradient"]:not([class*="text-slate-9"]) span,
html.light a[class*="bg-gradient"]:not([class*="text-slate-9"]) span,
html.light button[class*="bg-gradient"]:not([class*="text-slate-9"]) i:not(.text-amber-300),
html.light a[class*="bg-gradient"]:not([class*="text-slate-9"]) i:not(.text-amber-300),
html.light button[class*="bg-gradient"]:not([class*="text-slate-9"]),
html.light a[class*="bg-gradient"]:not([class*="text-slate-9"]),
html:not(.dark) button[class*="bg-gradient"]:not([class*="text-slate-9"]) span,
html:not(.dark) a[class*="bg-gradient"]:not([class*="text-slate-9"]) span,
html:not(.dark) button[class*="bg-gradient"]:not([class*="text-slate-9"]) i:not(.text-amber-300),
html:not(.dark) a[class*="bg-gradient"]:not([class*="text-slate-9"]) i:not(.text-amber-300),
html:not(.dark) button[class*="bg-gradient"]:not([class*="text-slate-9"]),
html:not(.dark) a[class*="bg-gradient"]:not([class*="text-slate-9"]) {
  color: #ffffff !important;
}
html.light button[class*="bg-gradient"] .text-amber-300,
html:not(.dark) button[class*="bg-gradient"] .text-amber-300 {
  color: #fde68a !important;
}
html.light #modal-image-lightbox .text-white,
html:not(.dark) #modal-image-lightbox .text-white {
  color: #ffffff !important;
}

/* ── 7. Universal Borders & Dividers ── */
html.light [class*="border-slate-800"]:not([class*="border-dashed"]),
html.light [class*="border-slate-700"]:not([class*="border-dashed"]),
html.light [class*="border-slate-600"]:not([class*="border-dashed"]),
html.light [class*="border-gray-800"]:not([class*="border-dashed"]),
html.light [class*="border-gray-700"]:not([class*="border-dashed"]),
html:not(.dark) [class*="border-slate-800"]:not([class*="border-dashed"]),
html:not(.dark) [class*="border-slate-700"]:not([class*="border-dashed"]),
html:not(.dark) [class*="border-slate-600"]:not([class*="border-dashed"]),
html:not(.dark) [class*="border-gray-800"]:not([class*="border-dashed"]),
html:not(.dark) [class*="border-gray-700"]:not([class*="border-dashed"]) {
  border-color: #e2e8f0 !important;
}

html.light .divide-slate-800 > *,
html.light .divide-slate-700 > *,
html:not(.dark) .divide-slate-800 > *,
html:not(.dark) .divide-slate-700 > * {
  border-color: #e2e8f0 !important;
}

/* ── 8. Form Inputs, Selects & Textareas ── */
html.light input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]),
html.light select,
html.light textarea,
html:not(.dark) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]),
html:not(.dark) select,
html:not(.dark) textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light input::placeholder,
html.light textarea::placeholder,
html:not(.dark) input::placeholder,
html:not(.dark) textarea::placeholder {
  color: #94a3b8 !important;
  opacity: 1 !important;
}

html.light select option,
html:not(.dark) select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html.light input:focus,
html.light select:focus,
html.light textarea:focus,
html:not(.dark) input:focus,
html:not(.dark) select:focus,
html:not(.dark) textarea:focus {
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15) !important;
}

html.light input[type="date"],
html:not(.dark) input[type="date"] {
  color-scheme: light !important;
}

/* ── 9. Modals & Dialog Overlays ── */
html.light .modal-overlay,
html.light .app-auth-guard-overlay,
html.light [id*="modal-"].fixed.inset-0,
html.light [id$="-modal"].fixed.inset-0,
html.light .modal-backdrop.fixed.inset-0,
html.light [id*="modal-"] > div.fixed.inset-0,
html.light .fixed.inset-0.bg-slate-950\/80,
html.light .fixed.inset-0.bg-slate-950\/85,
html.light .fixed.inset-0.bg-slate-950\/90,
html.light .fixed.inset-0.bg-black\/70,
html.light .fixed.inset-0.bg-black\/80,
html:not(.dark) .modal-overlay,
html:not(.dark) .app-auth-guard-overlay,
html:not(.dark) [id*="modal-"].fixed.inset-0,
html:not(.dark) [id$="-modal"].fixed.inset-0,
html:not(.dark) .modal-backdrop.fixed.inset-0,
html:not(.dark) [id*="modal-"] > div.fixed.inset-0,
html:not(.dark) .fixed.inset-0.bg-slate-950\/80,
html:not(.dark) .fixed.inset-0.bg-slate-950\/85,
html:not(.dark) .fixed.inset-0.bg-slate-950\/90,
html:not(.dark) .fixed.inset-0.bg-black\/70,
html:not(.dark) .fixed.inset-0.bg-black\/80 {
  background-color: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

html.light .modal-overlay > div,
html.light .app-auth-guard-card,
html.light #modal-admin-nav > div,
html.light #admin-nav-modal > div,
html.light [id*="modal-"]:not(#modal-image-lightbox):not(#gamified-quiz-runner-modal) > div:first-child:not(.fixed),
html.light [id$="-modal"]:not(#gamified-quiz-runner-modal) > div:first-child:not(.fixed),
html.light [id*="modal-"]:not(#modal-image-lightbox) .relative.rounded-3xl,
html.light [id*="modal-"]:not(#modal-image-lightbox) .relative.rounded-2xl,
html:not(.dark) .modal-overlay > div,
html:not(.dark) .app-auth-guard-card,
html:not(.dark) #modal-admin-nav > div,
html:not(.dark) #admin-nav-modal > div,
html:not(.dark) [id*="modal-"]:not(#modal-image-lightbox):not(#gamified-quiz-runner-modal) > div:first-child:not(.fixed),
html:not(.dark) [id$="-modal"]:not(#gamified-quiz-runner-modal) > div:first-child:not(.fixed),
html:not(.dark) [id*="modal-"]:not(#modal-image-lightbox) .relative.rounded-3xl,
html:not(.dark) [id*="modal-"]:not(#modal-image-lightbox) .relative.rounded-2xl {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

/* ── 10. Tables in Light Mode ── */
html.light table thead,
html.light table th,
html:not(.dark) table thead,
html:not(.dark) table th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}

html.light table tbody tr,
html:not(.dark) table tbody tr {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #f1f5f9 !important;
}

html.light table tbody tr:hover,
html:not(.dark) table tbody tr:hover {
  background-color: #f8fafc !important;
}

/* ── 11. Custom Scrollbars in Light Mode ── */
html.light .custom-scrollbar::-webkit-scrollbar-thumb,
html:not(.dark) .custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5) !important;
}
html.light .custom-scrollbar::-webkit-scrollbar-track,
html:not(.dark) .custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(241, 245, 249, 0.8) !important;
}

/* ── 12. Leaflet Map Controls in Light Mode ── */
html.light .leaflet-bar a,
html:not(.dark) .leaflet-bar a {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #e2e8f0 !important;
}
html.light .leaflet-popup-content-wrapper,
html:not(.dark) .leaflet-popup-content-wrapper {
  background-color: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important;
}

/* ── 13. Page-Specific Refinements (pathway, index, scan, upskill, report-bug) ── */

/* A. Pathway Page Specifics */
html.light #pathway-form-section .glass-card,
html:not(.dark) #pathway-form-section .glass-card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}
html.light #pathway-result-section .glass-card,
html:not(.dark) #pathway-result-section .glass-card {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* B. Index Page Quick Hub Cards & Podium */
html.light .hero-glow,
html:not(.dark) .hero-glow {
  opacity: 0.12 !important;
}
html.light .podium-base,
html:not(.dark) .podium-base {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

/* C. Scan Page Specifics */
html.light #scanner-placeholder,
html:not(.dark) #scanner-placeholder {
  background-color: #f8fafc !important;
  color: #64748b !important;
}
html.light #scanner-placeholder .w-16.h-16,
html:not(.dark) #scanner-placeholder .w-16.h-16 {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}
html.light #manual-checkin-code,
html:not(.dark) #manual-checkin-code {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* D. Upskill Page Specifics */
html.light [data-video-dur-id],
html:not(.dark) [data-video-dur-id] {
  background-color: rgba(15, 23, 42, 0.8) !important;
  color: #ffffff !important;
}

/* E. Report Bug Page Specifics */
html.light #card-type-bug,
html:not(.dark) #card-type-bug {
  background-color: #ffffff !important;
  border-color: #fecdd3 !important;
}
html.light #card-type-feature,
html:not(.dark) #card-type-feature {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}
html.light #form-system-report,
html:not(.dark) #form-system-report {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}
html.light #drop-zone,
html:not(.dark) #drop-zone {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
html.light #upload-prompt .w-12.h-12,
html:not(.dark) #upload-prompt .w-12.h-12 {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* E.1 Profile Page Theme Mode Settings Card */
html.light #theme-mode-card,
html:not(.dark) #theme-mode-card {
  background-color: #ffffff !important;
  background-image: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%) !important;
  border-color: #fde68a !important;
  color: #0f172a !important;
  box-shadow: 0 10px 30px -5px rgba(245, 158, 11, 0.08) !important;
}
html.light #theme-mode-card h3,
html.light #theme-mode-card [id^="btn-theme-preset-"] .text-white,
html:not(.dark) #theme-mode-card h3,
html:not(.dark) #theme-mode-card [id^="btn-theme-preset-"] .text-white {
  color: #0f172a !important;
}
html.light #theme-mode-card [id^="btn-theme-preset-"] .bg-slate-800,
html:not(.dark) #theme-mode-card [id^="btn-theme-preset-"] .bg-slate-800 {
  background-color: #f1f5f9 !important;
}


/* F. Sources Page Specifics (.source-card, .base-card, .quiz-card, tabs, choice-box) */
html.light .source-card,
html.light .base-card,
html.light .quiz-card,
html:not(.dark) .source-card,
html:not(.dark) .base-card,
html:not(.dark) .quiz-card {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
html.light .choice-box,
html:not(.dark) .choice-box {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
html.light .tab-btn,
html:not(.dark) .tab-btn {
  color: #64748b;
  border-color: transparent;
}
html.light .tab-btn:hover,
html:not(.dark) .tab-btn:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}
html.light .tab-btn.active,
html:not(.dark) .tab-btn.active {
  background-color: #e0f2fe !important;
  color: #0284c7 !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.12) !important;
}

/* G. Institutions Page Specifics (.inst-card, .sub-unit-tag) */
html.light .inst-card,
html:not(.dark) .inst-card {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
html.light .sub-unit-tag,
html:not(.dark) .sub-unit-tag {
  background-color: #f1f5f9 !important;
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

/* H. Certificate Editor & Registry (.cert-stage, .cert-canvas-container, .cert-live-canvas) */
html.light .cert-stage,
html:not(.dark) .cert-stage {
  background-color: #f1f5f9 !important;
  background: #f1f5f9 !important;
}
.cert-canvas-container,
.cert-live-canvas {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px #e2e8f0 !important;
}
html.light #cert-preview-loader,
html:not(.dark) #cert-preview-loader {
  background-color: rgba(255, 255, 255, 0.95) !important;
  color: #64748b !important;
}

/* I. Admin Management Data Tables & Stats Bars */
html.light table,
html:not(.dark) table {
  color: #1e293b !important;
}
html.light table thead tr,
html:not(.dark) table thead tr {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
html.light table th,
html:not(.dark) table th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-color: #e2e8f0 !important;
}
html.light table tbody tr,
html:not(.dark) table tbody tr {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #f1f5f9 !important;
}
html.light table tbody tr:hover,
html:not(.dark) table tbody tr:hover {
  background-color: #f8fafc !important;
}
html.light table td,
html:not(.dark) table td {
  border-color: #f1f5f9 !important;
  color: #334155 !important;
}
html.light table td .text-white,
html.light table td .text-slate-100,
html.light table td .text-slate-200,
html.light table td .text-slate-300,
html:not(.dark) table td .text-white,
html:not(.dark) table td .text-slate-100,
html:not(.dark) table td .text-slate-200,
html:not(.dark) table td .text-slate-300 {
  color: #0f172a !important;
}
html.light table td .text-slate-400,
html:not(.dark) table td .text-slate-400 {
  color: #64748b !important;
}

/* J. Admin Form Fields & Search Inputs */
html.light .custom-card input,
html.light .custom-card select,
html.light .custom-card textarea,
html.light .source-card input,
html.light .source-card select,
html.light .source-card textarea,
html:not(.dark) .custom-card input,
html:not(.dark) .custom-card select,
html:not(.dark) .custom-card textarea,
html:not(.dark) .source-card input,
html:not(.dark) .source-card select,
html:not(.dark) .source-card textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* ── 14. Theme Switcher UI Elements Styling ── */
.theme-switch-track {
  position: relative;
  width: 38px;
  height: 20px;
  background-color: #334155;
  border-radius: 9999px;
  transition: background-color 0.25s ease;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
html.light .theme-switch-track,
html:not(.dark) .theme-switch-track {
  background-color: #f59e0b;
}

.theme-switch-thumb {
  width: 16px;
  height: 16px;
  background-color: #ffffff;
  border-radius: 9999px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translateX(0px);
}
html.light .theme-switch-thumb,
html:not(.dark) .theme-switch-thumb {
  transform: translateX(18px);
}

/* Floating Quick Theme Toggle Button - Disabled per user design request */
#loft-quick-theme-toggle {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ── 15. Prevent Sticky Topbar Title Collapse Across Screen Widths, Sidebar & Zoom ── */
@media (min-width: 1024px) {
  header > div.flex.lg\:flex-row {
    flex-wrap: wrap !important;
  }
  header > div.flex.lg\:flex-row > div:first-child:not(:last-child) {
    flex: 1 1 380px !important;
    min-width: min(100%, 380px) !important;
  }
  header > div.flex.lg\:flex-row > div:last-child:not(:first-child) {
    flex: 0 1 auto !important;
    max-width: 100% !important;
  }
}

