@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   CSS Variables & Design Tokens
   ============================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --secondary: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --info: #3b82f6;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #253347;
  --bg-input: #0f172a;
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(79, 70, 229, 0.3);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   Layout
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1a1f35 0%, #0f172a 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1002;
  /* Always above the overlay (1001) */
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-logo .logo-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-logo .logo-text p {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 24px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
  margin: 1px 8px;
  border-radius: var(--radius-md);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 16px 8px 40px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.topbar-search input:focus {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.topbar-search input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--primary-light);
}

/* Profile specific button */
#profile-btn {
  width: auto;
  padding: 0 12px 0 6px;
  gap: 10px;
}

.profile-icon-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-arrow {
  font-size: 10px;
  color: var(--text-muted);
}

.page-content {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-title p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 24px;
}

/* ============================================
   Stats Cards (Dashboard KPIs)
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 2px 0 0 2px;
}

.stat-card.stat-total::before {
  background: var(--primary);
}

.stat-card.stat-valid::before {
  background: var(--success);
}

.stat-card.stat-warning::before {
  background: var(--warning);
}

.stat-card.stat-expired::before {
  background: var(--danger);
}

.stat-card.stat-nocert::before {
  background: var(--gray-500);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.14);
}

.stat-card.stat-warning {
  animation: pulse-warning 2.5s infinite;
}

.stat-card.stat-expired {
  animation: pulse-danger 2s infinite;
}

@keyframes pulse-warning {

  0%,
  100% {
    border-color: var(--border-color);
  }

  50% {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
  }
}

@keyframes pulse-danger {

  0%,
  100% {
    border-color: var(--border-color);
  }

  50% {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
  }
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-total .stat-icon {
  background: rgba(79, 70, 229, 0.15);
  color: var(--primary-light);
}

.stat-valid .stat-icon {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.stat-warning .stat-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.stat-expired .stat-icon {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.stat-nocert .stat-icon {
  background: rgba(100, 116, 139, 0.15);
  color: var(--gray-400);
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-total .stat-value {
  color: var(--primary-light);
}

.stat-valid .stat-value {
  color: var(--success);
}

.stat-warning .stat-value {
  color: var(--warning);
}

.stat-expired .stat-value {
  color: var(--danger);
}

.stat-nocert .stat-value {
  color: var(--gray-400);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #fff;
}

.btn-warning:hover {
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: #fff;
}

.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}

.btn-icon {
  padding: 9px;
}

/* ============================================
   Table
   ============================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: normal;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table td {
  padding: 14px 16px;
  vertical-align: middle;
  color: var(--text-primary);
}

.data-table td.text-muted {
  color: var(--text-muted);
}

/* Equipment image thumbnail */
.equip-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--gray-800);
  border: 1px solid var(--border-color);
}

.equip-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-muted);
}

/* ============================================
   Status Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-valid {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-expired {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-nocert {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.dot-green {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.dot-yellow {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  animation: blink 1.5s infinite;
}

.dot-red {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
  animation: blink 1s infinite;
}

.dot-gray {
  background: var(--gray-500);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control option {
  background: var(--gray-900);
}

select.form-control {
  appearance: none;
  cursor: pointer;
}

.form-control-file {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.form-control-file:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Filters / Search Bar
   ============================================ */
.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 16px 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-lg {
  max-width: 900px;
}

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: var(--transition);
  padding: 0 10px;
}

.page-btn:hover,
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn.active {
  font-weight: 700;
}

/* ============================================
   Alert / Flash messages
   ============================================ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.alert-info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: -1px;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}

.login-bg-orbs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: var(--radius-full);
  filter: blur(80px);
  opacity: 0.15;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--secondary);
  bottom: -80px;
  right: -80px;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: var(--warning);
  top: 50%;
  left: 50%;
}

.login-card {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-circle {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow);
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.login-logo p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Progress & Charts
   ============================================ */
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
}

/* ============================================
   Toolbar chips (status filter)
   ============================================ */
.status-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.chip-all {
  background: rgba(79, 70, 229, 0.15);
  color: var(--primary-light);
  border-color: rgba(79, 70, 229, 0.3);
}

.chip-valid {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.chip-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.chip-expired {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.chip-nocert {
  background: rgba(100, 116, 139, 0.12);
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.3);
}

.chip:hover,
.chip.active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  filter: brightness(1.15);
}

/* ============================================
   Utility
   ============================================ */
.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.ml-auto {
  margin-left: auto;
}

.mt-0 {
  margin-top: 0;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.text-muted {
  color: var(--text-muted);
}

.fw-bold {
  font-weight: 700;
}

.fs-12 {
  font-size: 12px;
}

.fs-13 {
  font-size: 13px;
}

/* ============================================
   Responsive Adjustments & Mobile Bottom Nav
   ============================================ */

/* Bottom Navigation (Mobile Only) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(15px);
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: var(--transition);
  flex: 1;
}

.mobile-bottom-nav .nav-item .nav-icon {
  font-size: 20px;
  transition: var(--transition);
}

.mobile-bottom-nav .nav-item.active {
  color: var(--primary-light);
}

.mobile-bottom-nav .nav-item.active .nav-icon {
  transform: translateY(-2px);
  text-shadow: 0 0 10px rgba(129, 140, 248, 0.4);
}

@media (max-width: 992px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding-bottom: 70px;
  }

  .topbar {
    padding: 0 16px;
    gap: 8px;
    justify-content: space-between;
    z-index: 1100;
  }

  .topbar-actions {
    gap: 4px;
    z-index: 1100;
  }

  .topbar-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  /* Profile button mobile */
  #profile-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    justify-content: center;
    background: transparent;
    border: none;
  }

  #profile-btn .user-name,
  #profile-btn .user-arrow {
    display: none;
  }

  #profile-btn .profile-icon-circle {
    width: 32px;
    height: 32px;
  }

  /* Search results mobile position */
  #search-results {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: none !important;
    top: 60px !important;
  }

  .topbar-search {
    max-width: 130px;
  }

  /* Shrink search on mobile */
  .topbar-search input {
    padding: 8px 12px 8px 32px;
    font-size: 12px;
  }

  .search-icon {
    left: 10px;
    font-size: 13px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .topbar-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  /* Profile btn modification for mobile */
  #profile-btn span:not(.nav-icon) {
    display: none;
  }

  /* Hide name on mobile header */
  #profile-btn {
    padding: 4px;
    width: 34px;
    height: 34px;
    justify-content: center;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
    gap: 12px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .page-content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Fix profile page on mobile */
  [style*="grid-template-columns: 280px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .topbar-search {
    display: none;
  }
}

/* Animations */
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.card {
  animation: slideInUp 0.4s ease backwards;
}

.card:nth-child(1) {
  animation-delay: 0.1s;
}

.card:nth-child(2) {
  animation-delay: 0.2s;
}

.card:nth-child(3) {
  animation-delay: 0.3s;
}

/* Responsive Grids */
.detail-grid,
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 992px) {

  .detail-grid,
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ==============================================
   Missing Ticket Badge Classes
   ============================================== */
.badge-repair {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* ==============================================
   Ticket Page
   ============================================== */
.ticket-row {
  cursor: pointer;
}

.ticket-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.ticket-detail {
  display: none;
  background: rgba(0, 0, 0, 0.2);
  padding: 15px;
  border-radius: 8px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ticket-detail.show {
  display: block;
  animation: slideInUp 0.2s ease;
}

/* ==============================================
   Cron Settings Code Block
   ============================================== */
.code-block {
  background: #0f172a;
  padding: 16px;
  border-radius: var(--radius-md);
  color: #38bdf8;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  word-break: break-all;
}

/* ==============================================
   Stat card label fix (ensure visible on ALL cards)
   ============================================== */
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
  white-space: normal;
  line-height: 1.3;
}

/* ==============================================
   Mobile Table Fixes
   ============================================== */
@media (max-width: 768px) {
  .table-container {
    border-radius: var(--radius-md);
  }

  .data-table thead th {
    padding: 8px 8px;
    font-size: 10px;
  }

  .data-table td {
    padding: 8px 8px;
    font-size: 12px;
  }

  /* Dashboard main grid force 1 col on tablet */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  /* Card header wrapping */
  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Modal slides up from bottom on mobile */
  .modal {
    max-width: 100% !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  /* Filter chips wrap nicely */
  .status-chips {
    gap: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .chip {
    padding: 4px 10px;
    font-size: 11px;
    flex-shrink: 0;
  }

  /* Dept stats table less important cols hidden */
  .dept-hide-mobile {
    display: none;
  }

  /* Form row 1 col */
  .form-row {
    grid-template-columns: 1fr !important;
  }

  /* stat card small */
  .stat-card {
    padding: 14px 12px;
    gap: 10px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .stat-label {
    font-size: 11px;
  }
}

/* ==============================================
   Page content bottom padding for mobile bottom-nav
   ============================================== */
@media (max-width: 992px) {
  .page-content {
    padding-bottom: 80px !important;
  }
}

/* ==============================================
   Pulse animations
   ============================================== */
@keyframes pulse-danger {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================================
   Progress bar
   ============================================== */
.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
}

/* ==============================================
   Pagination
   ============================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: var(--transition);
}

.page-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==============================================
   Form hint text
   ============================================== */
.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==============================================
   Empty state
   ============================================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ==============================================
   d-flex utility
   ============================================== */
.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.gap-6 {
  gap: 6px;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-muted);
}