/* Utility for screen-reader-only labels */
.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow text selection for inputs and content areas */
input,
textarea,
[contenteditable],
.selectable {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

:root {
  /* Dark Theme Colors */
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: #1e1e3f;
  --bg-input: #2a2a4a;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b8b8d1;
  --text-muted: #6b6b8a;

  /* Accent Colors */
  --accent-primary: #4f46e5;
  --accent-secondary: #7c3aed;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  /* Borders */
  --border-color: #2d2d5a;
  --border-light: #3a3a6a;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* iPad-specific variables */
  --safe-area-inset-top: env(safe-area-inset-top);
  --safe-area-inset-bottom: env(safe-area-inset-bottom);
  --safe-area-inset-left: env(safe-area-inset-left);
  --safe-area-inset-right: env(safe-area-inset-right);
}

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  /* iPad optimizations */
  padding-top: var(--safe-area-inset-top);
  padding-bottom: var(--safe-area-inset-bottom);
  padding-left: var(--safe-area-inset-left);
  padding-right: var(--safe-area-inset-right);
  /* Prevent zoom on input focus */
  font-size: 16px;
  /* Smooth scrolling */
  -webkit-overflow-scrolling: touch;
}

/* Container */
.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* iPad optimizations */
  min-height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
}

/* Login Container */
.login-container {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo i {
  font-size: 2.5rem;
  color: var(--accent-primary);
}

.logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 1rem;
}

.input-wrapper input {
  width: 100%;
  padding: 16px; /* base padding */
  padding-left: 56px; /* leave room for left icon */
  padding-right: 52px; /* leave room for right toggle */
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
  transition: color 0.3s ease;
  z-index: 2;
}

.toggle-password:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
}

/* Checkbox */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkbox-wrapper input[type='checkbox'] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  position: relative;
  transition: all 0.3s ease;
}

.checkbox-wrapper input[type='checkbox']:checked + .checkmark {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox-wrapper input[type='checkbox']:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Buttons */
.login-btn,
.register-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.login-btn:hover,
.register-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.login-btn:active,
.register-btn:active {
  transform: translateY(0);
}

.btn-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Form Options */
.form-options {
  margin-bottom: 24px;
}

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 32px;
}

.login-footer p {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-footer a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.login-footer a:hover {
  color: var(--accent-secondary);
}

.support-link {
  margin-top: 16px;
}

.employee-notice {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  text-align: center;
}

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

.employee-notice i {
  color: var(--accent-primary);
  margin-right: 6px;
}

.employee-notice strong {
  color: var(--text-primary);
}

/* Registration Container */
.register-container {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
}

.register-header {
  text-align: center;
  margin-bottom: 32px;
}

.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

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

.register-header h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

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

/* Dashboard */
.dashboard {
  display: flex;
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.sidebar-header {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
  justify-content: flex-start;
}

.sidebar-header .logo span {
  font-size: 1.2rem;
  font-weight: 600;
}

.nav-menu {
  list-style: none;
  padding: 24px 0;
  flex: 1;
}

.nav-item {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 0 8px 8px 0;
}

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

.nav-item.active .nav-link {
  background: var(--accent-primary);
  color: white;
}

.nav-link i {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

.user-info-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 16px;
}

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

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

.logout-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: var(--accent-danger);
  color: white;
  border-color: var(--accent-danger);
}

/* Main Content - restore page scrolling */
.main-content {
  flex: 1;
  background: var(--bg-primary);
  overflow-y: auto; /* Restore page scrolling */
}

.top-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.add-item-btn {
  padding: 12px 20px;
  background: var(--accent-primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-item-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
}

.search-box input {
  padding: 12px 16px 12px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  width: 300px;
}

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

/* Content Area */
.content-area {
  padding: 32px;
}

.welcome-message {
  text-align: center;
  margin-bottom: 48px;
}

.welcome-message h2 {
  font-size: 2rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.stat-content h3 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 1000;
  max-width: 350px;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left: 4px solid var(--accent-success);
}

.toast.error {
  border-left: 4px solid var(--accent-danger);
}

.toast.warning {
  border-left: 4px solid var(--accent-warning);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .login-container,
  .register-container {
    padding: 32px 24px;
  }

  .dashboard {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu {
    display: flex;
    overflow-x: auto;
    padding: 16px 24px;
  }

  .nav-item {
    margin-bottom: 0;
    margin-right: 16px;
    flex-shrink: 0;
  }

  .nav-link {
    padding: 12px 16px;
    border-radius: 8px;
  }

  .sidebar-footer {
    padding: 16px 24px;
  }

  .top-bar {
    padding: 16px 24px;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  .top-actions {
    justify-content: space-between;
  }

  .search-box input {
    width: 100%;
  }

  .content-area {
    padding: 24px 16px;
  }

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

@media (max-width: 480px) {
  .logo h1 {
    font-size: 1.5rem;
  }

  .logo i {
    font-size: 2rem;
  }

  .welcome-message h2 {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .stat-content h3 {
    font-size: 1.5rem;
  }
}

/* iPad Specific Optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }

  .nav-link {
    padding: 16px 20px;
    font-size: 1.1rem;
  }

  .nav-link i {
    font-size: 1.2rem;
  }

  .stat-card {
    padding: 28px;
  }

  .stat-icon {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
  }

  .stat-content h3 {
    font-size: 2.2rem;
  }
}

/* Error message styling */
.error-message {
  background: var(--bg-card);
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
  color: #ef4444;
}

.error-message i {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.error-message:empty {
  display: none;
}

/* Inventory Section */
.inventory-section {
  margin-top: 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 100;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Reduce spacing for inventory section header */
.inventory-section .section-header {
  margin-bottom: 24px;
  padding: 0;
  position: static;
  background: transparent;
  border-bottom: none;
  backdrop-filter: none;
  box-shadow: none;
  display: flex;
  align-items: flex-end;
}

/* Remove the absolute positioned title - we'll put it inside the table container */

.section-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
}

.list-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  margin-bottom: 16px;
}

/* Calendar grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.cal-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cal-cell-header {
  padding: 6px 8px;
  font-weight: 600;
  color: var(--text-primary);
}
.cal-cell-header.muted {
  color: var(--text-secondary);
}
.cal-cell-body {
  padding: 4px 8px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-event {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event:hover {
  text-decoration: underline;
}
.cal-more {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Calendar header spacing to match grid spacing */
#calendarSection .section-header {
  margin-top: 12px;
}

.list-select {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.refresh-btn {
  padding: 8px 12px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  background: var(--accent-primary-dark);
  border-color: var(--accent-primary-dark);
}

.inventory-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: visible; /* Allow sticky positioning to work */
}

/* Inventory table container with fixed header and full page scroll */
.inventory-table-container {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Ensures children respect rounded corners */
  /* Removed max-height for full page scroll */
}

/* Fixed table header - stays in place during horizontal scroll */
.inventory-table-header {
  background: var(--bg-secondary);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  border-radius: 12px 12px 0 0; /* Match container's top rounded corners */
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  overflow: hidden; /* Ensures background respects radius */
}

/* Top scrollbar for table navigation - zoom responsive */
.table-scrollbar-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 0.75rem; /* Scales with zoom level */
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  margin: 0;
  padding: 0;
  /* Hide the scrollbar track but keep functionality */
}

.table-scrollbar-top .scrollbar-content {
  height: 1px;
  /* Width will be set dynamically by JavaScript to match table width */
  min-width: 100%;
}

/* ChatGPT's recommended approach: stable geometry for both scrollers */
.table-scrollbar-top,
.inventory-table-scroll-wrapper {
  scrollbar-gutter: stable both-edges;
  box-sizing: border-box;
  padding: 0;
  border: 0;
}

.table-scrollbar-top .scrollbar-content {
  box-sizing: border-box;
  padding: 0;
  border: 0;
}

/* Scrollbar styling - controls thickness/colors only, not thumb length */
.table-scrollbar-top::-webkit-scrollbar,
.inventory-table-scroll-wrapper::-webkit-scrollbar {
  height: 0.75rem;
}

.table-scrollbar-top::-webkit-scrollbar-track,
.inventory-table-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 0;
}

.table-scrollbar-top::-webkit-scrollbar-thumb,
.inventory-table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 0.375rem;
  border: 0.125rem solid var(--bg-secondary);
}

.table-scrollbar-top::-webkit-scrollbar-thumb:hover,
.inventory-table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.table-scrollbar-top::-webkit-scrollbar-corner,
.inventory-table-scroll-wrapper::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}

/* Hide top scrollbar on mobile and when table doesn't need scrolling */
.table-scrollbar-top.hidden {
  display: none !important;
}

/* Firefox scrollbar styling for top scrollbar */
.table-scrollbar-top {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* Responsive adjustments for scrollbar - zoom responsive */
@media (max-width: 768px) {
  .table-scrollbar-top {
    height: 0.875rem; /* Slightly larger for touch but still scales */
  }

  .table-scrollbar-top::-webkit-scrollbar {
    height: 0.875rem;
  }
}

@media (max-width: 480px) {
  .table-scrollbar-top {
    height: 1rem; /* Larger on small devices but still scales */
  }

  .table-scrollbar-top::-webkit-scrollbar {
    height: 1rem;
  }
}

/* Table scroll wrapper - ensure horizontal scrollbar is accessible */
.inventory-table-scroll-wrapper {
  overflow-x: auto; /* Horizontal scroll for wide tables */
  overflow-y: visible; /* Let page handle vertical scroll */
  position: relative;
  /* Ensure there's enough bottom padding so scrollbar isn't cut off */
  padding-bottom: 20px;
  margin-bottom: -20px; /* Negative margin to maintain spacing */
}

/* Table title inside the header */
.inventory-table-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.inventory-table th {
  background: var(--bg-secondary);
  padding: 16px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.inventory-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.3s ease;
}

.inventory-table th.sortable:hover {
  color: var(--text-primary);
}

.inventory-table th i {
  margin-left: 8px;
  font-size: 0.8rem;
  opacity: 0.6;
}

.inventory-table td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.inventory-table tbody tr {
  transition: background 0.3s ease;
}

.inventory-table tbody tr:hover {
  background: var(--bg-tertiary);
}

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

.inventory-table tbody tr.in-house {
  background: rgba(79, 70, 229, 0.1);
}

.inventory-table tbody tr.outsourced {
  border-left: 6px solid #f59e0b; /* Orange border for outsourced items - increased width */
  background: rgba(245, 158, 11, 0.05); /* Light orange background for better visibility */
}

/* List color coding - dynamic colors applied via JavaScript */
.inventory-table tbody tr[data-list-id] {
  background-color: var(--list-bg-color, var(--bg-card)); /* Use list background color */
  color: var(--list-text-color, var(--text-primary)); /* Use list text color */
  /* Don't override border-left for outsourced items */
}

/* Ensure list text colors override cell colors */
.inventory-table tbody tr[data-list-id] td {
  color: var(--list-text-color, var(--text-primary)) !important;
}

/* Ensure outsourced items keep their border even when they have list colors */
.inventory-table tbody tr.outsourced[data-list-id] {
  border-left: 6px solid #f59e0b; /* Orange border for outsourced items */
  background: rgba(245, 158, 11, 0.05); /* Light orange background for better visibility */
}

/* Column-specific widths for better readability */
.inventory-table th[data-sort='calibrationMethod'],
.inventory-table td.column-calibrationMethod {
  min-width: 180px; /* Ensure Cal Method/Company column has enough space */
}

.inventory-table th[data-sort='maintenanceDate'],
.inventory-table td.column-maintenanceDate {
  min-width: 140px; /* Ensure Last Maintenance column has adequate space */
}

.inventory-table th[data-sort='maintenanceDue'],
.inventory-table td.column-maintenanceDue {
  min-width: 140px; /* Ensure Maintenance Due column has adequate space */
}

.inventory-table th[data-sort='calibrationDate'],
.inventory-table td.column-calibrationDate {
  min-width: 120px; /* Ensure Last Cal column has adequate space */
}

.inventory-table th[data-sort='nextCalibrationDue'],
.inventory-table td.column-nextCalibrationDue {
  min-width: 140px; /* Ensure Next Cal Due column has adequate space */
}

/* Inventory content wrapper - restore normal layout */
.inventory-content-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px; /* Add bottom margin for spacing */
}

.inventory-main-content {
  position: relative;
  flex: 1;
}

/* Inventory Legend */
.inventory-legend {
  display: flex;
  flex-direction: column; /* Changed to column for sections */
  gap: 16px; /* Gap between sections */
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  flex-shrink: 0; /* Prevent legend from shrinking */
  min-width: 200px; /* Ensure minimum width */
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.legend-color.outsourced {
  background: #f59e0b;
}

.legend-outsourced-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.legend-lists-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-lists-section h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

.legend-lists {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-list-color {
  width: 16px; /* Increased size for background swatch */
  height: 16px; /* Increased size for background swatch */
  border-radius: 3px;
  background-color: var(--list-bg-color); /* Use background color */
  border-left: none; /* Removed border */
}

/* Create First List Section */
.create-first-list-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  text-align: center;
}

.create-first-list-content h3 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 24px;
}

.create-first-list-content p {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 400px;
}

/* Create List Modal */
.color-selection {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.color-presets h4,
.color-custom h4 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
  font-size: 16px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.color-option {
  width: 50px; /* Increased from 40px */
  height: 50px; /* Increased from 40px */
  border-radius: 8px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
}

.color-option:hover {
  transform: scale(1.1);
  border-color: var(--accent-primary);
}

.color-option.selected {
  border-color: var(--accent-primary);
  transform: scale(1.1);
}

.theme-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.theme-selector label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.theme-selector select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.theme-selector select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.color-inputs {
  display: flex;
  gap: 16px;
}

.color-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px; /* Increased from 8px for better spacing */
}

.color-input-group label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px; /* Add space between label and input */
}

.color-input-group input[type='color'] {
  width: 160px; /* Increased from 80px to 160px (twice as big) */
  height: 100px; /* Increased from 50px to 100px (twice as big) */
  border: none;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid var(--border-color);
}

.auto-text-color-info {
  margin-top: 4px;
}

.auto-text-color-info small {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.8rem;
}

.action-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.action-btn.danger:hover {
  background: var(--accent-danger);
}

/* Compact action menu */
.action-menu {
  position: relative;
}

.action-menu-button {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  width: 36px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.action-menu-list {
  position: absolute;
  right: 0;
  top: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 180px;
  display: none;
  flex-direction: column;
  padding: 8px;
  z-index: 1000; /* above row hover/selection */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 300px;
  overflow-y: auto;
}

/* Keep menu interactive even if overlapping next row */
.action-menu.show .action-menu-list {
  display: flex;
  pointer-events: auto;
}

/* Flip menu upward when near bottom edge */
.action-menu.open-up .action-menu-list {
  top: auto;
  bottom: 36px;
}

/* Floating (viewport-fixed) menu to avoid clipping by scroll containers */
.action-menu-list.floating {
  position: fixed;
  right: auto;
  left: 0;
  top: 0;
  bottom: auto;
  z-index: 3000;
}

.action-menu-list button {
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.action-menu-list button:hover {
  background: var(--bg-tertiary);
}
.action-menu-list button.delete {
  color: var(--accent-danger);
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .nav-link,
  .add-item-btn,
  .logout-btn {
    min-height: 44px;
  }

  .input-wrapper input {
    min-height: 44px;
  }

  .login-btn,
  .register-btn {
    min-height: 48px;
  }

  .stat-card {
    min-height: 100px;
  }

  .action-btn {
    min-height: 44px;
    padding: 12px 16px;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

/* General modal improvements for better spacing and visual hierarchy */
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  max-width: 600px; /* Ensure modals have consistent width */
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

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

.modal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0; /* Remove default margin */
}

.modal-header h2 {
  color: var(--text-primary);
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

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

.modal-body {
  padding: 32px;
  line-height: 1.6;
}

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

/* Ensure consistent form styling across all modals */
.modal .form-group {
  margin-bottom: 32px;
}

.modal .form-group label {
  margin-bottom: 12px;
  display: block;
  font-weight: 500;
  color: var(--text-primary);
}

.modal .form-group input[type='text'],
.modal .form-group input[type='email'],
.modal .form-group input[type='password'],
.modal .form-group select,
.modal .form-group textarea {
  padding: 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text-primary);
  width: 100%;
  transition: border-color 0.3s ease;
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Add Item Form */
.add-item-form {
  padding: 32px;
}

.form-sections {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  overflow: hidden;
}

.form-section h3 {
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-group {
  margin-bottom: 20px;
  width: 100%;
  overflow: hidden;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

/* Override for login/register input spacing to avoid icon overlap */
.login-container .input-wrapper input,
.register-container .input-wrapper input {
  padding: 16px;
  padding-left: 56px; /* room for left icon */
  padding-right: 52px; /* room for toggle */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

/* Interval Input */
.interval-input {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.interval-input input[type='number'] {
  flex: 1;
  min-width: 80px;
  max-width: 120px;
}

.interval-input select {
  flex-shrink: 0;
  min-width: 80px;
  max-width: 100px;
  width: auto;
}

/* File Upload */
.file-upload-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.file-upload-section > label {
  display: block;
  margin-bottom: 16px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
}

.file-upload-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.file-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-upload label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.file-upload input[type='file'] {
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.file-info {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* Modal Actions */
.modal-actions {
  padding: 24px 32px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

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

/* Item Detail Modal */
.item-detail-content {
  padding: 32px;
}

.item-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.item-detail-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
}

.item-detail-section h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.item-detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 8px 0;
}

.item-detail-row:last-child {
  margin-bottom: 0;
}

.item-detail-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.item-detail-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.qr-code-section {
  text-align: center;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.qr-code-section img {
  max-width: 140px;
  height: auto;
  margin-bottom: 16px;
}

.qr-code-section h4 {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.qr-code-section p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.qr-code-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.qr-code-actions .btn {
  min-width: 100px;
}

/* Secondary info grid (QR + records) */
.item-secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.item-secondary-grid .item-detail-section {
  padding: 16px;
}
.item-secondary-grid .item-detail-section h3 {
  margin-bottom: 12px;
}

/* Responsive Modal */
@media (max-width: 768px) {
  .modal-content {
    margin: 20px;
    max-height: calc(100vh - 40px);
  }

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

  .file-upload-group {
    grid-template-columns: 1fr;
  }

  .item-detail-grid {
    grid-template-columns: 1fr;
  }

  .interval-input {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .interval-input input[type='number'],
  .interval-input select {
    max-width: none;
    width: 100%;
  }
}

/* Upload section styles */
.upload-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

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

/* File upload section in forms */
.file-upload-section {
  margin-top: 20px;
}

.file-upload-section label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.file-upload-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.file-upload {
  flex: 1;
  min-width: 200px;
}

/* File upload options for camera vs file upload */
.file-upload-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upload-option {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.upload-option .radio-label {
  margin-bottom: 12px;
}

/* Camera section styles */
.camera-section {
  margin-top: 16px;
}

.camera-preview {
  width: 100%;
  max-width: 400px;
  height: 300px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 16px;
}

.camera-placeholder {
  text-align: center;
  color: var(--text-secondary);
}

.camera-placeholder i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.camera-placeholder p {
  margin: 0;
  font-size: 0.9rem;
}

.camera-preview video,
.camera-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.camera-controls .btn {
  min-width: 120px;
}

.file-upload input[type='file'] {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
}

.file-upload input[type='file']::-webkit-file-upload-button {
  background: var(--accent-primary); /* Changed from accent-color to accent-primary */
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 12px;
}

.file-upload input[type='file']::-webkit-file-upload-button:hover {
  background: var(--accent-secondary); /* Changed from accent-hover to accent-secondary */
}

.file-info {
  display: block;
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Upload form styles */
.upload-form {
  padding: 0;
}

.upload-form .form-section {
  margin-bottom: 0;
}

.upload-form .modal-actions {
  margin-top: 24px;
}

/* Custom checkbox styles */
.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0;
}

.checkbox-label input[type='checkbox'] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  margin-right: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.checkbox-label input[type='checkbox']:checked + .checkmark {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox-label input[type='checkbox']:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.checkbox-label:hover .checkmark {
  border-color: var(--accent-primary);
}

/* Radio button styles */
.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.radio-label input[type='radio'] {
  display: none;
}

.radio-checkmark {
  width: 18px;
  height: 18px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  margin-right: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.radio-label input[type='radio']:checked + .radio-checkmark {
  border-color: var(--accent-primary);
}

.radio-label input[type='radio']:checked + .radio-checkmark::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
}

.radio-label:hover .radio-checkmark {
  border-color: var(--accent-primary);
}

/* Quick add modal styles */
.modal-content.small {
  max-width: 400px;
}

.quick-add-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 0;
}

.quick-add-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  width: 100%;
}

.quick-add-btn:hover {
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
  transform: translateY(-2px);
}

.quick-add-btn i {
  font-size: 1.5rem;
  color: var(--accent-primary);
  width: 24px;
}

/* Plus button in actions column */
.action-btn-plus {
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 0 8px;
  transition: all 0.3s ease;
}

.action-btn-plus:hover {
  background: var(--accent-secondary);
  transform: scale(1.05);
}

.action-btn-plus i {
  font-size: 0.875rem;
}

/* Column customizer styles - now part of the header */
.table-header-controls {
  display: flex;
  justify-content: flex-end;
  margin: 0; /* Remove margin since it's now in the header flex layout */
}

.column-customizer {
  position: relative;
}

.column-customizer-btn {
  background: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.column-customizer-btn:hover {
  border-color: var(--accent-secondary);
  background: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.column-customizer-btn i {
  font-size: 0.875rem;
}

.column-customizer-menu,
.list-menu {
  position: fixed; /* Use fixed positioning to avoid container overflow issues */
  top: auto; /* Will be set by JavaScript */
  right: auto; /* Will be set by JavaScript */
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  min-width: 320px; /* Increased to accommodate both sections */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none;
  margin-top: 8px;
  /* Ensure menu doesn't get cut off by scrollbars */
  max-width: calc(100vw - 40px); /* Prevent extending beyond viewport */
  overflow: visible;
  /* When height is limited by viewport, enable smooth scrolling */
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

.column-customizer-menu.show,
.list-menu.show {
  display: block;
  /* Ensure menu appears above all other elements when open */
  z-index: 2000;
}

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

/* Add spacing between sections in merged menu */
.column-customizer-header + .column-customizer-header {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.column-customizer-header h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.reset-columns-btn {
  background: var(--accent-secondary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.reset-columns-btn:hover {
  background: var(--accent-primary);
}

.column-options,
.list-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.menu-footer {
  margin-top: 8px; /* Reduced space above Add List button */
  padding-top: 8px; /* Reduced padding above Add List button */
  padding-bottom: 20px; /* Add space below Add List button for separation from Visible Columns */
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Align buttons cleanly to the right */
  gap: 8px;
}

/* Connected Button Group for Edit/Delete */
.list-button-group {
  display: flex;
  border-radius: 6px;
  overflow: hidden; /* Ensures clean corners */
  border: 1px solid var(--border-color);
}

.list-button-group button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 26px; /* Slightly shorter to account for group border */
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-button-group .edit-btn {
  border-right: 1px solid var(--border-color);
}

.list-button-group .edit-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.list-button-group .delete-btn:hover {
  background: var(--accent-danger);
  color: white;
}

.column-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  padding: 4px 0;
}

.column-option input[type='checkbox'] {
  margin: 0;
  accent-color: var(--accent-primary);
}

/* Responsive adjustments for column customizer */
@media (max-width: 768px) {
  .column-options {
    grid-template-columns: 1fr;
  }

  .column-customizer-menu {
    min-width: 240px;
    right: -20px;
    /* Ensure menu is fully visible on mobile */
    max-width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }

  /* Adjust positioning for very small screens */
  @media (max-width: 480px) {
    .column-customizer-menu {
      left: 5px;
      right: 5px;
      max-width: calc(100vw - 10px);
    }
  }
}

/* Enhanced table styles for better column management */
.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 1200px; /* Ensure table doesn't get too cramped */
}

.inventory-table th,
.inventory-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px; /* Prevent columns from getting too wide */
}

/* Actions column should never be cut off */
.inventory-table th:last-child,
.inventory-table td:last-child {
  max-width: none;
  min-width: 160px; /* Reduced from 200px for tighter layout */
  width: 160px; /* Fixed width to prevent expansion */
  position: sticky;
  right: 0;
  background: #0a0f1a; /* Darker than default --bg-secondary for distinction */
  z-index: 5;
  padding: 8px 12px; /* Reduced padding */
  box-shadow:
    -2px 0 0 0 rgba(112, 128, 255, 0.4),
    -4px 0 4px rgba(0, 0, 0, 0.1); /* Border via box-shadow + depth shadow */
}

/* When action menu is open, boost the entire actions cell z-index */
.inventory-table td:last-child:has(.action-menu.open),
.inventory-table td.actions:has(.action-menu.open) {
  z-index: 10000;
}

.inventory-table th:last-child {
  background: #0a0f1a; /* Match darker background */
  z-index: 15; /* Higher than other sticky headers */
}

.inventory-table td:last-child {
  background: #0a0f1a; /* Match darker background */
  overflow: visible !important; /* Ensure dropdowns are not cut off */
}

/* Table headers - sticky within scroll container */
.inventory-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
  z-index: 10;
  /* Ensure headers stay in sync with horizontal scroll */
}

/* Table data cells */
.inventory-table td {
  color: var(--text-secondary);
  vertical-align: middle;
}

/* Table container - restore normal behavior */
.inventory-table-container {
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  position: relative;
}

/* When fewer columns are visible, increase font size and padding */
.inventory-table.compact th,
.inventory-table.compact td {
  padding: 16px 12px;
  font-size: 1rem;
}

.inventory-table.compact td {
  max-width: 200px;
}

.inventory-table.compact th:last-child,
.inventory-table.compact td:last-child {
  max-width: none;
  min-width: 220px; /* Slightly more space in compact mode */
}

/* Sortable column headers */
.sortable {
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

.sortable:hover {
  background: var(--bg-input);
}

.sortable i {
  margin-left: 6px;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.sortable:hover i {
  opacity: 1;
}

/* Action buttons in table */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.action-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.action-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Custom Scrollbar Styling */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 0.75rem; /* Use rem for zoom responsiveness */
  height: 0.75rem;
}

::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 0.375rem;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 0.375rem;
  border: 0.125rem solid var(--bg-input);
  min-width: 2rem; /* Minimum thumb size */
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

::-webkit-scrollbar-corner {
  background: var(--bg-input);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-input);
}

/* Table-specific scrollbar */
.inventory-table-container::-webkit-scrollbar {
  height: 0.75rem; /* Use rem for zoom responsiveness */
}

.inventory-table-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 0.375rem;
}

.inventory-table-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 0.375rem;
  border: 0.125rem solid var(--bg-secondary);
  min-width: 2rem; /* Minimum thumb size */
}

.inventory-table-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Column customizer scrollbar */
.column-options::-webkit-scrollbar {
  width: 0.5rem; /* Use rem for zoom responsiveness */
}

.column-options::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 0.25rem;
}

.column-options::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 0.25rem;
  border: 0.0625rem solid var(--bg-input);
  min-width: 1.5rem; /* Minimum thumb size */
}

.column-options::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Modal content scrollbar */
.modal-content::-webkit-scrollbar {
  width: 0.5rem; /* Use rem for zoom responsiveness */
}

.modal-content::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 0.25rem;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 0.25rem;
  border: 0.0625rem solid var(--bg-secondary);
  min-width: 1.5rem; /* Minimum thumb size */
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Template links section in upload modal */
.template-links-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.template-links-section h4 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.template-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.template-link:not(.disabled):hover {
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
}

.template-link i {
  color: var(--accent-primary);
  font-size: 1rem;
  width: 16px;
}

/* Fix hyperlink contrast - make links much lighter for better visibility on dark backgrounds */
.template-link a {
  color: #60a5fa; /* Much lighter blue for better contrast against purple backgrounds */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.template-link a:hover {
  color: #93c5fd; /* Even lighter blue on hover */
  text-decoration: underline;
}

.template-link.disabled {
  opacity: 0.6;
  background: var(--bg-tertiary);
}

.template-link.disabled i {
  color: var(--text-muted);
}

/* Prevent dropdown clipping in table rows */
.inventory-table tr {
  position: relative;
}

.inventory-table td:last-child {
  overflow: visible;
}

.action-menu {
  position: relative;
  z-index: 5;
}

.action-menu-list {
  position: absolute;
  right: 0;
  top: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 180px;
  display: none;
  flex-direction: column;
  padding: 8px;
  z-index: 2000; /* Increased z-index to appear above scrollbars */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 300px;
  overflow-y: auto;
}

/* Keep menu interactive even if overlapping next row */
.action-menu.show .action-menu-list {
  display: flex;
  pointer-events: auto;
}

/* Ensure table can show dropdowns outside row bounds */
.inventory-table {
  position: relative;
  overflow: visible;
}

/* When an action menu is open, lift that cell above all others */
.inventory-table td:last-child:has(.action-menu.show) {
  z-index: 9999 !important;
}

/* Also lift the action menu container while open */
.action-menu.show {
  z-index: 2000;
}

/* Add spacing for form groups in edit list modal */
#editListModal .form-group {
  margin-bottom: 32px; /* Increased from 24px for better separation */
}

#editListModal .form-group label {
  margin-bottom: 12px; /* Increased from 8px for better label spacing */
  display: block;
  font-weight: 500; /* Make labels more prominent */
}

#editListModal .form-group input[type='text'] {
  padding: 16px 20px; /* Increased from 12px 16px for better text spacing from borders */
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px; /* Ensure readable text size */
}

/* Add spacing for color selection sections */
#editListModal .color-selection {
  margin-top: 24px; /* Increased from 16px */
}

#editListModal .color-presets {
  margin-bottom: 32px; /* Increased from 24px */
}

#editListModal .color-custom {
  margin-top: 28px; /* Increased from 20px */
}

#editListModal .color-custom h4 {
  margin-bottom: 20px; /* Increased from 16px */
}

/* Add spacing for theme selector */
#editListModal .theme-selector {
  margin-bottom: 20px; /* Add space below theme selector */
}

#editListModal .theme-selector label {
  margin-bottom: 8px; /* Space between theme label and dropdown */
  display: block;
}

/* Add spacing for preset colors heading */
#editListModal .color-presets h4 {
  margin-bottom: 16px; /* Space between heading and color grid */
}

/* Improve modal content padding */
#editListModal .modal-body {
  padding: 32px; /* Increased padding around modal content */
}

#editListModal .modal-header {
  padding: 24px 32px 16px 32px; /* Better header spacing */
}

#editListModal .modal-actions {
  padding: 24px 32px 32px 32px; /* Better action button spacing */
  margin-top: 16px; /* Space above action buttons */
}

/* Add spacing for form groups in create list modal */
#createListModal .form-group {
  margin-bottom: 32px; /* Increased from 24px for consistency */
}

#createListModal .form-group label {
  margin-bottom: 12px; /* Increased from 8px for consistency */
  display: block;
  font-weight: 500; /* Make labels more prominent */
}

#createListModal .form-group input[type='text'] {
  padding: 16px 20px; /* Increased from 12px 16px for consistency */
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px; /* Ensure readable text size */
}

/* Add spacing for color selection sections in create modal */
#createListModal .color-selection {
  margin-top: 24px; /* Increased from 16px for consistency */
}

#createListModal .color-presets {
  margin-bottom: 32px; /* Increased from 24px for consistency */
}

#createListModal .color-custom {
  margin-top: 28px; /* Increased from 20px for consistency */
}

#createListModal .color-custom h4 {
  margin-bottom: 20px; /* Increased from 16px for consistency */
}

/* Add spacing for theme selector in create modal */
#createListModal .theme-selector {
  margin-bottom: 20px; /* Add space below theme selector */
}

#createListModal .theme-selector label {
  margin-bottom: 8px; /* Space between theme label and dropdown */
  display: block;
}

/* Add spacing for preset colors heading in create modal */
#createListModal .color-presets h4 {
  margin-bottom: 16px; /* Space between heading and color grid */
}

/* Improve modal content padding for create modal */
#createListModal .modal-body {
  padding: 32px; /* Increased padding around modal content */
}

#createListModal .modal-header {
  padding: 24px 32px 16px 32px; /* Better header spacing */
}

#createListModal .modal-actions {
  padding: 24px 32px 32px 32px; /* Better action button spacing */
  margin-top: 16px; /* Space above action buttons */
}

/* General link improvements for better contrast */
a {
  color: #60a5fa; /* Much lighter blue for better contrast */
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #93c5fd; /* Even lighter blue on hover */
  text-decoration: underline;
}

/* Ensure file links have good contrast */
.file-link,
.document-link {
  color: #60a5fa; /* Much lighter blue for better contrast */
  text-decoration: none;
  font-weight: 500;
}

.file-link:hover,
.document-link:hover {
  color: #93c5fd; /* Even lighter blue on hover */
  text-decoration: underline;
}

/* Notes column styling */
.column-notes {
  max-width: 200px; /* Limit width for better table layout */
  word-wrap: break-word;
  white-space: normal; /* Allow text to wrap */
}

/* Notes column in item detail */
.item-detail-section .item-detail-row .item-detail-value {
  word-wrap: break-word;
  max-width: 100%;
}

/* ===== iPad and Touch Device Optimizations ===== */

/* iPad-specific styles */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
  /* Larger touch targets for iPad */
  button,
  .btn,
  input[type='button'],
  input[type='submit'] {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
  }

  /* Larger form inputs */
  input,
  textarea,
  select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
  }

  /* Larger table cells for better touch interaction */
  .inventory-table th,
  .inventory-table td {
    padding: 16px 12px;
    min-height: 44px;
  }

  /* Larger modal close buttons */
  .modal-close {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  /* Better spacing for iPad */
  .container {
    padding: 30px;
  }

  .login-container,
  .register-container {
    max-width: 500px;
    padding: 50px;
  }

  /* Larger icons for better touch interaction */
  .fas,
  .far,
  .fab {
    font-size: 1.2em;
  }

  /* Better table scrolling on iPad */
  .inventory-table-container {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  /* Larger dropdown menus */
  .dropdown-menu {
    min-width: 200px;
  }

  .dropdown-menu a {
    padding: 12px 16px;
    min-height: 44px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  button:hover,
  .btn:hover,
  a:hover {
    transform: none;
    box-shadow: none;
  }

  /* Add active states for touch feedback */
  button:active,
  .btn:active,
  a:active {
    transform: scale(0.98);
    opacity: 0.8;
  }

  /* Larger touch targets */
  .clickable,
  [role='button'] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Better scrolling */
  .scrollable {
    -webkit-overflow-scrolling: touch;
  }
}

/* Landscape iPad optimizations */
@media only screen and (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
  .inventory-content-wrapper {
    flex-direction: row;
    gap: 30px;
  }

  .inventory-legend {
    min-width: 250px;
  }

  .inventory-table-container {
    max-width: calc(100vw - 300px);
  }
}

/* Portrait iPad optimizations */
@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .inventory-content-wrapper {
    flex-direction: column;
    gap: 20px;
  }

  .inventory-legend {
    min-width: 100%;
    order: -1; /* Move legend to top on portrait */
  }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure crisp text and borders */
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Prevent text size adjustment on orientation change */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* Better focus indicators for accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Loading states for better UX */
.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* Disable pull-to-refresh on iOS */
html,
body {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* --- OOS chip next to Nickname --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}
.chip-oos {
  background: #3b0a0a;
  color: #ffb3b3;
  border-color: rgba(255, 64, 64, 0.35);
}

.chip-outsourced {
  background: #1a2b3d;
  color: #87ceeb;
  border-color: rgba(135, 206, 235, 0.35);
}

/* --- OOS row tint (no opacity!) --- */
.row-oos {
  background: linear-gradient(0deg, rgba(255, 64, 64, 0.08), rgba(255, 64, 64, 0.08));
}

/* Actions cell is a positioning context for the dropdown */
.actions-cell {
  position: relative;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px; /* Reduced from 8px to 6px (25% reduction) */
}

/* Dark buttons that should always be visible */
.actions-cell .action-btn,
.actions-cell .action-btn-plus,
.actions-cell .action-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px; /* Ensure consistent height */
  vertical-align: middle;
}

/* The menu container (rendered once per row) */
.actions-cell .action-menu {
  display: none; /* ← hidden by default */
  position: fixed; /* Use fixed positioning to escape stacking contexts */
  right: 20px; /* Position from viewport edge */
  top: auto; /* Will be set by JavaScript */
  min-width: 220px;
  background: #0f1424;
  border: 1px solid #2b3152;
  border-radius: 10px;
  padding: 6px;
  z-index: 99999; /* Extremely high z-index */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: translateY(0); /* Create new stacking context */
}

/* Visible state */
.actions-cell .action-menu.open {
  display: block;
}

/* Menu item buttons */
.actions-cell .action-menu .menu-item {
  display: flex;
  width: 100%;
  border: 0;
  background: transparent;
  color: #e6e7ee;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.actions-cell .action-menu .menu-item:hover {
  background: #171c30;
}

/* If any legacy "light" inline buttons sneak in, make them vanish */
.actions-cell > .menu-item,
.actions-cell > .btn-light,
.actions-cell > .inline-menu,
.action-buttons > .menu-item,
.action-buttons > .btn-light {
  display: none !important;
}

/* Ensure action menus always render above rows */
.table-col-actions,
.actions-cell,
td.actions {
  position: relative;
  z-index: 1;
}

/* Make sure table wrappers don't clip menus */
.inventory-table-wrap,
.table-scroll,
.table-container,
.inventory-table {
  overflow: visible !important;
}

/* Ensure action column has proper overflow */
td.actions {
  overflow: visible;
}

/* Legend & toolbar helpers (no scrollbars) */
.legend-inline {
  flex-shrink: 0;
  overflow: visible;
}

/* OOS modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50000;
}
.modal.hidden {
  display: none;
}
.modal-card {
  background: #1a1a2e;
  border: 1px solid #2d2d5a;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-card h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}
.modal-card .input,
.modal-card .textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #2d2d5a;
  border-radius: 6px;
  background: #2a2a4a;
  color: #ffffff;
  font-family: inherit;
  margin-top: 4px;
}
.modal-card .textarea {
  min-height: 80px;
  resize: vertical;
}
.modal-card .btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.modal-card .btn-ghost {
  background: transparent;
  border-color: #2d2d5a;
  color: #b8b8d1;
}
.modal-card .btn-ghost:hover {
  background: #2a2a4a;
}
.modal-card .btn-danger {
  background: #ef4444;
  color: white;
}
.modal-card .btn-danger:hover {
  background: #dc2626;
}
.modal-card .btn-primary {
  background: #4f46e5;
  color: white;
}
.modal-card .btn-primary:hover {
  background: #4338ca;
}
.modal-card .flex {
  display: flex;
}
.modal-card .justify-end {
  justify-content: flex-end;
}
.modal-card .gap-2 {
  gap: 8px;
}
.modal-card .mt-2 {
  margin-top: 8px;
}
.modal-card .mt-3 {
  margin-top: 12px;
}
.modal-card .mt-4 {
  margin-top: 16px;
}
.modal-card .block {
  display: block;
}
.modal-card .text-sm {
  font-size: 14px;
}
.modal-card .text-red-400 {
  color: #f87171;
}

/* File name display with overflow handling */
.file-display,
.current-file,
.file-name {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

/* File input containers */
.file-input-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-input-container .file-display {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Service Log styling - single column with horizontal card content */
.service-log-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.service-log-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  transition: background-color 0.2s ease;
}

.service-log-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.service-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.service-log-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-log-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.service-log-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.service-log-date {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.service-log-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.service-log-notes {
  color: var(--text-secondary);
  line-height: 1.4;
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .service-log-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .service-log-header-right {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Settings Page Styling */
.settings-section {
  padding: 24px;
}

.settings-section-header {
  margin: 32px 0 24px 0;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.settings-section-header:first-child {
  margin-top: 0;
}

.settings-section-header h3 {
  color: var(--primary-color);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.9rem;
}

.settings-content {
  max-width: 1200px;
  margin: 0 auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.settings-card:hover {
  box-shadow: var(--shadow-md);
}

.settings-card-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.settings-card-header h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-card-header h3 i {
  color: var(--accent-primary);
}

.settings-card-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.settings-card-content {
  padding: 20px;
}

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

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.form-help {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* Notification Settings Styles */
.notification-section {
  margin: 24px 0;
  padding: 20px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.notification-section h4 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-section h4 i {
  color: var(--accent-secondary);
  font-size: 0.9rem;
}

.section-description {
  margin: 0 0 16px 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

/* Button-style checkbox to match the "Change Location" aesthetic */
.checkbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-bottom: 8px;
  min-height: 48px;
  max-width: 400px;
  width: fit-content;
  position: relative;
}

/* Alternative: No-checkbox version - just a toggle button */
.checkbox-label.no-checkbox {
  justify-content: flex-start;
  padding-right: 50px;
}

.checkbox-label.no-checkbox .checkbox-custom {
  display: none;
}

.checkbox-label.no-checkbox::after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  transition: all 0.2s ease;
}

.checkbox-label.no-checkbox.checked::after {
  background: white;
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.checkbox-label:hover {
  background: var(--bg-input);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.checkbox-label input[type='checkbox'] {
  display: none;
}

/* Checked state - make the whole button look selected */
.checkbox-label.checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.checkbox-label.checked .checkbox-text {
  color: white;
}

.checkbox-label.checked:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid #4a5568;
  border-radius: 3px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
  background: #2d3748;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox-label input[type='checkbox']:checked + .checkbox-custom {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox-label input[type='checkbox']:checked + .checkbox-custom::before {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
}

.checkbox-text {
  flex: 1;
  order: 1;
}

.checkbox-custom {
  order: 3;
}

.checkbox-text {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-left: 0;
}

.required-indicator {
  color: var(--accent-secondary);
  font-size: 0.8rem;
  font-style: italic;
  margin-left: 4px;
}

.reminders-list {
  margin: 16px 0;
}

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 8px;
}

.reminder-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.reminder-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.reminder-badge.both {
  background: var(--accent-primary);
  color: white;
}

.reminder-badge.calibration {
  background: var(--accent-warning);
  color: var(--bg-primary);
}

.reminder-badge.maintenance {
  background: var(--accent-success);
  color: white;
}

.reminder-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.reminder-mandatory {
  color: var(--accent-warning);
  font-size: 0.8rem;
  font-style: italic;
}

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

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

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

.btn-icon.delete:hover {
  background: var(--accent-danger);
  color: white;
}

.policies-list {
  margin: 16px 0;
}

.policy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 8px;
}

.policy-info {
  flex: 1;
}

.policy-title {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.policy-details {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.policy-roles {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.role-tag {
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Navigation placeholder styling */
.nav-item.company-placeholder .nav-link {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.nav-link.disabled {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

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

  .settings-section {
    padding: 16px;
  }
}

/* My Company Page Styling */
.company-section {
  padding: 24px;
}

.company-content {
  max-width: 1200px;
  margin: 0 auto;
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.company-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.company-card:hover {
  box-shadow: var(--shadow-md);
}

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

.company-card-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.company-card-header h3 i {
  color: var(--accent-primary);
}

.company-card-content {
  padding: 20px;
}

/* Company Info Display */
.company-info-display {
  display: grid;
  gap: 16px;
}

.company-info-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.company-info-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.company-info-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

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

.company-info-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* Logo Upload Area */
.logo-upload-area {
  text-align: center;
}

.current-logo {
  margin-bottom: 16px;
  padding: 20px;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.no-logo {
  color: var(--text-muted);
}

.no-logo i {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.no-logo p {
  margin: 0;
  font-size: 0.9rem;
}

/* Users List */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

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

.user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-email {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.user-role {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-primary);
  color: white;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

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

/* Form Row Layout */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Company-specific card sizing */
.company-info-card {
  grid-column: span 2;
}

.company-users-card {
  grid-column: span 2;
}

/* Logo upload area improvements */
.logo-upload-area {
  text-align: center;
  padding: 16px;
}

.current-logo {
  margin-bottom: 20px;
  padding: 24px;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.logo-upload-area .btn {
  margin: 0 8px;
}

/* Responsive company page */
@media (max-width: 1024px) {
  .company-info-card,
  .company-users-card {
    grid-column: span 1;
  }
}

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

  .company-section {
    padding: 16px;
  }

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

  .company-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Invite Confirmation Styles */
.invite-confirm-container {
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.invite-confirm-header {
  text-align: center;
  margin-bottom: 30px;
}

.company-welcome {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
}

.company-welcome i {
  font-size: 3rem;
  color: var(--accent-primary);
  margin-bottom: 15px;
}

.company-welcome h2 {
  margin: 0 0 10px 0;
  color: var(--text-primary);
  font-size: 1.8rem;
}

.company-welcome p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.invite-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
}

.invite-info-card h3 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.invite-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.detail-row label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.detail-row span {
  color: var(--text-primary);
  font-weight: 500;
}

.invite-confirm-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 30px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
}

.invite-actions {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

.invite-actions .btn {
  flex: 1;
  padding: 12px 20px;
  font-weight: 500;
}

.invite-footer {
  margin-top: 20px;
  text-align: center;
}

.invite-footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.invite-footer i {
  color: var(--accent-primary);
}

/* Responsive invite confirmation */
@media (max-width: 768px) {
  .invite-confirm-container {
    padding: 16px;
  }

  .company-welcome {
    padding: 20px;
  }

  .invite-info-card,
  .invite-confirm-form {
    padding: 20px;
  }

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

/* Export Modal Styling */
.export-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}

.export-option {
  position: relative;
}

.export-option input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.export-option label {
  display: block;
  cursor: pointer;
  padding: 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  transition: all 0.2s ease;
}

.export-option label:hover {
  border-color: var(--accent-primary);
  background: var(--bg-tertiary);
}

.export-option input[type='radio']:checked + label {
  border-color: var(--accent-primary);
  background: rgba(112, 128, 255, 0.1);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.option-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.option-header i {
  color: var(--accent-primary);
  font-size: 1.1rem;
}

.option-header strong {
  color: var(--text-primary);
  font-size: 1.1rem;
}

.option-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.4;
}

.item-count {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 4px;
}

.modal-description {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

/* Responsive export modal */
@media (max-width: 768px) {
  .export-option label {
    padding: 16px;
  }

  .option-header {
    gap: 8px;
  }
}

/* Search Container and Popup Styling */
.search-container {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-right: 16px;
}

.search-results-popup {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
}

.search-count {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.search-navigation {
  display: flex;
  gap: 4px;
}

.search-nav-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.search-nav-btn:hover:not(:disabled) {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.search-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-nav-btn i {
  font-size: 0.75rem;
}

/* Search highlighting */
.search-highlight {
  background-color: #ffeb3b;
  color: #000;
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 500;
}

.search-highlight.current-match {
  background-color: #ff9800;
  color: white;
}

/* Adjust top-actions layout for new search position */
.top-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

/* Table Header Legend Styling */
.table-header-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 20px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  flex-wrap: wrap;
}

.table-header-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.table-header-legend .legend-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.table-header-legend .legend-lists {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 400px; /* Limit width to encourage wrapping after 4 items */
}

.table-header-legend .legend-lists .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-header-legend .legend-lists .legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.table-header-legend .legend-lists .legend-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Update inventory table header to accommodate legend - merged with sticky positioning */

/* Inventory Sidebar (where old legend was) */
.inventory-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 280px;
  padding-left: 20px;
}

.inventory-sidebar .column-customizer-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.inventory-sidebar .column-customizer-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.inventory-sidebar .column-customizer-btn i {
  color: var(--accent-primary);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .table-header-legend {
    margin-left: 12px;
    gap: 12px;
  }

  .table-header-legend .legend-lists {
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .inventory-table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .table-header-legend {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .inventory-content-wrapper {
    flex-direction: column;
  }

  .inventory-sidebar {
    min-width: auto;
    padding-left: 0;
    align-items: center;
    margin-top: 16px;
  }
}

/* Responsive search */
@media (max-width: 768px) {
  .search-container {
    margin-right: 8px;
    min-width: 200px;
  }

  .search-results-popup {
    padding: 6px 8px;
    min-height: 32px;
  }

  .search-count {
    font-size: 0.8rem;
  }

  .search-nav-btn {
    width: 20px;
    height: 20px;
  }
}

/* Duplicate Checkbox Styling */
.duplicate-checkbox {
  margin-right: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.duplicate-checkbox input[type='checkbox'] {
  margin: 0;
}

.duplicate-checkbox .checkmark {
  margin-right: 4px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Responsive modal actions */
@media (max-width: 768px) {
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .duplicate-checkbox {
    margin-right: 0;
    justify-content: center;
  }

  .action-buttons {
    justify-content: center;
  }
}

/* Status Column Styling */
.status-column {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
  padding: 8px 4px;
}

.status-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  min-height: 44px; /* Height to accommodate 2 stacked chips */
  justify-content: center;
}

.status-chips .chip {
  font-size: 10px;
  padding: 2px 6px;
  white-space: nowrap;
  width: fit-content;
}

/* Ensure consistent row height across all inventory table rows */
.inventory-table tbody tr {
  min-height: 60px; /* Accommodate stacked chips + padding */
}

.inventory-table tbody td {
  vertical-align: middle;
  min-height: 44px; /* Match status-chips min-height */
}

/* Location Header Styles */
.location-header {
  background: var(--bg-primary);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  border-radius: 12px 12px 0 0;
  position: sticky;
  top: 0;
  z-index: 110;
  flex-shrink: 0;
}

.location-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.location-name {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* Location Button Header - the area with Edit Lists and Change Location buttons */
.location-button-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Location Selection Modal */
.location-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.location-option {
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.location-option:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
}

.location-option.selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-light);
}

.location-option-info h4 {
  color: var(--text-primary);
  margin: 0 0 4px 0;
  font-size: 1rem;
  font-weight: 600;
}

.location-option-info p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.875rem;
}

/* Adjust inventory header when location header is present */
.location-header + .inventory-table-header {
  border-radius: 0;
  top: 60px;
}

/* User Management Styles */
.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.user-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
}

.user-info {
  flex: 1;
}

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

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

.user-badges {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-role-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-account-admin {
  background: #7c2d12;
  color: white;
}
.role-owner {
  background: #dc2626;
  color: white;
}
.role-admin {
  background: #ea580c;
  color: white;
}
.role-manager {
  background: #0ea5e9;
  color: white;
}
.role-user {
  background: #10b981;
  color: white;
}
.role-viewer {
  background: #6b7280;
  color: white;
}

.employee-id-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.user-email {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.user-locations {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.company-owner-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-style: italic;
}

/* Location Assignment Styles */
.location-assignments {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  background: var(--bg-secondary);
  margin-bottom: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.location-assignment {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.location-assignment:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.location-assignment-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.location-assignment-checkbox:hover {
  background: var(--bg-card);
}

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

.location-address {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-left: auto;
}

.location-lists {
  margin-left: 24px;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.location-lists-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.location-lists-header .form-label {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: underline;
  padding: 4px 8px;
}

.btn-link:hover {
  color: var(--accent-primary-dark);
}

.location-lists-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.list-permission-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.list-permission-checkbox:hover {
  background: var(--bg-input);
}

.list-name {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-block;
  min-width: 60px;
  text-align: center;
}

/* Responsive user management */
@media (max-width: 768px) {
  .user-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .user-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .user-actions {
    align-self: stretch;
    justify-content: flex-end;
  }

  .location-lists-content {
    grid-template-columns: 1fr;
  }
}

/* Location Button Header - the area with Edit Lists and Change Location buttons */
.location-button-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Position the column customizer menu relative to the new button location */
.location-header {
  position: relative;
}

.location-header .column-customizer-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 280px;
  max-height: 60vh;
  overflow-y: auto;
  display: none;
}

.location-header .column-customizer-menu.show {
  display: block;
}

/* Import Modal Styles */
.import-info {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 15px;
  margin-top: 10px;
}

.import-info ul {
  margin: 10px 0;
  padding-left: 20px;
}

.import-info li {
  margin: 5px 0;
  line-height: 1.4;
}

.import-info em {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.btn-success {
  background: var(--accent-success);
  color: white;
  border: none;
}

.btn-success:hover {
  background: #059669;
}
