/* ═══════════════════════════════════════════
   Design tokens — matching /app (chat_app)
   ═══════════════════════════════════════════ */
:root {
  --bg:             #0b1120;
  --panel:          rgba(15, 23, 42, 0.96);
  --panel-2:        rgba(17, 24, 39, 0.98);
  --border:         rgba(148, 163, 184, 0.12);
  --border-strong:  rgba(148, 163, 184, 0.22);
  --text:           #f1ece4;
  --muted:          #8b9cb7;
  --muted-strong:   #bcc8db;
  --accent:         #38bdf8;
  --accent-2:       #34d399;
  --accent-alt:     #f5deb3;
  --good:           #34d399;
  --warn:           #fbbf24;
  --bad:            #fb7185;
  --shadow:         0 24px 80px rgba(0, 0, 0, 0.38);
  --shadow-sm:      0 4px 24px rgba(0, 0, 0, 0.26);
  --radius:         22px;
  --radius-sm:      12px;
  --mono:           "Consolas", "SFMono-Regular", ui-monospace, monospace;
  --sans:           "Inter", "DM Sans", -apple-system, "Segoe UI", sans-serif;
  --display:        "Plus Jakarta Sans", "DM Sans", -apple-system, "Segoe UI", sans-serif;
  --safe-top:       env(safe-area-inset-top, 0px);
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
  --safe-left:      env(safe-area-inset-left, 0px);
  --safe-right:     env(safe-area-inset-right, 0px);
  --sidebar-w:      300px;
  color-scheme:     dark;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; -webkit-appearance: none; }
a { text-decoration: none; }

/* ── Ambient bg ── */
.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}
.ambient-a { width: 28rem; height: 28rem; top: -6rem; left: -4rem; background: radial-gradient(circle, rgba(56, 189, 248, 0.8), transparent); }
.ambient-b { width: 22rem; height: 22rem; right: -8rem; top: 12rem; background: radial-gradient(circle, rgba(245, 222, 179, 0.65), transparent); }
.ambient-c { width: 24rem; height: 24rem; bottom: -10rem; right: 14rem; background: radial-gradient(circle, rgba(52, 211, 153, 0.5), transparent); }

/* ── Mobile topbar ── */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 15;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  padding-top: calc(0.65rem + var(--safe-top));
  padding-left: calc(1rem + var(--safe-left));
  padding-right: calc(1rem + var(--safe-right));
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.97), rgba(15, 23, 42, 0.92));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.mobile-topbar .topbar-brand .eyebrow { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mobile-topbar .topbar-brand h2 { font-size: 0.98rem; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Icon button ── */
.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--text);
  transition: background 160ms ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* ── Shell layout ── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ── Sidebar ── */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel-2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 22px 16px;
  padding-top: calc(22px + var(--safe-top));
  padding-bottom: calc(22px + var(--safe-bottom));
  padding-left: calc(16px + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-top .close-btn { display: none; }

.brand { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-title { font-size: 1.4rem; line-height: 1.05; margin-top: 2px; }
.sidebar-sub { color: var(--muted); font-size: 0.83rem; line-height: 1.55; margin-top: 4px; }

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  transition: color 160ms ease;
}
.nav-back:hover { color: var(--text); }

/* ── Design tokens utilities ── */
.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ── Card ── */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Label ── */
.label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

/* ── Select wrapper (custom arrow) ── */
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.select-wrap .select {
  padding-right: 2.2rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.select-chevron {
  position: absolute;
  right: 0.75rem;
  pointer-events: none;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Form elements ── */
.select, .input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.select:focus, .input:focus {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}
.select option { background: #111827; color: var(--text); }
.input::placeholder { color: var(--muted); }

/* ── Buttons ── */
.button {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #0b1424;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.button:hover  { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(56, 189, 248, 0.4); }
.button:active { transform: scale(0.97); }
.button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: none;
}
.button.secondary:hover { background: rgba(255, 255, 255, 0.1); box-shadow: none; }

.button.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted-strong);
  box-shadow: none;
}
.button.ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.button.slim { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.full-btn { width: 100%; }

/* ── Sidebar actions row ── */
.sidebar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Live status badge ── */
.live-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.18);
  color: #a7e8ff;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  align-self: flex-start;
}
.live-status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Location card ── */
.location-card { gap: 10px; }
.location-status-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted-strong);
  line-height: 1.5;
}
.location-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-top: 5px;
  transition: background 380ms ease;
}
.location-dot.active { background: var(--good); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2); }

/* ── Notes card ── */
.notes-card { gap: 8px; }
.notes-text { font-size: 0.8rem; color: var(--muted); line-height: 1.6; }

/* ── Main area ── */
.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  padding-right: calc(22px + var(--safe-right));
  padding-bottom: calc(22px + var(--safe-bottom));
  min-width: 0;
  overflow-y: auto;
}

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 14px;
  padding: 20px 24px;
  background:
    radial-gradient(circle at 75% 20%, rgba(56, 189, 248, 0.12), transparent 38%),
    radial-gradient(circle at 20% 80%, rgba(52, 211, 153, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  align-items: start;
}
.hero-text { grid-column: 1; grid-row: 1; }
.hero-text .eyebrow { margin-bottom: 6px; }
.hero-text h2 { font-size: 1.5rem; }
.hero-copy { color: var(--muted-strong); font-size: 0.85rem; max-width: 520px; margin-top: 6px; line-height: 1.6; }

.hero-stats {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 8px;
  flex-direction: column;
  align-items: flex-end;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  min-width: 80px;
}
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.stat-chip strong { font-size: 0.95rem; margin-top: 2px; font-family: var(--display); }

.hero-nav-links {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sidebar-toggle-btn { display: none; }

/* ── Tab bar ── */
.tab-bar {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { height: 0; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  flex-shrink: 0;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.active {
  color: #0b1424;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 12px rgba(56, 189, 248, 0.3);
}
.tab svg { opacity: 0.7; flex-shrink: 0; }
.tab.active svg { opacity: 1; }

/* ── Tab panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-inner {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.panel-head h3 { font-size: 1.1rem; }
.panel-sub { color: var(--muted); font-size: 0.82rem; margin-top: 4px; line-height: 1.5; }

/* ══ Live workspace (merged Live + Nearby + Map) ══ */
.live-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* ── Left column ── */
.live-left {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Sub-tabs (Vehicles / Nearby) ── */
.sub-tab-bar {
  display: flex;
  gap: 2px;
  padding: 10px 10px 0;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
  margin-bottom: -1px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(56, 189, 248, 0.05);
}

/* ── Sub-panels ── */
.sub-panel { display: none; padding: 14px; }
.sub-panel.active { display: block; }

.nearby-meta-text {
  font-size: 0.82rem;
  color: var(--muted-strong);
  line-height: 1.55;
  margin-bottom: 4px;
}

/* ── Right column: map ── */
.live-right {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 4px;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}
.map-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted-strong);
  font-family: var(--display);
}

.map-wrap { flex: 1; }
.map {
  width: 100%;
  height: 540px;
}

/* ── Route Planner form ── */
.route-form { display: flex; flex-direction: column; gap: 14px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

/* ── Route result ── */
.route-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  min-height: 120px;
}

.route-summary { display: grid; gap: 10px; }
.route-summary strong { font-size: 1rem; }
.route-summary > p { color: var(--muted); font-size: 0.88rem; }

.route-steps { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; }

.route-step {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.15);
}
.route-step strong { display: block; font-size: 0.9rem; margin-bottom: 4px; }
.route-step p { color: var(--muted); font-size: 0.82rem; margin: 0; }

/* ── Vehicle Grid (live feed cards) ── */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.vehicle-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vehicle-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.06);
  transform: translateY(-1px);
}

.vehicle-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vehicle-id { font-weight: 700; font-size: 0.9rem; }
.vehicle-mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.vehicle-mode-badge.rail {
  background: rgba(52, 211, 153, 0.12);
  color: var(--accent-2);
  border-color: rgba(52, 211, 153, 0.2);
}

.vehicle-route { font-size: 0.82rem; color: var(--muted-strong); }
.vehicle-meta { font-size: 0.76rem; color: var(--muted); }
.vehicle-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 4px; }
.vehicle-dot.rail { background: var(--accent-2); }
.vehicle-dot.moving { animation: pulse 1.5s ease infinite; }

/* ── Nearby section ── */
.route-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.route-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  color: var(--text);
  cursor: pointer;
  text-align: left;
  min-width: 180px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.route-chip:hover {
  border-color: rgba(56, 189, 248, 0.38);
  background: rgba(56, 189, 248, 0.07);
  transform: translateY(-1px);
}
.route-chip-title { font-weight: 700; font-size: 0.88rem; }
.route-chip-meta { color: var(--muted); font-size: 0.78rem; }

.nearby-vehicle-list { display: grid; gap: 8px; }

.nearby-vehicle-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}
.nearby-vehicle-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }
.nearby-vehicle-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ── Map ── */
.map-wrap {
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.map {
  width: 100%;
  height: 480px;
}

/* ── Table ── */
.table-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 0.82rem;
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(56, 189, 248, 0.03); }

/* ── Empty state ── */
.empty-state {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: center;
  padding: 28px 16px;
  grid-column: 1 / -1;
}

/* ── Backdrop ── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 20;
}

.permission-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(8, 12, 24, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.permission-modal-card {
  width: min(100%, 28rem);
  padding: 1.2rem;
  display: grid;
  gap: 0.8rem;
  box-shadow: var(--shadow);
}

.permission-modal-card h3 {
  font-size: 1.1rem;
}

.permission-modal-copy {
  color: var(--muted-strong);
  font-size: 0.9rem;
  line-height: 1.7;
}

.permission-modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.08) transparent; }

/* ── Map marker styles ── */
.vehicle-marker-shell { background: transparent; border: none; }

.vehicle-marker {
  min-width: 80px;
  height: 34px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
}
.vehicle-marker.bus  { background: linear-gradient(135deg, rgba(56, 189, 248, 0.88), rgba(52, 211, 153, 0.88)); }
.vehicle-marker.rail { background: linear-gradient(135deg, rgba(245, 222, 179, 0.9), rgba(56, 189, 248, 0.9)); }
.vehicle-marker.is-moving { box-shadow: 0 10px 26px rgba(56, 189, 248, 0.4); }

.vehicle-marker-glyph {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(11, 17, 32, 0.22);
  font-size: 0.95rem;
}

.vehicle-marker-label {
  font-size: 0.7rem; font-weight: 800; line-height: 1;
  color: #0b1424;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.15);
}

.user-location-pin {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.08);
}
.user-location-core {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

/* Collapse live workspace left/right into single column below 1100px */
@media (max-width: 1100px) {
  .live-workspace {
    grid-template-columns: 1fr;
  }
  /* On tablet: map goes below the vehicle list, not sticky */
  .live-right {
    position: static;
  }
  .map { height: 380px; }
}

/* Tablet: sidebar becomes overlay drawer */
@media (max-width: 1060px) {
  .mobile-topbar { display: flex; }
  .sidebar-toggle-btn { display: grid; }

  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 30;
    width: min(88vw, 320px);
    border-radius: 0;
    transform: translateX(-108%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-top .close-btn { display: grid; }

  .main { padding: 14px; padding-bottom: calc(14px + var(--safe-bottom)); }

  .hero { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .hero-stats { grid-column: 1; grid-row: 2; flex-direction: row; align-items: stretch; flex-wrap: wrap; }
  .stat-chip { align-items: flex-start; flex: 1 1 80px; }
  .hero-nav-links { grid-row: 3; }
}

/* Mobile */
@media (max-width: 720px) {
  html { font-size: 14.5px; }

  .tab svg { display: none; }
  .tab { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

  .form-row { grid-template-columns: 1fr; }
  .map { height: 280px; }

  .panel-head { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Vehicle cards: 1 column on mobile so each card is easy to tap */
  .vehicle-grid { grid-template-columns: 1fr; }

  .nearby-vehicle-card { flex-direction: column; align-items: stretch; }
  .nearby-vehicle-meta { align-items: flex-start; }

  .hero { padding: 14px 16px; }
  .hero-text h2 { font-size: 1.2rem; }

  .hide-sm { display: none; }

  .sub-tab { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
  .sub-tab svg { display: none; }

  .permission-modal {
    padding: 1rem;
    align-items: end;
  }

  .permission-modal-card {
    width: 100%;
    border-radius: 22px;
  }

  .permission-modal-actions {
    flex-direction: column;
  }

  .permission-modal-actions .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .tab-bar { border-radius: var(--radius-sm); }
  .tab { padding: 0.4rem 0.6rem; }
  .hide-md { display: none; }
}

@media (max-width: 380px) {
  html { font-size: 13.5px; }
  .main { padding: 10px; }
  .hero { padding: 12px; }
}

/* ── Touch / PWA quality improvements ── */
button, a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.icon-btn, .button, .tab, .sub-tab {
  min-height: 44px;
  min-width: 44px;
}
.tab { min-height: 40px; }
.sub-tab { min-height: 40px; }
.button.slim { min-height: 38px; }

/* Momentum scroll on scrollable containers */
.sidebar,
.main,
.sub-panel,
.vehicle-grid,
.nearby-vehicle-list,
.route-chip-list {
  -webkit-overflow-scrolling: touch;
}

/* Better readability: slightly larger line height on mobile text */
@media (max-width: 720px) {
  .hero-copy, .notes-text, .panel-sub, .nearby-meta-text {
    line-height: 1.65;
  }
  /* Make center-map button easy to tap */
  #centerMapButton, #centerMapButton2 {
    min-height: 44px;
    padding: 0 1.2rem;
  }
  /* Refresh feed + use location: full width stack on very small screens */
  .sidebar-actions {
    flex-direction: column;
  }
  .sidebar-actions .button {
    width: 100%;
  }
  /* Map: give full viewport width, slightly taller on mobile */
  .map { height: 300px; }
}

@media (max-width: 480px) {
  .map { height: 260px; }
  .hero-text h2 { font-size: 1.1rem; }
  .hero-copy { font-size: 0.82rem; }
  /* Stat chips: smaller to fit 3 horizontally */
  .stat-chip { padding: 6px 10px; min-width: 68px; }
  .stat-chip strong { font-size: 0.88rem; }
  .stat-label { font-size: 0.62rem; }
}
