/* ==========================================================================
   ВОИ Навигатор — Полноэкранное мобильное PWA-приложение (Material Design 3)
   Инклюзивный дизайн, плавные анимации, поддержка версий для слабовидящих
   ========================================================================== */

:root {
  --nav-bg: #f8fafc;
  --nav-surface: #ffffff;
  --nav-surface-glass: rgba(255, 255, 255, 0.94);
  --nav-surface-subtle: #f1f5f9;
  --nav-border: rgba(15, 23, 42, 0.1);
  --nav-text: #0f172a;
  --nav-text-muted: #475569;
  --nav-accent: #2563eb;
  --nav-accent-dark: #1d4ed8;
  --nav-safe: #047857;
  --nav-road: #dc2626;
  --nav-warn: #ea580c;
  --nav-radius-lg: 24px;
  --nav-radius-md: 16px;
  --nav-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --nav-bar-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--nav-bg);
  color: var(--nav-text);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.font-heading {
  font-family: "Montserrat", "Manrope", sans-serif;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================================
   APP SHELL (100dvh full-bleed map + MD3 bottom bar)
   ========================================================================== */
.nav-app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--nav-bg);
}

.nav-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: #e2e8f0;
}

#nav-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #e5eef5;
}

/* Hide default Leaflet controls since we use custom MD3 thumb-zone controls */
#nav-map .leaflet-control-zoom,
#nav-map .leaflet-control-attribution {
  display: none !important;
}

#nav-map.is-picking {
  cursor: crosshair !important;
}
#nav-map.is-picking * {
  cursor: crosshair !important;
}

/* ==========================================================================
   FLOATING TOP BAR & QUICK FILTER CHIPS
   ========================================================================== */
.nav-top-dock {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 420;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  animation: navDropIn 0.45s var(--nav-spring) both;
}

@media (min-width: 768px) {
  .nav-top-dock {
    left: 20px;
    right: auto;
    width: min(460px, calc(100vw - 40px));
  }
}

.nav-search-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border-radius: 18px;
  background: var(--nav-surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--nav-border);
  box-shadow: 0 10px 28px -8px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s var(--nav-spring);
}

.nav-icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 13px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.16s var(--nav-bounce), background-color 0.18s ease, box-shadow 0.18s ease;
}

.nav-icon-btn:active {
  transform: scale(0.92);
}

.nav-icon-btn--brand {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #1d4ed8;
}
.nav-icon-btn--brand:hover {
  background: #dbeafe;
}

.nav-icon-btn--ghost {
  background: transparent;
  color: #475569;
}
.nav-icon-btn--ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.nav-icon-btn--ghost.is-listening {
  background: #fee2e2;
  color: #dc2626;
  animation: navVoicePulse 1.1s ease-in-out infinite;
}

.nav-icon-btn--a11y {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.nav-icon-btn--a11y:hover {
  background: #1d4ed8;
}

.nav-search-trigger {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Horizontal Filter Chips Carousel */
.nav-chips-wrap {
  position: relative;
  pointer-events: auto;
  margin-left: -12px;
  margin-right: -12px;
}

@media (min-width: 768px) {
  .nav-chips-wrap {
    margin-left: -4px;
    margin-right: -4px;
  }
}

.nav-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 36px 6px 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  .nav-chips-row {
    padding: 2px 36px 6px 4px;
  }
}

.nav-chips-wrap.has-more .nav-chips-row {
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 88%, transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 88%, transparent 100%);
}

.nav-chips-arrow {
  position: absolute;
  right: 6px;
  top: 3px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  color: #1e293b;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  z-index: 5;
  transition: opacity 0.2s ease, transform 0.16s var(--nav-bounce);
}

.nav-chips-arrow:active {
  transform: scale(0.9);
}

.nav-chips-wrap:not(.has-more) .nav-chips-arrow {
  opacity: 0;
  pointer-events: none;
}

.nav-chip {
  min-height: 34px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: var(--nav-surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  cursor: pointer;
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.13);
  transition: transform 0.16s var(--nav-bounce), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-chip:active {
  transform: scale(0.94);
}

.nav-chip--primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.nav-chip--active-green {
  background: #047857;
  color: #ffffff;
  border-color: #047857;
}

.nav-chip--active-blue {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.nav-chip--active-red {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.nav-chip--reset {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.nav-chip-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.nav-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ==========================================================================
   FLOATING CONTEXT BANNERS (OFFLINE, MODE HINTS, ROUTE SUMMARY)
   ========================================================================== */
.nav-status-stack {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 106px);
  left: 12px;
  right: 12px;
  z-index: 410;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 768px) {
  .nav-status-stack {
    left: 20px;
    right: auto;
    width: min(460px, calc(100vw - 40px));
  }
}

.nav-offline-pill {
  pointer-events: auto;
  align-self: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: #1e293b;
  color: #fef08a;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: navPopIn 0.28s var(--nav-spring) both;
}

.nav-update-banner {
  pointer-events: auto;
  border-radius: 18px;
  padding: 10px 12px;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 14px 32px -8px rgba(15, 23, 42, 0.34);
  animation: navPopIn 0.3s var(--nav-spring) both;
}

.nav-mode-hint {
  pointer-events: auto;
  align-self: center;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.25);
  animation: navPopIn 0.28s var(--nav-spring) both;
}

.nav-mode-hint--pick {
  background: #dc2626;
  color: #ffffff;
}

.nav-mode-hint--pano {
  background: #ffea66;
  color: #0f172a;
  border: 1px solid #f59e0b;
}

.nav-route-banner {
  pointer-events: auto;
  border-radius: 20px;
  padding: 12px 14px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 14px 32px -8px rgba(15, 23, 42, 0.28);
  animation: navPopIn 0.32s var(--nav-spring) both;
}

.nav-route-banner--safe {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
}
.nav-route-banner--walk {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
}
.nav-route-banner--car {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
}

/* ==========================================================================
   RIGHT THUMB-ZONE MAP CONTROLS & LEFT RED REPORT FAB
   ========================================================================== */
.nav-map-controls {
  position: absolute;
  right: 12px;
  bottom: 22px;
  z-index: 410;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.32s var(--nav-spring), opacity 0.22s ease;
}

@media (min-width: 768px) {
  .nav-map-controls {
    right: 20px;
    bottom: 26px;
  }
}

.nav-map-controls.is-lifted {
  transform: translateY(-195px);
}
.nav-map-controls.is-lifted-sm {
  transform: translateY(-136px);
}

.nav-ctrl-btn {
  width: 56px;
  height: 54px;
  padding: 4px 2px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.11);
  background: var(--nav-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.18);
  transition: transform 0.16s var(--nav-bounce), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-ctrl-btn:active {
  transform: scale(0.92);
}

.nav-ctrl-btn__lbl {
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.nav-ctrl-btn--pano {
  background: rgba(255, 249, 214, 0.96);
  border-color: #f59e0b;
  color: #0f172a;
}
.nav-ctrl-btn--pano.is-active {
  background: #ffea66;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.32), 0 8px 20px rgba(15, 23, 42, 0.2);
}

.nav-ctrl-btn--gps {
  height: 50px;
  color: #2563eb;
}

.nav-zoom-group {
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.11);
  background: var(--nav-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.nav-zoom-btn {
  width: 56px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.nav-zoom-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}
.nav-zoom-btn:active {
  background: rgba(37, 99, 235, 0.12);
}
.nav-zoom-btn + .nav-zoom-btn {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

/* Primary Bottom-Left Red FAB */
.nav-report-fab {
  position: absolute;
  left: 12px;
  bottom: 30px;
  z-index: 410;
  height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  border: 0;
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
  font-family: "Montserrat", "Manrope", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 12px 26px -6px rgba(220, 38, 38, 0.45);
  transition: transform 0.22s var(--nav-bounce), opacity 0.22s ease, box-shadow 0.2s ease;
  animation: navRiseIn 0.45s var(--nav-spring) 0.1s both;
}

@media (min-width: 768px) {
  .nav-report-fab {
    left: 20px;
    bottom: 34px;
  }
}

.nav-report-fab:hover {
  box-shadow: 0 16px 32px -6px rgba(220, 38, 38, 0.52);
}
.nav-report-fab:active {
  transform: scale(0.95);
}
.nav-report-fab.is-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.92);
  pointer-events: none;
}

/* OSM Attribution Badge */
.nav-osm-badge {
  position: absolute;
  left: 12px;
  bottom: 5px;
  z-index: 405;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: #475569;
  font-size: 10px;
  line-height: 1.45;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.nav-osm-badge:hover {
  background: #ffffff;
  color: #0f172a;
}

/* ==========================================================================
   FLOATING BOTTOM CARDS (PICK MODE, ROUTE PICK, PANO MODE, DENSE CAROUSEL)
   ========================================================================== */
.nav-float-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  z-index: 440;
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 20px 44px -12px rgba(15, 23, 42, 0.34);
  transition: transform 0.34s var(--nav-spring), opacity 0.24s ease;
}

@media (min-width: 768px) {
  .nav-float-card {
    left: 20px;
    right: auto;
    width: min(460px, calc(100vw - 40px));
  }
}

.nav-float-card--dark {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-float-card--carousel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.1);
  padding: 12px 14px 14px;
}

.nav-float-card.is-hidden {
  transform: translateY(115%);
  opacity: 0;
  pointer-events: none;
}

/* Route Barrier Carousel Card */
.nav-carousel-card {
  flex: 0 0 auto;
  width: 224px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.18s var(--nav-bounce), border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-carousel-card:active {
  transform: scale(0.96);
}

.nav-carousel-card.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 6px 18px -6px rgba(37, 99, 235, 0.28);
}

/* ==========================================================================
   BACKDROP & MATERIAL DESIGN 3 BOTTOM SHEETS
   ========================================================================== */
.nav-backdrop {
  position: absolute;
  inset: 0;
  z-index: 460;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.nav-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nav-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 480;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--nav-surface);
  color: var(--nav-text);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -16px 48px -12px rgba(15, 23, 42, 0.24);
  transform: translateY(105%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.36s var(--nav-spring), opacity 0.24s ease;
  will-change: transform, opacity;
}

@media (min-width: 768px) {
  .nav-sheet {
    left: 20px;
    right: auto;
    bottom: 16px;
    width: min(460px, calc(100vw - 40px));
    max-height: calc(100% - 32px);
    border-radius: 26px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.28);
  }
}

.nav-sheet.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.nav-sheet__handle-wrap {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.nav-sheet__handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: #cbd5e1;
}

.nav-sheet__header {
  padding: 0 18px 12px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
  background: var(--nav-surface);
}

.nav-sheet__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 18px 18px;
}

.nav-sheet__footer {
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e2e8f0;
  background: var(--nav-surface);
  flex-shrink: 0;
}

/* ==========================================================================
   ROUTE PROFILE CARDS (3-COLOR TRIAD: GREEN SAFE / BLUE WALK / RED ROAD)
   ========================================================================== */
.nav-mode-card {
  flex: 0 0 auto;
  min-width: 186px;
  padding: 12px;
  border-radius: 18px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.16s var(--nav-bounce), border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-mode-card:active {
  transform: scale(0.96);
}

.nav-mode-card.is-active[data-mode="safe_wheelchair"] {
  border-color: #047857;
  background: #ecfdf5;
  box-shadow: 0 6px 18px -6px rgba(4, 120, 87, 0.28);
}

.nav-mode-card.is-active[data-mode="foot_direct"] {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 6px 18px -6px rgba(37, 99, 235, 0.28);
}

.nav-mode-card.is-active[data-mode="car_road"] {
  border-color: #dc2626;
  background: #fef2f2;
  box-shadow: 0 6px 18px -6px rgba(220, 38, 38, 0.28);
}

/* Autocomplete Dropdown inside Route Sheet */
.nav-suggest-list {
  margin-top: 6px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.nav-suggest-item {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background-color 0.15s ease;
}

.nav-suggest-item:last-child {
  border-bottom: 0;
}

.nav-suggest-item:hover {
  background: #eff6ff;
}

/* ==========================================================================
   FILTER CARDS & ANDROID MATERIAL 3 SWITCHES
   ========================================================================== */
.nav-sev-card {
  min-height: 86px;
  padding: 10px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.16s var(--nav-bounce), border-color 0.18s ease, background-color 0.18s ease;
}

.nav-sev-card:active {
  transform: scale(0.96);
}

.nav-sev-card.is-active {
  border-color: #2563eb;
  background: #eff6ff;
}

.nav-obs-btn {
  min-height: 44px;
  padding: 8px 13px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.16s var(--nav-bounce), border-color 0.18s ease, background-color 0.18s ease;
}

.nav-obs-btn:active {
  transform: scale(0.96);
}

.nav-obs-btn.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #0f172a;
}

.nav-switch {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  padding: 3px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: background-color 0.22s ease;
}

.nav-switch__knob {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
  transform: translateX(0);
  transition: transform 0.24s var(--nav-spring);
}

.nav-switch.is-on {
  background: #2563eb;
}
.nav-switch.is-on--green {
  background: #059669;
}
.nav-switch.is-on .nav-switch__knob {
  transform: translateX(20px);
}

/* ==========================================================================
   MATERIAL DESIGN 3 BOTTOM NAVIGATION BAR
   ========================================================================== */
.nav-bottom-bar {
  position: relative;
  z-index: 450;
  flex-shrink: 0;
  height: calc(var(--nav-bar-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 8px env(safe-area-inset-bottom, 0px);
  background: #ffffff;
  border-top: 1px solid rgba(15, 23, 42, 0.09);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  box-shadow: 0 -4px 20px -8px rgba(15, 23, 42, 0.1);
}

.nav-tab-btn {
  min-height: 54px;
  border: 0;
  background: transparent;
  color: #64748b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.nav-tab-btn__pill {
  width: 60px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background-color 0.22s ease, transform 0.22s var(--nav-bounce);
}

.nav-tab-btn:active .nav-tab-btn__pill {
  transform: scale(0.9);
}

.nav-tab-btn__label {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.nav-tab-btn.is-active {
  color: #1d4ed8;
}
.nav-tab-btn.is-active .nav-tab-btn__pill {
  background: #dbeafe;
}
.nav-tab-btn.is-active[data-tab="report"] {
  color: #dc2626;
}
.nav-tab-btn.is-active[data-tab="report"] .nav-tab-btn__pill {
  background: #fee2e2;
}

/* ==========================================================================
   LEAFLET CUSTOM MARKERS, CLUSTERS, NUMBERED ROUTE PINS & ANIMATIONS
   ========================================================================== */
.nav-marker-wrap {
  background: transparent !important;
  border: 0 !important;
}

.nav-pin {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.3);
  transition: transform 0.22s var(--nav-bounce), opacity 0.25s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.nav-pin::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: inherit;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  z-index: -1;
}

.nav-pin:hover,
.nav-pin.is-selected {
  transform: scale(1.16);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.28), 0 10px 22px rgba(15, 23, 42, 0.34);
}

.nav-pin.is-dimmed {
  opacity: 0.26;
  transform: scale(0.68);
  pointer-events: none;
}

.nav-pin--impassable { background: #dc2626; }
.nav-pin--hard { background: #ea580c; }
.nav-pin--tolerable { background: #d97706; }
.nav-pin--fixed { background: #059669; }

/* Cluster Bubble */
.nav-cluster {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.32);
  cursor: pointer;
  transition: transform 0.2s var(--nav-bounce), box-shadow 0.2s ease;
  font-variant-numeric: tabular-nums;
}

.nav-cluster:hover {
  transform: scale(1.12);
}

.nav-cluster--impassable { background: #dc2626; box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.24), 0 8px 18px rgba(15, 23, 42, 0.28); }
.nav-cluster--hard { background: #ea580c; box-shadow: 0 0 0 5px rgba(234, 88, 12, 0.24), 0 8px 18px rgba(15, 23, 42, 0.28); }
.nav-cluster--tolerable { background: #d97706; box-shadow: 0 0 0 5px rgba(217, 119, 6, 0.24), 0 8px 18px rgba(15, 23, 42, 0.28); }
.nav-cluster--fixed { background: #059669; box-shadow: 0 0 0 5px rgba(5, 150, 105, 0.24), 0 8px 18px rgba(15, 23, 42, 0.28); }

/* Numbered Route Barrier Pin */
.nav-route-num {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.32);
  transition: transform 0.2s var(--nav-bounce), box-shadow 0.2s ease;
  cursor: pointer;
}

.nav-route-num.is-active {
  transform: scale(1.26);
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.35), 0 10px 22px rgba(15, 23, 42, 0.36);
}

/* Route A / B / Detour Endpoints */
.nav-endpoint {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  color: #ffffff;
  font-family: "Montserrat", sans-serif;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.34);
}
.nav-endpoint--a { background: #1d4ed8; }
.nav-endpoint--b { background: #047857; }
.nav-endpoint--detour { background: #7c3aed; font-size: 12px; }

/* Picked Pin Drop Animation */
.nav-picked-pin {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.35);
  animation: navPinDrop 0.38s var(--nav-bounce) both;
}
.nav-picked-pin--report {
  background: #dc2626;
  color: #ffffff;
}
.nav-picked-pin--pano {
  background: #ffea66;
  color: #0f172a;
  font-family: "Montserrat", sans-serif;
  font-weight: 900;
  font-size: 12px;
}

/* User GPS Beacon */
.nav-gps-beacon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: navGpsPulse 2s ease-out infinite;
}
.nav-gps-beacon__dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #2563eb;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5);
}

/* Animated Route Dash Flow */
.nav-route-flow {
  stroke-dasharray: 10 10;
  animation: navDashFlow 1.1s linear infinite;
}

/* Toast Notification */
.nav-toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 92px;
  z-index: 520;
  margin: 0 auto;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.42);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.28s var(--nav-spring);
}

.nav-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Loading Overlay Pill */
.nav-loading-pill {
  pointer-events: auto;
  align-self: center;
  padding: 9px 16px;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #bfdbfe;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.nav-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2.5px solid #dbeafe;
  border-top-color: #2563eb;
  animation: navSpin 0.7s linear infinite;
}

/* ==========================================================================
   KEYFRAMES
   ========================================================================== */
@keyframes navDropIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes navRiseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes navPopIn {
  from { opacity: 0; transform: scale(0.94) translateY(-6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes navPinDrop {
  0% { opacity: 0; transform: translateY(-28px) scale(0.7); }
  70% { opacity: 1; transform: translateY(4px) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes navDashFlow {
  to { stroke-dashoffset: -20; }
}

@keyframes navGpsPulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
  70% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

@keyframes navVoicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

@keyframes navSpin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   HIGH CONTRAST & ACCESSIBILITY MODES (Synced with main site localStorage)
   ========================================================================== */
body.high-contrast,
body.high-contrast .nav-app {
  background: #ffffff !important;
  color: #000000 !important;
}

body.high-contrast .nav-search-bar,
body.high-contrast .nav-sheet,
body.high-contrast .nav-sheet__header,
body.high-contrast .nav-sheet__footer,
body.high-contrast .nav-bottom-bar,
body.high-contrast .nav-ctrl-btn,
body.high-contrast .nav-zoom-group,
body.high-contrast .nav-chip,
body.high-contrast .nav-float-card--carousel,
body.high-contrast .nav-mode-card,
body.high-contrast .nav-sev-card,
body.high-contrast .nav-obs-btn,
body.high-contrast .nav-carousel-card,
body.high-contrast .nav-a11y-box {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  box-shadow: none !important;
}

body.high-contrast .nav-chip--primary,
body.high-contrast .nav-chip--active-green,
body.high-contrast .nav-chip--active-blue,
body.high-contrast .nav-chip--active-red,
body.high-contrast .nav-report-fab,
body.high-contrast .nav-icon-btn--a11y,
body.high-contrast .nav-tab-btn.is-active .nav-tab-btn__pill,
body.high-contrast .nav-mode-card.is-active,
body.high-contrast .nav-sev-card.is-active,
body.high-contrast .nav-obs-btn.is-active {
  background: #000000 !important;
  color: #ffffff !important;
  border-color: #000000 !important;
}

body.high-contrast .nav-mode-card.is-active *,
body.high-contrast .nav-sev-card.is-active *,
body.high-contrast .nav-obs-btn.is-active * {
  color: #ffffff !important;
}

body.high-contrast #nav-map .leaflet-tile-pane {
  filter: grayscale(100%) contrast(1.45);
}

/* Yellow on Black High-Contrast Theme */
body.high-contrast-yellow,
body.high-contrast-yellow .nav-app {
  background: #000000 !important;
  color: #ffea00 !important;
}

body.high-contrast-yellow .nav-search-bar,
body.high-contrast-yellow .nav-sheet,
body.high-contrast-yellow .nav-sheet__header,
body.high-contrast-yellow .nav-sheet__footer,
body.high-contrast-yellow .nav-bottom-bar,
body.high-contrast-yellow .nav-ctrl-btn,
body.high-contrast-yellow .nav-zoom-group,
body.high-contrast-yellow .nav-chip,
body.high-contrast-yellow .nav-float-card--carousel,
body.high-contrast-yellow .nav-float-card--dark,
body.high-contrast-yellow .nav-mode-card,
body.high-contrast-yellow .nav-sev-card,
body.high-contrast-yellow .nav-obs-btn,
body.high-contrast-yellow .nav-carousel-card,
body.high-contrast-yellow .nav-a11y-box,
body.high-contrast-yellow input {
  background: #000000 !important;
  color: #ffea00 !important;
  border: 2px solid #ffea00 !important;
  box-shadow: none !important;
}

body.high-contrast-yellow .nav-sheet p,
body.high-contrast-yellow .nav-sheet span,
body.high-contrast-yellow .nav-sheet h2,
body.high-contrast-yellow .nav-sheet h3,
body.high-contrast-yellow .nav-sheet label,
body.high-contrast-yellow .nav-search-trigger,
body.high-contrast-yellow .nav-tab-btn,
body.high-contrast-yellow .nav-zoom-btn {
  color: #ffea00 !important;
}

body.high-contrast-yellow .nav-report-fab,
body.high-contrast-yellow .nav-icon-btn--a11y,
body.high-contrast-yellow .nav-btn-primary,
body.high-contrast-yellow .nav-chip--primary,
body.high-contrast-yellow .nav-chip--active-green,
body.high-contrast-yellow .nav-chip--active-blue,
body.high-contrast-yellow .nav-chip--active-red,
body.high-contrast-yellow .nav-tab-btn.is-active .nav-tab-btn__pill {
  background: #ffea00 !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

body.high-contrast-yellow .nav-btn-primary *,
body.high-contrast-yellow .nav-report-fab *,
body.high-contrast-yellow .nav-icon-btn--a11y *,
body.high-contrast-yellow .nav-tab-btn.is-active .nav-tab-btn__pill * {
  color: #000000 !important;
}

body.high-contrast-yellow #nav-map .leaflet-tile-pane {
  filter: contrast(1.45) brightness(0.85) saturate(0.5);
}

/* ==========================================================================
   REDUCED MOTION COMPLIANCE
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* Focus visibility */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* Guarantee .hidden always beats unlayered display:flex / inline-flex rules (Tailwind v4 cascade layer fix) */
.hidden,
[hidden] {
  display: none !important;
}
