  .gps-view {
    --bg: #0a0e14;
    --panel: #131820;
    --panel-2: #1a212c;
    --border: #243142;
    --text: #e6edf3;
    --text-dim: #8b98a8;
    --text-faint: #5a6776;
    --accent: #f59e0b;
    --accent-dim: #b45309;
    --ok: #10b981;
    --warn: #eab308;
    --bad: #ef4444;
    --gone: #6b7280;
  }

  .gps-view, .gps-view * { box-sizing: border-box; margin: 0; padding: 0; }

  .gps-view, .gps-view {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    overflow: hidden;
  }

  .gps-view .mono { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }

  .gps-view .app {
    display: grid;
    grid-template-rows: 56px 1fr;
    height: 100vh;
  }

  .gps-view /* Header */
  header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 24px;
  }

  .gps-view .brand {
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 14px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .gps-view .brand-mark {
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 1px;
    transform: rotate(45deg);
  }

  .gps-view .brand-sep {
    color: var(--text-faint);
    margin: 0 4px;
  }

  .gps-view .brand-sub {
    color: var(--text-dim);
    font-weight: 400;
  }

  .gps-view .header-stats {
    margin-left: auto;
    display: flex;
    gap: 28px;
    align-items: center;
    font-size: 12px;
  }

  .gps-view .stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .gps-view .stat-label {
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
  }

  .gps-view .stat-value {
    color: var(--text);
    font-weight: 500;
  }

  .gps-view .refresh-pulse {
    width: 8px; height: 8px;
    background: var(--ok);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  }

  .gps-view /* Main grid */
  .main {
    display: grid;
    grid-template-columns: 340px 1fr;
    overflow: hidden;
  }

  .gps-view /* Sidebar */
  .sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .gps-view .sidebar-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .gps-view .sidebar-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    font-weight: 600;
  }

  .gps-view .truck-count {
    font-size: 11px;
    color: var(--text-faint);
    font-family: 'IBM Plex Mono', monospace;
  }

  .gps-view .truck-list {
    flex: 1;
    overflow-y: auto;
  }

  .gps-view .truck-list::-webkit-scrollbar {
    width: 6px;
  }
  .gps-view .truck-list::-webkit-scrollbar-track { background: transparent; }
  .gps-view .truck-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }

  .gps-view .truck-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 120ms ease;
    position: relative;
  }

  .gps-view .truck-item:hover {
    background: var(--panel-2);
  }

  .gps-view .truck-item.active {
    background: var(--panel-2);
  }

  .gps-view .truck-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: var(--accent);
  }

  .gps-view .truck-row1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  .gps-view .status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .gps-view .status-dot.ok { background: var(--ok); box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
  .gps-view .status-dot.warn { background: var(--warn); }
  .gps-view .status-dot.bad { background: var(--bad); }
  .gps-view .status-dot.gone { background: var(--gone); }

  .gps-view .truck-id {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
  }

  .gps-view .truck-seen {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-faint);
    font-family: 'IBM Plex Mono', monospace;
  }

  .gps-view .truck-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    font-size: 11px;
  }

  .gps-view .truck-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .gps-view .metric-label {
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 9px;
  }

  .gps-view .metric-value {
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
  }

  .gps-view .empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12px;
  }

  .gps-view /* Map */
  .map-wrap {
    position: relative;
  }

  .gps-view #map {
    width: 100%;
    height: 100%;
    background: #0a0e14;
  }

  .gps-view /* Override Leaflet for dark theme */
  .leaflet-control-attribution {
    background: rgba(10, 14, 20, 0.8) !important;
    color: var(--text-faint) !important;
    font-size: 10px !important;
    border: 1px solid var(--border) !important;
  }
  .gps-view .leaflet-control-attribution a {
    color: var(--text-dim) !important;
  }
  .gps-view .leaflet-control-zoom a {
    background: var(--panel) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
  }
  .gps-view .leaflet-control-zoom a:hover {
    background: var(--panel-2) !important;
  }

  .gps-view /* Map legend */
  .legend {
    position: absolute;
    bottom: 24px;
    left: 16px;
    background: rgba(19, 24, 32, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    padding: 12px 14px;
    z-index: 500;
    font-size: 11px;
    border-radius: 2px;
  }

  .gps-view .legend-title {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    font-size: 10px;
    margin-bottom: 8px;
    font-weight: 600;
  }

  .gps-view .legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
  }
  .gps-view .legend-row:last-child { margin-bottom: 0; }

  .gps-view /* Detail panel for selected truck */
  .detail-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 280px;
    background: rgba(19, 24, 32, 0.97);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    padding: 14px 16px;
    z-index: 500;
    border-radius: 2px;
    display: none;
  }

  .gps-view .detail-panel.show { display: block; }

  .gps-view .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .gps-view .detail-title {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
  }

  .gps-view .detail-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
  }
  .gps-view .detail-close:hover { color: var(--text); }

  .gps-view .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .gps-view .detail-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .gps-view .detail-cell.full { grid-column: 1 / -1; }

  .gps-view .detail-label {
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 9px;
  }

  .gps-view .detail-value {
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
  }

  .gps-view /* Custom marker */
  .truck-marker {
    background: transparent;
    border: none;
  }

  .gps-view .truck-marker-inner {
    width: 32px; height: 32px;
    background: var(--accent);
    border: 2px solid var(--bg);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(245, 158, 11, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 11px;
    color: var(--bg);
    cursor: pointer;
    transition: transform 150ms ease;
  }

  .gps-view .truck-marker-inner.warn { background: var(--warn); box-shadow: 0 0 0 2px var(--warn), 0 4px 12px rgba(234, 179, 8, 0.4); }
  .gps-view .truck-marker-inner.bad { background: var(--bad); box-shadow: 0 0 0 2px var(--bad), 0 4px 12px rgba(239, 68, 68, 0.4); }
  .gps-view .truck-marker-inner.gone { background: var(--gone); box-shadow: 0 0 0 2px var(--gone); opacity: 0.7; }

  .gps-view .truck-marker-inner:hover {
    transform: scale(1.15);
  }

  .gps-view .truck-marker-inner.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px var(--text), 0 0 0 5px var(--accent), 0 4px 16px rgba(245, 158, 11, 0.6);
  }

  .gps-view /* Loading state */
  .loading {
    padding: 30px 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12px;
  }

  .gps-view .err-banner {
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
  }


/* SPA tab integration overrides */
.gps-view { height: calc(100vh - 200px); min-height: 500px; display: block; }

/* === Mobile responsive — stack sidebar above map === */
@media (max-width: 900px) {
  .gps-view {
    height: auto !important;
    min-height: 700px;
  }
  .gps-view .main {
    flex-direction: column !important;
    height: auto !important;
  }
  .gps-view .sidebar {
    width: 100% !important;
    max-height: 220px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .gps-view .map-wrap {
    width: 100% !important;
    height: 60vh;
    min-height: 380px;
  }
  .gps-view header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .gps-view .header-stats {
    flex-wrap: wrap;
    gap: 6px;
  }
  .gps-view .stat {
    flex: 1 0 auto;
    min-width: 70px;
  }
}

/* Ensure map element has explicit dimensions */
.gps-view #map {
  width: 100%;
  height: 100%;
  min-height: 300px;
}

/* === Force block layout on mobile (fix .map-wrap collapse) === */
@media (max-width: 900px) {
  .gps-view .main {
    display: block !important;
    flex-direction: unset !important;
  }
  .gps-view .sidebar {
    display: block !important;
    width: auto !important;
    max-height: 240px;
    flex: none !important;
  }
  .gps-view .map-wrap {
    display: block !important;
    width: 100% !important;
    height: 500px !important;
    flex: none !important;
    overflow: visible !important;
    position: relative !important;
  }
  .gps-view #map {
    width: 100% !important;
    height: 500px !important;
    display: block !important;
  }
}

/* === Stat badge visibility fix === */
.gps-view .stat {
  display: inline-flex !important;
  flex-direction: column !important;
  background: #1a212c !important;
  border: 1px solid #243142 !important;
  padding: 8px 12px !important;
  min-height: 52px !important;
  border-radius: 8px !important;
  justify-content: center;
}
.gps-view .stat-label {
  display: block !important;
  font-size: 10px !important;
  color: #8b98a8 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.gps-view .stat-value {
  display: block !important;
  font-size: 18px !important;
  color: #e6edf3 !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
}

/* Light map background for Voyager tiles */
.gps-view .leaflet-container {
  background: #e8e8e8 !important;
}

/* Hide status legend */
.gps-view .legend { display: none !important; }

/* Hide stat badges */
.gps-view .header-stats { display: none !important; }

/* Hide sidebar — click truck markers on map for info */
.gps-view .sidebar { display: none !important; }

/* Don't reserve extra space below content */
.gps-view {
  min-height: 0 !important;
  height: auto !important;
}

/* Let map-wrap auto-size to whatever #map's height is */
.gps-view .map-wrap {
  height: auto !important;
  min-height: 0 !important;
}

/* DIAGNOSTIC — temp colored backgrounds */
.gps-view { background: red !important; }
.gps-view .app { background: orange !important; }
.gps-view .main { background: yellow !important; }
.gps-view .map-wrap { background: green !important; }
body { background: blue !important; }

/* Clear diagnostic colors */
.gps-view { background: var(--bg) !important; }
.gps-view .app { background: transparent !important; }
.gps-view .main { background: transparent !important; }
.gps-view .map-wrap { background: transparent !important; }
body { background: initial !important; }

/* Force .main to auto-height (it's the source of the dark band) */
.gps-view .main {
  display: block !important;
  height: auto !important;
  min-height: 0 !important;
  flex: none !important;
}
.gps-view .app {
  height: auto !important;
  flex: none !important;
}

/* Match body bg when GPS view is active */
body.gps-active { background: #0a0e14 !important; }

/* Round shop marker */
.shop-marker { border-radius: 50% !important; }

/* Shop divIcon wrapper — strip Leaflet's default white card */
.shop-marker {
  background: transparent !important;
  border: none !important;
}
