/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { opacity: 0.8; }

/* Ultra-Refined Glassmorphism Classes */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.4);
}

.glass-card-hover {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.glass-card-hover:hover {
  border-color: rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 20px 40px -12px rgba(59, 130, 246, 0.22);
}

.glass-modal {
  background: var(--glass-modal-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-medium);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
}

/* Severity Badges with strict whitespace prevention */
.badge-blocker { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: max-content; }
.badge-critical { background: rgba(249, 115, 22, 0.2); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.4); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: max-content; }
.badge-major { background: rgba(234, 179, 8, 0.2); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.4); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: max-content; }
.badge-minor { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.4); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: max-content; }
.badge-info { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.4); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; min-width: max-content; }

/* Markdown Body Styling */
.markdown-body { color: #e2e8f0; line-height: 1.7; }
.markdown-body pre {
  background: var(--code-bg) !important;
  padding: 1.25rem !important;
  border-radius: 0.875rem !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.85rem !important;
  border: 1px solid var(--border-medium) !important;
  margin: 1.25rem 0 !important;
  overflow-x: auto;
}
.markdown-body h1 { font-size: 1.5rem; font-weight: 800; color: #60a5fa; margin: 1.75rem 0 0.75rem; letter-spacing: -0.02em; }
.markdown-body h2 { font-size: 1.25rem; font-weight: 700; color: #93c5fd; margin: 1.5rem 0 0.5rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.4rem; }
.markdown-body h3 { font-size: 1.05rem; font-weight: 600; color: #bfdbfe; margin: 1.2rem 0 0.4rem; }
.markdown-body ul { list-style-type: disc; margin-left: 1.5rem; margin-bottom: 1rem; color: #cbd5e1; }
.markdown-body li { margin-bottom: 0.35rem; }
.markdown-body code { font-family: 'JetBrains Mono', monospace; background: rgba(255,255,255,0.08); padding: 0.15rem 0.4rem; border-radius: 0.3rem; font-size: 0.85em; color: #38bdf8; }
.markdown-body blockquote { border-left: 4px solid #3b82f6; padding-left: 1rem; color: #94a3b8; margin: 1rem 0; font-style: italic; background: rgba(59, 130, 246, 0.05); padding-top: 0.5rem; padding-bottom: 0.5rem; border-radius: 0 0.5rem 0.5rem 0; }

/* Floating Theme Toast Notifications */
#themeToastContainer {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.theme-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-surface-850);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.5);
  animation: themeToastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.theme-toast.toast-hiding {
  animation: themeToastSlideOut 0.25s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}
@keyframes themeToastSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes themeToastSlideOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(12px) scale(0.95); }
}

/* ========================================================================= */
/* 1. LIGHT MODE OVERRIDES FOR MAXIMUM LEGIBILITY, HIGH-CONTRAST BADGES & METRICS */
/* Supports both html.light and [data-theme*="light"]                        */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) {
  color-scheme: light;
}

:is(html.light, [data-theme*="light"]) body {
  background-color: var(--bg-surface-950) !important;
  color: #1e293b !important;
}

:is(html.light, [data-theme*="light"]) .glass-panel {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 4px 10px -4px rgba(0, 0, 0, 0.04);
}

:is(html.light, [data-theme*="light"]) .glass-modal {
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.08);
}

/* Light Theme Text Color Conversions (Ensure high contrast on white/light surfaces) */
:is(html.light, [data-theme*="light"]) .text-white {
  color: #0f172a !important;
}

:is(html.light, [data-theme*="light"]) .text-slate-100 {
  color: #0f172a !important;
}

:is(html.light, [data-theme*="light"]) .text-slate-200 {
  color: #333333 !important;
}

:is(html.light, [data-theme*="light"]) .text-slate-300 {
  color: #333333 !important;
}

:is(html.light, [data-theme*="light"]) .text-slate-400 {
  color: #555555 !important;
}

:is(html.light, [data-theme*="light"]) .text-slate-500,
:is(html.light, [data-theme*="light"]) .text-slate-600 {
  color: #666666 !important;
}

/* Base borders & subtle surfaces on Light */
:is(html.light, [data-theme*="light"]) :is(
  .border-white\/5,
  .border-white\/10,
  .border-white\/15,
  .border-white\/20,
  .border-white\/25,
  .border-white\/30
) {
  border-color: rgba(15, 23, 42, 0.12) !important;
}

:is(html.light, [data-theme*="light"]) .bg-white\/5 {
  background-color: rgba(15, 23, 42, 0.04) !important;
}

:is(html.light, [data-theme*="light"]) .bg-white\/10 {
  background-color: rgba(15, 23, 42, 0.07) !important;
}

:is(html.light, [data-theme*="light"]) .hover\:bg-white\/5:hover {
  background-color: rgba(15, 23, 42, 0.05) !important;
}

:is(html.light, [data-theme*="light"]) .hover\:bg-white\/10:hover {
  background-color: rgba(15, 23, 42, 0.09) !important;
}

:is(html.light, [data-theme*="light"]) .hover\:bg-white\/\[0\.03\]:hover {
  background-color: rgba(15, 23, 42, 0.04) !important;
}

/* Light Theme Input / Form Fields */
:is(html.light, [data-theme*="light"]) input:not([type="checkbox"]):not([type="radio"]),
:is(html.light, [data-theme*="light"]) select,
:is(html.light, [data-theme*="light"]) textarea {
  color: #0f172a !important;
}

:is(html.light, [data-theme*="light"]) input::placeholder,
:is(html.light, [data-theme*="light"]) textarea::placeholder {
  color: #64748b !important;
}

:is(html.light, [data-theme*="light"]) select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

/* Light Theme: Prevent dark gradient smears from dark mode styles */
:is(html.light, [data-theme*="light"]) .to-blue-950\/40 {
  --tw-gradient-to: rgba(59, 130, 246, 0.05) var(--tw-gradient-to-position, to right) !important;
}

/* ========================================================================= */
/* METRICS & NUMERICAL HIGHLIGHTS CONTRAST FIXES FOR LIGHT THEME             */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) :is(.text-amber-400, .text-amber-300, .text-yellow-400, .text-yellow-300, .text-orange-400) {
  color: #b45309 !important; /* Amber 700 - Deep, vivid, high contrast */
}

:is(html.light, [data-theme*="light"]) :is(.text-rose-400, .text-rose-300, .text-red-400, .text-red-300) {
  color: #b91c1c !important; /* Red 700 - Bold crisp red */
}

:is(html.light, [data-theme*="light"]) :is(.text-emerald-400, .text-emerald-300, .text-green-400, .text-green-300) {
  color: #047857 !important; /* Emerald 700 - Rich dark green */
}

:is(html.light, [data-theme*="light"]) :is(.text-blue-400, .text-blue-300, .text-sky-400, .text-sky-300) {
  color: #1d4ed8 !important; /* Blue 700 - Clear saturated blue */
}

:is(html.light, [data-theme*="light"]) :is(.text-purple-400, .text-purple-300, .text-violet-400) {
  color: #7e22ce !important; /* Purple 700 - Deep violet */
}

:is(html.light, [data-theme*="light"]) :is(.text-cyan-400, .text-cyan-300) {
  color: #0e7490 !important; /* Cyan 700 - Deep sharp cyan */
}

:is(html.light, [data-theme*="light"]) :is(.text-indigo-400, .text-indigo-300) {
  color: #4338ca !important; /* Indigo 700 */
}

/* ========================================================================= */
/* BADGES, NOTIFICATIONS & PILLS CONTRAST (BACKGROUND + TEXT + BORDER)       */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) :is(
  .bg-amber-500\/10,
  .bg-amber-500\/15,
  .bg-amber-500\/20,
  .bg-amber-500\/30,
  .bg-yellow-500\/10,
  .bg-yellow-500\/20
) {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-rose-500\/10,
  .bg-rose-500\/15,
  .bg-rose-500\/20,
  .bg-rose-500\/30,
  .bg-red-500\/10,
  .bg-red-500\/20
) {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #ef4444 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-emerald-500\/10,
  .bg-emerald-500\/15,
  .bg-emerald-500\/20,
  .bg-emerald-500\/30,
  .bg-green-500\/10,
  .bg-green-500\/20
) {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
  border-color: #10b981 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-blue-500\/10,
  .bg-blue-500\/15,
  .bg-blue-500\/20,
  .bg-blue-500\/30,
  .bg-sky-500\/20
) {
  background-color: #dbeafe !important;
  color: #1e40af !important;
  border-color: #3b82f6 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-purple-500\/10,
  .bg-purple-500\/15,
  .bg-purple-500\/20,
  .bg-purple-500\/30
) {
  background-color: #f3e8ff !important;
  color: #6b21a8 !important;
  border-color: #a855f7 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-cyan-500\/10,
  .bg-cyan-500\/15,
  .bg-cyan-500\/20,
  .bg-cyan-500\/30
) {
  background-color: #cffafe !important;
  color: #155e75 !important;
  border-color: #06b6d4 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-indigo-500\/10,
  .bg-indigo-500\/15,
  .bg-indigo-500\/20,
  .bg-indigo-500\/30
) {
  background-color: #e0e7ff !important;
  color: #3730a3 !important;
  border-color: #818cf8 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  .bg-pink-500\/10,
  .bg-pink-500\/15,
  .bg-pink-500\/20,
  .text-pink-400
) {
  background-color: #fce7f3 !important;
  color: #9d174d !important;
  border-color: #f472b6 !important;
  font-weight: 700 !important;
}

/* Table Light Mode Overrides */
:is(html.light, [data-theme*="light"]) thead {
  background-color: #f8fafc !important;
  color: #334155 !important;
  border-bottom-color: #e2e8f0 !important;
}

:is(html.light, [data-theme*="light"]) tbody tr {
  border-bottom-color: #f1f5f9 !important;
}

:is(html.light, [data-theme*="light"]) :is(tbody tr:hover, tr.hover\:bg-white\/5:hover) {
  background-color: #f8fafc !important;
}

:is(html.light, [data-theme*="light"]) td {
  color: #1e293b !important;
}

/* ========================================================================= */
/* SIDEBAR & NAVIGATION LIGHT THEME CONTRAST                                 */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) aside {
  background-color: #ffffff !important;
  border-right-color: #e2e8f0 !important;
}

:is(html.light, [data-theme*="light"]) aside button {
  color: #334155 !important;
}

:is(html.light, [data-theme*="light"]) aside button:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

/* Inactive Sidebar Buttons in Light Mode */
:is(html.light, [data-theme*="light"]) aside button:not([class*="bg-blue-600/"]):not([class~="bg-blue-600"]):not([class~="bg-purple-600"]) {
  color: #334155 !important;
  background-color: transparent !important;
}

:is(html.light, [data-theme*="light"]) aside button:not([class*="bg-blue-600/"]):not([class~="bg-blue-600"]):not([class~="bg-purple-600"]) span {
  color: #334155 !important;
}

:is(html.light, [data-theme*="light"]) aside button:not([class*="bg-blue-600/"]):not([class~="bg-blue-600"]):not([class~="bg-purple-600"]):hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

:is(html.light, [data-theme*="light"]) aside button:not([class*="bg-blue-600/"]):not([class~="bg-blue-600"]):not([class~="bg-purple-600"]):hover span {
  color: #0f172a !important;
}

/* Active Nav Button in Light Mode */
:is(html.light, [data-theme*="light"]) aside button[class*="bg-blue-600/"],
:is(html.light, [data-theme*="light"]) aside button[class*="text-blue-400"],
:is(html.light, [data-theme*="light"]) aside button[id^="nav-"][class*="bg-blue-600/"] {
  background-color: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1.5px solid #60a5fa !important;
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.16) !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) aside button[class*="bg-blue-600/"] span,
:is(html.light, [data-theme*="light"]) aside button[class*="text-blue-400"] span,
:is(html.light, [data-theme*="light"]) aside button[id^="nav-"][class*="bg-blue-600/"] span {
  color: #1d4ed8 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) aside button[class*="bg-blue-600/"] svg,
:is(html.light, [data-theme*="light"]) aside button[class*="text-blue-400"] svg,
:is(html.light, [data-theme*="light"]) aside button[id^="nav-"][class*="bg-blue-600/"] svg {
  color: #1d4ed8 !important;
}

/* Sidebar Count Badges */
:is(html.light, [data-theme*="light"]) #navLandingProjectsCount {
  background-color: #dbeafe !important;
  color: #1e40af !important;
  border-color: #93c5fd !important;
  font-weight: 800 !important;
}

:is(html.light, [data-theme*="light"]) #navCatalogBadge,
:is(html.light, [data-theme*="light"]) #navIssuesBadge {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  border-color: #f59e0b !important;
  font-weight: 800 !important;
}

:is(html.light, [data-theme*="light"]) #navActiveWorkspaceBadge {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
  border-color: #10b981 !important;
  font-weight: 800 !important;
}

:is(html.light, [data-theme*="light"]) #navWorkspaceReturnPrompt {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

/* ========================================================================= */
/* HEADER & BREADCRUMB CONTEXT BAR LIGHT THEME                               */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) header {
  background-color: #ffffff !important;
  border-bottom-color: #e2e8f0 !important;
}

:is(html.light, [data-theme*="light"]) #breadcrumbBar {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05) !important;
}

:is(html.light, [data-theme*="light"]) #breadcrumbBar :is(.text-slate-400, .text-slate-300) {
  color: #475569 !important;
}

:is(html.light, [data-theme*="light"]) #breadcrumbBar .text-slate-600 {
  color: #94a3b8 !important;
}

:is(html.light, [data-theme*="light"]) #breadcrumbBuildStatus {
  color: #047857 !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) #breadcrumbPersonaRole {
  background-color: #eff6ff !important;
  color: #1e40af !important;
  border-color: #bfdbfe !important;
  font-weight: 800 !important;
}

:is(html.light, [data-theme*="light"]) #headerUserDisplayName {
  color: #0f172a !important;
}

/* ========================================================================= */
/* TRANSLUCENT SUBTABS, FILTER CHIPS & ACTION PILLS IN LIGHT MODE            */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) :is(
  button[class*="bg-blue-600/"],
  button[class*="bg-blue-500/"],
  button[class*="bg-cyan-600/"],
  button[class*="bg-cyan-500/"],
  [id^="subtab-btn-"][class*="bg-blue-600/"],
  [id^="chip-sev-"][class*="bg-blue-600/"],
  [id^="scanCat-"][class*="bg-blue-600/"],
  [id^="cloneFmt-"][class*="bg-blue-600/"]
) {
  background-color: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  font-weight: 700 !important;
}

:is(html.light, [data-theme*="light"]) :is(
  button[class*="bg-blue-600/"],
  button[class*="bg-blue-500/"],
  button[class*="bg-cyan-600/"],
  button[class*="bg-cyan-500/"],
  [id^="subtab-btn-"][class*="bg-blue-600/"],
  [id^="chip-sev-"][class*="bg-blue-600/"],
  [id^="scanCat-"][class*="bg-blue-600/"],
  [id^="cloneFmt-"][class*="bg-blue-600/"]
) :is(span, svg, div) {
  color: #1d4ed8 !important;
  font-weight: 700 !important;
}

/* ========================================================================= */
/* SOLID ACTION BUTTONS, PILLS & AVATARS (MAINTAIN CRISP WHITE TEXT)        */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) :is(
  button.bg-blue-600,
  button.bg-blue-500,
  button.bg-blue-700,
  button.bg-indigo-600,
  button.bg-indigo-500,
  button.bg-indigo-700,
  button.bg-purple-600,
  button.bg-purple-500,
  button.bg-purple-700,
  button.bg-emerald-600,
  button.bg-emerald-500,
  button.bg-emerald-700,
  button.bg-red-600,
  button.bg-red-500,
  button.bg-rose-600,
  button.bg-rose-500,
  button.bg-amber-600,
  button.bg-amber-500,
  a.bg-blue-600,
  a.bg-indigo-600,
  a.bg-purple-600,
  a.bg-emerald-600,
  a.bg-rose-600,
  a.bg-red-600,
  .auth-btn-primary,
  .btn-primary,
  .badge-solid,
  #btnGateUnifiedSubmit
):not(aside button) {
  color: #ffffff !important;
}

:is(html.light, [data-theme*="light"]) :is(
  button.bg-blue-600,
  button.bg-blue-500,
  button.bg-blue-700,
  button.bg-indigo-600,
  button.bg-indigo-500,
  button.bg-indigo-700,
  button.bg-purple-600,
  button.bg-purple-500,
  button.bg-purple-700,
  button.bg-emerald-600,
  button.bg-emerald-500,
  button.bg-emerald-700,
  button.bg-red-600,
  button.bg-red-500,
  button.bg-rose-600,
  button.bg-rose-500,
  button.bg-amber-600,
  button.bg-amber-500,
  a.bg-blue-600,
  a.bg-indigo-600,
  a.bg-purple-600,
  a.bg-emerald-600,
  a.bg-rose-600,
  a.bg-red-600,
  .auth-btn-primary,
  .btn-primary,
  .badge-solid,
  #btnGateUnifiedSubmit
):not(aside button) :is(*, span, svg, div, p, b, strong, i, .text-white, .text-slate-100, .text-slate-200, .text-slate-300) {
  color: #ffffff !important;
}

/* Saturated colored avatar chips */
:is(html.light, [data-theme*="light"]) :is(
  div[class*="bg-blue-600"],
  div[class*="bg-indigo-600"],
  div[class*="bg-purple-600"],
  div[class*="bg-emerald-600"],
  div[class*="bg-rose-600"],
  div[class*="bg-red-600"],
  div[class*="bg-amber-600"],
  span[class*="bg-blue-600"],
  span[class*="bg-indigo-600"],
  span[class*="bg-purple-600"]
):not([class*="/"]) {
  color: #ffffff !important;
}

/* Hover states for interactive buttons */
:is(html.light, [data-theme*="light"]) :is(
  button[class*="hover:bg-blue-"]:hover,
  button[class*="hover:bg-indigo-"]:hover,
  button[class*="hover:bg-purple-"]:hover,
  button[class*="hover:bg-emerald-"]:hover,
  button[class*="hover:bg-rose-"]:hover,
  button[class*="hover:bg-red-"]:hover,
  button[class*="hover:bg-amber-"]:hover,
  a[class*="hover:bg-blue-"]:hover,
  a[class*="hover:bg-indigo-"]:hover,
  a[class*="hover:bg-purple-"]:hover,
  a[class*="hover:bg-emerald-"]:hover
):not([class*="hover:bg-blue-600/"]):not([class*="hover:bg-blue-500/"]):not([class*="hover:bg-purple-600/"]):not([class*="hover:bg-emerald-600/"]):not(aside button) {
  color: #ffffff !important;
}

:is(html.light, [data-theme*="light"]) :is(
  button[class*="hover:bg-blue-"]:hover,
  button[class*="hover:bg-indigo-"]:hover,
  button[class*="hover:bg-purple-"]:hover,
  button[class*="hover:bg-emerald-"]:hover,
  button[class*="hover:bg-rose-"]:hover,
  button[class*="hover:bg-red-"]:hover,
  button[class*="hover:bg-amber-"]:hover,
  a[class*="hover:bg-blue-"]:hover,
  a[class*="hover:bg-indigo-"]:hover,
  a[class*="hover:bg-purple-"]:hover,
  a[class*="hover:bg-emerald-"]:hover
):not([class*="hover:bg-blue-600/"]):not([class*="hover:bg-blue-500/"]):not([class*="hover:bg-purple-600/"]):not([class*="hover:bg-emerald-600/"]):not(aside button) :is(*, svg, span, div, p, b, strong, i, .text-white, .text-slate-100, .text-slate-200, .text-slate-300) {
  color: #ffffff !important;
}

/* ========================================================================= */
/* SEVERITY BADGES & DEFECT CATALOG LIGHT THEME                              */
/* ========================================================================= */
:is(html.light, [data-theme*="light"]) .badge-blocker { background: #fee2e2 !important; color: #991b1b !important; border-color: #ef4444 !important; font-weight: 800 !important; }
:is(html.light, [data-theme*="light"]) .badge-critical { background: #ffedd5 !important; color: #9a3412 !important; border-color: #f97316 !important; font-weight: 800 !important; }
:is(html.light, [data-theme*="light"]) .badge-major { background: #fef3c7 !important; color: #92400e !important; border-color: #f59e0b !important; font-weight: 800 !important; }
:is(html.light, [data-theme*="light"]) .badge-minor { background: #dbeafe !important; color: #1e40af !important; border-color: #3b82f6 !important; font-weight: 800 !important; }
:is(html.light, [data-theme*="light"]) .badge-info { background: #f1f5f9 !important; color: #334155 !important; border-color: #94a3b8 !important; font-weight: 800 !important; }

/* Light Markdown Overrides */
:is(html.light, [data-theme*="light"]) .markdown-body {
  color: #334155 !important;
}
:is(html.light, [data-theme*="light"]) .markdown-body pre {
  background: var(--code-bg) !important;
  color: #0f172a !important;
  border-color: var(--border-medium) !important;
}
:is(html.light, [data-theme*="light"]) .markdown-body code {
  background: rgba(15, 23, 42, 0.06) !important;
  color: #0284c7 !important;
}
:is(html.light, [data-theme*="light"]) .markdown-body h1 {
  color: #1d4ed8 !important;
}
:is(html.light, [data-theme*="light"]) .markdown-body h2 {
  color: #2563eb !important;
  border-bottom-color: var(--border-subtle) !important;
}
:is(html.light, [data-theme*="light"]) .markdown-body h3 {
  color: #1e40af !important;
}
:is(html.light, [data-theme*="light"]) :is(.markdown-body ul, .markdown-body li) {
  color: #334155 !important;
}
:is(html.light, [data-theme*="light"]) .markdown-body blockquote {
  background: rgba(59, 130, 246, 0.06) !important;
  color: #475569 !important;
  border-left-color: #3b82f6 !important;
}

/* ========================================================================= */
/* 2. DARK THEME HIGH-CONTRAST & SAFETY RULES                                */
/* Ensures no accidental dark text on dark surfaces in Obsidian and Ocean    */
/* ========================================================================= */
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) {
  color-scheme: dark;
}

/* Inputs, Selects, and Textareas in Dark Mode */
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) input:not([type="checkbox"]):not([type="radio"]),
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) select,
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) textarea {
  color: #fafafa !important;
}

:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) select option {
  background-color: #18181b !important;
  color: #fafafa !important;
}

:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) input::placeholder,
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) textarea::placeholder {
  color: #71717a !important;
}

/* Safety: Prevent dark text classes (text-slate-800, text-black, etc.) on dark surfaces,
   excluding elements with explicit white backgrounds like Google SSO button */
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) :is(
  .text-slate-800,
  .text-slate-900,
  .text-gray-800,
  .text-gray-900,
  .text-black
):not(.bg-white, [class*="bg-white"], .btn-white) {
  color: #f8fafc !important;
}

/* Enhance readability of text-slate-500 secondary notes on dark carbon/navy */
:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) .text-slate-500 {
  color: #94a3b8 !important;
}

/* View Mode (Developer vs Leader / Executive) Declarative Visibility Rules */
body[data-view-mode="developer"] .lead-only,
body:not([data-view-mode="executive"]) .lead-only {
  display: none !important;
}
body[data-view-mode="executive"] .dev-only {
  display: none !important;
}

/* Light Theme Contrast Polish: Header Jenkins Quick Link */
:is(html.light, [data-theme*="light"]) #quickBarJenkinsLink {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
:is(html.light, [data-theme*="light"]) #quickBarJenkinsLink:hover {
  background-color: #e2e8f0 !important;
  color: #0284c7 !important;
}
:is(html.light, [data-theme*="light"]) #quickBarJenkinsLink svg {
  color: #0284c7 !important;
}

/* ========================================================================= */
/* ENTERPRISE ERP / CRM DESIGN SYSTEM STANDARDS & DATA DENSITY               */
/* ========================================================================= */
:root {
  --fontSz14: 14px;
  --fontSz12: var(--fontSz14);
  --fontSz11: var(--fontSz14);
  --table-density-row-h: 38px;
  --badge-density-success-bg: #d7f3e2;
  --badge-density-success-fg: #08683b;
  --badge-density-warning-bg: #ffedcd;
  --badge-density-warning-fg: #d98911;
  --badge-density-error-bg: #ffd9da;
  --badge-density-error-fg: #b9131c;
  --badge-density-info-bg: #e1f1ff;
  --badge-density-info-fg: #006aff;
}

/* Status Badges */
.badge-status-success,
.badge-erp-success {
  background: var(--badge-density-success-bg) !important;
  color: var(--badge-density-success-fg) !important;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: var(--fontSz11);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-status-warning,
.badge-erp-warning {
  background: var(--badge-density-warning-bg) !important;
  color: var(--badge-density-warning-fg) !important;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: var(--fontSz11);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-status-error,
.badge-erp-error {
  background: var(--badge-density-error-bg) !important;
  color: var(--badge-density-error-fg) !important;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: var(--fontSz11);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-status-info,
.badge-erp-info {
  background: var(--badge-density-info-bg) !important;
  color: var(--badge-density-info-fg) !important;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: var(--fontSz11);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Data Density Tables (Compact 36-40px rows, sticky header) */
.table-data-density {
  width: 100%;
  font-size: var(--fontSz14);
  border-collapse: separate;
  border-spacing: 0;
}

.table-data-density thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  font-size: var(--fontSz11);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  height: 36px;
}

.table-data-density tbody tr {
  height: var(--table-density-row-h);
  transition: background-color 0.15s ease;
}

.table-data-density tbody td {
  padding: 6px 12px;
  vertical-align: middle;
  font-size: var(--fontSz14);
}

:is(html.light, [data-theme*="light"]) .table-data-density tbody tr:hover {
  background-color: #f1f4f7 !important;
}

:is(html.dark, [data-theme*="dark"], [data-theme*="ocean"], :root:not(.light)) .table-data-density tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* ========================================================================= */
/* CODE HIGHLIGHTING & RICH CODE VIEW STYLES */
/* ========================================================================= */
.code-token-keyword { color: #f472b6; font-weight: 600; } /* pink-400 */
.code-token-type { color: #67e8f9; font-weight: 500; }    /* cyan-300 */
.code-token-string { color: #86efac; }                      /* green-300 */
.code-token-number { color: #fcd34d; }                      /* amber-300 */
.code-token-comment { color: #94a3b8; font-style: italic; opacity: 0.85; } /* slate-400 */
.code-token-macro { color: #c084fc; font-weight: 600; }    /* purple-400 */
.code-token-builtin { color: #93c5fd; font-weight: 500; }  /* blue-300 */
.code-token-operator { color: #cbd5e1; }                    /* slate-300 */
.code-token-variable { color: #e2e8f0; font-weight: 600; }  /* slate-200 */

/* Unified Diff Highlighting */
.diff-line-add { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border-left: 3px solid #10b981; }
.diff-line-del { background: rgba(244, 63, 94, 0.15); color: #fda4af; border-left: 3px solid #f43f5e; }
.diff-line-header { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; font-weight: 700; border-left: 3px solid #6366f1; }
.diff-line-context { color: #94a3b8; border-left: 3px solid transparent; }
.diff-gutter-marker { display: inline-block; width: 1.25rem; text-align: center; font-weight: 800; user-select: none; }

/* Squiggly error underline */
.code-error-squiggly {
  text-decoration: underline wavy #ef4444;
  text-decoration-skip-ink: none;
  font-weight: 700;
  color: #fecaca !important;
}

:is(html.light, [data-theme*="light"]) .code-error-squiggly {
  color: #b91c1c !important;
  text-decoration-color: #dc2626;
}

/* VS Code & GitHub Editor Canvas */
.vscode-editor-canvas {
  background-color: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
}

:is(html.light, [data-theme*="light"]) .vscode-editor-canvas {
  background-color: #ffffff;
  border-color: #d0d7de;
  color: #24292f;
}

/* Gutter Numbers */
.vscode-gutter {
  width: 48px;
  color: #6e7681;
  text-align: right;
  padding-right: 14px;
  user-select: none;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

:is(html.light, [data-theme*="light"]) .vscode-gutter {
  color: #8c959f;
  border-right-color: #d0d7de;
  background-color: #f6f8fa;
}

/* Target Error Line */
.vscode-line-error {
  background-color: rgba(248, 81, 73, 0.12);
  border-left: 3px solid #f85149;
}

:is(html.light, [data-theme*="light"]) .vscode-line-error {
  background-color: #ffebe9;
  border-left-color: #cf222e;
}

/* GitHub Inline Callout Box */
.github-inline-callout {
  background: #161b22;
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-left: 4px solid #f85149;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

:is(html.light, [data-theme*="light"]) .github-inline-callout {
  background: #ffffff;
  border-color: #ff8182;
  border-left-color: #cf222e;
  box-shadow: 0 4px 12px rgba(140, 149, 159, 0.2);
}

/* GitHub Diff Additions & Deletions */
.diff-add-row {
  background-color: rgba(46, 160, 67, 0.15) !important;
  color: #e6edf3;
}
.diff-add-gutter {
  background-color: rgba(46, 160, 67, 0.25) !important;
  color: #7ee787 !important;
  border-right: 1px solid rgba(46, 160, 67, 0.3);
}
.diff-del-row {
  background-color: rgba(248, 81, 73, 0.15) !important;
  color: #ffdcd7;
}
.diff-del-gutter {
  background-color: rgba(248, 81, 73, 0.25) !important;
  color: #f85149 !important;
  border-right: 1px solid rgba(248, 81, 73, 0.3);
}

:is(html.light, [data-theme*="light"]) .diff-add-row {
  background-color: #dafbe1 !important;
  color: #1a7f37 !important;
}
:is(html.light, [data-theme*="light"]) .diff-add-gutter {
  background-color: #ccffd8 !important;
  color: #1a7f37 !important;
  border-right-color: #4ac26b !important;
}
:is(html.light, [data-theme*="light"]) .diff-del-row {
  background-color: #ffebe9 !important;
  color: #cf222e !important;
}
:is(html.light, [data-theme*="light"]) .diff-del-gutter {
  background-color: #ffd7d5 !important;
  color: #cf222e !important;
  border-right-color: #ff8182 !important;
}

/* Defect Drawer 3-Tab Navigation & Subtle Active State */
.defect-tab-btn {
  transition: all 0.15s ease-in-out;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}

.defect-tab-inactive {
  color: #94a3b8 !important;
  border-bottom: 2px solid transparent !important;
  background: transparent !important;
  border-top: 1px solid transparent !important;
  border-left: 1px solid transparent !important;
  border-right: 1px solid transparent !important;
}

.defect-tab-inactive:hover {
  color: #e2e8f0 !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

.defect-tab-inactive .material-symbols-outlined,
.defect-tab-inactive .defect-tab-icon {
  opacity: 0.65;
  transition: opacity 0.15s ease-in-out;
}

.defect-tab-inactive:hover .material-symbols-outlined,
.defect-tab-inactive:hover .defect-tab-icon {
  opacity: 0.95;
}

/* Backward-compatible .tab-active base indicator */
.tab-active {
  color: #93c5fd !important;
  border-bottom: 2px solid #3b82f6 !important;
  background: rgba(59, 130, 246, 0.14) !important;
}

:is(html.light, [data-theme*="light"]) .tab-active {
  color: #0969da !important;
  border-bottom-color: #0969da !important;
  background: rgba(9, 105, 218, 0.10) !important;
}

/* Active Tab: Code (Rose / Red) - Specificity override */
.defect-tab-active-code,
.tab-active.defect-tab-active-code {
  color: #fda4af !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #f43f5e !important;
  background: rgba(244, 63, 94, 0.14) !important;
  border-top: 1px solid rgba(244, 63, 94, 0.25) !important;
  border-left: 1px solid rgba(244, 63, 94, 0.2) !important;
  border-right: 1px solid rgba(244, 63, 94, 0.2) !important;
}

.defect-tab-active-code .material-symbols-outlined,
.defect-tab-active-code .defect-tab-icon {
  opacity: 1 !important;
}

/* Active Tab: Fix (Blue / Primary) */
.defect-tab-active-fix,
.tab-active.defect-tab-active-fix {
  color: #93c5fd !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #3b82f6 !important;
  background: rgba(59, 130, 246, 0.14) !important;
  border-top: 1px solid rgba(59, 130, 246, 0.25) !important;
  border-left: 1px solid rgba(59, 130, 246, 0.2) !important;
  border-right: 1px solid rgba(59, 130, 246, 0.2) !important;
}

.defect-tab-active-fix .material-symbols-outlined,
.defect-tab-active-fix .defect-tab-icon {
  opacity: 1 !important;
}

/* Active Tab: Knowledge Base (Purple / Indigo) - Specificity override */
.defect-tab-active-kb,
.tab-active.defect-tab-active-kb {
  color: #d8b4fe !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #a855f7 !important;
  background: rgba(168, 85, 247, 0.14) !important;
  border-top: 1px solid rgba(168, 85, 247, 0.25) !important;
  border-left: 1px solid rgba(168, 85, 247, 0.2) !important;
  border-right: 1px solid rgba(168, 85, 247, 0.2) !important;
}

.defect-tab-active-kb .material-symbols-outlined,
.defect-tab-active-kb .defect-tab-icon {
  opacity: 1 !important;
}

:is(html.light, [data-theme*="light"]) .defect-tab-inactive {
  color: #64748b !important;
  background: transparent !important;
}

:is(html.light, [data-theme*="light"]) .defect-tab-inactive:hover {
  color: #0f172a !important;
  background: rgba(0, 0, 0, 0.04) !important;
}

:is(html.light, [data-theme*="light"]) .defect-tab-active-code,
:is(html.light, [data-theme*="light"]) .tab-active.defect-tab-active-code {
  color: #be123c !important;
  background: rgba(244, 63, 94, 0.10) !important;
  border-bottom-color: #e11d48 !important;
  border-top-color: rgba(244, 63, 94, 0.25) !important;
  border-left-color: rgba(244, 63, 94, 0.2) !important;
  border-right-color: rgba(244, 63, 94, 0.2) !important;
}

:is(html.light, [data-theme*="light"]) .defect-tab-active-fix,
:is(html.light, [data-theme*="light"]) .tab-active.defect-tab-active-fix {
  color: #1d4ed8 !important;
  background: rgba(59, 130, 246, 0.10) !important;
  border-bottom-color: #2563eb !important;
  border-top-color: rgba(59, 130, 246, 0.25) !important;
  border-left-color: rgba(59, 130, 246, 0.2) !important;
  border-right-color: rgba(59, 130, 246, 0.2) !important;
}

:is(html.light, [data-theme*="light"]) .defect-tab-active-kb,
:is(html.light, [data-theme*="light"]) .tab-active.defect-tab-active-kb {
  color: #7e22ce !important;
  background: rgba(168, 85, 247, 0.10) !important;
  border-bottom-color: #9333ea !important;
  border-top-color: rgba(168, 85, 247, 0.25) !important;
  border-left-color: rgba(168, 85, 247, 0.2) !important;
  border-right-color: rgba(168, 85, 247, 0.2) !important;
}

/* Defect Drawer Container Light Theme Contrast */
:is(html.light, [data-theme*="light"]) #defectModal .bg-surface-950 {
  background-color: #ffffff !important;
}
:is(html.light, [data-theme*="light"]) #defectModal .bg-surface-900 {
  background-color: #f6f8fa !important;
}
:is(html.light, [data-theme*="light"]) #defectModal .bg-surface-850 {
  background-color: #eaeef2 !important;
}
:is(html.light, [data-theme*="light"]) #defectModal .border-white\/10,
:is(html.light, [data-theme*="light"]) #defectModal .border-white\/5 {
  border-color: #d0d7de !important;
}

/* Diff Lines & Syntax Tokens Light Theme Contrast */
:is(html.light, [data-theme*="light"]) .diff-line-add {
  background: #dafbe1 !important;
  color: #1a7f37 !important;
  border-left-color: #2da44e !important;
}
:is(html.light, [data-theme*="light"]) .diff-line-del {
  background: #ffebe9 !important;
  color: #cf222e !important;
  border-left-color: #cf222e !important;
}
:is(html.light, [data-theme*="light"]) .diff-line-header {
  background: #ddf4ff !important;
  color: #0969da !important;
  border-left-color: #54aeff !important;
}
:is(html.light, [data-theme*="light"]) .diff-line-context {
  color: #57606a !important;
}
:is(html.light, [data-theme*="light"]) .code-token-keyword { color: #cf222e !important; }
:is(html.light, [data-theme*="light"]) .code-token-type { color: #0550ae !important; }
:is(html.light, [data-theme*="light"]) .code-token-string { color: #0a3069 !important; }
:is(html.light, [data-theme*="light"]) .code-token-number { color: #953800 !important; }
:is(html.light, [data-theme*="light"]) .code-token-comment { color: #6e7781 !important; }
:is(html.light, [data-theme*="light"]) .code-token-macro { color: #8250df !important; }
:is(html.light, [data-theme*="light"]) .code-token-builtin { color: #0550ae !important; }
:is(html.light, [data-theme*="light"]) .code-token-variable { color: #24292f !important; }




