/* ═══════════════════════════════════════════════
   WIALON FLEET DASHBOARD — Global Styles
   NOM-087 Compliance | Carlos Sanchez (Li)
═══════════════════════════════════════════════ */

:root {
  --bg-base:       #0d1117;
  --bg-card:       #161b22;
  --bg-card-hover: #1f2937;
  --bg-sidebar:    #13181f;
  --border:        #30363d;
  --border-light:  #21262d;

  --primary:    #3b82f6;
  --primary-dk: #2563eb;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #06b6d4;
  --purple:     #8b5cf6;

  /* NOM-087 */
  --nom-safe:      #22c55e;
  --nom-caution:   #84cc16;
  --nom-warning:   #f59e0b;
  --nom-alert:     #f97316;
  --nom-violation: #ef4444;

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #4b5563;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,.4);
  --transition: .2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Typography helpers ────────────────────── */
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }
.text-primary   { color: var(--primary); }
.text-sm        { font-size: 12px; }
.text-xs        { font-size: 11px; }
.text-lg        { font-size: 16px; }
.text-xl        { font-size: 20px; }
.fw-600         { font-weight: 600; }
.fw-700         { font-weight: 700; }

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dk); }
.btn-ghost    { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm       { padding: 5px 10px; font-size: 12px; }
.btn-icon     { padding: 6px; border-radius: var(--radius-sm); }

/* ── Form controls ─────────────────────────── */
.form-group       { display: flex; flex-direction: column; gap: 6px; }
.form-label       { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-control::placeholder { color: var(--text-muted); }

/* ── Badge ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-success   { background: rgba(34,197,94,.15);  color: var(--success); }
.badge-warning   { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger    { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-info      { background: rgba(6,182,212,.15);  color: var(--info); }
.badge-secondary { background: rgba(148,163,184,.1); color: var(--text-secondary); }
.badge-primary   { background: rgba(59,130,246,.15); color: var(--primary); }

/* ── Status dot ────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online   { background: var(--success); box-shadow: 0 0 0 2px rgba(34,197,94,.25); }
.status-dot.moving   { background: var(--primary); box-shadow: 0 0 0 2px rgba(59,130,246,.25); animation: pulse-dot 1.5s infinite; }
.status-dot.idle     { background: var(--warning); }
.status-dot.offline  { background: var(--text-muted); }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(59,130,246,.25); }
  50%       { box-shadow: 0 0 0 4px rgba(59,130,246,.4); }
}

/* ── Toast notifications ───────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 340px;
  animation: slide-in .3s ease;
  pointer-events: all;
}
.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error   { border-left-color: var(--danger); }
.toast.fade-out { animation: slide-out .3s ease forwards; }

@keyframes slide-in  { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes slide-out { from { transform: translateX(0); opacity:1; } to { transform: translateX(100%); opacity:0; } }

/* ── Modal ─────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 90%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Spinner ───────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading overlay ───────────────────────── */
.loading-overlay {
  display: none;
  position: absolute; inset: 0;
  background: rgba(13,17,23,.7);
  z-index: 10;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-direction: column;
  gap: 12px;
}
.loading-overlay.active { display: flex; }

/* ── Utility ───────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.w-full { width: 100%; }
.relative { position: relative; }

/* ══════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,.07) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,.05) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
  position: relative; z-index: 1;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(59,130,246,.3);
}
.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p  { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.login-error {
  display: none;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 13px;
}
.login-error.visible { display: block; }

.advanced-toggle {
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  justify-content: center;
}
.advanced-toggle:hover { color: var(--text-primary); }
.advanced-fields { display: none; }
.advanced-fields.open { display: flex; flex-direction: column; gap: 16px; }

/* ══════════════════════════════════════════════
   DASHBOARD LAYOUT
══════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition);
}
.sidebar.collapsed { width: 60px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-light);
  min-height: 60px;
}
.sidebar-brand .brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand .brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding: 4px 8px 8px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(59,130,246,.12); color: var(--primary); }
.nav-item .nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-light);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-name   { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role   { font-size: 11px; color: var(--text-muted); }

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 60px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}
.topbar-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.topbar-stat .stat-val { font-weight: 700; color: var(--text-primary); }
.topbar-actions { display: flex; gap: 6px; }

.refresh-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.refresh-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.refresh-btn.spinning .refresh-icon { animation: spin .7s linear infinite; display: inline-block; }

/* Page content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.page-section { display: none; }
.page-section.active { display: block; }

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 16px 20px; }
.card-actions { display: flex; gap: 6px; align-items: center; }

/* ── Stat cards row ────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--primary); }
.stat-card .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-secondary); font-weight: 600; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .stat-sub   { font-size: 11px; color: var(--text-muted); }
.stat-card.accent-blue   { border-top: 2px solid var(--primary); }
.stat-card.accent-green  { border-top: 2px solid var(--success); }
.stat-card.accent-orange { border-top: 2px solid var(--warning); }
.stat-card.accent-red    { border-top: 2px solid var(--danger); }
.stat-card.accent-purple { border-top: 2px solid var(--purple); }

/* ── Dashboard grid ────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dashboard-grid .full-width { grid-column: 1 / -1; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ── Table ─────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: var(--bg-base);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--text-primary); }
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); cursor: pointer; }
tbody tr:hover { background: var(--bg-card-hover); }
.table-row-selected { background: rgba(59,130,246,.08) !important; }

/* ── Map ───────────────────────────────────── */
#map-container {
  width: 100%; height: 480px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
#leaflet-map { width: 100%; height: 100%; }

/* ── Notification badge on nav ─────────────── */
#notif-badge {
  min-width: 18px; height: 18px;
  background: var(--danger); color: #fff;
  border-radius: 9px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; margin-left: auto;
}

/* ── Threshold checkboxes ───────────────────── */
.threshold-check {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px;
  user-select: none;
}
.threshold-check input { cursor: pointer; }
.threshold-check:has(input:checked) { border-color: var(--accent); }

/* ── Sortable table headers ────────────────── */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: var(--accent); }
th.sortable.sort-asc  .sort-icon::after { content: ' ↑'; color: var(--accent); }
th.sortable.sort-desc .sort-icon::after { content: ' ↓'; color: var(--accent); }
th.sortable:not(.sort-asc):not(.sort-desc) .sort-icon::after { content: ' ↕'; opacity: .35; }

/* ── NOM hours two-line ─────────────────────── */
.nom-col { display: flex; flex-direction: column; gap: 3px; min-width: 140px; }
.nom-remaining { font-size: 11px; color: var(--text-muted); }
.nom-remaining span { font-weight: 600; }

/* ── NOM-087 bar ───────────────────────────── */
.nom-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}
.nom-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.nom-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
}
.nom-bar-fill.safe      { background: var(--nom-safe); }
.nom-bar-fill.caution   { background: var(--nom-caution); }
.nom-bar-fill.warning   { background: var(--nom-warning); }
.nom-bar-fill.alert     { background: var(--nom-alert); }
.nom-bar-fill.violation { background: var(--nom-violation); }
.nom-hours { font-size: 12px; font-weight: 600; white-space: nowrap; }
.nom-hours.safe      { color: var(--nom-safe); }
.nom-hours.caution   { color: var(--nom-caution); }
.nom-hours.warning   { color: var(--nom-warning); }
.nom-hours.alert     { color: var(--nom-alert); }
.nom-hours.violation { color: var(--nom-violation); }

/* NOM-087 detail card */
.nom-unit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}
.nom-unit-card:hover { border-color: var(--border); background: var(--bg-card-hover); }
.nom-unit-card.violation { border-left: 3px solid var(--nom-violation); }
.nom-unit-card.alert     { border-left: 3px solid var(--nom-alert); }
.nom-unit-card.warning   { border-left: 3px solid var(--nom-warning); }
.nom-unit-card.caution   { border-left: 3px solid var(--nom-caution); }
.nom-unit-card.safe      { border-left: 3px solid var(--nom-safe); }
.nom-unit-card .unit-name  { font-weight: 600; font-size: 13px; }
.nom-unit-card .driver-name { font-size: 11px; color: var(--text-secondary); }

/* NOM legend */
.nom-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.nom-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.nom-legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── Alerts feed ───────────────────────────── */
.alert-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.alert-item:last-child { border-bottom: none; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alert-content .alert-title { font-size: 13px; font-weight: 500; }
.alert-content .alert-meta  { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── Unit detail panel ─────────────────────── */
.unit-detail-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 360px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 1001;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,.4);
}
.unit-detail-panel.open { transform: translateX(0); }
.unit-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.panel-section { padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.panel-section:last-child { border-bottom: none; }
.panel-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 700; margin-bottom: 12px; }
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.info-item .info-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 2px; }
.info-item .info-value { font-size: 14px; font-weight: 600; }

/* ── Driver analysis ───────────────────────── */
.driver-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}
.driver-card:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.driver-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.driver-info { flex: 1; min-width: 0; }
.driver-info .driver-name { font-weight: 600; font-size: 13px; }
.driver-info .driver-units { font-size: 11px; color: var(--text-secondary); }
.driver-stats { text-align: right; }
.driver-stats .hours { font-size: 20px; font-weight: 700; line-height: 1; }
.driver-stats .hours-label { font-size: 10px; color: var(--text-secondary); }

/* ── Widget add modal ──────────────────────── */
.widget-catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.widget-option {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.widget-option:hover  { border-color: var(--primary); background: rgba(59,130,246,.05); }
.widget-option.active { border-color: var(--primary); background: rgba(59,130,246,.1); }
.widget-option .wi-icon { font-size: 28px; margin-bottom: 6px; }
.widget-option .wi-name { font-size: 12px; font-weight: 600; }
.widget-option .wi-desc { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── Sidebar collapse ──────────────────────── */
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed .nav-badge {
  display: none;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px; }
.sidebar.collapsed .user-info { justify-content: center; }

/* ── Search ────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
}
.search-box input {
  border: none;
  background: none;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

/* ── Filter chips ──────────────────────────── */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
}
.chip:hover  { border-color: var(--primary); color: var(--primary); }
.chip.active { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,.1); }

/* ── Empty state ───────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state p { margin-top: 6px; font-size: 13px; }

/* ── Progress bar ──────────────────────────── */
.progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  transition: width .5s ease;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .topbar-stats { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .widget-catalog { grid-template-columns: 1fr; }
  #map-container { height: 300px; }
  .unit-detail-panel { width: 100%; }
}
