/* QES Field Service Scheduler Design System */

:root {
  /* Dark Theme Variables (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(30, 41, 59, 0.55);
  --bg-card-hover: rgba(30, 41, 59, 0.75);
  --border-color: rgba(255, 255, 255, 0.15);
  --border-color-focus: rgba(59, 130, 246, 0.5);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-blue: #3b82f6;
  --accent-blue-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --accent-cyan: #06b6d4;
  --accent-cyan-gradient: linear-gradient(135deg, #06b6d4, #0891b2);
  --accent-green: #10b981;
  --accent-green-gradient: linear-gradient(135deg, #10b981, #047857);
  --accent-yellow: #f59e0b;
  --accent-yellow-gradient: linear-gradient(135deg, #f59e0b, #b45309);
  --accent-red: #ef4444;
  --accent-red-gradient: linear-gradient(135deg, #ef4444, #b91c1c);
  --accent-indigo: #6366f1;
  --accent-indigo-gradient: linear-gradient(135deg, #6366f1, #4338ca);
  
  /* Gantt Schedule Type Colors (Overlay styling) */
  --color-project-onsite: rgba(16, 185, 129, 0.18);
  --color-project-onsite-border: #10b981;
  --color-project-onsite-text: #34d399;
  
  --color-project-training: rgba(245, 158, 11, 0.18);
  --color-project-training-border: #f59e0b;
  --color-project-training-text: #fbbf24;
  
  --color-travel: rgba(6, 182, 212, 0.18);
  --color-travel-border: #06b6d4;
  --color-travel-text: #22d3ee;
  
  --color-timeoff: rgba(99, 102, 241, 0.18);
  --color-timeoff-border: #6366f1;
  --color-timeoff-text: #818cf8;
  
  /* Utilities */
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --sidebar-width: 260px;
  --topbar-height: 70px;
}

/* Light Theme Overrides */
.light-theme {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(0, 0, 0, 0.12);
  --border-color-focus: rgba(37, 99, 235, 0.4);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  
  --color-project-onsite: rgba(16, 185, 129, 0.1);
  --color-project-onsite-border: #059669;
  --color-project-onsite-text: #065f46;
  
  --color-project-training: rgba(217, 119, 6, 0.1);
  --color-project-training-border: #d97706;
  --color-project-training-text: #78350f;
  
  --color-travel: rgba(8, 145, 178, 0.1);
  --color-travel-border: #0891b2;
  --color-travel-text: #164e63;
  
  --color-timeoff: rgba(79, 70, 229, 0.1);
  --color-timeoff-border: #4f46e5;
  --color-timeoff-text: #312e81;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 80% 20%, rgba(15, 23, 42, 0.65), var(--bg-primary)), url('assets/background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  position: relative;
  transition: background-color 0.4s ease, color 0.4s ease, background-image 0.4s ease;
}

body.light-theme {
  background-image: none;
}

/* Background Ambient Glows (Dark Mode Only) */
.bg-glow {
  position: absolute;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}
.bg-glow-1 {
  top: -10vw;
  right: -5vw;
  background: var(--accent-blue);
}
.bg-glow-2 {
  bottom: -10vw;
  left: -5vw;
  background: var(--accent-cyan);
}
.light-theme .bg-glow {
  opacity: 0;
}

/* App Container Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden; /* Clip the page to the viewport — scrolling is per-panel */
  position: relative;
  z-index: 1;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1.5rem 1rem;
  z-index: 10;
  overflow: hidden;
  box-sizing: border-box;
  transition: background-color 0.4s ease, border-color 0.4s ease;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0;
  gap: 0.5rem;
  flex-shrink: 0;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 0;
  overflow: hidden;
}

.brand-logo {
  height: 24px;
  width: auto;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-logo.icon-logo {
  display: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-blue);
  font-weight: 600;
}

/* The hamburger toggle always lives inside .sidebar-brand */
.menu-toggle-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.menu-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.light-theme .menu-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.07);
}

.menu-toggle-btn i {
  width: 18px;
  height: 18px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
}

.nav-item i {
  width: 20px;
  height: 20px;
  stroke-width: 1.8px;
  flex-shrink: 0;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.light-theme .nav-item:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.nav-item.active {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  font-weight: 600;
}

.light-theme .nav-item.active {
  background-color: rgba(37, 99, 235, 0.08);
  color: var(--accent-blue);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Desktop sidebar collapse (icon-only rail) */
.sidebar {
  transition: background-color 0.4s ease, border-color 0.4s ease, width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapse only applies on desktop widths — on mobile the sidebar is an
   off-canvas drawer and always shows full labels. */
@media (min-width: 1024.1px) {
  .sidebar.collapsed {
    width: 76px;
    padding: 1.5rem 0.6rem;
  }

  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .sidebar-footer button span,
  .sidebar.collapsed .sidebar-version {
    display: none !important;
  }

  .sidebar.collapsed .sidebar-brand {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .sidebar.collapsed .brand-identity {
    justify-content: center;
  }

  .sidebar.collapsed .brand-logo.full-logo {
    display: none;
  }

  .sidebar.collapsed .brand-logo.icon-logo {
    display: block;
    height: 38px;
    width: auto;
  }

  .sidebar.collapsed .menu-toggle-btn {
    margin: 0 auto;
    width: 36px;
    height: 36px;
  }

  .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem 0.5rem;
  }

  .sidebar.collapsed .sidebar-footer {
    gap: 0.5rem;
    align-items: center;
  }

  .sidebar.collapsed .sidebar-footer button {
    border: none;
    background: transparent;
    padding: 0.6rem;
    justify-content: center;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    margin: 0 auto;
  }

  .sidebar.collapsed .sidebar-footer button:hover {
    background-color: rgba(255, 255, 255, 0.05);
  }

  .light-theme .sidebar.collapsed .sidebar-footer button:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
}

.theme-toggle-btn, .db-settings-btn, .reset-btn, .arcade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  width: 100%;
}

.theme-toggle-btn:hover, .db-settings-btn:hover, .reset-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.arcade-btn:hover {
  background: rgba(234, 179, 8, 0.15) !important;
  color: #f59e0b !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.15);
}

.theme-toggle-btn i, .reset-btn i, .db-settings-btn i, .arcade-btn i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Toggle Sun/Moon display */
.sun-icon { display: none; }
.moon-icon { display: block; }
.light-theme .sun-icon { display: block; }
.light-theme .moon-icon { display: none; }

/* Main Wrapper Layout */
.main-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: 100vh;
  position: relative;
  min-width: 0;
}

/* Topbar Header styling */
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 9;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.topbar-search {
  position: relative;
  width: 320px;
}

.topbar-search input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.25s ease;
}

.topbar-search input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.badge-container {
  position: relative;
}

.icon-button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}

.icon-button:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.light-theme .icon-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.icon-button i {
  width: 20px;
  height: 20px;
}

.pulse-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  z-index: 2;
}

.alert-pulse {
  background-color: var(--accent-red);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 1.8s infinite;
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--border-color);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-blue-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content Container styling */
.content-container {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: auto; /* Allow horizontal scroll so calendar never squishes */
  position: relative;
  z-index: 2;
  min-width: 0;
}

/* Loader Styles */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  border-top-color: var(--accent-blue);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Glassmorphism Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.light-theme .glass-panel:hover {
  border-color: rgba(0, 0, 0, 0.15);
}

/* Text and Titles */
h1.page-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.75px;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

p.page-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Grid Layouts */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Stats Card widget styling */
.stats-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stats-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.stats-card-icon i {
  width: 24px;
  height: 24px;
}

.stats-card-info {
  display: flex;
  flex-direction: column;
}

.stats-card-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.stats-card-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Alert center & Dashboard rows */
.dashboard-row-2 {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 1024px) {
  .dashboard-row-2 {
    grid-template-columns: 1fr;
  }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.panel-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-header h3 i {
  width: 18px;
  height: 18px;
}

/* Alerts List widget styling */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.light-theme .alert-item {
  background-color: rgba(0, 0, 0, 0.01);
}

.alert-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.alert-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border-radius: 6px;
  color: white;
}

.alert-icon-wrap i {
  width: 16px;
  height: 16px;
}

.alert-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.alert-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.alert-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.alert-action-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  margin-top: 0.4rem;
  align-self: flex-start;
  transition: all 0.2s ease;
}

.alert-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* Gantt Schedule Page wrapper — entire schedule section scrolls as one unit */
.gantt-page {
  min-width: 700px;
}

/* Gantt timeline layout elements */
.gantt-outer {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  height: calc(100vh - 200px);
  width: 100%;
  min-width: 700px; /* Calendar never compresses below this — scrollbar appears instead */
}

.gantt-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.gantt-nav-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gantt-title-date {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 240px;
  text-align: center;
}

.gantt-view-selectors {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.2rem;
}

.view-btn {
  padding: 0.4rem 0.85rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.view-btn.active {
  background-color: var(--accent-blue);
  color: white;
}

/* Gantt Core Workspace */
.gantt-workspace {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
  position: relative;
  width: 100%;
  min-width: 0;
}

/* Technicians Row Headers */
.gantt-techs-panel {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.gantt-techs-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.gantt-techs-list {
  flex-grow: 1;
  overflow-y: hidden; /* Scrolled synchronously with grid-body */
}

.gantt-tech-row {
  height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  transition: background-color 0.2s ease;
}

.gantt-tech-row.primary-user-row {
  border-left: 4px solid var(--accent-blue) !important;
  background: rgba(59, 130, 246, 0.08) !important;
}

.gantt-grid-row.primary-user-row-grid {
  background-color: rgba(59, 130, 246, 0.03) !important;
}

.gantt-tech-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.gantt-tech-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-tech-specialization {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

/* Grid Scrollable Timeline */
.gantt-grid-panel {
  flex-grow: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* High-contrast scrollbar (standard properties work in Chrome + Firefox) */
  scrollbar-width: auto;
  scrollbar-color: var(--accent-blue) rgba(148, 163, 184, 0.18);
  align-items: flex-start; /* Prevent children from stretching to panel width */
}

/* Thicker, clearly visible scrollbar for engines that honor webkit pseudos */
.gantt-grid-panel::-webkit-scrollbar { height: 14px; width: 14px; }
.gantt-grid-panel::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.14);
  border-radius: 8px;
}
.gantt-grid-panel::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 8px;
  border: 3px solid var(--bg-secondary);
}
.gantt-grid-panel::-webkit-scrollbar-thumb:hover { background: #60a5fa; }

/* The calendar header doubles as a drag-to-pan handle */
.gantt-grid-header { cursor: grab; }
.gantt-grid-header.panning { cursor: grabbing; user-select: none; }

/* Clickable month/date label + month picker popup */
.gantt-title-date {
  cursor: pointer;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  transition: background 0.2s ease;
}
.gantt-title-date:hover { background: rgba(59, 130, 246, 0.12); }

.gantt-month-picker {
  position: fixed;
  z-index: 10000;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 0.75rem;
  width: 260px;
}
.gantt-month-picker .mp-year-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.gantt-month-picker .mp-year-row button {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  width: 28px; height: 28px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.gantt-month-picker .mp-year-row span {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
}
.gantt-month-picker .mp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.gantt-month-picker .mp-month {
  padding: 0.45rem 0;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.gantt-month-picker .mp-month:hover {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text-primary);
}
.gantt-month-picker .mp-month.current {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.gantt-grid-header {
  height: 48px;
  display: grid;
  /* Columns will be defined dynamically in JS using inline variables */
  grid-template-columns: repeat(var(--gantt-cols), var(--gantt-col-width, 100px));
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  background-color: var(--bg-secondary);
  z-index: 4;
  width: calc(var(--gantt-cols) * var(--gantt-col-width, 100px));
  flex-shrink: 0;
}

.gantt-grid-header.month-header-active {
  height: 68px;
  grid-template-rows: 28px 40px;
}

.gantt-techs-header.month-header-active {
  height: 68px;
  padding-top: 28px;
  box-sizing: border-box;
}

.gantt-month-header-cell {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
}

.gantt-month-header-cell span {
  position: sticky;
  left: 12px;
}

.gantt-header-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.2rem;
}

.gantt-header-cell.today {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  font-weight: 700;
}

.gantt-day-name {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.gantt-header-cell.today .gantt-day-name {
  color: var(--accent-blue);
}

.gantt-grid-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  width: calc(var(--gantt-cols) * var(--gantt-col-width, 100px));
}

.gantt-grid-row {
  height: 62px;
  display: grid;
  grid-template-columns: repeat(var(--gantt-cols), var(--gantt-col-width, 100px));
  grid-template-rows: 62px; /* Fixed single-row track so events stay contained */
  border-bottom: 1px solid var(--border-color);
  position: relative;
  background-color: rgba(255, 255, 255, 0.01);
  overflow: hidden; /* clip events that might exceed the row height */
  width: calc(var(--gantt-cols) * var(--gantt-col-width, 100px));
}

.gantt-grid-row:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.gantt-cell {
  position: relative;
  height: 100%;
  grid-row: 1; /* explicitly share row 1 with event bars */
}

.gantt-cell::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  border-right: 1px solid var(--border-color);
  z-index: 2;
  pointer-events: none;
}

.gantt-cell.today-column {
  background-color: rgba(59, 130, 246, 0.02);
}

.gantt-cell.today-column::after {
  border-right-color: rgba(59, 130, 246, 0.15);
  border-left: 1px solid rgba(59, 130, 246, 0.15);
}

/* Alternating week background shading (2-week & month views) */
.gantt-cell.alt-week-col {
  background-color: rgba(255, 255, 255, 0.025);
}

.light-theme .gantt-cell.alt-week-col {
  background-color: rgba(0, 0, 0, 0.025);
}

.gantt-header-cell.alt-week {
  background-color: rgba(255, 255, 255, 0.04);
}

.light-theme .gantt-header-cell.alt-week {
  background-color: rgba(0, 0, 0, 0.04);
}

/* Left border accent on first column of each alternate week */
.gantt-cell.week-start-col::after {
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.light-theme .gantt-cell.week-start-col::after {
  border-left: 2px solid rgba(0, 0, 0, 0.12);
}

.gantt-header-cell.week-start {
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.light-theme .gantt-header-cell.week-start {
  border-left: 2px solid rgba(0, 0, 0, 0.12);
}

/* Month view: days that belong to the previous/next month are de-emphasized */
.gantt-header-cell.other-month {
  opacity: 0.38;
}

.gantt-cell.other-month-col {
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.015) 6px,
    transparent 6px,
    transparent 12px
  );
}

.light-theme .gantt-cell.other-month-col {
  background: repeating-linear-gradient(
    -45deg,
    rgba(0, 0, 0, 0.025),
    rgba(0, 0, 0, 0.025) 6px,
    transparent 6px,
    transparent 12px
  );
}

/* Event Overlay Block */
.gantt-event {
  /* Grid-item placement — grid-column/grid-row set inline via JS */
  grid-row: 1;
  position: relative;
  min-width: 0;
  border-radius: 6px;
  border-left: 4px solid transparent;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s ease;
  height: 23px;
  /* Prevent the event bar from stretching to the full grid-row height */
  align-self: start;
}

/* Top placement for jobs, training and timeoff */
.gantt-event.event-onsite,
.gantt-event.event-training,
.gantt-event.event-timeoff {
  align-self: start;
  margin-top: 6px;
}

/* Bottom placement for travel cards so they don't overlap jobs */
.gantt-event.event-travel {
  align-self: end;
  margin-bottom: 7px;
}

.gantt-event:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
  z-index: 10;
}

.gantt-event span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.gantt-event i {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* Event Color Mapping classes */
.event-onsite {
  background: var(--color-project-onsite);
  border-left-color: var(--color-project-onsite-border);
  color: var(--color-project-onsite-text);
}
.event-training {
  background: var(--color-project-training);
  border-left-color: var(--color-project-training-border);
  color: var(--color-project-training-text);
}
.event-travel {
  background: var(--color-travel);
  border-left-color: var(--color-travel-border);
  color: var(--color-travel-text);
}
.event-timeoff {
  background: var(--color-timeoff);
  border-left-color: var(--color-timeoff-border);
  color: var(--color-timeoff-text);
}

/* Drag and Drop styles */
.gantt-grid-row.drag-over {
  background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Unassigned Jobs Sidebar Drawer */
.gantt-drawer-toggle {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-blue-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gantt-drawer-toggle:hover {
  transform: scale(1.1) rotate(5deg);
}

.gantt-drawer-toggle i {
  width: 24px;
  height: 24px;
}

.gantt-drawer-toggle .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent-red);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  border: 2px solid var(--bg-primary);
}

.gantt-drawer {
  position: absolute;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -5px 0 25px rgba(0,0,0,0.4);
  z-index: 25;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.gantt-drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.drawer-search {
  position: relative;
  margin-bottom: 1rem;
}

.drawer-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.2rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
  outline: none;
}

.drawer-search i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.drawer-jobs-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.drawer-job-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
}

.drawer-job-card:active {
  cursor: grabbing;
}

.drawer-job-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

.light-theme .drawer-job-card:hover {
  border-color: rgba(0,0,0,0.15);
}

.drawer-job-title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.drawer-job-loc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
}

.drawer-job-loc i {
  width: 12px;
  height: 12px;
}

.drawer-job-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  margin-top: 0.4rem;
}

.priority-badge {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.priority-high {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.priority-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.priority-low {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.job-type-badge {
  color: var(--text-muted);
}

/* Modals & Dialog overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  display: block;
  opacity: 1;
}

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 500px;
  max-width: 90vw;
  max-height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  z-index: 101;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.15), opacity 0.25s ease;
}

.modal-dialog.open {
  display: flex;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

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

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background-color: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.light-theme .modal-close-btn:hover {
  background-color: rgba(0,0,0,0.05);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: rgba(0,0,0,0.1);
}

.light-theme .modal-footer {
  background-color: rgba(0,0,0,0.02);
}

/* Modals Tabs in Schedule Entry */
.modal-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.5rem;
  background: var(--bg-primary);
  padding: 0.2rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.modal-tab-btn {
  padding: 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.modal-tab-btn:not(.active) {
  border-color: var(--border-color);
  background-color: rgba(255, 255, 255, 0.01);
}

.light-theme .modal-tab-btn:not(.active) {
  background-color: rgba(0, 0, 0, 0.01);
}

.modal-tab-btn:not(.active):hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.light-theme .modal-tab-btn:not(.active):hover {
  background-color: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.15);
}

.modal-tab-btn.active {
  background-color: var(--accent-blue);
  color: white;
  border-color: var(--accent-blue);
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
}

/* Form Styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-blue);
}

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

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  background-color: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.form-checkbox-label input {
  width: 16px;
  height: 16px;
}

/* Custom Buttons styles */
.btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--accent-blue-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

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

.btn-danger {
  background: var(--accent-red-gradient);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-cyan {
  background: var(--accent-cyan-gradient);
  color: white;
}

.btn-cyan:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}

.btn i {
  width: 16px;
  height: 16px;
}

/* Tooltips */
.tooltip-card {
  position: absolute;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  color: var(--text-primary);
  font-size: 0.78rem;
  z-index: 1000;
  max-width: 250px;
  pointer-events: none;
}

.tooltip-title {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.tooltip-row {
  display: flex;
  margin-top: 0.25rem;
  gap: 0.25rem;
}

.tooltip-row strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Alerts Dropdown styling */
.alerts-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  padding: 1rem;
  z-index: 50;
  display: none;
  flex-direction: column;
}

.alerts-dropdown.open {
  display: flex;
}

.alerts-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.alerts-dropdown-header h4 {
  font-family: var(--font-display);
}

.alerts-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
}

.alerts-dropdown-item {
  padding: 0.5rem;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

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

.no-alerts {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Jobs Grid/Directory layout */
.jobs-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  outline: none;
}

.jobs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .jobs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .jobs-grid {
    grid-template-columns: 1fr;
  }
}

.job-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.job-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.job-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.job-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: 1rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.job-card-details {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.job-detail-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.job-detail-row i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.job-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: auto;
}

.status-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.status-queued {
  background-color: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.status-scheduled {
  background-color: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.status-in-progress {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fde047;
}

.status-completed {
  background-color: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

/* Equipment Calibration Table styles */
.calibration-tracker {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cal-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  /* auto (not hidden) so wide tables scroll sideways on narrow screens
     instead of getting clipped */
  overflow-x: auto;
  overflow-y: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 0.9rem 1.2rem;
  font-size: 0.85rem;
}

.data-table th {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-color);
  font-weight: 700;
  color: var(--text-secondary);
}

.data-table tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.data-table td {
  color: var(--text-primary);
}

.badge-overdue {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
}

.badge-active {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
}

/* Training Matrix layout */
.training-matrix-grid {
  display: grid;
  grid-template-columns: repeat(var(--training-columns, 4), 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.matrix-header-cell {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.matrix-tech-cell {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.matrix-status-cell {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.matrix-status-cell:hover {
  background-color: var(--bg-card-hover);
}

.matrix-status-cell.completed {
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.03);
}

.matrix-status-cell.missing {
  border-color: rgba(239, 68, 68, 0.2);
  background-color: rgba(239, 68, 68, 0.02);
}

.matrix-status-icon {
  width: 18px;
  height: 18px;
  margin-bottom: 0.25rem;
}

.completed .matrix-status-icon {
  color: var(--accent-green);
}

.missing .matrix-status-icon {
  color: var(--accent-red);
}

.matrix-completed-date {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Restricted Unlock styling */
.restricted-lock-screen {
  max-width: 420px;
  margin: 6rem auto;
  text-align: center;
}

.lock-icon-wrap {
  width: 72px;
  height: 72px;
  background-color: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 50%;
  color: var(--accent-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.lock-icon-wrap i {
  width: 32px;
  height: 32px;
}

/* Technician manager card grid */
.techs-manager-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (max-width: 1024px) {
  .techs-manager-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .techs-manager-grid {
    grid-template-columns: 1fr;
  }
}

.tech-manage-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tech-manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tech-manage-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.tech-manage-date {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.tech-manage-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

/* Dialog Password confirm input wrapper */
.password-prompt-wrapper {
  margin: 1rem 0;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Database Connection & Seeding Styles */
.db-status-badge {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
  letter-spacing: 0.75px;
  font-family: var(--font-display);
}

.status-local {
  background-color: rgba(245, 158, 11, 0.12);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-connected {
  background-color: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-error {
  background-color: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.25);
  position: relative;
  cursor: pointer; /* Clickable — copies error to clipboard */
  animation: error-pulse 2s ease-in-out infinite;
}

@keyframes error-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* Styled tooltip for sync error detail — appears on hover */
.status-error[data-error-detail]::after {
  content: attr(data-error-detail);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  background: #1e1e2e;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f3f4f6;
  font-size: 0.72rem;
  font-weight: 500;
  font-family: 'Outfit', monospace;
  letter-spacing: 0;
  text-transform: none;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  width: max-content;
  max-width: 320px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Arrow pointing up to the badge */
.status-error[data-error-detail]::before {
  content: '';
  position: absolute;
  left: 10px;
  top: calc(100% + 2px);
  border: 6px solid transparent;
  border-bottom-color: rgba(239, 68, 68, 0.4);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.status-error[data-error-detail]:hover::after,
.status-error[data-error-detail]:hover::before {
  opacity: 1;
  transform: translateY(0);
}

.progress-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 1rem;
}

.progress-bar {
  height: 100%;
  background: var(--accent-green-gradient);
  width: 0%;
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* ==========================================
   AUTHENTICATION LAYOUT
   ========================================== */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 120px);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.auth-cheat-sheet {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.88rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.auth-cheat-sheet h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.auth-cheat-sheet ul {
  list-style: none;
  margin-top: 0.35rem;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-cheat-sheet li strong {
  color: var(--accent-blue);
}

/* ==========================================
   TRAINING MATRIX LEADERBOARD
   ========================================== */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 0.88rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.leaderboard-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  border-color: var(--text-secondary);
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  width: 40px;
  text-align: center;
  color: var(--text-muted);
}

.leaderboard-item.rank-1 .leaderboard-rank {
  color: #fbbf24; /* Gold */
}
.leaderboard-item.rank-2 .leaderboard-rank {
  color: #94a3b8; /* Silver */
}
.leaderboard-item.rank-3 .leaderboard-rank {
  color: #b45309; /* Bronze */
}

.leaderboard-info {
  flex-grow: 1;
  margin-left: 1rem;
}

.leaderboard-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.leaderboard-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.leaderboard-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.completions-count {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.completions-lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ==========================================
   TRIP CREATION STYLING
   ========================================== */
.trip-tech-duration-row {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1.5fr 1.5fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.trip-tech-duration-row:last-child {
  border-bottom: none;
}

.trip-tech-duration-header {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1.5fr 1.5fr;
  gap: 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border-bottom: 1px solid var(--border-color);
}

/* ==========================================
   RESUME GENERATOR PRINT LAYOUT
   ========================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-family: 'Outfit', sans-serif !important;
  }
  .no-print {
    display: none !important;
  }
}

/* ==========================================
   TUTORIAL POPUP & ONBOARDING
   ========================================== */
.tutorial-overlay {
  position: fixed;
  z-index: 10000;
  bottom: 2rem;
  right: 2rem;
  width: 380px;
  max-width: calc(100vw - 4rem);
  background: var(--card-bg);
  border: 1px solid var(--accent-blue);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  padding: 1.25rem;
  backdrop-filter: blur(16px);
  animation: slideInUp 0.3s ease-out;
}

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

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.tutorial-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tutorial-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
}

.tutorial-close:hover {
  color: var(--text-primary);
}

.tutorial-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tutorial-progress {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

/* Wide modal variant (trip creation board, etc.). NOTE: this rule used to be
   accidentally nested inside the fadeOut keyframes (missing brace) and never
   applied — which is why wide dialogs rendered cramped. */
.modal-dialog.modal-wide {
  width: 1040px;
  max-width: 94vw;
}

.mobile-only-label {
  display: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

/* ==========================================
   TRIP CREATION BOARD (tcb) — styled to match the
   "Interface usability improvement" design mockup
   ========================================== */
.modal-dialog.modal-wide.tcb-modal,
.tcb-modal {
  width: 980px;
  max-width: 94vw;
  background: #0c1119;
  border: 1px solid #1c2432;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.tcb-modal .modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid #1c2432;
}
.tcb-modal .modal-header h3 {
  color: #f3f5f9;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tcb-modal .modal-body { padding: 24px 28px 8px; }
.tcb-modal .modal-body::-webkit-scrollbar { width: 8px; height: 8px; }
.tcb-modal .modal-body::-webkit-scrollbar-thumb { background: #2a3242; border-radius: 8px; }
.tcb-modal .modal-body::-webkit-scrollbar-track { background: transparent; }
.tcb-modal .modal-footer {
  padding: 16px 28px;
  border-top: 1px solid #1c2432;
  align-items: center;
}

/* Step tabs */
.tcb-steps { display: flex; gap: 10px; margin-bottom: 22px; }
.tcb-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: #131a26;
  border: 1px solid #232c3d;
  color: #8a91a3;
  font-family: var(--font-family);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tcb-step:hover { background: #1a2130; color: #c3c8d4; }
.tcb-step.active { background: #3b7cf6; border-color: #3b7cf6; color: #fff; }
.tcb-step-badge {
  width: 21px; height: 21px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #232c3d;
  color: #8a91a3;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.tcb-step.active .tcb-step-badge { background: rgba(255, 255, 255, 0.22); color: #fff; }
.tcb-step-count {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}
.tcb-step:not(.active) .tcb-step-count { background: #232c3d; color: #a9c4ff; }

/* Form fields */
.tcb-modal .form-group label,
.tcb-modal .tcb-field > label,
.tcb-modal .tcb-dates-head label {
  color: #c3c8d4;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  display: inline-block;
}
.tcb-req { color: #f6685e; }
.tcb-modal .form-input,
.tcb-modal .form-select {
  background: #131a26;
  border: 1px solid #232c3d;
  color: #e5e8ef;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 9px;
  outline: none;
}
.tcb-modal .form-input::placeholder { color: #5b6478; }
.tcb-modal .form-input:focus,
.tcb-modal .form-select:focus { border-color: #3b7cf6; }
.tcb-modal input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.6);
  cursor: pointer;
}
.tcb-add-tpl-btn {
  width: 42px;
  background: #131a26;
  border: 1px solid #232c3d;
  color: #c3c8d4;
  border-radius: 9px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tcb-add-tpl-btn:hover { background: #1a2130; color: #fff; }

/* Project details info card */
.tcb-info-card {
  background: #131a26;
  border: 1px solid #232c3d;
  border-radius: 12px;
  padding: 16px 18px;
  display: none;
  flex-direction: column;
  gap: 6px;
  color: #c3c8d4;
  font-size: 13.5px;
}
.tcb-info-card strong { color: #f3f5f9; }

/* Trip dates segmented control */
.tcb-dates-head { display: flex; align-items: baseline; justify-content: space-between; }
.tcb-nights { color: #6b7385; font-size: 12px; }
.tcb-dates-box {
  display: flex;
  align-items: stretch;
  background: #131a26;
  border: 1px solid #232c3d;
  border-radius: 12px;
  overflow: hidden;
}
.tcb-date-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px 8px;
}
.tcb-date-cell + .tcb-date-cell { border-left: 1px solid #232c3d; }
.tcb-date-cap {
  color: #6b7385;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.tcb-date-cell input[type="date"] {
  background: transparent;
  border: none;
  color: #f3f5f9;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  padding: 0;
  outline: none;
  width: 100%;
  color-scheme: dark;
}

/* Emergency toggle */
.tcb-emergency {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 11px;
  cursor: pointer;
  background: rgba(246, 104, 94, 0.05);
  border: 1px solid rgba(246, 104, 94, 0.18);
  transition: all 0.2s ease;
}
.tcb-emergency:has(input:checked) {
  background: rgba(246, 104, 94, 0.12);
  border-color: rgba(246, 104, 94, 0.45);
}
.tcb-emergency input[type="checkbox"] { display: none; }
.tcb-toggle {
  width: 38px; height: 22px;
  border-radius: 20px;
  background: #232c3d;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.tcb-toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #8a91a3;
  transition: all 0.2s ease;
}
.tcb-emergency input:checked ~ .tcb-toggle { background: #f6685e; }
.tcb-emergency input:checked ~ .tcb-toggle .tcb-toggle-thumb { left: 19px; background: #fff; }
.tcb-emg-icon { font-size: 20px; }
.tcb-emg-text { display: flex; flex-direction: column; gap: 1px; }
.tcb-emg-title { color: #ff8983; font-weight: 700; font-size: 13.5px; }
.tcb-emg-sub { color: #c98a86; font-size: 11.5px; }

/* Section panels (site visits, durations) */
.tcb-panel {
  background: #0e141e;
  border: 1px solid #1c2432;
  border-radius: 12px;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tcb-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tcb-panel-title { color: #f3f5f9; font-weight: 700; font-size: 14px; display: block; }
.tcb-panel-sub { color: #6b7385; font-size: 11.5px; display: block; margin-top: 2px; }
.tcb-pill-btn {
  display: flex; align-items: center; gap: 6px;
  background: #131a26;
  border: 1px solid #232c3d;
  color: #dfe3ec;
  font-family: var(--font-family);
  font-size: 13px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  flex-shrink: 0;
}
.tcb-pill-btn:hover { background: #1a2130; }

/* Site visit cards */
.tcb-modal .sub-block-row {
  background: #131a26 !important;
  border: 1px solid #232c3d !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
}
.tcb-modal .sub-block-header { margin-bottom: 8px; }
.tcb-modal .sub-block-number-label { color: #6b8fef; font-weight: 700; font-size: 13.5px; }
.tcb-modal .sub-block-row .form-input {
  background: #0c1119;
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 8px;
}
.tcb-modal .remove-sub-block-btn {
  background: #2a1418 !important;
  border: 1px solid #4a1f24 !important;
  color: #f6685e !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
}
.tcb-modal .remove-sub-block-btn:hover { background: #3a1a1f !important; }

/* Travelers tab */
.tcb-trav-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}
.tcb-checklist {
  background: #131a26;
  border: 1px solid #232c3d;
  border-radius: 10px;
  overflow-y: auto;
}
.tcb-checklist::-webkit-scrollbar { width: 8px; }
.tcb-checklist::-webkit-scrollbar-thumb { background: #2a3242; border-radius: 8px; }
.tcb-modal .tech-select-item {
  padding: 10px 14px !important;
  border-bottom: 1px solid #1a2130;
  border-radius: 0 !important;
}
.tcb-modal .tech-select-item:hover { background: #171f2d; }
.tcb-modal .tech-select-item:last-child { border-bottom: none; }
.tcb-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0; }
.tcb-chip {
  display: flex; align-items: center; gap: 6px;
  background: #17223a;
  border: 1px solid #2a4a86;
  color: #a9c4ff;
  font-size: 12px; font-weight: 600;
  padding: 5px 6px 5px 10px;
  border-radius: 20px;
}
.tcb-chip button {
  background: transparent; border: none;
  color: #7ea3e8; cursor: pointer;
  display: flex; padding: 2px;
  font-size: 12px; line-height: 1;
}
.tcb-chip button:hover { color: #fff; }
.tcb-helper-sub { color: #6b7385; font-size: 11.5px; display: block; margin: -4px 0 8px; }
.tcb-dashed-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%;
  background: transparent;
  border: 1px dashed #2a3242;
  color: #8a91a3;
  font-family: var(--font-family);
  font-size: 12.5px; font-weight: 600;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
}
.tcb-dashed-btn:hover { border-color: #3b7cf6; color: #a9c4ff; }
.tcb-builder-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #1a2130;
  cursor: pointer;
  color: #e5e8ef;
  font-size: 13.5px; font-weight: 500;
}
.tcb-builder-item:hover { background: #171f2d; }
.tcb-builder-item:last-child { border-bottom: none; }

/* Durations table */
.tcb-modal .trip-tech-duration-header {
  grid-template-columns: 2fr 1fr 1fr 1fr;
  background: transparent;
  border-bottom: none;
  color: #6b7385;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 16px 8px;
}
.tcb-modal .trip-tech-duration-row {
  grid-template-columns: 2fr 1fr 1fr 1fr;
  border-top: 1px solid #1c2432;
  border-bottom: none;
  padding: 10px 16px;
}
.tcb-modal .trip-tech-duration-row .form-select,
.tcb-modal .trip-tech-duration-row .form-input {
  font-size: 12.5px !important;
  padding: 8px 10px !important;
  border-radius: 8px !important;
}
.tcb-modal .tech-name-label { color: #dfe3ec !important; font-size: 13px !important; padding-left: 0 !important; }

/* Custom calendar popover (trip dates range + single-date pickers) */
.tcb-cal-pop {
  position: fixed;
  z-index: 10050;
  background: #131a26;
  border: 1px solid #232c3d;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 16px;
  width: 300px;
  font-family: var(--font-family);
}
.tcb-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.tcb-cal-head button {
  background: transparent; border: none;
  color: #8a91a3; cursor: pointer;
  padding: 6px; border-radius: 8px;
  display: flex; align-items: center;
}
.tcb-cal-head button:hover { background: #1a2130; color: #fff; }
.tcb-cal-month { color: #f3f5f9; font-size: 13.5px; font-weight: 700; }
.tcb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin: 8px 0 2px;
}
.tcb-cal-wd { text-align: center; color: #4a5468; font-size: 10.5px; font-weight: 700; padding: 2px 0; }
.tcb-cal-day {
  width: 100%; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: #c3c8d4; font-size: 12.5px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.tcb-cal-day:hover { background: #1a2130; color: #fff; }
.tcb-cal-day.other { color: #4a5468; }
.tcb-cal-day.today { box-shadow: inset 0 0 0 1px #3b7cf6; }
.tcb-cal-day.inrange { background: rgba(59, 124, 246, 0.16); color: #a9c4ff; border-radius: 0; }
.tcb-cal-day.edge { background: #3b7cf6; color: #fff; font-weight: 700; }
.tcb-cal-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid #1c2432;
}
.tcb-cal-hint { color: #6b7385; font-size: 11.5px; }
.tcb-cal-done {
  background: #1a2130; border: none;
  color: #dfe3ec; font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 7px;
  cursor: pointer;
}
.tcb-cal-done:hover { background: #232c3d; }

/* Readonly date inputs act as popover triggers */
.tcb-modal input[type="date"][readonly]:not(:disabled) { cursor: pointer; }
.tcb-modal input[type="date"]::-webkit-calendar-picker-indicator { display: none; }

/* Role filter select beside the tech search */
.tcb-role-filter {
  width: 130px;
  flex-shrink: 0;
  font-size: 13px !important;
  padding: 10px !important;
}

/* Footer extras */
.tcb-step-note { color: #4a5468; font-size: 12px; margin-right: auto; }
.tcb-modal .modal-footer .btn-secondary {
  background: #131a26;
  border: 1px solid #232c3d;
  color: #dfe3ec;
  font-size: 13.5px; font-weight: 600;
  padding: 10px 20px;
  border-radius: 9px;
}
.tcb-modal .modal-footer .btn-secondary:hover { background: #1a2130; }
.tcb-modal .modal-footer .btn-primary {
  background: #3b7cf6;
  border: none;
  font-size: 13.5px; font-weight: 600;
  padding: 10px 20px;
  border-radius: 9px;
}
.tcb-modal .modal-footer .btn-primary:hover { background: #2f6ce0; }

@media (max-width: 768px) {
  .tcb-trav-grid { grid-template-columns: 1fr; }
  .tcb-steps { flex-direction: column; }
  .tcb-step-note { display: none; }
}

.sub-block-inner-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ==========================================
   MOBILE & TABLET RESPONSIVE STYLING
   ========================================== */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    height: 100vh;
    width: 260px;
    box-shadow: 5px 0 25px rgba(0,0,0,0.55);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .main-wrapper {
    width: 100%;
    min-width: 0;
  }
  
  .topbar {
    padding: 0 1.25rem;
  }
  
  #mobile-menu-btn {
    display: flex !important;
  }

  .sidebar-collapse-btn {
    display: none;
  }
  
  #global-create-project-btn span {
    display: none;
  }
  
  #global-create-project-btn {
    padding: 0.5rem;
    border-radius: 8px;
  }
  
  .topbar-search {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 0.75rem;
  }
  
  .topbar-search {
    width: 140px;
  }
  
  .topbar-search input {
    font-size: 0.78rem;
    padding: 0.5rem 0.5rem 0.5rem 2rem;
  }
  
  .topbar-search .search-icon {
    left: 0.75rem;
  }
  
  .topbar-actions {
    gap: 0.4rem;
  }
  
  #topbar-user-profile-container span {
    display: none;
  }
  
  #topbar-user-profile-container button {
    padding: 0.5rem;
    border-radius: 8px;
  }
  
  .content-container {
    padding: 1rem 0.75rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 1rem !important;
  }
  
  .form-group {
    width: 100% !important;
  }
  
  .gantt-outer {
    height: calc(100vh - 240px);
    height: calc(100dvh - 240px); /* dvh tracks the real visible area when the mobile browser bar shows/hides */
  }

  /* Inputs at 16px+ stop iOS Safari from auto-zooming the page on focus */
  .form-input, .form-select, .topbar-search input {
    font-size: 16px !important;
  }

  /* Comfortable touch targets */
  .btn, .nav-item {
    min-height: 42px;
  }

  /* Mobile Modal Enhancements */
  .modal-dialog {
    width: 95% !important;
    max-width: 95vw !important;
    height: 94vh !important;
    height: 94dvh !important;
    max-height: 94vh !important;
    max-height: 94dvh !important;
    top: 3% !important;
    left: 2.5% !important;
    transform: translate(0, 0) scale(1) !important;
  }
  
  .modal-dialog.open {
    transform: translate(0, 0) scale(1) !important;
  }

  .modal-body {
    padding: 1rem !important;
    overflow-y: auto !important;
    flex-grow: 1;
  }

  .modal-footer {
    padding: 0.75rem 1rem !important;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .modal-footer button {
    flex-grow: 1;
    text-align: center;
  }

  .mobile-only-label {
    display: block !important;
  }

  /* Sub-block stack style */
  .sub-block-row {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0.75rem !important;
  }

  .sub-block-inner-row {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  .sub-block-inner-row input {
    width: 100% !important;
  }

  .sub-block-row .remove-sub-block-btn {
    align-self: flex-end;
    width: 100% !important;
    margin-top: 0.25rem;
  }

  /* Tech checkboxes */
  #trip-tech-select-grid {
    max-height: 150px !important;
  }

  /* Tech checklist duration panel stacked layout */
  .trip-tech-duration-header {
    display: none !important;
  }

  .trip-tech-duration-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    padding: 0.75rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    margin-bottom: 0.75rem !important;
    background: rgba(255,255,255,0.01) !important;
  }

  .trip-tech-duration-row > * {
    width: 100% !important;
    text-align: left !important;
  }

  .trip-tech-duration-row .tech-name-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
  }
}
