/* Color scheme inspired by sablierechevrier.com - Earth tones */
:root {
  --primary-color: #6B5B4A;      /* Dark brown */
  --secondary-color: #8B7355;    /* Medium brown */
  --accent-color: #A68B5B;       /* Light brown/tan */
  --background-color: #F5F1E8;   /* Cream/beige */
  --text-color: #3D3D3D;         /* Dark gray */
  --text-light: #6B6B6B;         /* Medium gray */
  --white: #FFFFFF;
  --shadow: rgba(0, 0, 0, 0.1);
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #F5F5F5;
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Desktop Layout */
@media (min-width: 769px) {
  .mobile-header,
  .mobile-main-content,
  .mobile-only {
    display: none !important;
  }

  /* Auth page (login): show header and main on desktop; .auth-page-main is never hidden */
  .auth-page-wrapper .mobile-header {
    display: block !important;
  }

  body:not(.auth-page) {
    display: flex;
  }

  /* Desktop Sidebar */
  .desktop-sidebar {
    width: 80px;
    background: #2d5016; /* Sablière green - matches mobile header */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
  }

  .sidebar-logo {
    margin-bottom: 2rem;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 0.5rem;
  }

  .sidebar-logo-icon {
    width: 56px;
    height: 56px;
    min-width: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .sidebar-logo-icon .logo-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    align-items: center;
  }

  .sidebar-nav-group {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  /* Invisible bridge over the gap so hover is kept when moving from icon to submenu */
  .sidebar-nav-group::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 0;
    bottom: 0;
    width: 0.5rem;
  }

  .sidebar-nav-item {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    position: relative;
    z-index: 10;
  }

  .sidebar-nav-item:hover,
  .sidebar-nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }

  .sidebar-nav-item svg {
    width: 20px;
    height: 20px;
  }

  /* Sidebar Submenu */
  .sidebar-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
  }

  .sidebar-nav-group:hover .sidebar-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }

  .sidebar-submenu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    white-space: nowrap;
  }

  .sidebar-submenu a:hover {
    background: #f5f5f5;
    color: var(--primary-color);
  }

  .sidebar-submenu a:first-child {
    border-radius: 8px 8px 0 0;
  }

  .sidebar-submenu a:last-child {
    border-radius: 0 0 8px 8px;
  }

  /* Desktop Main Wrapper */
  .desktop-main-wrapper {
    flex: 1;
    margin-left: 80px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  /* Desktop Header */
  .desktop-header {
    background: white;
    padding: 0.6rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .desktop-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .header-back-button {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.6rem;
    margin-right: 0.25rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
  }
  .header-back-button:hover {
    background: rgba(107, 91, 74, 0.1);
    color: var(--secondary-color);
  }

  .desktop-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
  }

  .desktop-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
  }

  .desktop-header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }

  .user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
  }

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

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

  .user-status.available {
    color: #50C878;
  }

  .user-avatar {
    display: flex;
    align-items: center;
  }

  .avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
  }

  .header-icon-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    text-decoration: none;
  }

  .notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #E74C3C;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
  }

  /* Desktop Main Content */
  .desktop-main-content {
    flex: 1;
    padding: 2rem;
    background: #F5F5F5;
  }

  .desktop-main-content .container {
    max-width: 100%;
    padding: 0;
  }

  /* Dashboard */
  .desktop-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  /* Dashboard Tabs */
  .dashboard-tabs {
    display: flex;
    gap: 0;
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .tab-item {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
  }

  .tab-item:hover {
    color: var(--text-color);
  }

  .tab-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
  }

  /* Dashboard Widgets */
  .dashboard-widgets {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .widget-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
  }

  .dashboard-widget {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .widget-large {
    grid-column: span 1;
  }

  .widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
  }

  .widget-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
  }

  .widget-more {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
  }

  .widget-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .widget-info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .info-icon {
    font-size: 1.2rem;
  }

  .info-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .info-label {
    font-size: 0.85rem;
    color: var(--text-light);
  }

  .info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
  }

  .widget-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .progress-label {
    font-size: 0.85rem;
    color: var(--text-light);
  }

  .progress-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
  }

  .progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
  }

  .progress-fill {
    height: 100%;
    background: #50C878;
    border-radius: 4px;
    transition: width 0.3s;
  }

  .employee-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .employee-item {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .employee-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
  }

  .employee-info {
    flex: 1;
  }

  .employee-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
  }

  .employee-role {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
  }

  .employee-project {
    font-size: 0.8rem;
    color: var(--text-light);
  }

  .employee-status {
    font-size: 1.5rem;
    color: #50C878;
  }

  .modules-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .module-widget-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s;
  }

  .module-widget-card:hover {
    transform: translateY(-2px);
  }

  .module-widget-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
  }

  .module-widget-card span {
    font-size: 0.85rem;
    text-align: center;
  }

  .widget-status-chart {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
  }

  .status-chart-center {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
  }

  .status-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
  }

  .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
  }

  .activity-chart {
    height: 150px;
    background: #f9f9f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
  }

  .chart-placeholder {
    color: var(--text-light);
    font-size: 0.9rem;
  }

  .activity-stats {
    display: flex;
    justify-content: space-around;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
  }

  .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
  }

  .stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
  }

  .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
  }
}

/* Mobile Layout */
@media (max-width: 768px) {
  .desktop-sidebar,
  .desktop-header,
  .desktop-dashboard {
    display: none !important;
  }

  /* Keep .desktop-main-wrapper visible on mobile so mobile header + main content show */
  .desktop-main-wrapper {
    margin-left: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

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

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
}

/* Mobile Header */
.mobile-header {
  background: #2d5016;
  color: var(--white);
  padding: 1.5rem 0;
  box-shadow: 0 2px 10px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

@media (min-width: 769px) {
  .mobile-header {
    display: none;
  }
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

nav ul:empty {
  display: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--white);
  z-index: 1001;
}

.logo-icon {
  width: 140px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 100%;
  height: 100%;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-logo-icon {
  width: 56px;
  height: 56px;
  min-width: 0;
  background: transparent;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.desktop-sidebar .sidebar-logo-icon .logo-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.logo-text {
  font-size: 1.2rem;
  line-height: 1.2;
}

.logo-text strong {
  font-weight: 700;
}

.mobile-header-back-button {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.5rem;
  margin-right: 0.5rem;
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 6px;
  transition: background 0.2s, opacity 0.2s;
}
.mobile-header-back-button:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

nav > ul > li {
  position: relative;
}

nav a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

nav a:hover {
  opacity: 0.8;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer;
}

.dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  min-width: 200px;
  box-shadow: 0 4px 15px var(--shadow);
  border-radius: 5px;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li {
  margin: 0;
}

.dropdown-menu a {
  color: var(--text-color);
  padding: 0.75rem 1.5rem;
  display: block;
  transition: background 0.3s;
}

.dropdown-menu a:hover {
  background: var(--background-color);
  opacity: 1;
}

/* Notification dropdown (bell) — desktop & mobile */
.notification-dropdown {
  position: relative;
}
.notification-dropdown .dropdown-menu {
  left: auto;
  right: 0;
  min-width: 320px;
  max-width: min(400px, 95vw);
  max-height: 360px;
  overflow-y: auto;
  padding: 0;
}
.notification-dropdown .dropdown-menu .notification-dropdown-menu {
  padding: 0;
}
.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
  background: #f9f9f9;
}
.notification-dropdown-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.notification-mark-all-form { margin: 0; }
.notification-mark-all-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}
.notification-mark-all-btn:hover { text-decoration: underline; }
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notification-item {
  margin: 0;
  border-bottom: 1px solid #eee;
}
.notification-item:last-child { border-bottom: none; }
.notification-item.notification-empty {
  padding: 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
}
.notification-link {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.2s;
}
.notification-link:hover {
  background: #f5f5f5;
}
.notification-unread .notification-link { background: #f0f7ff; }
.notification-unread .notification-link:hover { background: #e6f0ff; }
.notification-item-title {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
}
.notification-item-message {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}
.notification-item-time {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.25rem;
}
.notification-dropdown-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid #eee;
  background: #f9f9f9;
}
.notification-view-all {
  font-size: 0.9rem;
  color: var(--primary-color);
  text-decoration: none;
}
.notification-view-all:hover { text-decoration: underline; }

.notification-push-enable-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--primary-color);
  background: transparent;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}
.notification-push-enable-btn:hover { background: #f0f0f0; }
.notification-push-enable-btn:disabled { opacity: 0.7; cursor: default; border-color: #999; color: #666; }

/* Notification full list page */
.notification-full-list { list-style: none; margin: 0; padding: 0; }
.notification-full-item { margin: 0; border-bottom: 1px solid #eee; }
.notification-full-link {
  display: block;
  padding: 1rem;
  color: var(--text-color);
  text-decoration: none;
}
.notification-full-link:hover { background: #f5f5f5; }
.notification-full-title { display: block; font-weight: 500; }
.notification-full-message { display: block; font-size: 0.9rem; color: var(--text-light); margin-top: 0.25rem; }
.notification-full-time { display: block; font-size: 0.8rem; color: #999; margin-top: 0.25rem; }

/* Mobile notification bell */
.mobile-notification-btn {
  position: relative;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: inherit;
}
.notification-dropdown-mobile {
  margin-left: auto;
  margin-right: 0.5rem;
}
.notification-dropdown-mobile .notification-badge {
  top: 2px;
  right: 2px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  gap: 5px;
}

.mobile-menu-toggle span {
  width: 25px;
  height: 3px;
  background: var(--white);
  border-radius: 3px;
  transition: all 0.3s;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Main content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

.hero {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
  color: var(--white);
  padding: 4rem 0;
  text-align: center;
  margin-bottom: 3rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px var(--shadow);
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.95;
}

.content-section {
  background: var(--white);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--shadow);
  margin-bottom: 2rem;
}

.content-section h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

.content-section p {
  color: var(--text-light);
  margin-bottom: 1rem;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.card {
  background: var(--white);
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 20px var(--shadow);
}

.card h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-light);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: var(--white);
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  transition: background 0.3s, transform 0.2s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--accent-color);
}

.btn-secondary:hover {
  background: var(--secondary-color);
}

/* Footer */
footer {
  background: #E8E8E8;
  color: var(--text-color);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

footer .container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

footer p {
  margin: 0;
  font-size: 0.9rem;
}

.footer-link {
  color: var(--text-color);
  text-decoration: underline;
  font-size: 0.9rem;
  transition: opacity 0.3s;
}

.footer-link:hover {
  opacity: 0.7;
}

@media (min-width: 769px) {
  footer {
    display: none;
  }
}

/* Install button */
#install-button {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  padding: 1rem 1.5rem;
  background: var(--accent-color);
  color: var(--white);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--shadow);
  font-weight: 500;
  transition: transform 0.3s;
}

#install-button:hover {
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
  header .container {
    flex-wrap: wrap;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  nav {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }

  nav.active {
    max-height: 75vh;
    margin-top: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  nav ul {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  nav ul li {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  nav ul li:last-child {
    border-bottom: none;
  }

  nav a {
    padding: 1rem;
    text-align: center;
    min-height: 44px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-nav-push-btn {
    width: 100%;
    padding: 1rem;
    margin: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font: inherit;
    font-size: 1rem;
    text-align: center;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
  }
  .mobile-nav-push-btn:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  .mobile-nav-push-btn:disabled {
    opacity: 0.7;
    cursor: default;
  }

  /* Mobile Dropdown */
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0;
    margin-top: 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .dropdown.active .dropdown-menu {
    max-height: 500px;
  }

  .dropdown-menu a {
    color: var(--white);
    padding: 0.75rem 1rem 0.75rem 2rem;
  }

  .dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  /* Notification dropdown: keep as popover on mobile (do not use static nav style) */
  .notification-dropdown .dropdown-menu,
  .notification-dropdown-mobile .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    max-height: 360px;
    overflow-y: auto;
    background: var(--white);
    box-shadow: 0 4px 15px var(--shadow);
    border-radius: 5px;
  }
  .notification-dropdown.active .dropdown-menu,
  .notification-dropdown-mobile.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .notification-dropdown .dropdown-menu a,
  .notification-dropdown-mobile .dropdown-menu a {
    color: var(--text-color);
    padding: 0.75rem 1rem;
  }
  .notification-dropdown .dropdown-menu a:hover,
  .notification-dropdown-mobile .dropdown-menu a:hover {
    background: #f5f5f5;
  }

  .module-card {
    padding: 1rem;
  }

  .module-icon {
    width: 48px;
    height: 48px;
  }

  .module-icon svg {
    width: 20px;
    height: 20px;
  }

  .module-content h3 {
    font-size: 1rem;
  }

  .module-content p {
    font-size: 0.85rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .dashboard-header h1 {
    font-size: 2rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .card-content .btn {
    display: block;
    width: 100%;
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  .auth-card {
    padding: 1.5rem;
  }
}

/* Messages/Alerts */
.messages {
  margin-bottom: 2rem;
}

.alert {
  padding: 1rem 1.5rem;
  border-radius: 5px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Authentication Forms */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem 0;
}

.auth-card {
  background: var(--white);
  padding: 2.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 20px var(--shadow);
  width: 100%;
  max-width: 450px;
}

.auth-card h2 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 2rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.9rem;
}

/* django-crispy-forms (uni_form) field wrappers */
.ctrlHolder {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.ctrlHolder label {
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.9rem;
}

.form-input {
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s;
  background: var(--white);
  color: var(--text-color);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-errors {
  color: #d32f2f;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.form-errors ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.btn-block {
  width: 100%;
  text-align: center;
}

.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--text-light);
}

.auth-footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Dashboard */
.dashboard-header {
  margin-bottom: 2rem;
  text-align: center;
}

.dashboard-header h1 {
  color: var(--primary-color);
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.welcome-text {
  color: var(--text-light);
  font-size: 1.1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.dashboard-card {
  background: var(--white);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 20px var(--shadow);
}

.card-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1rem;
}

.dashboard-card h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.5rem;
}

.card-content {
  color: var(--text-light);
}

.card-content p {
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

.card-content p:last-child {
  margin-bottom: 0;
}

.card-content strong {
  color: var(--text-color);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e0e0e0;
}

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

.stat-label {
  color: var(--text-light);
  font-weight: 500;
}

.stat-value {
  color: var(--primary-color);
  font-weight: 600;
}

.card-content .btn {
  margin-top: 1rem;
  margin-right: 0.5rem;
}

.card-content .btn:last-child {
  margin-right: 0;
}

/* Module List (Homepage) */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  padding: 1.25rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.module-card:active {
  transform: translateY(0);
}

.module-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.module-icon svg {
  width: 24px;
  height: 24px;
}

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

.module-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0 0 0.25rem 0;
}

.module-content p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0;
  line-height: 1.4;
}

.module-chevron {
  font-size: 1.5rem;
  color: var(--text-light);
  font-weight: 300;
  flex-shrink: 0;
}

/* Module Pages – compact layout, title in global header only */
.module-page {
  padding: 0.5rem 0;
}

.module-page-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  min-height: 2rem;
}

.back-button {
  display: inline-flex;
  align-items: center;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  margin: 0;
  transition: opacity 0.3s;
}

.back-button:hover {
  opacity: 0.7;
}

.module-page-content {
  background: var(--white);
  padding: 1.25rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--shadow);
}

.module-section h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.module-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.module-header-actions h2 {
  margin: 0;
}

/* Sand Test Form */
.sand-test-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Tests Table */
.tests-table {
  overflow-x: auto;
}

.tests-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.tests-table thead {
  background: var(--primary-color);
  color: white;
}

.tests-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.tests-table td {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.tests-table tbody tr:hover {
  background: #f9f9f9;
}

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

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-light);
}

.empty-state p {
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

/* Settings Page */
.settings-section {
  margin-bottom: 3rem;
}

.settings-section:last-child {
  margin-bottom: 0;
}

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

.settings-section-header h3 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin: 0;
}

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

.settings-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.settings-table thead {
  background: var(--primary-color);
  color: white;
}

.settings-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.settings-table td {
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.settings-table tbody tr:hover {
  background: #f9f9f9;
}

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

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-badge.active {
  background: #d4edda;
  color: #155724;
}

.status-badge.inactive {
  background: #f8d7da;
  color: #721c24;
}

.status-badge.default {
  background: #d1ecf1;
  color: #0c5460;
}

.btn-danger {
  background: #E74C3C;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

/* Task status badges (scheduling app) */
.task-status {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}
.task-status-todo {
  background: #e2e8f0;
  color: #475569;
}
.task-status-in_progress {
  background: #fef3c7;
  color: #92400e;
}
.task-status-done {
  background: #d1fae5;
  color: #065f46;
}

.filter-links a {
  margin-right: 1rem;
  color: var(--primary-color);
}
.filter-links a.active {
  font-weight: 600;
  text-decoration: none;
}

/* Scheduling / Task Management UI (Magic Patterns–inspired layout) */
.scheduling-page {
  padding-bottom: 1.5rem;
}
.scheduling-page-header {
  margin-bottom: 1.25rem;
}
.scheduling-page-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.scheduling-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.02em;
}
.scheduling-page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-light);
  font-size: 0.95rem;
}
.scheduling-header-cta {
  flex-shrink: 0;
}

/* Two-column scheduling layout */
.scheduling-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}
.scheduling-main {
  min-width: 0;
}
.scheduling-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.scheduling-side-card {
  background: var(--white);
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.scheduling-side-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--text-color);
}
.scheduling-side-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.scheduling-side-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid #eee;
}
.scheduling-side-list li:last-child {
  border-bottom: none;
}
.side-task-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-color);
}
.side-task-meta {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  color: var(--text-light);
  font-size: 0.85rem;
}
.side-task-date {
  font-weight: 600;
  color: var(--primary-color);
}
.side-empty {
  color: var(--text-light);
  font-size: 0.9rem;
  margin: 0;
}
.scheduling-side-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.scheduling-side-links a {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 500;
}
.scheduling-side-links a:hover {
  text-decoration: underline;
}

/* Stats row: quick overview cards */
.scheduling-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.scheduling-stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.scheduling-stat-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(107, 91, 74, 0.12);
}
.scheduling-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-color);
}
.scheduling-stat-label {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}
.scheduling-stat-todo .scheduling-stat-value { color: #475569; }
.scheduling-stat-in-progress .scheduling-stat-value { color: #92400e; }
.scheduling-stat-done .scheduling-stat-value { color: #065f46; }

/* Main card: single card for toolbar + table */
.scheduling-main-card {
  background: var(--white);
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.scheduling-main-card-header {
  padding: 1rem 1.25rem;
  background: #fafafa;
  border-bottom: 1px solid #e8e8e8;
}
.scheduling-main-card-header.task-list-toolbar {
  margin-bottom: 0;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e8e8e8;
}
.scheduling-main-card-body {
  padding: 0;
}
.scheduling-main-card-body .task-list-table-wrapper {
  border: none;
  border-radius: 0;
}
.scheduling-pagination {
  padding: 1rem 1.25rem;
  border-top: 1px solid #eee;
  background: #fafafa;
}
.scheduling-empty-state {
  padding: 2.5rem 1.25rem;
}

/* Zoho-like task list (scheduling) – toolbar inside card */
.task-list-module .task-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.task-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.task-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.task-scope-dropdown { position: relative; }
.task-scope-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--white);
  color: var(--text-color);
  cursor: pointer;
  min-width: 160px;
}
.task-scope-select:hover,
.task-scope-select:focus {
  border-color: var(--primary-color);
  outline: none;
}
.task-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: var(--white);
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.task-toolbar-btn:hover {
  background: #f5f5f5;
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.task-filter-details {
  position: relative;
  display: inline-block;
}
.task-filter-details summary.task-toolbar-btn {
  width: auto;
  min-width: 36px;
  padding: 0 0.6rem;
}
.task-filter-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.35rem;
  background: var(--white);
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 1rem;
  min-width: 280px;
  z-index: 50;
}
.task-filter-dropdown .task-filter-form { margin: 0; }
.task-filter-dropdown .form-actions { margin-top: 0.75rem; }

.btn-primary-task {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: white !important;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-primary-task:hover {
  background: var(--secondary-color);
  color: white !important;
}

.task-list-table-wrapper {
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: var(--white);
}
.task-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.task-list-table thead {
  background: #f5f5f5;
  border-bottom: 2px solid #e0e0e0;
}
.task-list-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-color);
}
.task-list-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}
.task-list-table tbody tr:hover {
  background: #fafafa;
}
.task-list-table tbody tr:last-child td { border-bottom: none; }
.task-list-table .col-checkbox { width: 40px; text-align: center; }
.task-list-table .col-task { min-width: 200px; }
.task-list-table .col-type { min-width: 100px; }
.task-list-table .col-owner { min-width: 120px; }
.task-list-table .col-status { min-width: 100px; }
.task-list-table .col-bay { min-width: 90px; }
.task-list-table .col-due { min-width: 95px; }
.task-list-table .col-actions { white-space: nowrap; }

.task-id {
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
}
.task-title-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}
.task-title-link:hover {
  text-decoration: underline;
}
.due-date-overdue {
  color: #c0392b;
  font-weight: 600;
}

/* ============================================================================
   Task Page Styles
   ============================================================================ */

/* Stats Cards */
.module-section .task-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1rem !important;
  margin-bottom: 1.5rem !important;
}

.module-section .task-stat-card {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: #ffffff;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  min-height: 100px;
}

.module-section .task-stat-card:hover,
.module-section .task-stat-card.active {
  border-color: var(--primary-color, #8B7355);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.module-section .task-stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #475569;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.module-section .task-stat-progress .task-stat-number {
  color: #d97706;
}

.module-section .task-stat-done .task-stat-number {
  color: #059669;
}

.module-section .task-stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

/* Filter Bar */
.module-section .task-filters-bar {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.module-section .task-filter-tabs {
  display: flex !important;
  gap: 0.5rem;
}

.module-section .filter-tab {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  text-decoration: none;
  border-radius: 6px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  transition: all 0.2s;
}

.module-section .filter-tab:hover {
  background: #e8e8e8;
  color: #333;
  text-decoration: none;
}

.module-section .filter-tab.active {
  background: var(--primary-color, #8B7355);
  color: white;
  border-color: var(--primary-color, #8B7355);
}

/* Filter Dropdown */
.module-section .filter-dropdown {
  position: relative;
}

.module-section .filter-dropdown summary {
  cursor: pointer;
  list-style: none;
}

.module-section .filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.module-section .filter-dropdown-content {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  min-width: 300px;
  z-index: 100;
}

.module-section .filter-dropdown-content p {
  margin: 0 0 0.75rem;
}

.module-section .filter-dropdown-content label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: #333;
}

.module-section .filter-dropdown-content select,
.module-section .filter-dropdown-content input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 0.9rem;
}

/* Task Table Enhancements */
.task-cell-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-cell-sub {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

.task-id-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f0f0f0;
  color: #666;
  border-radius: 4px;
  white-space: nowrap;
}

.task-type-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
}

.task-assignee {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.assignee-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--primary-color, #8B7355);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
}

.assignee-name {
  font-size: 0.9rem;
}

.unassigned {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Task title link */
.task-title-link {
  color: var(--text-color, #333);
  text-decoration: none;
  font-weight: 500;
}

.task-title-link:hover {
  color: var(--primary-color, #8B7355);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .module-section .task-stats-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  
  .module-section .task-stat-card {
    flex-direction: row !important;
    justify-content: flex-start;
    padding: 1rem;
    min-height: auto;
    gap: 1rem;
    text-align: left;
  }
  
  .module-section .task-stat-number {
    font-size: 1.75rem;
    margin-bottom: 0;
  }
  
  .module-section .task-stat-label {
    margin-top: 0;
  }
  
  .module-section .task-filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .module-section .task-filter-tabs {
    width: 100%;
  }
  
  .module-section .filter-tab {
    flex: 1;
    text-align: center;
  }
}

/* django-filter form (task list, etc.) */
.task-filter-form { margin-bottom: 1rem; padding: 0.75rem; background: #f9f9f9; border-radius: 5px; }
.task-filter-form p { display: inline-block; margin: 0 1rem 0.5rem 0; vertical-align: top; }
.task-filter-form label { display: block; font-size: 0.85rem; margin-bottom: 0.2rem; }
.task-filter-form input, .task-filter-form select { padding: 0.35rem 0.5rem; font-size: 0.9rem; }

/* Schedule view (scheduling app) */
.schedule-by-day { margin-top: 1rem; }
.schedule-day { margin-bottom: 1.5rem; }
.schedule-day h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.shift-list { list-style: none; padding-left: 0; }
.shift-list li { padding: 0.5rem 0; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.shift-notes { color: var(--text-light); font-size: 0.9rem; }

/* ========================================================================
   Garage Schedule Styles
   ======================================================================== */

/* Week navigation */
.garage-week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.week-label {
  font-weight: 600;
  color: var(--text-color);
}

/* Schedule table wrapper */
.garage-schedule-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.garage-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.garage-table thead {
  background: #f5f5f5;
}

.garage-table th {
  padding: 0.5rem 0.4rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.8rem;
  border-bottom: 2px solid #e0e0e0;
}

.garage-table th.col-bay {
  width: 80px;
  text-align: left;
  padding-left: 0.75rem;
}

.garage-table th.col-day {
  min-width: 100px;
}

.garage-table th.col-day.today {
  background: rgba(107, 91, 74, 0.1);
}

.day-name {
  display: block;
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
}

.day-date {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
}

/* Table body */
.garage-table td {
  padding: 0.35rem;
  border: 1px solid #f0f0f0;
  vertical-align: top;
  height: 80px;
}

.bay-cell {
  background: #fafafa;
  padding-left: 0.75rem !important;
  vertical-align: middle !important;
}

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

.schedule-cell {
  background: white;
}

.schedule-cell.alt-row {
  background: #fcfcfc;
}

.empty-slot {
  color: #ddd;
  font-size: 0.8rem;
}

/* Garage job card */
.garage-job {
  background: #f0f7ff;
  border: 1px solid #c5ddf7;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  position: relative;
}

.garage-job:last-child {
  margin-bottom: 0;
}

.garage-job.multi-day {
  background: #fef3c7;
  border-color: #fcd34d;
  border-left-color: #f59e0b;
}

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

.job-unit {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: monospace;
}

.job-hours {
  font-size: 0.65rem;
  color: #666;
  font-weight: 500;
}

.job-title {
  font-weight: 500;
  color: var(--text-color);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.job-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: #888;
}

.job-mechanic {
  font-weight: 500;
}

.job-duration {
  background: #f59e0b;
  color: white;
  padding: 0.05rem 0.25rem;
  border-radius: 2px;
  font-weight: 600;
}

.job-actions {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  display: none;
  gap: 0.15rem;
}

.garage-job:hover .job-actions {
  display: flex;
}

.job-action {
  display: inline-block;
  padding: 0.1rem 0.2rem;
  color: #888;
  text-decoration: none;
  font-size: 0.7rem;
  border-radius: 2px;
}

.job-action:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--primary-color);
}

.job-action.job-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Unscheduled tasks queue */
.unscheduled-tasks {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
}

.unscheduled-tasks h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--text-color);
}

.task-queue {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.queue-task {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f9f9f9;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
}

.queue-task-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.queue-unit {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: monospace;
}

.queue-title {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.85rem;
}

.queue-hours {
  font-size: 0.75rem;
  color: #666;
  background: #e8e8e8;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.queue-type {
  font-size: 0.7rem;
  color: #888;
}

/* Garage job form */
.garage-job-form .form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e8e8e8;
}

.garage-job-form .form-section:last-of-type {
  border-bottom: none;
}

.garage-job-form .form-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .garage-week-nav {
    flex-wrap: wrap;
  }
  
  .garage-table {
    min-width: 600px;
    font-size: 0.8rem;
  }
  
  .garage-table th,
  .garage-table td {
    padding: 0.25rem;
  }
  
  .garage-job {
    padding: 0.3rem;
  }
  
  .job-actions {
    display: flex;
    position: static;
    margin-top: 0.25rem;
  }
  
  .queue-task {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

.header-buttons {
  display: flex;
  gap: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.delete-confirmation {
  max-width: 600px;
  margin: 0 auto;
}

.delete-confirmation h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.delete-confirmation p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.warning-text {
  color: #E74C3C;
  font-weight: 500;
  padding: 1rem;
  background: #f8d7da;
  border-radius: 5px;
  border-left: 4px solid #E74C3C;
}

.delete-form {
  margin-top: 2rem;
}

/* Specifications Subsection */
.specifications-subsection {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f5f5f5;
  border-radius: 5px;
  border-left: 4px solid var(--primary-color);
}

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

.specifications-header h4 {
  color: var(--primary-color);
  font-size: 1.2rem;
  margin: 0;
}

.specifications-table {
  margin-top: 1rem;
  overflow-x: auto;
}

.specifications-table table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.9rem;
}

.specifications-table thead {
  background: var(--primary-color);
  color: white;
}

.specifications-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}

.specifications-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
}

.specifications-table tbody tr:hover {
  background: #f9f9f9;
}

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

.empty-state-small {
  padding: 1rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
}

.empty-state-small p {
  margin-bottom: 0.5rem;
}

.sand-type-info {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 5px;
  border-left: 4px solid var(--primary-color);
}

.sand-type-info p {
  margin: 0.5rem 0;
  color: var(--text-color);
}

.specifications-table {
  margin-top: 1.5rem;
}

/* St-Polycarpe Section */
.st-polycarpe-section {
  margin: 2rem 0;
  padding: 2rem;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.st-polycarpe-section h3 {
  margin-top: 0;
  margin-bottom: 2rem;
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 600;
}

.st-polycarpe-section h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-color);
  font-size: 1.1rem;
  font-weight: 600;
}

/* Positions Section */
.positions-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.position-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.position-group > label {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
}

.position-controls-top {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.position-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.2s ease;
}

.position-btn:hover {
  background: #f5f5f5;
  border-color: #999;
}

.position-btn.active {
  background: #e8f4e9;
  border-color: #2d7a32;
  color: #2d7a32;
}

.position-btn svg {
  width: 16px;
  height: 16px;
}

.position-selector {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.circular-diagram {
  width: 100%;
  max-width: 250px;
  margin: 0 auto;
  cursor: pointer;
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  transition: border-color 0.3s ease;
}

.circular-diagram:hover {
  border-color: #999;
}

.circular-svg {
  width: 100%;
  height: auto;
  display: block;
}

.position-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.position-input-group label {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.9rem;
}

.position-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

/* Silos and Recipe Row */
.silos-recipe-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Silos Section */
.silos-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.silos-inputs-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.silos-inputs-row .silo-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.silos-jets-label {
  margin-left: auto;
  white-space: nowrap;
}

/* Recipe Section */
.recipe-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.5rem;
  position: relative;
}

/* Center the last 2 items (11 and 12) in columns 5 and 6 */
.recipe-input:nth-child(11) {
  grid-column: 5;
}

.recipe-input:nth-child(12) {
  grid-column: 6;
}

.recipe-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  text-align: center;
}

/* Notes Section */
.notes-section {
  margin-bottom: 2rem;
}

.notes-section label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
}

.notes-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
}

/* Client Availability Section */
.client-availability-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: white;
  border-radius: 5px;
  border: 1px solid #e0e0e0;
}

.client-availability-section h4 {
  margin-bottom: 1rem;
}

.client-availability-section .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.client-availability-section .form-help {
  display: block;
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Responsive for St-Polycarpe section */
@media (max-width: 768px) {
  .positions-section {
    grid-template-columns: 1fr;
  }
  
  .silos-recipe-row {
    grid-template-columns: 1fr;
  }
  
  .silos-inputs-row {
    flex-wrap: wrap;
  }
  
  .recipe-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Test Parameters Section */
.test-parameters-section {
  margin: 2rem 0;
  padding: 2rem;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.test-parameters-section h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  font-size: 1.5rem;
}

/* Weight Mode Toggle */
.weight-mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.toggle-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 2px solid #ddd;
  border-radius: 5px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.toggle-option input[type="radio"] {
  display: none;
}

.toggle-option span {
  font-weight: 500;
  color: #666;
}

.toggle-option:hover {
  border-color: var(--primary-color);
  background: #f0f8f0;
}

.toggle-option.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
}

.toggle-option.active span {
  color: white;
}

/* Sieve Weights Table */
.sieve-weights-table-container {
  margin-top: 1.5rem;
  overflow-x: auto;
}

.sieve-weights-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 5px;
  overflow: hidden;
}

.sieve-weights-table thead {
  background: var(--primary-color);
  color: white;
}

.sieve-weights-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.sieve-weights-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e0e0e0;
}

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

.sieve-weights-table tbody tr:hover {
  background: #f9f9f9;
}

.sieve-weights-table .sieve-weight-input {
  width: 100%;
  min-width: 120px;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.sieve-weights-table .sieve-weight-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(45, 80, 22, 0.1);
}

.sieve-weights-table .sieve-weight-input[readonly] {
  background: #f5f5f5;
  cursor: not-allowed;
}

.sieve-weights-table td strong {
  color: var(--primary-color);
  font-size: 0.95rem;
}

/* Autocomplete suggestions styling */
.autocomplete-suggestions {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.autocomplete-suggestion {
    padding: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-suggestion:hover {
    background: #f0f0f0;
}

.autocomplete-selected {
    background: #e9ecef;
}

/* Responsive form */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

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

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

  .module-header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .module-header-actions .btn {
    width: 100%;
  }

  .tests-table {
    font-size: 0.9rem;
  }

  .tests-table th,
  .tests-table td {
    padding: 0.75rem 0.5rem;
  }

  .scheduling-page-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .scheduling-header-cta {
    width: 100%;
    justify-content: center;
  }
  .scheduling-layout {
    grid-template-columns: 1fr;
  }
  .scheduling-side {
    order: 2;
  }
  .scheduling-side-card {
    padding: 0.9rem 1rem;
  }
  .scheduling-stats-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .task-list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .task-toolbar-left,
  .task-toolbar-right {
    justify-content: flex-start;
  }
  .task-toolbar-right .btn-primary-task {
    flex: 1;
    justify-content: center;
  }
  .task-list-table-wrapper {
    font-size: 0.85rem;
  }
  .task-list-table th,
  .task-list-table td {
    padding: 0.6rem 0.5rem;
  }
  .task-list-table .col-task { min-width: 140px; }
}

/* ========================================================================
   Unit Management Styles
   ======================================================================== */

/* Unit number badges */
.unit-number-badge {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: monospace;
}

.unit-number-badge-large {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-family: monospace;
  margin-right: 0.5rem;
}

.unit-number-link {
  text-decoration: none;
}

.unit-number-link:hover .unit-number-badge {
  background: var(--accent-hover);
}

/* Unit status badges */
.unit-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.unit-status-active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.unit-status-maintenance {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

.unit-status-out_of_service {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* Maintenance type badges */
.maintenance-type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.maintenance-type-preventive {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.maintenance-type-repair {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.maintenance-type-inspection {
  background: rgba(168, 85, 247, 0.15);
  color: #9333ea;
}

.maintenance-type-other {
  background: rgba(107, 114, 128, 0.15);
  color: #4b5563;
}

/* Unit info grid */
.unit-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.unit-info-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.unit-info-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.unit-info-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
}

/* Unit details section */
.unit-details-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.unit-details-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.unit-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.detail-item {
  display: flex;
  gap: 0.5rem;
}

.detail-label {
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 130px;
}

.detail-value {
  color: var(--text-color);
}

.unit-notes {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* Unit section (for tasks and maintenance lists) */
.unit-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.unit-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.unit-section .section-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-color);
}

.unit-section .tests-table {
  margin: 0;
}

.see-all-link {
  margin-top: 1rem;
  text-align: right;
}

.see-all-link a {
  color: var(--accent-color);
  text-decoration: none;
  font-size: 0.9rem;
}

.see-all-link a:hover {
  text-decoration: underline;
}

.empty-message {
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}

/* Search form inline */
.search-form-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-form-inline .search-input {
  width: 200px;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
}

/* Danger zone */
.danger-zone {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: right;
}

/* Form row for two columns */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row .form-group {
  margin-bottom: 0;
}

.form-group.half-width {
  flex: 1;
}

/* Status badges (generic) */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.status-active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.status-badge.status-inactive {
  background: rgba(107, 114, 128, 0.15);
  color: #4b5563;
}

/* Confirm delete styles */
.confirm-delete-container {
  max-width: 500px;
  margin: 2rem auto;
}

.confirm-delete-warning {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.confirm-delete-warning p {
  margin: 0 0 1rem 0;
  color: var(--text-color);
}

.delete-item-info {
  background: var(--surface-color);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.delete-item-description {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.warning-text {
  color: #dc2626;
  font-size: 0.9rem;
  margin-bottom: 0 !important;
}

/* Responsive adjustments for unit management */
@media (max-width: 768px) {
  .unit-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .unit-details-grid {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .search-form-inline {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-form-inline .search-input {
    width: 100%;
  }
  
  .unit-section .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ========================================================================
   Customer Management Styles
   ======================================================================== */

.customer-code-badge {
  display: inline-block;
  background: #6366f1;
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: monospace;
  margin-right: 0.5rem;
}

.customer-code-badge-large {
  display: inline-block;
  background: #6366f1;
  color: white;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-family: monospace;
  margin-right: 0.5rem;
}

.customer-type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.customer-type-contractor { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.customer-type-retail { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.customer-type-wholesale { background: rgba(168, 85, 247, 0.15); color: #9333ea; }
.customer-type-internal { background: rgba(107, 114, 128, 0.15); color: #4b5563; }

.customer-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.customer-status-active { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.customer-status-inactive { background: rgba(107, 114, 128, 0.15); color: #4b5563; }
.customer-status-on_hold { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }

/* Contact cards */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.contact-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.contact-card.contact-primary {
  border-left: 4px solid var(--accent-color);
}

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

.contact-name {
  font-weight: 600;
  color: var(--text-color);
}

.contact-badge {
  background: var(--accent-color);
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.contact-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.contact-details {
  font-size: 0.85rem;
  color: var(--text-color);
  margin-bottom: 0.75rem;
}

.contact-details div {
  margin-bottom: 0.25rem;
}

.contact-actions {
  display: flex;
  gap: 0.5rem;
}

/* ========================================================================
   Inspection Styles
   ======================================================================== */

.inspection-type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.inspection-type-equipment { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.inspection-type-vehicle { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.inspection-type-site { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.inspection-type-safety { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.inspection-type-other { background: rgba(107, 114, 128, 0.15); color: #4b5563; }

.inspection-result {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.inspection-result-passed { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.inspection-result-failed { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.inspection-result-pending { background: rgba(107, 114, 128, 0.15); color: #4b5563; }

.inspection-result-large {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
}

.inspection-date-badge {
  display: inline-block;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Inspection items list */
.inspection-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inspection-item-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.inspection-item-card.item-critical {
  border-left: 4px solid #dc2626;
}

.inspection-item-card.item-failed {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.3);
}

.item-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
}

.item-order {
  background: var(--border-color);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.item-result-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.item-content {
  flex: 1;
}

.item-question {
  font-weight: 500;
  color: var(--text-color);
}

.item-description, .item-notes {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.item-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.item-response-type {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.item-badge {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.item-required { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.item-critical-badge { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

.item-actions {
  display: flex;
  gap: 0.5rem;
}

/* Inspection perform form */
.inspection-category-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.category-title {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.inspection-check-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.inspection-check-item.check-item-critical {
  background: rgba(239, 68, 68, 0.05);
  margin: 0 -1rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}

.check-item-main {
  flex: 1;
}

.check-item-question {
  font-weight: 500;
  color: var(--text-color);
}

.check-item-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.check-item-response {
  min-width: 180px;
}

.response-buttons {
  display: flex;
  gap: 0.5rem;
}

.response-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.response-btn input {
  display: none;
}

.response-btn.response-pass:hover,
.response-btn.response-pass.selected {
  background: rgba(34, 197, 94, 0.15);
  border-color: #16a34a;
  color: #16a34a;
}

.response-btn.response-fail:hover,
.response-btn.response-fail.selected {
  background: rgba(239, 68, 68, 0.15);
  border-color: #dc2626;
  color: #dc2626;
}

.response-numeric {
  width: 120px;
}

.check-item-notes {
  min-width: 200px;
}

.check-item-notes input {
  width: 100%;
}

.inspection-form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Inspection results display */
.inspection-results-list {
  display: flex;
  flex-direction: column;
}

.inspection-result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

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

.inspection-result-item .result-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
}

.inspection-result-item.result-passed .result-icon { color: #16a34a; }
.inspection-result-item.result-failed .result-icon { color: #dc2626; }
.inspection-result-item.result-pending .result-icon { color: #9ca3af; }

.result-content {
  flex: 1;
}

.result-question {
  color: var(--text-color);
}

.result-notes {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.inspection-failed-section {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ========================================================================
   Employee Management Styles
   ======================================================================== */

.employee-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.employee-avatar-small {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.employee-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.2rem;
  margin-right: 0.75rem;
}

.employee-cell-info {
  flex: 1;
}

.employee-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.employee-status-active { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.employee-status-on_leave { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.employee-status-terminated { background: rgba(107, 114, 128, 0.15); color: #4b5563; }

/* Certification status */
.cert-status {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cert-status-valid { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.cert-status-expiring { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.cert-status-expired { background: rgba(239, 68, 68, 0.15); color: #dc2626; }

/* Row highlighting for certifications */
.row-warning {
  background: rgba(234, 179, 8, 0.05);
}

.row-expired {
  background: rgba(239, 68, 68, 0.05);
}

/* Alert box */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.alert-warning {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: #92400e;
}

/* Fieldset styling for forms */
fieldset {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

fieldset legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .contacts-grid {
    grid-template-columns: 1fr;
  }
  
  .inspection-check-item {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .check-item-response,
  .check-item-notes {
    min-width: 100%;
  }
  
  .response-buttons {
    width: 100%;
  }
  
  .response-btn {
    flex: 1;
  }
  
  .inspection-form-actions {
    flex-direction: column;
  }
  
  .inspection-item-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .item-meta,
  .item-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ========================================================================
   Compact Task List with Collapsible Groups
   ======================================================================== */

/* Header with count summary */
.task-header-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.task-header-left h2 {
  margin: 0;
}

.task-count-summary {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.count-todo {
  color: #475569;
}

.count-progress {
  color: #d97706;
}

/* Compact filters bar */
.task-filters-bar-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.task-filter-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Status filter pills */
.status-filter-pills {
  display: flex;
  gap: 0.25rem;
}

.status-pill {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: #666;
  text-decoration: none;
  border-radius: 4px;
  background: #f5f5f5;
  transition: all 0.2s;
}

.status-pill:hover {
  background: #e8e8e8;
  text-decoration: none;
}

.status-pill.active {
  background: var(--primary-color);
  color: white;
}

.status-pill.status-todo.active {
  background: #475569;
}

.status-pill.status-progress.active {
  background: #d97706;
}

.status-pill.status-done.active {
  background: #059669;
}

/* Task groups (collapsible) */
.task-groups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-group {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.task-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #f9f9f9;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.task-group-header:hover {
  background: #f0f0f0;
}

.task-group-toggle {
  font-size: 0.7rem;
  color: #888;
  transition: transform 0.2s;
}

.task-group[open] .task-group-toggle {
  transform: rotate(90deg);
}

.task-group-name {
  flex: 1;
  color: var(--text-color);
}

.task-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 0.4rem;
  background: #e0e0e0;
  color: #666;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 11px;
}

.task-group-content {
  padding: 0;
}

/* Compact task table - fixed layout so column widths are respected */
.task-table-compact {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.task-table-compact thead {
  background: #fafafa;
  border-bottom: 1px solid #e0e0e0;
}

.task-table-compact th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.task-table-compact td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

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

.task-table-compact tbody tr:hover {
  background: #fafafa;
}

/* Task row cells - widths come from <colgroup> in template; only overflow/display here */
.task-table-compact .col-task {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-table-compact .col-comments {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-table-compact .col-comments .comment-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-table-compact .col-unit,
.task-table-compact .col-assignee,
.task-table-compact .col-status,
.task-table-compact .col-due {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-table-compact .col-actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
  text-align: right;
}

.task-table-compact .col-actions .action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.task-table-compact .col-task .task-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-table-compact tbody .task-row {
  cursor: pointer;
}

.task-table-compact td,
.task-table-compact th {
  padding: 0.35rem 0.5rem;
  vertical-align: middle;
}

/* Task link styling */
.task-link {
  color: var(--text-color);
  text-decoration: none;
  display: block;
}

.task-link:hover {
  color: var(--primary-color);
}

.task-link .task-id {
  display: inline-block;
  color: #999;
  font-size: 0.75rem;
  margin-right: 0.35rem;
}

.task-meta {
  display: block;
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.15rem;
}

/* Unit badge in task list */
.unit-badge {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: monospace;
  text-decoration: none;
}

.unit-badge:hover {
  opacity: 0.85;
}

/* Compact assignee display */
.assignee-compact {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
}

.assignee-avatar-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
}

.unassigned-text {
  color: #ccc;
}

/* Due date styling */
.due-overdue {
  color: #dc2626;
  font-weight: 600;
}

/* Action links */
.action-link {
  display: inline-block;
  padding: 0.2rem 0.35rem;
  color: #888;
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 3px;
}

.action-link:hover {
  background: #f0f0f0;
  color: var(--primary-color);
}

.action-link.action-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Completed tasks page */
.completed-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.85rem;
  color: #666;
}

.filter-select {
  padding: 0.4rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  background: white;
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
}

.completed-tasks-table {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.completed-row .col-date {
  width: 100px;
}

.completion-date {
  display: block;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.85rem;
}

.completion-time {
  display: block;
  font-size: 0.75rem;
  color: #888;
}

.col-duration {
  width: 80px;
}

.hours-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: #d1fae5;
  color: #065f46;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
}

.hours-badge.estimated {
  background: #e0e0e0;
  color: #666;
}

/* Responsive for compact task list */
@media (max-width: 768px) {
  .task-header-left {
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
  }
  
  .task-count-summary {
    flex-wrap: wrap;
  }
  
  .task-filters-bar-compact {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .task-filter-right {
    flex-direction: column;
    align-items: stretch;
  }
  
  .status-filter-pills {
    justify-content: center;
  }
  
  .task-table-compact {
    font-size: 0.8rem;
  }
  
  .task-table-compact th,
  .task-table-compact td {
    padding: 0.4rem 0.5rem;
  }
  
  .task-table-compact .col-unit,
  .task-table-compact .col-due {
    display: none;
  }
  
  .task-table-compact .col-assignee {
    width: 80px;
  }
  
  .assignee-compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
  }
  
  .completed-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-select {
    flex: 1;
  }
}

/* ========== Mobile task list: card view (replace table on small screens) ========== */
.task-list-mobile {
  display: none;
}

@media (max-width: 768px) {
  .task-table-desktop {
    display: none !important;
  }

  .task-list-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  .task-card-mobile {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem 1rem 1rem 1.25rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    position: relative;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, box-shadow 0.15s;
  }

  .task-card-mobile:hover,
  .task-card-mobile:active {
    background: #f8f8f8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .task-card-mobile-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    flex: 1 1 100%;
  }

  .task-card-mobile-id {
    font-size: 0.8rem;
    color: #888;
  }

  .task-card-mobile-main .task-status {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

  .task-card-mobile-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1 1 100%;
    padding-right: 1.5rem;
  }

  .task-card-mobile-meta {
    display: block;
    font-size: 0.8rem;
    color: #666;
    flex: 1 1 100%;
  }

  .task-card-mobile-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #666;
    flex: 1 1 100%;
  }

  .task-card-mobile-due.due-overdue {
    color: #c5221f;
    font-weight: 500;
  }

  .task-card-mobile-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: #bbb;
    pointer-events: none;
  }

  /* Task list header on mobile: stack and touch-friendly */
  .task-list-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .task-list-header-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .task-list-header-buttons .btn {
    min-height: 44px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .task-empty-state .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ========== Mobile task-do page (execution / checklist) ========== */
@media (max-width: 768px) {
  .task-do-page .module-header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.25rem;
  }

  .task-do-page .module-header-actions h2 {
    font-size: 1.25rem;
  }

  .task-do-page .header-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .task-do-page .header-buttons .btn {
    min-height: 48px;
    width: 100%;
    justify-content: center;
  }

  .task-do-page .task-do-summary {
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
  }

  .task-do-page .task-do-summary h3 {
    font-size: 1.15rem;
  }

  .task-do-page .checklist-section-do {
    padding: 1rem;
    margin-top: 1rem;
  }

  .task-do-page .checklist-item-row-do {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fafafa;
    border-radius: 10px;
    border: 1px solid #eee;
  }

  .task-do-page .checklist-item-row-do .form-check {
    order: -1;
    padding-top: 0;
  }

  .task-do-page .checklist-item-row-do .form-check input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
  }

  .task-do-page .checklist-item-row-do .item-title-wrap {
    flex: none;
  }

  .task-do-page .checklist-item-row-do .item-title {
    font-size: 1rem;
  }

  .task-do-page .checklist-item-row-do .notes-cell {
    min-width: 0;
    width: 100%;
  }

  .task-do-page .checklist-item-row-do .notes-cell textarea {
    width: 100%;
    min-height: 80px;
    font-size: 16px;
  }

  .task-do-page .task-do-actions .btn {
    min-height: 48px;
    width: 100%;
    justify-content: center;
  }

  .task-do-page .comments-section {
    padding: 1rem;
    margin-top: 1.25rem;
  }

  .task-do-page .comments-section textarea {
    width: 100%;
    min-height: 100px;
    font-size: 16px;
  }

  .task-do-page .comments-section form .btn {
    min-height: 48px;
    width: 100%;
  }

  .task-do-page .mark-done-wrap .btn {
    min-height: 52px;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    justify-content: center;
  }
}

/* PWA specific styles (installed as app / standalone) */
@media (display-mode: standalone) {
  .mobile-header {
    padding-top: env(safe-area-inset-top);
  }

  header {
    padding-top: env(safe-area-inset-top);
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  main {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .auth-page-wrapper {
    padding-top: env(safe-area-inset-top);
  }

  .auth-page-main {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ========== Mobile views (PWA) – all pages ========== */
@media (max-width: 768px) {
  /* Touch-friendly targets and spacing */
  .desktop-main-content .container,
  main.container,
  main .container {
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 24px;
  }

  main {
    min-height: 50vh;
  }

  /* --- PWA / Mobile: Login (auth) page --- */
  .auth-page-wrapper {
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .auth-page-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .auth-container {
    flex: 1;
    min-height: 0;
    padding: 1.5rem 0 2rem;
    align-items: flex-start;
    padding-top: 1rem;
  }

  .auth-card {
    max-width: 100%;
    padding: 1.75rem 1.25rem;
    border-radius: 12px;
    margin: 0 auto;
  }

  .auth-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .auth-form .form-input,
  .auth-form input[type="text"],
  .auth-form input[type="password"] {
    font-size: 16px; /* prevents iOS zoom on focus */
    min-height: 48px;
    padding: 0.75rem 1rem;
    -webkit-appearance: none;
    appearance: none;
  }

  .auth-form .btn-block,
  .auth-form button[type="submit"] {
    min-height: 48px;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.25rem;
  }

  /* Buttons and links: minimum 44px touch target */
  .btn,
  button[type="submit"],
  a.btn,
  .button {
    min-height: 44px;
    padding: 0.6rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Forms: full width on mobile */
  main input[type="text"],
  main input[type="email"],
  main input[type="number"],
  main input[type="password"],
  main input[type="url"],
  main select,
  main textarea {
    font-size: 16px; /* avoids zoom on focus on iOS */
    max-width: 100%;
  }

  /* Tables: horizontal scroll with shadow hint */
  .table-responsive,
  main table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  main table {
    min-width: 280px;
  }

  /* Cards and list items: comfortable tap area */
  .card,
  .list-group-item,
  .notification-full-link,
  .task-row,
  a[role="button"] {
    min-height: 44px;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  /* Page titles on mobile */
  main h1,
  main .page-title {
    font-size: 1.35rem;
    margin-bottom: 1rem;
    word-break: break-word;
  }

  /* Install app button: visible only when PWA prompt available */
  #install-button {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    right: 16px;
    z-index: 999;
    padding: 0.6rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 2px 10px var(--shadow);
    display: none;
    min-height: 44px;
  }
  #install-button:hover {
    background: var(--secondary-color);
  }
}

@media (min-width: 769px) {
  #install-button {
    display: none !important;
  }
}
