@import url(https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap);
/* Theme System */
:root {
  /* Light Theme (Glitch-inspired warm) */
  --bg-primary: #fff5e6;
  --bg-secondary: #ffe8cc;
  --bg-tertiary: #ffd699;
  --text-primary: #3d2817;
  --text-secondary: #5c3d2e;
  --text-muted: #8b6f47;
  --border-color: #e8d4b8;
  --border-light: #f5e6d3;
  --shadow-light: 0 2px 8px rgba(139, 111, 71, 0.08);
  --shadow-medium: 0 4px 12px rgba(139, 111, 71, 0.12);
  --shadow-heavy: 0 8px 20px rgba(139, 111, 71, 0.15);
  --accent-primary: #ff9944;
  --accent-secondary: #ffcc66;
  --success: #88ff99;
  --warning: #ffaa44;
  --error: #ff7766;
  --info: #66ccff;

  /* Existing variables for compatibility */
  --gradient-bg: white;
  --glass-bg: rgba(255, 245, 230, 0.92);
  --glass-border: rgba(255, 204, 102, 0.2);
}

/* Dark Theme (Glitch-inspired warm dark) */
.theme-dark {
  --bg-primary: #2a1f1a;
  --bg-secondary: #3a2f2a;
  --bg-tertiary: #4a3f3a;
  --text-primary: #f5e6d3;
  --text-secondary: #e8d4b8;
  --text-muted: #c9a76d;
  --border-color: #5a4f4a;
  --border-light: #6a5f5a;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-heavy: 0 8px 20px rgba(0, 0, 0, 0.4);
  --accent-primary: #ffaa44;
  --accent-secondary: #ffdd88;
  --success: #88ff99;
  --warning: #ffcc66;
  --error: #ff9966;
  --info: #66ccff;

  /* Dark theme specific */
  --gradient-bg: linear-gradient(135deg, #2a1f1a 0%, #3a2f2a 100%);
  --glass-bg: rgba(58, 47, 42, 0.92);
  --glass-border: rgba(255, 170, 68, 0.2);
  --card-bg: #3a2f2a;
  --input-bg: #3a2f2a;
}

/* Alias for ThemeService compatibility */
.dark-mode {
  --bg-primary: #2a1f1a;
  --bg-secondary: #3a2f2a;
  --bg-tertiary: #4a3f3a;
  --text-primary: #f5e6d3;
  --text-secondary: #e8d4b8;
  --text-muted: #c9a76d;
  --border-color: #5a4f4a;
  --border-light: #6a5f5a;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-heavy: 0 8px 20px rgba(0, 0, 0, 0.4);
  --accent-primary: #ffaa44;
  --accent-secondary: #ffdd88;
  --success: #88ff99;
  --warning: #ffcc66;
  --error: #ff9966;
  --info: #66ccff;

  /* Dark theme specific */
  --gradient-bg: linear-gradient(135deg, #2a1f1a 0%, #3a2f2a 100%);
  --glass-bg: rgba(58, 47, 42, 0.92);
  --glass-border: rgba(255, 170, 68, 0.2);
  --card-bg: #3a2f2a;
  --input-bg: #3a2f2a;
}

/* Auto Theme - Uses system preference */
@media (prefers-color-scheme: dark) {
  .theme-auto {
    --bg-primary: #2a1f1a;
    --bg-secondary: #3a2f2a;
    --bg-tertiary: #4a3f3a;
    --text-primary: #f5e6d3;
    --text-secondary: #e8d4b8;
    --text-muted: #c9a76d;
    --border-color: #5a4f4a;
    --border-light: #6a5f5a;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 8px 20px rgba(0, 0, 0, 0.4);
    --accent-primary: #ffaa44;
    --accent-secondary: #ffdd88;
    --success: #88ff99;
    --warning: #ffcc66;
    --error: #ff9966;
    --info: #66ccff;
    --gradient-bg: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --glass-bg: rgba(30, 41, 59, 0.95);
    --glass-border: rgba(148, 163, 184, 0.2);
  }
}

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

/* CRITICAL: Global scroll fix - ensure page can always scroll */
html, body {
  height: auto !important;
  min-height: 100vh;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
}

/* Fallback root styles for compatibility */
html {
  --gradient-bg: linear-gradient(135deg, #fff5e6 0%, #ffe8cc 100%);
  --glass-bg: rgba(255, 245, 230, 0.92);
  --glass-border: rgba(255, 204, 102, 0.2);
  --shadow-light: 0 2px 8px rgba(139, 111, 71, 0.08);
  --shadow-medium: 0 4px 12px rgba(139, 111, 71, 0.12);
  --shadow-heavy: 0 8px 20px rgba(139, 111, 71, 0.15);
  --text-primary: #3d2817;
  --text-secondary: #5c3d2e;
  --text-muted: #8b6f47;
  --accent-primary: #ff9944;
  --accent-secondary: #ffcc66;
  --success: #88ff99;
  --warning: #ffaa44;
  --error: #ff7766;
  --info: #66ccff;
}
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--gradient-bg);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
} /* Hide initial loader once app loads */
.app-loaded .initial-loader {
  display: none !important;
} /* App Container */
.app-container {
  min-height: 100vh;
  padding: 25px;
  background: var(--gradient-bg);
} /* Header */
.app-header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 22px 35px;
  margin-bottom: 35px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}
.app-header:hover {
  box-shadow: var(--shadow-medium);
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo-icon {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  overflow: hidden;
}

.logo-icon.has-image {
  background: transparent !important;
  box-shadow: none;
}

.logo-icon.has-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 0 !important;
}

.app-header .logo-icon.has-image,
.app-header .logo-icon.has-image[style*="background"] {
  background: transparent !important;
}
.logo-text {
  font-size: 30px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
}
.logo-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: -3px;
}
.header-search {
  display: flex;
  align-items: center;
  background: rgba(247, 250, 252, 0.8);
  border-radius: 18px;
  padding: 14px 24px;
  gap: 14px;
  min-width: 350px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
}

/* Global quick-search results dropdown */
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e8d4b8);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
  z-index: 1100;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}
.theme-dark .global-search-dropdown,
.dark-mode .global-search-dropdown,
[data-theme="dark"] .global-search-dropdown {
  background: var(--bg-secondary, #3a2f2a);
  border-color: var(--border-color, #5a4f4a);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
}
.search-result-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #8b6f47);
  padding: 8px 10px 4px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}
.search-result-item:hover {
  background: var(--bg-secondary, #ffe8cc);
}
.theme-dark .search-result-item:hover,
.dark-mode .search-result-item:hover,
[data-theme="dark"] .search-result-item:hover {
  background: var(--bg-tertiary, #4a3f3a);
}
.search-result-icon {
  font-size: 16px;
  flex: 0 0 auto;
}
.search-result-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #3d2817);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, #8b6f47);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-search:focus-within {
  background: white;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  border-color: var(--accent-primary);
}
.header-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 16px;
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}
.header-search input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}
.search-icon {
  color: var(--text-muted);
  font-size: 18px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.notification-icon {
  position: relative;
  width: 50px;
  height: 50px;
  background: rgba(247, 250, 252, 0.8);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.notification-icon:hover {
  background: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  border-radius: 50%;
  font-size: 11px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
} /* Main Layout */
.app-layout {
  display: flex;
  gap: 35px;
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
} /* Sidebar */
.app-sidebar {
  width: 300px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 35px 0;
  height: calc(100vh - 80px);
  max-height: calc(100vh - 80px);
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  overflow: hidden;
  align-self: flex-start;
}
.app-sidebar .nav-menu {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 111, 71, 0.4) rgba(232, 212, 184, 0.3);
  -ms-overflow-style: auto;
  padding-right: 4px;
  transition: scrollbar-color 0.3s ease;
  overscroll-behavior: contain;
}
.app-sidebar .nav-menu::-webkit-scrollbar {
  width: 6px;
}
.app-sidebar .nav-menu::-webkit-scrollbar-track {
  background: rgba(232, 212, 184, 0.3);
  border-radius: 10px;
}
.app-sidebar .nav-menu::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 71, 0.4);
  border-radius: 10px;
  transition: background 0.3s ease;
}
.app-sidebar .nav-menu:hover {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 111, 71, 0.55) rgba(232, 212, 184, 0.4);
}
.app-sidebar .nav-menu:hover::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 71, 0.55);
}
.app-sidebar .nav-menu:hover::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 111, 71, 0.7);
}
.app-sidebar:hover {
  box-shadow: var(--shadow-medium);
}
.sidebar-user {
  padding: 15px 5px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 30px;
  flex-direction: column;
  text-align: center;
  justify-content: center;
}
.user-avatar {
  width: 35px;
  height: 35px;
  background-color: var(--text-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(26, 26, 26, 0.15);
}
.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.user-info h3 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.user-info p {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}
/* Navigation */
.nav-menu {
  padding: 0 25px;
}
.nav-section {
  margin: 30px 0 18px;
}
.nav-section-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1.2px;
  margin-bottom: 15px;
  padding: 0 15px;
}
.nav-item {
  margin-bottom: 8px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.nav-link:hover {
  background: rgba(102, 126, 234, 0.08);
  color: var(--accent-primary);
  transform: translateX(8px);
}
.nav-link.active {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.35) 0%,
    rgba(118, 75, 162, 0.35) 100%
  );
  color: var(--accent-primary);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  font-weight: 800;
}
.nav-icon {
  font-size: 20px;
  width: 24px;
  height: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nav-badge.new {
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
} /* Main Content */
.app-main {
  flex: 1;
  min-height: calc(100vh - 160px);
  overflow-y: auto;
  overflow-x: hidden;
}
.page-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 25px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  min-height: 650px;
  transition: all 0.3s ease;
}

/* Dashboard page - remove ALL default page-content styles */
.page-content.dashboard-page {
  padding: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  border-radius: 0 !important;
  display: block !important;
  min-height: auto !important;
}

/* Assets page - remove min-height constraint */
.page-content.assets-page-wrapper {
  min-height: auto !important;
  height: auto !important;
}

/* Remove padding from inner page-content on dashboard */
.page-content.dashboard-page #page-content {
  padding: 0 !important;
  margin: 0 !important;
}

/* Profile card as sibling of page-content in app-main */
.app-main > .bandar-profile-card-container {
  width: 100% !important;
  margin: 0 0 24px 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Responsive adjustments for vertical/portrait screens */
@media (max-height: 900px) {
  .bandar-profile-card-container {
    min-height: 380px !important;
  }
}

@media (max-height: 768px) {
  .bandar-profile-card-container {
    min-height: 360px !important;
  }
}

/* For big screens with tall viewport - optimize vertical layout */
@media (min-height: 1200px) and (min-width: 1200px) {
  .bandar-profile-card-container {
    min-height: 500px !important;
  }
}

/* For tall screens - improve vertical spacing */
@media (min-height: 1000px) {
  .app-main > .bandar-profile-card-container {
    margin: 0 0 32px 0 !important;
  }
}

@media (max-width: 768px) {
  .app-main > .bandar-profile-card-container {
    margin: 0 0 16px 0 !important;
  }
}

@media (max-width: 480px) {
  .app-main > .bandar-profile-card-container {
    margin: 0 0 12px 0 !important;
  }
}

.bandar-profile-card-container {
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: block !important;
}

.main-menu-card-container {
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  display: block !important;
  min-height: 80px !important;
}

.page-content:hover {
  box-shadow: var(--shadow-medium);
}

/* TIMESHEETS PAGE GLASS EFFECT OVERRIDE - ONLY page-content background */
.page-content.timesheets-page {
  background: var(--bg-primary) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-color: var(--bg-primary) !important;
  background-image: none !important;
}

/* CRITICAL: Ensure sidebar and header NEVER get affected by timesheet styles */
.app-sidebar,
.app-header,
.logo-text,
.logo-subtitle,
.user-info h3,
.nav-link,
.page-header h1,
.page-header p {
  color: var(--text-primary) !important;
  opacity: 1 !important;
  filter: none !important;
  background-image: none !important;
}

/* ⭐ EXCEPTION: Allow active nav-links to show gradient background */
.nav-link.active {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.35) 0%,
    rgba(118, 75, 162, 0.35) 100%
  ) !important;
  background-image: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.35) 0%,
    rgba(118, 75, 162, 0.35) 100%
  ) !important;
  color: var(--accent-primary) !important;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
  font-weight: 800 !important;
}

/* Ensure active state persists even when nav-link is being manipulated */
.nav-link:is(.active) {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.35) 0%,
    rgba(118, 75, 162, 0.35) 100%
  ) !important;
}

/* Allow user avatars to display background images even on timesheets page
   Only unset background-image for avatars that do NOT have a loaded image
   (class .has-image is applied at runtime). This prevents global rules from
   blocking avatars that were set via inline styles. */
.page-content.timesheets-page .user-avatar:not(.has-image),
.timesheets-page .user-avatar:not(.has-image) {
  background-image: none !important;
}

/* Page Headers */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
}
.page-header h1 {
  font-size: 40px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin: 0;
}
.page-header p {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
}

/* Dashboard Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  margin-bottom: 45px;
}

/* Responsive stats grid for tablets and smaller screens */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
}

/* Mobile stats grid */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

.stat-card {
  background: linear-gradient(
    135deg,
    var(--card-bg) 0%,
    var(--card-bg-end) 100%
  );
  border-radius: 28px;
  padding: 40px;
  color: white;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-medium);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card:hover {
  transform: translateY(-15px) scale(1.02);
  box-shadow: var(--shadow-heavy);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: -60%;
  right: -60%;
  width: 140%;
  height: 140%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: 0;
}

.stat-card-content {
  position: relative;
  z-index: 1;
}

.stat-card.green {
  --card-bg: #10b981;
  --card-bg-end: #059669;
}

.stat-card.orange {
  --card-bg: #f59e0b;
  --card-bg-end: #d97706;
}

.stat-card.blue {
  --card-bg: #3b82f6;
  --card-bg-end: #2563eb;
}

.stat-card.purple {
  --card-bg: #8b5cf6;
  --card-bg-end: #7c3aed;
}

.stat-card.red {
  --card-bg: #ef4444;
  --card-bg-end: #dc2626;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 15px;
}

.stat-value {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1;
}

.stat-title {
  font-size: 16px;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 12px;
}

.stat-change {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

.stat-change.positive {
  color: rgba(255, 255, 255, 0.9);
}

.stat-change.negative {
  color: rgba(255, 255, 255, 0.7);
}

/* Cards Page Styles */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.card-item {
  background: white;
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.card-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.card-item.default-card {
  border: 2px solid var(--accent-primary);
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.02) 0%,
    rgba(118, 75, 162, 0.02) 100%
  );
}

.card-visual {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 25px;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.card-visual::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.card-type-icon {
  font-size: 24px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
}

.default-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-primary);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.card-number {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 20px;
  font-family: "Courier New", monospace;
}

.card-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-holder {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.9;
}

.card-expiry {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
  font-family: "Courier New", monospace;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 30px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}

.modal-body {
  padding: 30px;
}

.modal-footer {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  padding: 20px 30px 30px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.module-selector-modal .modal-content {
  width: 50vw;
  max-width: 600px;
  min-width: 400px;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  margin: 20px;
  flex-shrink: 0;
  flex-grow: 0;
  align-self: center;
}

.module-selector-modal .modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 22px 28px;
  border-radius: 12px 12px 0 0;
}

.module-selector-modal .modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
  text-align: center;
}

.module-selector-modal .modal-body {
  padding: 22px 28px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.module-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  min-height: 84px;
  max-height: 84px;
  aspect-ratio: 1;
}

.module-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: #667eea;
}

.module-tile:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 8px 24px rgba(0, 0, 0, 0.12);
}

.module-tile:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.module-tile.user {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
}

.module-tile.project {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.module-tile.business {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.module-tile.finance {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.module-tile.sales {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.module-tile.hr-management {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
}

.module-tile.procurement {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  color: white;
}

.module-tile.account {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

.module-tile.user:hover {
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.25);
}

.module-tile.project:hover {
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}

.module-tile.business:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.module-tile.finance:hover {
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
}

.module-tile.sales:hover {
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
}

.module-tile.hr-management:hover {
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.25);
}

.module-tile.procurement:hover {
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.25);
}

.module-tile.account:hover {
  box-shadow: 0 8px 24px rgba(107, 114, 128, 0.25);
}

.module-icon {
  font-size: 42px;
  margin-bottom: 4px;
  opacity: 1;
  line-height: 1;
  display: block;
}

.module-name {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.3px;
  margin-bottom: 1px;
}

.module-description {
  font-size: 9px;
  opacity: 0.9;
  text-align: center;
  line-height: 1.1;
}

/* Tablet Styles (421-1024px) */
@media (max-width: 1024px) {
  .module-selector-modal .modal-content {
    width: 70vw;
    max-width: 500px;
    min-width: 350px;
    margin: 20px;
    flex-shrink: 0;
    flex-grow: 0;
    align-self: center;
  }

  .module-selector-modal .modal-header {
    padding: 20px 28px;
  }

  .module-selector-modal .modal-header h3 {
    font-size: 15px;
  }

  .module-selector-modal .modal-body {
    padding: 20px 28px;
  }

  .module-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .module-tile {
    min-height: 68px;
    max-height: 68px;
    padding: 8px 6px;
  }

  .module-icon {
    font-size: 36px;
    margin-bottom: 3px;
  }

  .module-name {
    font-size: 12px;
  }

  .module-description {
    font-size: 8px;
  }
}

@media (max-width: 768px) {
  .module-selector-modal .modal-content {
    width: 80vw;
    max-width: 450px;
    min-width: 320px;
    margin: 20px;
    flex-shrink: 0;
    flex-grow: 0;
    align-self: center;
  }

  .module-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .module-tile {
    min-height: 68px;
    max-height: 68px;
    padding: 8px 6px;
  }

  .module-icon {
    font-size: 36px;
    margin-bottom: 3px;
  }

  .module-name {
    font-size: 12px;
  }

  .module-description {
    font-size: 8px;
  }
}

/* Mobile Styles (≤420px) */
@media (max-width: 420px) {
  .module-selector-modal .modal-content {
    width: 96vw;
    max-width: 96vw;
    min-width: 96vw;
    margin: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    flex-shrink: 0;
    flex-grow: 0;
    align-self: center;
  }

  .module-selector-modal .modal-header {
    padding: 18px;
    border-radius: 12px 12px 0 0;
  }

  .module-selector-modal .modal-header h3 {
    font-size: 15px;
  }

  .module-selector-modal .modal-body {
    padding: 18px;
  }

  .module-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-bottom: 16px;
  }

  .module-tile {
    min-height: 60px;
    max-height: 60px;
    padding: 6px 4px;
    aspect-ratio: 1;
  }

  .module-icon {
    font-size: 32px;
    margin-bottom: 2px;
  }

  .module-name {
    font-size: 11px;
    margin-bottom: 0px;
  }

  .module-description {
    font-size: 7px;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  font-size: 14px;
  background: rgba(247, 250, 252, 0.5);
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
}

.stat-title {
  font-size: 16px;
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-value {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 15px;
  line-height: 1;
  letter-spacing: -1.5px;
}

.stat-change {
  font-size: 14px;
  opacity: 0.9;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  backdrop-filter: blur(10px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-transform: none;
  box-shadow: 0 4px 12px var(--shadow-light);
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--accent-primary) 0%,
    var(--accent-secondary) 100%
  );
  color: white;
  box-shadow: 0 6px 16px rgba(255, 153, 68, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 153, 68, 0.35);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-medium);
}

/* ⭐ Balance Module Button - Warm Glitch colors */
#balanceModuleBtn {
  background: linear-gradient(135deg, rgba(255, 153, 68, 0.15) 0%, rgba(255, 102, 68, 0.1) 100%) !important;
  border: 1px solid rgba(255, 153, 68, 0.4) !important;
  color: var(--accent-primary) !important;
  box-shadow: 0 4px 12px rgba(255, 153, 68, 0.15) !important;
}

#balanceModuleBtn:hover {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.4) 0%, rgba(75, 0, 130, 0.4) 100%) !important;
  box-shadow: 0 0 16px rgba(138, 43, 226, 0.3) !important;
}

/* Ensure colors don't change in dark mode */
.theme-dark #balanceModuleBtn,
.dark-mode #balanceModuleBtn {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.2) 0%, rgba(75, 0, 130, 0.2) 100%) !important;
  border: 1px solid rgba(138, 43, 226, 0.5) !important;
  color: #00ddff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.theme-dark #balanceModuleBtn:hover,
.dark-mode #balanceModuleBtn:hover {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.4) 0%, rgba(75, 0, 130, 0.4) 100%) !important;
  box-shadow: 0 0 16px rgba(138, 43, 226, 0.3) !important;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Tables */
.table-container {
  background: white;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.responsive-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overflow-y: visible;
  position: relative;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px; /* Increased to accommodate all columns including Last Login and Actions */
}

.table th {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 25px 30px;
  text-align: left;
  font-weight: 800;
  color: var(--text-primary);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

/* Dark mode override for table headers */
.theme-dark .table th,
.dark-mode .table th {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-bottom-color: var(--border-color) !important;
}

.table td {
  padding: 25px 30px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  vertical-align: middle;
  font-size: 16px;
  font-weight: 600;
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background: rgba(102, 126, 234, 0.03);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Column width specifications for user management table */
.table th:nth-child(6),
.table td:nth-child(6) {
  width: 140px !important;
  min-width: 140px !important;
  max-width: 140px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.table th:nth-child(7),
.table td:nth-child(7) {
  width: 140px !important;
  min-width: 140px !important;
  max-width: 140px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Ensure action buttons don't overflow */
.table td:nth-child(7) .action-buttons {
  display: flex !important;
  gap: 6px !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  overflow: visible !important;
}

/* Prevent scroll on action button hover */
.table tbody tr .action-buttons {
  position: relative;
  z-index: 1;
}

.table tbody tr:hover {
  overflow: visible !important;
}

/* Forms */
.form-control {
  width: 100%;
  padding: 18px 24px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 18px;
  font-size: 16px;
  background: rgba(247, 250, 252, 0.5);
  transition: all 0.3s ease;
  font-weight: 600;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
}

.form-group {
  margin-bottom: 28px;
}

.form-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 16px;
}

/* LOGIN PAGE - PRESERVE ORIGINAL BEAUTIFUL DESIGN */
.login-container {
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--gradient-bg) !important;
  padding: 25px !important;
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: visible !important;
}

.login-card {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(20px) !important;
  border-radius: 32px !important;
  padding: 55px 50px !important;
  width: 100% !important;
  max-width: 450px !important;
  text-align: center !important;
  box-shadow: var(--shadow-heavy) !important;
  border: 1px solid var(--glass-border) !important;
  margin: 0 auto !important;
  overflow: visible !important;
}

.login-card h1 {
  font-size: 40px !important;
  font-weight: 900 !important;
  margin-bottom: 12px !important;
  color: var(--text-primary) !important;
  letter-spacing: -1px !important;
}

.login-card p {
  color: var(--text-secondary) !important;
  margin-bottom: 40px !important;
  font-size: 18px !important;
  font-weight: 600 !important;
}

/* Login Branding Styles */
.login-branding {
  text-align: center !important;
  margin-bottom: 30px !important;
}

.login-logo {
  width: 80px !important;
  height: 80px !important;
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  border-radius: 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 32px !important;
  margin: 0 auto 25px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  overflow: hidden !important;
  animation: pulse 2s infinite !important;
}

.login-logo img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 18px !important;
}

.login-form {
  text-align: left !important;
  margin-bottom: 30px !important;
  max-width: 400px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: block !important;
}

.login-form .form-group {
  margin-bottom: 24px !important;
  width: 100% !important;
  display: block !important;
  clear: both !important;
}

.login-form .form-group:last-of-type {
  margin-bottom: 32px !important;
}

.login-form .form-label {
  display: block !important;
  margin-bottom: 8px !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  font-size: 15px !important;
  letter-spacing: 0.5px !important;
  white-space: nowrap !important;
  width: 100% !important;
  text-align: left !important;
  float: none !important;
}

.login-form .form-control {
  width: 100% !important;
  padding: 16px 20px !important;
  border: 2px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(15px) !important;
  color: var(--text-primary) !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-sizing: border-box !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  display: block !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  float: none !important;
  clear: both !important;
}

.login-form .form-control {
  width: 100% !important;
  padding: 16px 20px !important;
  border: 2px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(15px) !important;
  color: var(--text-primary) !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-sizing: border-box !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

.login-form .form-control:focus {
  border-color: var(--accent-primary) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 8px 32px rgba(0, 0, 0, 0.12) !important;
  outline: none !important;
  transform: translateY(-1px) !important;
}

.login-form .form-control::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
  font-weight: 400 !important;
}

.login-form .btn {
  width: 100% !important;
  padding: 18px 24px !important;
  border-radius: 16px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  text-align: center !important;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%) !important;
  border: none !important;
  color: white !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.3) !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

.login-form .btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4) !important;
}

.login-form .btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3) !important;
}

.login-demo {
  background: rgba(247, 250, 252, 0.8) !important;
  padding: 24px !important;
  border-radius: 20px !important;
  margin-top: 30px !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.login-demo small {
  color: var(--text-secondary) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
}

/* Override aggressive responsive rules for login page */
.login-container *,
.login-card *,
.login-form *,
.login-demo * {
  width: auto !important;
  max-width: none !important;
  flex-direction: initial !important;
}

/* Login form inputs should be full width within the card */
.login-form input,
.login-form select,
.login-form textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Mobile Login Page - Keep it beautiful but responsive */
@media (max-width: 768px) {
  .login-container {
    padding: 20px !important;
    min-height: 100vh !important;
  }

  .login-card {
    padding: 40px 30px !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 24px !important;
  }

  .login-card h1 {
    font-size: 32px !important;
    margin-bottom: 10px !important;
  }

  .login-card p {
    font-size: 16px !important;
    margin-bottom: 30px !important;
  }

  .login-demo {
    padding: 20px !important;
    margin-top: 25px !important;
  }
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-bg);
  padding: 25px;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 55px 50px;
  width: 100%;
  max-width: 450px;
  text-align: center;
  box-shadow: var(--shadow-heavy);
  border: 1px solid var(--glass-border);
}

.login-card h1 {
  font-size: 40px;
  font-weight: 900;
  margin-bottom: 12px;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.login-card p {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 18px;
  font-weight: 600;
}

.login-form {
  text-align: left;
  margin-bottom: 30px;
}

.login-demo {
  background: rgba(247, 250, 252, 0.8);
  padding: 24px;
  border-radius: 20px;
  margin-top: 30px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.login-demo small {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
}

/* ===== MOBILE LANDSCAPE LOGIN (Android APK) ===== */
@media (orientation: landscape) and (max-height: 520px) {
  .login-container {
    padding: 8px 16px !important;
    align-items: center !important;
    overflow-y: auto !important;
  }

  .login-card {
    display: flex !important;
    flex-direction: row !important;
    gap: 24px !important;
    align-items: center !important;
    padding: 14px 20px !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 16px !important;
    text-align: left !important;
  }

  .login-branding {
    flex: 0 0 auto !important;
    min-width: 130px !important;
    max-width: 160px !important;
    margin-bottom: 0 !important;
    text-align: center !important;
  }

  .login-logo {
    width: 46px !important;
    height: 46px !important;
    font-size: 18px !important;
    margin: 0 auto 8px !important;
  }

  #loginTitle, .login-card h1 {
    font-size: 16px !important;
    margin-bottom: 4px !important;
    letter-spacing: 0 !important;
  }

  #loginSubtitle, .login-card p {
    font-size: 10px !important;
    margin-bottom: 0 !important;
    display: none !important;
  }

  .login-form {
    flex: 1 !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: none !important;
  }

  .login-form .form-group {
    margin-bottom: 8px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .login-form .form-label {
    flex: 0 0 70px !important;
    margin-bottom: 0 !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .login-form .form-control {
    flex: 1 !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }

  .login-form .form-group:last-of-type {
    margin-bottom: 10px !important;
  }

  .login-form .btn {
    padding: 9px 16px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }

  .login-demo {
    display: none !important;
  }
}

/* ===== MOBILE GAME MODE (hide non-game elements) ===== */
body.mobile-game-mode .app-header,
body.mobile-game-mode .app-sidebar,
body.mobile-game-mode [data-mobile-hide] {
  display: none !important;
}

/* Mobile back button - only shown in mobile mode */
.mobile-back-btn {
  display: none;
}

body.mobile-game-mode .mobile-back-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: rgba(0, 221, 255, 0.15) !important;
  border: 1px solid rgba(0, 221, 255, 0.4) !important;
  color: #00ddff !important;
  padding: 6px 14px !important;
  border-radius: 20px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  margin-right: 8px !important;
  flex-shrink: 0 !important;
}

/* Loading States */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 350px;
  font-size: 20px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1400px) {
  .app-container {
    padding: 20px;
  }

  .app-layout {
    gap: 30px;
  }

  .app-sidebar {
    width: 280px;
  }
}

@media (max-width: 1024px) {
  .app-layout {
    flex-direction: row; /* Keep horizontal layout for tablet */
  }

  .app-sidebar {
    width: 280px; /* Slightly smaller on tablet */
  }

  .header-search {
    min-width: 280px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
  }
}

/* AGGRESSIVE RESPONSIVE BREAKPOINT - FORCES SINGLE COLUMN ON ALL SCREENS UNDER 1400px */
@media (max-width: 1400px) {
  /* Force all grids to single column */
  .responsive-grid-2col,
  .responsive-grid-equal,
  .analytics-grid,
  .cards-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Force all flex rows to column */
  .responsive-flex-row,
  .responsive-actions,
  .page-actions {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  /* Make buttons full width */
  .responsive-actions .btn,
  .page-actions .btn {
    width: 100% !important;
    text-align: center;
  }

  /* Force table wrappers to scroll horizontally */
  .responsive-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .responsive-table-wrapper table {
    min-width: 600px !important;
    width: 100% !important;
  }

  /* Fix specific grid layouts */
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 2fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(380px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Fix horizontal filter/action bars */
  div[style*="display: flex"][style*="gap: 15px"],
  div[style*="display: flex"][style*="gap: 20px"] {
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* Keep small inline elements horizontal */
  div[style*="display: flex"][style*="align-items: center"][style*="gap"] {
    flex-direction: row !important;
  }

  /* Make search inputs full width */
  input[type="text"],
  input[type="search"],
  select {
    width: 100% !important;
    max-width: none !important;
  }

  /* Responsive search inputs in filter bars */
  input[style*="width: 250px"],
  input[style*="width: 280px"] {
    width: 100% !important;
    min-width: 200px;
  }

  /* Chart containers responsive */
  .chart-container {
    min-height: 250px !important;
    width: 100% !important;
    overflow-x: auto;
  }

  /* Fix stats cards spacing */
  .stat-card {
    margin-bottom: 15px;
  }

  /* Force responsive grid classes to work properly */
  .responsive-grid-equal > div,
  .responsive-grid-2col > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fix analytics table containers */
  .analytics-table {
    width: 100% !important;
    overflow-x: auto;
    margin-bottom: 20px;
  }

  /* Fix wallet page cards specifically */
  .responsive-grid-equal > div {
    min-width: 0;
    overflow-x: auto;
  }

  /* EXCEPTION: Keep calendar page layout intact */
  .calendar-page {
    display: grid !important;
    /* Calendar columns handled by dedicated calendar media queries */
  }

  .calendar-page .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }

  .calendar-main,
  .calendar-sidebar {
    min-width: 0 !important;
  }
}

/* AGGRESSIVE RESPONSIVE BREAKPOINT - FORCES SINGLE COLUMN ON ALL SCREENS UNDER 1200px */
@media (max-width: 1200px) {
  /* Force all grids to single column */
  .responsive-grid-2col,
  .responsive-grid-equal,
  .analytics-grid,
  .cards-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Force all flex rows to column */
  .responsive-flex-row,
  .responsive-actions,
  .page-actions {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  /* Make buttons full width */
  .responsive-actions .btn,
  .page-actions .btn {
    width: 100% !important;
    text-align: center;
  }

  /* Force table wrappers to scroll horizontally */
  .responsive-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .responsive-table-wrapper table {
    min-width: 600px !important;
    width: 100% !important;
  }

  /* Fix specific grid layouts */
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 2fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(380px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Fix horizontal filter/action bars */
  div[style*="display: flex"][style*="gap: 15px"],
  div[style*="display: flex"][style*="gap: 20px"] {
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* Keep small inline elements horizontal */
  div[style*="display: flex"][style*="align-items: center"][style*="gap"] {
    flex-direction: row !important;
  }

  /* Make search inputs full width */
  input[type="text"],
  input[type="search"],
  select {
    width: 100% !important;
    max-width: none !important;
  }

  /* Responsive search inputs in filter bars */
  input[style*="width: 250px"],
  input[style*="width: 280px"] {
    width: 100% !important;
    min-width: 200px;
  }

  /* Chart containers responsive */
  .chart-container {
    min-height: 250px !important;
    width: 100% !important;
    overflow-x: auto;
  }

  /* Fix stats cards spacing */
  .stat-card {
    margin-bottom: 15px;
  }

  /* Force responsive grid classes to work properly */
  .responsive-grid-equal > div,
  .responsive-grid-2col > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fix analytics table containers */
  .analytics-table {
    width: 100% !important;
    overflow-x: auto;
    margin-bottom: 20px;
  }

  /* Fix wallet page cards specifically */
  .responsive-grid-equal > div {
    min-width: 0;
    overflow-x: auto;
  }

  /* EXCEPTION: Keep calendar page layout intact - do NOT flatten */
  .calendar-page {
    display: grid !important;
    /* grid-template-columns handled by calendar-specific media queries */
  }

  /* Protect calendar internals from aggressive rules */
  .calendar-page .calendar-grid,
  .calendar-page .calendar-controls,
  .calendar-page .view-toggle,
  .calendar-page .nav-controls,
  .calendar-page .calendar-container {
    flex-direction: unset !important;
  }
}

/* Mobile-specific responsive design */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
    gap: 0;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-radius: 0;
    padding: 20px 0;
    z-index: 9999;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  }

  .app-sidebar.mobile-open {
    left: 0;
  }

  .mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .app-main {
    width: 100%;
    margin-left: 0;
  }

  /* Mobile hamburger menu */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .mobile-menu-toggle:hover {
    background: var(--accent-secondary);
    transform: scale(1.05);
  }

  .mobile-menu-toggle.active {
    background: var(--error);
  }

  /* Adjust header for mobile menu button */
  .app-header {
    padding-left: 80px; /* Make space for mobile menu button */
  }

  /* Sidebar adjustments for mobile */
  .app-sidebar .sidebar-user {
    padding: 20px 25px;
    margin-bottom: 20px;
  }

  .app-sidebar .user-avatar {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }

  .app-sidebar .user-info h3 {
    font-size: 16px;
  }

  .app-sidebar .nav-menu {
    padding: 0 20px;
  }

  .app-sidebar .nav-link {
    padding: 12px 16px;
    margin-bottom: 4px;
    font-size: 15px;
  }

  .app-sidebar .nav-icon {
    font-size: 18px;
    min-width: 24px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-sidebar .nav-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
  }

  .app-sidebar .nav-section-title {
    font-size: 12px;
    padding: 0 16px;
  }

  /* Hide desktop sidebar toggle on mobile */
  .app-sidebar .sidebar-toggle {
    display: none;
  }

  /* Mobile-specific page content adjustments */
  .page-content {
    padding: 15px 20px;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .page-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .page-header p {
    font-size: 14px;
  }

  /* Fix Dashboard 2-column grid layout for mobile */
  div[style*="grid-template-columns: 2fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Fix Wallet Page Recent Activity layout */
  div[style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Fix horizontal filter/action bars */
  div[style*="display: flex"][style*="gap: 15px"],
  div[style*="display: flex"][style*="gap: 20px"] {
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* Keep small inline elements horizontal */
  div[style*="display: flex"][style*="align-items: center"][style*="gap"] {
    flex-direction: row !important;
  }

  /* Make buttons full width on mobile */
  .btn {
    width: 100% !important;
    text-align: center;
  }

  /* Fix action bars with buttons */
  div[style*="display: flex"][style*="gap"] .btn {
    width: auto !important;
    min-width: 120px;
  }

  /* Analytics page fixes */
  .analytics-grid,
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 2fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  /* Chart containers responsive */
  .chart-container {
    min-height: 250px !important;
    width: 100% !important;
    overflow-x: auto;
  }

  /* Responsive form layouts */
  .form-row {
    flex-direction: column !important;
    gap: 15px !important;
  }

  .form-group {
    width: 100% !important;
  }

  /* Invoice, Cards, Projects page header fixes */
  .page-actions {
    flex-direction: column !important;
    gap: 15px !important;
    width: 100% !important;
  }

  /* Make search inputs full width */
  input[type="text"],
  input[type="search"],
  select {
    width: 100% !important;
    max-width: none !important;
  }

  /* Fix specific filter bars */
  div[style*="background: white"][style*="padding: 20px"] {
    padding: 15px !important;
  }

  /* Fix stats cards spacing */
  .stat-card {
    margin-bottom: 15px;
  }
  .responsive-grid-2col,
  .responsive-grid-equal {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .responsive-flex-row,
  .responsive-actions {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  .responsive-actions .btn {
    width: 100% !important;
  }

  /* Keep small inline flex items horizontal */
  .keep-horizontal {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }

  /* Responsive form inputs */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* Responsive search inputs in filter bars */
  input[style*="width: 250px"],
  input[style*="width: 280px"] {
    width: 100% !important;
    min-width: 200px;
  }

  /* Responsive label-input groups */
  .keep-horizontal label {
    white-space: nowrap;
    margin-right: 10px;
  }

  /* Responsive button groups */
  .responsive-flex-row .btn {
    flex: 1;
    min-width: 100px;
  }

  /* Fix chart containers on mobile */
  .chart-container,
  .analytics-table {
    min-height: auto !important;
    overflow-x: auto;
  }

  /* Fix stats cards spacing */
  .stat-card {
    margin-bottom: 15px;
  }

  /* Responsive projects grid */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(380px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Responsive cards grid */
  .cards-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Messages center mobile styles */
  .message-item {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 15px !important;
  }

  .message-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 5px !important;
  }

  .message-controls {
    width: 100% !important;
    justify-content: flex-end !important;
  }

  /* Force responsive grid classes to work properly */
  .responsive-grid-equal > div,
  .responsive-grid-2col > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fix analytics table containers */
  .analytics-table {
    width: 100% !important;
    overflow-x: auto;
    margin-bottom: 20px;
  }

  /* Responsive leads grid */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(350px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Fix wallet page cards specifically */
  .responsive-grid-equal > div {
    min-width: 0;
    overflow-x: auto;
  }

  /* TABLE WRAPPER FORCES HORIZONTAL SCROLL */
  .responsive-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .responsive-table-wrapper table {
    min-width: 600px !important;
    width: 100% !important;
  }

  /* USERS PAGE SPECIFIC FIXES */
  .users-page .responsive-actions {
    flex-direction: column !important;
    gap: 20px !important;
    padding: 15px !important;
  }

  .users-page .responsive-flex-row {
    flex-direction: column !important;
    gap: 15px !important;
  }

  .users-page .responsive-flex-row > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  .users-page input[type="text"],
  .users-page input[type="search"],
  .users-page select {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fix user modal form grids */
  .users-page .modal-content form {
    grid-template-columns: 1fr !important;
  }

  .users-page .modal-content div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Fix user info display in table */
  .users-page .user-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    align-items: flex-start !important;
  }

  .users-page .user-avatar {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }

  /* Fix action buttons in table */
  .users-page .action-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    align-items: center !important;
  }

  .users-page .action-buttons .btn-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 14px !important;
  }

  /* DASHBOARD PAGE SPECIFIC FIXES */
  .dashboard-page .responsive-grid-2col {
    flex-direction: column !important;
    gap: 20px !important;
  }

  .dashboard-page .responsive-grid-2col > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  .dashboard-page .table-container {
    width: 100% !important;
    overflow-x: auto !important;
  }

  .dashboard-page .table {
    min-width: 600px !important;
    width: 100% !important;
  }

  /* Fix dashboard modal forms */
  .dashboard-page .modal-content div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .dashboard-page .modal-content div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  .dashboard-page .modal-content div[style*="grid-template-columns: repeat(auto-fit, minmax(250px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Fix dashboard reports modal */
  .dashboard-page .modal-content div[style*="grid-template-columns: repeat(auto-fit, minmax(250px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Force all modal content to be responsive */
  .modal-content {
    max-width: 95vw !important;
    width: 95vw !important;
    max-height: 95vh !important;
    overflow-y: auto !important;
  }

  .modal-content form {
    grid-template-columns: 1fr !important;
  }

  .modal-content .form-row {
    grid-template-columns: 1fr !important;
  }

  .modal-content div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Force all tables to be responsive */
  .table-container {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .table {
    min-width: 600px !important;
    width: 100% !important;
  }

  /* Force all page content to fit viewport */
  .page-content {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* Force all containers to fit */
  .app-main {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Force all grids to single column aggressively */
  .responsive-grid-2col,
  .responsive-grid-equal,
  .analytics-grid,
  .cards-grid,
  div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Force all flex containers to column */
  .responsive-flex-row,
  .responsive-actions,
  .page-actions,
  div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  /* Force all buttons to full width */
  .btn {
    width: 100% !important;
    text-align: center !important;
    white-space: normal !important;
  }

  /* Force all inputs to full width */
  input, select, textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* GLOBAL OVERFLOW FIXES - PREVENT ANY CONTENT FROM GOING OFF-SCREEN */
* {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Width constraints only - overflow handled at end of file */
html, body {
  width: 100%;
  max-width: 100vw;
}

.app-container,
.app-layout,
.app-main {
  width: 100%;
  max-width: 100vw;
}

.page-content {
  width: 100%;
  max-width: 100vw;
  overflow-y: auto;
}

/* Force all images and media to fit */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Force all text to wrap */
* {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Allow scroll on containers that need it */
.scrollable, 
#turnQueuePanel,
#gameLog,
.spellbook-page,
.modal-body,
.notification-list,
textarea {
  overflow-y: auto;
}

/* EXCEPTION: Allow dropdowns and popovers to overflow without being clipped */
#task-assignee-dropdown,
[id*="dropdown"],
[id*="popover"],
[class*="dropdown"],
[class*="popover"],
[id*="assignee-dropdown"],
.dropdown-container,
.popover-container {
  overflow-x: visible;
  overflow-y: visible !important;
}

/* Specific container fixes for dropdown parents */
#task-assignee-container,
[id*="assignee-container"],
[class*="assignee-container"],
[id*="multi-select"],
[class*="multi-select"] {
  overflow: visible !important;
  position: relative;
  z-index: 100;
}

/* CRITICAL: Fix modal containers that clip dropdowns */
.task-modal-content,
.modal-content,
#task-modal,
.task-modal,
.modal-overlay {
  overflow-x: visible !important;
}

/* Ensure task modal specifically allows dropdown overflow */
#task-modal .task-modal-content,
#task-modal .modal-content {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: auto !important;
}

/* SUPER SPECIFIC: Override any modal-content overflow rules for task modals */
.modal-content:has(#task-assignee-container),
.modal-content:has(#task-assignee-dropdown),
div[style*="z-index: 1000"] .modal-content {
  overflow-x: visible !important;
  overflow-y: auto !important;
}

/* Force assignee dropdown elements to be visible regardless of parent */
#task-assignee-dropdown,
#task-assignee-container {
  position: absolute !important;
  z-index: 10000 !important;
  overflow: visible !important;
}

/* Allow vertical scrolling where needed */
.page-content,
.modal-content,
.table-container,
.responsive-table-wrapper {
  overflow-y: auto !important;
  overflow-x: auto !important;
}

/* Invoice Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideUp 0.3s ease-out;
}

/* ⭐ CRITICAL: Ensure task modal content is properly centered */
#task-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 10000 !important;
  background: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(5px) !important;
  /* Only apply flex when modal is visible */
  display: none !important;
}

/* When modal is displayed (has style="display: flex") */
#task-modal[style*="display: flex"] {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

#task-modal .modal-content,
#task-modal .task-modal-content {
  margin: auto !important;
  width: 90% !important;
  max-width: 600px !important;
  max-height: 90vh !important;
}

.modal-content.large {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.modal-body {
  padding: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* Line Items Section */
.line-items-section {
  margin: 24px 0;
  padding: 20px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.line-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.line-items-header h4 {
  margin: 0;
  color: #374151;
  font-size: 16px;
}

.line-item {
  display: grid;
  grid-template-columns: 2fr 80px 120px 120px 40px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.line-item input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.line-item input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.line-item .item-amount {
  background: #f3f4f6;
  color: #6b7280;
}

.btn-remove-item {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.btn-remove-item:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.btn-add-item {
  background: #10b981;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-add-item:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* Invoice Totals */
.invoice-totals {
  margin-top: 20px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.total-row:last-child {
  border-bottom: 2px solid #374151;
  font-weight: 600;
  font-size: 16px;
  margin-top: 8px;
  padding-top: 12px;
}

.total-row:last-child .total-amount {
  color: #059669;
}

/* Form Sections */
.form-section {
  margin-bottom: 32px;
  padding: 24px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.form-section h4 {
  margin: 0 0 20px 0;
  color: #1f2937;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkbox-item:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #667eea;
}

.checkbox-item span {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.btn-secondary {
  background: #6b7280;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #4b5563;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Hide mobile menu toggle on desktop */
.mobile-menu-toggle {
  display: none;
}

/* Responsive utility classes */
.responsive-grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

.responsive-grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.responsive-flex-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.responsive-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .page-content {
    padding: 20px 15px;
  }

  .app-header {
    flex-direction: column;
    gap: 20px;
    padding: 20px 25px 20px 80px; /* Account for mobile menu button */
  }

  .header-search {
    width: 100%;
    min-width: auto;
  }

  .page-header h1 {
    font-size: 32px;
  }

  .stat-value {
    font-size: 36px;
  }

  /* Invoice Modal Mobile Styles */
  .modal-content {
    width: 95%;
    max-width: 95vw;
    max-height: 95vh;
    margin: 10px;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-header h3 {
    font-size: 16px;
  }

  .modal-body {
    padding: 20px 16px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .line-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px 12px;
  }

  .line-item input {
    padding: 10px 12px;
  }

  .btn-remove-item {
    width: 100%;
    justify-self: stretch;
    height: 40px;
    margin-top: 8px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-actions button {
    width: 100%;
    padding: 14px 20px;
  }

  /* Schedule Report Modal Mobile */
  .form-section {
    padding: 16px;
    margin-bottom: 20px;
  }

  .form-section h4 {
    font-size: 14px;
    margin-bottom: 16px;
  }

  .checkbox-group {
    gap: 8px;
  }

  .checkbox-item {
    padding: 10px 12px;
  }

  .checkbox-item span {
    font-size: 13px;
  }

  /* EXCEPTION: Calendar mobile layout - single column grid, preserve internal grid/flex */
  .calendar-page {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    position: relative !important;
    min-height: calc(100vh - 30px) !important;
  }

  .calendar-main,
  .calendar-sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }

  .calendar-page .calendar-main {
    grid-column: 1 !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-page .calendar-sidebar {
    grid-column: 1 !important;
    width: 100% !important;
  }

  /* Ensure calendar grid keeps its 7-column layout */
  .calendar-page .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }

  /* Ensure calendar controls stay in flex row */
  .calendar-page .calendar-controls {
    display: flex !important;
  }

  .calendar-page .view-toggle {
    display: flex !important;
  }

  .calendar-page .nav-controls {
    display: flex !important;
  }
}

/* Theme Selector Styles */
.theme-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.theme-option:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.theme-option.active {
  border-color: #667eea;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.theme-preview {
  width: 60px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  position: relative;
}

.theme-preview.light {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.theme-preview.dark {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.theme-preview.auto {
  background: linear-gradient(135deg, #ffffff 0%, #0f172a 100%);
}

.theme-preview .preview-header {
  height: 12px;
  background: rgba(102, 126, 234, 0.8);
  margin-bottom: 4px;
}

.theme-preview .preview-content {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.theme-preview.light .preview-content {
  background: #ffffff;
}

.theme-preview.dark .preview-content {
  background: #1e293b;
}

.theme-preview.auto .preview-content {
  background: linear-gradient(90deg, #ffffff 50%, #1e293b 50%);
}

.theme-preview .preview-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(102, 126, 234, 0.3);
}

.theme-preview .preview-bar:first-child {
  width: 80%;
  background: rgba(102, 126, 234, 0.6);
}

.theme-preview .preview-bar:last-child {
  width: 60%;
}

.theme-option span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}

/* Dark Theme Updates for Main Components */
.theme-dark .app-header {
  background: transparent;
  color: var(--text-primary);
}
.theme-dark .app-sidebar,
.theme-dark .page-content {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.theme-dark .modal-content {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.theme-dark .form-group input,
.theme-dark .form-group select,
.theme-dark .form-group textarea {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.theme-dark .theme-option {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.theme-dark .theme-option.active {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

/* Compact Mode Styles */
.compact-mode .page-content {
  padding: 25px 30px;
}

.compact-mode .page-header {
  margin-bottom: 25px;
}

.compact-mode .page-header h1 {
  font-size: 32px;
  margin-bottom: 8px;
}

.compact-mode .page-header p {
  font-size: 16px;
}

.compact-mode .stats-grid {
  gap: 20px;
  margin-bottom: 30px;
}

.compact-mode .stat-card {
  padding: 20px 25px;
}

.compact-mode .stat-value {
  font-size: 32px;
}

.compact-mode .stat-label {
  font-size: 13px;
}

.compact-mode .app-header {
  padding: 18px 30px;
  margin-bottom: 25px;
}

.compact-mode .app-sidebar {
  padding: 25px 0;
}

.compact-mode .sidebar-user {
  padding: 0 25px 20px;
  margin-bottom: 20px;
}

.compact-mode .nav-link {
  padding: 12px 18px;
  font-size: 15px;
}

.compact-mode .user-avatar {
  width: 50px;
  height: 50px;
}

.compact-mode .logo-text {
  font-size: 28px;
}

.compact-mode .logo-icon {
  width: 44px;
  height: 44px;
  font-size: 20px;
}

/* Collapsible Sidebar Styles */
.app-sidebar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.app-sidebar.collapsed {
  width: 80px;
  min-width: 80px;
}

.app-sidebar.collapsed .sidebar-user {
  padding: 15px 5px;
  flex-direction: column;
  text-align: center;
  gap: 4px;
  justify-content: center;
  align-items: center;
  position: relative;
}

.app-sidebar.collapsed {
  width: 80px;
  min-width: 80px;
}

.app-sidebar.collapsed .nav-section-title,
.app-sidebar.collapsed .nav-link span {
  opacity: 0;
  visibility: hidden;
}

/* Remove margins and padding from nav-section and nav-section-title in collapsed sidebar */
.app-sidebar.collapsed .nav-section {
  margin: 0;
}

.app-sidebar.collapsed .nav-section-title {
  margin-bottom: 0;
  padding: 0;
}

/* Ensure icons are always visible in collapsed state */
.app-sidebar.collapsed .nav-link .nav-icon {
  opacity: 1;
  visibility: visible;
  /* Optional: keep a bit of horizontal space consistent */
  margin-right: 0;
}

/* Hide the text label when collapsed */
.app-sidebar.collapsed .nav-link span:not(.nav-icon),
.app-sidebar.collapsed .nav-link .label {
  /* Assuming the text label is within a span; adjust selector as needed */
  display: none;
  visibility: hidden;
  opacity: 0;
}

/* Hide direct text content in nav-links when collapsed */
.app-sidebar.collapsed .nav-link .nav-icon {
  text-indent: 0;
  position: relative;
  z-index: 1;
}

.app-sidebar.collapsed .nav-link .nav-icon {
  /* Ensure icon remains visible and aligned */
  display: inline-flex;
  align-items: first baseline;
  font-size: 20px;
}

.app-sidebar.collapsed .nav-link {
  padding: 10px 3px;
  flex-direction: row;
  text-align: left;
  gap: 0;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  font-size: 0;
}

.app-main.sidebar-collapsed {
  margin-left: 0;
}

/* Ensure settings content adjusts properly when sidebar is collapsed */
.app-main.sidebar-collapsed .settings-content,
.app-main.sidebar-collapsed .settings-nav,
.app-main.sidebar-collapsed .settings-actions {
  width: 100%;
  max-width: 100%;
}

/* Sidebar Hover Expansion - DISABLED: User prefers click-only toggle */
/* 
.app-sidebar.collapsed:hover {
  width: 300px;
  min-width: 300px;
}

.app-sidebar.collapsed:hover .sidebar-user {
  padding: 0 35px 30px;
  flex-direction: row;
  text-align: left;
  gap: 18px;
  justify-content: flex-start;
  align-items: center;
}

.app-sidebar.collapsed:hover .user-info {
  display: block;
}

.app-sidebar.collapsed:hover .nav-section-title,
.app-sidebar.collapsed:hover .nav-link span {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease 0.1s, visibility 0.2s ease 0.1s;
  margin-left: 8px;
}

.app-sidebar.collapsed:hover .nav-link {
  text-indent: 0;
  font-size: 14px;
}

.app-sidebar.collapsed:hover .nav-link .nav-icon {
  margin-right: 8px;
}

.app-sidebar.collapsed:hover .nav-link {
  justify-content: flex-start;
  padding: 16px 18px;
}

.app-sidebar.collapsed:hover .nav-badge {
  display: block;
}
*/

/* Session Management Styles */
.session-info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}

.session-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.session-info-row:last-child {
  border-bottom: none;
}

.session-info-row span:first-child {
  color: var(--text-secondary);
  font-weight: 500;
}

.session-info-row span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

.session-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
}

.session-status.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.session-status.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.session-status.expired {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.session-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.session-actions .btn {
  flex: 1;
  min-width: 140px;
}

/* Session Warning Modal Styles */
.modal-overlay.session-warning {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.session-warning-content {
  max-width: 500px;
  text-align: center;
}

.session-warning-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.session-warning-body {
  padding: 32px 24px;
}

.session-warning-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.session-warning-body h4 {
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-weight: 700;
}

.session-warning-body p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.session-activity-info {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.session-activity-info small {
  color: var(--text-muted);
  display: block;
  margin: 4px 0;
}

#sessionCountdown {
  font-weight: 800;
  font-size: 28px;
  color: var(--warning);
  display: inline-block;
  margin: 0 8px;
  font-family: "Courier New", monospace;
}

/* Mobile Session Management */
@media (max-width: 768px) {
  .session-actions {
    flex-direction: column;
  }

  .session-actions .btn {
    width: 100%;
    margin-bottom: 8px;
  }

  .session-info-card {
    padding: 16px;
  }

  .session-warning-body {
    padding: 24px 16px;
  }

  .session-warning-icon {
    font-size: 48px;
  }

  .session-warning-body h4 {
    font-size: 20px;
  }

  #sessionCountdown {
    font-size: 24px;
  }
}

/* Email Settings Styles */
.email-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
  width: 100%;
  max-width: 100%;
}

.email-preferences-section,
.email-delivery-section,
.email-signature-section,
.email-templates-section,
.email-stats-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  max-width: 100%;
  overflow: hidden;
}

.email-preferences-section h4,
.email-delivery-section h4,
.email-signature-section h4,
.email-templates-section h4,
.email-stats-section h4 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.quiet-hours-config {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* Email Templates */
.template-list {
  margin-bottom: 16px;
}

.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.template-item:last-child {
  border-bottom: none;
}

.template-info strong {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;
}

.template-info p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* Email Statistics */
.email-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* Email History */
.email-history {
  margin-top: 20px;
}

.email-history h5 {
  margin: 0 0 12px 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.email-history-list {
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin-bottom: 8px;
}

.history-icon {
  font-size: 18px;
  margin-right: 12px;
}

.history-details {
  flex: 1;
  min-width: 0;
}

.history-subject {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  color: var(--text-secondary);
  font-size: 12px;
}

.history-status {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.history-status.success {
  background: #dcfce7;
  color: #166534;
}

.history-status.error {
  background: #fee2e2;
  color: #dc2626;
}

/* Email Actions */
.email-actions {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Modal Styles for Email Templates */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.close-modal:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.template-variables {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.template-variables h4 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.template-variables p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  justify-content: flex-end;
}

/* Notification Settings Styles */
.notification-groups {
  display: grid;
  gap: 24px;
}

.notification-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
}

.notification-group h4 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.dnd-hours-config {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.range-value {
  margin-left: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Messages Center Styles */
.message-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 16px;
  border-radius: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.message-item:hover {
  background: rgba(59, 130, 246, 0.05);
  transform: translateX(2px);
}

.message-item.unread {
  background: rgba(59, 130, 246, 0.08);
  border-left-color: #3b82f6;
  font-weight: 500;
}

.message-item.important {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.message-sender {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.message-time {
  font-size: 12px;
  color: var(--text-muted);
}

.message-subject {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 4px;
}

.message-preview {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-controls {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-item:hover .message-controls {
  opacity: 1;
}

.btn-icon {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Notification Center Styles */
.notification-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 18px;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
  background: rgba(247, 250, 252, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.notification-bell:hover {
  background: var(--bg-secondary);
  transform: scale(1.1);
}

.notification-bell.active {
  background: var(--primary-color);
  color: white;
}

.notification-bell.has-notifications {
  animation: bellShake 0.5s ease-in-out;
}

.notification-bell.new-notification {
  animation: bellPulse 2s ease-in-out infinite;
}

@keyframes bellShake {
  0%,
  50%,
  100% {
    transform: rotate(0deg);
  }
  10%,
  30% {
    transform: rotate(-10deg);
  }
  20%,
  40% {
    transform: rotate(10deg);
  }
}

@keyframes bellPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--error);
  color: white;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
  animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
  0% {
    transform: scale(0);
  }
  80% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.notification-center {
  position: absolute;
  top: 70px;
  right: 20px;
  width: 400px;
  max-height: 600px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-center-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.notification-center-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.notification-center-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-center-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.notification-filters {
  display: flex;
  gap: 4px;
}

.filter-btn {
  background: none;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary-color);
  color: white;
}

.notification-center-body {
  max-height: 400px;
  overflow-y: auto;
}

.notification-list {
  padding: 8px 0;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.notification-item:hover {
  background: var(--bg-secondary);
}

.notification-item.unread {
  background: rgba(59, 130, 246, 0.05);
  border-left-color: var(--primary-color);
}

.notification-item.unread .notification-title {
  font-weight: 600;
}

.notification-icon {
  font-size: 20px;
  margin-right: 12px;
  margin-top: 2px;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.notification-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.notification-time {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.notification-message {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.notification-actions {
  margin-top: 8px;
}

.notification-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 8px;
}

.notification-center-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.no-notifications {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.no-notifications-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-notifications p {
  margin: 0 0 16px 0;
  font-size: 16px;
}

/* ── Notification Center design polish ─────────────────────────────── */
.notification-item {
  border-bottom: 1px solid var(--border-light);
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-item.unread {
  background: rgba(255, 153, 68, 0.09); /* fallback for older webviews */
  background: color-mix(in srgb, var(--accent-primary) 9%, transparent);
  border-left: 3px solid var(--accent-primary);
}
.theme-dark .notification-item.unread,
.dark-mode .notification-item.unread,
[data-theme="dark"] .notification-item.unread {
  background: rgba(255, 170, 68, 0.16); /* fallback for older webviews */
  background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
}
.notification-item.unread .notification-title {
  font-weight: 700;
}
.notification-item.unread .notification-time::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  vertical-align: middle;
}
.notification-center-footer .btn {
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
}
.notification-center-footer .btn:hover {
  transform: translateY(-1px);
}

/* ── Dark-mode belt-and-suspenders (all three theme states) ────────── */
.theme-dark .notification-center,
.dark-mode .notification-center,
[data-theme="dark"] .notification-center {
  background: var(--bg-secondary, #3a2f2a);
  border-color: var(--border-color, #5a4f4a);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
.theme-dark .notification-center-header,
.theme-dark .notification-center-footer,
.dark-mode .notification-center-header,
.dark-mode .notification-center-footer,
[data-theme="dark"] .notification-center-header,
[data-theme="dark"] .notification-center-footer {
  background: var(--bg-primary, #2a1f1a);
  border-color: var(--border-color, #5a4f4a);
}
.theme-dark .notification-center-title h3,
.dark-mode .notification-center-title h3,
[data-theme="dark"] .notification-center-title h3,
.theme-dark .notification-title,
.dark-mode .notification-title,
[data-theme="dark"] .notification-title {
  color: var(--text-primary, #f5e6d3);
}
.theme-dark .notification-message,
.dark-mode .notification-message,
[data-theme="dark"] .notification-message,
.theme-dark .notification-time,
.dark-mode .notification-time,
[data-theme="dark"] .notification-time {
  color: var(--text-secondary, #e8d4b8);
}
.theme-dark .notification-item:hover,
.dark-mode .notification-item:hover,
[data-theme="dark"] .notification-item:hover {
  background: var(--bg-tertiary, #4a3f3a);
}
.theme-dark .notification-item.unread,
.dark-mode .notification-item.unread,
[data-theme="dark"] .notification-item.unread {
  background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
}
.theme-dark .notification-center-footer .btn,
.dark-mode .notification-center-footer .btn,
[data-theme="dark"] .notification-center-footer .btn {
  color: var(--text-primary, #f5e6d3);
  border-color: var(--border-color, #5a4f4a);
}
.theme-dark .notification-center-footer .btn:hover,
.dark-mode .notification-center-footer .btn:hover,
[data-theme="dark"] .notification-center-footer .btn:hover {
  background: var(--bg-tertiary, #4a3f3a);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .notification-center {
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 70vh;
  }

  .app-header {
    padding: 8px 16px;
  }

  .header-search {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  .header-actions .btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .app-sidebar {
    width: 100%;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .page-content {
    padding: 16px;
  }

  .email-settings-grid {
    grid-template-columns: 1fr;
  }

  .email-stats-grid {
    grid-template-columns: 1fr;
  }

  .email-actions {
    flex-direction: column;
  }

  .email-actions .btn {
    width: 100%;
  }

  .form-row {
    flex-direction: column;
  }

  .modal-content {
    width: 95%;
    margin: 10px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .template-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .edit-template-btn {
    align-self: flex-end;
  }

  .settings-nav {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
  }

  .settings-tab {
    flex-shrink: 0;
    font-size: 14px;
    padding: 8px 16px;
  }

  .notification-groups {
    grid-template-columns: 1fr;
  }

  .notification-item {
    padding: 8px 16px;
  }

  .notification-controls {
    flex-direction: row;
    gap: 8px;
    margin-left: 8px;
    margin-top: 0;
  }

  /* Users Page Mobile Styles */
  .users-page .responsive-flex-row {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
  }

  .users-page .responsive-flex-row .search-input {
    width: 100% !important;
    max-width: none !important;
  }

  .users-page .responsive-actions {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
  }

  .users-page .responsive-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .users-page .responsive-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .users-page .responsive-table-wrapper table {
    min-width: 600px !important;
    width: 100% !important;
  }

  .users-page .responsive-grid-equal {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    width: 100% !important;
  }

  .users-page .stat-card {
    width: 100% !important;
    max-width: none !important;
    margin-bottom: 15px !important;
  }

  .users-page .page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px !important;
  }

  .users-page .page-header h1 {
    font-size: 24px !important;
    margin-bottom: 0 !important;
  }

  .users-page .filters-section {
    width: 100% !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .users-page .filters-section .filter-group {
    width: 100% !important;
  }

  .users-page .filters-section .filter-group select,
  .users-page .filters-section .filter-group input {
    width: 100% !important;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .app-header {
    padding: 8px 12px;
  }

  .logo-text {
    font-size: 18px;
  }

  .logo-subtitle {
    font-size: 11px;
  }

  .header-actions .btn {
    font-size: 11px;
    padding: 4px 8px;
  }

  .notification-icon {
    font-size: 18px;
    width: 36px;
    height: 36px;
  }

  .notification-center {
    right: 5px;
    left: 5px;
    top: 60px;
  }

  .page-content {
    padding: 12px;
  }

  .modal-content {
    width: 98%;
    margin: 5px;
  }

  /* Users Page Small Mobile Styles */
  .users-page .page-header h1 {
    font-size: 20px !important;
  }

  .users-page .stat-card .stat-value {
    font-size: 24px !important;
  }

  .users-page .stat-card .stat-label {
    font-size: 12px !important;
  }

  .users-page .responsive-table-wrapper table {
    font-size: 12px !important;
  }

  .users-page .responsive-table-wrapper th,
  .users-page .responsive-table-wrapper td {
    padding: 8px 6px !important;
  }

  .users-page .user-info .user-name {
    font-size: 14px !important;
  }

  .users-page .user-meta {
    font-size: 11px !important;
  }
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: fixed; /* keep it anchored to the viewport */
  top: 16px;
  right: 16px; /* or use left: 16px; if you want top-left */
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.25s ease;
  z-index: 1000;
}

.sidebar-toggle:hover {
  background: var(--accent-secondary);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.app-sidebar.collapsed .sidebar-toggle {
  position: fixed;
  left: 27px;
  top: 16px;
  width: 24px;
  height: 24px;
  right: auto;
  z-index: 1000;
  background: var(--accent-primary);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.25s ease;
}

.app-sidebar.collapsed .sidebar-toggle:hover {
  background: var(--accent-secondary);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

@media (max-width: 480px) {
  .app-container {
    padding: 15px;
  }

  .login-card {
    padding: 40px 30px;
    margin: 15px;
  }

  .app-header,
  .app-sidebar,
  .page-content {
    border-radius: 20px;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content {
  background: white;
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 30px 30px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

.modal-body {
  padding: 30px;
}

.modal-footer {
  padding: 20px 30px 30px;
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  background: rgba(247, 250, 252, 0.5);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.invoice-item {
  padding: 15px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  margin-bottom: 15px;
  background: rgba(247, 250, 252, 0.3);
}

.invoice-item:hover {
  background: rgba(247, 250, 252, 0.6);
}

/* Button Styles */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--accent-primary) 0%,
    var(--accent-secondary) 100%
  );
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Analytics Page Styles */
.chart-container {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 35px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.chart-container:hover {
  box-shadow: var(--shadow-medium);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chart-header h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.5px;
}

.chart-controls {
  display: flex;
  gap: 10px;
}

.chart-toggle {
  padding: 12px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.chart-toggle:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.chart-toggle.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.chart-content {
  min-height: 300px;
}

.chart-legend {
  padding: 20px 0;
}

.analytics-table {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 35px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.analytics-table:hover {
  box-shadow: var(--shadow-medium);
}

.analytics-table h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 25px;
  letter-spacing: -0.5px;
}

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 16px 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

/* Dark mode override for table headers */
.theme-dark .table th,
.dark-mode .table th {
  color: var(--text-primary) !important;
  border-bottom-color: var(--border-color) !important;
}

.table td {
  padding: 20px 12px;
  font-size: 15px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  font-weight: 600;
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background: rgba(102, 126, 234, 0.03);
  transform: scale(1.01);
}

.insights-section {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 35px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  margin-bottom: 40px;
  transition: all 0.3s ease;
}

.insights-section:hover {
  box-shadow: var(--shadow-medium);
}

.insights-section h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 25px;
  letter-spacing: -0.5px;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 25px;
  border-radius: 18px;
  border-left: 5px solid;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.5);
}

.insight-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.insight-card.positive {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.08) 0%,
    rgba(16, 185, 129, 0.03) 100%
  );
  border-left-color: var(--success);
}

.insight-card.warning {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.08) 0%,
    rgba(245, 158, 11, 0.03) 100%
  );
  border-left-color: var(--warning);
}

.insight-card.info {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.08) 0%,
    rgba(102, 126, 234, 0.03) 100%
  );
  border-left-color: var(--accent-primary);
}

.insight-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.insight-content h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.insight-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 600;
}

.reports-section {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 35px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.reports-section:hover {
  box-shadow: var(--shadow-medium);
}

.reports-section h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 25px;
  letter-spacing: -0.5px;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(102, 126, 234, 0.15);
  color: var(--accent-primary);
  border-radius: 8px;
  letter-spacing: 0.8px;
}

.status-badge {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

.status-badge.ready {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.status-badge.processing {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.btn-sm {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 10px;
  font-weight: 700;
}

/* Stat card additional color variants for Analytics */
.stat-card.blue {
  --card-bg: #3b82f6;
  --card-bg-end: #1d4ed8;
}

.stat-card.purple {
  --card-bg: #8b5cf6;
  --card-bg-end: #7c3aed;
}

/* Settings Page Styles */
.settings-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 15px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
}

.settings-tab {
  padding: 14px 24px;
  border: none;
  background: transparent;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  min-width: fit-content;
}

.settings-tab:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.settings-tab.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  transform: translateY(-2px);
}

.settings-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  max-width: 100%;
  width: 100%;
  padding: 25px;
}

.settings-content:hover {
  box-shadow: var(--shadow-medium);
}

.settings-panel {
  display: none;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.settings-panel.active {
  display: block;
}

.settings-section {
  padding: 0;
  max-width: 100%;
}

.settings-section h3 {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.8px;
}

.settings-section > p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 35px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
  max-width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 16px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  background: rgba(247, 250, 252, 0.8);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
}

/* Profile Avatar Section */
.profile-avatar-section {
  display: flex;
  justify-content: center;
  margin: 30px 0 40px;
}

.avatar-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.user-avatar.large {
  width: 80px;
  height: 80px;
  font-size: 28px;
  border-radius: 20px;
}

.avatar-upload-btn {
  padding: 12px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(247, 250, 252, 0.8);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.avatar-upload-btn:hover {
  background: white;
  color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Logo Upload Styles */
.profile-logo-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.profile-logo-section h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: center;
}

.logo-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.company-logo {
  width: 100px;
  height: 100px;
  background-color: var(--accent-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(26, 26, 26, 0.2);
  transition: all 0.3s ease;
}

.company-logo.has-image {
  background-color: transparent;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.logo-placeholder {
  font-size: 32px;
}

.logo-upload-btn {
  padding: 12px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(247, 250, 252, 0.8);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.logo-upload-btn:hover {
  background: white;
  color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Notification Groups */
.notification-groups {
  display: flex;
  flex-direction: column;
  gap: 35px;
}

.notification-group h4,
.security-group h4,
.appearance-group h4,
.advanced-group h4 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -0.4px;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(247, 250, 252, 0.5);
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.toggle-item:hover {
  background: rgba(247, 250, 252, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.toggle-item label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.setting-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 600;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 55px;
  height: 30px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 30px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
  background: linear-gradient(
    135deg,
    var(--accent-primary) 0%,
    var(--accent-secondary) 100%
  );
}

input:checked + .slider:before {
  transform: translateX(25px);
}

/* Theme Selector */
.theme-selector {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 100px;
}

.theme-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.theme-option.active {
  border-color: var(--accent-primary);
  background: rgba(102, 126, 234, 0.05);
}

.theme-preview {
  width: 50px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-preview.light {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.theme-preview.dark {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.theme-preview.auto {
  background: linear-gradient(135deg, #ffffff 0%, #1f2937 100%);
}

.theme-option span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Security Groups */
.security-groups {
  display: flex;
  flex-direction: column;
  gap: 35px;
}

.security-actions,
.export-options,
.backup-options,
.danger-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Advanced Groups */
.advanced-groups {
  display: flex;
  flex-direction: column;
  gap: 35px;
}

.advanced-group {
  padding: 25px;
  background: rgba(247, 250, 252, 0.5);
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.advanced-group.danger {
  background: rgba(239, 68, 68, 0.03);
  border-color: rgba(239, 68, 68, 0.1);
}

/* Settings Actions */
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 15px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--glass-border);
  width: 100%;
  max-width: 100%;
  margin-top: 20px;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100% !important;
    max-height: 200px;
    overflow-y: auto;
  }

  .app-main {
    margin-left: 0 !important;
    width: 100%;
  }

  .sidebar-toggle {
    display: none;
  }
}

/* Analytics Mobile Improvements */
@media (max-width: 768px) {
  /* FORCE single column layout for all responsive grids */
  .responsive-grid-2col {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
  }

  .responsive-grid-equal {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    width: 100% !important;
  }

  /* Container fixes */
  .chart-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .analytics-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 20px !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
  }

  /* Fix donut chart specifically */
  .donut-chart {
    width: 150px !important;
    height: 150px !important;
    margin: 15px auto !important;
    max-width: 90% !important;
  }

  .donut-chart svg {
    width: 150px !important;
    height: 150px !important;
    max-width: 100% !important;
  }

  .chart-content {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
  }

  .chart-legend {
    font-size: 11px !important;
    padding: 0 10px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .chart-legend > div {
    padding: 3px 0 !important;
    font-size: 11px !important;
  }

  /* Payment methods specific fixes */
  .analytics-table div[style*="padding"] {
    padding: 12px 8px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .analytics-table h3 {
    font-size: 16px !important;
    margin-bottom: 10px !important;
    padding: 0 8px !important;
  }

  /* Table fixes */
  .analytics-table table {
    width: 100% !important;
    font-size: 13px !important;
    min-width: 300px !important;
  }

  .analytics-table th,
  .analytics-table td {
    padding: 6px 8px !important;
    white-space: nowrap !important;
    font-size: 12px !important;
  }

  /* Action buttons */
  .responsive-actions {
    flex-direction: column !important;
    gap: 15px !important;
    align-items: stretch !important;
  }

  .responsive-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .responsive-flex-row {
    flex-direction: row !important;
    gap: 10px !important;
    align-items: center !important;
  }

  .responsive-flex-row.keep-horizontal {
    flex-direction: row !important;
  }
}

/* Large Screen Optimizations */
@media (min-width: 1440px) {
  .modal-content {
    max-width: 1000px;
  }

  .modal-content.large {
    max-width: 1400px;
  }

  .app-sidebar {
    width: 280px;
  }
}

/* Offline Status Indicator */
.offline-status {
  display: none;
  align-items: center;
  gap: 8px;
  background: #fef3c7;
  color: #92400e;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #fcd34d;
  transition: all 0.3s ease;
}

.offline-status .status-icon {
  font-size: 14px;
}

.offline-status .status-text {
  font-weight: 600;
}

.offline-status .btn-reconnect {
  background: #92400e;
  color: #fef3c7;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.offline-status .btn-reconnect:hover {
  background: #78350f;
  transform: scale(1.1);
}

.offline-status .btn-reconnect:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Dark theme support for offline status */
.theme-dark .offline-status {
  background: #451a03;
  color: #fbbf24;
  border-color: #92400e;
}

.theme-dark .offline-status .btn-reconnect {
  background: #fbbf24;
  color: #451a03;
}

.theme-dark .offline-status .btn-reconnect:hover {
  background: #f59e0b;
}

/* Sync Status Styles */
.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-status .btn-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.sync-status .btn-sync:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sync-status .btn-sync:disabled {
  background: #6b7280;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 4px rgba(107, 114, 128, 0.2);
}

.sync-status .sync-icon {
  font-size: 12px;
}

.sync-status .sync-text {
  font-size: 11px;
  font-weight: 600;
}

/* Dark theme sync button */
.theme-dark .sync-status .btn-sync {
  background: linear-gradient(135deg, #059669, #047857);
}

.theme-dark .sync-status .btn-sync:hover {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* Spin animation for reconnect button and sync icon */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Modal System - Full Screen */
.modal-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  box-shadow: none;
  z-index: 9999;
}

.modal-fullscreen .modal-header {
  padding: 24px 32px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.modal-fullscreen .modal-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  background: var(--bg-primary);
}

.modal-fullscreen .modal-footer {
  padding: 24px 32px;
  border-top: 2px solid var(--border-color);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

/* Prevent sidebar access when modal is open */
body.modal-open .app-sidebar {
  pointer-events: none;
  opacity: 0.3;
}

body.modal-open .mobile-menu-toggle {
  pointer-events: none;
  opacity: 0.3;
}

/* User Form Specific Styles */
.user-form {
  max-width: 1000px;
  margin: 0 auto;
}

.user-form .form-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.user-form .form-section h4 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-form .form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.user-form .form-group {
  flex: 1;
}

.user-form .form-group.full-width {
  flex: 100%;
}

.user-form .form-control {
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.user-form .form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Role Permissions Display */
.role-permissions {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.permissions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.permission-badge {
  background: var(--accent-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

/* User Preview */
.user-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  border: 2px dashed var(--border-color);
}

.preview-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.preview-details {
  flex: 1;
}

.preview-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.preview-email {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.preview-role {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* User Table Enhancements */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
}

.user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.user-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Status Badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-badge.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

/* Badge Colors for Roles */
.badge.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.badge.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge.badge-info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.badge.badge-primary {
  background: rgba(102, 126, 234, 0.1);
  color: var(--accent-primary);
}

.badge.badge-secondary {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
}

/* Checkbox Styling for Forms */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-primary);
  padding: 8px 0;
  transition: all 0.2s ease;
}

.checkbox-label:hover {
  color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Modal Close Button Styling */
.modal-close {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #ef4444 !important;
  border: none !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  font-size: 20px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2) !important;
}

/* Form Section Icons */
.form-section h4 i {
  margin-right: 8px;
  font-style: normal;
}

/* Textarea Styling in Forms */
.user-form textarea.form-control {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* Select Styling */
.user-form select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 fill=%27none%27 viewBox=%270 0 20 20%27%3e%3cpath stroke=%27%236b7280%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%271.5%27 d=%27m6 8 4 4 4-4%27/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
  appearance: none;
}

/* Responsive Modal Adjustments */
@media (max-width: 768px) {
  .modal-fullscreen .modal-header {
    padding: 16px 20px;
  }
  
  .modal-fullscreen .modal-body {
    padding: 20px;
  }
  
  .modal-fullscreen .modal-footer {
    padding: 16px 20px;
  }
  
  .user-form .form-row {
    flex-direction: column;
  }
  
  .user-form .form-section {
    padding: 16px;
  }
}

/* Loading States for Buttons */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* User Avatar */
.user-avatar {
  width: 60px;
  height: 60px;
  background-color: linear-gradient(135deg, var(--text-primary) 0%, #374151 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(26, 26, 26, 0.2);
}

/* Collapsed Sidebar User Avatar */
.app-sidebar.collapsed .user-avatar {
  width: 35px;
  height: 35px;
  background-color: linear-gradient(135deg, var(--text-primary) 0%, #374151 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(26, 26, 26, 0.15);
}

/* Expanded Sidebar User Avatar */
.app-sidebar:not(.collapsed) .user-avatar {
  width: 75px;
  height: 75px;
  border-radius: 50% !important;
  font-size: 28px;
}

/* ==================== GLOBAL VERTICAL SCREEN RESPONSIVE IMPROVEMENTS ==================== */

/* Vertical orientation adjustments for better mobile experience */
@media (max-height: 600px) and (orientation: portrait) {
  /* Reduce padding and margins globally for vertical screens */
  .app-main {
    padding: 12px;
  }

  .page-header {
    padding: 16px 20px;
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .page-subtitle {
    font-size: 14px;
  }

  /* Compact cards and components */
  .card, .panel, .section {
    margin-bottom: 12px;
    padding: 16px;
  }

  .card-header, .panel-header {
    padding-bottom: 12px;
  }

  .card-title, .panel-title {
    font-size: 18px;
  }

  /* Better button spacing */
  .btn-group, .button-group {
    gap: 8px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 14px;
  }

  /* Form improvements */
  .form-group, .input-group {
    margin-bottom: 12px;
  }

  .form-label {
    margin-bottom: 4px;
    font-size: 14px;
  }

  .form-control {
    padding: 10px 12px;
  }

  /* Table improvements */
  .table-container {
    max-height: 250px;
    overflow-y: auto;
  }

  .data-table th,
  .data-table td {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Modal adjustments */
  .modal-dialog {
    margin: 10px;
    max-height: calc(100vh - 20px);
  }

  .modal-content {
    max-height: 100%;
  }

  .modal-body {
    max-height: calc(100vh - 140px);
    overflow-y: auto;
  }
}

/* Landscape orientation on small screens */
@media (max-height: 500px) and (orientation: landscape) {
  /* Optimize for landscape on small screens */
  .app-sidebar {
    width: 60px;
  }

  .app-sidebar.expanded {
    width: 200px;
  }

  .app-main {
    margin-left: 60px;
    padding: 8px;
  }

  .app-main.sidebar-expanded {
    margin-left: 200px;
  }

  .page-header {
    padding: 12px 16px;
    flex-direction: row;
    align-items: center;
  }

  .page-title {
    font-size: 20px;
    margin-bottom: 0;
    margin-right: 16px;
  }

  .page-subtitle {
    display: none; /* Hide subtitle in landscape to save space */
  }

  /* Compact layouts */
  .card, .panel {
    padding: 12px;
    margin-bottom: 8px;
  }

  .btn-group {
    flex-direction: row;
    justify-content: flex-start;
  }

  /* Table optimizations */
  .table-container {
    max-height: 180px;
  }

  .data-table th,
  .data-table td {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* Very small vertical screens */
@media (max-width: 360px) and (max-height: 640px) {
  /* Further optimizations for very small screens */
  .app-main {
    padding: 8px;
  }

  .page-header {
    padding: 12px 8px;
  }

  .page-title {
    font-size: 18px;
  }

  .card, .panel {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 13px;
    min-width: auto;
  }

  .form-control {
    padding: 8px 10px;
    font-size: 14px;
  }

  .data-table th,
  .data-table td {
    padding: 6px;
    font-size: 12px;
  }
}

/* Touch-friendly improvements for vertical screens */
@media (max-width: 768px) and (orientation: portrait) {
  /* Increase touch targets */
  .btn, .tab-btn, .menu-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Better spacing for touch */
  .form-control, .select-control, .input-control {
    min-height: 44px;
    padding: 12px 16px;
  }

  /* Improve table touch interaction */
  .data-table th,
  .data-table td {
    padding: 12px 8px;
  }

  /* Better modal touch experience */
  .modal-header,
  .modal-footer {
    padding: 16px;
  }

  .modal-close {
    width: 44px;
    height: 44px;
    padding: 10px;
  }
}

/* ==================== GLOBAL VERTICAL SCREEN RESPONSIVE IMPROVEMENTS ==================== */

/* Vertical orientation specific adjustments */
@media (max-height: 600px) and (orientation: portrait) {
  .app-container {
    padding: 15px;
  }

  .app-header {
    padding: 15px 20px;
    margin-bottom: 20px;
  }

  .app-header h1 {
    font-size: 28px;
  }

  .page-content {
    padding: 20px;
    min-height: 400px;
  }

  .page-header {
    margin-bottom: 20px;
  }

  .page-header h1 {
    font-size: 28px;
  }

  .stats-grid {
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-value {
    font-size: 28px;
  }

  /* Compact navigation for vertical screens */
  .app-sidebar {
    padding: 20px 0;
  }

  .sidebar-user {
    padding: 10px 15px;
    margin-bottom: 15px;
  }

  .nav-link {
    padding: 10px 12px;
  }

  /* Better modal handling for vertical screens */
  .modal-content {
    max-height: 85vh;
    margin: 10px;
  }

  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Landscape orientation on small screens */
@media (max-height: 500px) and (orientation: landscape) {
  .app-container {
    padding: 10px;
  }

  .app-header {
    padding: 10px 15px;
    margin-bottom: 15px;
  }

  .page-content {
    padding: 15px;
    min-height: 300px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-value {
    font-size: 24px;
  }

  /* Sidebar adjustments for landscape */
  .app-sidebar {
    width: 240px;
    padding: 15px 0;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 14px;
  }

  /* Compact modals for landscape */
  .modal-content {
    max-width: 90vw;
    max-height: 80vh;
  }

  .modal-body {
    max-height: 50vh;
  }
}

/* ==================== GLOBAL TOUCH INTERACTIONS ==================== */

/* Touch feedback for interactive elements */
.btn:active,
.tab-btn:active,
.nav-link:active,
.menu-item:active,
.form-control:active,
.select-control:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* Prevent text selection on touch devices for UI elements */
.app-sidebar,
.app-header,
.stat-card,
.nav-link,
.btn,
.tab-btn,
.menu-item {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow text selection in input fields and content areas */
.form-control,
.select-control,
.input-control,
textarea,
.content-editable,
.page-content p,
.page-content span,
.page-content div {
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Touch-friendly hover states for non-touch devices */
@media (hover: hover) and (pointer: fine) {
  .btn:hover,
  .tab-btn:hover,
  .nav-link:hover {
    transform: translateY(-1px);
  }
}

/* Touch-specific improvements for coarse pointers */
@media (pointer: coarse) {
  /* Minimum touch target sizes */
  .btn,
  .tab-btn,
  .nav-link,
  .menu-item,
  .form-control,
  .select-control {
    min-height: 44px;
    min-width: 44px;
  }

  /* Better spacing for touch */
  .app-sidebar .nav-link {
    padding: 12px 16px;
    margin-bottom: 4px;
  }

  .stat-card {
    padding: 20px;
  }

  /* Improved modal touch targets */
  .modal-close {
    width: 48px;
    height: 48px;
    padding: 12px;
  }

  .modal-footer .btn {
    min-height: 48px;
    padding: 12px 24px;
  }

  /* Better form touch experience */
  .form-group {
    margin-bottom: 20px;
  }

  .form-control,
  .select-control,
  textarea {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Table touch improvements */
  .table th,
  .table td {
    padding: 12px 16px;
  }

  .data-table th,
  .data-table td {
    padding: 12px 8px;
  }
}

/* Smooth scrolling for touch devices */
.app-sidebar,
.modal-body,
.table-container,
.responsive-table-wrapper {
  -webkit-overflow-scrolling: touch;
}

/* Touch gesture improvements */
* {
  -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
}

/* Disable pull-to-refresh on mobile for better UX in some contexts */
body {
  overscroll-behavior-y: contain;
}

/* Better focus styles for keyboard navigation */
.btn:focus,
.tab-btn:focus,
.nav-link:focus,
.form-control:focus,
.select-control:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn,
  .tab-btn,
  .nav-link,
  .stat-card,
  .modal-content {
    border: 2px solid var(--text-primary);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* NUCLEAR OVERRIDE: Allow user avatars to display background images */
/* This counteracts the background-image: none !important rules in timesheet.css */
.user-avatar:not(.has-image) {
  background-image: unset !important;
}

/* Ensure background-color is set to allow background-image overlay */
.user-avatar {
  background-color: var(--text-primary) !important;
}

/* For avatars with images, use transparent background so image shows through */
.user-avatar.has-image {
  background-color: transparent !important;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Handle img elements within user-avatar */
.user-avatar.has-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 12px !important;
}

/* ===========================================
   CALENDAR PAGE STYLES - NUCLEAR OVERRIDE
   =========================================== */

.calendar-page {
  padding: 20px;
  max-width: 100%;
  margin: 0;
  display: grid !important;
  grid-template-columns: 1fr 320px !important;
  grid-template-rows: auto !important;
  gap: 20px !important;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Ensure calendar-main takes full column and children don't overflow */
.calendar-page .calendar-main {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
}

.calendar-page .calendar-sidebar {
  grid-column: 2;
  min-width: 0;
}

/* Medium screens (901px-1200px) - keep sidebar but narrower */
@media (min-width: 901px) and (max-width: 1200px) {
  .calendar-page {
    grid-template-columns: 1fr 280px !important;
    gap: 15px !important;
  }
}

/* Tablets / smaller screens - stack to single column */
@media (max-width: 900px) {
  .calendar-page {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
  }

  .calendar-page .calendar-main {
    grid-column: 1;
  }

  .calendar-page .calendar-sidebar {
    grid-column: 1;
  }

  .calendar-main,
  .calendar-sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* MOBILE LAYOUT - single column grid */
@media (max-width: 768px) {
  .calendar-page {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 15px;
    position: relative;
    min-height: calc(100vh - 30px);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .calendar-main {
    grid-column: 1;
    width: 100% !important;
    margin-bottom: 20px;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-sidebar {
    grid-column: 1;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Ensure tasks-sidebar stretches to full width at portrait mode */
  .calendar-sidebar .tasks-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Ensure calendar grid keeps 7 columns */
  .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }

  /* Ensure calendar-page children stretch properly */
  .calendar-page > div {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

.calendar-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  padding: 0 10px;
  gap: 20px;
  width: 100%;
}

.calendar-title {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.calendar-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 30px;
}

.view-toggle {
  display: flex;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}

.view-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: #4b5563;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.view-btn.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  flex-shrink: 1;
}

.nav-btn {
  background: white;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #000000;
}

.today-btn {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.today-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.current-period {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  min-width: 140px;
  text-align: center;
  padding: 0 10px;
  flex-shrink: 0;
}

.calendar-container {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  margin-bottom: 20px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: #e5e7eb;
  width: 100%;
}

.calendar-header-cell {
  background: #f8fafc;
  padding: 15px 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.calendar-cell {
  background: white;
  min-height: 120px;
  padding: 8px;
  position: relative;
  border: none;
  transition: background 0.2s ease;
  overflow: hidden;
  min-width: 0;
}

.calendar-cell:hover {
  background: #f8fafc;
  cursor: pointer;
}

.calendar-cell:hover::after {
  content: "Double-click to create task";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  z-index: 10;
}

.calendar-cell.drag-over {
  background: #dbeafe !important;
  border: 2px dashed #3b82f6 !important;
}

.calendar-cell.drag-over::after {
  content: "Drop to set due date" !important;
  background: #3b82f6 !important;
}

.sidebar-task-item.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.task-item[draggable="true"] {
  cursor: grab;
}

.task-item[draggable="true"]:active {
  cursor: grabbing;
}

.calendar-cell.other-month {
  background: #f9fafb;
  color: #9ca3af;
}

.calendar-cell.today {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 2px solid #3b82f6;
}

.cell-date {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.calendar-cell.other-month .cell-date {
  color: #9ca3af;
}

.calendar-cell.today .cell-date {
  color: #1d4ed8;
}

.task-item {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  cursor: pointer;
  transition: transform 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}

.task-item:hover {
  transform: translateY(-1px);
}

.task-item.priority-low {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.task-item.priority-medium {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.task-item.priority-high {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.task-item.priority-urgent {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.no-tasks {
  text-align: center;
  color: #9ca3af;
  font-style: italic;
  padding: 40px;
  font-size: 16px;
}

.task-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
  max-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Mobile Calendar Styles */
@media (max-width: 768px) {
  .calendar-page {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 15px;
    position: relative;
    min-height: calc(100vh - 30px);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .calendar-main {
    grid-column: 1;
    width: 100% !important;
    margin-bottom: 20px;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-sidebar {
    grid-column: 1;
    width: 100% !important;
  }

  .calendar-header {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }

  .calendar-controls {
    justify-content: center;
  }

  .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  }

  .calendar-cell {
    min-height: 80px;
    overflow: hidden !important;
    min-width: 0 !important;
  }

  .task-item {
    font-size: 10px;
    max-width: 100% !important;
  }
}

/* Enhanced Vertical Screen Support */
@media screen and (max-width: 768px) and (orientation: portrait),
       screen and (max-height: 600px) and (max-width: 900px) {
  .calendar-page {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    padding: 10px;
    min-height: calc(100vh - 20px);
    position: relative;
    overflow-y: auto;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .calendar-main {
    grid-column: 1;
    width: 100% !important;
    margin-bottom: 15px;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-sidebar {
    grid-column: 1;
    width: 100% !important;
  }

  .calendar-header {
    padding: 0 5px;
    margin-bottom: 15px;
  }

  .calendar-title {
    font-size: 24px;
    text-align: center;
    margin-bottom: 10px;
  }

  .calendar-controls {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
  }

  .view-toggle {
    justify-content: center;
    margin-bottom: 8px;
  }

  .nav-controls {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .current-period {
    text-align: center;
    min-width: unset;
    font-size: 14px;
    margin: 8px 0;
  }

  .calendar-container {
    margin-bottom: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }

  .calendar-grid {
    min-width: unset;
  }

  .calendar-cell {
    min-height: 70px;
    padding: 6px;
    min-width: 0;
    overflow: hidden;
  }

  .calendar-cell.today {
    border-width: 1px;
  }

  .cell-date {
    font-size: 12px;
    margin-bottom: 3px;
  }

  .task-item {
    font-size: 9px;
    padding: 2px 4px;
    margin-bottom: 1px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
  }

  .sidebar-tasks {
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-task-item {
    padding: 10px;
    margin-bottom: 6px;
  }

  .sidebar-task-item .task-title {
    font-size: 12px;
  }

  .sidebar-task-item p {
    font-size: 10px;
  }
}

/* Ultra-narrow portrait screens */
@media screen and (max-width: 480px) and (orientation: portrait) {
  .calendar-page {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 8px;
    min-height: calc(100vh - 16px);
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .calendar-main {
    grid-column: 1;
    width: 100% !important;
    margin-bottom: 15px;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-sidebar {
    order: 2;
    width: 100% !important;
  }

  .calendar-title {
    font-size: 20px;
  }

  .calendar-grid {
    gap: 1px;
    width: 100%;
    min-width: unset;
  }

  .calendar-cell {
    min-height: 60px;
    padding: 4px;
    min-width: 0;
    overflow: hidden;
  }

  .cell-date {
    font-size: 11px;
  }

  .task-item {
    font-size: 8px;
    padding: 1px 3px;
    max-width: 100%;
    display: block;
  }

  .sidebar-task-item {
    padding: 8px;
  }

  .sidebar-task-item .task-title {
    font-size: 11px;
  }

  .calendar-sidebar {
    max-height: 200px;
  }

  .sidebar-tasks {
    max-height: 180px;
  }
}

/* Calendar sidebar width - handled by grid-template-columns */

/* Calendar controls responsive adjustments for medium screens */
@media (max-width: 1199px) {
  /* Make calendar controls wrap nicely on smaller screens */
  .calendar-controls {
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .nav-controls {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
  }

  .nav-btn {
    min-width: 80px !important;
    text-align: center !important;
  }

  .current-period {
    text-align: center !important;
    min-width: 120px !important;
  }
}

/* Calendar desktop grid layout: ensure sidebar fixed width on large screens */
@media (min-width: 1200px) {
  .calendar-page {
    display: grid !important;
    grid-template-columns: 1fr 350px !important;
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .calendar-main {
    width: auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-sidebar {
    grid-column: 2 !important;
  }
}

/* ========================================
   QUOTATIONS PAGE STYLES
   ======================================== */

.quotations-page {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.quotations-page .page-header {
  margin-bottom: 30px;
}

.quotations-page .page-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.quotations-page .page-header .subtitle {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

/* Action Bar */
.quotations-page .action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.quotations-page .search-filter-group {
  display: flex;
  gap: 15px;
  flex: 1;
  min-width: 300px;
}

.quotations-page .search-box {
  flex: 1;
  max-width: 400px;
}

.quotations-page .search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.quotations-page .search-box input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.quotations-page .filter-group .status-filter {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: white;
  transition: all 0.3s ease;
}

.quotations-page .filter-group .status-filter:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Quotations Table */
.quotations-page .table-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.quotations-table {
  width: 100%;
  border-collapse: collapse;
}

.quotations-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.quotations-table thead th {
  padding: 16px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quotations-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: all 0.2s ease;
}

.quotations-table tbody tr:hover {
  background: #f9fafb;
}

.quotations-table tbody tr:last-child {
  border-bottom: none;
}

.quotations-table tbody td {
  padding: 16px;
  font-size: 14px;
  color: #374151;
}

.quotations-table .quotation-number {
  font-weight: 700;
  color: #667eea;
}

.quotations-table .quotation-link {
  color: #667eea;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease;
}

.quotations-table .quotation-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

.quotations-table .amount {
  font-weight: 700;
  font-size: 16px;
  color: #1f2937;
}

.quotations-table .days-remaining {
  font-size: 12px;
  font-weight: 600;
}

.quotations-table .text-red {
  color: #ef4444;
}

.quotations-table .text-orange {
  color: #f59e0b;
}

.quotations-table .text-gray {
  color: #6b7280;
}

.quotations-table .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Action Buttons */
.quotations-table .btn-action {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: 2px solid #6366f1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 20px;
  cursor: pointer;
  color: white;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
  min-width: 40px;
  text-align: center;
}

.quotations-table .btn-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3);
}

.quotations-table .btn-view {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: #6366f1;
}

.quotations-table .btn-view:hover {
  background: linear-gradient(135deg, #4f46e5, #3730a3);
}

.quotations-table .btn-edit {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #f59e0b;
}

.quotations-table .btn-edit:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
}

.quotations-table .btn-send,
.quotations-table .btn-resend {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
}

.quotations-table .btn-send:hover,
.quotations-table .btn-resend:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

.quotations-table .btn-convert {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  border-color: #8b5cf6;
}

.quotations-table .btn-convert:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.3);
}

.quotations-table .btn-archive {
  background: linear-gradient(135deg, #64748b, #475569);
  border-color: #64748b;
}

.quotations-table .btn-archive:hover {
  background: linear-gradient(135deg, #475569, #334155);
  box-shadow: 0 3px 10px rgba(100, 116, 139, 0.3);
}

.quotations-table .btn-delete {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
}

.quotations-table .btn-delete:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

/* Status Badges */
.quotations-table .badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quotations-table .badge-gray {
  background: #f3f4f6;
  color: #6b7280;
}

.quotations-table .badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.quotations-table .badge-green {
  background: #d1fae5;
  color: #065f46;
}

.quotations-table .badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.quotations-table .badge-amber {
  background: #fef3c7;
  color: #92400e;
}

.quotations-table .badge-purple {
  background: #f3e8ff;
  color: #6b21a8;
}

/* Empty State */
.quotations-page .empty-state {
  text-align: center;
  padding: 80px 20px;
  background: white;
  border-radius: 16px;
}

.quotations-page .empty-state .empty-icon {
  font-size: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.quotations-page .empty-state h3 {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 12px 0;
}

.quotations-page .empty-state p {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 30px 0;
}

/* Loading State */
.quotations-page .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 20px;
}

.quotations-page .loading-state .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f4f6;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.quotations-page .loading-state p {
  margin-top: 20px;
  font-size: 16px;
  color: #6b7280;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .quotations-page .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .quotations-page .search-filter-group {
    flex-direction: column;
    min-width: 100%;
  }

  .quotations-page .search-box {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .quotations-page {
    padding: 15px;
  }

  .quotations-page .page-header h1 {
    font-size: 24px;
  }

  .quotations-table {
    font-size: 12px;
  }

  .quotations-table thead th,
  .quotations-table tbody td {
    padding: 12px 8px;
  }

  .quotations-table .btn-action {
    padding: 6px 10px;
    font-size: 16px;
  }
  
  .quotations-page .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .quotations-page .stats-grid {
    grid-template-columns: 1fr;
  }

  .quotations-table .actions {
    flex-direction: column;
  }
}

/* ========================================
   RESPONSIVE FILTER BAR - Small Screens
   ======================================== */
@media screen and (max-width: 1024px) {
  #pm-board-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto !important;
    width: 100% !important;
    gap: 15px !important;
  }

  .task-filter-bar {
    grid-row: 1 !important;
    grid-column: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 18px 22px !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .task-filter-bar[style] {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .task-filter-bar .filter-label {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 8px !important;
    order: 1 !important;
  }

  .task-filter-bar .filter-label[style] {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .task-filter-bar .filter-controls {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    order: 2 !important;
  }

  .task-filter-bar .filter-controls[style] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
  }

  #kanban-board,
  .kanban-board,
  .kanban-board.responsive-board.responsive-taskboard {
    grid-row: 2 !important;
    grid-column: 1 !important;
    width: 100% !important;
  }

  .kanban-board.responsive-board.responsive-taskboard {
    display: grid !important;
    gap: 14px !important;
    padding: 14px !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    flex-direction: unset !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
  }

  .kanban-board.responsive-board.responsive-taskboard .kanban-column {
    width: 100% !important;
    min-width: unset !important;
    max-width: none !important;
    flex: none !important;
    height: auto !important;
  }
}

/* AGGRESSIVE OVERRIDE - Force filter bar to vertical stack at ANY screen size ≤ 1024px */
@media screen and (max-width: 1024px) {
  div.task-filter-bar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  
  div.task-filter-bar > div:first-child {
    order: 1 !important;
  }
  
  div.task-filter-bar > div:last-child {
    order: 2 !important;
  }
  
  div.task-filter-bar > div {
    width: 100% !important;
  }
}

/* Hide app header for users module */
body.hide-app-header .app-header {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Toast Container - Prevent any scrolling */
.toast-container,
.toast-container * {
  overflow: hidden !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  max-width: 420px !important;
  box-sizing: border-box !important;
}

/* Portrait Mode - Icon-only STATUS and ACTIONS columns */
@media (orientation: portrait) and (min-width: 650px) and (max-width: 1200px) {
  /* Hide text in status badges, show only emoji icon */
  .table td:nth-child(6) .status-badge .status-text {
    display: none !important;
  }
  
  .table td:nth-child(6) .status-badge {
    padding: 0 !important;
    margin: 0 !important;
    min-width: unset !important;
    max-width: unset !important;
    width: auto !important;
    height: auto !important;
    min-height: unset !important;
    max-height: unset !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: inline !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    text-transform: none !important;
    font-weight: normal !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: inherit !important;
  }
  
  .table td:nth-child(6) .status-badge .status-icon {
    font-size: 20px !important;
    line-height: 1 !important;
    display: inline !important;
  }
  
  /* Optimize STATUS column width for icon only - prevent breaking */
  .table th:nth-child(6),
  .table td:nth-child(6) {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    padding: 12px 8px !important;
    text-align: center !important;
    overflow: visible !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
  }
  
  /* Hide button text in actions column, show only emoji icons */
  .table td:last-child .action-btn .btn-text {
    display: none !important;
  }
  
  .table td:last-child .action-btn {
    padding: 8px !important;
    min-width: 36px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }
  
  .table td:last-child .action-btn .btn-icon {
    font-size: 16px !important;
    line-height: 1 !important;
  }
  
  /* Optimize ACTIONS column width for icons only */
  .table th:last-child,
  .table td:last-child {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    padding: 12px 8px !important;
    text-align: center !important;
    overflow: visible !important;
  }
  
  /* Ensure action button container is flex */
  .table td:last-child .action-buttons {
    display: flex !important;
    gap: 6px !important;
    justify-content: center !important;
    overflow: visible !important;
  }
}

/* Tablet/Vertical view - prevent column overlap */
@media (max-width: 1100px) and (min-width: 769px) {
  /* Increase column widths for Last Login and Actions on tablet/vertical */
  .table th:nth-child(6),
  .table td:nth-child(6) {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .table th:nth-child(7),
  .table td:nth-child(7) {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Ensure table doesn't shrink too much */
  .table {
    font-size: 13px !important;
  }

  .table th,
  .table td {
    padding: 12px 8px !important;
  }
}

/* Hide tab text on portrait/mobile screens - show only icons */
@media (max-width: 768px), (orientation: portrait) {
  .tab-text {
    display: none !important;
  }
  
  .tab-btn {
    padding: 12px 16px !important;
  }
  
  .tab-btn span[style*="font-size: 18px"] {
    font-size: 20px !important;
  }
}

/* Enhanced tab styling for better visual appearance */
.tabs-container .tabs {
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%) !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.tab-btn {
  position: relative !important;
  border-radius: 0 !important;
  transition: all 0.3s ease !important;
}

.tab-btn.active,
.tab-btn[style*="background: white"] {
  background: #ffffff !important;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05) !important;
  border-top-left-radius: 8px !important;
  border-top-right-radius: 8px !important;
  margin-top: -2px !important;
  padding-top: 18px !important;
  position: relative !important;
  z-index: 1 !important;
}

.tab-btn:not(.active):hover,
.tab-btn[style*="background: transparent"]:hover,
.tab-btn[style*="background: #f1f5f9"]:hover {
  background: rgba(255, 255, 255, 0.5) !important;
}


/* Knowledge Base Sidebar Search Placeholder */
.kb-sidebar-search::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Request Items Animation */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-20px);
  }
}

/* Suppress Chrome view transitions warning for video/img/canvas */
video, img, canvas {
  view-transition-name: none;
}

/* Request Item Input Focus Effects */
.request-item input:focus,
.receipt-item input:focus {
  outline: none;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.request-item input:hover,
.receipt-item input:hover {
  border-color: #94a3b8 !important;
}

/* Mobile-friendly table layout for portrait mode */
@media (max-width: 768px) {
  .responsive-table-wrapper {
    overflow-x: visible !important;
    overflow-y: visible !important;
    width: 100% !important;
  }

  .table {
    min-width: 100% !important;
    width: 100% !important;
  }

  .table thead {
    display: none;
  }

  .table tbody,
  .table tbody tr,
  .table tbody td {
    display: block;
    width: 100%;
  }

  .table tbody tr {
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: white;
  }

  .table tbody td {
    padding: 10px 0 !important;
    border-bottom: 1px solid #f3f4f6 !important;
    display: block !important;
    text-align: left !important;
    word-break: break-word !important;
    position: relative !important;
    min-height: 40px !important;
    width: 100% !important;
  }

  .table tbody td:last-child {
    border-bottom: none !important;
    padding: 12px 0 12px 0 !important;
    margin-top: 8px !important;
    border-top: 2px solid #e5e7eb !important;
  }

  /* Label on first line */
  .table tbody td:before {
    content: attr(data-label) !important;
    font-weight: 700 !important;
    color: #6b7280 !important;
    text-align: left !important;
    display: block !important;
    margin-bottom: 4px !important;
    font-size: 12px !important;
  }

  .table th,
  .table td {
    padding: 10px 0 !important;
    font-size: 14px !important;
  }

  .table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
  }

  /* Action buttons - stack horizontally */
  .action-buttons {
    gap: 6px !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    display: flex !important;
    width: 100% !important;
    margin-top: 8px !important;
    overflow: visible !important;
    position: relative !important;
  }

  /* Ensure all content in cells is visible and not truncated */
  .table tbody td > div,
  .table tbody td > span {
    max-width: 100% !important;
    overflow: visible !important;
    word-wrap: break-word !important;
    display: block !important;
    width: 100% !important;
  }

  /* Badge styling for mobile */
  .table tbody td .badge {
    display: inline-block !important;
    max-width: 100% !important;
  }

  /* Actions column styling for mobile - ensure it has full width */
  .table tbody td:last-child {
    min-height: auto !important;
    padding: 12px 0 !important;
    margin-top: 8px !important;
    border-top: 1px solid #e5e7eb !important;
  }

  .table tbody td:last-child::before {
    content: "Actions" !important;
  }
}

/* Project Name Tooltip */
.project-name-tooltip {
  position: relative;
  display: inline-block;
}

/* Native browser tooltip styling using title attribute */
.project-name-tooltip[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: normal;
  max-width: 280px;
  word-wrap: break-word;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: tooltipFadeIn 0.2s ease-in-out;
  line-height: 1.4;
}

/* Tooltip arrow */
.project-name-tooltip[title]:hover::before {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
}

/* ═══════════════════════════════════════════════════════════════ */
/* DARK MODE GLOBAL CSS OVERRIDES                                  */
/* ═══════════════════════════════════════════════════════════════ */
/* Auto-convert hardcoded light colors to theme variables in dark mode */

/* White backgrounds → Primary background */
.theme-dark [style*="background: white"],
.dark-mode [style*="background: white"],
.theme-dark [style*="background:white"],
.dark-mode [style*="background:white"] {
  background-color: var(--bg-primary) !important;
}

/* Light gray backgrounds → Secondary background */
.theme-dark [style*="background: #f8fafc"],
.dark-mode [style*="background: #f8fafc"],
.theme-dark [style*="background: #ffffff"],
.dark-mode [style*="background: #ffffff"] {
  background-color: var(--bg-secondary) !important;
}

/* Light text → Primary text color */
.theme-dark [style*="color: #1e293b"],
.dark-mode [style*="color: #1e293b"],
.theme-dark [style*="color:#1e293b"],
.dark-mode [style*="color:#1e293b"] {
  color: var(--text-primary) !important;
}

/* Dark gray text → Secondary text color */
.theme-dark [style*="color: #475569"],
.dark-mode [style*="color: #475569"],
.theme-dark [style*="color: #6b7280"],
.dark-mode [style*="color: #6b7280"] {
  color: var(--text-secondary) !important;
}

/* Muted gray text → Muted text color */
.theme-dark [style*="color: #9ca3af"],
.dark-mode [style*="color: #9ca3af"],
.theme-dark [style*="color: #64748b"],
.dark-mode [style*="color: #64748b"] {
  color: var(--text-muted) !important;
}

/* Light borders → Theme borders */
.theme-dark [style*="border: 1px solid #e2e8f0"],
.dark-mode [style*="border: 1px solid #e2e8f0"],
.theme-dark [style*="border: 1px solid #e5e7eb"],
.dark-mode [style*="border: 1px solid #e5e7eb"],
.theme-dark [style*="border-bottom: 1px solid #e5e7eb"],
.dark-mode [style*="border-bottom: 1px solid #e5e7eb"],
.theme-dark [style*="border-top: 1px solid #e5e7eb"],
.dark-mode [style*="border-top: 1px solid #e5e7eb"],
.theme-dark [style*="border-bottom: 1px solid #e2e8f0"],
.dark-mode [style*="border-bottom: 1px solid #e2e8f0"] {
  border-color: var(--border-color) !important;
}

/* Form input styling in dark mode */
.theme-dark input[type="text"],
.dark-mode input[type="text"],
.theme-dark input[type="email"],
.dark-mode input[type="email"],
.theme-dark input[type="password"],
.dark-mode input[type="password"],
.theme-dark input[type="number"],
.dark-mode input[type="number"],
.theme-dark textarea,
.dark-mode textarea,
.theme-dark select,
.dark-mode select {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Form input placeholders */
.theme-dark input::placeholder,
.dark-mode input::placeholder,
.theme-dark textarea::placeholder,
.dark-mode textarea::placeholder {
  color: var(--text-muted) !important;
}

/* Table styling in dark mode */
.theme-dark table,
.dark-mode table {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark tbody tr,
.dark-mode tbody tr {
  border-bottom-color: var(--border-color) !important;
}

.theme-dark tbody tr:hover,
.dark-mode tbody tr:hover {
  background-color: var(--bg-secondary) !important;
}

.theme-dark th,
.dark-mode th {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark td,
.dark-mode td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Modal and dialog styling */
.theme-dark .modal,
.dark-mode .modal,
.theme-dark [role="dialog"],
.dark-mode [role="dialog"] {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* Card styling - only target specific card classes, not all elements containing "card" */
.theme-dark .card,
.dark-mode .card {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Button styling in dark mode - preserve button colors but fix text */
.theme-dark button,
.dark-mode button {
  color: var(--text-primary) !important;
}

.theme-dark .btn-default,
.dark-mode .btn-default,
.theme-dark button:not([class*="btn-"]),
.dark-mode button:not([class*="btn-"]) {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* List styling */
.theme-dark ul,
.dark-mode ul,
.theme-dark ol,
.dark-mode ol {
  color: var(--text-primary) !important;
}

.theme-dark li,
.dark-mode li {
  color: var(--text-primary) !important;
}

/* Link styling */
.theme-dark a,
.dark-mode a {
  color: var(--accent-primary) !important;
}

.theme-dark a:hover,
.dark-mode a:hover {
  color: var(--accent-secondary) !important;
}

/* Label and form text */
.theme-dark label,
.dark-mode label {
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* KNOWLEDGE BASE CARD STYLING                                      */
/* ═══════════════════════════════════════════════════════════════ */

/* KB cards use warm cream background in light mode */
.kb-card {
  background: rgba(255, 248, 240, 0.95) !important;
  color: #5a3e1b !important;
}

/* KB cards in dark mode */
html.theme-dark .kb-card,
.dark-mode .kb-card {
  background: rgba(58, 47, 42, 0.92) !important;
  color: rgba(255, 245, 230, 0.9) !important;
}

/* Dark mode styling for project tag buttons in KB cards */
.dark-mode .kb-filter-project-tag[style*="background: #eff6ff"],
.theme-dark .kb-filter-project-tag[style*="background: #eff6ff"] {
  background: rgba(30, 58, 138, 0.6) !important;
  color: #87ceeb !important;
  border: 1px solid rgba(135, 206, 235, 0.3) !important;
}

.dark-mode .kb-filter-project-tag[style*="background: #f0fdf4"],
.theme-dark .kb-filter-project-tag[style*="background: #f0fdf4"] {
  background: rgba(34, 85, 51, 0.6) !important;
  color: #90ee90 !important;
  border: 1px solid rgba(144, 238, 144, 0.3) !important;
}

.dark-mode .kb-filter-project-tag[style*="background: #fef3c7"],
.theme-dark .kb-filter-project-tag[style*="background: #fef3c7"] {
  background: rgba(133, 100, 14, 0.6) !important;
  color: #ffd700 !important;
  border: 1px solid rgba(255, 215, 0, 0.3) !important;
}

.dark-mode .kb-filter-project-tag[style*="background: #fce7f3"],
.theme-dark .kb-filter-project-tag[style*="background: #fce7f3"] {
  background: rgba(125, 30, 93, 0.6) !important;
  color: #ff69b4 !important;
  border: 1px solid rgba(255, 105, 180, 0.3) !important;
}

/* Header and navigation */
.theme-dark .page-header,
.dark-mode .page-header,
.theme-dark .header,
.dark-mode .header {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Page header h1, h2, h3 etc */
.theme-dark .page-header h1,
.dark-mode .page-header h1,
.theme-dark .page-header h2,
.dark-mode .page-header h2,
.theme-dark .page-header h3,
.dark-mode .page-header h3,
.theme-dark .header h1,
.dark-mode .header h1,
.theme-dark .header h2,
.dark-mode .header h2,
.theme-dark .header h3,
.dark-mode .header h3 {
  color: var(--text-primary) !important;
}

/* Page header paragraphs */
.theme-dark .page-header p,
.dark-mode .page-header p,
.theme-dark .header p,
.dark-mode .header p {
  color: var(--text-secondary) !important;
}

/* Additional dark gray text colors */
.theme-dark [style*="color: #374151"],
.dark-mode [style*="color: #374151"],
.theme-dark [style*="color: #4b5563"],
.dark-mode [style*="color: #4b5563"],
.theme-dark [style*="color: #656e7e"],
.dark-mode [style*="color: #656e7e"] {
  color: var(--text-secondary) !important;
}

/* Logo and subtitle text */
.theme-dark .logo-text,
.dark-mode .logo-text,
.theme-dark .logo-subtitle,
.dark-mode .logo-subtitle {
  color: var(--text-primary) !important;
}

/* Generic heading text */
.theme-dark h1,
.dark-mode h1,
.theme-dark h2,
.dark-mode h2,
.theme-dark h3,
.dark-mode h3,
.theme-dark h4,
.dark-mode h4,
.theme-dark h5,
.dark-mode h5,
.theme-dark h6,
.dark-mode h6 {
  color: var(--text-primary) !important;
}

/* Generic paragraph text */
.theme-dark p,
.dark-mode p {
  color: var(--text-secondary) !important;
}

/* Span and div with text content */
.theme-dark [style*="color: #1f2937"],
.dark-mode [style*="color: #1f2937"],
.theme-dark [style*="color: #374151"],
.dark-mode [style*="color: #374151"],
.theme-dark [style*="color: #6b7280"],
.dark-mode [style*="color: #6b7280"] {
  color: var(--text-secondary) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* KANBAN CARD STYLING FOR DARK MODE                               */
/* ═══════════════════════════════════════════════════════════════ */

/* Kanban task card styling */
.theme-dark .kanban-task,
.dark-mode .kanban-task {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Task card on hover */
.theme-dark .kanban-task:hover,
.dark-mode .kanban-task:hover {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%) !important;
  border-color: rgba(102, 126, 234, 0.4) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
}

/* Kanban task text color */
.theme-dark .kanban-task [style*="color: #1f2937"],
.dark-mode .kanban-task [style*="color: #1f2937"] {
  color: var(--text-primary) !important;
}

/* Kanban task muted text */
.theme-dark .kanban-task [style*="color: #9ca3af"],
.dark-mode .kanban-task [style*="color: #9ca3af"],
.theme-dark .kanban-task [style*="color: #6b7280"],
.dark-mode .kanban-task [style*="color: #6b7280"] {
  color: var(--text-muted) !important;
}

/* Kanban task date badges */
.theme-dark .kanban-task [style*="background: rgba(156, 163, 175, 0.1)"],
.dark-mode .kanban-task [style*="background: rgba(156, 163, 175, 0.1)"] {
  background-color: rgba(148, 163, 184, 0.15) !important;
  color: var(--text-muted) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

/* Kanban task action buttons */
.theme-dark .kanban-task .task-actions button,
.dark-mode .kanban-task .task-actions button {
  background-color: rgba(148, 163, 184, 0.15) !important;
  color: var(--text-secondary) !important;
  border-color: transparent !important;
}

.theme-dark .kanban-task .edit-task-btn,
.dark-mode .kanban-task .edit-task-btn {
  background-color: rgba(129, 140, 248, 0.15) !important;
  color: #818cf8 !important;
}

.theme-dark .kanban-task .delete-task-btn,
.dark-mode .kanban-task .delete-task-btn {
  background-color: rgba(248, 113, 113, 0.15) !important;
  color: #f87171 !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* CALENDAR STYLING FOR DARK MODE                                  */
/* ═══════════════════════════════════════════════════════════════ */

/* Calendar container */
.theme-dark .calendar-container,
.dark-mode .calendar-container {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* Calendar grid */
.theme-dark .calendar-grid,
.dark-mode .calendar-grid {
  background-color: var(--bg-primary) !important;
}

/* Calendar header cells */
.theme-dark .calendar-header-cell,
.dark-mode .calendar-header-cell {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Calendar cells */
.theme-dark .calendar-cell,
.dark-mode .calendar-cell {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Calendar cell date text */
.theme-dark .calendar-cell .cell-date,
.dark-mode .calendar-cell .cell-date {
  color: var(--text-primary) !important;
}

/* Other month dates (lighter) */
.theme-dark .calendar-cell.other-month,
.dark-mode .calendar-cell.other-month {
  background-color: var(--bg-secondary) !important;
  color: var(--text-muted) !important;
}

.theme-dark .calendar-cell.other-month .cell-date,
.dark-mode .calendar-cell.other-month .cell-date {
  color: var(--text-muted) !important;
}

/* Today indicator */
.theme-dark .calendar-cell.today,
.dark-mode .calendar-cell.today {
  background-color: rgba(102, 126, 234, 0.1) !important;
  border-color: rgba(102, 126, 234, 0.3) !important;
}

.theme-dark .calendar-cell.today .cell-date,
.dark-mode .calendar-cell.today .cell-date {
  color: #818cf8 !important;
  font-weight: 700 !important;
}

/* Task items in calendar */
.theme-dark .task-item,
.dark-mode .task-item {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .task-item.priority-low,
.dark-mode .task-item.priority-low {
  background-color: rgba(52, 211, 153, 0.15) !important;
  color: #86efac !important;
  border-color: rgba(52, 211, 153, 0.3) !important;
}

.theme-dark .task-item.priority-medium,
.dark-mode .task-item.priority-medium {
  background-color: rgba(251, 191, 36, 0.15) !important;
  color: #fbbf24 !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
}

.theme-dark .task-item.priority-high,
.dark-mode .task-item.priority-high {
  background-color: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.3) !important;
}

.theme-dark .task-item.priority-urgent,
.dark-mode .task-item.priority-urgent {
  background-color: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* TASK/PROJECT CARD CONTAINERS FOR DARK MODE                      */
/* ═══════════════════════════════════════════════════════════════ */

/* Light gray background containers */
.theme-dark [style*="background: rgba(249, 250, 251"],
.dark-mode [style*="background: rgba(249, 250, 251"] {
  background-color: var(--bg-secondary) !important;
}

/* Light gray borders in containers */
.theme-dark [style*="border: 1px solid rgba(229, 231, 235"],
.dark-mode [style*="border: 1px solid rgba(229, 231, 235"] {
  border-color: var(--border-color) !important;
}

/* Text in these containers */
.theme-dark [style*="background: rgba(249, 250, 251"] [style*="color: #374151"],
.dark-mode [style*="background: rgba(249, 250, 251"] [style*="color: #374151"] {
  color: var(--text-secondary) !important;
}

/* Dropdown/Search styling */
.theme-dark .header-search,
.dark-mode .header-search,
.theme-dark .search-container,
.dark-mode .search-container {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .header-search input,
.dark-mode .header-search input,
.theme-dark .search-container input,
.dark-mode .search-container input {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .header-search input::placeholder,
.dark-mode .header-search input::placeholder,
.theme-dark .search-container input::placeholder,
.dark-mode .search-container input::placeholder {
  color: var(--text-muted) !important;
}

/* Dropdown menus */
.theme-dark .dropdown-menu,
.dark-mode .dropdown-menu {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .dropdown-menu > li > a,
.dark-mode .dropdown-menu > li > a,
.theme-dark .dropdown-menu a,
.dark-mode .dropdown-menu a {
  color: var(--text-primary) !important;
}

.theme-dark .dropdown-menu a:hover,
.dark-mode .dropdown-menu a:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* Alert and notification styling */
.theme-dark .alert,
.dark-mode .alert {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Badge styling */
.theme-dark .badge,
.dark-mode .badge {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Pagination */
.theme-dark .pagination,
.dark-mode .pagination {
  background-color: var(--bg-secondary) !important;
}

.theme-dark .pagination li,
.dark-mode .pagination li {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .pagination a,
.dark-mode .pagination a {
  color: var(--accent-primary) !important;
}

/* Scrollbar styling for dark mode */
.theme-dark ::-webkit-scrollbar,
.dark-mode ::-webkit-scrollbar {
  background-color: var(--bg-secondary) !important;
}

.theme-dark ::-webkit-scrollbar-track,
.dark-mode ::-webkit-scrollbar-track {
  background-color: var(--bg-primary) !important;
}

.theme-dark ::-webkit-scrollbar-thumb,
.dark-mode ::-webkit-scrollbar-thumb {
  background-color: var(--border-color) !important;
}

.theme-dark ::-webkit-scrollbar-thumb:hover,
.dark-mode ::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted) !important;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Tooltip for smaller screens */
@media (max-width: 768px) {
  .project-name-tooltip[title]:hover::after {
    max-width: 200px;
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════ */
/* CARD AND CONTAINER STYLING FOR DARK MODE                        */
/* ═══════════════════════════════════════════════════════════════ */

/* White background cards with rounded corners */
.theme-dark [style*="background: white; border-radius"],
.dark-mode [style*="background: white; border-radius"],
.theme-dark [style*="background:white;border-radius"],
.dark-mode [style*="background:white;border-radius"] {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

/* Card shadows - convert to dark mode appropriate shadows */
.theme-dark [style*="box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08)"],
.dark-mode [style*="box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08)"] {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

/* Dark text in cards - convert to light text */
.theme-dark [style*="color: #1f2937"],
.dark-mode [style*="color: #1f2937"],
.theme-dark [style*="color: #1a1a1a"],
.dark-mode [style*="color: #1a1a1a"],
.theme-dark [style*="color: #000000"],
.dark-mode [style*="color: #000000"] {
  color: var(--text-primary) !important;
}

/* Muted gray text - medium gray */
.theme-dark [style*="color: #6b7280"],
.dark-mode [style*="color: #6b7280"],
.theme-dark [style*="color: #9ca3af"],
.dark-mode [style*="color: #9ca3af"] {
  color: var(--text-muted) !important;
}

/* Large number displays (28px, 24px headings) */
.theme-dark div[style*="font-size: 28px"],
.dark-mode div[style*="font-size: 28px"],
.theme-dark div[style*="font-size: 24px"],
.dark-mode div[style*="font-size: 24px"],
.theme-dark h3[style*="color: #1a1a1a"],
.dark-mode h3[style*="color: #1a1a1a"] {
  color: var(--text-primary) !important;
}

/* Stats and metric labels */
.theme-dark [style*="font-size: 13px; font-weight: 600; color: #6b7280"],
.dark-mode [style*="font-size: 13px; font-weight: 600; color: #6b7280"],
.theme-dark [style*="font-size: 12px; color: #9ca3af"],
.dark-mode [style*="font-size: 12px; color: #9ca3af"] {
  color: var(--text-muted) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* SELECT AND DROPDOWN STYLING FOR DARK MODE                       */
/* ═══════════════════════════════════════════════════════════════ */

.theme-dark select,
.dark-mode select,
.theme-dark .project-select,
.dark-mode .project-select {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark select option,
.dark-mode select option,
.theme-dark .project-select option,
.dark-mode .project-select option {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* NAVIGATION AND TAB STYLING FOR DARK MODE                        */
/* ═══════════════════════════════════════════════════════════════ */

.theme-dark .timesheet-nav,
.dark-mode .timesheet-nav,
.theme-dark .nav-left,
.dark-mode .nav-left,
.theme-dark .nav-center,
.dark-mode .nav-center {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .view-tabs,
.dark-mode .view-tabs {
  background-color: var(--bg-secondary) !important;
}

.theme-dark .tab-btn,
.dark-mode .tab-btn {
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  border-color: transparent !important;
}

.theme-dark .tab-btn.active,
.dark-mode .tab-btn.active {
  background-color: var(--bg-primary) !important;
  color: var(--accent-primary) !important;
  border-bottom-color: var(--accent-primary) !important;
}

.theme-dark .tab-btn:hover,
.dark-mode .tab-btn:hover {
  background-color: rgba(102, 126, 234, 0.1) !important;
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* THEME TOGGLE BUTTON STYLING                                     */
/* ═══════════════════════════════════════════════════════════════ */

.theme-dark .theme-toggle-btn,
.dark-mode .theme-toggle-btn {
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  border: 1px solid transparent !important;
  padding: 8px !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
}

.theme-dark .theme-toggle-btn:hover,
.dark-mode .theme-toggle-btn:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
  border-color: var(--border-color) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* ADDITIONAL INLINE STYLE OVERRIDES FOR DARK MODE                 */
/* ═══════════════════════════════════════════════════════════════ */

/* Very light gray backgrounds */
.theme-dark [style*="background: rgba(249, 250, 251"],
.dark-mode [style*="background: rgba(249, 250, 251"],
.theme-dark [style*="background: rgba(245, 245, 245"],
.dark-mode [style*="background: rgba(245, 245, 245"],
.theme-dark [style*="background: #f9fafb"],
.dark-mode [style*="background: #f9fafb"],
.theme-dark [style*="background: #f5f5f5"],
.dark-mode [style*="background: #f5f5f5"] {
  background-color: var(--bg-secondary) !important;
}

/* Subtle borders */
.theme-dark [style*="border: 1px solid rgba(0, 0, 0, 0.05)"],
.dark-mode [style*="border: 1px solid rgba(0, 0, 0, 0.05)"],
.theme-dark [style*="border: 1px solid #e5e5e5"],
.dark-mode [style*="border: 1px solid #e5e5e5"] {
  border-color: var(--border-color) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* ACTIVITY ITEMS AND TASK LIST STYLING FOR DARK MODE              */
/* ═══════════════════════════════════════════════════════════════ */

/* Activity items with light blue background */
.theme-dark [style*="background: rgb(249, 250, 251)"],
.dark-mode [style*="background: rgb(249, 250, 251)"],
.theme-dark [style*="background: rgb(239, 246, 255)"],
.dark-mode [style*="background: rgb(239, 246, 255)"] {
  background-color: var(--bg-secondary) !important;
}

/* Activity item title text */
.theme-dark [style*="flex: 1"] [style*="color: #1f2937"],
.dark-mode [style*="flex: 1"] [style*="color: #1f2937"] {
  color: var(--text-primary) !important;
}

/* Activity item date/time text */
.theme-dark [style*="font-size: 12px; color: #6b7280"],
.dark-mode [style*="font-size: 12px; color: #6b7280"] {
  color: var(--text-muted) !important;
}

/* Activity item hover state - light blue background */
.theme-dark [style*="onmouseover"],
.dark-mode [style*="onmouseover"] {
  transition: background-color 0.2s ease !important;
}

/* Status badge styling in activities */
.theme-dark [style*="background: #fef08a"],
.dark-mode [style*="background: #fef08a"] {
  background-color: rgba(251, 191, 36, 0.2) !important;
  color: #fbbf24 !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* CURRENT TASKS SECTION STYLING FOR DARK MODE                     */
/* ═══════════════════════════════════════════════════════════════ */

/* Current tasks container */
.theme-dark [style*="background: rgba(249, 250, 251, 0.8)"],
.dark-mode [style*="background: rgba(249, 250, 251, 0.8)"],
.theme-dark [style*="background: rgba(249, 250, 251, 1)"],
.dark-mode [style*="background: rgba(249, 250, 251, 1)"] {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* Current tasks header text */
.theme-dark [style*="color: #374151"],
.dark-mode [style*="color: #374151"] {
  color: var(--text-secondary) !important;
}

/* Current tasks label text */
.theme-dark [style*="color: #6b7280; font-weight: 700"],
.dark-mode [style*="color: #6b7280; font-weight: 700"] {
  color: var(--text-muted) !important;
}

/* Task item in current tasks list */
.theme-dark [style*="background: rgba(255,255,255,0.8)"],
.dark-mode [style*="background: rgba(255,255,255,0.8)"] {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

/* Task item text in current tasks */
.theme-dark [style*="color: #4b5563"],
.dark-mode [style*="color: #4b5563"] {
  color: var(--text-secondary) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* INFO PANELS AND DETAIL BOXES STYLING FOR DARK MODE              */
/* ═══════════════════════════════════════════════════════════════ */

/* Info boxes with gray background */
.theme-dark [style*="background: #f3f4f6"],
.dark-mode [style*="background: #f3f4f6"],
.theme-dark [style*="padding: 10px; background"],
.dark-mode [style*="padding: 10px; background"] {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* Info box text */
.theme-dark [style*="padding: 10px; background"] [style*="color: #6b7280"],
.dark-mode [style*="padding: 10px; background"] [style*="color: #6b7280"] {
  color: var(--text-muted) !important;
}

/* Info box strong text */
.theme-dark [style*="padding: 10px; background"] strong,
.dark-mode [style*="padding: 10px; background"] strong {
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* TABLE HEADER STYLING FOR DARK MODE                              */
/* ═══════════════════════════════════════════════════════════════ */

/* Table headers - PRIMARY RULES */
.theme-dark thead,
.dark-mode thead {
  background-color: var(--bg-secondary) !important;
  display: table-header-group !important;
}

.theme-dark thead tr,
.dark-mode thead tr {
  background-color: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  display: table-row !important;
}

.theme-dark thead th,
.dark-mode thead th {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
  font-weight: 600 !important;
  padding: 12px 16px !important;
  text-align: left !important;
}

/* Table rows */
.theme-dark tbody tr,
.dark-mode tbody tr {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark tbody td,
.dark-mode tbody td {
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

/* Table row hover */
.theme-dark tbody tr:hover,
.dark-mode tbody tr:hover {
  background-color: var(--bg-secondary) !important;
}


/* ═══════════════════════════════════════════════════════════════ */
/* STATS CARD AND GRID STYLING FOR DARK MODE                       */
/* ═══════════════════════════════════════════════════════════════ */

/* White card containers with padding and border-radius */
.theme-dark [style*="background: white; border-radius: 16px"],
.dark-mode [style*="background: white; border-radius: 16px"] {
  background-color: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

/* Card shadow adjustment for dark mode */
.theme-dark [style*="box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); margin-bottom"],
.dark-mode [style*="box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); margin-bottom"] {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

/* Grid layout containers */
.theme-dark [style*="display: grid; grid-template-columns"],
.dark-mode [style*="display: grid; grid-template-columns"] {
  background-color: transparent !important;
}

/* Stats value text - large numbers */
.theme-dark [style*="font-size: 28px; font-weight: 800; color: #1f2937"],
.dark-mode [style*="font-size: 28px; font-weight: 800; color: #1f2937"] {
  color: var(--text-primary) !important;
}

/* Stats label text - uppercase */
.theme-dark [style*="font-size: 13px; font-weight: 600; color: #6b7280; text-transform: uppercase"],
.dark-mode [style*="font-size: 13px; font-weight: 600; color: #6b7280; text-transform: uppercase"] {
  color: var(--text-muted) !important;
}

/* Stats description text */
.theme-dark [style*="font-size: 12px; color: #9ca3af; margin-top: 4px"],
.dark-mode [style*="font-size: 12px; color: #9ca3af; margin-top: 4px"] {
  color: var(--text-muted) !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* ACTIVITY SECTION - DETAILED STYLING FOR DARK MODE               */
/* ═══════════════════════════════════════════════════════════════ */

/* Activity flex containers */
.theme-dark [style*="display: flex; flex-direction: column; gap: 16px"],
.dark-mode [style*="display: flex; flex-direction: column; gap: 16px"] {
  background-color: transparent !important;
}

/* Activity item card - light gray background */
.theme-dark [style*="display: flex; align-items: center; gap: 16px; padding: 16px; background: rgb(249, 250, 251)"],
.dark-mode [style*="display: flex; align-items: center; gap: 16px; padding: 16px; background: rgb(249, 250, 251)"],
.theme-dark [style*="display: flex; align-items: center; gap: 16px; padding: 16px; background: rgb(239, 246, 255)"],
.dark-mode [style*="display: flex; align-items: center; gap: 16px; padding: 16px; background: rgb(239, 246, 255)"] {
  background-color: var(--bg-secondary) !important;
  border-left-color: rgba(129, 140, 248, 0.5) !important;
}

/* Activity item hover state - convert light blue */
.theme-dark [style*="onmouseover=\"this.style.backgroundColor='#eff6ff'"],
.dark-mode [style*="onmouseover=\"this.style.backgroundColor='#eff6ff'"] {
  background-color: var(--bg-secondary) !important;
  transition: background-color 0.2s ease !important;
}

/* Activity item - title text (font-weight: 600) */
.theme-dark [style*="font-weight: 600; color: #1f2937; margin-bottom: 4px"],
.dark-mode [style*="font-weight: 600; color: #1f2937; margin-bottom: 4px"] {
  color: var(--text-primary) !important;
}

/* Activity item - date and time text */
.theme-dark [style*="font-size: 12px; color: #6b7280"][style*="2025"],
.dark-mode [style*="font-size: 12px; color: #6b7280"][style*="2025"] {
  color: var(--text-muted) !important;
}

/* Activity strong text (time values) */
.theme-dark [style*="font-size: 12px"] strong,
.dark-mode [style*="font-size: 12px"] strong {
  color: var(--text-secondary) !important;
}

/* Yellow pending badge - adjust for dark mode */
.theme-dark [style*="background: #fef08a; color: #b45309"],
.dark-mode [style*="background: #fef08a; color: #b45309"] {
  background-color: rgba(251, 191, 36, 0.2) !important;
  color: #fbbf24 !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
}

/* Activity section heading */
.theme-dark [style*="font-size: 20px; font-weight: 800; margin: 0 0 24px 0; color: #1a1a1a"],
.dark-mode [style*="font-size: 20px; font-weight: 800; margin: 0 0 24px 0; color: #1a1a1a"] {
  color: var(--text-primary) !important;
}


/* ═══════════════════════════════════════════════════════════════ */
/* THEME TOGGLE BUTTON - FIX SCROLL APPEARANCE                     */
/* ═══════════════════════════════════════════════════════════════ */

#theme-toggle-btn,
.theme-toggle-btn {
  background-color: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 0 !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  color: var(--text-secondary) !important;
  font-size: 20px !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

#theme-toggle-btn:hover,
.theme-toggle-btn:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
}

/* Remove ALL scrollbar from button - comprehensive fix */
#theme-toggle-btn::-webkit-scrollbar,
.theme-toggle-btn::-webkit-scrollbar,
#theme-toggle-btn::-webkit-scrollbar-track,
.theme-toggle-btn::-webkit-scrollbar-track,
#theme-toggle-btn::-webkit-scrollbar-thumb,
.theme-toggle-btn::-webkit-scrollbar-thumb {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  visibility: hidden !important;
}

/* Ensure button doesn't scroll in any state */
#theme-toggle-btn:hover::-webkit-scrollbar,
.theme-toggle-btn:hover::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

/* Dark mode specific button styling */
.theme-dark #theme-toggle-btn,
.dark-mode #theme-toggle-btn,
.theme-dark .theme-toggle-btn,
.dark-mode .theme-toggle-btn {
  background-color: transparent !important;
  color: var(--text-secondary) !important;
  border: none !important;
}

.theme-dark #theme-toggle-btn:hover,
.dark-mode #theme-toggle-btn:hover,
.theme-dark .theme-toggle-btn:hover,
.dark-mode .theme-toggle-btn:hover {
  background-color: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
  border-color: transparent !important;
}

/* Drone Modal Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Drone close button hover effect */
.drone-close-btn:hover {
  color: #00ff00 !important;
  transform: scale(1.2);
  transition: all 0.2s;
}

/* ═══════════════════════════════════════════════════════════════ */
/* HIDE ALL THEME TOGGLES BY DEFAULT                              */
/* ═══════════════════════════════════════════════════════════════ */

#theme-toggle-wrapper,
.theme-toggle-container,
#theme-toggle-btn,
.theme-toggle-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Only show the GAME theme toggle */
#gameThemeToggleContainer,
#gameThemeToggleContainer .theme-toggle-container,
#gameThemeToggleContainer #theme-toggle-btn,
#gameThemeToggleContainer .theme-toggle-btn {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* HEADER THEME TOGGLE - KEEP IN HEADER ONLY                       */
/* ═══════════════════════════════════════════════════════════════ */

#theme-toggle-wrapper {
  position: relative !important;
  z-index: 10 !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* GAME WRAPPER - POSITIONING CONTEXT                              */
/* ═══════════════════════════════════════════════════════════════ */

#gameNpcWrapper {
  position: relative !important;
  z-index: 50 !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* QUEST UI ANIMATIONS                                              */
/* ═══════════════════════════════════════════════════════════════ */

@keyframes slideInRight {
  from {
    transform: translateX(400px) translateY(-50%);
    opacity: 0;
  }
  to {
    transform: translateX(0) translateY(-50%);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════ */
/* GAME THEME TOGGLE - TOP CENTER POSITIONING                      */
/* ═══════════════════════════════════════════════════════════════ */

#gameThemeToggleContainer {
  position: absolute !important;
  top: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 100 !important;
  margin: 0 !important;
  padding: 0 !important;
  width: fit-content !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* GAME UI PANEL - THEME TOGGLE AND MODULE LINKS                   */
/* ═══════════════════════════════════════════════════════════════ */

/* Module links container - horizontal centered layout */
#moduleLinks {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 10px 0 !important;
  min-height: 24px !important;
}
/* Home customization content container */
#homeContentContainer {
    display: none;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
    background: rgba(36, 0, 79, 0.86);
    border: 1px solid rgba(0, 221, 255, 0.3);
    border-radius: 16px;
}

#homeContentContainer::-webkit-scrollbar {
    width: 8px;
}

#homeContentContainer::-webkit-scrollbar-track {
    background: rgba(100, 100, 100, 0.1);
    border-radius: 10px;
}

#homeContentContainer::-webkit-scrollbar-thumb {
    background: rgba(199, 125, 255, 0.6);
    border-radius: 10px;
}

#homeContentContainer::-webkit-scrollbar-thumb:hover {
    background: rgba(199, 125, 255, 0.9);
}
/* Home customization content */
#homeCustomizationContent {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

/* Center NPC name/tagline header */
#gameUIPanel h3 {
  text-align: center !important;
  width: 100% !important;
  margin: 0 auto 12px auto !important;
  display: flex !important;
  justify-content: center !important;
}


/* ===== ULTIMATE SCROLL FIX - HIGHEST PRIORITY ===== */
html, body {
  height: auto !important;
  min-height: 100vh !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  scroll-behavior: smooth !important;
}

#app, .app-container, .app-layout, .app-main, .page-content {
  height: auto !important;
  min-height: auto !important;
  overflow: visible !important;
}

/* Ensure nothing blocks wheel events */
canvas {
  touch-action: pan-y !important;
}

/* ═══════════════════════════════════════════════════════════════ */
/* COMPREHENSIVE DARK MODE OVERRIDES FOR ALL PAGES                 */
/* ═══════════════════════════════════════════════════════════════ */

/* ── Page Header backgrounds ── */
.theme-dark .page-header,
.dark-mode .page-header {
  background: var(--bg-primary) !important;
}

/* ── Calendar Page dark mode ── */
.theme-dark .calendar-page,
.dark-mode .calendar-page {
  color: var(--text-primary) !important;
}

.theme-dark .calendar-controls,
.dark-mode .calendar-controls {
  color: var(--text-primary) !important;
}

.theme-dark .view-toggle,
.dark-mode .view-toggle {
  background: var(--bg-secondary) !important;
}

.theme-dark .view-btn,
.dark-mode .view-btn {
  background: transparent !important;
  color: var(--text-secondary) !important;
}

.theme-dark .view-btn.active,
.dark-mode .view-btn.active {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .calendar-nav button,
.dark-mode .calendar-nav button {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .calendar-nav .current-date,
.dark-mode .calendar-nav .current-date {
  color: var(--text-primary) !important;
}

.theme-dark .calendar-grid,
.dark-mode .calendar-grid {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .calendar-grid th,
.dark-mode .calendar-grid th,
.theme-dark .calendar-header-cell,
.dark-mode .calendar-header-cell {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .calendar-grid td,
.dark-mode .calendar-grid td,
.theme-dark .calendar-cell,
.dark-mode .calendar-cell {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .calendar-cell.today,
.dark-mode .calendar-cell.today {
  background: rgba(255, 170, 68, 0.1) !important;
  border-color: rgba(255, 170, 68, 0.3) !important;
}

.theme-dark .calendar-cell.other-month,
.dark-mode .calendar-cell.other-month {
  background: var(--bg-secondary) !important;
  color: var(--text-muted) !important;
}

.theme-dark .task-detail-modal,
.dark-mode .task-detail-modal {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .task-detail-modal h3,
.dark-mode .task-detail-modal h3,
.theme-dark .task-detail-modal label,
.dark-mode .task-detail-modal label {
  color: var(--text-primary) !important;
}

.theme-dark .task-detail-modal p,
.dark-mode .task-detail-modal p,
.theme-dark .task-detail-modal span,
.dark-mode .task-detail-modal span {
  color: var(--text-secondary) !important;
}

/* Calendar sidebar */
.theme-dark .calendar-sidebar,
.dark-mode .calendar-sidebar,
.theme-dark [style*="calendar"] .sidebar,
.dark-mode [style*="calendar"] .sidebar {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Year view month cards */
.theme-dark .month-card,
.dark-mode .month-card {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Seller Hub dark mode ── */
.theme-dark .sh-wrap,
.dark-mode .sh-wrap {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .sh-sidebar,
.dark-mode .sh-sidebar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-sidebar-header,
.dark-mode .sh-sidebar-header {
  border-color: var(--border-color) !important;
}

.theme-dark .sh-sidebar-header h2,
.dark-mode .sh-sidebar-header h2 {
  color: var(--text-primary) !important;
}

.theme-dark .sh-sidebar-header small,
.dark-mode .sh-sidebar-header small {
  color: var(--text-muted) !important;
}

.theme-dark .sh-acc-name,
.dark-mode .sh-acc-name {
  color: var(--text-primary) !important;
}

.theme-dark .sh-acc-email,
.dark-mode .sh-acc-email {
  color: var(--text-muted) !important;
}

.theme-dark .sh-account-item:hover,
.dark-mode .sh-account-item:hover {
  background: rgba(255, 153, 68, 0.1) !important;
}

.theme-dark .sh-account-item.active,
.dark-mode .sh-account-item.active {
  background: rgba(255, 153, 68, 0.15) !important;
}

.theme-dark .sh-main,
.dark-mode .sh-main {
  background: var(--bg-primary) !important;
}

.theme-dark .sh-main-header,
.dark-mode .sh-main-header {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-main-header h3,
.dark-mode .sh-main-header h3 {
  color: var(--text-primary) !important;
}

.theme-dark .sh-sync-info,
.dark-mode .sh-sync-info {
  color: var(--text-muted) !important;
}

.theme-dark .sh-refresh-btn,
.dark-mode .sh-refresh-btn {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .sh-stat-card,
.dark-mode .sh-stat-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-stat-card .sh-label,
.dark-mode .sh-stat-card .sh-label {
  color: var(--text-muted) !important;
}

.theme-dark .sh-stat-card .sh-sub,
.dark-mode .sh-stat-card .sh-sub {
  color: var(--text-muted) !important;
}

.theme-dark .sh-tabs,
.dark-mode .sh-tabs {
  border-color: var(--border-color) !important;
}

.theme-dark .sh-tab,
.dark-mode .sh-tab {
  color: var(--text-muted) !important;
}

.theme-dark .sh-tab:hover:not(.active),
.dark-mode .sh-tab:hover:not(.active) {
  color: var(--text-primary) !important;
}

.theme-dark .sh-table,
.dark-mode .sh-table {
  background: var(--bg-secondary) !important;
}

.theme-dark .sh-table th,
.dark-mode .sh-table th {
  background: var(--bg-tertiary) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-table td,
.dark-mode .sh-table td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-overview-card,
.dark-mode .sh-overview-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-overview-card h4,
.dark-mode .sh-overview-card h4 {
  color: var(--text-primary) !important;
}

.theme-dark .sh-overview-stat,
.dark-mode .sh-overview-stat {
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-section-title,
.dark-mode .sh-section-title {
  color: var(--text-primary) !important;
}

.theme-dark .sh-connect-box,
.dark-mode .sh-connect-box {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-connect-box h2,
.dark-mode .sh-connect-box h2 {
  color: var(--text-primary) !important;
}

.theme-dark .sh-connect-box p,
.dark-mode .sh-connect-box p {
  color: var(--text-secondary) !important;
}

.theme-dark .sh-field label,
.dark-mode .sh-field label {
  color: var(--text-secondary) !important;
}

.theme-dark .sh-field input,
.dark-mode .sh-field input {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .sh-modal,
.dark-mode .sh-modal {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sh-modal h3,
.dark-mode .sh-modal h3 {
  color: var(--text-primary) !important;
}

.theme-dark .sh-cancel-btn,
.dark-mode .sh-cancel-btn {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .sh-empty,
.dark-mode .sh-empty {
  color: var(--text-muted) !important;
}

.theme-dark .sh-empty h3,
.dark-mode .sh-empty h3 {
  color: var(--text-primary) !important;
}

.theme-dark .sh-notif-item,
.dark-mode .sh-notif-item {
  border-color: var(--border-color) !important;
}

.theme-dark .sh-notif-time,
.dark-mode .sh-notif-time {
  color: var(--text-muted) !important;
}

.theme-dark .sh-add-btn,
.dark-mode .sh-add-btn {
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
}

.theme-dark .sh-mpk-btn-outline,
.dark-mode .sh-mpk-btn-outline {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .sh-mpk-empty,
.dark-mode .sh-mpk-empty {
  color: var(--text-muted) !important;
}

.theme-dark .sh-mpk-activity-item,
.dark-mode .sh-mpk-activity-item {
  border-color: var(--border-color) !important;
}

.theme-dark .sh-mpk-activity-time,
.dark-mode .sh-mpk-activity-time {
  color: var(--text-muted) !important;
}

/* ── Invoice Page dark mode ── */
.theme-dark .invoice-filters,
.dark-mode .invoice-filters,
.theme-dark .invoice-toolbar,
.dark-mode .invoice-toolbar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .invoice-table,
.dark-mode .invoice-table {
  background: var(--bg-primary) !important;
}

.theme-dark .invoice-modal,
.dark-mode .invoice-modal,
.theme-dark .invoice-form,
.dark-mode .invoice-form {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* Invoice action buttons - preserve emoji visibility */
.theme-dark .btn-icon,
.dark-mode .btn-icon {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .btn-icon:hover,
.dark-mode .btn-icon:hover {
  background: var(--bg-tertiary) !important;
  color: var(--accent-primary) !important;
}

/* ── Accounting Hub dark mode ── */
.theme-dark .accounting-page,
.dark-mode .accounting-page {
  color: var(--text-primary) !important;
}

.theme-dark .report-card,
.dark-mode .report-card,
.theme-dark [class*="report-card"],
.dark-mode [class*="report-card"] {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .journal-table,
.dark-mode .journal-table {
  background: var(--bg-primary) !important;
}

/* ── Taskboard / ProjectsPage dark mode fixes ── */
.theme-dark .filter-bar,
.dark-mode .filter-bar,
.theme-dark .taskboard-toolbar,
.dark-mode .taskboard-toolbar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .view-pill,
.dark-mode .view-pill {
  background: var(--bg-secondary) !important;
}

.theme-dark .view-pill button,
.dark-mode .view-pill button {
  color: var(--text-secondary) !important;
}

.theme-dark .view-pill button.active,
.dark-mode .view-pill button.active {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .kanban-column,
.dark-mode .kanban-column {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .kanban-column-header,
.dark-mode .kanban-column-header {
  color: var(--text-primary) !important;
}

.theme-dark .add-task-btn,
.dark-mode .add-task-btn {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Kanban task card text visibility */
.theme-dark .kanban-task h4,
.dark-mode .kanban-task h4,
.theme-dark .kanban-task .task-title,
.dark-mode .kanban-task .task-title {
  color: var(--text-primary) !important;
}

.theme-dark .kanban-task p,
.dark-mode .kanban-task p,
.theme-dark .kanban-task .task-description,
.dark-mode .kanban-task .task-description {
  color: var(--text-secondary) !important;
}

/* List view */
.theme-dark .list-view,
.dark-mode .list-view,
.theme-dark .task-list-container,
.dark-mode .task-list-container {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Global inline style overrides for white/light backgrounds ── */
.theme-dark [style*="background: white"],
.dark-mode [style*="background: white"],
.theme-dark [style*="background:white"],
.dark-mode [style*="background:white"],
.theme-dark [style*="background: #fff"],
.dark-mode [style*="background: #fff"],
.theme-dark [style*="background:#fff"],
.dark-mode [style*="background:#fff"] {
  background: var(--bg-primary) !important;
}

.theme-dark [style*="background: #f3f4f6"],
.dark-mode [style*="background: #f3f4f6"],
.theme-dark [style*="background:#f3f4f6"],
.dark-mode [style*="background:#f3f4f6"],
.theme-dark [style*="background: #f8fafc"],
.dark-mode [style*="background: #f8fafc"],
.theme-dark [style*="background:#f8fafc"],
.dark-mode [style*="background:#f8fafc"],
.theme-dark [style*="background: #fdf8f3"],
.dark-mode [style*="background: #fdf8f3"],
.theme-dark [style*="background: #fff5e6"],
.dark-mode [style*="background: #fff5e6"],
.theme-dark [style*="background: #fff8f0"],
.dark-mode [style*="background: #fff8f0"],
.theme-dark [style*="background: #ffe8cc"],
.dark-mode [style*="background: #ffe8cc"] {
  background: var(--bg-secondary) !important;
}

/* Override light inline text colors */
.theme-dark [style*="color: #3d2817"],
.dark-mode [style*="color: #3d2817"],
.theme-dark [style*="color:#3d2817"],
.dark-mode [style*="color:#3d2817"],
.theme-dark [style*="color: #5c3d2e"],
.dark-mode [style*="color: #5c3d2e"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #8b6f47"],
.dark-mode [style*="color: #8b6f47"] {
  color: var(--text-muted) !important;
}

/* Override inline light border colors */
.theme-dark [style*="border-color: #e8d4b8"],
.dark-mode [style*="border-color: #e8d4b8"],
.theme-dark [style*="border: 1px solid #e8d4b8"],
.dark-mode [style*="border: 1px solid #e8d4b8"],
.theme-dark [style*="border: 2px solid #e8d4b8"],
.dark-mode [style*="border: 2px solid #e8d4b8"],
.theme-dark [style*="border-bottom: 1px solid #e8d4b8"],
.dark-mode [style*="border-bottom: 1px solid #e8d4b8"],
.theme-dark [style*="border-right: 1px solid #e8d4b8"],
.dark-mode [style*="border-right: 1px solid #e8d4b8"],
.theme-dark [style*="border-bottom: 1px solid #f0e4d0"],
.dark-mode [style*="border-bottom: 1px solid #f0e4d0"],
.theme-dark [style*="border: 1px solid #f0e4d0"],
.dark-mode [style*="border: 1px solid #f0e4d0"] {
  border-color: var(--border-color) !important;
}

/* Override inline light rgba backgrounds */
.theme-dark [style*="background: rgba(255, 248, 240"],
.dark-mode [style*="background: rgba(255, 248, 240"],
.theme-dark [style*="background: rgba(255,248,240"],
.dark-mode [style*="background: rgba(255,248,240"],
.theme-dark [style*="background: rgba(247, 250, 252"],
.dark-mode [style*="background: rgba(247, 250, 252"],
.theme-dark [style*="background: rgba(255, 255, 255"],
.dark-mode [style*="background: rgba(255, 255, 255"],
.theme-dark [style*="background: rgba(255,255,255"],
.dark-mode [style*="background: rgba(255,255,255"] {
  background: var(--bg-secondary) !important;
}

/* Linear gradient overrides for light gradients */
.theme-dark [style*="linear-gradient(135deg, #ffffff"],
.dark-mode [style*="linear-gradient(135deg, #ffffff"],
.theme-dark [style*="linear-gradient(135deg, #f3f4f6"],
.dark-mode [style*="linear-gradient(135deg, #f3f4f6"] {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
}

/* ── Generic white background divs override ── */
.theme-dark [style*="background-color: white"],
.dark-mode [style*="background-color: white"],
.theme-dark [style*="background-color:#fff"],
.dark-mode [style*="background-color:#fff"],
.theme-dark [style*="background-color: #ffffff"],
.dark-mode [style*="background-color: #ffffff"],
.theme-dark [style*="background-color: #fff"],
.dark-mode [style*="background-color: #fff"] {
  background-color: var(--bg-primary) !important;
}

/* ── Select/dropdown dark mode ── */
.theme-dark select option,
.dark-mode select option {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* ── Search input in filters ── */
.theme-dark input[type="search"],
.dark-mode input[type="search"],
.theme-dark input[type="date"],
.dark-mode input[type="date"] {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Ensure dark mode doesn't show white flash on animations ── */
.theme-dark .task-updated,
.dark-mode .task-updated {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
}

/* ── Generic overrides for all remaining pages ── */
.theme-dark .page-content,
.dark-mode .page-content {
  color: var(--text-primary) !important;
}

/* Fix all form sections */
.theme-dark .form-section,
.dark-mode .form-section {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* Fix all stat/metric cards */
.theme-dark .stat-card,
.dark-mode .stat-card,
.theme-dark .metric-card,
.dark-mode .metric-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Fix all panel/section backgrounds */
.theme-dark .panel,
.dark-mode .panel,
.theme-dark .section,
.dark-mode .section {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

/* Ensure tooltips are visible */
.theme-dark [title],
.dark-mode [title] {
  color: var(--text-primary);
}

/* Fix filter dropdowns */
.theme-dark .filter-select,
.dark-mode .filter-select,
.theme-dark .filter-input,
.dark-mode .filter-input {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Ensure HR, Finance, Operations pages are all themed ── */
.theme-dark .data-table,
.dark-mode .data-table {
  background: var(--bg-primary) !important;
}

.theme-dark .data-table th,
.dark-mode .data-table th {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .data-table td,
.dark-mode .data-table td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .data-table tbody tr:hover,
.dark-mode .data-table tbody tr:hover {
  background: var(--bg-secondary) !important;
}

/* Fix modal overlays */
.theme-dark .modal-overlay,
.dark-mode .modal-overlay {
  background: rgba(0, 0, 0, 0.6) !important;
}

.theme-dark .modal-content,
.dark-mode .modal-content {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Badge/pill overrides ── */
.theme-dark [style*="background: #dbeafe"],
.dark-mode [style*="background: #dbeafe"] {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

.theme-dark [style*="background: #e5e7eb"],
.dark-mode [style*="background: #e5e7eb"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
}

/* ══════════════════════════════════════════════════════════
   TASKBOARD — Force bright text on kanban task cards
   ══════════════════════════════════════════════════════════ */
.theme-dark .kanban-task,
.dark-mode .kanban-task {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .kanban-task > div,
.dark-mode .kanban-task > div {
  color: var(--text-primary) !important;
}

/* Task title - must be bright white */
.theme-dark .kanban-task [style*="font-weight: 700"],
.dark-mode .kanban-task [style*="font-weight: 700"],
.theme-dark .kanban-task [style*="font-weight: 600"],
.dark-mode .kanban-task [style*="font-weight: 600"] {
  color: #ffffff !important;
}

/* Task description text */
.theme-dark .kanban-task [style*="font-size: 12px"][style*="line-height"],
.dark-mode .kanban-task [style*="font-size: 12px"][style*="line-height"],
.theme-dark .kanban-task [style*="-webkit-line-clamp"],
.dark-mode .kanban-task [style*="-webkit-line-clamp"] {
  color: #e8d4b8 !important;
}

/* Due date badges */
.theme-dark .kanban-task [style*="border-radius: 6px"][style*="font-size: 10px"],
.dark-mode .kanban-task [style*="border-radius: 6px"][style*="font-size: 10px"] {
  color: #f5e6d3 !important;
  background: rgba(100, 100, 150, 0.35) !important;
  border-color: rgba(200, 200, 200, 0.25) !important;
}

/* Kanban column background */
.theme-dark [style*="background:"][style*="border-radius: 16px"][style*="min-width"],
.dark-mode [style*="background:"][style*="border-radius: 16px"][style*="min-width"] {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* Column header text */
.theme-dark [style*="font-size: 15px"][style*="font-weight: 700"][style*="letter-spacing"],
.dark-mode [style*="font-size: 15px"][style*="font-weight: 700"][style*="letter-spacing"] {
  color: #ffffff !important;
}

/* Task count badge */
.theme-dark [style*="border-radius: 50%"][style*="font-size: 12px"][style*="font-weight: 700"],
.dark-mode [style*="border-radius: 50%"][style*="font-size: 12px"][style*="font-weight: 700"] {
  color: #ffffff !important;
}

/* Filter bar selects */
.theme-dark .kanban-container select,
.dark-mode .kanban-container select,
.theme-dark [style*="border-radius: 12px"] select,
.dark-mode [style*="border-radius: 12px"] select {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Filter bar search input */
.theme-dark [style*="border-radius: 12px"] input[type="text"],
.dark-mode [style*="border-radius: 12px"] input[type="text"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Clear button in filters */
.theme-dark [style*="cursor: pointer"][style*="color: #ef4444"],
.dark-mode [style*="cursor: pointer"][style*="color: #ef4444"] {
  color: #f87171 !important;
}

/* Add Task button in columns */
.theme-dark [style*="border: 2px dashed"],
.dark-mode [style*="border: 2px dashed"] {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-secondary) !important;
}

/* Page title / header */
.theme-dark [style*="font-size: 28px"][style*="font-weight: 800"],
.dark-mode [style*="font-size: 28px"][style*="font-weight: 800"],
.theme-dark [style*="font-size: 32px"][style*="font-weight: 800"],
.dark-mode [style*="font-size: 32px"][style*="font-weight: 800"] {
  color: #ffffff !important;
}

/* Subtitle text */
.theme-dark [style*="color: #6b7280"],
.dark-mode [style*="color: #6b7280"],
.theme-dark [style*="color:#6b7280"],
.dark-mode [style*="color:#6b7280"] {
  color: var(--text-muted) !important;
}

/* Override all #374151 text */
.theme-dark [style*="color: #374151"],
.dark-mode [style*="color: #374151"],
.theme-dark [style*="color:#374151"],
.dark-mode [style*="color:#374151"] {
  color: var(--text-primary) !important;
}

/* Override #1f2937 text */
.theme-dark [style*="color: #1f2937"],
.dark-mode [style*="color: #1f2937"],
.theme-dark [style*="color:#1f2937"],
.dark-mode [style*="color:#1f2937"] {
  color: #ffffff !important;
}

/* Override #9ca3af text */
.theme-dark [style*="color: #9ca3af"],
.dark-mode [style*="color: #9ca3af"] {
  color: var(--text-muted) !important;
}

/* Override #f9fafb backgrounds */
.theme-dark [style*="background: #f9fafb"],
.dark-mode [style*="background: #f9fafb"],
.theme-dark [style*="background:#f9fafb"],
.dark-mode [style*="background:#f9fafb"] {
  background: var(--bg-secondary) !important;
}

/* ══════════════════════════════════════════════════════════
   BRUSITE ADMIN PANEL — Dark mode overrides for all bsa-* classes
   ══════════════════════════════════════════════════════════ */
.theme-dark .bsa-wrap,
.dark-mode .bsa-wrap {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .bsa-body,
.dark-mode .bsa-body {
  background: var(--bg-primary) !important;
}

.theme-dark .bsa-section-title,
.dark-mode .bsa-section-title {
  color: var(--text-primary) !important;
}

/* Dashboard cards */
.theme-dark .bsa-card,
.dark-mode .bsa-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-card h3,
.dark-mode .bsa-card h3 {
  color: var(--text-primary) !important;
}

.theme-dark .bsa-card p,
.dark-mode .bsa-card p {
  color: var(--text-secondary) !important;
}

.theme-dark .bsa-card-arrow,
.dark-mode .bsa-card-arrow {
  color: var(--text-muted) !important;
}

.theme-dark .bsa-card:hover,
.dark-mode .bsa-card:hover {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

.theme-dark .bsa-card:hover .bsa-card-arrow,
.dark-mode .bsa-card:hover .bsa-card-arrow {
  color: var(--accent-primary) !important;
}

/* Stats */
.theme-dark .bsa-stat,
.dark-mode .bsa-stat {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-stat-val,
.dark-mode .bsa-stat-val {
  color: var(--accent-primary) !important;
}

.theme-dark .bsa-stat-label,
.dark-mode .bsa-stat-label {
  color: var(--text-secondary) !important;
}

/* Table */
.theme-dark .bsa-table,
.dark-mode .bsa-table {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-table th,
.dark-mode .bsa-table th {
  background: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-table td,
.dark-mode .bsa-table td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-table tr:hover td,
.dark-mode .bsa-table tr:hover td {
  background: var(--bg-tertiary) !important;
}

/* Buttons */
.theme-dark .bsa-btn-secondary,
.dark-mode .bsa-btn-secondary {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Badges */
.theme-dark .bsa-badge-active,
.dark-mode .bsa-badge-active {
  background: rgba(10, 125, 10, 0.2) !important;
  color: #4ade80 !important;
}

.theme-dark .bsa-badge-pending,
.dark-mode .bsa-badge-pending {
  background: rgba(184, 134, 11, 0.2) !important;
  color: #fbbf24 !important;
}

.theme-dark .bsa-badge-inactive,
.dark-mode .bsa-badge-inactive {
  background: rgba(192, 57, 43, 0.2) !important;
  color: #f87171 !important;
}

/* Forms */
.theme-dark .bsa-form,
.dark-mode .bsa-form {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-form label,
.dark-mode .bsa-form label {
  color: var(--text-secondary) !important;
}

.theme-dark .bsa-form-input,
.dark-mode .bsa-form-input,
.theme-dark .bsa-form textarea,
.dark-mode .bsa-form textarea,
.theme-dark .bsa-form select,
.dark-mode .bsa-form select {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Login */
.theme-dark .bsa-login,
.dark-mode .bsa-login {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-login h2,
.dark-mode .bsa-login h2 {
  color: var(--text-primary) !important;
}

.theme-dark .bsa-login p,
.dark-mode .bsa-login p {
  color: var(--text-secondary) !important;
}

.theme-dark .bsa-login label,
.dark-mode .bsa-login label {
  color: var(--text-secondary) !important;
}

.theme-dark .bsa-login input,
.dark-mode .bsa-login input {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* Empty state */
.theme-dark .bsa-empty h3,
.dark-mode .bsa-empty h3 {
  color: var(--text-primary) !important;
}

.theme-dark .bsa-empty p,
.dark-mode .bsa-empty p {
  color: var(--text-secondary) !important;
}

/* Back link */
.theme-dark .bsa-back,
.dark-mode .bsa-back {
  color: var(--text-muted) !important;
}

.theme-dark .bsa-back:hover,
.dark-mode .bsa-back:hover {
  color: var(--accent-primary) !important;
}

/* Messages */
.theme-dark .bsa-msg-success,
.dark-mode .bsa-msg-success {
  background: rgba(10, 125, 10, 0.15) !important;
  color: #4ade80 !important;
  border-color: rgba(10, 125, 10, 0.3) !important;
}

.theme-dark .bsa-msg-error,
.dark-mode .bsa-msg-error {
  background: rgba(192, 57, 43, 0.15) !important;
  color: #f87171 !important;
  border-color: rgba(192, 57, 43, 0.3) !important;
}

/* Admin header disconnect button */
.theme-dark .bsa-header .bsa-btn,
.dark-mode .bsa-header .bsa-btn {
  color: #ffffff !important;
}

/* Admin account badge */
.theme-dark .bsa-acc-badge,
.dark-mode .bsa-acc-badge {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

/* Admin notification cards */
.theme-dark .bsa-notif-card,
.dark-mode .bsa-notif-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .bsa-notif-card div,
.dark-mode .bsa-notif-card div {
  color: var(--text-primary) !important;
}

.theme-dark .bsa-notif-card span,
.dark-mode .bsa-notif-card span {
  color: var(--text-secondary) !important;
}

/* Admin notification filter buttons */
.theme-dark .bsa-notif-filter,
.dark-mode .bsa-notif-filter {
  color: var(--text-primary) !important;
}

.theme-dark .bsa-notif-filter.active,
.dark-mode .bsa-notif-filter.active {
  background: var(--accent-primary, #ff9944) !important;
  color: #ffffff !important;
}

/* Admin settings info and rows */
.theme-dark .bsa-settings-info,
.dark-mode .bsa-settings-info {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .bsa-settings-row,
.dark-mode .bsa-settings-row {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .bsa-settings-row div,
.dark-mode .bsa-settings-row div {
  color: var(--text-primary) !important;
}

/* ══════════════════════════════════════════════════════════
   SELLER HUB — Sub-pages: Shipping, Auctions, Collections
   Dark mode overrides for inline white backgrounds
   ══════════════════════════════════════════════════════════ */

/* Coming soon containers (Shipping, Auctions, Collections) */
.theme-dark .sh-main [style*="background:#fff"],
.dark-mode .sh-main [style*="background:#fff"],
.theme-dark .sh-main [style*="background: #fff"],
.dark-mode .sh-main [style*="background: #fff"],
.theme-dark .sh-main-content [style*="background:#fff"],
.dark-mode .sh-main-content [style*="background:#fff"] {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* Inner cards (Pickup, Meet Point, Shipping, Active, etc.) */
.theme-dark .sh-main [style*="background:#fdf8f3"],
.dark-mode .sh-main [style*="background:#fdf8f3"],
.theme-dark .sh-main-content [style*="background:#fdf8f3"],
.dark-mode .sh-main-content [style*="background:#fdf8f3"] {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

/* Text in sub-page cards */
.theme-dark .sh-main [style*="color:#5c3d2e"],
.dark-mode .sh-main [style*="color:#5c3d2e"],
.theme-dark .sh-main-content [style*="color:#5c3d2e"],
.dark-mode .sh-main-content [style*="color:#5c3d2e"] {
  color: var(--text-primary) !important;
}

.theme-dark .sh-main [style*="color:#8b6f47"],
.dark-mode .sh-main [style*="color:#8b6f47"],
.theme-dark .sh-main-content [style*="color:#8b6f47"],
.dark-mode .sh-main-content [style*="color:#8b6f47"] {
  color: var(--text-secondary) !important;
}

.theme-dark .sh-main [style*="color:#3d2817"],
.dark-mode .sh-main [style*="color:#3d2817"],
.theme-dark .sh-main-content [style*="color:#3d2817"],
.dark-mode .sh-main-content [style*="color:#3d2817"] {
  color: var(--text-primary) !important;
}

/* Section headers in sub-pages */
.theme-dark .sh-main h2,
.dark-mode .sh-main h2,
.theme-dark .sh-main h3,
.dark-mode .sh-main h3,
.theme-dark .sh-main-content h2,
.dark-mode .sh-main-content h2,
.theme-dark .sh-main-content h3,
.dark-mode .sh-main-content h3 {
  color: var(--text-primary) !important;
}

/* Sub-page descriptive text */
.theme-dark .sh-main p,
.dark-mode .sh-main p,
.theme-dark .sh-main-content p,
.dark-mode .sh-main-content p {
  color: var(--text-secondary) !important;
}

/* Notification bell dark mode - match chat icon style */
.theme-dark .notification-bell,
.dark-mode .notification-bell {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ══════════════════════════════════════════════════════════
   ADDITIONAL DARK MODE GAPS — Text colors & rgba backgrounds
   ══════════════════════════════════════════════════════════ */

/* Dark text colors that are invisible on dark backgrounds */
.theme-dark [style*="color: #333"],
.dark-mode [style*="color: #333"],
.theme-dark [style*="color:#333"],
.dark-mode [style*="color:#333"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #666"],
.dark-mode [style*="color: #666"],
.theme-dark [style*="color:#666"],
.dark-mode [style*="color:#666"] {
  color: var(--text-secondary) !important;
}

.theme-dark [style*="color: #555"],
.dark-mode [style*="color: #555"],
.theme-dark [style*="color:#555"],
.dark-mode [style*="color:#555"] {
  color: var(--text-secondary) !important;
}

.theme-dark [style*="color: #444"],
.dark-mode [style*="color: #444"],
.theme-dark [style*="color:#444"],
.dark-mode [style*="color:#444"] {
  color: var(--text-primary) !important;
}

/* Light rgba backgrounds (filter inputs, table headers) */
.theme-dark [style*="rgba(247, 250, 252"],
.dark-mode [style*="rgba(247, 250, 252"],
.theme-dark [style*="rgba(247,250,252"],
.dark-mode [style*="rgba(247,250,252"] {
  background: var(--bg-tertiary) !important;
}

.theme-dark [style*="rgba(243, 244, 246"],
.dark-mode [style*="rgba(243, 244, 246"],
.theme-dark [style*="rgba(243,244,246"],
.dark-mode [style*="rgba(243,244,246"] {
  background: var(--bg-tertiary) !important;
}

/* Light background colors used in various pages */
.theme-dark [style*="background: #f5f5f5"],
.dark-mode [style*="background: #f5f5f5"],
.theme-dark [style*="background:#f5f5f5"],
.dark-mode [style*="background:#f5f5f5"] {
  background: var(--bg-tertiary) !important;
}

.theme-dark [style*="background: #eee"],
.dark-mode [style*="background: #eee"],
.theme-dark [style*="background:#eee"],
.dark-mode [style*="background:#eee"] {
  background: var(--bg-tertiary) !important;
}

.theme-dark [style*="background: #f0f0f0"],
.dark-mode [style*="background: #f0f0f0"],
.theme-dark [style*="background:#f0f0f0"],
.dark-mode [style*="background:#f0f0f0"] {
  background: var(--bg-tertiary) !important;
}

/* Border colors commonly hardcoded */
.theme-dark [style*="border: 1px solid #ddd"],
.dark-mode [style*="border: 1px solid #ddd"],
.theme-dark [style*="border: 1px solid #e5e7eb"],
.dark-mode [style*="border: 1px solid #e5e7eb"],
.theme-dark [style*="border: 1px solid #d1d5db"],
.dark-mode [style*="border: 1px solid #d1d5db"],
.theme-dark [style*="border-bottom: 1px solid #e5e7eb"],
.dark-mode [style*="border-bottom: 1px solid #e5e7eb"],
.theme-dark [style*="border-bottom: 1px solid #ddd"],
.dark-mode [style*="border-bottom: 1px solid #ddd"] {
  border-color: var(--border-color) !important;
}

/* Knowledge Base specific: article cards, category text */
.theme-dark .kb-article-card,
.dark-mode .kb-article-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .kb-sidebar,
.dark-mode .kb-sidebar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .kb-sidebar a,
.dark-mode .kb-sidebar a,
.theme-dark .kb-sidebar li,
.dark-mode .kb-sidebar li {
  color: var(--text-primary) !important;
}

.theme-dark .kb-content,
.dark-mode .kb-content {
  color: var(--text-primary) !important;
}

/* ══════════════════════════════════════════════════════════════════
   COMPREHENSIVE DARK MODE — All remaining pages & components
   Covers: Tabs, Modals, Buttons, Cards, Tables, Inputs, Selects,
   Responsive Actions, Task Cards, Team Members, Timesheets, HR,
   Payroll, Clients, Wallet, Admin, Ops, Calendar, Proposals, etc.
   ══════════════════════════════════════════════════════════════════ */

/* ── Tab Buttons (Timesheets, Attendance, Payroll, Leave, HR) ── */
.theme-dark .tab-btn,
.dark-mode .tab-btn {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .tab-btn.active,
.dark-mode .tab-btn.active {
  background: var(--accent-primary, #ff9944) !important;
  color: #ffffff !important;
  border-color: var(--accent-primary, #ff9944) !important;
}

.theme-dark .tab-btn:hover,
.dark-mode .tab-btn:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .tabs-container,
.dark-mode .tabs-container,
.theme-dark .tabs,
.dark-mode .tabs {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── Responsive Actions Bar (Clients, Team Members, Payroll) ── */
.theme-dark .responsive-actions,
.dark-mode .responsive-actions {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── Modal Content (all pages) ── */
.theme-dark .modal-content,
.dark-mode .modal-content {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .modal-header,
.dark-mode .modal-header {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .modal-body,
.dark-mode .modal-body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .modal-footer,
.dark-mode .modal-footer {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── Task Cards ── */
.theme-dark .task-card,
.dark-mode .task-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Buttons — Secondary/Default with white bg ── */
.theme-dark .btn-secondary,
.dark-mode .btn-secondary,
.theme-dark .btn.btn-secondary,
.dark-mode .btn.btn-secondary {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .btn-outline,
.dark-mode .btn-outline {
  background: transparent !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Select & Input Elements everywhere ── */
.theme-dark select,
.dark-mode select {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark input[type="text"],
.dark-mode input[type="text"],
.theme-dark input[type="email"],
.dark-mode input[type="email"],
.theme-dark input[type="password"],
.dark-mode input[type="password"],
.theme-dark input[type="number"],
.dark-mode input[type="number"],
.theme-dark input[type="tel"],
.dark-mode input[type="tel"],
.theme-dark input[type="url"],
.dark-mode input[type="url"],
.theme-dark textarea,
.dark-mode textarea {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark input::placeholder,
.dark-mode input::placeholder,
.theme-dark textarea::placeholder,
.dark-mode textarea::placeholder {
  color: var(--text-muted) !important;
}

/* ── Table styling (all pages) ── */
.theme-dark table,
.dark-mode table {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark th,
.dark-mode th {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark td,
.dark-mode td {
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark tbody tr:hover,
.dark-mode tbody tr:hover {
  background: var(--bg-secondary) !important;
}

/* ── Table Container ── */
.theme-dark .table-container,
.dark-mode .table-container {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Card backgrounds (generic) ── */
.theme-dark .card,
.dark-mode .card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Team Members Page ── */
.theme-dark .member-card,
.dark-mode .member-card,
.theme-dark .team-card,
.dark-mode .team-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Work Orders Page ── */
.theme-dark .work-order-card,
.dark-mode .work-order-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── CRM Dashboard ── */
.theme-dark .add-client-btn,
.dark-mode .add-client-btn,
.theme-dark .create-quotation-btn,
.dark-mode .create-quotation-btn,
.theme-dark .manage-projects-btn,
.dark-mode .manage-projects-btn {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Proposals ── */
.theme-dark .proposal-content,
.dark-mode .proposal-content {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .proposal-content blockquote,
.dark-mode .proposal-content blockquote {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Groups Page ── */
.theme-dark .group-card,
.dark-mode .group-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── User Management / Admin Management ── */
.theme-dark .user-management-page,
.dark-mode .user-management-page {
  color: var(--text-primary) !important;
}

/* ── Wallet Page ── */
.theme-dark .wallet-btn,
.dark-mode .wallet-btn,
.theme-dark .currency-selector,
.dark-mode .currency-selector {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Budgets & Forecast ── */
.theme-dark .budget-card,
.dark-mode .budget-card,
.theme-dark .forecast-card,
.dark-mode .forecast-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Leave Page tabs ── */
.theme-dark .leave-tab,
.dark-mode .leave-tab {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .leave-tab.active,
.dark-mode .leave-tab.active {
  background: var(--accent-primary, #10b981) !important;
  color: #ffffff !important;
}

/* ── Attendance Page ── */
.theme-dark .attendance-tab,
.dark-mode .attendance-tab {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* ── Marketplace Page dark text ── */
.theme-dark [style*="color: #000"],
.dark-mode [style*="color: #000"],
.theme-dark [style*="color:#000"],
.dark-mode [style*="color:#000"],
.theme-dark [style*="color: black"],
.dark-mode [style*="color: black"],
.theme-dark [style*="color:black"],
.dark-mode [style*="color:black"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #1a1a1a"],
.dark-mode [style*="color: #1a1a1a"],
.theme-dark [style*="color:#1a1a1a"],
.dark-mode [style*="color:#1a1a1a"] {
  color: var(--text-primary) !important;
}

/* ── Additional inline background overrides ── */
.theme-dark [style*="background: #fffbeb"],
.dark-mode [style*="background: #fffbeb"],
.theme-dark [style*="background:#fffbeb"],
.dark-mode [style*="background:#fffbeb"] {
  background: var(--bg-tertiary) !important;
}

.theme-dark [style*="background-color: white"],
.dark-mode [style*="background-color: white"],
.theme-dark [style*="background-color:white"],
.dark-mode [style*="background-color:white"],
.theme-dark [style*="background-color: #fff"],
.dark-mode [style*="background-color: #fff"],
.theme-dark [style*="background-color:#fff"],
.dark-mode [style*="background-color:#fff"],
.theme-dark [style*="background-color: #ffffff"],
.dark-mode [style*="background-color: #ffffff"],
.theme-dark [style*="background-color:#ffffff"],
.dark-mode [style*="background-color:#ffffff"] {
  background-color: var(--bg-primary) !important;
}

/* ── Inline color #64748b (muted gray used in many pages) ── */
.theme-dark [style*="color: #64748b"],
.dark-mode [style*="color: #64748b"],
.theme-dark [style*="color:#64748b"],
.dark-mode [style*="color:#64748b"] {
  color: var(--text-secondary) !important;
}

/* ── Calendar page sidebar tasks ── */
.theme-dark .tasks-sidebar,
.dark-mode .tasks-sidebar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .tasks-sidebar h3,
.dark-mode .tasks-sidebar h3 {
  color: var(--text-primary) !important;
}

/* ── Calendar grid dark mode ── */
.theme-dark .calendar-cell,
.dark-mode .calendar-cell {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .calendar-header-cell,
.dark-mode .calendar-header-cell {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* ── Dropdown menus ── */
.theme-dark .dropdown-menu,
.dark-mode .dropdown-menu,
.theme-dark .dropdown-content,
.dark-mode .dropdown-content {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .dropdown-item,
.dark-mode .dropdown-item {
  color: var(--text-primary) !important;
}

.theme-dark .dropdown-item:hover,
.dark-mode .dropdown-item:hover {
  background: var(--bg-tertiary) !important;
}

/* ── Payroll Page employee dropdown ── */
.theme-dark #employeeDropdown,
.dark-mode #employeeDropdown {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── Operations Page ── */
.theme-dark .ops-card,
.dark-mode .ops-card,
.theme-dark .operations-card,
.dark-mode .operations-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── HR Module buttons ── */
.theme-dark .hr-btn,
.dark-mode .hr-btn,
.theme-dark .hr-card,
.dark-mode .hr-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Generic: Any remaining white background containers ── */
.theme-dark [style*="background: #f8fafc"],
.dark-mode [style*="background: #f8fafc"],
.theme-dark [style*="background:#f8fafc"],
.dark-mode [style*="background:#f8fafc"] {
  background: var(--bg-secondary) !important;
}

/* ── Inline button backgrounds ── */
.theme-dark button[style*="background: white"],
.dark-mode button[style*="background: white"],
.theme-dark button[style*="background:white"],
.dark-mode button[style*="background:white"],
.theme-dark button[style*="background: #fff"],
.dark-mode button[style*="background: #fff"],
.theme-dark button[style*="background:#fff"],
.dark-mode button[style*="background:#fff"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Inline div backgrounds ── */
.theme-dark div[style*="background: white"],
.dark-mode div[style*="background: white"],
.theme-dark div[style*="background:white"],
.dark-mode div[style*="background:white"] {
  background: var(--bg-primary) !important;
}

.theme-dark div[style*="background: #fff"],
.dark-mode div[style*="background: #fff"],
.theme-dark div[style*="background:#fff"],
.dark-mode div[style*="background:#fff"] {
  background: var(--bg-primary) !important;
}

/* ── Inline select backgrounds ── */
.theme-dark select[style*="background: white"],
.dark-mode select[style*="background: white"],
.theme-dark select[style*="background:white"],
.dark-mode select[style*="background:white"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Inline input backgrounds ── */
.theme-dark input[style*="background: white"],
.dark-mode input[style*="background: white"],
.theme-dark input[style*="background:white"],
.dark-mode input[style*="background:white"],
.theme-dark input[style*="background: #f8fafc"],
.dark-mode input[style*="background: #f8fafc"],
.theme-dark input[style*="background:#f8fafc"],
.dark-mode input[style*="background:#f8fafc"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Admin Management Page ── */
.theme-dark .admin-card,
.dark-mode .admin-card,
.theme-dark .admin-panel,
.dark-mode .admin-panel {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── Tooltip, popover ── */
.theme-dark .tooltip,
.dark-mode .tooltip,
.theme-dark .popover,
.dark-mode .popover {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── Ensure text inside dark mode containers is visible ── */
.theme-dark h1, .dark-mode h1,
.theme-dark h2, .dark-mode h2,
.theme-dark h3, .dark-mode h3,
.theme-dark h4, .dark-mode h4,
.theme-dark h5, .dark-mode h5,
.theme-dark h6, .dark-mode h6 {
  color: var(--text-primary) !important;
}

.theme-dark p,
.dark-mode p {
  color: var(--text-secondary) !important;
}

.theme-dark label,
.dark-mode label {
  color: var(--text-secondary) !important;
}

.theme-dark span,
.dark-mode span {
  color: inherit;
}

/* ── Scrollbar styling for dark mode ── */
.theme-dark ::-webkit-scrollbar-track,
.dark-mode ::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.theme-dark ::-webkit-scrollbar-thumb,
.dark-mode ::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

/* ── HR/Finance/Ops page wrapper backgrounds ── */
.theme-dark .page-wrapper,
.dark-mode .page-wrapper,
.theme-dark .page-container,
.dark-mode .page-container,
.theme-dark .content-wrapper,
.dark-mode .content-wrapper {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   🌙 COMPREHENSIVE DARK MODE NUCLEAR OVERRIDES
   Last-resort high-specificity rules that override ALL hardcoded inline styles.
   These catch every remaining white background, dark text, and light-theme
   element across all pages and components.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── NUCLEAR: Force ALL backgrounds with inline white/light to dark ── */
.theme-dark [style*="background: white"],
.dark-mode [style*="background: white"],
.theme-dark [style*="background:white"],
.dark-mode [style*="background:white"],
.theme-dark [style*="background: #fff"],
.dark-mode [style*="background: #fff"],
.theme-dark [style*="background:#fff"],
.dark-mode [style*="background:#fff"],
.theme-dark [style*="background: #ffffff"],
.dark-mode [style*="background: #ffffff"],
.theme-dark [style*="background:#ffffff"],
.dark-mode [style*="background:#ffffff"] {
  background: var(--bg-secondary) !important;
}

.theme-dark [style*="background-color: white"],
.dark-mode [style*="background-color: white"],
.theme-dark [style*="background-color:white"],
.dark-mode [style*="background-color:white"],
.theme-dark [style*="background-color: #fff"],
.dark-mode [style*="background-color: #fff"],
.theme-dark [style*="background-color:#fff"],
.dark-mode [style*="background-color:#fff"],
.theme-dark [style*="background-color: #ffffff"],
.dark-mode [style*="background-color: #ffffff"],
.theme-dark [style*="background-color:#ffffff"],
.dark-mode [style*="background-color:#ffffff"] {
  background-color: var(--bg-secondary) !important;
}

/* Light gray backgrounds */
.theme-dark [style*="background: #f8fafc"],
.dark-mode [style*="background: #f8fafc"],
.theme-dark [style*="background:#f8fafc"],
.dark-mode [style*="background:#f8fafc"],
.theme-dark [style*="background: #f9fafb"],
.dark-mode [style*="background: #f9fafb"],
.theme-dark [style*="background:#f9fafb"],
.dark-mode [style*="background:#f9fafb"],
.theme-dark [style*="background: #f3f4f6"],
.dark-mode [style*="background: #f3f4f6"],
.theme-dark [style*="background:#f3f4f6"],
.dark-mode [style*="background:#f3f4f6"],
.theme-dark [style*="background: #f1f5f9"],
.dark-mode [style*="background: #f1f5f9"],
.theme-dark [style*="background:#f1f5f9"],
.dark-mode [style*="background:#f1f5f9"],
.theme-dark [style*="background: #e5e7eb"],
.dark-mode [style*="background: #e5e7eb"],
.theme-dark [style*="background:#e5e7eb"],
.dark-mode [style*="background:#e5e7eb"],
.theme-dark [style*="background: #f0f1f3"],
.dark-mode [style*="background: #f0f1f3"],
.theme-dark [style*="background:#f0f1f3"],
.dark-mode [style*="background:#f0f1f3"],
.theme-dark [style*="background: #e2e8f0"],
.dark-mode [style*="background: #e2e8f0"],
.theme-dark [style*="background:#e2e8f0"],
.dark-mode [style*="background:#e2e8f0"],
.theme-dark [style*="background: #eff6ff"],
.dark-mode [style*="background: #eff6ff"],
.theme-dark [style*="background:#eff6ff"],
.dark-mode [style*="background:#eff6ff"],
.theme-dark [style*="background: #fffbeb"],
.dark-mode [style*="background: #fffbeb"],
.theme-dark [style*="background:#fffbeb"],
.dark-mode [style*="background:#fffbeb"],
.theme-dark [style*="background: #dbeafe"],
.dark-mode [style*="background: #dbeafe"],
.theme-dark [style*="background:#dbeafe"],
.dark-mode [style*="background:#dbeafe"],
.theme-dark [style*="background: #fff5e6"],
.dark-mode [style*="background: #fff5e6"],
.theme-dark [style*="background:#fff5e6"],
.dark-mode [style*="background:#fff5e6"],
.theme-dark [style*="background: #ffe8cc"],
.dark-mode [style*="background: #ffe8cc"],
.theme-dark [style*="background:#ffe8cc"],
.dark-mode [style*="background:#ffe8cc"],
.theme-dark [style*="background: rgb(247"],
.dark-mode [style*="background: rgb(247"],
.theme-dark [style*="background: rgb(248"],
.dark-mode [style*="background: rgb(248"],
.theme-dark [style*="background: rgb(249"],
.dark-mode [style*="background: rgb(249"],
.theme-dark [style*="background: rgb(243"],
.dark-mode [style*="background: rgb(243"],
.theme-dark [style*="background: rgb(241"],
.dark-mode [style*="background: rgb(241"],
.theme-dark [style*="background: rgb(255, 245"],
.dark-mode [style*="background: rgb(255, 245"],
.theme-dark [style*="background: rgb(255, 232"],
.dark-mode [style*="background: rgb(255, 232"] {
  background: var(--bg-tertiary) !important;
}

.theme-dark [style*="background-color: #f8fafc"],
.dark-mode [style*="background-color: #f8fafc"],
.theme-dark [style*="background-color:#f8fafc"],
.dark-mode [style*="background-color:#f8fafc"],
.theme-dark [style*="background-color: #f9fafb"],
.dark-mode [style*="background-color: #f9fafb"],
.theme-dark [style*="background-color:#f9fafb"],
.dark-mode [style*="background-color:#f9fafb"],
.theme-dark [style*="background-color: #f3f4f6"],
.dark-mode [style*="background-color: #f3f4f6"],
.theme-dark [style*="background-color:#f3f4f6"],
.dark-mode [style*="background-color:#f3f4f6"],
.theme-dark [style*="background-color: #f1f5f9"],
.dark-mode [style*="background-color: #f1f5f9"],
.theme-dark [style*="background-color:#f1f5f9"],
.dark-mode [style*="background-color:#f1f5f9"] {
  background-color: var(--bg-tertiary) !important;
}

/* ── NUCLEAR: Force ALL dark text to light for dark mode ── */
.theme-dark [style*="color: #1f2937"],
.dark-mode [style*="color: #1f2937"],
.theme-dark [style*="color:#1f2937"],
.dark-mode [style*="color:#1f2937"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #374151"],
.dark-mode [style*="color: #374151"],
.theme-dark [style*="color:#374151"],
.dark-mode [style*="color:#374151"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #111827"],
.dark-mode [style*="color: #111827"],
.theme-dark [style*="color:#111827"],
.dark-mode [style*="color:#111827"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #1a1a1a"],
.dark-mode [style*="color: #1a1a1a"],
.theme-dark [style*="color:#1a1a1a"],
.dark-mode [style*="color:#1a1a1a"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #333"],
.dark-mode [style*="color: #333"],
.theme-dark [style*="color:#333"],
.dark-mode [style*="color:#333"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #000"],
.dark-mode [style*="color: #000"],
.theme-dark [style*="color:#000"],
.dark-mode [style*="color:#000"],
.theme-dark [style*="color: black"],
.dark-mode [style*="color: black"],
.theme-dark [style*="color:black"],
.dark-mode [style*="color:black"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #4b5563"],
.dark-mode [style*="color: #4b5563"],
.theme-dark [style*="color:#4b5563"],
.dark-mode [style*="color:#4b5563"] {
  color: var(--text-secondary) !important;
}

.theme-dark [style*="color: #6b7280"],
.dark-mode [style*="color: #6b7280"],
.theme-dark [style*="color:#6b7280"],
.dark-mode [style*="color:#6b7280"] {
  color: var(--text-muted) !important;
}

.theme-dark [style*="color: #64748b"],
.dark-mode [style*="color: #64748b"],
.theme-dark [style*="color:#64748b"],
.dark-mode [style*="color:#64748b"] {
  color: var(--text-muted) !important;
}

.theme-dark [style*="color: #9ca3af"],
.dark-mode [style*="color: #9ca3af"],
.theme-dark [style*="color:#9ca3af"],
.dark-mode [style*="color:#9ca3af"] {
  color: var(--text-muted) !important;
}

.theme-dark [style*="color: #3d2817"],
.dark-mode [style*="color: #3d2817"],
.theme-dark [style*="color:#3d2817"],
.dark-mode [style*="color:#3d2817"] {
  color: var(--text-primary) !important;
}

.theme-dark [style*="color: #5c3d2e"],
.dark-mode [style*="color: #5c3d2e"],
.theme-dark [style*="color:#5c3d2e"],
.dark-mode [style*="color:#5c3d2e"] {
  color: var(--text-secondary) !important;
}

/* ── NUCLEAR: Border color overrides ── */
.theme-dark [style*="border-color: #e5e7eb"],
.dark-mode [style*="border-color: #e5e7eb"],
.theme-dark [style*="border-color:#e5e7eb"],
.dark-mode [style*="border-color:#e5e7eb"],
.theme-dark [style*="border: 1px solid #e5e7eb"],
.dark-mode [style*="border: 1px solid #e5e7eb"],
.theme-dark [style*="border: 1px solid #d1d5db"],
.dark-mode [style*="border: 1px solid #d1d5db"],
.theme-dark [style*="border: 1px solid #e2e8f0"],
.dark-mode [style*="border: 1px solid #e2e8f0"],
.theme-dark [style*="border: 2px solid #e2e8f0"],
.dark-mode [style*="border: 2px solid #e2e8f0"] {
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Tab and pill containers ── */
.theme-dark .tabs-container,
.dark-mode .tabs-container {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .tabs,
.dark-mode .tabs {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .tab-btn,
.dark-mode .tab-btn {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border-color: transparent !important;
}

.theme-dark .tab-btn.active,
.dark-mode .tab-btn.active {
  background: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
  border-bottom-color: var(--accent-primary) !important;
}

.theme-dark .tab-btn:hover,
.dark-mode .tab-btn:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: View toggle buttons (Calendar Month/Year) ── */
.theme-dark .view-toggle,
.dark-mode .view-toggle {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .view-btn,
.dark-mode .view-btn {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .view-btn.active,
.dark-mode .view-btn.active {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
}

/* ── NUCLEAR: Calendar navigation buttons ── */
.theme-dark .nav-btn,
.dark-mode .nav-btn {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .nav-btn:hover,
.dark-mode .nav-btn:hover {
  background: var(--bg-secondary) !important;
}

.theme-dark .today-btn,
.dark-mode .today-btn {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
}

.theme-dark .current-period,
.dark-mode .current-period {
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Calendar controls container ── */
.theme-dark .calendar-controls,
.dark-mode .calendar-controls {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Calendar page header ── */
.theme-dark .page-header,
.dark-mode .page-header {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Calendar year view month cards ── */
.theme-dark .year-month-card,
.dark-mode .year-month-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.theme-dark .year-month-card h3,
.dark-mode .year-month-card h3 {
  color: var(--text-primary) !important;
}

.theme-dark .year-month-card span,
.dark-mode .year-month-card span {
  color: var(--text-secondary) !important;
}

/* ── NUCLEAR: Calendar sidebar ── */
.theme-dark .tasks-sidebar,
.dark-mode .tasks-sidebar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.theme-dark .tasks-sidebar h2,
.dark-mode .tasks-sidebar h2,
.theme-dark .tasks-sidebar h3,
.dark-mode .tasks-sidebar h3 {
  color: var(--text-primary) !important;
}

.theme-dark .tasks-sidebar p,
.dark-mode .tasks-sidebar p {
  color: var(--text-muted) !important;
}

.theme-dark .sidebar-task-item,
.dark-mode .sidebar-task-item {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .sidebar-task-item span,
.dark-mode .sidebar-task-item span {
  color: var(--text-primary) !important;
}

.theme-dark .sidebar-task-item p,
.dark-mode .sidebar-task-item p {
  color: var(--text-muted) !important;
}

/* ── NUCLEAR: Tasks without due date section ── */
.theme-dark .tasks-without-due-date,
.dark-mode .tasks-without-due-date {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Calendar cells and grid ── */
.theme-dark .calendar-grid,
.dark-mode .calendar-grid {
  background: var(--bg-primary) !important;
}

.theme-dark .calendar-cell,
.dark-mode .calendar-cell {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .calendar-cell.today,
.dark-mode .calendar-cell.today {
  background: var(--bg-tertiary) !important;
  border-color: var(--accent-primary) !important;
}

.theme-dark .calendar-cell.other-month,
.dark-mode .calendar-cell.other-month {
  background: var(--bg-secondary) !important;
  color: var(--text-muted) !important;
}

.theme-dark .calendar-header-cell,
.dark-mode .calendar-header-cell {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .cell-date,
.dark-mode .cell-date {
  color: var(--text-primary) !important;
}

.theme-dark .task-item,
.dark-mode .task-item {
  color: #ffffff !important;
}

/* ── NUCLEAR: Calendar page container ── */
.theme-dark .calendar-page,
.dark-mode .calendar-page {
  background: var(--bg-primary) !important;
}

.theme-dark .calendar-main,
.dark-mode .calendar-main {
  background: var(--bg-primary) !important;
}

.theme-dark .calendar-container,
.dark-mode .calendar-container {
  background: var(--bg-primary) !important;
}

/* ── NUCLEAR: Kanban board comprehensive ── */
.theme-dark .kanban-board,
.dark-mode .kanban-board {
  background: var(--bg-primary) !important;
}

.theme-dark .kanban-column,
.dark-mode .kanban-column {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .kanban-column-header,
.dark-mode .kanban-column-header {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .kanban-task,
.dark-mode .kanban-task {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.theme-dark .kanban-task:hover,
.dark-mode .kanban-task:hover {
  background: var(--bg-tertiary) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.theme-dark .kanban-tasks,
.dark-mode .kanban-tasks {
  background: transparent !important;
}

/* ── NUCLEAR: Kanban add task button ── */
.theme-dark .add-task-btn,
.dark-mode .add-task-btn,
.theme-dark [class*="add-task"],
.dark-mode [class*="add-task"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Filter bar ── */
.theme-dark .task-filter-bar,
.dark-mode .task-filter-bar,
.theme-dark .filter-bar,
.dark-mode .filter-bar {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .filter-label,
.dark-mode .filter-label {
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: All selects and inputs in dark mode ── */
.theme-dark select,
.dark-mode select {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark select option,
.dark-mode select option {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

.theme-dark input[type="text"],
.dark-mode input[type="text"],
.theme-dark input[type="search"],
.dark-mode input[type="search"],
.theme-dark input[type="email"],
.dark-mode input[type="email"],
.theme-dark input[type="password"],
.dark-mode input[type="password"],
.theme-dark input[type="number"],
.dark-mode input[type="number"],
.theme-dark input[type="date"],
.dark-mode input[type="date"],
.theme-dark input[type="time"],
.dark-mode input[type="time"],
.theme-dark input[type="datetime-local"],
.dark-mode input[type="datetime-local"],
.theme-dark input[type="tel"],
.dark-mode input[type="tel"],
.theme-dark input[type="url"],
.dark-mode input[type="url"],
.theme-dark textarea,
.dark-mode textarea {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark input::placeholder,
.dark-mode input::placeholder,
.theme-dark textarea::placeholder,
.dark-mode textarea::placeholder {
  color: var(--text-muted) !important;
}

/* ── NUCLEAR: All buttons that aren't primary action buttons ── */
.theme-dark button:not(.btn-primary):not([style*="gradient"]):not([style*="linear-gradient"]),
.dark-mode button:not(.btn-primary):not([style*="gradient"]):not([style*="linear-gradient"]) {
  color: var(--text-primary);
}

/* ── NUCLEAR: Stats cards and metric cards ── */
.theme-dark .stats-grid .stat-card,
.dark-mode .stats-grid .stat-card,
.theme-dark .stats-card,
.dark-mode .stats-card,
.theme-dark .metric-card,
.dark-mode .metric-card,
.theme-dark .stat-item,
.dark-mode .stat-item {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Task detail modal ── */
.theme-dark .modal-overlay .modal-content,
.dark-mode .modal-overlay .modal-content,
.theme-dark .modal-overlay > div,
.dark-mode .modal-overlay > div {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .modal-overlay [style*="background: white"],
.dark-mode .modal-overlay [style*="background: white"],
.theme-dark .modal-overlay [style*="background:#fff"],
.dark-mode .modal-overlay [style*="background:#fff"] {
  background: var(--bg-primary) !important;
}

/* ── NUCLEAR: Clear filter and action buttons ── */
.theme-dark #clear-filters,
.dark-mode #clear-filters,
.theme-dark .clear-btn,
.dark-mode .clear-btn {
  background: var(--error) !important;
  color: #ffffff !important;
}

/* ── NUCLEAR: View pills / view toggle ── */
.theme-dark .view-pill,
.dark-mode .view-pill {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .view-pill button,
.dark-mode .view-pill button {
  color: var(--text-secondary) !important;
  background: transparent !important;
}

.theme-dark .view-pill button.active,
.dark-mode .view-pill button.active {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
}

/* ── NUCLEAR: Table wrappers and containers ── */
.theme-dark .table-wrapper,
.dark-mode .table-wrapper,
.theme-dark .table-container,
.dark-mode .table-container,
.theme-dark .data-table-wrapper,
.dark-mode .data-table-wrapper {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark table,
.dark-mode table {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark th,
.dark-mode th {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark td,
.dark-mode td {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark tbody tr:hover td,
.dark-mode tbody tr:hover td {
  background: var(--bg-secondary) !important;
}

/* ── NUCLEAR: Generic div containers with white bg ── */
.theme-dark .section-header,
.dark-mode .section-header {
  color: var(--text-primary) !important;
}

.theme-dark .section-header h2,
.dark-mode .section-header h2,
.theme-dark .section-header h3,
.dark-mode .section-header h3 {
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Badge colors for dark mode ── */
.theme-dark [style*="background: #dbeafe"],
.dark-mode [style*="background: #dbeafe"],
.theme-dark [style*="background:#dbeafe"],
.dark-mode [style*="background:#dbeafe"] {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
}

.theme-dark [style*="color: #1d4ed8"],
.dark-mode [style*="color: #1d4ed8"],
.theme-dark [style*="color:#1d4ed8"],
.dark-mode [style*="color:#1d4ed8"] {
  color: #93c5fd !important;
}

/* ── NUCLEAR: Attendance/Leave/Performance/Recruitment tabs container ── */
.theme-dark .tabs-container,
.dark-mode .tabs-container {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.theme-dark .tabs-container .tabs,
.dark-mode .tabs-container .tabs {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .tabs-container .tab-btn,
.dark-mode .tabs-container .tab-btn {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border-bottom-color: transparent !important;
}

.theme-dark .tabs-container .tab-btn.active,
.dark-mode .tabs-container .tab-btn.active {
  background: var(--bg-secondary) !important;
  color: var(--accent-primary) !important;
  border-bottom-color: var(--accent-primary) !important;
}

.theme-dark .tabs-container .tab-content,
.dark-mode .tabs-container .tab-content {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Modal backgrounds (dynamically created) ── */
.theme-dark [style*="background: white"][style*="border-radius"],
.dark-mode [style*="background: white"][style*="border-radius"] {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Scrollbar colors in dark sidebars ── */
.theme-dark [style*="scrollbar-color: #d1d5db"],
.dark-mode [style*="scrollbar-color: #d1d5db"] {
  scrollbar-color: var(--bg-tertiary) var(--bg-secondary) !important;
}

/* ── NUCLEAR: Shadow overrides ── */
.theme-dark [style*="box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05)"],
.dark-mode [style*="box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05)"] {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.theme-dark [style*="box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1)"],
.dark-mode [style*="box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1)"] {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* ── NUCLEAR: Priority badge backgrounds that need to stay visible ── */
.theme-dark [style*="background: #ef4444"],
.dark-mode [style*="background: #ef4444"],
.theme-dark [style*="background: #f59e0b"],
.dark-mode [style*="background: #f59e0b"],
.theme-dark [style*="background: #10b981"],
.dark-mode [style*="background: #10b981"],
.theme-dark [style*="background: #3b82f6"],
.dark-mode [style*="background: #3b82f6"],
.theme-dark [style*="background: #8b5cf6"],
.dark-mode [style*="background: #8b5cf6"] {
  color: #ffffff !important;
}

/* ── NUCLEAR: Close buttons and action buttons with light bg ── */
.theme-dark .modal-close,
.dark-mode .modal-close {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Gamification and game elements ── */
.theme-dark .achievement-card,
.dark-mode .achievement-card,
.theme-dark .leaderboard,
.dark-mode .leaderboard,
.theme-dark .quest-card,
.dark-mode .quest-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Knowledge base editor ── */
.theme-dark .kb-editor,
.dark-mode .kb-editor,
.theme-dark .editor-container,
.dark-mode .editor-container,
.theme-dark .kb-content,
.dark-mode .kb-content,
.theme-dark .kb-sidebar,
.dark-mode .kb-sidebar {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Share modal ── */
.theme-dark .share-modal,
.dark-mode .share-modal {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: CRM specific ── */
.theme-dark .crm-dashboard,
.dark-mode .crm-dashboard {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Date picker and calendar popup ── */
.theme-dark input[type="date"]::-webkit-calendar-picker-indicator,
.dark-mode input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) !important;
}

/* ── NUCLEAR: No due date tag ── */
.theme-dark [style*="background: #fee2e2"],
.dark-mode [style*="background: #fee2e2"],
.theme-dark [style*="background:#fee2e2"],
.dark-mode [style*="background:#fee2e2"] {
  background: rgba(239, 68, 68, 0.2) !important;
}

.theme-dark [style*="color: #dc2626"],
.dark-mode [style*="color: #dc2626"],
.theme-dark [style*="color:#dc2626"],
.dark-mode [style*="color:#dc2626"] {
  color: #fca5a5 !important;
}

/* ── NUCLEAR: Ensure taskboard title header is dark ── */
.theme-dark .taskboard-header,
.dark-mode .taskboard-header,
.theme-dark .pm-board-header,
.dark-mode .pm-board-header {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Empty state messages ── */
.theme-dark .empty-state,
.dark-mode .empty-state {
  color: var(--text-muted) !important;
}

/* ── NUCLEAR: Checkbox styling ── */
.theme-dark input[type="checkbox"],
.dark-mode input[type="checkbox"] {
  accent-color: var(--accent-primary) !important;
}

/* ── NUCLEAR: Drag handle icon ── */
.theme-dark .drag-handle,
.dark-mode .drag-handle {
  color: var(--text-muted) !important;
}

/* ── NUCLEAR: Search input specifically ── */
.theme-dark #filter-search,
.dark-mode #filter-search,
.theme-dark input[placeholder*="Search"],
.dark-mode input[placeholder*="Search"],
.theme-dark input[placeholder*="search"],
.dark-mode input[placeholder*="search"] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Generic white background override for EVERYTHING ── */
.theme-dark .page-header[style*="background: white"],
.dark-mode .page-header[style*="background: white"] {
  background: var(--bg-primary) !important;
}

/* ── NUCLEAR: Stats grid ── */
.theme-dark .stats-grid,
.dark-mode .stats-grid {
  color: var(--text-primary) !important;
}

.theme-dark .stats-grid > div,
.dark-mode .stats-grid > div {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Any remaining inline white background on ANY element ── */
.theme-dark *[style*="background: white"],
.dark-mode *[style*="background: white"] {
  background: var(--bg-secondary) !important;
}

.theme-dark *[style*="background:white"],
.dark-mode *[style*="background:white"] {
  background: var(--bg-secondary) !important;
}

.theme-dark *[style*="background: #fff;"],
.dark-mode *[style*="background: #fff;"] {
  background: var(--bg-secondary) !important;
}

.theme-dark *[style*="background:#fff;"],
.dark-mode *[style*="background:#fff;"] {
  background: var(--bg-secondary) !important;
}

.theme-dark *[style*="background: #ffffff"],
.dark-mode *[style*="background: #ffffff"] {
  background: var(--bg-secondary) !important;
}

.theme-dark *[style*="background:#ffffff"],
.dark-mode *[style*="background:#ffffff"] {
  background: var(--bg-secondary) !important;
}

/* ── NUCLEAR: PayrollPage, Forecast, Opportunities specific ── */
.theme-dark .payroll-container,
.dark-mode .payroll-container,
.theme-dark .forecast-container,
.dark-mode .forecast-container,
.theme-dark .opportunities-container,
.dark-mode .opportunities-container {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: KnowledgeBase article/editor white backgrounds ── */
.theme-dark .article-content,
.dark-mode .article-content,
.theme-dark .article-editor,
.dark-mode .article-editor {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .category-list,
.dark-mode .category-list {
  background: var(--bg-secondary) !important;
}

.theme-dark .category-item,
.dark-mode .category-item {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .category-item:hover,
.dark-mode .category-item:hover {
  background: var(--bg-tertiary) !important;
}

/* ── NUCLEAR: Taskboard column-specific override for inline styles ── */
.theme-dark .kanban-column[style],
.dark-mode .kanban-column[style] {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

.theme-dark .kanban-column-header[style],
.dark-mode .kanban-column-header[style] {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.theme-dark .kanban-task[style],
.dark-mode .kanban-task[style] {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Avatar border white to dark ── */
.theme-dark [style*="border: 2px solid white"],
.dark-mode [style*="border: 2px solid white"] {
  border-color: var(--border-color) !important;
}

/* ── NUCLEAR: Requests, Payments, Cards page containers ── */
.theme-dark .request-card,
.dark-mode .request-card,
.theme-dark .payment-card,
.dark-mode .payment-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Invoice and quotation ── */
.theme-dark .invoice-container,
.dark-mode .invoice-container,
.theme-dark .quotation-container,
.dark-mode .quotation-container {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Scrollbar styling for all dark mode elements ── */
.theme-dark ::-webkit-scrollbar-track,
.dark-mode ::-webkit-scrollbar-track {
  background: var(--bg-primary) !important;
}

.theme-dark ::-webkit-scrollbar-thumb,
.dark-mode ::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary) !important;
  border-radius: 4px !important;
}

.theme-dark ::-webkit-scrollbar-thumb:hover,
.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: var(--border-color) !important;
}

/* ── NUCLEAR: Ensure ALL text inside dark mode is readable ── */
.theme-dark *,
.dark-mode * {
  border-color: var(--border-color);
}

/* DO NOT override color on everything - only on elements that need it */
.theme-dark .page-wrapper *:not([style*="color: white"]):not([style*="color: #fff"]):not([style*="color:#fff"]):not([style*="color: #ffffff"]):not([style*="color:#ffffff"]):not([class*="priority"]):not([class*="badge"]):not(.btn-primary),
.dark-mode .page-wrapper *:not([style*="color: white"]):not([style*="color: #fff"]):not([style*="color:#fff"]):not([style*="color: #ffffff"]):not([style*="color:#ffffff"]):not([class*="priority"]):not([class*="badge"]):not(.btn-primary) {
  /* Let CSS variables handle it through inheritance */
}

/* ── NUCLEAR: Ensure sub-elements in light-bg containers get dark text ── */
.theme-dark [style*="background: #f3f4f6"] *,
.dark-mode [style*="background: #f3f4f6"] * {
  color: var(--text-primary) !important;
}

/* ── NUCLEAR: Ensure sub-elements in white containers get dark text ── */
.theme-dark [style*="background: white"] h1,
.dark-mode [style*="background: white"] h1,
.theme-dark [style*="background: white"] h2,
.dark-mode [style*="background: white"] h2,
.theme-dark [style*="background: white"] h3,
.dark-mode [style*="background: white"] h3,
.theme-dark [style*="background: white"] p,
.dark-mode [style*="background: white"] p,
.theme-dark [style*="background: white"] span,
.dark-mode [style*="background: white"] span,
.theme-dark [style*="background: white"] label,
.dark-mode [style*="background: white"] label {
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   END OF COMPREHENSIVE DARK MODE NUCLEAR OVERRIDES
   ═══════════════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════════════
   FUTURISTIC LOGIN — Android-style animated login (2026-08-12)
   Dark space theme with aurora blobs, grid, particles, neon glow.
   ═══════════════════════════════════════════════════════════════════════ */
.futuristic-login {
  --fx-bg1: #04091a;
  --fx-bg2: #081a3a;
  --fx-bg3: #0a2a5e;
  --fx-cyan: #22d3ee;
  --fx-blue: #3b82f6;
  position: relative !important;
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(34, 211, 238, 0.16), transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(139, 92, 246, 0.16), transparent 45%),
    radial-gradient(ellipse at 70% 20%, rgba(59, 130, 246, 0.12), transparent 40%),
    linear-gradient(150deg, var(--fx-bg1) 0%, var(--fx-bg2) 55%, var(--fx-bg3) 100%) !important;
  overflow: hidden !important;
  padding: 24px !important;
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

/* Aurora blobs */
.fx-aurora { position: absolute !important; border-radius: 50% !important; filter: blur(60px) !important; opacity: 0.55 !important; pointer-events: none !important; will-change: transform !important; z-index: 0 !important; }
.fx-aurora-1 { width: 520px !important; height: 520px !important; background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 70%) !important; top: -10% !important; left: -8% !important; animation: fx-drift1 22s ease-in-out infinite !important; }
.fx-aurora-2 { width: 460px !important; height: 460px !important; background: radial-gradient(circle, rgba(139, 92, 246, 0.32), transparent 70%) !important; bottom: -12% !important; right: -6% !important; animation: fx-drift2 26s ease-in-out infinite !important; }
.fx-aurora-3 { width: 420px !important; height: 420px !important; background: radial-gradient(circle, rgba(59, 130, 246, 0.3), transparent 70%) !important; top: 55% !important; left: 55% !important; animation: fx-drift3 30s ease-in-out infinite !important; }

@keyframes fx-drift1 { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(60px,40px) scale(1.12); } 66% { transform: translate(-40px,20px) scale(0.94); } }
@keyframes fx-drift2 { 0%,100% { transform: translate(0,0) scale(1); } 40% { transform: translate(-70px,-30px) scale(1.1); } 70% { transform: translate(30px,-50px) scale(0.92); } }
@keyframes fx-drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(50px,-40px) scale(1.15); } }

/* Perspective grid overlay */
.fx-grid {
  position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.06) 1px, transparent 1px) !important;
  background-size: 44px 44px !important;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 75%) !important;
  mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 75%) !important;
  animation: fx-gridmove 40s linear infinite !important;
  pointer-events: none !important;
  z-index: 0 !important;
}
@keyframes fx-gridmove { from { background-position: 0 0, 0 0; } to { background-position: 0 44px, 44px 0; } }

/* Floating particles */
.fx-particles { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; pointer-events: none !important; overflow: hidden !important; z-index: 0 !important; }
.fx-particle { position: absolute !important; border-radius: 50% !important; background: rgba(140, 215, 255, 0.85) !important; box-shadow: 0 0 8px rgba(34, 211, 238, 0.9) !important; animation: fx-rise linear infinite !important; opacity: 0 !important; }
@keyframes fx-rise { 0% { transform: translateY(20px); opacity: 0; } 12% { opacity: 0.9; } 85% { opacity: 0.55; } 100% { transform: translateY(-92vh); opacity: 0; } }

/* Scanline sweep */
.fx-scanline { position: absolute !important; left: 0 !important; right: 0 !important; height: 2px !important; background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.5), transparent) !important; animation: fx-scan 9s linear infinite !important; pointer-events: none !important; opacity: 0.5 !important; z-index: 0 !important; }
@keyframes fx-scan { 0% { top: -2%; } 100% { top: 102%; } }

/* Login card */
.fx-login-card {
  position: relative !important;
  z-index: 2 !important;
  width: min(460px, 94vw) !important;
  max-width: 460px !important;
  padding: 44px 42px 40px !important;
  border-radius: 26px !important;
  background: linear-gradient(160deg, rgba(9, 20, 44, 0.85), rgba(6, 13, 30, 0.92)) !important;
  border: 1px solid rgba(120, 180, 255, 0.18) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 40px rgba(34, 211, 238, 0.06) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  backdrop-filter: blur(18px) !important;
  text-align: center !important;
  animation: fx-cardin 0.7s cubic-bezier(0.22, 1, 0.36, 1) both !important;
}
@keyframes fx-cardin { from { opacity: 0; transform: translateY(26px) scale(0.97); filter: blur(6px); } to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } }

/* Logo */
.fx-logo-wrap { width: 96px !important; height: 96px !important; margin: 0 auto 18px !important; position: relative !important; animation: fx-float 5s ease-in-out infinite !important; }
.fx-logo-wrap::before { content: ''; position: absolute !important; inset: -12px !important; border-radius: 50% !important; background: radial-gradient(circle, rgba(34, 211, 238, 0.28), transparent 70%) !important; animation: fx-glowpulse 3s ease-in-out infinite !important; }
.fx-logo { width: 100% !important; height: 100% !important; object-fit: contain !important; border-radius: 24px !important; position: relative !important; box-shadow: 0 0 28px rgba(34, 211, 238, 0.35) !important; }
.fx-logo-fallback { display: none; width: 100% !important; height: 100% !important; border-radius: 24px !important; align-items: center !important; justify-content: center !important; font-size: 40px !important; font-weight: 900 !important; color: #fff !important; background: linear-gradient(135deg, #10b981, #059669) !important; position: relative !important; }
@keyframes fx-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes fx-glowpulse { 0%,100% { opacity: 0.5; transform: scale(0.92); } 50% { opacity: 1; transform: scale(1.08); } }

/* Kicker / title / subtitle */
.fx-kicker { margin: 0 0 8px !important; color: var(--fx-cyan) !important; font-size: 12px !important; letter-spacing: 0.22em !important; text-transform: uppercase !important; font-weight: 700 !important; }
.fx-title { margin: 0 0 8px !important; font-size: 34px !important; font-weight: 800 !important; letter-spacing: -0.5px !important; line-height: 1.1 !important;
  background: linear-gradient(120deg, #eaf6ff, #ffffff, #bfeaff) !important;
  -webkit-background-clip: text !important; background-clip: text !important; -webkit-text-fill-color: transparent !important; color: #ffffff !important; }
.fx-subtitle { margin: 0 0 30px !important; color: rgba(190, 215, 250, 0.75) !important; font-size: 15px !important; font-weight: 500 !important; }

/* Form fields */
.fx-form { text-align: left !important; margin-bottom: 6px !important; }
.fx-field { margin-bottom: 20px !important; }
.fx-label { color: rgba(205, 225, 255, 0.85) !important; font-size: 13px !important; font-weight: 600 !important; letter-spacing: 0.04em !important; margin-bottom: 8px !important; }
.fx-input { height: 52px !important; border-radius: 14px !important; border: 1px solid rgba(120, 180, 255, 0.22) !important; background: rgba(8, 16, 34, 0.7) !important; color: #f2f8ff !important; font-size: 15px !important; padding: 0 16px !important; transition: all 0.3s ease !important; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) !important; }
.fx-input:focus { border-color: var(--fx-cyan) !important; background: rgba(10, 20, 42, 0.85) !important; box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15), 0 8px 28px rgba(0, 0, 0, 0.3), 0 0 18px rgba(34, 211, 238, 0.25) !important; outline: none !important; transform: translateY(-1px) !important; }
.fx-input::placeholder { color: rgba(150, 175, 215, 0.5) !important; }

/* Submit button with shimmer sweep */
.fx-btn {
  position: relative !important; overflow: hidden !important; height: 52px !important; border-radius: 14px !important; border: none !important; font-size: 15px !important; font-weight: 800 !important; letter-spacing: 0.04em !important; color: #ffffff !important; cursor: pointer !important; text-transform: none !important;
  background: linear-gradient(120deg, #0891b2, #2563eb, #4f46e5) !important; background-size: 200% 100% !important;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35), 0 0 22px rgba(34, 211, 238, 0.18) !important;
  transition: all 0.3s ease !important;
}
.fx-btn::after { content: ''; position: absolute !important; top: 0 !important; left: -120% !important; width: 60% !important; height: 100% !important; background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent) !important; transform: skewX(-20deg) !important; animation: fx-shimmer 3.4s ease-in-out infinite !important; }
.fx-btn:hover { transform: translateY(-2px) !important; box-shadow: 0 14px 40px rgba(37, 99, 235, 0.5), 0 0 30px rgba(34, 211, 238, 0.3) !important; background-position: 100% 0 !important; }
.fx-btn:active { transform: translateY(0) !important; }
.fx-btn:disabled { opacity: 0.75 !important; cursor: wait !important; }
@keyframes fx-shimmer { 0% { left: -120%; } 60%,100% { left: 160%; } }

/* Mobile responsiveness */
@media (max-width: 560px) {
  .fx-login-card { padding: 32px 24px 28px !important; border-radius: 20px !important; }
  .fx-title { font-size: 28px !important; }
  .fx-logo-wrap { width: 80px !important; height: 80px !important; }
}

/* Dedicated styles for the Module Selector modal to avoid interference
   with other modals in the app. These rules use extremely high specificity
   to override global rules including the universal selector. */

/* Use ID + classes for maximum specificity to override * { max-width: 100% !important; } */
#moduleSelectorModal .modal-content.module-selector-modal {
  /* Force fixed proportional width - completely isolated from global styles */
  width: 50vw !important;
  max-width: 640px !important;
  min-width: 420px !important;

  /* Prevent any flexbox interference */
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  align-self: center !important;

  /* Visual styling */
  padding: 0 !important;
  border-radius: 12px !important;
  margin: 20px !important;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18) !important;
  overflow: hidden !important;
  background: white !important;
}

/* Override the global universal selector for all elements inside this specific modal */
#moduleSelectorModal .modal-content.module-selector-modal,
#moduleSelectorModal .modal-content.module-selector-modal * {
  max-width: none !important;
  box-sizing: border-box !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}

/* Make sure header and body spacing fit our constrained width */
.modal-content.module-selector-modal .modal-header {
  padding: 20px 18px !important;
}

.modal-content.module-selector-modal .modal-body {
  padding: 18px !important;
}

/* Layout for the tiles */
.modal-content.module-selector-modal .module-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 16px !important;
}

.modal-content.module-selector-modal .module-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 12px 8px !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  position: relative !important;
  overflow: visible !important;
}

.modal-content.module-selector-modal .module-item:hover {
  background: rgba(102,126,234,0.04) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

.modal-content.module-selector-modal .module-tile {
  width: 60px !important;
  height: 60px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  position: relative !important;
  z-index: 2 !important;
  overflow: visible !important;
}

.modal-content.module-selector-modal .module-icon {
  font-size: 24px !important;
  line-height: 1 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

.modal-content.module-selector-modal .module-name {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #374151 !important;
  text-align: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  margin-top: 4px !important;
}

.modal-content.module-selector-modal .module-description {
  position: absolute !important;
  bottom: 100% !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(0,0,0,0.9) !important;
  color: white !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.2s ease !important;
  pointer-events: none !important;
  z-index: 10 !important;
  margin-bottom: 8px !important;
}

.modal-content.module-selector-modal .module-item:hover .module-description {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Tablet breakpoints */
@media (max-width: 1024px) {
  .modal-content.module-selector-modal {
    width: 60vw !important;
    max-width: 560px !important;
    min-width: 360px !important;
  }

  .modal-content.module-selector-modal .module-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  .modal-content.module-selector-modal .module-item {
    padding: 10px 6px !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .modal-content.module-selector-modal .module-tile {
    width: 52px !important;
    height: 52px !important;
    overflow: visible !important;
  }

  .modal-content.module-selector-modal .module-icon {
    font-size: 20px !important;
  }
}

@media (max-width: 768px) {
  .modal-content.module-selector-modal {
    width: 78vw !important;
    max-width: 520px !important;
    min-width: 320px !important;
  }

  .modal-content.module-selector-modal .module-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .modal-content.module-selector-modal .module-item {
    padding: 10px 6px !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .modal-content.module-selector-modal .module-tile {
    width: 48px !important;
    height: 48px !important;
    overflow: visible !important;
  }

  .modal-content.module-selector-modal .module-name {
    font-size: 11px !important;
  }

  .modal-content.module-selector-modal .module-icon {
    font-size: 18px !important;
  }
}

@media (max-width: 420px) {
  .modal-content.module-selector-modal {
    width: 96vw !important;
    max-width: 96vw !important;
    min-width: 96vw !important;
    margin: 12px !important;
    max-height: calc(100vh - 24px) !important;
    overflow-y: auto !important;
  }

  .modal-content.module-selector-modal .module-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .modal-content.module-selector-modal .module-item {
    padding: 8px 4px !important;
    gap: 4px !important;
    overflow: visible !important;
  }

  .modal-content.module-selector-modal .module-tile {
    width: 44px !important;
    height: 44px !important;
    overflow: visible !important;
  }

  .modal-content.module-selector-modal .module-name {
    font-size: 10px !important;
  }

  .modal-content.module-selector-modal .module-icon {
    font-size: 16px !important;
  }
}

/* Accessibility: ensure focus outline looks good */
.modal-content.module-selector-modal .module-item:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.3) !important;
  border-radius: 10px !important;
}

/* Pastel Module Colors */
.modal-content.module-selector-modal .module-tile.user {
  background: #A7D3F5 !important; /* Pastel Sky */
}

.modal-content.module-selector-modal .module-tile.project {
  background: #C6B6E5 !important; /* Misty Lavender */
}

.modal-content.module-selector-modal .module-tile.business {
  background: #BDEBD7 !important; /* Mint Cream */
}

.modal-content.module-selector-modal .module-tile.finance {
  background: #FFCDB2 !important; /* Peach Puff */
}

.modal-content.module-selector-modal .module-tile.sales {
  background: #F6A6C8 !important; /* Baby Pink */
}

.modal-content.module-selector-modal .module-tile.hr-management {
  background: #C6E6D1 !important; /* Pale Sage */
}

.modal-content.module-selector-modal .module-tile.procurement {
  background: #A9C8F5 !important; /* Powder Blue */
}

.modal-content.module-selector-modal .module-tile.inventory {
  background: #D6A6F0 !important; /* Lilac Mist */
}

.modal-content.module-selector-modal .module-tile.account {
  background: #F2D8B5 !important; /* Warm Sand */
}

/**
 * Theme Toggle Component Styles
 */

.theme-toggle-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    color: var(--text-secondary) !important;
    font-size: 20px !important;
    outline: none !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.theme-toggle-btn:hover {
    background-color: var(--bg-secondary) !important;
    color: var(--accent-primary) !important;
}

.theme-toggle-btn:active {
    opacity: 0.8 !important;
}

.theme-toggle-container {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    overflow: hidden !important;
}

/* Dark mode specific styles for toggle */
:root.dark-mode .theme-toggle-btn {
    color: #f8fafc !important;
}

:root.light-mode .theme-toggle-btn {
    color: #64748b !important;
}

/* Accessibility */
.theme-toggle-btn:focus-visible {
    outline: 2px solid var(--accent-primary) !important;
    outline-offset: 2px !important;
}

