/* Optimized CSS - Redundancy Removed */

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f2f5;
  color: #333;
  padding: 20px;
  padding-top: 80px; /* Added extra top padding to account for the sticky tab bar */
  line-height: 1.6;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-button {
  background-color: #e0e0e0;
  color: #333;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-button:hover {
  background-color: #f0f0f0;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1000;
}

/* User Section Styles */
.right-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-name {
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.btn-icon {
  font-size: 16px;
}

.logout-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 14px;
  transition: color 0.3s ease;
}

.logout-btn:hover {
  color: #e74c3c;
}

.tab-button.active {
  background-color: #007bff;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.tab-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Tab Content */
.tab-content {
  display: none;
  background-color: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  min-height: 600px;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

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

/* Headings */
h2 {
  font-size: 1.8rem;
  margin-bottom: 25px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 10px;
}

h3 {
  font-size: 1.3rem;
  color: #34495e;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dashboard Styles */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card.dept-total { background: linear-gradient(135deg, #ffb347 0%, #ffcc33 100%); }
.stat-card.avg-invoice { background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%); }
.stat-card.max-invoice { background: linear-gradient(135deg, #ff4b1f 0%, #1fddff 100%); }
.stat-card.pending-billing { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-card.billing-amount { background: linear-gradient(135deg, #f76b1c 0%, #fad961 100%); }
.stat-card.billed-this-month { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.stat-card:hover::before {
  transform: translateX(100%);
}

.stat-card.total { 
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
}
.stat-card.unbilled { 
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); 
}
.stat-card.billed { 
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); 
}
.stat-card.amount { 
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); 
}

.stat-icon {
  font-size: 3rem;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: bold;
  margin-bottom: 5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.stat-label {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 500;
}

.dashboard-section {
  margin-bottom: 40px;
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.department-breakdown {
  display: grid;
  gap: 15px;
}


.dept-card {
  background: #f8f9fb;
  padding: 20px;
  border-radius: 10px;
  border-left: 5px solid #007bff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.dept-card:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.dept-name {
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.dept-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.dept-stats .stat {
  font-size: 0.95rem;
  color: #666;
  background: white;
  padding: 6px 12px;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.recent-activity {
  max-height: 350px;
  overflow-y: auto;
  padding-right: 10px;
}

.recent-activity::-webkit-scrollbar {
  width: 6px;
}

.recent-activity::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.recent-activity::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fb;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.activity-item:hover {
  background: #f0f3ff;
  transform: translateX(5px);
}

.activity-icon {
  font-size: 1.8rem;
  background: white;
  padding: 8px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.activity-title {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 3px;
}

.activity-meta {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.quick-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons - Consolidated */
.action-btn, .report-btn, .edit-btn, .save-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-btn, .report-btn {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.action-btn:hover, .report-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.edit-btn {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
  color: white;
  box-shadow: 0 3px 10px rgba(23, 162, 184, 0.3);
  padding: 8px 16px;
  font-size: 0.9rem;
  margin: 0 3px;
}

.edit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
}

.save-btn {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
  color: white;
  box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
  padding: 8px 16px;
  font-size: 0.9rem;
  margin: 0 3px;
}

.save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.save-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
  position: relative;
}

/* Add visual cue for disabled save buttons */
.save-btn:disabled::after {
  content: '❌';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 12px;
  background: #dc3545;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Button container styles */
.button-container {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: nowrap;
}

/* Read-only field styles */
.readonly-field {
  background-color: #f8f9fa;
  color: #6c757d;
  border-color: #dee2e6;
  cursor: not-allowed;
  opacity: 0.8;
}

/* Required field styling */
/* Enhanced Required Field Styling */
.required-field {
  border-left: 4px solid #28a745 !important;
  background-color: #f8fff8;
  position: relative;
  padding-right: 25px; /* Make room for the asterisk */
}

.required-field::placeholder {
  color: #28a745;
  font-weight: 500;
  opacity: 0.8;
}


/* Required field indicator */
.data-table td:has(> .required-field)::after {
  content: '*';
  color: #28a745;
  font-weight: bold;
  font-size: 1.2em;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

/* Add animation for required fields that are empty */
.required-field:not([value]):not([type="date"]),
.required-field[value=""]:not([type="date"]) {
  animation: pulse-required 2s infinite;
}

@keyframes pulse-required {
  0% { border-left-color: #28a745; }
  50% { border-left-color: #ffc107; }
  100% { border-left-color: #28a745; }
}

/* Read-only field styling */
.readonly-field {
  background-color: #f8f9fa !important;
  border-color: #e9ecef !important;
  color: #6c757d;
  font-weight: 500;
}

/* Error States with Enhanced Animation */
input.error {
  border-color: #dc3545 !important;
  background-color: #fff8f8;
  box-shadow: 0 0 8px rgba(220, 53, 69, 0.25);
  animation: shake 0.5s linear;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Field highlight animation */
.highlight {
  animation: highlight-pulse 1.5s ease-in-out;
}

@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
  50% { box-shadow: 0 0 0 6px rgba(40, 167, 69, 0.3); }
}

/* No Data Message Styling */
.no-data-message {
  padding: 40px 20px;
  text-align: center;
  background-color: #f8f9fb;
  border-radius: 12px;
  border: 2px dashed #dee2e6;
  margin: 20px 0;
}

.no-data-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  color: #adb5bd;
}

.no-data-message p {
  color: #6c757d;
  font-size: 1.1rem;
  margin: 5px 0;
}

.no-data-hint {
  font-size: 0.9rem !important;
  font-style: italic;
  opacity: 0.8;
}

/* Highlight style for fields that need attention */
.highlight {
  animation: pulse 1s infinite;
  box-shadow: 0 0 10px rgba(40, 167, 69, 0.7);
  border: 2px solid #28a745 !important;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
  70% { box-shadow: 0 0 10px 10px rgba(40, 167, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

.btn-icon {
  font-size: 1.1rem;
}

/* Controls Section */
.controls-section {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  align-items: center;
  background: #f8f9fb;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.search-container {
  flex: 1;
  min-width: 280px;
}

.search-container input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 25px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.search-container input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.filter-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-controls select,
.filter-controls input[type="date"] {
  padding: 10px 14px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  min-width: 140px;
  font-size: 0.95rem;
  background: white;
  transition: border-color 0.3s ease;
}

.filter-controls select:focus,
.filter-controls input[type="date"]:focus {
  outline: none;
  border-color: #007bff;
}

/* Enhanced Tab Header */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e9ecef;
}

.tab-summary {
  display: flex;
  gap: 20px;
}

.summary-item {
  background: #f8f9fb;
  padding: 8px 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dee2e6;
}

.summary-label {
  font-size: 0.9rem;
  color: #6c757d;
  font-weight: 500;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #007bff;
}


/* Controls Panel */
.controls-panel {
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  border: 1px solid #e9ecef;
}

.controls-panel.filters-active {
  border: 1px solid #28a745;
  box-shadow: 0 2px 10px rgba(40, 167, 69, 0.15);
}

/* Responsive adjustments for filter controls */
@media (max-width: 992px) {
  .controls-panel {
    flex-direction: column;
  }
  
  .search-filter-section {
    flex-direction: column;
  }
  
  .filter-controls {
    justify-content: space-between;
  }
  
  .filter-group {
    min-width: 47%;
  }
  
  .date-filter-group {
    min-width: 100%;
  }
}

.search-filter-section {
  display: flex;
  flex: 1;
  gap: 15px;
  flex-wrap: wrap;
}

.search-container {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  pointer-events: none;
}

.search-container input {
  width: 100%;
  padding: 10px 35px 10px 35px;
  border-radius: 8px;
  border: 2px solid #e1e5e9;
  font-size: 0.95rem;
}

.clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  display: none;
  width: 24px;
  height: 24px;
  line-height: 0.8;
  border-radius: 50%;
}

.clear-search:hover {
  background: #f1f3f5;
}

.search-container input:not(:placeholder-shown) + .clear-search {
  display: block;
}

.filter-controls {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  position: relative;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
}

.filter-group label {
  font-size: 0.85rem;
  color: #495057;
  font-weight: 600;
}

.filter-group select, .filter-group input {
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #e1e5e9;
  font-size: 0.95rem;
  background: white;
  transition: all 0.2s ease;
}

.filter-group select:focus, .filter-group input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
  outline: none;
}

.filter-group select.active-filter, .filter-group input.active-filter {
  border-color: #28a745;
  background-color: #f8fff8;
}

.date-filter-group {
  min-width: 300px;
}

.status-filter-group, 
.adjustment-filter-group,
.billing-status-filter-group {
  min-width: 180px;
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.date-separator {
  color: #6c757d;
  font-size: 0.9rem;
}

.date-range-inputs input[type="date"] {
  flex: 1;
  min-width: 140px;
  position: relative;
  padding-right: 25px; /* Room for calendar icon */
  cursor: pointer;
}

/* Custom calendar icon styling */
.date-range-inputs input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.2s;
}

.date-range-inputs input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Date range filter active indicator */
.date-filter-active .date-range-inputs input[type="date"] {
  border-color: #28a745;
  background-color: #f8fff8;
}

.apply-filter-btn {
  background: #e9ecef;
  border: none;
  padding: 8px 15px;
  border-radius: 8px;
  color: #495057;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  margin-top: 18px;
}

.apply-filter-btn:hover {
  background: #dee2e6;
}

.clear-filters-btn {
  background: #f8d7da;
  border: none;
  padding: 8px 15px;
  border-radius: 8px;
  color: #721c24;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.clear-filters-btn:hover {
  background: #f5c6cb;
  transform: translateY(-1px);
}

.clear-filters-btn:disabled {
  background: #f8f9fa;
  color: #adb5bd;
  cursor: not-allowed;
  transform: none;
}


.actions-section {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.active-filters-display {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-badge {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-badge.status-filter {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.filter-badge.adjustment-filter {
  background: #fff3cd;
  border-color: #ffeeba;
  color: #856404;
}

.filter-badge.date-filter {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.filter-badge.billing-filter {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.filter-badge i {
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.7;
}

.filter-badge i:hover {
  opacity: 1;
}

/* Tables - Enhanced with consistent column widths */
.data-container {
  position: relative;
}

.table-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  background: white;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1700px; /* Increased to accommodate wider columns */
}

.data-table thead {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 18px 15px;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  position: relative;
  border-bottom: 1px solid #0056b3;
  transition: background 0.2s;
}

.data-table th:hover {
  background: rgba(255,255,255,0.1);
  cursor: pointer;
}

/* Column widths - optimized with consistent naming */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 80px; }   /* Profile ID */
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 120px; }  /* Last Name */
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 120px; }  /* First Name */
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 100px; }  /* Middle Name */
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 140px; }  /* Department */
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 100px; }  /* Net Pay */
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 100px; }   /* Status */
.data-table th:nth-child(8), .data-table td:nth-child(8) { width: 180px; }  /* Nature of Adjustment */
.data-table th:nth-child(9), .data-table td:nth-child(9) { width: 130px; }  /* Date Processed */
.data-table th:nth-child(10), .data-table td:nth-child(10) { width: 140px; } /* Billing Status */
.data-table th:nth-child(11), .data-table td:nth-child(11) { width: 140px; } /* Invoice Number */
.data-table th:nth-child(12), .data-table td:nth-child(12) { width: 120px; } /* Amount */
.data-table th:nth-child(13), .data-table td:nth-child(13) { width: 120px; } /* Billing Amount */
.data-table th:nth-child(14), .data-table td:nth-child(14) { width: 130px; } /* Date of Billing */
.data-table th:nth-child(15), .data-table td:nth-child(15) { width: 110px; text-align: center; } /* Action */

.data-table td {
  padding: 15px;
  border-bottom: 1px solid #f1f3f5;
  vertical-align: middle;
  font-size: 0.95rem;
  position: relative;
}

/* Allow cells to show full content on hover */
.data-table td.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.data-table td.truncate-text:hover {
  white-space: normal;
  overflow: visible;
  background-color: #f8fff8;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  z-index: 10;
}

/* Enhanced tooltip for truncated text */
.data-table td.truncate-text::after {
  content: '👁';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.3;
  pointer-events: none;
}

.data-table td.truncate-text:hover::after {
  display: none;
}


/* Sort indicator for column headers */
.data-table th.sorted-asc::after,
.data-table th.sorted-desc::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}

.data-table th.sorted-asc::after {
  border-bottom: 5px solid white;
}

.data-table th.sorted-desc::after {
  border-top: 5px solid white;
}

/* Row hover effects */
.data-table tbody tr {
  transition: all 0.2s ease;
}

.data-table tbody tr:hover {
  background-color: #f8f9fb;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  z-index: 5;
  position: relative;
}

/* Tooltip for long text */
.data-table td[title] {
  position: relative;
  cursor: help;
}

.data-table tbody tr:nth-child(even) {
  background-color: #fdfdfe;
}

/* Status indication with colored left border */
.data-table tbody tr[data-status="Active"] {
  border-left: 4px solid #28a745;
}

.data-table tbody tr[data-status="Inactive"] {
  border-left: 4px solid #dc3545;
}

.data-table tbody tr[data-billing="Billed"] {
  border-left: 4px solid #007bff;
}

.data-table tbody tr[data-billing="Unbilled"] {
  border-left: 4px solid #ffc107;
}

/* Form controls inside table cells */
.data-table td input, 
.data-table td select {
  padding: 10px 12px;
  border-radius: 6px;
  border: 2px solid #e1e5e9;
  width: 100%;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.data-table td input:focus, 
.data-table td select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.data-table td input:disabled, 
.data-table td select:disabled {
  background-color: #f8f9fa;
  border-color: #e9ecef;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Billing status column enhanced styling */
.data-table td:nth-child(10) {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}

.data-table td:nth-child(10) select {
  width: 100%;
  min-width: 120px;
  font-weight: 500;
  color: #2c3e50;
  position: relative;
  padding-left: 30px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
}

.data-table td:nth-child(10) select::before {
  content: "●";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.billing-status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-billed .billing-status-indicator {
  background-color: #28a745;
  box-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
}

.status-unbilled .billing-status-indicator {
  background-color: #ffc107;
  box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
}

/* Enhanced select options */
.data-table td:nth-child(10) select option[value="Billed"] {
  background-color: #d4edda;
  color: #155724;
  padding-left: 25px;
}

.data-table td:nth-child(10) select option[value="Unbilled"] {
  background-color: #f8d7da;
  color: #721c24;
  padding-left: 25px;
}

/* Action buttons in table */
.button-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 4px 0;
}

.edit-btn, .save-btn, .delete-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.edit-btn {
  background: #6c757d;
  color: white;
}

.edit-btn:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.save-btn {
  background: #28a745;
  color: white;
}

.save-btn:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-2px);
}


.save-btn:disabled {
  background: #86c596;
  cursor: not-allowed;
  box-shadow: none;
}

.delete-btn {
  background: #dc3545;
  color: white;
}

.delete-btn:hover {
  background: #c82333;
  transform: translateY(-2px);
}

/* Enhanced Pagination */
.pagination {
  margin-top: 25px;
  text-align: center;
  background: #f8f9fb;
  padding: 15px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Enhanced Pagination Controls */
.pagination {
  margin-top: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  background: #f8f9fb;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.pagination-info {
  color: #6c757d;
  font-size: 0.9rem;
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  background-color: white;
  border: 2px solid #e1e5e9;
  color: #495057;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover:not(:disabled) {
  background-color: #e9ecef;
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.page-btn.active {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border-color: #007bff;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
  font-weight: 700;
}

.pagination-ellipsis {
  color: #6c757d;
  padding: 0 5px;
  font-weight: bold;
}

.prev-btn, .next-btn {
  min-width: 80px;
  font-weight: 600;
}

/* Row being edited styling */
tr.editing {
  background-color: #fff8e1 !important;
  box-shadow: 0 0 0 2px #ffc107 !important;
  position: relative;
  z-index: 10;
}

/* Reports Section */
.reports-container {
  display: flex;
  height: calc(100% - 60px);
  gap: 20px;
  margin-top: 15px;
}

.reports-sidebar {
  width: 300px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 15px rgba(0,0,0,0.06);
  overflow-y: auto;
  max-height: 100%;
}

.reports-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 15px rgba(0,0,0,0.06);
  overflow: hidden;
}

/* Report Filters */
.report-filters-section {
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
}

.report-filters-section h3 {
  margin-bottom: 15px;
  color: #2c3e50;
  font-size: 1.1rem;
}

.filter-group {
  margin-bottom: 15px;
}

.filter-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 5px;
  color: #495057;
  font-weight: 500;
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ced4da;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.filter-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.apply-btn {
  background-color: #007bff;
  color: white;
}

.apply-btn:hover {
  background-color: #0069d9;
}

.clear-btn {
  background-color: #f8f9fa;
  color: #495057;
  border: 1px solid #ced4da;
}

.clear-btn:hover {
  background-color: #e9ecef;
}

/* Report Summary */
.report-summary {
  padding: 20px;
}

.report-summary h3 {
  margin-bottom: 15px;
  color: #2c3e50;
  font-size: 1.1rem;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 10px;
}

.report-summary h4 {
  font-size: 1rem;
  color: #495057;
  margin: 20px 0 10px;
}

.summary-item, .analysis-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.9rem;
}


.summary-item label, .analysis-item label {
  color: #495057;
}

.summary-item span, .analysis-item span {
  font-weight: bold;
  color: #007bff;
}

.report-analysis {
  margin-top: 25px;
  padding-top: 10px;
  border-top: 1px solid #e9ecef;
}

/* Report Tabs */
.report-tabs {
  display: flex;
  background: #f8f9fa;
  padding: 10px 20px 0;
  border-bottom: 1px solid #dee2e6;
}

.report-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  color: #495057;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid transparent;
  margin-right: 8px;
  position: relative;
  bottom: -1px;
}

.report-tab.active {
  background: white;
  color: #007bff;
  border: 1px solid #dee2e6;
  border-bottom-color: #fff;
}

.report-tab:hover:not(.active) {
  background-color: rgba(0, 123, 255, 0.1);
}

/* Report Views */
.report-view {
  display: none;
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.report-view.active {
  display: block;
}

/* Report Tables */
.report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.report-table th, .report-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

.report-table th {
  background-color: #f8f9fa;
  color: #495057;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.report-table tbody tr:hover {
  background-color: #f1f4f8;
}

/* Utility classes for the report section */
.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.highlight {
  color: #007bff;
  font-weight: 600;
}

.dept-report-stats span {
  background: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: #495057;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-weight: 500;
}

/* Error States */
input.error {
  border-color: #dc3545 !important;
  background-color: #f8d7da;
  box-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
  animation: shake 0.5s linear;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.no-activity {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 40px 20px;
  background: #f8f9fb;
  border-radius: 12px;
  border: 2px dashed #dee2e6;
}

/* Notifications - Single Definition */
.notification {
  position: fixed;
  top: 25px;
  right: 25px;
  padding: 15px 25px;
  border-radius: 8px;
  color: white;
  z-index: 1000;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  font-weight: 600;
  max-width: 400px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification.success {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.notification.error {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  box-shadow: 0 4px 20px rgba(220, 53, 69, 0.4);
  border-left: 5px solid #721c24;
  font-weight: 600;
}

.notification.info {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}


/* Responsive Layout */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .tabs {
    gap: 5px;
  }
  
  .tab-button {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  
  .tab-content {
    padding: 20px;
  }
  
  .dashboard-stats {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .stat-card {
    padding: 20px;
  }
  
  .stat-icon {
    font-size: 2.5rem;
  }
  
  .stat-number {
    font-size: 1.8rem;
  }
  
  .controls-section {
    flex-direction: column;
    gap: 15px;
  }
  
  .filter-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .reports-section {
    grid-template-columns: 1fr;
  }
  
  .quick-actions {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Mobile Table Styles */
  table, thead, tbody, th, td, tr {
    display: block;
  }
  
  table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  table tr {
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 15px;
    background: white;
    border: 1px solid #e1e5e9;
  }
  
  table td {
    border: none;
    position: relative;
    padding: 12px 15px 12px 40%;
    text-align: right;
    border-bottom: 1px solid #f1f3f5;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }
  
  table td:last-child {
    border-bottom: none;
    text-align: center;
    padding: 12px 15px;
  }
  
  /* Ensure buttons in the action column display properly */
  table td:last-child .edit-btn,
  table td:last-child .save-btn {
    display: inline-block;
    margin: 5px;
  }
  
  table td::before {
    content: attr(data-label) ": ";
    position: absolute;
    left: 15px;
    top: 12px;
    width: 35%;
    text-align: left;
    font-weight: bold;
    color: #2c3e50;
  }
  
  table td:nth-child(10)::before {
    content: "Billing Status: ";
  }
  
  table td:nth-child(10) select {
    width: 100%;
    min-width: auto;
  }
  
  .notification {
    right: 15px;
    left: 15px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .stat-card {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  
  .dept-stats {
    flex-direction: column;
  }
  
  .activity-item {
    flex-direction: column;
    text-align: center;
  }
  
  .date-range-controls {
    flex-direction: column;
  }
  
  .filter-controls {
    flex-direction: column;
  }
  
  .filter-controls select,
  .filter-controls input[type="date"] {
    width: 100%;
  }
}

@media (min-width: 1200px) {
  table th:nth-child(10), 
  table td:nth-child(10) { 
    width: 180px;
  }
}
