/* ============================================================
   ATHENA FLEET MANAGEMENT SYSTEM — style.css
   Enterprise-grade • Linear/Vercel-quality aesthetic
   Font: DM Sans (display) + IBM Plex Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=IBM+Plex+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #4F46E5;
  --primary-dark:   #3730A3;
  --primary-light:  #EEF2FF;
  --accent:         #06B6D4;
  --accent-light:   #ECFEFF;

  /* Surfaces */
  --surface:        #F8FAFC;
  --bg:             #F1F5F9;
  --card:           #FFFFFF;
  --sidebar-bg:     #0F172A;
  --sidebar-active: #1E293B;
  --topbar-bg:      #FFFFFF;

  /* Text */
  --text-primary:   #0F172A;
  --text-secondary: #64748B;
  --text-muted:     #94A3B8;
  --text-inverse:   #F8FAFC;

  /* Borders */
  --border:         #E2E8F0;
  --border-strong:  #CBD5E1;

  /* Status */
  --success:        #10B981;
  --success-bg:     #ECFDF5;
  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --danger:         #EF4444;
  --danger-bg:      #FEF2F2;
  --info:           #3B82F6;
  --info-bg:        #EFF6FF;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg:  0 4px 6px rgba(0,0,0,0.07), 0 10px 25px rgba(0,0,0,0.06);
  --shadow-xl:  0 8px 16px rgba(0,0,0,0.08), 0 24px 48px rgba(0,0,0,0.06);

  /* Layout */
  --sidebar-w:  240px;
  --topbar-h:   64px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  /* Fonts */
  --font-display: 'DM Sans', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast:   150ms;
  --t-base:   200ms;
  --t-slow:   300ms;
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  animation: fadeIn 0.35s var(--ease-out) forwards;
}

@keyframes fadeIn { to { opacity: 1; } }

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── FOCUS ────────────────────────────────────────────────── */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width var(--t-slow) var(--ease-out);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

.sidebar-logo-mark svg { color: #fff; }

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
  font-weight: 400;
}

/* Branch Selector */
.branch-selector {
  margin: 12px 12px 4px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background var(--t-fast);
}

.branch-selector:hover { background: rgba(255,255,255,0.08); }

.branch-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.branch-name {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-chevron { color: rgba(255,255,255,0.3); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.55);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t-fast);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: 1px;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}

.nav-item.active {
  background: rgba(79,70,229,0.25);
  color: #fff;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

/* User footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--t-fast);
}

.sidebar-user:hover { background: rgba(255,255,255,0.06); }

.user-avatar-sidebar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info-sidebar { flex: 1; overflow: hidden; }

.user-name-sidebar {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-sidebar {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   MAIN WRAPPER
══════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg);
  transition: margin-left var(--t-slow) var(--ease-out);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb-sep { color: var(--border-strong); }
.breadcrumb-current { color: var(--text-primary); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search */
.topbar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar-search input {
  width: 220px;
  padding: 7px 12px 7px 36px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  transition: all var(--t-base);
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
  width: 260px;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Topbar icon buttons */
.topbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: all var(--t-fast);
  position: relative;
  cursor: pointer;
}

.topbar-icon-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.notification-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card);
}

/* User chip */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--t-fast);
}

.topbar-user:hover { background: var(--surface); }

.user-avatar-top {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.user-name-top {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── PAGE CONTENT ─────────────────────────────────────────── */
.page-content {
  padding: 32px;
  max-width: 1400px;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header-left {}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  transition: all var(--t-base);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(79,70,229,0.35);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #DC2626;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-sm);
}

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(226,232,240,0.6);
  transition: box-shadow var(--t-base);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-body { padding: 22px; }

/* ── STAT CARDS ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(226,232,240,0.6);
  border-left: 4px solid;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.05;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stat-card.indigo  { border-left-color: var(--primary); }
.stat-card.cyan    { border-left-color: var(--accent); }
.stat-card.emerald { border-left-color: var(--success); }
.stat-card.amber   { border-left-color: var(--warning); }
.stat-card.red     { border-left-color: var(--danger); }

.stat-card.indigo::after  { background: var(--primary); }
.stat-card.cyan::after    { background: var(--accent); }
.stat-card.emerald::after { background: var(--success); }
.stat-card.amber::after   { background: var(--warning); }

.stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-icon-wrap {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap.indigo  { background: var(--primary-light); color: var(--primary); }
.stat-icon-wrap.cyan    { background: var(--accent-light);  color: var(--accent); }
.stat-icon-wrap.emerald { background: var(--success-bg);    color: var(--success); }
.stat-icon-wrap.amber   { background: var(--warning-bg);    color: var(--warning); }
.stat-icon-wrap.red     { background: var(--danger-bg);     color: var(--danger); }

.stat-trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 99px;
}

.stat-trend.up   { background: var(--success-bg); color: var(--success); }
.stat-trend.down { background: var(--danger-bg);  color: var(--danger); }
.stat-trend.flat { background: var(--surface);    color: var(--text-secondary); }

.stat-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ── GRID LAYOUTS ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* ── TABLES ───────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead tr {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

thead th {
  padding: 11px 16px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--surface); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Driver/entity avatar */
.entity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entity-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-light) 0%, #DDD6FE 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.entity-name { font-weight: 500; color: var(--text-primary); }
.entity-sub  { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-success .badge-dot { background: var(--success); }

.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-warning .badge-dot { background: var(--warning); }

.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-danger .badge-dot  { background: var(--danger); }

.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-info .badge-dot    { background: var(--info); }

.badge-neutral { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); }

/* Action buttons in table */
.action-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid;
  cursor: pointer;
  transition: all var(--t-fast);
  background: transparent;
}

.action-btn-edit {
  color: var(--primary);
  border-color: rgba(79,70,229,0.3);
}

.action-btn-edit:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.action-btn-delete {
  color: var(--danger);
  border-color: rgba(239,68,68,0.3);
}

.action-btn-delete:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.action-btn-view {
  color: var(--text-secondary);
  border-color: var(--border);
}

.action-btn-view:hover {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--card);
  transition: all var(--t-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Filter Bar */
.filter-bar {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  flex: 1;
  min-width: 140px;
  max-width: 220px;
}

/* ── TABS ─────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-item {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-item:hover { color: var(--text-primary); background: rgba(0,0,0,0.03); }

.tab-item.active {
  background: var(--card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-count {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
}

/* ── PROGRESS & MISC ──────────────────────────────────────── */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s var(--ease-out);
}

/* Route stop timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 14px;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 20px;
  width: 1px;
  height: calc(100% - 8px);
  background: var(--border);
}

.timeline-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
  z-index: 1;
}

.timeline-dot.stop    { border-color: var(--accent); }
.timeline-dot.arrived { background: var(--success); border-color: var(--success); }

.timeline-content { padding-bottom: 16px; }
.timeline-time { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.timeline-place { font-size: 13.5px; font-weight: 500; margin-top: 1px; }

/* ── SKELETON LOADER ──────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, #e8edf3 50%, var(--surface) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.skeleton-avatar { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.skeleton-line { height: 12px; border-radius: 4px; }
.skeleton-line-sm { height: 10px; border-radius: 4px; margin-top: 6px; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 56px; height: 56px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 16px;
  border: 1.5px dashed var(--border-strong);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-text {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 280px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ── BRANCH OVERVIEW TABLE ────────────────────────────────── */
.branch-row td:first-child { font-weight: 600; }

.branch-flag {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

/* ── ACTIVITY FEED ────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.activity-body { flex: 1; }

.activity-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-text strong { font-weight: 600; }

.activity-time {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* ── MOBILE HAMBURGER ─────────────────────────────────────── */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ── SECTION HEADER (inline) ──────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.section-link {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
}

.section-link:hover { text-decoration: underline; }

/* ── MAP PLACEHOLDER ──────────────────────────────────────── */
.map-placeholder {
  height: 220px;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0F2FE 100%);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  border: 1.5px dashed var(--border-strong);
}

.map-placeholder-icon { color: var(--primary); opacity: 0.6; }

/* ── VEHICLE TYPE ICON ────────────────────────────────────── */
.vehicle-type-icon {
  width: 36px; height: 36px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}

/* ── FUEL PROGRESS ────────────────────────────────────────── */
.fuel-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fuel-level-text {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  width: 30px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 60px; }

  .sidebar-logo-text,
  .sidebar-logo-name,
  .sidebar-logo-sub,
  .branch-selector .branch-name,
  .branch-selector .branch-chevron,
  .nav-item span,
  .nav-badge,
  .nav-section-label,
  .sidebar-user .user-info-sidebar { display: none; }

  .sidebar-logo { justify-content: center; padding: 16px 12px; }
  .branch-selector { justify-content: center; padding: 8px; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item.active::before { display: none; }
  .sidebar-user { justify-content: center; }

  .grid-2-1,
  .grid-1-2,
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 240px;
    transform: translateX(-100%);
    transition: transform var(--t-slow) var(--ease-out);
  }

  .sidebar.open { transform: translateX(0); }

  .main-wrapper { margin-left: 0; }

  .hamburger { display: flex; }

  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-3 { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .filter-bar { gap: 8px; }
  .filter-bar .form-input,
  .filter-bar .form-select { max-width: 100%; flex: 1 1 140px; }

  .topbar-search input { width: 160px; }

  .overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
  }

  .overlay.active { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row,
  .form-row-3 { grid-template-columns: 1fr; }
  .stat-value { font-size: 28px; }
}

/* ══════════════════════════════════════════════════════════
   PAGE-SPECIFIC: DASHBOARD
══════════════════════════════════════════════════════════ */
.branch-overview-table { margin-top: 4px; }

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}

.mini-bar {
  width: 6px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
  opacity: 0.35;
  transition: opacity var(--t-fast);
}

.mini-bar:last-child { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--t-slow) var(--ease-out);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   TOOLTIP
══════════════════════════════════════════════════════════ */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: #fff;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: 99;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   UTILITY
══════════════════════════════════════════════════════════ */
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.mt-1        { margin-top: 4px; }
.mt-2        { margin-top: 8px; }
.mt-4        { margin-top: 16px; }
.mb-4        { margin-bottom: 16px; }
.mb-6        { margin-bottom: 24px; }
.w-full      { width: 100%; }
.text-sm     { font-size: 12px; }
.text-muted  { color: var(--text-secondary); }
.font-mono   { font-family: var(--font-mono); }
.tel-link    { color: var(--primary); text-decoration: none; font-family: var(--font-mono); }
.tel-link:hover { text-decoration: underline; }
.em-dash     { color: var(--text-muted); font-family: var(--font-mono); }


/* ── Logout Button Fix ── */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  margin-top: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
.logout-btn:active {
  transform: scale(0.97);
}
.logout-btn svg {
  flex-shrink: 0;
}
/*  Sidebar collapse button fix  */
.sidebar-collapse-btn {
    position: absolute;
    top: 12px;
    right: -14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4338CA;
    border: 2px solid #fff;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 610;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.25s ease;
}
.sidebar-collapse-btn:hover { background: #6366F1; }
.sidebar-collapse-btn svg { width: 14px; height: 14px; transition: transform 0.25s ease; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

/*  Nav-group collapsible sidebar sections  */
.nav-group { margin-bottom: 2px; }
.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.15s;
}
.nav-group-toggle:hover { color: rgba(255,255,255,0.7); }
.nav-group-chevron {
    width: 12px; height: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.nav-group.open .nav-group-chevron { transform: rotate(90deg); }
.nav-group-items { display: none; padding-left: 0; }
.nav-group.open .nav-group-items { display: block; }
