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

/* Fluid Typography - scales with viewport */
html {
  /* Base font size: 14px at 1280px, 16px at 1920px, 12px at 768px */
  font-size: clamp(0.75rem, 0.5rem + 0.5vw, 1.125rem);
}

:root {
  --primary: #4F7499;
  --primary-dark: #3D5C7A;
  --primary-light: #6A8FB3;
  --secondary: #424242;
  --surface: #ffffff;
  --surface-variant: #f5f5f5;
  --error: #d32f2f;
  --success: #388e3c;
  --warning-bg: #FEF3C7;
  --warning-border: #FCD34D;
  --warning-text: #92400E;
  --on-surface: #212121;
  --on-surface-variant: #757575;
  --border: #e0e0e0;
  --shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
  --shadow-lg: 0 0.25rem 0.75rem rgba(0,0,0,0.15);
  
  /* Responsive spacing scale */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
}

[data-theme="dark"] {
  --primary: #4F7499;
  --primary-dark: #3D5C7A;
  --primary-light: #6A8FB3;
  --secondary: #7a7a7a;
  --surface: #3a3a3a;
  --surface-variant: #4a4a4a;
  --error: #ef5350;
  --success: #66bb6a;
  --warning-bg: #5a5040;
  --warning-border: #fbbf24;
  --warning-text: #fde68a;
  --on-surface: #e8e8e8;
  --on-surface-variant: #b0b0b0;
  --border: #5a5a5a;
  --shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.2);
  --shadow-lg: 0 0.25rem 0.75rem rgba(0,0,0,0.3);
}

[data-theme="ash"] {
  --primary: #4F7499;
  --primary-dark: #3D5C7A;
  --primary-light: #6A8FB3;
  --secondary: #8a8a8a;
  --surface: #505050;
  --surface-variant: #606060;
  --error: #ef5350;
  --success: #66bb6a;
  --warning-bg: #6a6050;
  --warning-border: #fbbf24;
  --warning-text: #fde68a;
  --on-surface: #ececec;
  --on-surface-variant: #c0c0c0;
  --border: #6a6a6a;
  --shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.15);
  --shadow-lg: 0 0.25rem 0.75rem rgba(0,0,0,0.25);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--surface-variant);
  color: var(--on-surface);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* Link Styles for Detail Views */
.name-link {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.name-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.link {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.link:hover {
  text-decoration: underline;
}

/* Kanban Card Actions */
.kanban-card-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.container {
  max-width: 87.5rem;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.header {
  background: var(--primary);
  color: white;
  padding: var(--spacing-sm) 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xl);
}

.header-logo {
  flex-shrink: 0;
}

.header-logo a {
  display: block;
  line-height: 0;
}

.header-logo img {
  height: 4rem;
  width: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-shrink: 0;
}

.products-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  padding: var(--spacing-sm);
  border-radius: 0.25rem;
  transition: background 0.2s;
  text-decoration: none;
}

.products-icon-link:hover {
  background: rgba(255,255,255,0.1);
}

.products-icon-link.active {
  background: rgba(255,255,255,0.2);
}

.nav {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  margin-right: var(--spacing-xl);
}

.nav a, .nav button {
  color: white;
  text-decoration: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 0.25rem;
  transition: background 0.2s;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
}

.nav a:hover, .nav button:hover {
  background: rgba(255,255,255,0.1);
}

.nav a.active {
  background: rgba(255,255,255,0.2);
}

.search-form {
  margin: 0;
}

.search-input {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: 1.25rem;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 0.875rem;
  width: 12.5rem;
  transition: all 0.2s;
}

.search-input::placeholder {
  color: rgba(255,255,255,0.7);
}

.search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.3);
  width: 15.625rem;
}

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

.search-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.search-toggle:hover {
    opacity: 1;
}

.search-form-expandable {
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}

.search-container.expanded .search-form-expandable {
    width: 200px;
}

.search-input-expandable {
    width: 100%;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 0.375rem;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.875rem;
    outline: none;
}

.search-input-expandable::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-input-expandable:focus {
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.2);
}

.profile-dropdown {
  position: relative;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 0.25rem;
  color: white;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.profile-button:hover {
  background: rgba(255,255,255,0.2);
}

.profile-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.dropdown-arrow {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s;
}

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

.profile-menu {
  position: absolute;
  top: calc(100% + var(--spacing-sm));
  right: 0;
  background: var(--surface);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  min-width: 12.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.625rem);
  transition: all 0.2s;
  z-index: 1000;
}

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

.profile-menu-item {
  display: block;
  padding: 0.75rem var(--spacing-md);
  color: var(--on-surface);
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.875rem;
}

.profile-menu-item:hover {
  background: var(--surface-variant);
}

.profile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: var(--spacing-xs) 0;
}

/* Navigation More Dropdown */
.nav-more-dropdown {
  position: relative;
}

.nav-more-button {
  color: white;
  text-decoration: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 0.25rem;
  transition: background 0.2s;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.nav-more-button:hover {
  background: rgba(255,255,255,0.1);
}

.nav-more-menu {
  position: absolute;
  top: calc(100% + var(--spacing-sm));
  right: 0;
  background: var(--surface);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  min-width: 12rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.625rem);
  transition: all 0.2s;
  z-index: 1000;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.nav-more-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-more-item {
  display: block;
  padding: 0.75rem var(--spacing-md);
  color: #1f2937;
  background: white;
  text-decoration: none;
  transition: background 0.2s;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
  min-height: 2.5rem;
  line-height: 1.5;
  border-bottom: 1px solid #e5e7eb;
}

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

.nav-more-item:hover {
  background: #f3f4f6;
}

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

[data-theme="dark"] .nav-more-item {
  color: #f3f4f6;
  background: #1f2937;
  border-bottom: 1px solid #374151;
}

[data-theme="dark"] .nav-more-item:hover {
  background: #374151;
}

[data-theme="dark"] .nav-more-item.active {
  background: var(--primary);
  color: white;
}

.main {
  padding: var(--spacing-xl) 0;
  min-height: calc(100vh - 4.375rem);
}

.card {
  background: var(--surface);
  border-radius: 0.5rem;
  padding: var(--spacing-lg);
  box-shadow: var(--shadow);
  margin-bottom: var(--spacing-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--on-surface);
}

.btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface-variant);
  color: var(--on-surface);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #eeeeee;
}

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

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

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.favorite-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--on-surface-variant);
  transition: all 0.2s;
}

.favorite-btn:hover {
  color: #FFA000;
  transform: scale(1.2);
}

.favorite-btn[data-favorited="true"] {
  color: #FFA000;
}

.favorite-btn[data-favorited="true"]:hover {
  color: var(--on-surface-variant);
}

.favorite-icon {
  display: inline-block;
  user-select: none;
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  color: var(--on-surface);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  font-size: 1rem;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 0.125rem rgba(25, 118, 210, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 6.25rem;
}

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

.table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--surface-variant);
  font-weight: 500;
  border-bottom: 0.125rem solid var(--border);
}

.table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.table tr:hover {
  background: var(--surface-variant);
}

/* Data table for associated lists with expanded columns and separators */
.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--surface-variant);
  font-weight: 600;
  border-bottom: 0.125rem solid var(--border);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  position: relative;
  user-select: none;
}

.data-table th:last-child {
  border-right: none;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.data-table td:last-child {
  border-right: none;
}

.data-table tr:hover {
  background: var(--surface-variant);
}

/* Resizable column handle */
.data-table th .resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.data-table th .resize-handle:hover {
  background: rgba(0, 0, 0, 0.1);
}

.chip {
  display: inline-block;
  padding: var(--spacing-xs) 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
}

.chip-primary { background: rgba(25, 118, 210, 0.1); color: var(--primary); }
.chip-success { background: rgba(56, 142, 60, 0.1); color: var(--success); }
.chip-error { background: rgba(211, 47, 47, 0.1); color: var(--error); }
.chip-warning { background: rgba(245, 124, 0, 0.1); color: #f57c00; }

.grid {
  display: grid;
  gap: var(--spacing-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Responsive Breakpoints */

/* Large Desktop (1920px and up) - Slightly larger base size */
@media (min-width: 120em) {
  html {
    font-size: clamp(1rem, 0.8rem + 0.3vw, 1.125rem);
  }
}

/* Desktop (1024px to 1919px) - Default */
@media (min-width: 64em) and (max-width: 119.9375em) {
  /* Uses default clamp values */
}

/* Tablet (768px to 1023px) - Adjust spacing and layout */
@media (min-width: 48em) and (max-width: 63.9375em) {
  html {
    font-size: clamp(0.875rem, 0.7rem + 0.4vw, 1rem);
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .header-logo img {
    height: 2.5rem;
  }
  
  .nav a, .nav button {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
  }
  
  .kanban-column {
    flex: 0 0 15rem;
  }
  
  .modal-content {
    max-width: 90%;
  }
}

/* Mobile (up to 767px) - Stack layout, larger touch targets */
@media (max-width: 47.9375em) {
  html {
    font-size: clamp(0.875rem, 0.75rem + 0.5vw, 1rem);
  }
  
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .header {
    padding: var(--spacing-xs) 0;
  }
  
  .header .container {
    gap: var(--spacing-sm);
    flex-wrap: wrap;
  }
  
  .header-logo img {
    height: 2rem;
  }
  
  .nav {
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    width: 100%;
    justify-content: center;
  }
  
  .nav a, .nav button {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
  }
  
  .search-input {
    width: 100%;
    max-width: 15rem;
  }
  
  .search-input:focus {
    width: 100%;
  }
  
  .card {
    padding: var(--spacing-md);
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }
  
  .btn {
    padding: var(--spacing-sm) var(--spacing-md);
    width: 100%;
  }
  
  .actions {
    width: 100%;
    flex-direction: column;
  }
  
  .actions .btn {
    width: 100%;
  }
  
  .kanban {
    gap: var(--spacing-sm);
  }
  
  .kanban-column {
    flex: 0 0 80vw;
  }
  
  .modal-content {
    max-width: 95%;
    padding: var(--spacing-md);
  }
  
  .table, .data-table {
    font-size: 0.75rem;
  }
  
  .table th, .table td,
  .data-table th, .data-table td {
    padding: var(--spacing-xs) var(--spacing-sm);
  }
  
  .notifications-menu {
    min-width: 90vw;
    max-width: 90vw;
    right: -2rem;
  }
  
  .profile-menu {
    min-width: 10rem;
  }
  
  .toast-container {
    right: var(--spacing-sm);
    left: var(--spacing-sm);
    max-width: none;
  }
  
  .toast {
    min-width: auto;
  }
}

/* Standardized Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: var(--spacing-md);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.modal-content {
  background: var(--surface);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  overflow: hidden;
  overflow-y: auto;
  margin: 1rem;
}

.modal.active .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.close-btn {
  background: var(--surface-variant);
  border: none;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-surface-variant);
  transition: all 0.2s;
  font-size: 18px;
  font-weight: 300;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1;
  padding: 0;
  margin: 0;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}

.close-btn:hover,
.modal-close:hover {
  background: var(--border);
  color: var(--on-surface);
  transform: rotate(90deg);
}

.modal-close {
  background: var(--surface-variant);
  border: none;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-surface-variant);
  transition: all 0.2s;
  font-size: 18px;
  font-weight: 300;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1;
  padding: 0;
  margin: 0;
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-md);
  flex-shrink: 0;
}

.modal-form {
  display: grid;
  gap: var(--spacing-md);
}

.modal-form .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

@media (max-width: 48rem) {
  .modal-form .grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    max-height: 95vh;
  }

  .filter-bar-inline {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.5rem 0.75rem !important;
  }
  .filter-bar-form {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  .filter-bar-select,
  .filter-bar-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .filter-bar-stats {
    margin-left: 0 !important;
    width: 100%;
    justify-content: flex-start !important;
    flex-wrap: wrap;
  }
  .calendar-header-flex {
    flex-wrap: wrap !important;
    gap: 0.5rem;
  }
  .widget-actions {
    margin-left: 0 !important;
  }
  .widget-title-area {
    width: 100%;
  }
}

.filter-bar-select {
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 6px;
}
.filter-bar-input {
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 6px;
}
.widget-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: 1.5rem;
}

.filter-bar {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.kanban {
  display: flex;
  gap: var(--spacing-md);
  overflow-x: auto;
  padding-bottom: var(--spacing-md);
}

.kanban-column {
  flex: 0 0 18.75rem;
  background: var(--surface-variant);
  border-radius: 0.5rem;
  padding: var(--spacing-md);
}

.kanban-header {
  font-weight: 500;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 0.125rem solid var(--border);
}

.kanban-card {
  background: var(--surface);
  padding: var(--spacing-md);
  border-radius: 0.375rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  cursor: move;
}

.kanban-card:hover {
  box-shadow: var(--shadow-lg);
}

.calendar {
  background: var(--surface);
  border-radius: 0.5rem;
  overflow: hidden;
}

.calendar-header {
  background: var(--primary);
  color: white;
  padding: var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day-header {
  padding: 0.75rem;
  text-align: center;
  font-weight: 500;
  background: var(--surface-variant);
  border: 1px solid var(--border);
}

.calendar-day {
  padding: var(--spacing-md);
  min-height: 6.25rem;
  border: 1px solid var(--border);
  cursor: pointer;
}

.calendar-day:hover {
  background: var(--surface-variant);
}

.calendar-day.other-month {
  opacity: 0.3;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 3.75rem repeat(auto-fit, minmax(6.25rem, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.schedule-cell {
  background: var(--surface);
  padding: var(--spacing-sm);
  min-height: 2.5rem;
  position: relative;
}

.schedule-cell.unavailable {
  background: var(--surface-variant);
  opacity: 0.5;
}

.schedule-cell.has-job {
  background: rgba(25, 118, 210, 0.1);
  cursor: pointer;
}

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 25rem;
}

.login-logo {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.login-logo img {
  max-width: 100%;
  height: auto;
}

.actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: var(--spacing-2xl) var(--spacing-md);
  color: var(--on-surface-variant);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.3;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

/* Notifications Dropdown */
.notifications-dropdown {
  position: relative;
  margin-right: var(--spacing-sm);
}

.notifications-button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: var(--spacing-sm);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: background 0.2s;
}

.notifications-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.bell-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.notification-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: #f44336;
  color: white;
  border-radius: 0.625rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 1.125rem;
  text-align: center;
}

.notifications-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border-radius: 0.5rem;
  min-width: 21.875rem;
  max-width: 25rem;
  margin-top: var(--spacing-sm);
  display: none;
  z-index: 1000;
}

.notifications-menu.show {
  display: block;
}

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

.notifications-header h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--on-surface);
}

.mark-all-read {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
}

.mark-all-read:hover {
  text-decoration: underline;
}

.notifications-list {
  max-height: 25rem;
  overflow-y: auto;
}

.notification-item {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.notification-item:hover {
  background: var(--surface-variant);
}

.notification-item.read {
  opacity: 0.6;
}

.notification-item strong {
  display: block;
  margin-bottom: var(--spacing-xs);
  color: var(--on-surface);
}

.notification-item p {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 0.875rem;
  color: var(--on-surface-variant);
}

.notification-time {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
}

/* Avatar Styles */
.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  text-transform: uppercase;
  color: white;
}

.avatar-small {
  width: 2rem;
  height: 2rem;
  font-size: 0.875rem;
}

.avatar-medium {
  width: 3rem;
  height: 3rem;
  font-size: 1.125rem;
}

.avatar-large {
  width: 4rem;
  height: 4rem;
  font-size: 1.5rem;
}

.avatar-img {
  border-radius: 50%;
  object-fit: cover;
}

/* Impersonation Banner */
.impersonation-banner {
  background: #FFF3CD;
  border-bottom: 0.125rem solid #FFC107;
  padding: 0.75rem 0;
  text-align: center;
  font-weight: 500;
}

.impersonation-banner .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
}

.impersonation-banner span {
  color: #856404;
}

.impersonation-banner .btn {
  background: #856404;
  color: white;
  border: none;
}

.impersonation-banner .btn:hover {
  background: #6c5200;
}

/* Integration Cards */
.integration-card {
  padding: var(--spacing-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  transition: box-shadow 0.2s;
}

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

.integration-card h5 {
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--on-surface);
}

.integration-card p {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 0.875rem;
  color: var(--on-surface-variant);
}

/* Recently Viewed Items */
.recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-variant);
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--on-surface);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.recent-item:hover {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-0.125rem);
}

.recent-item-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

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

.recent-item-name {
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
}

.recent-item-subtitle {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 5rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 25rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 0.25rem;
  border-radius: 0.5rem;
  padding: var(--spacing-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
  min-width: 18.75rem;
}

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

.toast-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
  font-size: 1rem;
}

.toast-message {
  flex: 1;
  color: var(--on-surface);
  font-size: 0.875rem;
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--on-surface-variant);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: background 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.toast-close:hover {
  background: var(--surface-variant);
}

.toast-success {
  border-left-color: var(--success);
}

.toast-success .toast-icon {
  background: var(--success);
  color: white;
}

.toast-error {
  border-left-color: var(--error);
}

.toast-error .toast-icon {
  background: var(--error);
  color: white;
}

.toast-warning {
  border-left-color: var(--warning-border);
}

.toast-warning .toast-icon {
  background: var(--warning-border);
  color: var(--warning-text);
}

.toast-info {
  border-left-color: var(--primary);
}

.toast-info .toast-icon {
  background: var(--primary);
  color: white;
}

/* Global Loading Spinner */
.global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] .global-loader {
  background: rgba(0, 0, 0, 0.6);
}

.loader-spinner {
  width: 3rem;
  height: 3rem;
  border: 0.25rem solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Inline Loading State */
.htmx-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

/* HTMX Indicator Visibility */
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator,
.htmx-indicator.htmx-request {
  display: block !important;
}

/* Button Loading State */
.btn.htmx-loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin-left: -0.5rem;
  margin-top: -0.5rem;
  border: 0.125rem solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Skeleton Screens */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-variant) 25%,
    var(--surface) 50%,
    var(--surface-variant) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 0.25rem;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--spacing-sm);
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: var(--spacing-md);
}

.skeleton-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
}

.skeleton-card {
  padding: var(--spacing-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.skeleton-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 6.25rem;
  gap: var(--spacing-md);
  padding: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.skeleton-table-cell {
  height: 1rem;
}

/* Pulse Animation Alternative */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Inline Editing Styles */
.editable-cell {
  cursor: pointer;
  position: relative;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.editable-cell:hover {
  background: var(--surface-variant);
  box-shadow: 0 0 0 1px var(--border);
}

.editable-cell.editing {
  background: var(--surface);
  padding: 0;
}

.inline-edit-input {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.inline-edit-input:focus {
  border-color: var(--primary-dark);
}

.inline-edit-select {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.inline-edit-select:focus {
  border-color: var(--primary-dark);
}

.inline-edit-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

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

.editable-hint {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  font-style: italic;
  display: none;
}

.editable-cell:hover .editable-hint {
  display: inline;
  margin-left: 0.5rem;
}

/* Bulk Actions Styles */
.bulk-actions-toolbar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 1rem;
  z-index: 100;
  animation: slideUp 0.3s ease-out;
}

.bulk-actions-toolbar.active {
  display: flex;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.bulk-actions-count {
  font-weight: 600;
  color: var(--primary);
  margin-right: 0.5rem;
}

.bulk-actions-toolbar .btn {
  margin: 0 0.25rem;
}

.bulk-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.select-all-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  margin-right: 0.5rem;
}

/* Bulk action dropdown */
.bulk-action-dropdown {
  position: relative;
  display: inline-block;
}

.bulk-action-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  display: none;
  z-index: 101;
}

.bulk-action-menu.active {
  display: block;
}

.bulk-action-menu button {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--on-surface);
  transition: background 0.2s;
}

.bulk-action-menu button:hover {
  background: var(--surface-variant);
}

.bulk-action-menu button:first-child {
  border-radius: 6px 6px 0 0;
}

.bulk-action-menu button:last-child {
  border-radius: 0 0 6px 6px;
}

.bulk-action-menu .separator {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* Checkbox column styling */
.checkbox-col {
  width: 40px;
  text-align: center;
}

/* Selected row highlight */
tr.selected {
  background: rgba(25, 118, 210, 0.08);
}

[data-theme="dark"] tr.selected {
  background: rgba(25, 118, 210, 0.15);
}

/* Advanced Filtering */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.filter-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-toggle-icon {
  transition: transform 0.3s ease;
  font-size: 0.9rem;
}

.filter-toggle-icon.collapsed {
  transform: rotate(-90deg);
}

.filter-panel-content {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.filter-panel-content.collapsed {
  display: none;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-surface-variant);
  margin-bottom: 0.5rem;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  grid-column: 1 / -1;
}

/* Active Filters Chips */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 16px;
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-chip-label {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

.filter-chip-remove {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.filter-chip-remove:hover {
  opacity: 1;
}

/* Date range inputs */
.filter-date-range {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-date-range input {
  flex: 1;
  min-width: 0;
}

.filter-date-separator {
  color: var(--on-surface-variant);
  font-size: 0.875rem;
}

/* Accordion Styles for Documentation and Release Notes */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow 0.2s;
}

.accordion-item:hover {
  box-shadow: var(--shadow);
}

.accordion-header {
  background: var(--surface-variant);
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
  user-select: none;
}

.accordion-header:hover {
  background: var(--border);
}

.accordion-header.active {
  background: var(--primary-light);
  color: white;
}

[data-theme="dark"] .accordion-header.active,
[data-theme="ash"] .accordion-header.active {
  background: var(--primary);
}

.accordion-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--on-surface);
}

.accordion-header.active .accordion-title {
  color: white;
}

.accordion-icon {
  font-size: 1.25rem;
  transition: transform 0.3s ease;
  color: var(--on-surface-variant);
}

.accordion-header.active .accordion-icon {
  transform: rotate(180deg);
  color: white;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 1.25rem;
}

.accordion-content.active {
  max-height: 2000px;
  padding: 1.25rem;
}

.accordion-content p,
.accordion-content ul,
.accordion-content ol {
  margin-bottom: 0.75rem;
}

.accordion-content h4 {
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.accordion-content ul,
.accordion-content ol {
  margin-left: 1.5rem;
}

.accordion-content li {
  margin-bottom: 0.375rem;
}

/* Clickable Stat Boxes */
.stat-box-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
}

.stat-box-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: var(--surface-variant);
}

.stat-box-clickable:active {
    transform: translateY(0);
}

/* Widget Toggle Items */
.widget-toggle-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.widget-toggle-item:hover {
    background: var(--surface-variant);
    border-color: var(--primary);
}

.widget-toggle-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.widget-toggle-item span {
    flex: 1;
    font-weight: 500;
}

/* Dashboard Layout - Flex Container for Push Panel */
.dashboard-layout {
    display: flex;
    gap: 0;
    position: relative;
    transition: all 0.3s ease;
}

.dashboard-content {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

/* Side Panel Styles - Push Layout */
.side-panel {
    width: 0;
    overflow: hidden;
    background: var(--surface);
    border-left: 0 solid var(--border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.side-panel.open {
    width: 400px;
    border-left-width: 1px;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
}

/* Make content more compact when panel is open */
.dashboard-layout.customization-active .dashboard-content {
    margin-right: 0;
}

.dashboard-layout.customization-active #dashboard-widgets {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1rem;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.side-panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.side-panel-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.side-panel-footer button {
    flex: 1;
}

/* Base Dashboard Widgets Grid */
#dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 1.5rem;
    --header-control-height: 2.5rem;
}

/* Dashboard Widget Card Header Normalization */
#dashboard-widgets .card-header {
    gap: 0.75rem;
}

#dashboard-widgets .card-header .card-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#dashboard-widgets .card-header .drag-handle {
    align-self: stretch;
    display: flex;
    align-items: center;
}

#dashboard-widgets .card-header .widget-filter,
#dashboard-widgets .card-header .btn {
    height: var(--header-control-height);
    line-height: calc(var(--header-control-height) - 2px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

/* Layout Density Classes - ROOMY (Extra Spacious) */
#dashboard-widgets.density-roomy {
    gap: 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 450px), 1fr));
    --header-control-height: 2.75rem;
}

#dashboard-widgets.density-roomy .card {
    padding: 2rem;
}

#dashboard-widgets.density-roomy .card-header {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

#dashboard-widgets.density-roomy .stat-box {
    padding: 2rem;
}

#dashboard-widgets.density-roomy .stat-value {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

#dashboard-widgets.density-roomy .stat-label {
    font-size: 1rem;
}

#dashboard-widgets.density-roomy .task-item,
#dashboard-widgets.density-roomy .activity-item {
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

/* Layout Density Classes - COZY (Default, Comfortable) */
#dashboard-widgets.density-cozy {
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}

#dashboard-widgets.density-cozy .stat-box {
    padding: 1.5rem;
}

#dashboard-widgets.density-cozy .card {
    padding: 1.5rem;
}

#dashboard-widgets.density-cozy .task-item,
#dashboard-widgets.density-cozy .activity-item {
    padding: 1rem;
}

/* Layout Density Classes - COMPACT (Dense) */
#dashboard-widgets.density-compact {
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
    --header-control-height: 2.25rem;
}

#dashboard-widgets.density-compact .card {
    padding: 0.75rem;
}

#dashboard-widgets.density-compact .card-header {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

#dashboard-widgets.density-compact .stat-box {
    padding: 0.75rem;
}

#dashboard-widgets.density-compact .stat-value {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

#dashboard-widgets.density-compact .stat-label {
    font-size: 0.75rem;
}

#dashboard-widgets.density-compact .task-item,
#dashboard-widgets.density-compact .activity-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

#dashboard-widgets.density-compact .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Home Page Header Bar - contains heading and actions (DESKTOP) */
.home-header-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.home-header-bar h2 {
    margin: 0;
    flex-shrink: 1;
}

/* Home Page Header Actions - Fix button wrapping (DESKTOP) */
.home-header-actions {
    display: inline-flex !important;
    gap: 0.5rem !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
}

.home-header-actions > * {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

/* Dashboard widget headers - LEFT ALIGN titles (COMPLETE FIX) */
.dashboard-widget .card-header {
    justify-content: flex-start;
    align-items: center;
    gap: var(--spacing-xs);
}

.dashboard-widget .card-header > .drag-handle {
    display: inline-flex;
    align-items: center;
    margin-left: calc(-1 * var(--spacing-2xl));
    margin-right: 0;
    padding: 0;
}

.dashboard-widget .card-header > .card-title,
.dashboard-widget .card-header h3.card-title {
    margin: 0;
    text-align: left;
}

.dashboard-widget .card-header-actions {
    margin-left: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .side-panel.open {
        width: 100%;
    }
    
    .dashboard-layout.customization-active #dashboard-widgets {
        display: none;
    }
    
    /* Stack home header on mobile */
    .home-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .home-header-actions {
        margin-left: 0 !important;
        width: 100%;
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
}

/* Home page density select - no width expansion */
.home-density-select {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--on-surface);
    width: auto !important;
    flex: 0 0 auto !important;
}

/* Revenue Stat Box Special Styling */
.stat-box-revenue {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark, #2563EB) 100%);
    color: white;
    border-radius: 8px;
}

/* Ensure revenue box respects density padding */
#dashboard-widgets.density-roomy .stat-box-revenue {
    padding: 2rem;
}

#dashboard-widgets.density-cozy .stat-box-revenue {
    padding: 1.5rem;
}

#dashboard-widgets.density-compact .stat-box-revenue {
    padding: 0.75rem;
}

/* ========================================
   COMPREHENSIVE MOBILE RESPONSIVE STYLES
   ======================================== */

/* Mobile-first utility classes */
.grid-mobile-1 { display: grid; grid-template-columns: 1fr; gap: var(--spacing-md); }
.stack-mobile { display: flex; flex-direction: column; gap: var(--spacing-md); }
.show-mobile { display: none; }

/* Mobile card view for tables */
.mobile-card-view {
    display: none;
}

.mobile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
}

.mobile-card-title {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs) 0;
    font-size: 0.875rem;
}

.mobile-card-label {
    color: var(--on-surface-variant);
    font-weight: 500;
}

.mobile-card-value {
    color: var(--on-surface);
    text-align: right;
    max-width: 60%;
}

.mobile-card-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.mobile-card-actions .btn {
    flex: 1;
    min-width: 80px;
    text-align: center;
    justify-content: center;
}

/* Responsive 2-column grid utility */
.responsive-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Page header flex utility - used on detail pages */
.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Invoice/Quote detail layout */
.invoice-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

/* Org settings sidebar layout */
.org-settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
}

/* User settings sidebar layout */
.user-settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Mobile Breakpoints */
@media (max-width: 1024px) {
    /* Tablet adjustments */
    .container {
        padding: 0 1rem;
    }
    
    .header-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 2-column grids become single column on tablet portrait */
    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }
    
    .grid-3, .grid-4 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    /* Mobile utility class overrides */
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

    /* 12. Better scrolling on all pages */
    html, body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Mobile Navigation */
    .header {
        padding: 0.5rem 0;
    }
    
    .header .container {
        gap: var(--spacing-sm);
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .header-logo {
        font-size: 1.2rem;
    }
    
    .header-logo img {
        height: 32px;
    }
    
    /* Header nav becomes slide-in menu (scoped to header only) */
    .header .nav,
    .header-nav {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: var(--surface) !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 1rem !important;
        padding-top: 4rem !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2) !important;
        z-index: 1001 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        margin: 0 !important;
        gap: 0 !important;
        pointer-events: auto !important;
    }
    
    .header .nav.mobile-open,
    .header-nav.mobile-open {
        left: 0 !important;
    }
    
    .header .nav a,
    .header .nav button,
    .header-nav a {
        display: block !important;
        color: var(--on-surface) !important;
        padding: 1rem !important;
        border-bottom: 1px solid var(--border) !important;
        margin: 0 !important;
        border-radius: 0 !important;
        width: 100% !important;
        text-align: left !important;
        justify-content: flex-start !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }
    
    .header .nav a:hover,
    .header .nav button:hover,
    .header-nav a:hover {
        background: var(--surface-variant);
    }
    
    .header .nav a.active,
    .header-nav a.active {
        background: var(--primary);
        color: white;
    }
    
    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Mobile overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    /* Show mobile card view, hide table */
    .mobile-card-view {
        display: block !important;
    }
    
    .table-container.has-mobile-cards {
        display: none !important;
    }
    
    /* 3. Tables - Horizontal scroll with sticky first column */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
        max-width: 100%;
    }
    
    table {
        min-width: 600px;
        font-size: 0.8125rem;
    }
    
    table th,
    table td {
        padding: 0.5rem 0.375rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    table th:first-child,
    table td:first-child {
        position: sticky;
        left: 0;
        background: var(--surface, white);
        z-index: 1;
    }
    
    /* Cards and Lists */
    .card {
        margin: 0.5rem 0;
        padding: 1rem;
        border-radius: 0.5rem;
    }
    
    /* 2. Card header buttons - don't force full width */
    .card-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center !important;
        gap: 0.5rem;
    }
    
    .card-header .btn {
        width: auto;
        flex-shrink: 0;
    }

    .card-header .card-title {
        flex: 1;
        min-width: 0;
    }
    
    .card-title {
        font-size: 1.125rem;
    }
    
    /* Forms - All single column */
    .form-row,
    .modal-content .grid-2,
    form .grid-2 {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--spacing-md) !important;
    }
    
    .form-group {
        width: 100% !important;
        margin-bottom: 0.75rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.75rem;
    }
    
    .form-actions,
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-actions .btn,
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
    
    /* 7. Modals - Full screen on mobile with proper scrolling */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .modal-header {
        position: sticky;
        top: 0;
        background: var(--surface);
        z-index: 10;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        flex-shrink: 0;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: 1rem;
        flex-shrink: 0;
    }
    
    /* Buttons - Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Profile dropdown */
    .profile-menu {
        right: 0;
        left: auto;
        min-width: 200px;
    }
    
    .profile-button {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }
    
    .profile-button .profile-name {
        display: none;
    }
    
    /* Dashboard widgets */
    .dashboard-grid,
    .widget-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    
    /* Stat boxes - 2 column on mobile for compact display */
    .stats-grid,
    .stat-boxes {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem;
    }
    
    .stat-box {
        padding: 0.75rem;
    }
    
    .stat-box h3 {
        font-size: 1.25rem;
    }
    
    .stat-box p {
        font-size: 0.75rem;
    }
    
    /* 4. Kanban board - better mobile handling */
    .kanban, .kanban-board {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 0.75rem;
        padding: 0.5rem;
        margin: 0 -0.75rem;
    }
    
    .kanban-column {
        min-width: 280px;
        max-width: 85vw;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
    
    /* Search bar */
    .search-container,
    .search-form {
        width: 100%;
        margin: 0.5rem 0;
    }
    
    .search-input {
        width: 100%;
        font-size: 16px;
    }
    
    /* Header search - hide on very small screens */
    .header-right .search-form {
        display: none;
    }
    
    /* Tab navigation */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        margin: 0 -1rem;
        padding: 0 1rem;
        scroll-snap-type: x mandatory;
    }
    
    .tab, .tab-link {
        white-space: nowrap;
        flex-shrink: 0;
        scroll-snap-align: start;
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
    
    /* Filter form - stack fields */
    .filter-form {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-form .form-group,
    .filter-form .form-select,
    .filter-form .form-input {
        width: 100% !important;
        min-width: 0 !important;
    }
    
    /* 5. Filter forms - inline filter bars with min-width overrides */
    .form-select[style*="min-width"],
    select[style*="min-width"] {
        min-width: 0 !important;
        width: 100% !important;
    }
    .form-input[style*="min-width"],
    .form-input[style*="max-width"] {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Filter panels - slide up from bottom */
    .filter-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-height: 80vh;
        background: var(--surface);
        z-index: 1000;
        padding: 1rem;
        border-radius: 1rem 1rem 0 0;
        overflow-y: auto;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
    
    /* Actions row */
    .actions-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .actions-row .btn {
        width: 100%;
    }
    
    /* Info grids */
    .info-grid,
    .detail-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Badge groups */
    .badge-group {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* Timeline */
    .timeline {
        padding-left: 1rem;
    }
    
    .timeline-item {
        padding-left: 1rem;
    }
    
    /* Mobile nav close button */
    .mobile-nav-close {
        display: block !important;
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--on-surface);
        cursor: pointer;
        padding: 0.5rem;
        min-height: 44px;
        min-width: 44px;
        z-index: 10;
    }
    
    /* Header-right tighter gap on mobile */
    .header-right {
        gap: 0.25rem;
    }
    
    /* Prevent horizontal overflow on all pages */
    body {
        overflow-x: hidden;
    }
    
    /* 1. Main content area scrolling */
    .main {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem;
        padding-bottom: 2rem;
    }
    
    /* Fix notification menu positioning on mobile */
    .notifications-menu {
        position: fixed !important;
        top: 60px !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        max-width: none !important;
        min-width: 0 !important;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Fix profile menu on mobile */
    .profile-menu {
        position: fixed !important;
        top: 60px !important;
        right: 0.5rem !important;
        left: auto !important;
        min-width: 220px;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    /* Inline styles override for common patterns */
    [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }
    
    /* Panel mobile close button */
    .panel-mobile-close {
        display: flex !important;
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        background: none;
        border: none;
        font-size: 1.25rem;
        color: #6b7280;
        cursor: pointer;
        padding: 0.25rem;
        z-index: 10;
    }

    /* 8. Page header flex - needs flex-wrap for action buttons */
    .page-header-flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    .page-header-flex > div:last-child {
        text-align: left !important;
        width: 100%;
    }
    .page-header-flex > div:last-child > div {
        flex-wrap: wrap !important;
    }
    .page-header .btn,
    .page-header-flex .btn {
        width: auto !important;
        min-height: 40px;
    }

    /* Detail page h1 font size overflow */
    .page-header h1 {
        font-size: 1.5rem !important;
        word-break: break-word;
    }

    /* Responsive 2-column grid stacking */
    .responsive-grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* Invoice/Quote layout stacking */
    .invoice-layout {
        grid-template-columns: 1fr !important;
    }

    /* Org settings sidebar stacking */
    .org-settings-layout {
        grid-template-columns: 1fr;
    }
    .org-tabs {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 0.25rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border);
        margin-bottom: 1rem;
    }
    .org-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8125rem !important;
    }

    /* Dispatch calendar grid mobile */
    .calendar-grid {
        font-size: 0.75rem;
    }
    .calendar-day {
        padding: 0.25rem !important;
        min-height: 50px !important;
    }
    .calendar-day-header {
        padding: 0.25rem !important;
        font-size: 0.7rem;
    }

    /* Leads and similar inline filter bars */
    .data-table .form-select,
    .data-table .form-input {
        width: 100% !important;
        min-width: 0 !important;
    }
    [style*="background: #f9fafb"][style*="border-bottom"] {
        flex-direction: column !important;
    }
    [style*="background: #f9fafb"][style*="border-bottom"] form {
        flex-direction: column !important;
    }
    [style*="background: #f9fafb"][style*="border-bottom"] .form-select,
    [style*="background: #f9fafb"][style*="border-bottom"] .form-input {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    [style*="background: #f9fafb"][style*="border-bottom"] [style*="margin-left: auto"] {
        margin-left: 0 !important;
        margin-top: 0.5rem;
    }

    /* 10. Home page dashboard widgets */
    .dashboard-widget .card-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .dashboard-widget .card-header .widget-filter {
        max-width: none !important;
        flex: 1 !important;
        min-width: 120px;
    }
    .dashboard-widget .card-header > div[style*="margin-left"] {
        margin-left: 0 !important;
        width: 100%;
    }
    .drag-handle {
        display: none;
    }

    /* User settings sidebar stacking */
    .user-settings-layout {
        grid-template-columns: 1fr;
    }
    .user-tabs {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 0.25rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border);
        margin-bottom: 1rem;
    }
    .user-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8125rem !important;
    }

    /* Fix select elements with inline min-width */
    select[style*="min-width"] {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* 6. Detail page info sections - inner grids */
    .detail-section [style*="grid-template-columns"],
    .inv-card [style*="grid-template-columns"],
    .modal-body [style*="grid-template-columns"],
    form [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Ensure all inline 2-col grid layouts stack */
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Fix inline flex gap layouts that don't wrap */
    [style*="display: flex"][style*="gap: 8px"],
    [style*="display: flex"][style*="gap: 0.5rem"] {
        flex-wrap: wrap !important;
    }

    /* 9. Financial page stat cards */
    .fin-stats-row {
        grid-template-columns: 1fr 1fr !important;
    }
    .fin-stat-value {
        font-size: 1.25rem !important;
    }

    /* 11. Dispatch day view */
    .summary-dashboard {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
    .stat-card {
        min-width: 0 !important;
    }

    /* 13. Right-side collaboration panel - bottom sheet on mobile */
    .crm-right-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 70vh !important;
        border-left: none !important;
        border-top: 1px solid #e5e7eb;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        z-index: 1050;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    .crm-right-panel:not(.collapsed) {
        transform: translateY(0);
    }
    .crm-right-panel.collapsed {
        transform: translateY(100%);
    }

    /* 14. Search results page */
    .search-results {
        overflow-x: hidden;
    }
    .search-results .card {
        overflow: hidden;
        word-break: break-word;
    }

    /* 15. Approval page and reporting layout fixes */
    .approval-card,
    .report-card {
        overflow: hidden;
    }

    /* 16. My hours page */
    .hours-grid,
    .timesheet-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 0.5rem;
    }
    
    .card {
        padding: 0.75rem;
    }

    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }

    .card-header {
        padding: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.25rem !important;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }

    .stat-box h3 {
        font-size: 1rem;
    }
    
    /* User detail modal adjustments */
    .user-detail-modal {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .user-info-grid {
        grid-template-columns: 1fr !important;
    }
    
    .login-attempts-table {
        font-size: 0.75rem;
    }
    
    .login-attempts-table th,
    .login-attempts-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-item, .profile-button, .mobile-menu-toggle,
    .tab, .tab-link, .profile-menu-item, .panel-tab {
        min-height: 44px;
    }
    
    /* Remove hover states on touch devices */
    .btn:hover {
        transform: none;
    }
    
    /* Better touch feedback */
    .btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
}

/* Landscape orientation tweaks */
@media (max-height: 600px) and (orientation: landscape) {
    .modal-content {
        height: auto !important;
        max-height: 100vh;
    }
    
    .header {
        padding: 0.25rem 0;
    }
}

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

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 999;
}

/* Hide desktop-only elements on mobile */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    /* Show mobile menu toggle on mobile only */
    .mobile-menu-toggle {
        display: block !important;
    }
}

/* Show desktop elements, hide mobile on desktop */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .mobile-overlay {
        display: none !important;
        pointer-events: none !important;
    }
    
    .mobile-nav-close {
        display: none !important;
    }
    
    .panel-mobile-close {
        display: none !important;
    }
}

