:root {
  --ap-primary: #0d6efd;
  --ap-accent: #ffc107;
  --sidebar-width: 260px;
  --sidebar-bg: #0b1f3a;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(13, 110, 253, 0.35);
}
body { background: #f4f6f9; min-height: 100vh; }
.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-card { border-left: 4px solid var(--ap-primary); }
.stat-card.warning { border-left-color: var(--ap-accent); }
.stat-card.success { border-left-color: #198754; }
.stat-card.danger { border-left-color: #dc3545; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #6c757d; }
.hero-rastreo { background: linear-gradient(135deg, #0d6efd 0%, #052c65 100%); color: #fff; border-radius: 1rem; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #052c65, #0d6efd); }
.login-card { max-width: 400px; width: 100%; }
.bus-foto-preview { min-height: 140px; }

/* Layout admin con sidebar vertical */
.admin-layout { overflow-x: hidden; }
.admin-wrapper { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #e8eef7;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.25s ease;
}
.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sidebar-brand i { font-size: 1.5rem; color: var(--ap-primary); }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
}
.sidebar-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  padding: 1rem 0.75rem 0.35rem;
  margin-top: 0.25rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 2px;
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.925rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link i { font-size: 1.15rem; width: 1.35rem; text-align: center; opacity: 0.9; }
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--ap-primary);
  padding-left: calc(0.75rem - 3px);
}
.sidebar-footer {
  padding: 0.75rem 0.5rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}
.sidebar-user > i { font-size: 1.75rem; opacity: 0.85; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 0.7rem; color: rgba(255, 255, 255, 0.5); text-transform: capitalize; }
.sidebar-link-logout { color: rgba(255, 255, 255, 0.65); font-size: 0.85rem; }
.sidebar-link-logout:hover { color: #f8a5a5; background: rgba(220, 53, 69, 0.15); }

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.sidebar-toggle {
  color: var(--sidebar-bg);
  padding: 0.25rem 0.5rem;
  text-decoration: none;
}
.sidebar-toggle:hover { color: var(--ap-primary); }
.admin-content { flex: 1; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1035;
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .admin-main { margin-left: 0; }
  .admin-topbar { display: flex; }
}

@media print {
  .sidebar, .admin-topbar, .sidebar-backdrop { display: none !important; }
  .admin-main { margin-left: 0 !important; }
  .admin-content { padding: 0 !important; }
  body * { visibility: hidden; }
  #modalQr, #modalQr * { visibility: visible; }
  #modalQr { position: fixed; left: 0; top: 0; width: 100%; }
}
