/* ═══════════════════════════════════════════════════════════════
   DelivPro Dashboard – Crextio-Inspired Design
   Light cream background · Yellow accent · Dark activity panel
═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. Design Tokens
───────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --c-bg: #f0ede6;
  --c-surface: #ffffff;
  --c-surface-2: #f7f5f0;
  --c-surface-3: #ede9e1;
  --c-dark-panel: #1c1c1e;
  --c-dark-surface: #2a2a2d;
  --c-dark-border: rgba(255, 255, 255, 0.08);

  /* Accent – Yellow/Gold */
  --c-accent: #f5c842;
  --c-accent-dk: #d4a820;
  --c-accent-lt: #fde68a;
  --c-accent-bg: rgba(245, 200, 66, 0.15);

  /* Status Colors */
  --c-success: #22c55e;
  --c-warning: #f97316;
  --c-danger: #ef4444;
  --c-info: #3b82f6;

  /* Text */
  --c-text: #111111;
  --c-text-2: #444444;
  --c-text-muted: #888888;
  --c-text-dim: #aaaaaa;
  --c-text-dark: #f0ede6;
  --c-text-dark-2: #aaaaaa;

  /* Borders */
  --c-border: rgba(0, 0, 0, 0.07);
  --c-border-md: rgba(0, 0, 0, 0.12);

  /* Layout */
  --sidebar-w: 220px;
  --topnav-h: 60px;

  /* Spacing */
  --sp-xs: 0.375rem;
  --sp-sm: 0.75rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2rem;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.07);

  /* Font */
  --font: 'Inter', system-ui, sans-serif;
  --ease: 0.2s ease;
  --ease-out: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────
   2. Reset & Base
───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
}

/* ─────────────────────────────────────────────
   3. Layout Shell
───────────────────────────────────────────── */

/* Left Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--ease-out);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 0 var(--sp-lg);
  height: var(--topnav-h);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--c-accent);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--c-text);
}

.sidebar-close {
  margin-left: auto;
  color: var(--c-text-muted);
  font-size: 1rem;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-md) var(--sp-sm);
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--c-surface-3);
  border-radius: 3px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-divider {
  height: 1px;
  background: var(--c-border);
  margin: var(--sp-sm);
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  color: var(--c-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--ease);
}

.nav-link-item:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

.nav-item.active .nav-link-item {
  background: var(--c-text);
  color: var(--c-accent);
}

.nav-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  background: var(--c-accent);
  color: var(--c-text);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--sp-md);
  border-top: 1px solid var(--c-border);
}

.user-mini-card {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  cursor: pointer;
  transition: background var(--ease);
}

.user-mini-card:hover {
  background: var(--c-surface-3);
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--c-accent);
  flex-shrink: 0;
}

.user-name-sm {
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0;
}

.user-role-sm {
  font-size: 0.68rem;
  color: var(--c-text-muted);
  margin: 0;
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

/* Main Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--ease-out), padding var(--ease-out);
}

/* ─────────────────────────────────────────────
   4. Topnav
───────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  height: var(--topnav-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-xl);
  z-index: 100;
  gap: var(--sp-md);
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex: 1;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: #ffffff;
  color: var(--c-text);
  font-size: 1.3rem;
  display: none; /* Hidden on desktop by default */
  align-items: center;
  justify-content: center;
  transition: all var(--ease-out);
  flex-shrink: 0;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.menu-toggle:hover {
  background: var(--c-dark-panel);
  color: white;
  transform: scale(1.05);
}

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 0 16px;
  gap: 8px;
  flex: 1;
  max-width: 340px;
  transition: all var(--ease);
}

.search-box:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.15);
}

.search-icon {
  color: var(--c-text-muted);
  font-size: 0.82rem;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.84rem;
  padding: 8px 0;
}

.search-input::placeholder {
  color: var(--c-text-dim);
}

.search-kbd {
  background: var(--c-surface-3);
  color: var(--c-text-muted);
  font-size: 0.63rem;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: monospace;
  border: 1px solid var(--c-border-md);
}

/* Nav Buttons */
.nav-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
  position: relative;
}

.nav-action-btn:hover {
  background: var(--c-accent);
  color: var(--c-text);
  border-color: var(--c-accent);
}

.notif-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--c-danger);
  border: 2px solid var(--c-surface);
}

/* Profile */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 18px 5px 6px;
  border-radius: var(--r-full);
  background: #ffffff;
  border: 1px solid var(--c-border);
  transition: all var(--ease-out);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.profile-btn:hover {
  border-color: var(--c-text);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--r-full);
  background: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--c-accent);
}

.profile-name {
  font-size: 0.78rem;
  font-weight: 600;
  display: block;
  line-height: 1.2;
}

.profile-role {
  font-size: 0.65rem;
  color: var(--c-text-muted);
  display: block;
}

/* Dropdowns */
.profile-dropdown {
  background: #ffffff !important;
  border: 1px solid var(--c-border-md) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-premium) !important;
  padding: 10px !important;
  min-width: 220px;
  margin-top: 10px !important;
}

.profile-dropdown .dropdown-item {
  border-radius: var(--r-md);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c-text-muted) !important;
  padding: 10px 16px;
  transition: all var(--ease);
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-dropdown .dropdown-item:hover {
  background: var(--c-bg) !important;
  color: var(--c-text) !important;
  transform: translateX(4px);
}

.profile-dropdown .dropdown-item.text-danger {
  color: var(--c-danger) !important;
}

.profile-dropdown .dropdown-divider {
  border-color: var(--c-border) !important;
}

/* ─────────────────────────────────────────────
   5. Page Content & Section Headers
───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--sp-xl);
}

.dash-section {
  animation: fadeUp 0.35s ease;
}

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

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-xl);
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}

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

.section-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   6. KPI Cards (light, clean)
───────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
}

.kpi-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
  box-shadow: var(--shadow-card);
  transition: all var(--ease-out);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--c-accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--ease-out);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card:hover::after {
  transform: scaleX(1);
}

.kpi-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* KPI icon colors */
.kpi-blue {
  background: #eff6ff;
  color: #3b82f6;
}

.kpi-green {
  background: #f0fdf4;
  color: #22c55e;
}

.kpi-amber {
  background: #fffbeb;
  color: #f59e0b;
}

.kpi-purple {
  background: #faf5ff;
  color: #a855f7;
}

.kpi-body {
  flex: 1;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--c-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--c-text);
}

.kpi-trend {
  font-size: 0.74rem;
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
}

.kpi-trend.positive {
  color: var(--c-success);
}

.kpi-trend.negative {
  color: var(--c-danger);
}

/* ─────────────────────────────────────────────
   7. Dash Cards (white panels)
───────────────────────────────────────────── */
.dash-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--ease);
}

.dash-card:hover {
  box-shadow: var(--shadow-md);
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.dash-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-text);
  margin: 0;
}

.view-all-link {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  font-weight: 500;
  transition: color var(--ease);
}

.view-all-link:hover {
  color: var(--c-text);
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--c-success);
  font-weight: 600;
  background: rgba(34, 197, 94, 0.1);
  padding: 3px 9px;
  border-radius: var(--r-full);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--c-success);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {

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

  50% {
    opacity: 0.4;
    transform: scale(0.65);
  }
}

/* ─────────────────────────────────────────────
   8. Dark Activity Panel
───────────────────────────────────────────── */
.dark-panel {
  background: var(--c-dark-panel);
  border: 1px solid var(--c-dark-border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-lg);
}

.dark-panel .dash-card-title {
  color: var(--c-text-dark);
}

/* Activity Feed (dark) */
.activity-feed {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.activity-feed::-webkit-scrollbar {
  width: 3px;
}

.activity-feed::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.activity-item {
  display: flex;
  gap: var(--sp-sm);
  padding: 10px 0;
  border-bottom: 1px solid var(--c-dark-border);
  animation: slideIn 0.3s ease;
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }

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

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  margin-top: 5px;
}

.activity-content {
  flex: 1;
}

.activity-msg {
  font-size: 0.8rem;
  color: var(--c-text-dark);
  line-height: 1.4;
}

.activity-time {
  font-size: 0.68rem;
  color: var(--c-text-dark-2);
  margin-top: 2px;
}

/* ─────────────────────────────────────────────
   9. Data Tables
───────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--c-text-muted);
  white-space: nowrap;
  background: transparent;
  border-bottom: 2px solid var(--c-surface-2);
}

.data-table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  color: var(--c-text);
  transition: all var(--ease);
}

.data-table tbody tr {
  transition: all var(--ease);
}

.data-table tbody tr:hover td {
  background: var(--c-surface-2);
}

.data-table tbody tr:hover td:first-child {
  border-top-left-radius: var(--r-md);
  border-bottom-left-radius: var(--r-md);
}

.data-table tbody tr:hover td:last-child {
  border-top-right-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─────────────────────────────────────────────
   10. Filters & Search
───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-top: var(--sp-lg);
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  background: var(--c-surface-2);
  padding: 4px;
  border-radius: var(--r-full);
  gap: 2px;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: var(--r-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-text-muted);
  transition: all var(--ease);
  border: none;
  background: transparent;
}

.filter-tab:hover {
  color: var(--c-text);
}

.filter-tab.active {
  background: var(--c-surface);
  color: var(--c-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-input-sm {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 8px 16px;
  font-size: 0.82rem;
  width: 280px;
  transition: all var(--ease);
  outline: none;
}

.search-input-sm:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.12);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-delivered {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.badge-pending {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-cancelled {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-online {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.badge-offline {
  background: #f9fafb;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

/* Agent cell */
.agent-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.agent-name-text {
  font-weight: 600;
  font-size: 0.84rem;
}

.agent-meta-text {
  font-size: 0.7rem;
  color: var(--c-text-muted);
}

/* Performance bar */
.perf-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}

.perf-bar {
  flex: 1;
  height: 5px;
  background: var(--c-surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}

.perf-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.perf-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-text-muted);
  min-width: 30px;
}

/* Stars */
.star-rating {
  color: var(--c-accent);
  font-size: 0.75rem;
}

/* Table actions */
.tbl-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
  margin-right: 3px;
}

.tbl-action-btn:hover {
  background: var(--c-text);
  color: var(--c-accent);
  border-color: var(--c-text);
}

.tbl-action-btn.danger:hover {
  background: var(--c-danger);
  color: white;
  border-color: var(--c-danger);
}

/* Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--c-border);
  margin-top: var(--sp-sm);
}

.page-btn {
  min-width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  transition: all var(--ease);
}

.page-btn:hover,
.page-btn.active {
  background: var(--c-text);
  color: var(--c-accent);
  border-color: var(--c-text);
}

/* ─────────────────────────────────────────────
   10. Filters & Search
───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-md);
}

.filter-tabs {
  display: flex;
  gap: 3px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 4px;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--c-text-muted);
  transition: all var(--ease);
}

.filter-tab:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

.filter-tab.active {
  background: var(--c-text);
  color: var(--c-accent);
}

.search-input-sm {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 7px 16px;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.84rem;
  outline: none;
  transition: all var(--ease);
  min-width: 200px;
}

.search-input-sm:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.15);
}

.search-input-sm::placeholder {
  color: var(--c-text-dim);
}

.filter-select {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 7px 16px;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.84rem;
  outline: none;
  cursor: pointer;
  transition: all var(--ease);
}

.filter-select:focus {
  border-color: var(--c-accent);
}

/* ─────────────────────────────────────────────
   11. Buttons
───────────────────────────────────────────── */
.btn-primary-action {
  display: inline-flex;
  align-items: center;
  background: var(--c-text);
  color: var(--c-accent);
  border: none;
  border-radius: var(--r-full);
  padding: 9px 20px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ease-out);
}

.btn-primary-action:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 9px 20px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
}

.btn-secondary-action:hover {
  background: var(--c-surface-2);
  border-color: var(--c-accent);
}

.btn-cancel {
  display: inline-flex;
  align-items: center;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 9px 20px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ease);
}

.btn-cancel:hover {
  color: var(--c-text);
  background: var(--c-surface-3);
}

/* ─────────────────────────────────────────────
   12. Charts
───────────────────────────────────────────── */
.chart-wrap-sm {
  position: relative;
  height: 200px;
}

.chart-wrap-md {
  position: relative;
  height: 270px;
}

.chart-wrap-lg {
  position: relative;
  height: 300px;
}

/* ─────────────────────────────────────────────
   13. Agent mini stat cards
───────────────────────────────────────────── */
.agent-stat-mini {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  box-shadow: var(--shadow-card);
}

.agent-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.agent-stat-label {
  font-size: 0.7rem;
  color: var(--c-text-muted);
  font-weight: 500;
}

.agent-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--c-text);
}

/* ─────────────────────────────────────────────
   14. Settings
───────────────────────────────────────────── */
.settings-group-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--c-border);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

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

.settings-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

.settings-input {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--ease);
}

.settings-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.15);
}

.settings-toggles {
  display: flex;
  flex-direction: column;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--c-border);
  gap: var(--sp-md);
}

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

.toggle-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.toggle-desc {
  font-size: 0.73rem;
  color: var(--c-text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--c-surface-3);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--c-border-md);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: var(--r-full);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--c-accent);
  border-color: var(--c-accent);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(18px);
  background: white;
}

.theme-selector {
  display: flex;
  background: var(--c-surface-2);
  padding: 5px;
  border-radius: var(--r-md);
  gap: 5px;
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: var(--c-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--ease);
}

.theme-btn:hover {
  color: var(--c-text);
}

.theme-btn.active {
  background: var(--c-surface);
  color: var(--c-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.system-info-list {
  display: flex;
  flex-direction: column;
}

.system-info-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.84rem;
}

.system-info-list li:last-child {
  border-bottom: none;
}

.system-info-list li span {
  color: var(--c-text-muted);
}

/* ─────────────────────────────────────────────
   15. Notifications Dropdown
───────────────────────────────────────────── */
.notif-dropdown {
  width: 330px;
  background: var(--c-surface) !important;
  border: 1px solid var(--c-border-md) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
  font-weight: 700;
}

.btn-link-sm {
  font-size: 0.72rem;
  color: var(--c-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  transition: color var(--ease);
}

.btn-link-sm:hover {
  color: var(--c-text);
}

.notif-list {
  max-height: 270px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--c-border);
  transition: background var(--ease);
}

.notif-item:hover {
  background: var(--c-surface-2);
}

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

.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.notif-text {
  font-size: 0.78rem;
  color: var(--c-text);
  line-height: 1.4;
}

.notif-time {
  font-size: 0.67rem;
  color: var(--c-text-muted);
  margin-top: 2px;
}

.notif-footer {
  padding: var(--sp-sm) var(--sp-lg);
  text-align: center;
  font-size: 0.76rem;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: color var(--ease);
  background: var(--c-surface-2);
}

.notif-footer:hover {
  color: var(--c-text);
}

/* ─────────────────────────────────────────────
   16. Modals
───────────────────────────────────────────── */
.custom-modal {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-border-md) !important;
  border-radius: var(--r-xl) !important;
}

.custom-modal-header {
  background: var(--c-surface-2) !important;
  border-bottom: 1px solid var(--c-border) !important;
  border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
  padding: var(--sp-lg) !important;
  font-weight: 700;
  color: var(--c-text) !important;
}

.custom-modal-body {
  padding: var(--sp-lg) !important;
}

.custom-modal-footer {
  background: var(--c-surface-2) !important;
  border-top: 1px solid var(--c-border) !important;
  border-radius: 0 0 var(--r-xl) var(--r-xl) !important;
  padding: var(--sp-md) var(--sp-lg) !important;
  display: flex;
  gap: var(--sp-sm);
  justify-content: flex-end;
}

.form-label-custom {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-text-muted);
  display: block;
  margin-bottom: 6px;
}

.form-input-custom {
  width: 100%;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--ease);
}

.form-input-custom:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(245, 200, 66, 0.15);
}

.form-input-custom::placeholder {
  color: var(--c-text-dim);
}

/* ─────────────────────────────────────────────
   17. Toast
───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  background: var(--c-surface);
  border: 1px solid var(--c-border-md);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-lg);
  box-shadow: var(--shadow-lg);
  min-width: 270px;
  max-width: 340px;
  animation: toastIn 0.32s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.toast-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast-success::before {
  background: var(--c-success);
}

.toast-error::before {
  background: var(--c-danger);
}

.toast-info::before {
  background: var(--c-info);
}

.toast-warning::before {
  background: var(--c-warning);
}

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

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

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

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

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

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

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

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--c-text);
}

.toast-msg {
  font-size: 0.76rem;
  color: var(--c-text-muted);
}

.toast-close {
  color: var(--c-text-muted);
  font-size: 0.82rem;
  margin-top: 1px;
  flex-shrink: 0;
  transition: color var(--ease);
}

.toast-close:hover {
  color: var(--c-text);
}

/* ─────────────────────────────────────────────
   18. Responsive
───────────────────────────────────────────── */
@media (max-width: 1199.98px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 991.98px) {
  .menu-toggle {
    display: flex; /* Show only on mobile/tablet */
  }

  .sidebar {
    transform: translateX(-100%) !important;
    box-shadow: none;
  }

  .sidebar.is-open {
    transform: translateX(0) !important;
    box-shadow: var(--shadow-lg);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }
}

@media (max-width: 767.98px) {
  .page-content {
    padding: var(--sp-lg);
  }

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

  .search-box {
    display: none;
  }
}

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

  .page-content {
    padding: var(--sp-md);
  }

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

  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-input-sm {
    min-width: 100%;
  }

  .section-header {
    flex-direction: column;
  }
}

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

.spin {
  animation: spin 0.6s linear;
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--c-surface-3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* ─────────────────────────────────────────────
   19. MAP CARD
───────────────────────────────────────────── */
.map-card {
  padding-bottom: var(--sp-md);
}

.map-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  flex-wrap: wrap;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

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

.map-wrap {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #f7f5f0;
  border: 1px solid var(--c-border);
}

.map-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Map pin hover */
.map-pin {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.map-pin:hover {
  transform: scale(1.15);
}

/* Pulsing ring around pins */
.pin-pulse {
  transform-origin: center;
  animation: pinPulse 2s ease-in-out infinite;
}

@keyframes pinPulse {

  0%,
  100% {
    r: 18;
    opacity: 0.20;
  }

  50% {
    r: 22;
    opacity: 0.10;
  }
}

/* Route dashes animation */
.route-line {
  stroke-dashoffset: 0;
  animation: dashFlow 3s linear infinite;
}

@keyframes dashFlow {
  to {
    stroke-dashoffset: -40;
  }
}

/* Animated trucks */
.truck-animate {
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.route-a {
  animation: truckRouteA 8s linear infinite;
}

.route-b {
  animation: truckRouteB 10s linear infinite;
}

@keyframes truckRouteA {
  0% {
    transform: translate(100px, 80px);
  }

  25% {
    transform: translate(320px, 132px);
  }

  50% {
    transform: translate(500px, 240px);
  }

  75% {
    transform: translate(610px, 290px);
  }

  100% {
    transform: translate(680px, 310px);
  }
}

@keyframes truckRouteB {
  0% {
    transform: translate(150px, 300px);
  }

  33% {
    transform: translate(360px, 230px);
  }

  66% {
    transform: translate(540px, 180px);
  }

  100% {
    transform: translate(720px, 140px);
  }
}

/* Map tooltip */
.map-tooltip {
  position: absolute;
  background: #1c1c1e;
  color: #f0ede6;
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 0.76rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  min-width: 160px;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.map-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.map-tooltip-id {
  font-size: 0.65rem;
  color: var(--c-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-tooltip-loc {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  margin: 3px 0 2px;
}

.map-tooltip-meta {
  font-size: 0.7rem;
  color: rgba(240, 237, 230, 0.6);
}

/* ─────────────────────────────────────────────
   20. CIRCULAR GAUGE / STATS CARD
───────────────────────────────────────────── */
.stats-gauge-card {}

.gauge-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
  margin-bottom: var(--sp-lg);
}

.gauge-svg {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.gauge-stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.gauge-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gauge-stat-divider {
  height: 1px;
  background: var(--c-border);
}

.gs-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--c-text);
  letter-spacing: -0.5px;
  line-height: 1;
}

.gs-lbl {
  font-size: 0.67rem;
  color: var(--c-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Mini progress bars */
.gauge-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--c-border);
}

.gb-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gb-label {
  font-size: 0.72rem;
  color: var(--c-text-muted);
  font-weight: 600;
  min-width: 80px;
}

.gb-track {
  flex: 1;
  height: 5px;
  background: var(--c-surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}

.gb-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.gb-pct {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-text);
  min-width: 32px;
  text-align: right;
}

/* ─────────────────────────────────────────────
   21. DRIVERS ACTIVITY PANEL
───────────────────────────────────────────── */
.drivers-panel {
  min-height: 260px;
}

.drivers-list {
  max-height: 310px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.drivers-list::-webkit-scrollbar {
  width: 3px;
}

.drivers-list::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.driver-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
  cursor: default;
  animation: slideIn 0.3s ease;
}

.driver-row:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Driver avatar */
.driver-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.driver-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--c-dark-panel);
}

.driver-status-dot.online {
  background: #22c55e;
}

.driver-status-dot.offline {
  background: #6b7280;
}

/* Driver info */
.driver-info {
  flex: 1;
  min-width: 0;
}

.driver-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f0ede6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-meta {
  font-size: 0.68rem;
  color: rgba(240, 237, 230, 0.45);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Driver right side */
.driver-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.driver-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.driver-badge.online {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.driver-badge.offline {
  background: rgba(107, 114, 128, 0.18);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.driver-deliveries {
  font-size: 0.66rem;
  color: rgba(240, 237, 230, 0.4);
}

/* ===============================================================
   DARK MODE  –  body.dark-theme
   All neumorphic shadows re-calibrated for dark #141417 base
=============================================================== */
body.dark-theme {
  --c-bg: #141417;
  --c-surface: #1c1c20;
  --c-surface-2: #242428;
  --c-surface-3: #2c2c31;
  --c-text: #f0ede6;
  --c-text-2: #c4bfb8;
  --c-text-muted: #888888;
  --c-text-dim: #555555;
  --c-border: rgba(255, 255, 255, 0.06);
  --c-border-md: rgba(255, 255, 255, 0.10);
  --neu-raised: 6px 6px 18px rgba(0, 0, 0, 0.55), -3px -3px 10px rgba(255, 255, 255, 0.04);
  --neu-raised-sm: 3px 3px 10px rgba(0, 0, 0, 0.50), -2px -2px 6px rgba(255, 255, 255, 0.03);
  --neu-raised-lg: 10px 10px 30px rgba(0, 0, 0, 0.60), -4px -4px 14px rgba(255, 255, 255, 0.04);
  --neu-pressed: inset 3px 3px 8px rgba(0, 0, 0, 0.55), inset -2px -2px 5px rgba(255, 255, 255, 0.03);
  --neu-accent-glow: 6px 6px 18px rgba(0, 0, 0, 0.55), -3px -3px 10px rgba(255, 255, 255, 0.04), 0 0 0 2px var(--c-accent-glow);
  --shadow-card: var(--neu-raised-sm);
  --shadow-md: var(--neu-raised);
  --shadow-lg: var(--neu-raised-lg);
  background: var(--c-bg);
  color: var(--c-text);
}

/* Sidebar */
body.dark-theme .sidebar {
  background: var(--c-surface);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

body.dark-theme .sidebar-brand {
  background: linear-gradient(135deg, var(--c-surface) 0%, var(--c-surface-2) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .brand-name {
  background: linear-gradient(135deg, #f0ede6 30%, #c4bfb8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-theme .nav-divider {
  background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .nav-link-item {
  color: #555;
}

body.dark-theme .nav-link-item:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .nav-item.active .nav-link-item {
  background: linear-gradient(135deg, #f0bc30 0%, #c99a18 100%);
  color: #1a1a1a;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.5), -2px -2px 6px rgba(255, 255, 255, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.dark-theme .sidebar-footer {
  background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-surface-2) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .user-mini-card {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .user-mini-card:hover {
  box-shadow: var(--neu-accent-glow);
}

body.dark-theme .user-name-sm {
  color: var(--c-text);
}

/* Topnav */
body.dark-theme .topnav {
  background: var(--c-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

body.dark-theme .menu-toggle {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--c-text-muted);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .menu-toggle:hover {
  color: var(--c-text);
  box-shadow: var(--neu-accent-glow);
}

body.dark-theme .menu-toggle:active {
  box-shadow: var(--neu-pressed);
}

body.dark-theme .search-box {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-pressed);
}

body.dark-theme .search-box:focus-within {
  border-color: var(--c-accent);
  box-shadow: var(--neu-pressed), 0 0 0 3px rgba(240, 188, 48, 0.18);
}

body.dark-theme .search-input {
  color: var(--c-text);
}

body.dark-theme .search-kbd {
  background: var(--c-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--c-text-muted);
  box-shadow: none;
}

body.dark-theme .nav-action-btn {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--c-text-muted);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .nav-action-btn:hover {
  background: var(--c-accent);
  color: #1a1a1a;
  border-color: var(--c-accent);
  box-shadow: 0 4px 16px rgba(240, 188, 48, 0.35), var(--neu-raised-sm);
}

body.dark-theme .nav-action-btn:active {
  box-shadow: var(--neu-pressed);
}

body.dark-theme .notif-dot {
  border-color: var(--c-surface);
}

body.dark-theme .profile-btn {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .profile-btn:hover {
  box-shadow: var(--neu-accent-glow);
}

body.dark-theme .profile-btn:active {
  box-shadow: var(--neu-pressed);
}

body.dark-theme .profile-name {
  color: var(--c-text);
}

body.dark-theme .profile-role {
  color: var(--c-text-muted);
}

body.dark-theme .profile-dropdown {
  background: var(--c-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 12px 12px 32px rgba(0, 0, 0, 0.6), -3px -3px 10px rgba(255, 255, 255, 0.03) !important;
}

body.dark-theme .profile-dropdown .dropdown-item {
  color: var(--c-text-muted) !important;
}

body.dark-theme .profile-dropdown .dropdown-item:hover {
  background: var(--c-surface-2) !important;
  color: var(--c-text) !important;
  box-shadow: none;
}

body.dark-theme .profile-dropdown .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Section */
body.dark-theme .section-title {
  color: var(--c-text);
}

body.dark-theme .section-subtitle {
  color: var(--c-text-muted);
}

/* KPI Cards */
body.dark-theme .kpi-card {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised);
}

body.dark-theme .kpi-card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
}

body.dark-theme .kpi-card:hover {
  box-shadow: 8px 8px 24px rgba(0, 0, 0, 0.6), -4px -4px 12px rgba(255, 255, 255, 0.03), 0 0 0 1px rgba(240, 188, 48, 0.2);
}

body.dark-theme .kpi-value {
  background: linear-gradient(135deg, #f0ede6 0%, #c4bfb8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.dark-theme .kpi-label {
  color: var(--c-text-muted);
}

body.dark-theme .kpi-icon-wrap {
  box-shadow: var(--neu-raised-sm);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.dark-theme .kpi-blue {
  background: linear-gradient(135deg, #1e2a4a, #1a2236);
  color: #60a5fa;
}

body.dark-theme .kpi-green {
  background: linear-gradient(135deg, #142a1e, #0f2018);
  color: #4ade80;
}

body.dark-theme .kpi-amber {
  background: linear-gradient(135deg, #2d2210, #241a08);
  color: #fbbf24;
}

body.dark-theme .kpi-purple {
  background: linear-gradient(135deg, #1e1535, #18102c);
  color: #c084fc;
}

/* Dash Cards */
body.dark-theme .dash-card {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised);
}

body.dark-theme .dash-card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
}

body.dark-theme .dash-card:hover {
  box-shadow: 8px 8px 24px rgba(0, 0, 0, 0.6), -3px -3px 10px rgba(255, 255, 255, 0.03);
}

body.dark-theme .dash-card-title {
  color: var(--c-text);
}

body.dark-theme .view-all-link {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised-sm);
  color: var(--c-text-muted);
}

body.dark-theme .view-all-link:hover {
  color: var(--c-text);
  box-shadow: var(--neu-accent-glow);
}

/* Tables */
body.dark-theme .data-table th {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-theme .data-table td {
  color: var(--c-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .data-table tbody tr:hover {
  background: var(--c-surface-2);
}

body.dark-theme .badge-delivered {
  background: #0d2a1a;
  color: #4ade80;
  border-color: #14532d;
}

body.dark-theme .badge-pending {
  background: #2a1d06;
  color: #fbbf24;
  border-color: #78350f;
}

body.dark-theme .badge-cancelled {
  background: #2a0d0d;
  color: #f87171;
  border-color: #7f1d1d;
}

body.dark-theme .badge-online {
  background: #0d2a1a;
  color: #4ade80;
  border-color: #14532d;
}

body.dark-theme .badge-offline {
  background: #1e1e1e;
  color: #6b7280;
  border-color: #374151;
}

body.dark-theme .tbl-action-btn {
  background: var(--c-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--c-text-muted);
}

body.dark-theme .tbl-action-btn:hover {
  background: var(--c-accent);
  color: #1a1a1a;
  border-color: var(--c-accent);
}

body.dark-theme .tbl-action-btn.danger:hover {
  background: var(--c-danger);
  color: white;
  border-color: var(--c-danger);
}

body.dark-theme .page-btn {
  background: var(--c-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--c-text-muted);
}

body.dark-theme .page-btn:hover,
body.dark-theme .page-btn.active {
  background: var(--c-accent);
  color: #1a1a1a;
  border-color: var(--c-accent);
}

/* Filters */
body.dark-theme .filter-tabs {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-theme .filter-tab {
  color: var(--c-text-muted);
}

body.dark-theme .filter-tab:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

body.dark-theme .filter-tab.active {
  background: var(--c-accent);
  color: #1a1a1a;
}

body.dark-theme .search-input-sm {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--c-text);
}

body.dark-theme .search-input-sm:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(240, 188, 48, 0.18);
}

body.dark-theme .filter-select {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--c-text);
}

/* Buttons */
body.dark-theme .btn-primary-action {
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-dk) 100%);
  color: #1a1a1a;
  box-shadow: 4px 4px 14px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(240, 188, 48, 0.2);
}

body.dark-theme .btn-primary-action:hover {
  box-shadow: 6px 8px 22px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(240, 188, 48, 0.35);
}

body.dark-theme .btn-secondary-action {
  background: var(--c-surface-2);
  color: var(--c-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .btn-secondary-action:hover {
  box-shadow: var(--neu-accent-glow);
  border-color: var(--c-accent);
}

body.dark-theme .btn-cancel {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .btn-cancel:hover {
  color: var(--c-text);
  box-shadow: var(--neu-raised);
}

/* Settings */
body.dark-theme .settings-group-title {
  color: var(--c-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-theme .settings-label {
  color: var(--c-text-muted);
}

body.dark-theme .settings-input {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--c-text);
}

body.dark-theme .settings-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(240, 188, 48, 0.18);
}

body.dark-theme .toggle-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-theme .toggle-label {
  color: var(--c-text);
}

body.dark-theme .toggle-desc {
  color: var(--c-text-muted);
}

body.dark-theme .toggle-slider {
  background: var(--c-surface-3);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .toggle-switch input:checked+.toggle-slider {
  background: var(--c-accent);
  border-color: var(--c-accent);
}

body.dark-theme .toggle-switch input:checked+.toggle-slider::before {
  background: #1a1a1a;
}

body.dark-theme .theme-btn {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

body.dark-theme .theme-btn:hover {
  border-color: var(--c-accent);
  color: var(--c-text);
}

body.dark-theme .theme-btn.active {
  background: var(--c-accent);
  color: #1a1a1a;
  border-color: var(--c-accent);
}

body.dark-theme .system-info-list li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--c-text);
}

body.dark-theme .system-info-list li span {
  color: var(--c-text-muted);
}

body.dark-theme .agent-stat-mini {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised-sm);
}

body.dark-theme .agent-stat-label {
  color: var(--c-text-muted);
}

body.dark-theme .agent-stat-value {
  color: var(--c-text);
}

/* Notifications */
body.dark-theme .notif-dropdown {
  background: var(--c-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 12px 12px 32px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .notif-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--c-text);
}

body.dark-theme .notif-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .notif-item:hover {
  background: var(--c-surface-2);
}

body.dark-theme .notif-text {
  color: var(--c-text);
}

body.dark-theme .notif-time {
  color: var(--c-text-muted);
}

body.dark-theme .notif-footer {
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}

body.dark-theme .notif-footer:hover {
  color: var(--c-text);
}

body.dark-theme .btn-link-sm {
  color: var(--c-text-muted);
}

body.dark-theme .btn-link-sm:hover {
  color: var(--c-text);
}

/* Modals */
body.dark-theme .custom-modal {
  background: var(--c-surface) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .custom-modal-header {
  background: var(--c-surface-2) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: var(--c-text) !important;
}

body.dark-theme .custom-modal-footer {
  background: var(--c-surface-2) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
}

body.dark-theme .form-label-custom {
  color: var(--c-text-muted);
}

body.dark-theme .form-input-custom {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--c-text);
}

body.dark-theme .form-input-custom:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(240, 188, 48, 0.18);
}

body.dark-theme .form-input-custom::placeholder {
  color: var(--c-text-dim);
}

body.dark-theme .modal-title {
  color: var(--c-text) !important;
}

body.dark-theme .btn-close {
  filter: invert(1);
}

body.dark-theme .modal-content {
  background: var(--c-surface) !important;
}

/* Toasts */
body.dark-theme .toast-item {
  background: var(--c-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 8px 8px 24px rgba(0, 0, 0, 0.55);
}

body.dark-theme .toast-title {
  color: var(--c-text);
}

body.dark-theme .toast-msg {
  color: var(--c-text-muted);
}

body.dark-theme .toast-close {
  color: var(--c-text-muted);
}

body.dark-theme .toast-close:hover {
  color: var(--c-text);
}

/* Map */
body.dark-theme .map-wrap {
  background: #1a1a1e;
  border-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .map-legend-item {
  color: var(--c-text-muted);
}

/* Animation optimizations */
.map-pin {
  transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.truck-animate {
  pointer-events: none;
  transition: transform 0.1s linear;
}

/* Gauge */
body.dark-theme .gauge-stat-divider {
  background: rgba(255, 255, 255, 0.07);
}

body.dark-theme .gs-val {
  color: var(--c-text);
}

body.dark-theme .gs-lbl {
  color: var(--c-text-muted);
}

body.dark-theme .gb-label {
  color: var(--c-text-muted);
}

body.dark-theme .gb-track {
  background: var(--c-surface-3);
}

body.dark-theme .gb-pct {
  color: var(--c-text);
}

body.dark-theme .gauge-bars {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

body.dark-theme #gaugePct {
  fill: #f0ede6 !important;
}

/* Scrollbars */
body.dark-theme ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ═══════════════════════════════════════════════════════════════
   LANGUAGE TOGGLE BUTTON
═══════════════════════════════════════════════════════════════ */
.lang-toggle-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-full);
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--neu-raised-sm);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.lang-toggle-btn:hover {
  box-shadow: var(--neu-accent-glow);
  color: var(--c-accent);
}

.lang-toggle-btn:active {
  box-shadow: var(--neu-pressed);
}

body.dark-theme .lang-toggle-btn {
  background: var(--c-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--neu-raised-sm);
  color: var(--c-text);
}

body.dark-theme .lang-toggle-btn:hover {
  box-shadow: var(--neu-accent-glow);
  color: var(--c-accent);
}

/* ═══════════════════════════════════════════════════════════════
   RTL SUPPORT  –  html[dir="rtl"]
═══════════════════════════════════════════════════════════════ */
html[dir="rtl"] body {
  font-family: 'Noto Sans Arabic', var(--font);
}

html[dir="rtl"] .main-wrapper {
  margin-left: 0;
  margin-right: var(--sidebar-w);
}

html[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.07);
}

html[dir="rtl"] .sidebar-brand {
  flex-direction: row-reverse;
}

html[dir="rtl"] .topnav {
  flex-direction: row-reverse;
}

html[dir="rtl"] .topnav-left {
  flex-direction: row-reverse;
}

html[dir="rtl"] .topnav-right {
  flex-direction: row-reverse;
}

html[dir="rtl"] .search-box {
  flex-direction: row-reverse;
}

html[dir="rtl"] .search-icon {
  order: 1;
}

html[dir="rtl"] .search-input {
  text-align: right;
}

html[dir="rtl"] .section-header {
  flex-direction: row-reverse;
}

html[dir="rtl"] .section-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .kpi-card {
  flex-direction: row-reverse;
}

html[dir="rtl"] .kpi-body {
  text-align: right;
}

html[dir="rtl"] .kpi-trend {
  flex-direction: row-reverse;
}

html[dir="rtl"] .dash-card-header {
  flex-direction: row-reverse;
}

html[dir="rtl"] .dash-card-title {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nav-link-item {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .agent-cell {
  flex-direction: row-reverse;
}

html[dir="rtl"] .perf-bar-wrap {
  flex-direction: row-reverse;
}

html[dir="rtl"] .filter-bar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .filter-tabs {
  flex-direction: row-reverse;
}

html[dir="rtl"] .driver-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .driver-info {
  text-align: right;
}

html[dir="rtl"] .driver-meta {
  flex-direction: row-reverse;
}

html[dir="rtl"] .gauge-wrap {
  flex-direction: row-reverse;
}

html[dir="rtl"] .gauge-stats {
  text-align: right;
}

html[dir="rtl"] .gb-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .activity-item {
  flex-direction: row-reverse;
}

html[dir="rtl"] .activity-content {
  text-align: right;
}

html[dir="rtl"] .notif-item {
  flex-direction: row-reverse;
}

html[dir="rtl"] .user-mini-card {
  flex-direction: row-reverse;
}

html[dir="rtl"] .profile-btn {
  flex-direction: row-reverse;
}

html[dir="rtl"] .profile-info {
  text-align: right;
}

html[dir="rtl"] .toggle-row {
  flex-direction: row-reverse;
}

html[dir="rtl"] .map-legend {
  flex-direction: row-reverse;
}

html[dir="rtl"] .table-pagination {
  flex-direction: row-reverse;
}

html[dir="rtl"] .data-table th,
html[dir="rtl"] .data-table td {
  text-align: right;
}

html[dir="rtl"] .sidebar-overlay.active {
  display: block;
}

html[dir="rtl"] .live-badge {
  flex-direction: row-reverse;
}

/* Slide sidebar in from the right on mobile RTL */
@media (max-width: 991.98px) {
  html[dir="rtl"] .sidebar {
    transform: translateX(100%);
  }

  html[dir="rtl"] .sidebar.is-open {
    transform: translateX(0);
  }

  html[dir="rtl"] .main-wrapper {
    margin-right: 0 !important;
  }
}