  :root {
    /* Fallbacks; JS below will set accurate values after load */
    --header-h: 72px;     /* adjust if your header is taller */
    --toolbar-h: 56px;
  }

  /* Layout: sidebar + main */
  .map-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    min-height: calc(100vh - var(--header-h));
  }

  /* Sidebar (tour list) */
  .sidebar {
    border-right: 1px solid #eee;
    background: var(--bs-body-bg);
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow: auto;
  }

  .sidebar .sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
  }

  .tour-list {
    padding: 8px 8px 16px;
  }
  .tour-item {
    display: block;
    padding: 10px 12px;
    margin: 6px 8px;
    border: 1px solid #eee;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
  }
  .tour-item.active {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(13,110,253,.08);
  }

  /* Main column */
  .main-col {
    min-width: 0; /* prevent overflow */
  }

  /* Toolbar: sticky under header */
.toolbar {
  /* no sticky → it scrolls with the page */
  position: relative;
  z-index: 1020;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
  background-color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.03);
}


  .toolbar label {
    font-size: 14px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }

  .toolbar select {
    max-width: 140px;
  }

  .toolbar input[type="range"] {
    margin-left: 6px;
    width: 160px;
  }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 999px;
    font-size: 13px;
    background-color: #fafafa;
  }

  .chip input[type="checkbox"] {
    margin: 0;
  }

  .legend {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .badge {
    padding: 2px 6px;
    background: #eee;
    border-radius: 6px;
    margin-left: 6px;
    font-size: 12px;
    color: #729B79 !important;
  }

  #svToggle {
    white-space: nowrap;
  }

  /* Make Street View + distance stick to the right on desktop */
  .toolbar .toolbar-spacer {
    flex: 1 1 auto;
  }

  /* Map area: fill remaining space under toolbar */
  .map-wrap {
    height: calc(100vh - var(--header-h) - var(--toolbar-h));
  }
  #map { height: 55%; width: 100%; }
  #pano { height: 45%; width: 100%; display: none; }

  /* When Street View is closed, map can use more space */
  .map-wrap.full-map #map { height: 100%; }
  .map-wrap.full-map #pano { height: 0; display: none; }

  /* Responsive: collapse sidebar on small screens */
  @media (max-width: 991.98px) {
    .map-layout {
      grid-template-columns: 1fr;
    }
    .sidebar {
      position: static;
      height: auto;
      border-right: none;
      border-bottom: 1px solid #eee;
    }
  }

  /* Toolbar mobile layout */
  @media (max-width: 767.98px) {
    .toolbar {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
    }

    .toolbar label {
      justify-content: space-between;
      width: 100%;
      white-space: normal;
    }

    .toolbar select {
      max-width: 100%;
    }

    .toolbar input[type="range"] {
      width: 100%;
    }

    .legend {
      width: 100%;
      justify-content: flex-start;
    }

    #svToggle,
    #distanceLabel {
      align-self: flex-start;
    }

    .toolbar .toolbar-spacer {
      display: none;
    }
  }