:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-hover: #e2e8f0;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-soft: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --header-bg: #1e293b;
  --header-ink: #f8fafc;
  --header-muted: #94a3b8;
  --chip-active-bg: #1e293b;
  --chip-active-ink: #ffffff;
  --pill-bg: #e2e8f0;
  --pill-ink: #334155;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fefce8;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #182133;
  --surface-hover: #243047;
  --ink: #f1f5f9;
  --ink-muted: #cbd5e1;
  --ink-soft: #94a3b8;
  --border: #1f2937;
  --border-strong: #334155;
  --header-bg: #0f172a;
  --header-ink: #f8fafc;
  --header-muted: #94a3b8;
  --chip-active-bg: #e2e8f0;
  --chip-active-ink: #0f172a;
  --pill-bg: #1f2937;
  --pill-ink: #cbd5e1;
  --danger: #f87171;
  --danger-bg: rgba(220, 38, 38, 0.14);
  --warn: #fbbf24;
  --warn-bg: rgba(217, 119, 6, 0.16);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Header (Muted Neutral Slate) */
.topbar {
  background: var(--header-bg);
  color: var(--header-ink);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-strong);
}

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

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-loc {
  font-size: 0.74rem;
  color: var(--header-muted);
  margin-top: 1px;
  cursor: pointer;
}

.brand-loc:hover {
  color: var(--header-ink);
}

button,
select,
input,
.stop-card,
.dep-row {
  touch-action: manipulation;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--chip-active-bg);
  color: var(--chip-active-ink);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.2);
}

.alerts-btn {
  position: relative;
}

.unread-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--header-bg);
}

.unread-dot[hidden] {
  display: none;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-size: 0.95rem;
  padding: 6px 9px;
  line-height: 1.1;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover {
  background: var(--surface-alt);
}

.error-banner {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Single Compact Filter Bar */
.controls-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}

.gps-compact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-gps {
  background: var(--pill-bg);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-gps:hover {
  background: var(--surface-hover);
}

.loc-select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.8rem;
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 600;
  min-width: 96px;
  flex: 1;
  max-width: 210px;
  outline: none;
}

.loc-select:focus,
.loc-select:focus-visible,
.field-label input:focus,
.field-label select:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.22);
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  border-radius: 9px;
  padding: 3px;
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.line-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.line-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chip.is-active {
  background: var(--chip-active-bg);
  color: var(--chip-active-ink);
  border-color: var(--chip-active-bg);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Bottom Navigation (Mobile / Narrow Screens) */
.bottom-nav {
  display: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.08);
}

.bnav-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bnav-svg {
  display: block;
}

.bnav-btn.is-active {
  background: var(--pill-bg);
  color: var(--ink);
}

.expand-btn {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 9px;
  cursor: pointer;
}

.expand-btn:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel-list {
  overflow-y: auto;
  padding: 14px 16px 28px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.stops-head {
  margin-top: 18px;
}

.updated-text {
  font-size: 0.74rem;
  color: var(--ink-soft);
}

/* Hero Nearest Cards */
.nearest-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hero-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-left: 5px solid var(--line-color);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.hero-card:hover {
  transform: translateY(-1px);
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.hero-dir {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--pill-ink);
  background: var(--pill-bg);
  padding: 2px 7px;
  border-radius: 6px;
}

.hero-dist {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-stop {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink);
}

.hero-dest {
  font-size: 0.84rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.hero-meta {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

.delay-txt {
  color: var(--warn);
  font-weight: 700;
}

.hero-eta {
  text-align: right;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 72px;
  color: var(--ink);
}

.hero-eta.is-urgent {
  border-color: var(--border-strong);
  background: var(--pill-bg);
}

.eta-val {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
}

.eta-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--ink-soft);
  font-weight: 700;
}

/* Line Tags — ONLY place carrying PTV Train Blue / Tram Green / Bus Orange */
.line-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.line-tag.sm {
  font-size: 0.68rem;
  padding: 2px 7px;
}

/* Stop Cards */
.stops-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.stop-card.is-selected {
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.25);
}

.stop-card-head {
  padding: 11px 14px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.stop-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stop-badges {
  display: flex;
  gap: 5px;
}

.stop-name {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink);
}

.stop-suburb {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.dep-list {
  display: flex;
  flex-direction: column;
}

.dep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

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

.dep-row:hover {
  background: var(--surface-alt);
}

.dep-row.is-cancelled {
  background: var(--danger-bg);
}

.dep-left {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.dep-stripe {
  width: 4px;
  border-radius: 4px;
  flex-shrink: 0;
}

.dep-details {
  min-width: 0;
}

.dep-line-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.dir-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--pill-bg);
  color: var(--pill-ink);
}

.plat-badge,
.bay-badge,
.tram-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--ink-muted);
  border: 1px solid var(--border-strong);
  padding: 1px 6px;
  border-radius: 5px;
}

.delay-pill {
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 2px 6px;
  border-radius: 5px;
}

.cancel-pill {
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--danger);
  color: #fff;
  padding: 2px 6px;
  border-radius: 5px;
}

.dep-dest {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dep-sub {
  font-size: 0.74rem;
  color: var(--ink-soft);
  margin-top: 1px;
}

.dep-right {
  text-align: right;
  flex-shrink: 0;
}

.dep-eta {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
}

.dep-eta.strike {
  text-decoration: line-through;
  color: var(--danger);
}

.dep-live {
  display: block;
  font-size: 0.68rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.dep-empty, .hero-empty {
  padding: 14px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-align: center;
}

/* Map Panel */
.panel-map {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.map-fit-fab {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.map-canvas {
  width: 100%;
  flex: 1;
  min-height: 260px;
  background: var(--bg);
}

.map-fallback {
  padding: 32px;
  text-align: center;
  color: var(--ink-soft);
}

/* Custom Leaflet Markers */
.stop-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--pin-color);
  color: #0f172a;
  font-size: 0.66rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s;
}

.stop-pin.dual {
  border-color: var(--pin-color);
  box-shadow: 0 0 0 2px #94a3b8, 0 2px 6px rgba(15, 23, 42, 0.3);
}

.stop-pin-wrapper.is-selected .stop-pin {
  transform: scale(1.28);
  background: #0f172a;
  color: #fff;
}

.user-gps-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1d4ed8;
  border: 3px solid #fff;
  box-shadow: 0 0 10px rgba(29, 78, 216, 0.8);
  position: relative;
}

.user-gps-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2.5px solid #1d4ed8;
  animation: gpsPulse 2s infinite;
}

@keyframes gpsPulse {
  0% { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

.veh-marker {
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 7px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
  text-align: center;
  white-space: nowrap;
}

.veh-popup {
  font-size: 0.8rem;
  line-height: 1.45;
  min-width: 190px;
  color: var(--ink);
}

.veh-popup-head {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
}

.veh-popup-dir {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.veh-delay {
  color: var(--warn);
  font-weight: 700;
  margin-top: 3px;
}

.veh-ontime {
  color: var(--ink-muted);
  font-weight: 700;
  margin-top: 3px;
}

.veh-source {
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Dark Mode Leaflet Popups & Controls */
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

[data-theme="dark"] .leaflet-bar a {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.75);
  color: var(--ink-soft);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px 8px;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}

.field-label input,
.field-label select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.88rem;
  background: var(--surface-alt);
  color: var(--ink);
}

.alert-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-alt);
}

.alert-item.cancelled {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.alert-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.alert-sev {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.alert-item h4 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.alert-item p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.api-guide {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  margin-bottom: 12px;
}

.api-guide p {
  margin: 4px 0 0;
  color: var(--ink-muted);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-result {
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 20px;
}

.test-result.ok {
  color: var(--ink);
}

.test-result.err {
  color: var(--danger);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* Line View Modal (Vertical Linear Diagram + Both-Direction Live Vehicles) */
.line-modal-card {
  max-width: 440px;
}

.line-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.line-modal-title h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lv-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 10px;
  margin-bottom: 14px;
}

.lv-sum-stop {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.lv-sum-dest {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.lv-sum-meta {
  font-size: 0.74rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.lv-cancel {
  color: var(--danger);
}

.lv-sum-eta {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  flex-shrink: 0;
}

.lv-sum-eta.strike {
  text-decoration: line-through;
  color: var(--danger);
}

.lv-lanes-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 24px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.lv-dir-legend {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
}

.lv-lbl-left {
  width: 50px;
  text-align: left;
  white-space: nowrap;
}

.lv-lbl-right {
  margin-left: 14px;
  text-align: left;
  white-space: nowrap;
}

.lv-vcanvas {
  position: relative;
  width: 100%;
  margin: 4px 0;
}

.lv-vrail {
  position: absolute;
  left: 48px;
  width: 5px;
  border-radius: 999px;
  opacity: 0.85;
}

.lv-vstop {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.lv-vdot {
  position: absolute;
  left: 41px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--border-strong);
  z-index: 2;
}

.lv-vstop.is-tapped .lv-vdot {
  transform: scale(1.22);
  background: var(--ink);
  box-shadow: inset 0 0 0 2.5px var(--surface);
}

.lv-vlabel {
  margin-left: 112px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lv-vcanvas.is-single .lv-vlabel {
  margin-left: 74px;
}

.lv-vname {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.lv-vstop.is-tapped .lv-vname {
  font-weight: 800;
  color: var(--ink);
}

.lv-vstop.is-context .lv-vdot {
  width: 13px;
  height: 13px;
  left: 44px;
  border-width: 3px;
}

.lv-vstop.is-context .lv-vname {
  font-size: 0.76rem;
  font-style: italic;
  color: var(--ink-soft);
}

.lv-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-ink);
}

.lv-tag.is-you {
  background: var(--ink);
  color: var(--surface);
}

.lv-vveh {
  position: absolute;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 3;
  transition: top 1.4s linear;
}

.lv-vlane-left {
  left: 8px;
}

.lv-vlane-right {
  left: 66px;
}

/* Responsive Mobile / Narrow Layout */
@media (max-width: 899px) {
  .bottom-nav {
    display: flex;
  }

  .controls-bar {
    padding: 8px 12px;
  }

  .loc-select,
  .field-label input,
  .field-label select {
    font-size: 16px;
  }

  .btn-gps,
  .btn-icon,
  .alerts-btn {
    min-height: 38px;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .seg-btn {
    padding: 8px 6px;
    font-size: 0.82rem;
  }

  .chip {
    padding: 8px 13px;
    font-size: 0.82rem;
  }

  .panel-list {
    padding: 12px 12px 20px;
    border-right: none;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .main-layout[data-mobile-view="list"] .panel-map {
    display: none;
  }

  .main-layout[data-mobile-view="map"] .panel-list {
    display: none;
  }
}

/* Native Bottom-Sheet Modals on Phone Screens */
@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    max-height: 86dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
