:root[data-theme='dark'] {
  --text-primary: #FFFFFF;
  --text-secondary: #B0B0B0;
  --text-muted: #8C8C8C;
  --text-inverse: #0D0D0D;

  --primary-900: var(--text-primary);
  --primary-800: #E6E6E6;
  --primary-700: #D1D1D1;
  --primary-600: var(--text-secondary);
  --primary-500: var(--text-muted);

  --accent-blue: #4A9EFF;
  --accent-green: #00A86B;
  --accent-amber: #FFB000;
  --accent-red: #DC3545;
  --accent-purple: #6F42C1;
  --accent-blue-hover: #74B6FF;
  --accent-green-hover: #1BC786;
  --accent-amber-hover: #FFC94F;
  --accent-red-hover: #F15B6C;
  --accent-purple-hover: #8C64D9;

  --surface-base: #1A1A1A;
  --surface-panel: #2D2D2D;
  --surface-card: #252525;
  --surface-subtle: #222222;
  --surface-hover: #3A3A3A;
  --surface-inset: #343434;

  --bg-primary: var(--surface-panel);
  --bg-secondary: var(--surface-base);
  --bg-tertiary: var(--surface-card);
  --bg-hover: var(--surface-hover);

  --border-subtle: #404040;
  --border-strong: #4D4D4D;

  --button-primary-bg: var(--accent-blue);
  --button-primary-hover: #74B6FF;
  --button-primary-color: var(--text-primary);
  --button-outline-border: #B0B0B0;
  --button-outline-text: #FFFFFF;
  --button-outline-hover-bg: rgba(255, 255, 255, 0.08);

  --toggle-track: #3A3A3A;
  --toggle-track-active: var(--accent-blue);
  --toggle-thumb: #FFFFFF;
  --toggle-thumb-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

  --focus-ring: rgba(74, 158, 255, 0.35);
  --focus-ring-strong: rgba(74, 158, 255, 0.5);
  --overlay-scrim: rgba(0, 0, 0, 0.75);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.55);
  --white: #FFFFFF;
}
:root[data-theme='dark'] body {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

:root[data-theme='dark'] h1,
:root[data-theme='dark'] h2,
:root[data-theme='dark'] h3,
:root[data-theme='dark'] h4,
:root[data-theme='dark'] h5,
:root[data-theme='dark'] h6 {
  color: var(--text-primary);
}
:root[data-theme='dark'] .navbar {
  background: rgba(45, 45, 45, 0.85);
}
:root[data-theme='dark'] .navbar-collapse {
  background: rgba(32, 32, 32, 0.95);
}
:root[data-theme='dark'] footer.bg-light {
  background: var(--surface-card) !important;
}

:root[data-theme='dark'] .navbar-nav .nav-link {
  color: var(--text-secondary);
}

:root[data-theme='dark'] .card {
  background: var(--surface-card);
  color: var(--text-primary);
}
:root[data-theme='dark'] .stat-card,
:root[data-theme='dark'] .client-card {
  background: var(--surface-card);
}
:root[data-theme='dark'] .stat-card .label {
  color: var(--text-secondary);
}
:root[data-theme='dark'] .client-card strong {
  color: var(--text-primary);
}
:root[data-theme='dark'] .client-card p {
  color: var(--text-secondary);
}

:root[data-theme="dark"] .badge.bg-secondary {
  background: var(--border-subtle);
  color: var(--text-primary);
}

/* Form and button overrides for improved readability */
:root[data-theme='dark'] .form-label {
  color: var(--text-secondary);
}
:root[data-theme='dark'] .form-help {
  color: var(--text-muted);
}

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

:root[data-theme='dark'] .btn-ghost {
  border: 1px solid var(--button-outline-border);
  color: var(--button-outline-text);
}
:root[data-theme='dark'] .btn-ghost:hover {
  border-color: var(--button-outline-border);
  background: var(--button-outline-hover-bg);
}

/* Specific overrides for problem areas */
:root[data-theme='dark'] .table-modern td,
:root[data-theme='dark'] .table-modern th {
  color: var(--text-secondary);
}

:root[data-theme='dark'] dt {
  color: var(--text-secondary);
  font-weight: var(--font-medium);
}

:root[data-theme='dark'] dd {
  color: var(--text-primary);
}
