/* ============================================
   IT TRACK - GPS Fleet Tracking Platform
   Premium Dark Theme v2
   ============================================ */

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

:root {
  --bg-primary: #080b12;
  --bg-secondary: #0d1120;
  --bg-card: rgba(17, 22, 38, 0.85);
  --bg-card-solid: #111626;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f2f5;
  --text-secondary: #8b92a5;
  --text-muted: #555d72;
  --accent: #0345bf;
  --accent-light: #2563eb;
  --accent-hover: #022e8a;
  --accent-glow: rgba(3, 69, 191, 0.15);
  --accent-glow-strong: rgba(3, 69, 191, 0.3);
  --gradient-1: linear-gradient(135deg, #0345bf 0%, #2563eb 100%);
  --gradient-2: linear-gradient(135deg, #2563eb 0%, #0345bf 100%);
  --gradient-3: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  --green: #10b981;
  --green-light: #34d399;
  --green-bg: rgba(16, 185, 129, 0.1);
  --green-glow: rgba(16, 185, 129, 0.2);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --cyan: #06b6d4;
  --sidebar-width: 270px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(3, 69, 191, 0.15);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

select option {
  background: var(--bg-card-solid);
  color: var(--text-primary);
}

select,
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ============================================
   LOGIN PAGE
   ============================================ */
/* LOGIN - Split Layout */
.login-page {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.login-brand {
  flex: 1;
  background: linear-gradient(135deg, #020d24 0%, #0a1a3a 40%, #0345bf 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}

.login-brand::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(3, 69, 191, 0.3) 0%, transparent 70%);
  border-radius: 50%;
}

.login-brand::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.login-brand-logo {
  width: 280px;
  height: auto;
  margin-bottom: 32px;
  filter: brightness(0) invert(1);
}

.login-brand-tagline {
  font-size: 20px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin-bottom: 40px;
}

.login-brand-features {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-brand-features li {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
}

.login-brand-features li i {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #60a5fa;
  font-size: 15px;
  flex-shrink: 0;
}

.login-brand-footer {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  z-index: 1;
}
.login-brand-footer a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s;
}
.login-brand-footer a:hover {
  color: rgba(255, 255, 255, 0.8);
}

/* Sidebar branding footer */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.sidebar-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.sidebar-footer a:hover {
  color: var(--accent-light);
}
.sidebar.collapsed .sidebar-footer span {
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
}

.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 60px 80px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 460px;
  animation: cardAppear 0.6s ease-out;
}

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

.login-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.input-with-icon input {
  padding-left: 42px;
}

.login-mobile-logo {
  display: none;
  width: 160px;
  height: auto;
  margin: 32px auto 0;
  filter: brightness(0) invert(1);
}
[data-theme="light"] .login-mobile-logo {
  filter: none;
}
[data-theme="light"] .login-brand-logo {
  filter: brightness(0) invert(1);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
  background: rgba(3, 69, 191, 0.05);
}

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

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.field-hint i { margin-right: 4px; }

.info-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--accent-glow);
  border: 1px solid rgba(3, 69, 191, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.info-bar i { color: var(--accent-light); margin-top: 2px; flex-shrink: 0; }
.info-bar.warn { background: var(--yellow-bg); border-color: rgba(245,158,11,0.2); }
.info-bar.warn i { color: var(--yellow); }

.announcement-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(245,158,11,0.15), rgba(245,158,11,0.08));
  border-bottom: 1px solid rgba(245,158,11,0.2);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 500;
}
.announcement-banner i { font-size: 16px; flex-shrink: 0; }

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }

.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group { flex: 1; }

.form-group .checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.form-group .checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.form-group .checkbox-row label {
  margin: 0;
  text-transform: none;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  letter-spacing: 0;
}

.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 16px;
  text-align: center;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--gradient-1);
  color: white;
  box-shadow: 0 4px 16px rgba(3, 69, 191, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(3, 69, 191, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-light);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 13px;
  font-size: 14px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ============================================
   APP LAYOUT
   ============================================ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow);
  z-index: 100;
  flex-shrink: 0;
  position: relative;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--accent-glow) 0%, transparent 30%, transparent 70%, var(--accent-glow) 100%);
  pointer-events: none;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-logo-img {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  height: var(--topbar-height);
}

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

.sidebar-logo-img {
  height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
}
[data-theme="light"] .sidebar-logo-img {
  filter: none;
  font-weight: 700;
  letter-spacing: -0.3px;
  transition: all var(--transition);
}

.sidebar-toggle {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 7px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 16px 14px 8px;
  transition: all var(--transition);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
}

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

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

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gradient-1);
  border-radius: 0 4px 4px 0;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-item.active i {
  color: var(--accent-light);
}

.nav-item span {
  transition: all var(--transition);
  white-space: nowrap;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(13, 17, 32, 0.8);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-left h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.topbar-user:hover { background: var(--bg-hover); }

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-user-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.topbar-user.open .topbar-user-arrow { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  overflow: hidden;
  animation: dropdownAppear 0.15s ease-out;
}

@keyframes dropdownAppear {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-dropdown-header strong {
  font-size: 14px;
  color: var(--text-primary);
}
.user-dropdown-header small {
  font-size: 12px;
  color: var(--text-muted);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--red);
}
.user-dropdown-item i { width: 16px; text-align: center; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-bg);
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--green-glow);
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.notification-bell {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.mobile-only { display: none; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-primary);
}

.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px 200px;
}

.page { display: none; }
.page.active { display: block; animation: pageIn 0.3s ease-out; }

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

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stats-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

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

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, transparent, var(--green), transparent); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, transparent, var(--yellow), transparent); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, transparent, var(--red), transparent); }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.accent { background: var(--accent-glow); color: var(--accent-light); }
.stat-icon.green { background: var(--green-bg); color: var(--green-light); }
.stat-icon.yellow { background: var(--yellow-bg); color: var(--yellow); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.1); color: var(--cyan); }
.stat-icon.orange { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.stat-icon.muted { background: rgba(85, 93, 114, 0.15); color: var(--text-muted); }

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

.stat-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.1px;
}

.card-header h3 i {
  color: var(--accent-light);
  font-size: 14px;
}

.card-body {
  padding: 20px 24px;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.fleet-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.fleet-summary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fleet-summary-item.warn {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}
.fleet-summary-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.fleet-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.fleet-summary-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.dashboard-map-card .card-body {
  padding: 0;
}

.dashboard-map {
  height: 520px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.p-0 { padding: 0 !important; }

/* Objects Panel */
.objects-panel {
  display: flex;
  flex-direction: column;
}

.objects-panel-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.objects-panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.objects-search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.objects-search i {
  color: var(--text-muted);
  font-size: 12px;
}

.objects-search input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all var(--transition);
}

.objects-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.objects-list {
  max-height: 260px;
  overflow-y: auto;
}

.object-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}

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

.object-item:hover {
  background: var(--bg-hover);
}

.object-status-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.object-status-icon.online { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.object-status-icon.idle { background: var(--yellow); }
.object-status-icon.offline { background: var(--text-muted); }
.object-status-icon.inactive { background: var(--cyan); }
.object-status-icon.expired { background: #f97316; }
.object-status-icon.unknown { background: #555d72; }

.object-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.object-status-text {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.object-status-text.online { background: var(--green-bg); color: var(--green-light); }
.object-status-text.idle { background: var(--yellow-bg); color: var(--yellow); }
.object-status-text.offline { background: var(--red-bg); color: var(--red); }
.object-status-text.inactive { background: rgba(6, 182, 212, 0.1); color: var(--cyan); }
.object-status-text.expired { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.object-status-text.unknown { background: rgba(85, 93, 114, 0.15); color: var(--text-muted); }

/* Schedules List */
.schedules-list {
  max-height: 200px;
  overflow-y: auto;
}

.schedule-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

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

.schedule-item:hover {
  background: var(--bg-hover);
}

.schedule-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.schedule-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-tasks {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.schedule-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.schedule-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.schedule-badge.enabled { background: var(--green-bg); color: var(--green-light); }
.schedule-badge.disabled { background: var(--red-bg); color: var(--red); }

.schedule-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* Recent Alerts List */
.recent-alerts-list {
  max-height: 180px;
  overflow-y: auto;
}

.recent-alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

.recent-alert-item:last-child {
  border-bottom: none;
}

.recent-alert-item:hover {
  background: var(--bg-hover);
}

.recent-alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.recent-alert-dot.danger { background: var(--red); }
.recent-alert-dot.warning { background: var(--yellow); }
.recent-alert-dot.info { background: var(--blue); }

.recent-alert-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.recent-alert-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Status Pie Chart */
.status-chart-container {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 0;
}

.status-chart-container canvas {
  flex-shrink: 0;
}

.status-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  color: var(--text-secondary);
}

.legend-value {
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-schedules-card .card-body {
  padding: 0;
}

.dashboard-alerts-card .card-body {
  padding: 0;
}

/* ============================================
   MAP PAGE
   ============================================ */
.map-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 56px);
  border-radius: var(--radius);
  overflow: hidden;
}

.map-sidebar {
  width: 330px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.map-search {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-search i {
  color: var(--text-muted);
  font-size: 14px;
}

.map-search input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all var(--transition);
}

.map-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.main-map {
  flex: 1;
}

.map-overlay-controls {
  position: absolute;
  bottom: 20px;
  right: 12px;
  z-index: 1000;
  display: flex;
  gap: 6px;
  flex-direction: column;
}
.map-overlay-controls .btn {
  font-size: 11px;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 600;
  padding: 6px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.map-overlay-controls .btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
}
.map-overlay-controls .btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(3,69,191,0.5);
}

.map-layout {
  position: relative;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(3, 69, 191, 0.08);
  border: 1px solid rgba(3, 69, 191, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
}

.poi-marker-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.3);
}

.vehicle-label {
  background: rgba(13, 17, 32, 0.85) !important;
  border: 1px solid var(--border-light) !important;
  color: var(--text-primary) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}
.vehicle-label::before {
  border-top-color: rgba(13, 17, 32, 0.85) !important;
}

/* Marker Cluster Custom */
.marker-cluster-custom {
  background: transparent !important;
}
.cluster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.3);
}
.cluster-small {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.cluster-medium {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  font-size: 14px;
}
.cluster-large {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  font-size: 15px;
}

/* Override markercluster defaults for dark theme */
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
  transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}

/* ============================================
   VEHICLE LIST
   ============================================ */
.vehicle-list {
  overflow-y: auto;
  flex: 1;
}

.vehicle-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.vehicle-item:hover {
  background: var(--bg-hover);
}

.vehicle-item.active {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
}

.vehicle-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.vehicle-status-dot.online {
  background: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}

.vehicle-status-dot.online::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.3);
  animation: statusPing 2s ease-in-out infinite;
}

@keyframes statusPing {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.5); }
}

.vehicle-status-dot.idle { background: var(--yellow); }
.vehicle-status-dot.offline { background: var(--red); }
.vehicle-status-dot.inactive { background: var(--cyan); }
.vehicle-status-dot.expired { background: #f97316; }
.vehicle-status-dot.unknown { background: #555d72; }

.vehicle-info {
  flex: 1;
  min-width: 0;
}

.vehicle-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-detail {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.vehicle-speed {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 4px 10px;
  background: var(--bg-hover);
  border-radius: var(--radius-xs);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
  overflow-x: auto;
}

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

th {
  text-align: left;
  padding: 14px 18px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tr:hover td {
  background: var(--bg-hover);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.online { background: var(--green-bg); color: var(--green-light); border: 1px solid rgba(16, 185, 129, 0.15); }
.status-badge.idle { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245, 158, 11, 0.15); }
.status-badge.offline { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.15); }
.status-badge.inactive { background: rgba(6, 182, 212, 0.1); color: var(--cyan); border: 1px solid rgba(6, 182, 212, 0.15); }
.status-badge.expired { background: rgba(249, 115, 22, 0.1); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.15); }
.status-badge.unknown { background: rgba(85, 93, 114, 0.15); color: var(--text-muted); border: 1px solid rgba(85, 93, 114, 0.15); }

.actions-cell {
  display: flex;
  gap: 2px;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ============================================
   FILTERS ROW
   ============================================ */
.filters-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filters-row .form-group {
  margin-bottom: 0;
  min-width: 160px;
}

/* ============================================
   ALERTS LIST
   ============================================ */
.alert-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

.alert-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.alert-icon.warning { background: var(--yellow-bg); color: var(--yellow); }
.alert-icon.danger { background: var(--red-bg); color: var(--red); }
.alert-icon.info { background: var(--blue-bg); color: var(--blue); }

.alert-content { flex: 1; }

.alert-title {
  font-size: 13.5px;
  font-weight: 600;
}

.alert-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.alert-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.alert-type-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.alert-type-cell i {
  color: var(--accent);
}

.alert-type-cell.danger i {
  color: #ef4444;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(3, 69, 191, 0.1);
  color: var(--accent);
  margin-right: 4px;
}

.alert-channels {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.alert-channel-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.alert-channel-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.alert-type-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  min-height: 16px;
}

.alert-device-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg-tertiary);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.alert-device-list.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.alert-device-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.alert-device-option:hover {
  background: rgba(3, 69, 191, 0.08);
}

.alert-device-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* ============================================
   GEOFENCES
   ============================================ */
.geofence-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.geofence-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-glow);
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.geofence-info { flex: 1; }

.geofence-name {
  font-size: 13.5px;
  font-weight: 600;
}

.geofence-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.geofence-item:hover {
  background: rgba(3, 69, 191, 0.05);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: 8px;
}

.geofence-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
}

.geofence-list-card {
  max-height: 600px;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .geofence-layout {
    grid-template-columns: 1fr;
  }
}

.geofence-type-btns {
  display: flex;
  gap: 8px;
}

.geofence-type-btns .btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: modalIn 0.3s ease-out;
  isolation: isolate;
  position: relative;
  z-index: 1001;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-body {
  padding: 28px;
}

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

.modal-wide {
  max-width: 920px;
}

.modal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.modal-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  .modal-wide {
    max-width: 95vw;
  }
  .modal-two-col {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 300px;
  backdrop-filter: blur(20px);
  font-size: 13px;
  font-weight: 500;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.success i { color: var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.error i { color: var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.warning i { color: var(--yellow); }
.toast.info { border-left: 3px solid var(--accent); }
.toast.info i { color: var(--accent-light); }

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

/* ============================================
   LEAFLET OVERRIDES
   ============================================ */
.leaflet-container {
  background: var(--bg-primary);
  font-family: 'Inter', sans-serif;
}

.vehicle-marker {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vehicle-marker-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.9);
  transition: all var(--transition);
}

.vehicle-marker-icon.online {
  background: var(--green);
  box-shadow: 0 0 16px var(--green-glow), 0 2px 8px rgba(0,0,0,0.3);
}

.vehicle-marker-icon.idle {
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2), 0 2px 8px rgba(0,0,0,0.3);
}

.vehicle-marker-icon.offline {
  background: #ef4444;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.vehicle-marker-icon.inactive {
  background: #06b6d4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.vehicle-marker-icon.expired {
  background: #f97316;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.vehicle-marker-icon.unknown {
  background: #555d72;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-family: 'Inter', sans-serif;
}

.leaflet-popup-tip {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
}

.leaflet-popup-content {
  margin: 14px 18px;
  font-size: 13px;
  line-height: 1.7;
}

.leaflet-popup-content strong {
  font-size: 15px;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.vehicle-popup {
  max-height: 400px;
  overflow-y: auto;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  gap: 12px;
  font-size: 12px;
  align-items: center;
}

.popup-row .label {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  min-width: 80px;
}

.popup-row span:last-child {
  font-weight: 500;
  text-align: right;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 52px;
  margin-bottom: 20px;
  opacity: 0.2;
}

.empty-state p {
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

  .dashboard-kpi-grid,
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
  .fleet-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .map-sidebar {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 200;
    transition: left var(--transition);
    width: 280px;
  }

  .sidebar.mobile-open {
    left: 0;
    box-shadow: var(--shadow-lg);
  }

  .mobile-only { display: flex; }

  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stats-grid-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 24px;
  }

  .page-container {
    padding: 18px;
  }

  .map-layout {
    flex-direction: column;
  }

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

  .filters-row {
    flex-direction: column;
  }

  .filters-row .form-group {
    min-width: 100%;
  }

  .modal {
    margin: 16px;
    border-radius: 16px;
  }

  .dashboard-map {
    height: 320px;
  }
}

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

  .topbar-left h2 {
    font-size: 15px;
  }

  .login-brand {
    display: none;
  }
  .login-form-side {
    width: 100%;
    min-width: 0;
    padding: 32px 24px;
  }
  .login-mobile-logo {
    display: block;
  }

  .dashboard-kpi-grid,
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
  .fleet-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   MAP STYLE SWITCHER
   ============================================ */
.map-style-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.map-style-toggle-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-card-solid);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.map-style-toggle-btn:hover,
.map-style-toggle-btn.active {
  color: var(--accent-light);
  background: var(--bg-card-solid);
  border-color: var(--accent);
}

.map-style-switcher {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.15s ease-out;
}

.map-style-switcher.hidden {
  display: none;
}

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

.map-style-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.map-style-btn i {
  width: 16px;
  text-align: center;
  font-size: 13px;
}

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

.map-style-btn.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  font-weight: 600;
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 15px;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-light);
}

/* ============================================
   LIGHT THEME
   ============================================ */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-solid: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.03);
  --bg-input: rgba(0, 0, 0, 0.03);
  --bg-glass: rgba(0, 0, 0, 0.02);
  --border: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --text-primary: #1a1d26;
  --text-secondary: #5f6577;
  --text-muted: #8b92a5;
  --accent: #0345bf;
  --accent-light: #2563eb;
  --accent-hover: #022e8a;
  --accent-glow: rgba(3, 69, 191, 0.1);
  --accent-glow-strong: rgba(3, 69, 191, 0.2);
  --green-bg: rgba(16, 185, 129, 0.08);
  --green-glow: rgba(16, 185, 129, 0.15);
  --yellow-bg: rgba(245, 158, 11, 0.08);
  --red-bg: rgba(239, 68, 68, 0.08);
  --blue-bg: rgba(59, 130, 246, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px rgba(3, 69, 191, 0.08);
}

[data-theme="light"] .login-form-side {
  background: #f8fafc;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .sidebar {
  background: #ffffff;
}

[data-theme="light"] .sidebar::after {
  background: linear-gradient(180deg, rgba(3, 69, 191, 0.08) 0%, transparent 30%, transparent 70%, rgba(3, 69, 191, 0.08) 100%);
}

[data-theme="light"] .nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 600;
}

[data-theme="light"] .nav-item.active i {
  color: var(--accent);
}

[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .leaflet-container {
  background: #f0f2f5;
}

[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #ffffff;
  color: #1a1d26;
}

[data-theme="light"] .leaflet-popup-tip {
  background: #ffffff;
}

[data-theme="light"] .toast {
  background: #ffffff;
}

[data-theme="light"] .modal {
  background: #ffffff;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.18);
}

/* ============================================
   PROTOCOL INLINE LIST WITH SEARCH
   ============================================ */
.protocol-list-inline {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  background: var(--bg-tertiary);
}

.protocol-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.protocol-item:hover {
  background: rgba(3, 69, 191, 0.08);
}

.protocol-item.selected {
  background: rgba(3, 69, 191, 0.15);
  border-left: 3px solid var(--accent);
}

.protocol-item.selected .protocol-name {
  color: var(--accent);
  font-weight: 600;
}

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

.protocol-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.protocol-port {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  background: rgba(3, 69, 191, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ============================================
   DEVICE ICON GRID
   ============================================ */
.device-icon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.modal-wide .device-icon-grid {
  grid-template-columns: repeat(4, 1fr);
}

.device-icon-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-tertiary);
}

.device-icon-option i {
  font-size: 20px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.device-icon-option span {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.1;
}

.device-icon-option:hover {
  border-color: var(--accent);
  background: rgba(3, 69, 191, 0.05);
}

.device-icon-option.selected {
  border-color: var(--accent);
  background: rgba(3, 69, 191, 0.12);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.device-icon-option.selected i {
  color: var(--accent);
}

.device-icon-option.selected span {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   HISTORY PAGE
   ============================================ */
.history-info {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.history-info-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.history-info-title i {
  color: var(--accent);
  margin-right: 6px;
}

.history-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.history-stat {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.history-stat-value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.history-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.history-marker-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.history-marker-icon.start {
  background: #22c55e;
}

.history-marker-icon.end {
  background: #ef4444;
}

.speed-legend {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.speed-legend-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.speed-legend-items {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
}
.speed-legend-items i {
  font-size: 10px;
  margin-right: 2px;
}

.stop-marker-icon {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
}

/* PLAYBACK */
.history-playback {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.playback-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.playback-header i {
  color: var(--accent);
  margin-right: 6px;
}

.playback-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.playback-controls .btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s;
}

.playback-controls .btn-icon:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.playback-play-btn {
  width: 42px !important;
  height: 42px !important;
  font-size: 16px !important;
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.playback-slider {
  width: 100%;
  margin-bottom: 10px;
  accent-color: var(--accent);
}

.playback-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.playback-speed-btns {
  display: flex;
  gap: 4px;
}

.playback-status {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playback-status i {
  width: 16px;
  color: var(--accent);
  margin-right: 4px;
}

.playback-marker-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 0 12px rgba(3, 69, 191, 0.5);
  border: 3px solid #fff;
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.settings-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.settings-info-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.settings-info-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.settings-info-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.settings-info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================
   NOTIFICATION PANEL
   ============================================ */
.notification-bell {
  position: relative;
}

.notification-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notification-panel-header h4 {
  font-size: 14px;
  font-weight: 600;
}

.notification-panel-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-panel-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.notification-panel-item:hover {
  background: rgba(3, 69, 191, 0.05);
}

.notification-panel-item.alert {
  border-left: 3px solid #ef4444;
}

.notification-panel-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}

.notification-panel-icon.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.notification-panel-icon.info {
  background: rgba(3, 69, 191, 0.12);
  color: var(--accent);
}

.notification-panel-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.notification-panel-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.notification-panel-empty {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

.notification-panel-empty i {
  font-size: 28px;
  margin-bottom: 8px;
}

@media (max-width: 500px) {
  .notification-panel {
    width: 290px;
    right: -40px;
  }
}

