/*
 * Earth Tones Theme for AskRobots
 * Warm natural palette - can be loaded alongside or instead of retro theme
 * From: apphtml design system
 */

/* ===========================================
   NUCLEAR OVERRIDES - Beat retro-components.css
   Match Dashboard/Homepage modern card design
   =========================================== */

/* Sidebar - force earth theme */
.earth-theme .sidebar,
.earth-theme #main-sidebar,
.earth-theme .col-md-3.sidebar,
body.earth-theme .sidebar {
  background: var(--toolbar-bg, #ebe7e1) !important;
  background-color: #ebe7e1 !important;
  border-right: 1px solid #d4cdc4 !important;
  border-color: #d4cdc4 !important;
}

.earth-theme .sidebar .nav-link,
.earth-theme #main-sidebar .nav-link,
body.earth-theme .sidebar a {
  color: #3d3529 !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
}

.earth-theme .sidebar .nav-link:hover,
.earth-theme #main-sidebar .nav-link:hover {
  background: #ddd8d0 !important;
  color: #3d3529 !important;
}

.earth-theme .sidebar .nav-link.active,
.earth-theme #main-sidebar .nav-link.active {
  background: #c17f59 !important;
  color: white !important;
}

/* Window titles - LIGHT headers like Dashboard cards */
.earth-theme .retro-window-title,
body.earth-theme .retro-window-title,
.earth-theme [class*="window-title"] {
  background: #f5f2ed !important;
  background-color: #f5f2ed !important;
  color: #3d3529 !important;
  border: none !important;
  border-bottom: 2px solid #d4cdc4 !important;
  border-radius: 12px 12px 0 0 !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 14px 16px !important;
}

/* Card headers - also light */
.earth-theme .card-header {
  background: #f5f2ed !important;
  background-color: #f5f2ed !important;
  color: #3d3529 !important;
  border: none !important;
  border-bottom: 1px solid #d4cdc4 !important;
  border-radius: 12px 12px 0 0 !important;
}

/* Table headers - subtle earth tones, not dark bars */
.earth-theme table th,
.earth-theme .table th,
.earth-theme .retro-table th,
body.earth-theme table th,
body.earth-theme .table th {
  background: #ebe7e1 !important;
  background-color: #ebe7e1 !important;
  color: #3d3529 !important;
  border: 1px solid #d4cdc4 !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Table header links (sortable columns) */
.earth-theme table th a,
.earth-theme .table th a,
.earth-theme .retro-table th a {
  color: #3d3529 !important;
  text-decoration: none !important;
}

.earth-theme table th a:hover,
.earth-theme .table th a:hover {
  color: #c17f59 !important;
}

/* All buttons - force earth theme */
.earth-theme .btn,
.earth-theme button.btn,
.earth-theme a.btn,
body.earth-theme .btn {
  border-radius: 12px !important;
  border: 1px solid #d4cdc4 !important;
  box-shadow: 0 1px 3px rgba(61,53,41,0.1) !important;
  transition: all 0.15s ease !important;
}

.earth-theme .btn-primary,
body.earth-theme .btn-primary {
  background: #c17f59 !important;
  background-color: #c17f59 !important;
  border-color: #c17f59 !important;
  color: white !important;
}

.earth-theme .btn-secondary,
body.earth-theme .btn-secondary {
  background: #f5f2ed !important;
  background-color: #f5f2ed !important;
  border-color: #d4cdc4 !important;
  color: #3d3529 !important;
}

.earth-theme .btn-success,
body.earth-theme .btn-success {
  background: #6b8f71 !important;
  background-color: #6b8f71 !important;
  border-color: #6b8f71 !important;
  color: white !important;
}

.earth-theme .btn-info,
body.earth-theme .btn-info {
  background: #7a9bae !important;
  background-color: #7a9bae !important;
  border-color: #7a9bae !important;
  color: white !important;
}

.earth-theme .btn-danger,
body.earth-theme .btn-danger {
  background: #a05050 !important;
  background-color: #a05050 !important;
  border-color: #a05050 !important;
  color: white !important;
}

.earth-theme .btn-warning,
body.earth-theme .btn-warning {
  background: #b89b78 !important;
  background-color: #b89b78 !important;
  border-color: #b89b78 !important;
  color: #1a1816 !important;
}

/* Outline buttons - light mode earth tones */
.earth-theme .btn-outline-primary,
body.earth-theme .btn-outline-primary {
  border-color: #c17f59 !important;
  color: #c17f59 !important;
}
.earth-theme .btn-outline-primary:hover,
body.earth-theme .btn-outline-primary:hover {
  background: #c17f59 !important;
  color: white !important;
}
.earth-theme .btn-outline-secondary,
body.earth-theme .btn-outline-secondary {
  border-color: #a89f94 !important;
  color: #6b5d4d !important;
}
.earth-theme .btn-outline-secondary:hover,
body.earth-theme .btn-outline-secondary:hover {
  background: #6b5d4d !important;
  color: white !important;
}
.earth-theme .btn-outline-success,
body.earth-theme .btn-outline-success {
  border-color: #6b8f71 !important;
  color: #6b8f71 !important;
}
.earth-theme .btn-outline-danger,
body.earth-theme .btn-outline-danger {
  border-color: #a05050 !important;
  color: #a05050 !important;
}

/* Panels - white like Dashboard cards */
.earth-theme .retro-panel,
body.earth-theme .retro-panel {
  background: #ffffff !important;
  border: 1px solid #e8e4de !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 12px rgba(61,53,41,0.08) !important;
  padding: 24px !important;
}

/* Windows inside panels */
.earth-theme .retro-window,
body.earth-theme .retro-window {
  background: #ffffff !important;
  border: 1px solid #e8e4de !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(61,53,41,0.06) !important;
  margin-bottom: 20px !important;
  overflow: hidden !important;
}

/* Window content area */
.earth-theme .retro-window-content,
body.earth-theme .retro-window-content {
  padding: 20px !important;
  background: #ffffff !important;
}

/* Breadcrumbs - clean, no box */
.earth-theme .retro-breadcrumb,
body.earth-theme .retro-breadcrumb {
  background: transparent !important;
  border: none !important;
  border-color: transparent !important;
  padding: 8px 0 !important;
  margin-bottom: 16px !important;
}

/* Table wrappers - clean */
.earth-theme .retro-table-wrapper,
body.earth-theme .retro-table-wrapper {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
}

/* List groups - modern */
.earth-theme .retro-list-group,
body.earth-theme .retro-list-group {
  border: 1px solid #e8e4de !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.earth-theme .retro-list-item,
body.earth-theme .retro-list-item {
  background: #ffffff !important;
  border-bottom: 1px solid #e8e4de !important;
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  padding: 12px 16px !important;
  color: #3d3529 !important;
}

.earth-theme .retro-list-item:hover,
body.earth-theme .retro-list-item:hover {
  background: #f5f2ed !important;
  color: #3d3529 !important;
}

.earth-theme .retro-list-item.active,
body.earth-theme .retro-list-item.active {
  background: #c17f59 !important;
  color: white !important;
}

/* Retro cards - modern */
.earth-theme .retro-card,
body.earth-theme .retro-card {
  background: #ffffff !important;
  border: 1px solid #e8e4de !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.earth-theme .retro-card-header,
body.earth-theme .retro-card-header {
  background: #f5f2ed !important;
  border-bottom: 1px solid #d4cdc4 !important;
  padding: 12px 16px !important;
  font-weight: 600 !important;
  color: #3d3529 !important;
}

.earth-theme .retro-card-body,
body.earth-theme .retro-card-body {
  padding: 16px !important;
  background: #ffffff !important;
}

/* Retro alerts - modern */
.earth-theme .retro-alert,
body.earth-theme .retro-alert {
  border-radius: 12px !important;
  border-width: 1px !important;
  border-style: solid !important;
  padding: 12px 16px !important;
}

/* Retro buttons - match modern buttons */
.earth-theme .retro-btn,
body.earth-theme .retro-btn {
  border-radius: 12px !important;
  border: 1px solid #d4cdc4 !important;
  padding: 8px 16px !important;
  font-family: inherit !important;
  cursor: pointer !important;
}

.earth-theme .retro-btn-primary,
body.earth-theme .retro-btn-primary {
  background: #c17f59 !important;
  color: white !important;
  border-color: #c17f59 !important;
}

.earth-theme .retro-btn-success,
body.earth-theme .retro-btn-success {
  background: #5a8a50 !important;
  color: white !important;
  border-color: #5a8a50 !important;
}

.earth-theme .retro-btn-info,
body.earth-theme .retro-btn-info {
  background: #5a8a9e !important;
  color: white !important;
  border-color: #5a8a9e !important;
}

.earth-theme .retro-btn-danger,
body.earth-theme .retro-btn-danger {
  background: #a05050 !important;
  color: white !important;
  border-color: #a05050 !important;
}

.earth-theme .retro-btn-warning,
body.earth-theme .retro-btn-warning {
  background: #b89b78 !important;
  color: #1a1816 !important;
  border-color: #b89b78 !important;
}

/* List group active - earth brown instead of Bootstrap blue */
.earth-theme .list-group-item.active,
body.earth-theme .list-group-item.active {
  background-color: #c17f59 !important;
  border-color: #c17f59 !important;
  color: white !important;
}

/* ===========================================
   NUCLEAR OVERRIDES - DARK MODE
   =========================================== */
@media (prefers-color-scheme: dark) {
  /* Sidebar - dark earth theme */
  .earth-theme .sidebar,
  .earth-theme #main-sidebar,
  .earth-theme .col-md-3.sidebar,
  body.earth-theme .sidebar {
    background: #252220 !important;
    background-color: #252220 !important;
    border-right: 1px solid #3d3632 !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .sidebar .nav-link,
  .earth-theme #main-sidebar .nav-link,
  body.earth-theme .sidebar a {
    color: #e8e4df !important;
  }

  .earth-theme .sidebar .nav-link:hover,
  .earth-theme #main-sidebar .nav-link:hover {
    background: #2a2622 !important;
    color: #e8e4df !important;
  }

  .earth-theme .sidebar .nav-link.active,
  .earth-theme #main-sidebar .nav-link.active {
    background: #d4956a !important;
    color: white !important;
  }

  /* Window titles - dark */
  .earth-theme .retro-window-title,
  body.earth-theme .retro-window-title,
  .earth-theme [class*="window-title"] {
    background: #252220 !important;
    background-color: #252220 !important;
    color: #e8e4df !important;
    border-bottom: 2px solid #3d3632 !important;
  }

  /* Card headers - dark */
  .earth-theme .card-header {
    background: #252220 !important;
    background-color: #252220 !important;
    color: #e8e4df !important;
    border-bottom: 1px solid #3d3632 !important;
  }

  /* Table headers - dark earth */
  .earth-theme table th,
  .earth-theme .table th,
  .earth-theme .retro-table th,
  body.earth-theme table th,
  body.earth-theme .table th {
    background: #2a2622 !important;
    background-color: #2a2622 !important;
    color: #e8e4df !important;
    border: 1px solid #3d3632 !important;
  }

  /* Table header links */
  .earth-theme table th a,
  .earth-theme .table th a,
  .earth-theme .retro-table th a {
    color: #e8e4df !important;
  }

  .earth-theme table th a:hover,
  .earth-theme .table th a:hover {
    color: #d4956a !important;
  }

  /* Buttons - dark */
  .earth-theme .btn-primary,
  body.earth-theme .btn-primary {
    background: #d4956a !important;
    background-color: #d4956a !important;
    border-color: #d4956a !important;
    color: white !important;
  }

  .earth-theme .btn-secondary,
  body.earth-theme .btn-secondary {
    background: #2a2622 !important;
    background-color: #2a2622 !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  /* Panels - dark */
  .earth-theme .retro-panel,
  body.earth-theme .retro-panel {
    background: #211e1b !important;
    border: 1px solid #3d3632 !important;
  }

  /* Windows - dark */
  .earth-theme .retro-window,
  body.earth-theme .retro-window {
    background: #211e1b !important;
    border: 1px solid #3d3632 !important;
  }

  .earth-theme .retro-window-content,
  body.earth-theme .retro-window-content {
    background: #211e1b !important;
    color: #e8e4df !important;
  }

  /* Cards - dark */
  .earth-theme .retro-card,
  body.earth-theme .retro-card {
    background: #211e1b !important;
    border: 1px solid #3d3632 !important;
  }

  .earth-theme .retro-card-header,
  body.earth-theme .retro-card-header {
    background: #252220 !important;
    border-bottom: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .retro-card-body,
  body.earth-theme .retro-card-body {
    background: #211e1b !important;
    color: #e8e4df !important;
  }

  /* List items - dark */
  .earth-theme .retro-list-item,
  body.earth-theme .retro-list-item {
    background: #211e1b !important;
    border-bottom: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .retro-list-item:hover,
  body.earth-theme .retro-list-item:hover {
    background: #2a2622 !important;
    color: #e8e4df !important;
  }
}

/* ===========================================
   END NUCLEAR OVERRIDES
   =========================================== */

:root {
  /* Natural palette - earth, sky, warmth */
  --earth: #3d3529;
  --bark: #6b5d4d;
  --stone: #9a928a;
  --sand: #d4cdc4;
  --cloud: #f0ece7;
  --sky: #b8c4ce;
  --water: #7a9bae;
  --leaf: #6b8f71;
  --clay: #c4a882;
  --ember: #c17f59;

  /* Mapped to interface roles */
  --app-bg: #e8e4de;
  --app-fg: #3d3529;
  --app-fg-muted: #6b5d4d;
  --app-accent: #c17f59;
  --app-accent-soft: #c4a882;
  --app-border: #d4cdc4;
  --app-hover: #ddd8d0;
  --app-active: #d4cdc4;
  --window-bg: #f5f2ed;
  --toolbar-bg: #ebe7e1;
  --menu-bg: #f5f2ed;
  --statusbar-bg: #e8e4de;
  --success: #6b8f71;
  --danger: #c17f59;
  --warning: #c4a882;
  --info: #7a9bae;

  /* Shadows and radii */
  --shadow-sm: 0 1px 3px rgba(61,53,41,0.1);
  --shadow-md: 0 4px 12px rgba(61,53,41,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Dark mode - warm, not cold blue-black */
@media (prefers-color-scheme: dark) {
  :root {
    --app-bg: #1a1816;
    --app-fg: #e8e4df;
    --app-fg-muted: #a89f94;
    --app-accent: #d4956a;
    --app-accent-soft: #b89b78;
    --app-border: #3d3632;
    --app-hover: #2a2622;
    --app-active: #3d3632;
    --window-bg: #211e1b;
    --toolbar-bg: #252220;
    --menu-bg: #252220;
    --statusbar-bg: #1a1816;
    --success: #7fa878;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  }
}

/* ===========================================
   EARTH THEME COMPONENT OVERRIDES
   Add .earth-theme class to body to enable
   =========================================== */

.earth-theme {
  background: var(--app-bg);
  color: var(--app-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Main content - spacing from sidebar */
.earth-theme .main-content {
  padding-left: 2rem !important;
  padding-top: 0.5rem !important;
}

@media (min-width: 768px) {
  .earth-theme .main-content {
    padding-left: 2.5rem !important;
  }
}

/* Sidebar */
.earth-theme .sidebar,
.earth-theme #main-sidebar {
  background: var(--toolbar-bg) !important;
  border-right: 1px solid var(--app-border) !important;
}

.earth-theme .sidebar .nav-link {
  color: var(--app-fg);
  border-radius: var(--radius-sm);
  margin: 2px 8px;
  padding: 10px 16px;
}

.earth-theme .sidebar .nav-link:hover {
  background: var(--app-hover);
  color: var(--app-fg);
}

.earth-theme .sidebar .nav-link.active {
  background: var(--app-accent);
  color: white;
}

/* Buttons */
.earth-theme .btn {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--app-border) !important;
  background: var(--window-bg) !important;
  color: var(--app-fg) !important;
  box-shadow: var(--shadow-sm) !important;
  font-family: inherit !important;
  font-size: 16px !important;
  padding: 12px 20px !important;
  transition: all 0.15s ease !important;
}

.earth-theme .btn:hover {
  background: var(--app-hover) !important;
  border-color: var(--app-accent) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}

.earth-theme .btn:active {
  background: var(--app-active) !important;
  transform: translateY(0);
  box-shadow: var(--shadow-sm) !important;
}

.earth-theme .btn-primary {
  background: var(--app-accent) !important;
  border-color: var(--app-accent) !important;
  color: white !important;
}

.earth-theme .btn-primary:hover {
  background: var(--ember) !important;
  border-color: var(--ember) !important;
}

.earth-theme .btn-success {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
}

/* Cards and panels */
.earth-theme .card,
.earth-theme .retro-panel,
.earth-theme .retro-window {
  background: var(--window-bg) !important;
  border: 1px solid var(--app-border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-md) !important;
}

.earth-theme .card-header {
  background: var(--toolbar-bg) !important;
  border-bottom: 1px solid var(--app-border) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

/* Form controls */
.earth-theme .form-control,
.earth-theme .form-select,
.earth-theme input[type="text"],
.earth-theme input[type="email"],
.earth-theme input[type="password"],
.earth-theme textarea {
  background: var(--window-bg) !important;
  border: 1px solid var(--app-border) !important;
  border-radius: var(--radius-md) !important;
  color: var(--app-fg) !important;
  padding: 12px 16px !important;
  box-shadow: var(--shadow-sm) !important;
}

.earth-theme .form-control:focus,
.earth-theme .form-select:focus {
  border-color: var(--app-accent) !important;
  box-shadow: 0 0 0 4px rgba(193, 127, 89, 0.2) !important;
  outline: none !important;
}

/* Tables */
.earth-theme .table,
.earth-theme .retro-table,
.earth-theme table {
  background: var(--window-bg) !important;
  border: 1px solid var(--app-border) !important;
  border-collapse: collapse !important;
}

.earth-theme .table th,
.earth-theme .retro-table th,
.earth-theme table th {
  background: var(--toolbar-bg) !important;
  border: 1px solid var(--app-border) !important;
  color: var(--app-fg) !important;
  font-weight: 600 !important;
  padding: 12px !important;
}

.earth-theme .table td,
.earth-theme .retro-table td,
.earth-theme table td {
  border: 1px solid var(--app-border) !important;
  padding: 10px 12px !important;
  background: var(--window-bg) !important;
}

.earth-theme .table tbody tr:hover td,
.earth-theme .retro-table tbody tr:hover td,
.earth-theme table tbody tr:hover td {
  background: var(--app-hover) !important;
}

/* Alerts */
.earth-theme .alert {
  border-radius: var(--radius-md);
  border: 1px solid;
}

.earth-theme .alert-success {
  background: rgba(107, 143, 113, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.earth-theme .alert-warning {
  background: rgba(196, 168, 130, 0.15);
  border-color: var(--warning);
  color: var(--bark);
}

.earth-theme .alert-danger {
  background: rgba(193, 127, 89, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.earth-theme .alert-info {
  background: rgba(122, 155, 174, 0.15);
  border-color: var(--info);
  color: var(--water);
}

/* Badges */
.earth-theme .badge {
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: 6px 12px;
}

.earth-theme .badge.bg-success,
.earth-theme .badge.bg-primary {
  background: var(--success) !important;
}

.earth-theme .badge.bg-warning {
  background: var(--clay) !important;
  color: var(--earth) !important;
}

.earth-theme .badge.bg-danger {
  background: var(--ember) !important;
}

/* Dropdown menus */
.earth-theme .dropdown-menu {
  background: var(--menu-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 8px 0;
}

.earth-theme .dropdown-item {
  border-radius: var(--radius-sm);
  margin: 2px 8px;
  padding: 10px 16px;
  width: calc(100% - 16px);
}

.earth-theme .dropdown-item:hover {
  background: var(--app-hover);
}

/* Navigation / breadcrumbs */
.earth-theme .breadcrumb {
  background: var(--toolbar-bg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.earth-theme .breadcrumb-item a {
  color: var(--app-accent);
}

/* Modal */
.earth-theme .modal-content {
  background: var(--window-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-lg);
}

.earth-theme .modal-header {
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--app-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Scrollbar styling */
.earth-theme ::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.earth-theme ::-webkit-scrollbar-track {
  background: var(--app-bg);
}

.earth-theme ::-webkit-scrollbar-thumb {
  background: var(--stone);
  border-radius: 6px;
  border: 3px solid var(--app-bg);
}

.earth-theme ::-webkit-scrollbar-thumb:hover {
  background: var(--bark);
}

/* Links */
.earth-theme a {
  color: var(--app-accent);
}

.earth-theme a:hover {
  color: var(--ember);
}

/* Code blocks */
.earth-theme pre,
.earth-theme code {
  background: var(--toolbar-bg);
  border-radius: var(--radius-sm);
  color: var(--app-fg);
}

.earth-theme pre {
  padding: 16px;
  border: 1px solid var(--app-border);
}

/* Project badges (activity feed) */
.earth-theme .project-badge {
  background: var(--clay) !important;
  color: var(--earth) !important;
  border: 1px solid var(--app-border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
}

.earth-theme .project-badge:hover {
  background: var(--ember) !important;
  color: white !important;
  text-decoration: none !important;
}

/* Small buttons (admin sidebar, etc.) */
.earth-theme .btn-sm {
  border-radius: var(--radius-sm) !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
}

/* Override retro button styles */
.earth-theme .btn,
.earth-theme .btn-secondary,
.earth-theme .btn-primary,
.earth-theme .btn-success,
.earth-theme .btn-danger,
.earth-theme .btn-sm {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
  border-width: 1px !important;
  transition: all 0.15s ease !important;
}

/* Retro containers in earth theme */
.earth-theme .retro-container .project-badge {
  border-color: var(--app-border) !important;
}

/* ===========================================
   EARTH THEME DARK MODE - COMPREHENSIVE
   Overrides contrast-fixes.css dark mode
   =========================================== */
@media (prefers-color-scheme: dark) {
  /* Body and main area */
  body.earth-theme {
    background: #1a1816 !important;
    background-color: #1a1816 !important;
    color: #e8e4df !important;
  }

  .earth-theme main,
  body.earth-theme main {
    background-color: #1a1816 !important;
    color: #e8e4df !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  /* Cards */
  .earth-theme .card,
  body.earth-theme .card {
    background-color: #211e1b !important;
    border: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .card-header,
  body.earth-theme .card-header {
    background: #252220 !important;
    background-color: #252220 !important;
    border-bottom: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .card-body,
  body.earth-theme .card-body {
    background-color: #211e1b !important;
    color: #e8e4df !important;
  }

  .earth-theme .card-footer,
  body.earth-theme .card-footer {
    background-color: #252220 !important;
    border-top: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  /* Text colors - comprehensive override for all text elements */
  .earth-theme main h1, .earth-theme main h2, .earth-theme main h3,
  .earth-theme main h4, .earth-theme main h5, .earth-theme main h6,
  .earth-theme main p, .earth-theme main span, .earth-theme main div,
  .earth-theme main strong, .earth-theme main em,
  .earth-theme main label, .earth-theme main small {
    color: #e8e4df !important;
  }

  .earth-theme main .text-muted,
  .earth-theme .text-muted {
    color: #a89f94 !important;
  }

  .earth-theme main .text-secondary {
    color: #a89f94 !important;
  }

  /* Links */
  .earth-theme main a,
  body.earth-theme main a {
    color: #d4956a !important;
  }

  .earth-theme main a:hover,
  body.earth-theme main a:hover {
    color: #e8a87c !important;
  }

  /* Forms */
  .earth-theme .form-control,
  .earth-theme .form-select,
  .earth-theme input[type="text"],
  .earth-theme input[type="email"],
  .earth-theme input[type="password"],
  .earth-theme textarea,
  body.earth-theme main input[type="text"],
  body.earth-theme main input[type="email"],
  body.earth-theme main input[type="password"],
  body.earth-theme main textarea,
  body.earth-theme main select,
  body.earth-theme main .form-control,
  body.earth-theme main .form-select {
    background: #252220 !important;
    background-color: #252220 !important;
    border: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .form-control:focus,
  .earth-theme .form-select:focus {
    border-color: #d4956a !important;
    box-shadow: 0 0 0 4px rgba(212, 149, 106, 0.2) !important;
  }

  .earth-theme .form-control::placeholder,
  .earth-theme input::placeholder,
  .earth-theme textarea::placeholder {
    color: #6b5d4d !important;
  }

  /* Tables */
  .earth-theme .table,
  .earth-theme table,
  body.earth-theme table,
  body.earth-theme .table {
    background: #211e1b !important;
    background-color: #211e1b !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .table th,
  .earth-theme table th,
  body.earth-theme table th,
  body.earth-theme .table th {
    background: #2a2622 !important;
    background-color: #2a2622 !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .table td,
  .earth-theme table td,
  body.earth-theme table td,
  body.earth-theme .table td {
    background: #211e1b !important;
    background-color: #211e1b !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme table tbody tr:nth-child(odd) td {
    background-color: #252220 !important;
    color: #e8e4df !important;
  }

  .earth-theme table tbody tr:hover td,
  body.earth-theme table tbody tr:hover td {
    background-color: #2a2622 !important;
    color: #e8e4df !important;
  }

  /* Table links */
  .earth-theme table td a,
  .earth-theme .table td a,
  body.earth-theme table td a {
    color: #d4956a !important;
  }

  .earth-theme table tbody tr:hover td a,
  body.earth-theme table tbody tr:hover td a {
    color: #e8a87c !important;
  }

  /* Table header links */
  .earth-theme table th a,
  .earth-theme .table th a,
  body.earth-theme table th a,
  body.earth-theme .table th a {
    color: #e8e4df !important;
  }

  /* Override inline style td * { color: #000 } from template style blocks */
  body.earth-theme table td *,
  body.earth-theme .table td *,
  body.earth-theme .retro-table-wrapper table td *,
  body.earth-theme .retro-table-container table td * {
    color: #e8e4df !important;
  }

  body.earth-theme table td a,
  body.earth-theme .retro-table-wrapper table td a,
  body.earth-theme .retro-table-container table td a {
    color: #d4956a !important;
  }

  /* Django-tables2 dark mode override */
  .earth-theme .django-tables2-container,
  .earth-theme .table-responsive,
  .earth-theme .retro-table-wrapper,
  body.earth-theme .django-tables2-container,
  body.earth-theme .table-responsive,
  body.earth-theme .retro-table-wrapper {
    background: #211e1b !important;
    border: 1px solid #3d3632 !important;
    box-shadow: none !important;
  }

  .earth-theme .django-tables2-container table,
  .earth-theme .table-responsive table,
  body.earth-theme .django-tables2-container table,
  body.earth-theme .table-responsive table {
    background: #211e1b !important;
  }

  .earth-theme .django-tables2-container thead th,
  .earth-theme .table-responsive table thead th,
  body.earth-theme .django-tables2-container thead th,
  body.earth-theme .table-responsive table thead th {
    background: #2a2622 !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .django-tables2-container thead th a,
  .earth-theme .table-responsive table thead th a,
  body.earth-theme .django-tables2-container thead th a,
  body.earth-theme .table-responsive table thead th a {
    color: #e8e4df !important;
  }

  .earth-theme .django-tables2-container tbody td,
  .earth-theme .table-responsive table tbody td,
  body.earth-theme .django-tables2-container tbody td,
  body.earth-theme .table-responsive table tbody td {
    background: #211e1b !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .django-tables2-container tbody tr:nth-child(odd) td,
  .earth-theme .table-responsive table tbody tr:nth-child(odd) td,
  body.earth-theme .django-tables2-container tbody tr:nth-child(odd) td {
    background-color: #252220 !important;
    color: #e8e4df !important;
  }

  .earth-theme .django-tables2-container tbody td *,
  .earth-theme .table-responsive table tbody td *,
  body.earth-theme .django-tables2-container tbody td *,
  body.earth-theme .table-responsive table tbody td * {
    color: #e8e4df !important;
  }

  .earth-theme .django-tables2-container td a,
  .earth-theme .table-responsive table td a,
  body.earth-theme .django-tables2-container td a,
  body.earth-theme .table-responsive table td a {
    color: #d4956a !important;
  }

  /* retro-table-wrapper dark mode (beats contrast-fixes.css specificity) */
  .earth-theme .retro-table-wrapper,
  body.earth-theme .retro-table-wrapper {
    background: #211e1b !important;
    border: 1px solid #3d3632 !important;
    box-shadow: none !important;
  }

  .earth-theme .retro-table-wrapper table,
  body.earth-theme .retro-table-wrapper table {
    background: #211e1b !important;
  }

  .earth-theme .retro-table-wrapper table thead th,
  .earth-theme .retro-table-wrapper table.table thead th,
  body.earth-theme .retro-table-wrapper table thead th,
  body.earth-theme .retro-table-wrapper table.table thead th {
    background: #2a2622 !important;
    background-color: #2a2622 !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .retro-table-wrapper table thead th a,
  .earth-theme .retro-table-wrapper table.table thead th a,
  body.earth-theme .retro-table-wrapper table thead th a,
  body.earth-theme .retro-table-wrapper table.table thead th a {
    color: #e8e4df !important;
  }

  .earth-theme .retro-table-wrapper table tbody tr,
  .earth-theme .retro-table-wrapper table.table tbody tr,
  body.earth-theme .retro-table-wrapper table tbody tr,
  body.earth-theme .retro-table-wrapper table.table tbody tr {
    background: #211e1b !important;
  }

  .earth-theme .retro-table-wrapper table tbody td,
  .earth-theme .retro-table-wrapper table.table tbody td,
  body.earth-theme .retro-table-wrapper table tbody td,
  body.earth-theme .retro-table-wrapper table.table tbody td {
    background: #211e1b !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  .earth-theme .retro-table-wrapper table.table tbody tr:nth-child(odd) td,
  body.earth-theme .retro-table-wrapper table.table tbody tr:nth-child(odd) td {
    background-color: #252220 !important;
    color: #e8e4df !important;
  }

  .earth-theme .retro-table-wrapper table tbody td *,
  .earth-theme .retro-table-wrapper table.table tbody td *,
  body.earth-theme .retro-table-wrapper table tbody td *,
  body.earth-theme .retro-table-wrapper table.table tbody td * {
    color: #e8e4df !important;
  }

  .earth-theme .retro-table-wrapper table td a,
  .earth-theme .retro-table-wrapper table.table td a,
  body.earth-theme .retro-table-wrapper table td a,
  body.earth-theme .retro-table-wrapper table.table td a {
    color: #d4956a !important;
  }

  .earth-theme .retro-table-wrapper table tbody tr:hover td,
  body.earth-theme .retro-table-wrapper table.table tbody tr:hover td {
    background-color: #2a2622 !important;
    color: #e8e4df !important;
  }

  /* Buttons */
  .earth-theme .btn,
  body.earth-theme .btn {
    box-shadow: 0 1px 3px rgba(0,0,0,0.4) !important;
  }

  .earth-theme .btn-primary,
  body.earth-theme .btn-primary {
    background: #d4956a !important;
    background-color: #d4956a !important;
    border-color: #d4956a !important;
    color: white !important;
  }

  .earth-theme .btn-secondary,
  body.earth-theme .btn-secondary {
    background: #2a2622 !important;
    background-color: #2a2622 !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .btn-success,
  body.earth-theme .btn-success {
    background: #7fa878 !important;
    background-color: #7fa878 !important;
    border-color: #7fa878 !important;
    color: white !important;
  }

  .earth-theme .btn-danger,
  body.earth-theme .btn-danger {
    background: #b56b6b !important;
    background-color: #b56b6b !important;
    border-color: #b56b6b !important;
    color: white !important;
  }

  .earth-theme .btn-warning,
  body.earth-theme .btn-warning {
    background: #b89b78 !important;
    background-color: #b89b78 !important;
    border-color: #b89b78 !important;
    color: #1a1816 !important;
  }

  .earth-theme .btn-info,
  body.earth-theme .btn-info {
    background: #7a9bae !important;
    background-color: #7a9bae !important;
    border-color: #7a9bae !important;
    color: white !important;
  }

  /* Outline buttons - dark mode */
  .earth-theme .btn-outline-primary,
  body.earth-theme .btn-outline-primary {
    background: transparent !important;
    border-color: #d4956a !important;
    color: #d4956a !important;
  }
  .earth-theme .btn-outline-primary:hover,
  body.earth-theme .btn-outline-primary:hover {
    background: #d4956a !important;
    color: white !important;
  }

  .earth-theme .btn-outline-secondary,
  body.earth-theme .btn-outline-secondary {
    background: transparent !important;
    border-color: #a89f94 !important;
    color: #e8e4df !important;
  }
  .earth-theme .btn-outline-secondary:hover,
  body.earth-theme .btn-outline-secondary:hover {
    background: #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .btn-outline-success,
  body.earth-theme .btn-outline-success {
    background: transparent !important;
    border-color: #7fa878 !important;
    color: #7fa878 !important;
  }
  .earth-theme .btn-outline-success:hover,
  body.earth-theme .btn-outline-success:hover {
    background: #7fa878 !important;
    color: white !important;
  }

  .earth-theme .btn-outline-danger,
  body.earth-theme .btn-outline-danger {
    background: transparent !important;
    border-color: #b56b6b !important;
    color: #b56b6b !important;
  }
  .earth-theme .btn-outline-danger:hover,
  body.earth-theme .btn-outline-danger:hover {
    background: #b56b6b !important;
    color: white !important;
  }

  .earth-theme .btn-outline-warning,
  body.earth-theme .btn-outline-warning {
    background: transparent !important;
    border-color: #b89b78 !important;
    color: #b89b78 !important;
  }
  .earth-theme .btn-outline-warning:hover,
  body.earth-theme .btn-outline-warning:hover {
    background: #b89b78 !important;
    color: #1a1816 !important;
  }

  .earth-theme .btn-outline-info,
  body.earth-theme .btn-outline-info {
    background: transparent !important;
    border-color: #7a9bae !important;
    color: #7a9bae !important;
  }
  .earth-theme .btn-outline-info:hover,
  body.earth-theme .btn-outline-info:hover {
    background: #7a9bae !important;
    color: white !important;
  }

  .earth-theme .btn-outline-dark,
  body.earth-theme .btn-outline-dark {
    background: transparent !important;
    border-color: #a89f94 !important;
    color: #e8e4df !important;
  }

  .earth-theme .btn-outline-light,
  body.earth-theme .btn-outline-light {
    background: transparent !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  /* Alerts - earth-dark variants */
  .earth-theme .alert-success,
  body.earth-theme .alert-success {
    background: rgba(127, 168, 120, 0.15) !important;
    border-color: #7fa878 !important;
    color: #7fa878 !important;
  }

  .earth-theme .alert-warning,
  body.earth-theme .alert-warning {
    background: rgba(184, 155, 120, 0.15) !important;
    border-color: #b89b78 !important;
    color: #b89b78 !important;
  }

  .earth-theme .alert-danger,
  body.earth-theme .alert-danger {
    background: rgba(193, 127, 89, 0.15) !important;
    border-color: #c17f59 !important;
    color: #d4956a !important;
  }

  .earth-theme .alert-info,
  body.earth-theme .alert-info {
    background: rgba(122, 155, 174, 0.15) !important;
    border-color: #7a9bae !important;
    color: #7a9bae !important;
  }

  .earth-theme .alert h1, .earth-theme .alert h2, .earth-theme .alert h3,
  .earth-theme .alert h4, .earth-theme .alert h5, .earth-theme .alert h6,
  .earth-theme .alert p, .earth-theme .alert span, .earth-theme .alert div,
  .earth-theme .alert strong, .earth-theme .alert em, .earth-theme .alert small {
    color: inherit !important;
  }

  .earth-theme .alert a {
    color: #d4956a !important;
  }

  /* Badges */
  .earth-theme .badge.bg-success,
  .earth-theme .badge.bg-primary {
    background: #7fa878 !important;
  }

  .earth-theme .badge.bg-warning {
    background: #b89b78 !important;
    color: #1a1816 !important;
  }

  .earth-theme .badge.bg-danger {
    background: #d4956a !important;
  }

  /* Dropdown menus */
  .earth-theme .dropdown-menu,
  body.earth-theme .dropdown-menu {
    background: #252220 !important;
    background-color: #252220 !important;
    border: 1px solid #3d3632 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
  }

  .earth-theme .dropdown-item,
  body.earth-theme .dropdown-item {
    color: #e8e4df !important;
  }

  .earth-theme .dropdown-item:hover,
  body.earth-theme .dropdown-item:hover {
    background: #2a2622 !important;
    color: #e8e4df !important;
  }

  .earth-theme .dropdown-divider {
    border-color: #3d3632 !important;
  }

  /* Modals */
  .earth-theme .modal-content,
  body.earth-theme .modal-content {
    background: #211e1b !important;
    background-color: #211e1b !important;
    border: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .modal-header,
  body.earth-theme .modal-header {
    background: #252220 !important;
    background-color: #252220 !important;
    border-bottom: 1px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  .earth-theme .modal-footer,
  body.earth-theme .modal-footer {
    background: #252220 !important;
    background-color: #252220 !important;
    border-top: 1px solid #3d3632 !important;
  }

  .earth-theme .modal-title,
  body.earth-theme .modal-title {
    color: #e8e4df !important;
  }

  /* Breadcrumbs */
  .earth-theme .breadcrumb,
  .earth-theme .retro-breadcrumb,
  body.earth-theme .retro-breadcrumb {
    background: #252220 !important;
    background-color: #252220 !important;
    border: none !important;
  }

  .earth-theme .breadcrumb-item,
  .earth-theme .breadcrumb-item a {
    color: #d4956a !important;
  }

  .earth-theme .breadcrumb-item.active {
    color: #a89f94 !important;
  }

  /* Retro empty states */
  .earth-theme .retro-empty-state,
  body.earth-theme .retro-empty-state {
    background: #211e1b !important;
    color: #e8e4df !important;
  }

  .earth-theme .retro-empty-state-icon,
  .earth-theme .retro-empty-state-title,
  .earth-theme .retro-empty-state-message,
  .earth-theme .retro-empty-state p,
  .earth-theme .retro-empty-state div {
    color: #e8e4df !important;
  }

  /* Header command input */
  .earth-theme #header-command-input,
  body.earth-theme #header-command-input {
    background-color: #252220 !important;
    color: #e8e4df !important;
    border: 1px solid #3d3632 !important;
  }

  /* Drawer */
  .earth-theme .drawer,
  body.earth-theme .drawer {
    background-color: #211e1b !important;
    color: #e8e4df !important;
  }

  /* Container divs from contrast-fixes override */
  body.earth-theme main > div:not(.modal):not(.drawer):not(.dropdown),
  body.earth-theme main > section,
  body.earth-theme main > article,
  body.earth-theme main > form {
    background-color: transparent !important;
    color: #e8e4df !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Retro window title in dark mode */
  .earth-theme .retro-window-title,
  body.earth-theme .retro-window-title {
    background: #252220 !important;
    color: #e8e4df !important;
    border-bottom: 2px solid #3d3632 !important;
  }

  /* Striped table rows */
  body.earth-theme .table-striped > tbody > tr:nth-of-type(odd) > *,
  .earth-theme .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #252220 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .table-striped > tbody > tr:nth-of-type(even) > *,
  .earth-theme .table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: #211e1b !important;
    color: #e8e4df !important;
  }

  /* Project badge in dark mode */
  .earth-theme .project-badge {
    background: #b89b78 !important;
    color: #1a1816 !important;
    border: 1px solid #3d3632 !important;
  }

  .earth-theme .project-badge:hover {
    background: #d4956a !important;
    color: white !important;
  }

  /* hr elements */
  .earth-theme hr,
  body.earth-theme hr {
    border-color: #3d3632 !important;
  }

  /* Code blocks */
  .earth-theme pre,
  .earth-theme code {
    background: #252220 !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  /* ===========================================
     BOOTSTRAP UTILITY CLASS OVERRIDES
     Fix .bg-light, .bg-white, .text-dark etc.
     =========================================== */
  body.earth-theme .bg-light,
  .earth-theme .bg-light {
    background-color: #252220 !important;
  }

  body.earth-theme .bg-white,
  .earth-theme .bg-white {
    background-color: #211e1b !important;
  }

  body.earth-theme .text-dark,
  .earth-theme .text-dark {
    color: #e8e4df !important;
  }

  body.earth-theme .text-black,
  .earth-theme .text-black {
    color: #e8e4df !important;
  }

  body.earth-theme .text-muted,
  .earth-theme .text-muted {
    color: #a89f94 !important;
  }

  body.earth-theme .border,
  .earth-theme .border {
    border-color: #3d3632 !important;
  }

  body.earth-theme .border-bottom,
  .earth-theme .border-bottom {
    border-bottom-color: #3d3632 !important;
  }

  body.earth-theme .border-top,
  .earth-theme .border-top {
    border-top-color: #3d3632 !important;
  }

  body.earth-theme .shadow,
  .earth-theme .shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3) !important;
  }

  body.earth-theme .border-light,
  .earth-theme .border-light {
    border-color: #3d3632 !important;
  }

  body.earth-theme .bg-info,
  .earth-theme .bg-info {
    background-color: #2a4a5a !important;
  }

  body.earth-theme .bg-warning,
  .earth-theme .bg-warning {
    background-color: #5a4a2a !important;
  }

  body.earth-theme .bg-success,
  .earth-theme .bg-success {
    background-color: #2a4a2a !important;
  }

  body.earth-theme .bg-secondary,
  .earth-theme .bg-secondary {
    background-color: #3d3632 !important;
  }

  body.earth-theme .bg-danger,
  .earth-theme .bg-danger {
    background-color: #5a2a2a !important;
  }

  /* Ensure badge text stays readable */
  body.earth-theme .badge.text-dark,
  .earth-theme .badge.text-dark {
    color: #e8e4df !important;
  }

  /* ===========================================
     HOMEPAGE HERO GRADIENT FIX
     =========================================== */
  body.earth-theme .px-4.py-5.my-5.text-center,
  body.earth-theme [style*="linear-gradient(to bottom, #f8f9fa"] {
    background: linear-gradient(to bottom, #252220, #1a1816) !important;
    color: #e8e4df !important;
  }

  body.earth-theme .px-4.py-5.my-5.text-center h1,
  body.earth-theme .px-4.py-5.my-5.text-center h5,
  body.earth-theme .px-4.py-5.my-5.text-center p,
  body.earth-theme .px-4.py-5.my-5.text-center .lead {
    color: #e8e4df !important;
  }

  body.earth-theme .px-4.py-5.my-5.text-center .text-muted,
  body.earth-theme .px-4.py-5.my-5.text-center .small {
    color: #a89f94 !important;
  }

  /* ===========================================
     RETRO COMPONENT DARK MODE FIXES
     (Forum, etc.)
     =========================================== */
  body.earth-theme .retro-panel,
  .earth-theme .retro-panel {
    background: #211e1b !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-window,
  .earth-theme .retro-window {
    background: #211e1b !important;
    border: 2px solid #3d3632 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-window-content,
  .earth-theme .retro-window-content {
    background: #211e1b !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-list-item,
  .earth-theme .retro-list-item {
    background: #252220 !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  body.earth-theme .retro-list-item:hover,
  .earth-theme .retro-list-item:hover {
    background: #2a2622 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-list-item.active,
  .earth-theme .retro-list-item.active {
    background: #d4956a !important;
    color: white !important;
  }

  body.earth-theme .retro-font,
  .earth-theme .retro-font {
    color: #e8e4df !important;
  }

  body.earth-theme .retro-breadcrumb,
  .earth-theme .retro-breadcrumb {
    color: #a89f94 !important;
  }

  body.earth-theme .retro-breadcrumb a,
  .earth-theme .retro-breadcrumb a {
    color: #d4956a !important;
  }

  body.earth-theme .retro-alert,
  .earth-theme .retro-alert {
    background: #252220 !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-btn,
  .earth-theme .retro-btn {
    background: #3d3632 !important;
    color: #e8e4df !important;
    border-color: #4d4642 !important;
  }

  body.earth-theme .retro-btn:hover,
  .earth-theme .retro-btn:hover {
    background: #4d4642 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-btn-primary,
  .earth-theme .retro-btn-primary {
    background: #d4956a !important;
    color: white !important;
    border-color: #c17f59 !important;
  }

  body.earth-theme .retro-btn-success,
  .earth-theme .retro-btn-success {
    background: #7fa878 !important;
    color: white !important;
    border-color: #6a9362 !important;
  }

  body.earth-theme .retro-btn-info,
  .earth-theme .retro-btn-info {
    background: #7a9bae !important;
    color: white !important;
    border-color: #6a8b9e !important;
  }

  body.earth-theme .retro-btn-danger,
  .earth-theme .retro-btn-danger {
    background: #b56b6b !important;
    color: white !important;
    border-color: #a05b5b !important;
  }

  body.earth-theme .retro-btn-warning,
  .earth-theme .retro-btn-warning {
    background: #b89b78 !important;
    color: #1a1816 !important;
    border-color: #a88b68 !important;
  }

  body.earth-theme .retro-btn-small,
  .earth-theme .retro-btn-small {
    background: #3d3632 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .retro-pagination .retro-page-link,
  .earth-theme .retro-pagination .retro-page-link {
    background: #252220 !important;
    color: #e8e4df !important;
    border-color: #3d3632 !important;
  }

  body.earth-theme .retro-pagination .retro-page-link.active,
  .earth-theme .retro-pagination .retro-page-link.active {
    background: #d4956a !important;
    color: white !important;
  }

  body.earth-theme .retro-radio,
  .earth-theme .retro-radio {
    accent-color: #d4956a !important;
  }

  /* ===========================================
     INLINE STYLE OVERRIDES - COMPREHENSIVE
     Override hardcoded colors across all templates
     =========================================== */

  /* Dark gray text (#404040) - used in forum, templates, forms */
  body.earth-theme [style*="color: #404040"] {
    color: #a89f94 !important;
  }

  /* Brown text (#6b5d4d) - used in forum, templates, categories */
  body.earth-theme [style*="color: #6b5d4d"] {
    color: #a89f94 !important;
  }

  body.earth-theme a[style*="color: #6b5d4d"] {
    color: #d4956a !important;
  }

  /* Brown backgrounds (#6b5d4d) - buttons, badges */
  body.earth-theme [style*="background: #6b5d4d"],
  body.earth-theme [style*="background-color: #6b5d4d"] {
    background: #3d3632 !important;
    background-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  /* Teal backgrounds (#008080) - template dashboard */
  body.earth-theme [style*="background: #008080"] {
    background: #7a9bae !important;
  }

  /* Light gray backgrounds - pre/code blocks, containers */
  body.earth-theme [style*="background: #f5f5f5"] {
    background: #252220 !important;
    color: #e8e4df !important;
  }

  body.earth-theme [style*="background: #f8f9fa"],
  body.earth-theme [style*="background-color: #f8f9fa"] {
    background: #252220 !important;
    background-color: #252220 !important;
    color: #e8e4df !important;
  }

  /* White backgrounds in inline styles */
  body.earth-theme [style*="background: #fff"],
  body.earth-theme [style*="background-color: #fff"],
  body.earth-theme [style*="background-color: white"],
  body.earth-theme [style*="background: white"] {
    background: #252220 !important;
    background-color: #252220 !important;
  }

  /* Dark text colors in inline styles */
  body.earth-theme [style*="color: #2c3e50"] {
    color: #e8e4df !important;
  }

  body.earth-theme [style*="color: #333"] {
    color: #e8e4df !important;
  }

  body.earth-theme [style*="color: #7f8c8d"] {
    color: #a89f94 !important;
  }

  /* Bootstrap stat colors - adapt for dark mode */
  body.earth-theme [style*="color: #007bff"] {
    color: #7a9bae !important;
  }

  body.earth-theme [style*="color: #28a745"] {
    color: #7fa878 !important;
  }

  body.earth-theme [style*="color: #ffc107"] {
    color: #b89b78 !important;
  }

  body.earth-theme [style*="color: #dc3545"] {
    color: #b56b6b !important;
  }

  body.earth-theme [style*="border-left-color: #007bff"] {
    border-left-color: #7a9bae !important;
  }

  body.earth-theme [style*="border-left-color: #28a745"] {
    border-left-color: #7fa878 !important;
  }

  body.earth-theme [style*="border-left-color: #ffc107"] {
    border-left-color: #b89b78 !important;
  }

  /* Card headers with hardcoded backgrounds */
  body.earth-theme .card-header[style*="background-color: #dc3545"] {
    background-color: #b56b6b !important;
  }

  body.earth-theme .card-header[style*="background-color: #198754"] {
    background-color: #7fa878 !important;
  }

  body.earth-theme .card-header[style*="background-color: #fd7e14"] {
    background-color: #b89b78 !important;
  }

  body.earth-theme .card-header[style*="background-color: #6f42c1"] {
    background-color: #8a6dab !important;
  }

  /* Light gray borders in inline styles */
  body.earth-theme [style*="border: 1px solid #ccc"],
  body.earth-theme [style*="border: 1px solid #e9ecef"],
  body.earth-theme [style*="border: 1px solid #e0e0e0"],
  body.earth-theme [style*="border: 1px solid #dee2e6"] {
    border-color: #3d3632 !important;
  }

  body.earth-theme [style*="border-bottom: 1px solid #e9ecef"],
  body.earth-theme [style*="border-bottom: 1px solid #eee"] {
    border-bottom-color: #3d3632 !important;
  }

  /* Homepage retro form field */
  body.earth-theme [style*="border-color: #404040 #dfdfdf"] {
    border-color: #3d3632 !important;
  }

  /* ===========================================
     AUTH PAGE CLASSES (login, signup, reset)
     =========================================== */
  body.earth-theme .bg-soft {
    background-color: #1a1816 !important;
  }

  body.earth-theme .signin-inner {
    background-color: #211e1b !important;
    color: #e8e4df !important;
  }

  body.earth-theme .fw-normal,
  body.earth-theme .font-weight-normal {
    color: #e8e4df !important;
  }

  body.earth-theme a.fw-bold,
  body.earth-theme a.font-weight-bold {
    color: #d4956a !important;
  }

  /* ===========================================
     FORM ELEMENTS - COMPREHENSIVE
     =========================================== */
  body.earth-theme .form-control,
  body.earth-theme .form-select,
  .earth-theme .form-control,
  .earth-theme .form-select {
    background-color: #252220 !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .form-control:focus,
  body.earth-theme .form-select:focus,
  .earth-theme .form-control:focus,
  .earth-theme .form-select:focus {
    border-color: #d4956a !important;
    box-shadow: 0 0 0 0.25rem rgba(212, 149, 106, 0.25) !important;
  }

  body.earth-theme .form-control::placeholder {
    color: #7a7167 !important;
  }

  body.earth-theme .form-label,
  .earth-theme .form-label {
    color: #e8e4df !important;
  }

  body.earth-theme .form-check-label,
  .earth-theme .form-check-label {
    color: #e8e4df !important;
  }

  /* ===========================================
     LIST GROUP ITEMS
     =========================================== */
  body.earth-theme .list-group-item,
  .earth-theme .list-group-item {
    background-color: #211e1b !important;
    border-color: #3d3632 !important;
    color: #e8e4df !important;
  }

  body.earth-theme .list-group-item:hover,
  .earth-theme .list-group-item:hover {
    background-color: #252220 !important;
  }

  body.earth-theme .list-group-item.active,
  .earth-theme .list-group-item.active {
    background-color: #d4956a !important;
    border-color: #d4956a !important;
    color: white !important;
  }

  /* ===========================================
     PAGINATION
     =========================================== */
  body.earth-theme .page-link,
  .earth-theme .page-link {
    background-color: #252220 !important;
    border-color: #3d3632 !important;
    color: #d4956a !important;
  }

  body.earth-theme .page-item.active .page-link,
  .earth-theme .page-item.active .page-link {
    background-color: #d4956a !important;
    border-color: #d4956a !important;
    color: white !important;
  }

  /* ===========================================
     NAV TABS AND PILLS
     =========================================== */
  body.earth-theme .nav-tabs,
  .earth-theme .nav-tabs {
    border-bottom-color: #3d3632 !important;
  }

  body.earth-theme .nav-tabs .nav-link,
  .earth-theme .nav-tabs .nav-link {
    color: #a89f94 !important;
  }

  body.earth-theme .nav-tabs .nav-link.active,
  .earth-theme .nav-tabs .nav-link.active {
    background-color: #211e1b !important;
    border-color: #3d3632 #3d3632 #211e1b !important;
    color: #e8e4df !important;
  }

  /* ===========================================
     PROGRESS BARS
     =========================================== */
  body.earth-theme .progress,
  .earth-theme .progress {
    background-color: #252220 !important;
  }

  body.earth-theme .progress-bar,
  .earth-theme .progress-bar {
    background-color: #d4956a !important;
  }

  /* ===========================================
     SEARCH CONTAINER ON HOMEPAGE
     =========================================== */
  body.earth-theme .search-container {
    color: #e8e4df !important;
  }

  body.earth-theme .search-container h1 {
    color: #e8e4df !important;
  }
}

/* ===========================================
   HASHTAG LINKS
   =========================================== */
a.hashtag {
  color: #c17f59;
  text-decoration: none;
  font-weight: 500;
  padding: 0.1em 0.2em;
  border-radius: 3px;
  transition: background-color 0.15s, color 0.15s;
}

a.hashtag:hover {
  background-color: #c17f59;
  color: #fff;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  a.hashtag {
    color: #d4956a;
  }
  a.hashtag:hover {
    background-color: #d4956a;
    color: #1a1816;
  }
}
