/* ================================================================
   AutoControl Elite — Design System v3.0
   Premium SaaS Fleet Management Platform
   Modern, accessible, responsive design
   ================================================================ */

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

/* ════════════════════════════════════════════
   CSS VARIABLES & THEMES
   ════════════════════════════════════════════ */
:root {
  /* Primary Colors - Neon Blue Palette */
  --primary-50: #e0f7ff;
  --primary-100: #baf0ff;
  --primary-200: #7fe6ff;
  --primary-300: #38d6ff;
  --primary-400: #00c8ff;
  --primary-500: #00b4f0;
  --primary-600: #0090cc;
  --primary-700: #006fa3;
  --primary-800: #005280;
  --primary-900: #003a5e;
  --primary: var(--primary-500);
  --primary-dark: var(--primary-600);
  --primary-light: var(--primary-400);
  --primary-rgb: 0, 180, 240;

  /* Secondary - Cyan/Electric Blue */
  --secondary-500: #06b6d4;
  --secondary-rgb: 6, 182, 212;

  /* Accent - Pink */
  --accent-500: #ec4899;
  --accent-rgb: 236, 72, 153;

  /* Semantic Colors */
  --success-500: #10b981;
  --success-rgb: 16, 185, 129;
  --warning-500: #f59e0b;
  --warning-rgb: 245, 158, 11;
  --danger-500: #ef4444;
  --danger-rgb: 239, 68, 68;
  --info-500: #3b82f6;
  --info-rgb: 59, 130, 246;

  /* Dark Theme (Default) */
  --bg-base: #0f172a;
  --bg-elevated: #1e293b;
  --bg-sidebar: #0b1120;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-hover: rgba(255, 255, 255, 0.08);
  --bg-input-focus: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(var(--primary-rgb), 0.5);
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-disabled: #475569;
  --glass: rgba(15, 23, 42, 0.6);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 40px rgba(var(--primary-rgb), 0.15);
  --shadow-glow-lg: 0 0 60px rgba(var(--primary-rgb), 0.25);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 72px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 22px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
.light-mode {
  --bg-base: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --bg-input-hover: #e2e8f0;
  --bg-input-focus: #ffffff;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: var(--primary-500);
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-disabled: #94a3b8;
  --glass: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 30px rgba(var(--primary-rgb), 0.08);
  --shadow-glow-lg: 0 0 50px rgba(var(--primary-rgb), 0.12);
}

/* ════════════════════════════════════════════
   RESET & BASE STYLES
   ════════════════════════════════════════════ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
  line-height: 1.5;
}

/* Selection */
::selection {
  background: rgba(var(--primary-rgb), 0.3);
  color: var(--text-main);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(var(--primary-rgb), 0.3);
  border-radius: 99px;
  transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--primary-rgb), 0.5);
}

/* Focus visible */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════════════════
   ICONS
   ════════════════════════════════════════════ */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  transition: width var(--transition-slow), background var(--transition-slow), border-color var(--transition-slow);
  overflow: hidden;
}

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

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

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
}

.brand-logo {
  height: 70px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.brand:hover .brand-logo {
  transform: scale(1.03);
  opacity: 0.92;
}

/* Mostrar logo correcto según tema */
html.dark  .brand-logo-light { display: none; }
html.dark  .brand-logo-dark  { display: block; }
html:not(.dark) .brand-logo-dark  { display: none; }
html:not(.dark) .brand-logo-light { display: block; }

/* Texto "FlotillaApp" solo visible cuando sidebar está colapsado */
.brand-text-collapsed {
  display: none;
}
.sidebar.collapsed .brand-logo {
  display: none !important;
}
.sidebar.collapsed .brand-text-collapsed {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Compat: ocultar brand-icon/brand-text si existen (legacy) */
.brand-icon { display: none; }
.brand-text:not(.brand-text-collapsed) { display: none; }

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar.collapsed .brand-text {
  display: none;
}

.brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--primary-light), var(--secondary-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.sidebar-collapse {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

.sidebar-collapse:hover {
  background: var(--bg-input);
  color: var(--text-main);
  border-color: var(--border-hover);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  transition: opacity var(--transition-base);
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  height: 0;
  margin: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.2), rgba(var(--primary-rgb), 0.06));
  color: var(--primary-light);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.7rem;
}

.sidebar.collapsed .nav-item span:not(.nav-badge) {
  display: none;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  line-height: 1;
  transition: opacity var(--transition-base);
}

.nav-badge-warning {
  background: var(--warning-500);
}

.sidebar.collapsed .nav-badge {
  opacity: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-toggle {
  cursor: pointer;
}

.toggle-pill {
  margin-left: auto;
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--transition-base);
  flex-shrink: 0;
}

.toggle-pill::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-base);
}

.light-mode .toggle-pill {
  background: var(--primary);
  border-color: var(--primary);
}

.light-mode .toggle-pill::after {
  left: 18px;
  background: #fff;
}

.theme-icon-sun {
  display: none;
}

.light-mode .theme-icon-moon {
  display: none;
}

.light-mode .theme-icon-sun {
  display: inline-flex;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
}

.user-profile:hover {
  border-color: var(--border-hover);
}

.sidebar.collapsed .user-profile {
  justify-content: center;
  padding: 0.6rem;
}

.sidebar.collapsed .user-info {
  display: none;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ════════════════════════════════════════════
   MOBILE MENU TOGGLE
   ════════════════════════════════════════════ */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-main);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

.mobile-menu-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ════════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════════ */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  height: var(--topbar-height);
  flex-shrink: 0;
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.topbar-left {
  flex: 1;
  min-width: 0;
}

.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-center {
  flex: 2;
  max-width: 480px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  transition: all var(--transition-base);
  height: 42px;
}

.topbar-search:focus-within {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-search input {
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  flex: 1;
}

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

.topbar-search kbd {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.icon-btn:active {
  transform: scale(0.95);
}

.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--danger-500);
  border: 2px solid var(--bg-sidebar);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(var(--danger-rgb), 0.4);
}

/* Page content */
.page-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  animation: fadeInPage 0.3s ease;
}

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

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

/* ════════════════════════════════════════════
   NOTIFICATIONS PANEL
   ════════════════════════════════════════════ */
.notifications-panel {
  position: fixed;
  top: var(--topbar-height);
  right: -380px;
  width: 380px;
  max-height: calc(100vh - var(--topbar-height));
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transition: right var(--transition-slow);
  overflow: hidden;
}

.notifications-panel.open {
  right: 0;
}

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

.notifications-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.notifications-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-base);
}

.notification-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-input-hover);
}

.notification-item.unread {
  border-left: 3px solid var(--primary);
}

.notification-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

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

.notification-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.notification-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.notification-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.45);
}

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

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
  background: var(--bg-input);
}

.btn-danger {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger-500);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
}

.btn-danger:hover {
  background: rgba(var(--danger-rgb), 0.2);
  border-color: rgba(var(--danger-rgb), 0.3);
}

.btn-success {
  background: rgba(var(--success-rgb), 0.1);
  color: var(--success-500);
  border: 1px solid rgba(var(--success-rgb), 0.2);
}

.btn-success:hover {
  background: rgba(var(--success-rgb), 0.2);
  border-color: rgba(var(--success-rgb), 0.3);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ════════════════════════════════════════════
   KPI GRID / STATS CARDS
   ════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary-500));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.kpi-card:hover {
  border-color: rgba(var(--primary-rgb), 0.3);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

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

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-light);
}

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.kpi-trend-up {
  color: var(--success-500);
  background: rgba(var(--success-rgb), 0.1);
}

.kpi-trend-down {
  color: var(--danger-500);
  background: rgba(var(--danger-rgb), 0.1);
}

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

.kpi-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.kpi-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ════════════════════════════════════════════
   CARDS & PANELS
   ════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-hover);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ════════════════════════════════════════════
   FLEET / VEHICLE CARDS
   ════════════════════════════════════════════ */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.fleet-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.fleet-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(var(--primary-rgb), 0.04), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.fleet-card:hover {
  border-color: rgba(var(--primary-rgb), 0.35);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

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

.fleet-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.fleet-card-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.fleet-card-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Delete button on fleet cards */
.delete-auto-btn {
  pointer-events: auto !important;
  cursor: pointer;
  z-index: 10;
}

.delete-auto-btn:hover {
  transform: scale(1.1);
}

/* Progress bar */
.progress-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-track {
  height: 6px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--primary), var(--secondary-500));
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-green {
  background: rgba(var(--success-rgb), 0.12);
  color: var(--success-500);
}

.badge-yellow {
  background: rgba(var(--warning-rgb), 0.12);
  color: var(--warning-500);
}

.badge-red {
  background: rgba(var(--danger-rgb), 0.12);
  color: var(--danger-500);
}

.badge-blue {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary-light);
}

.badge-gray {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
}

/* ════════════════════════════════════════════
   TABLE
   ════════════════════════════════════════════ */
.table-wrap {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.table-overflow {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  background: rgba(0, 0, 0, 0.04);
}

.light-mode thead {
  background: var(--bg-input);
}

th {
  text-align: left;
  padding: 1rem 1.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background var(--transition-base);
}

tbody tr:hover {
  background: rgba(var(--primary-rgb), 0.03);
}

/* ════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

.form-grid.full {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span,
.field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-base);
  width: 100%;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--border-hover);
  background: var(--bg-input-hover);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.field select option {
  background: var(--bg-elevated);
  color: var(--text-main);
}

/* ── Select genérico fuera de .field (filtros, topbar, etc.) ── */
.app-select {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base);
}
.app-select:hover  { border-color: var(--border-hover); background: var(--bg-input-hover); }
.app-select:focus  { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15); }

/* ── Dark mode: fuerza color-scheme para que el OS renderice el dropdown oscuro ── */
.dark select,
.dark .app-select {
  color-scheme: dark;
}

.dark select option,
.dark .field select option {
  background-color: #1e293b;
  color: #f8fafc;
}

.dark select option:hover,
.dark select option:checked,
.dark .field select option:checked {
  background-color: #334155;
  color: #f8fafc;
}

/* Modo claro */
:root:not(.dark) select option,
:root:not(.dark) .field select option {
  background-color: #ffffff;
  color: #0f172a;
}

:root:not(.dark) select {
  color-scheme: light;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  grid-column: 1 / -1;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

/* ════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  width: 100%;
  animation: slideUp 0.25s ease;
  box-shadow: var(--shadow-xl);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

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

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

.modal-header h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════
   SEARCH MODAL
   ════════════════════════════════════════════ */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 2rem;
}

.search-modal.open {
  display: flex;
  animation: fadeIn 0.15s ease;
}

.search-modal-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: slideUp 0.2s ease;
  box-shadow: var(--shadow-xl);
}

.search-modal-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.search-modal-input svg {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.search-modal-input input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

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

.search-modal-input kbd {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.search-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.search-result-item:hover {
  background: var(--bg-input);
}

.search-result-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.search-result-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.search-result-info p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  animation: toastIn 0.3s ease;
  max-width: 380px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

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

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

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

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

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

.toast.toast-error .toast-icon {
  color: var(--danger-500);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning-500);
}

.toast.toast-warning .toast-icon {
  color: var(--warning-500);
}

.toast.toast-info {
  border-left: 3px solid var(--primary);
}

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

/* ════════════════════════════════════════════
   ACTIVITY / LOG ITEMS
   ════════════════════════════════════════════ */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-base);
}

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

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-light);
}

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

.activity-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

activity-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ════════════════════════════════════════════
   ALERT ITEMS
   ════════════════════════════════════════════ */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  border: 1px solid var(--border);
  transition: all var(--transition-base);
}

.alert-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-input-hover);
}

.alert-item.alert-danger {
  border-left: 3px solid var(--danger-500);
}

.alert-item.alert-warning {
  border-left: 3px solid var(--warning-500);
}

.alert-item.alert-success {
  border-left: 3px solid var(--success-500);
}

.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

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

.alert-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

alert-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ════════════════════════════════════════════
   CHARTS & GRAPHS PLACEHOLDER
   ════════════════════════════════════════════ */
.chart-container {
  width: 100%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding: 1rem 0;
}

.bar {
  flex: 1;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition-base);
  position: relative;
  min-width: 30px;
}

.bar:hover {
  opacity: 0.8;
}

.bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

/* ════════════════════════════════════════════
   DOC ITEMS (inside modals)
   ════════════════════════════════════════════ */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-input);
  transition: all var(--transition-base);
}

.doc-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-input-hover);
}

.doc-item.loaded {
  border-color: rgba(var(--success-rgb), 0.35);
  background: rgba(var(--success-rgb), 0.05);
}

.doc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-light);
}

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

.doc-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.doc-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
  font-size: 0.9rem;
}

/* ════════════════════════════════════════════
   TAGS / CHIPS
   ════════════════════════════════════════════ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ════════════════════════════════════════════
   LAYOUT UTILITIES
   ════════════════════════════════════════════ */
.two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

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

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.gap-3 {
  gap: 1.5rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mt-4 {
  margin-top: 2rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

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

.text-sm {
  font-size: 0.8rem;
}

.text-xs {
  font-size: 0.72rem;
}

.font-bold {
  font-weight: 700;
}

.w-full {
  width: 100%;
}

/* ════════════════════════════════════════════
   RESPONSIVE DESIGN
   ════════════════════════════════════════════ */
@media (max-width: 1024px) {

  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 1rem 1.5rem;
  }

  .page-content {
    padding: 1.5rem;
  }

  .topbar-center {
    display: none;
  }
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    top: 0;
    height: 100vh;
    z-index: 150;
    transition: left var(--transition-slow);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .sidebar.mobile-open~.main-wrap::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  .topbar {
    padding-left: 4rem;
  }

  .topbar-left {
    max-width: calc(100% - 120px);
  }

  .page-title {
    font-size: 1.25rem;
  }

  .page-subtitle {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
  }

  .grid-cards {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .notifications-panel {
    width: 100%;
    right: -100%;
  }

  .modal-overlay {
    padding: 1rem;
  }

  .modal-box {
    max-height: 95vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .page-content {
    padding: 1rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }

  .card {
    padding: 1.25rem;
  }
}

/* Responsive Pro Patch */
@media (max-width: 1200px) {
  .page-content {
    padding: 1.5rem;
  }

  .topbar-center {
    max-width: 380px;
  }

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

@media (max-width: 992px) {
  .topbar {
    padding: 0.85rem 1rem;
    min-height: 64px;
    height: auto;
    gap: 0.8rem;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .page-content {
    padding: 1rem;
  }

  .topbar-right .icon-btn {
    width: 38px;
    height: 38px;
  }

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

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

  .form-grid .span2 {
    grid-column: 1 / -1;
  }

  .table-overflow {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 860px;
  }

  .modal-box {
    width: min(960px, 96vw);
  }
}

@media (max-width: 768px) {
  .main-wrap {
    min-width: 0;
  }

  .main-wrap::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.56);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
    z-index: 120;
  }

  .sidebar.mobile-open~.main-wrap::before {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    padding: 0.75rem 0.85rem 0.75rem 3.3rem;
    gap: 0.6rem;
  }

  .topbar-left {
    max-width: none;
  }

  .topbar-right {
    gap: 0.35rem;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .two-col,
  .three-col,
  .grid-cards,
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  .notifications-panel {
    top: 0;
    max-height: 100vh;
    z-index: 180;
  }

  .search-modal-content {
    width: min(96vw, 640px);
  }

  .search-modal-input kbd {
    display: none;
  }

  .modal-overlay {
    padding: 0.65rem;
  }

  .modal-box {
    width: 100%;
    max-height: 92vh;
    border-radius: 14px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    flex: 1 1 140px;
  }
}

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

  .page-title {
    font-size: 1.05rem;
  }

  .page-subtitle {
    display: none;
  }

  .topbar-right .icon-btn {
    width: 34px;
    height: 34px;
  }

  .card,
  .kpi-card,
  .fleet-card {
    padding: 1rem;
  }
}

/* ════════════════════════════════════════════
   PRINT STYLES
   ════════════════════════════════════════════ */
@media print {

  .sidebar,
  .topbar,
  .mobile-menu-toggle,
  .notifications-panel,
  .toast-container,
  .search-modal,
  .modal-overlay {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .main-wrap {
    margin: 0;
    padding: 0;
  }

  .page-content {
    padding: 0;
  }

  .card,
  .kpi-card,
  .fleet-card,
  .table-wrap {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* ════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════ */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
