/* ==========================================================================
   Premium Dark Theme for DB Pro Fleet Dashboard
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Core Colors */
  --bg: #090B10;
  /* Very deep dark blue/black */
  --surface: #10141D;
  /* Slightly lighter for cards */
  --surface-hover: #151A26;
  --surface-glass: rgba(16, 20, 29, 0.7);

  /* Borders & Dividers */
  --border: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.15);

  /* Accents */
  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));

  /* Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  /* Layout & Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Animations */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Utilities */
.hidden {
  display: none !important;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Subtle background glow effect */
body::before {
  content: '';
  position: fixed;
  top: -20vh;
  left: -10vw;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

/* Subtle dot-grid texture behind everything */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  z-index: -1;
  pointer-events: none;
}


header {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.lang-switcher .lang-btn {
  color: var(--text-muted);
}
.lang-switcher .lang-btn.active {
  color: var(--text-main);
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.logo h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo span {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  margin-left: 0.5rem;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2.5s infinite;
  flex-shrink: 0;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

/* ── ADVANCED STATS TAB ── */
.stats-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.custom-date-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  animation: slideDown 0.2s ease-out forwards;
}

.date-input {
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
}

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

/* ── ADVANCED STATS DASHBOARD ── */
.stats-dashboard-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .stats-dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.stats-page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

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

/* Glass Toolbar */
.glass-toolbar {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.glass-input {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

.glass-input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Premium Dashboard Grid */
.adv-stats-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

.glass-card {
  background: rgba(30, 41, 59, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.glass-card:hover {
  transform: translateY(-4px);
  background: rgba(30, 41, 59, 0.5);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.adv-stat-card.hero-card {
  grid-column: span 12;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.1) 0%, rgba(30, 41, 59, 0.4) 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.span-full {
  grid-column: span 12;
}

/* Animated Glow Accents */
.stat-glow {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.5s;
}

.glass-card:hover .stat-glow {
  opacity: 0.8;
}

.glow-green { background: #10b981; }
.glow-purple { background: #8b5cf6; }
.glow-blue { background: #3b82f6; }
.glow-orange { background: #f59e0b; }

/* Headers & Icons */
.adv-stat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  z-index: 1;
  position: relative;
}

.adv-stat-header.border-b {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}

.adv-stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.green-grad { background: linear-gradient(135deg, #10b981, #059669); }
.purple-grad { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.blue-grad { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.orange-grad { background: linear-gradient(135deg, #f59e0b, #d97706); }

.adv-stat-titles {
  display: flex;
  flex-direction: column;
}

.adv-stat-title {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.adv-stat-subtext {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* Values */
.adv-stat-content {
  z-index: 1;
  position: relative;
  display: flex;
  align-items:Baseline;
  gap: 0.5rem;
}

.adv-stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.currency-symbol {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-muted);
}
.currency-symbol.small { font-size: 0.9rem; }

.hero-content .adv-stat-value {
  font-size: 3.5rem;
  color: #10b981;
}

/* Modern Fleet Health Grid */
.modern-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.health-item-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s;
}

.health-item-box:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.03);
}

.health-icon {
  font-size: 1.5rem;
}

.box-green .health-icon { color: #10b981; }
.box-blue .health-icon { color: #3b82f6; filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.4));}
.box-red .health-icon { color: #ef4444; filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.4));}

.health-details {
  display: flex;
  flex-direction: column;
}

.health-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.health-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Spinner Modern */
.spinner-modern {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: s-spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  margin: 0 auto 1rem;
}
@keyframes s-spin { 100% { transform: rotate(360deg); } }
.loading-text { color: var(--text-muted); font-size: 0.9rem; }

/* Stats Loading */
/* ── EMPLOYEE UI ENHANCEMENTS ── */
.emp-name-col {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.emp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #818cf8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.health-val {
  font-weight: 600;
  color: var(--text);
}

/* Stats Loading */
.stats-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
  gap: 1rem;
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.tab-btn {
  padding: 0.875rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tab-btn .tab-icon {
  font-size: 1em;
  line-height: 1;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-primary);
  transform: scaleX(0);
  transition: var(--transition-fast);
  border-radius: 2px 2px 0 0;
}

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

.tab-btn.active {
  color: var(--text-main);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

/* ── SECTIONS ── */
.section {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  display: none;
  animation: fadeIn 0.3s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section.active {
  display: block;
}

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

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-main) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── BUTTONS ── */
.btn {
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

/* Spinner Animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  border: none;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--border-highlight);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
}

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

/* ── TABLE WRAPPER & TOOLBAR ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.toolbar input {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition-fast);
}

.toolbar input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

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

.chip-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip {
  padding: 0.375rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.chip:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.chip.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ── DESKTOP TABLE ── */
.desktop-view {
  overflow-x: auto;
}

.desktop-view table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.desktop-view thead tr {
  background: rgba(255, 255, 255, 0.02);
}

th {
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-main);
}

.desktop-view tbody tr {
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.desktop-view tbody tr::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-primary);
  transform: scaleY(0);
  transition: transform var(--transition-fast);
  border-radius: 0 2px 2px 0;
}

.desktop-view tbody tr:hover {
  background-color: var(--surface-hover);
}

.desktop-view tbody tr:hover::after {
  transform: scaleY(1);
}

.desktop-view tbody tr:last-child td {
  border-bottom: none;
}

.empty-row td {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge.avail {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge.inuse {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.2);
}

.badge.ok {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.badge.expired {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.badge.active {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.2);
}

.badge.completed {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border);
}

.badge.missing {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ── MOBILE CARDS ── */
.mobile-view {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
}

.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.entity-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform var(--transition-smooth);
  transform-origin: left;
}

.entity-card:hover::before {
  transform: scaleX(1);
}

.entity-card:active {
  transform: scale(0.99);
}

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

.card-plate {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  color: var(--text-main);
  font-weight: 700;
}

.card-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

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

.card-row .label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.card-row .val {
  font-weight: 500;
  color: var(--text-main);
  text-align: right;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  background: var(--surface);
}

.page-info {
  color: var(--text-muted);
}

.page-btns {
  display: flex;
  gap: 0.5rem;
}

.page-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 11, 16, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(1) translateY(0);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal {
  transform: scale(0.95) translateY(20px);
}

/* Wide document viewer modal */
.modal-xl {
  max-width: 900px;
}

.doc-modal-body {
  padding: 0 !important;
  height: 72vh;
  overflow: hidden;
}

/* Inline doc action links (view / download) for car table rows */
.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sub);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.doc-chip:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.doc-chip.no-doc {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* ── Current file preview card inside the car modal ── */
.file-current {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(59, 130, 246, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.file-current.hidden {
  display: none;
}

.file-current-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-current-name {
  flex: 1;
  font-size: 0.78rem;
  color: var(--accent-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.file-current-name:hover {
  text-decoration: underline;
}

.file-current-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.file-replace-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.file-replace-label.hidden {
  display: none;
}

.file-input-styled {
  display: block;
  width: 100%;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.file-input-styled:hover {
  border-color: var(--accent-primary);
}

/* Extra-small button variant */
.btn-xs {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
}


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

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}

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

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

.form-group input,
.form-group select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── TOASTS ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-main);
  min-width: 280px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(100%);
  opacity: 0;
  animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes toastSlideIn {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

/* ── RESPONSIVENESS ── */
@media(max-width: 768px) {
  header {
    padding: 0 1rem;
  }

  .logo span {
    display: none;
  }

  /* Hide 'Fleet Dashboard' subtitle */
  #db-status {
    display: none;
  }

  /* Hide 'Database Connected' text */
  .header-status button {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    margin-left: 0.5rem !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 1rem;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.75rem;
    gap: 0.75rem;
    border-radius: var(--radius-sm);
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .stat-label {
    font-size: 0.65rem;
    margin-bottom: 0.1rem;
    letter-spacing: 0.02em;
  }

  /* Advanced Stats Mobile layout */
  .adv-stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .glass-card {
    grid-column: 1 / -1 !important;
  }

  .hero-content .adv-stat-value {
    font-size: 2.2rem;
  }

  .section {
    padding: 1rem;
  }

  /* Make tabs smooth scrollable horizontally without scrollbar */
  .tabs {
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .desktop-view {
    display: none !important;
  }

  .mobile-view {
    display: flex !important;
    margin-top: 1rem;
    gap: 0.75rem;
  }

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

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  .toolbar input {
    min-width: 100%;
  }

  .custom-date-group {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .custom-date-group input {
    flex: 1 1 40%;
  }

  .custom-date-group button {
    flex: 1 1 100%;
  }

  /* Make filter chips smooth scrollable horizontally */
  .chip-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .chip-group::-webkit-scrollbar {
    display: none;
  }

  /* Tighten Modals on mobile */
  .modal-overlay {
    padding: 0.5rem;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
    gap: 1rem;
  }

  .modal-footer {
    padding: 1rem;
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Stack Pagination Actions */
  .pagination {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .page-btns {
    justify-content: center;
    width: 100%;
  }

  .page-btn {
    flex: 1;
    text-align: center;
  }

  /* Toasts stretch to screen edges */
  .toast-container {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }
}

/* Tiny screens (e.g., iPhone SE, older Androids, Samsung S25) */
@media(max-width: 480px) {
  header {
    padding: 0 0.75rem;
    height: 56px;
  }

  .logo {
    gap: 0.4rem;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
    border-radius: 6px;
  }

  .logo h1 {
    font-size: 0.95rem;
  }

  .header-status {
    gap: 0.25rem;
  }

  .header-status button {
    padding: 0.25rem 0.4rem;
    font-size: 0.65rem;
    margin-left: auto !important;
  }

  .section {
    padding: 1rem 0;
  }

  .tabs {
    padding: 0 0.5rem;
  }

  .table-wrap {
    border: none;
    border-radius: 0;
  }

  .toolbar {
    padding: 1rem 0.5rem;
  }

  .mobile-view {
    padding: 0 0.5rem;
  }

  .entity-card {
    border-radius: var(--radius-sm);
    padding: 1rem;
  }

  .login-box {
    padding: 2.5rem 1.5rem;
    margin: 0 1rem;
  }

  .login-box h2 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
  }

  .card-plate {
    font-size: 0.95rem;
  }

  .card-row .val {
    max-width: 60%;
    text-align: right;
    word-break: break-word;
    /* Prevent long emails/phones from blowing out the card view */
  }
}

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

/* ── LOGIN ── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% -20%, var(--surface) 0%, var(--bg) 80%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: opacity 0.4s ease, visibility 0.4s;
}

#login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-box {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(59, 130, 246, 0.12), 0 0 120px rgba(139, 92, 246, 0.08);
  text-align: center;
  animation: loginPop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Top-edge gradient accent on login box */
.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

@keyframes loginPop {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-box h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.login-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  letter-spacing: 0.02em;
}

.login-box .form-group {
  text-align: left;
  margin-bottom: 1.5rem;
}

.login-box input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  width: 100%;
  color: var(--text-main);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.login-box input:focus {
  border-color: var(--accent-primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  outline: none;
}

.login-box button {
  width: 100%;
  padding: 0.875rem;
  margin-top: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  color: white;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.login-box button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.login-box button:active {
  transform: translateY(0);
}

#app-content {
  transition: opacity 0.4s ease;
}

/* ── Employee Document Cards Grid ────────────────────────────────────────── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .doc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.doc-slot {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.85rem 0.9rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  min-height: 120px;
}

.doc-slot.has-file {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.05);
}

.doc-slot.has-file:hover {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.09);
}

.doc-slot.pending-delete {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
  opacity: 0.7;
}

.doc-slot-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status dot */
.doc-slot-status {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.doc-slot.has-file .doc-slot-status {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.doc-slot.pending-delete .doc-slot-status {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

/* ── Mini Document Icons (Table/Cards) ───────────────────────────────────── */
.doc-mini-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.doc-mini-list {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.doc-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-main);
  padding: 0;
}

.doc-mini-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.doc-slot.has-file .doc-slot-status {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

/* Empty state */
.doc-slot-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.doc-slot-empty-icon {
  font-size: 1.4rem;
}

.doc-slot-empty-text {
  font-size: 0.68rem;
}

/* Filled state */
.doc-slot-file {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
}

.doc-slot-file-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.doc-slot-file-name {
  font-size: 0.72rem;
  color: var(--accent-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.doc-slot-file-name:hover {
  text-decoration: underline;
}

.doc-slot-actions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.doc-slot-actions .btn {
  flex: 1;
  min-width: 0;
  font-size: 0.65rem;
  padding: 0.25rem 0.35rem;
  text-align: center;
}

/* Replace label above file picker */
.doc-slot-replace-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* File input inside a slot */
.doc-slot input[type="file"] {
  display: block;
  width: 100%;
  font-size: 0.68rem;
  padding: 0.3rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.doc-slot input[type="file"]:hover {
  border-color: var(--accent-primary);
}

/* Pending-delete overlay text */
.doc-slot-delete-notice {
  font-size: 0.65rem;
  color: var(--danger);
  text-align: center;
  margin-top: 0.15rem;
}

/* Undo-delete button */
.doc-slot-undo {
  font-size: 0.65rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  width: 100%;
  margin-top: 0.2rem;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.doc-slot-undo:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ── Employee Advanced Filter Toolbar ───────────────────────────────────── */
.emp-filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

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

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Employee Table — Permis column ─────────────────────────────────────── */
.emp-permis-cell {
  min-width: 140px;
}

.emp-permis-dates {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Employee Table — Doc column ────────────────────────────────────────── */
.emp-doc-cell {
  min-width: 120px;
}

.emp-doc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.emp-doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 100px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.emp-doc-pill.has-file {
  border-color: rgba(34,197,94,0.4);
  color: #22c55e;
  background: rgba(34,197,94,0.08);
}

.emp-doc-pill.no-file {
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
  background: rgba(239,68,68,0.06);
}

.emp-doc-pill:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ── Employee Card Improvements ─────────────────────────────────────────── */
.emp-card-permis {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .emp-filters-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .emp-filter-group {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   EMPLOYEE CARD GRID — Modern responsive design
   ═══════════════════════════════════════════════════════════════════════════ */

.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
  padding: 0.5rem 0 1.5rem;
}

/* ── Individual Card ─────────────────────────────────────────────────────── */
.emp-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.emp-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.38);
}
.emp-card--ok      { border-left-color: #22c55e; }
.emp-card--warn    { border-left-color: #f59e0b; }
.emp-card--danger  { border-left-color: #ef4444; }
.emp-card--neutral { border-left-color: rgba(255,255,255,0.1); }

/* ── Card Header ─────────────────────────────────────────────────────────── */
.emp-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.emp-card-avatar {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}
.emp-card-identity   { flex: 1; min-width: 0; }
.emp-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emp-card-phone {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.emp-phone-empty { font-style: italic; opacity: 0.5; }

/* Action buttons in the header */
.emp-card-tools { display: flex; gap: 0.35rem; flex-shrink: 0; }
.ecc-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.ecc-btn:hover { transform: scale(1.1); }
.ecc-btn--edit:hover { background: rgba(99,102,241,0.2); border-color: #6366f1; }
.ecc-btn--del:hover  { background: rgba(239,68,68,0.2);  border-color: #ef4444; }

/* ── Section Labels ──────────────────────────────────────────────────────── */
.ecc-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.45rem;
}

/* ── Permis Row ──────────────────────────────────────────────────────────── */
.emp-card-permis-row {
  padding: 0.7rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.ecc-permis-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.ecc-permis-dates {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Documents Section ───────────────────────────────────────────────────── */
.emp-card-docs-row {
  padding: 0.7rem 1rem 0.75rem;
  flex: 1;
}
.ecc-docs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.ecc-docs-head .ecc-section-label { margin-bottom: 0; }

/* Summary badge (Complete / Partial / Missing) */
.edc-summary {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
}
.edc-summary--ok      { background: rgba(34,197,94,0.15);  color: #4ade80; }
.edc-summary--partial { background: rgba(245,158,11,0.15); color: #fbbf24; }
.edc-summary--bad     { background: rgba(239,68,68,0.12);  color: #f87171; }

/* A strict 7-column grid to force all docs onto a single line */
.edc-pills-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

/* Individual doc pill - stacked vertically to save horizontal space */
.edc-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.55rem;
  font-weight: 600;
  cursor: default;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  text-align: center;
  line-height: 1.1;
  /* Ensure identical dimensions for <button> vs <span> */
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background-color: transparent;
  color: inherit;
  font-family: inherit;
}
.edc-pill-icon { 
  font-size: 0.85rem; 
  line-height: 1; 
  margin-bottom: 0.2rem;
}
.edc-pill-label { 
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip; /* Clip instead of ellipsis to save space, short labels are designed to fit */
  max-width: 100%;
}

.edc-pill--ok {
  background: rgba(34,197,94,0.08); /* Lighter background */
  border-color: rgba(34,197,94,0.25);
  color: #86efac;
  cursor: pointer;
}
.edc-pill--ok:hover {
  background: rgba(34,197,94,0.15);
  border-color: #22c55e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34,197,94,0.2);
}
.edc-pill--miss {
  background: rgba(239,68,68,0.04);
  border-color: rgba(239,68,68,0.15);
  color: rgba(248,113,113,0.6);
}

/* ── Card Footer ─────────────────────────────────────────────────────────── */
.emp-card-footer {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  background: rgba(255,255,255,0.015);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.emp-grid-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  gap: 0.6rem;
  color: var(--text-muted);
  text-align: center;
}
.emp-grid-empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.emp-grid-empty p    { font-size: 1rem; font-weight: 600; color: var(--text-main); margin: 0; }
.emp-grid-empty small { font-size: 0.8rem; }

/* ── Filter toolbar responsive fix ──────────────────────────────────────── */
@media (max-width: 768px) {
  .emp-filters-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .emp-filter-group {
    flex-direction: column;
    align-items: flex-start;
  }
  .emp-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Monitoring Module
   ========================================================================== */

.mon-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mon-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.mon-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.mon-stat-value.mon-danger {
  color: var(--danger);
}

.mon-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mon-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.mon-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.mon-panel-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.mon-search {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  min-width: 240px;
  outline: none;
  transition: border-color 0.2s;
}

.mon-search:focus {
  border-color: var(--accent-primary);
}

/* Filter row (dropdowns + search together) */
.mon-filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mon-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.mon-select:focus { border-color: var(--accent-primary); }

/* Count badge next to panel title */
.mon-count-badge {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

/* Response-time colour coding */
.mon-slow   { color: var(--danger);  font-weight: 600; }
.mon-medium { color: var(--warning); font-weight: 500; }
.mon-warn   { color: var(--warning); }

/* ==========================================================================
   Diagnostic bar-chart panels (top paths / IPs / users)
   ========================================================================== */
.mon-diag-row-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.mon-diag-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
}

.mon-diag-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.mon-diag-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.mon-diag-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
}

.mon-diag-label {
  flex: 0 0 auto;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mon-diag-bar-wrap {
  flex: 1 1 auto;
  background: var(--border);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

.mon-diag-bar {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.mon-diag-count {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 2rem;
  text-align: right;
}

/* ==========================================================================
   Pagination controls
   ========================================================================== */
.mon-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
}

.mon-page-btns {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.mon-page-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}
.mon-page-btn:hover:not([disabled]) {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}
.mon-page-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}
.mon-page-btn.mon-page-active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  font-weight: 600;
  pointer-events: none;
}

.mon-page-ellipsis {
  padding: 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  user-select: none;
}

.mon-page-info {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media(max-width: 600px) {
  .mon-stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .mon-search {
    min-width: 0;
    width: 100%;
  }
  .mon-diag-row-wrap {
    grid-template-columns: 1fr;
  }
  /* Stack panel header vertically on small screens */
  .mon-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .mon-filter-row {
    width: 100%;
    flex-direction: column;
  }
  .mon-select,
  .mon-filter-row .mon-search {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }
  /* Make tables horizontally scrollable instead of overflowing */
  .mon-panel .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Pagination: stack info below buttons */
  .mon-pagination {
    flex-direction: column;
    align-items: flex-start;
  }
  .mon-page-info {
    order: -1;
    margin-bottom: 0.3rem;
  }
}

/* ── Houses ──────────────────────────────────────────────────────────────────── */
.house-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding: 1.25rem 0;
}

.house-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.house-empty-icon {
  font-size: 3rem;
  opacity: 0.4;
}
.house-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}
.house-empty-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Card */
.house-card {
  background: rgba(16, 20, 29, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.25s;
}

/* gradient top-bar that slides in on hover */
.house-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: var(--gradient-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box,
                linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.house-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4),
              0 0 0 1px rgba(59,130,246,0.12);
}

.house-card:hover::before {
  opacity: 1;
}

/* Card body */
.house-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1;
}

/* Icon + Address row */
.house-icon-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.house-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(59,130,246,0.18), rgba(139,92,246,0.18));
  border: 1px solid rgba(59,130,246,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,0.12);
}

.house-address-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.house-address {
  font-weight: 700;
  font-size: 0.975rem;
  color: var(--text-main);
  line-height: 1.45;
  word-break: break-word;
}

/* Owner info grid */
.house-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.house-info-item {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.house-info-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

.house-info-value {
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.house-info-value.na {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

/* Contract row */
.house-contract-row {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.house-contract-row a.badge,
.house-contract-row .badge {
  text-decoration: none;
  font-size: 0.78rem;
}

/* Actions footer */
.house-card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  justify-content: flex-end;
}

/* Optional label in modal */
.house-optional {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* doc-link inside modal */
.doc-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-size: 0.85rem;
}
.doc-link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .house-grid {
    grid-template-columns: 1fr;
  }
  .house-info-grid {
    grid-template-columns: 1fr;
  }
}
