/* ─────────────────────────────────────────
   APP SHELL
───────────────────────────────────────── */
body { position: relative; }

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background-color: #7f7f7f; /* overridden per-layer by JS */
}

.app-overlays {
  position: relative;
  z-index: 1000;
}

/* ─────────────────────────────────────────
   TOP BAR
───────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 600;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-center {
  flex: 1 1 auto;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-logo {
  display: block;
  height: 1.6rem;
  width: auto;
  flex: 0 0 auto;
}

.topbar-title {
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 800;
  font-family: 'Oswald', system-ui, sans-serif;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.topbar-slash {
  color: var(--text-primary);
  font-size: 1.6rem;
  line-height: 1;
}

.title-region-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.title-region-picker select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.6rem;
  font-weight: 400;
  padding: 0 24px 0 0;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
  font-family: 'Oswald', system-ui, sans-serif;
  text-transform: uppercase;
}
.title-region-picker select:hover,
.title-region-picker select:focus { color: var(--accent-hover); }

.title-region-chevron {
  position: absolute;
  right: 0;
  color: var(--text-primary);
  font-size: 2rem;
  pointer-events: none;
}

.header-link-btn {
  background: transparent;
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.header-link-btn:hover,
.header-link-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(215, 173, 49, 0.08);
  outline: none;
}

.layer-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 4px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.layer-btn:hover { color: var(--text-primary); background: var(--border); }
.layer-btn.active {
  background: var(--accent);
  color: var(--bg-dark);
  font-weight: 700;
}

/* ─────────────────────────────────────────
   FLOATING PANEL (Google Maps-style drawer)
───────────────────────────────────────── */
.map-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  right: 16px;
  z-index: 500;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - var(--topbar-h) - 32px);

  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--ui-border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.25);

  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.3s ease;
}

.map-panel.panel-hidden {
  width: var(--ui-element-dimension);
  border-width: 0;
  border-radius: var(--ui-border-radius);
}

/* ── Right panel stack (POI info above legend) ── */
.panels {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  pointer-events: none;
  z-index: 500;
  gap: 16px;
}

.panels-right {
  flex: 0 0 auto;
  align-self: stretch;
  width: fit-content;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  pointer-events: none;
}

.panels-left {
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.panels-left-top {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.panels-left-bottom {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.map-mode-control { display: block; }

.panels-right .map-panel,
.map-mode-control,
.left-search-wrap,
.left-search-input-wrap,
.left-search-tags,
.left-search-tags-wrap,
.left-layers-control {
  pointer-events: auto;
}

.left-json-btn {
  width: 100%;
  height: 100%;
}

.left-json-btn img {
  width: 18px;
  height: 18px;
}

.left-layers-control {
  width: var(--ui-element-dimension);
  height: var(--ui-element-dimension);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--ui-border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.25);
}

.left-json-control[hidden] {
  display: none;
}

.left-layers-btn {
  width: 100%;
  height: 100%;
}

.left-layers-btn img {
  width: 18px;
  height: 18px;
}

.left-layers-btn.active {
  background: var(--accent);
}

.left-layers-btn.active img {
  filter: brightness(0);
}

.left-layer-selector[hidden] {
  display: none;
}

.left-layer-selector {
  pointer-events: auto;
}

.left-layer-tabs {
  min-height: var(--ui-element-dimension);
}

.left-layer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ui-element-dimension);
  height: var(--ui-element-dimension);
  padding: 0;
}

.left-layer-btn img {
  width: 18px;
  height: 18px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.left-layer-btn:hover img,
.left-layer-btn.active img {
  opacity: 1;
}

.mobile-legend-control {
  display: none;
  pointer-events: auto;
}

.mobile-legend-btn {
  width: 100%;
  height: 100%;
}

.panels-right .map-panel {
  position: static;
  top: auto;
  right: auto;
  z-index: 950;
}

/* Wrapper that collapses to 0 when POI panel is hidden */
.panel-wrapper {
  display: none;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              display 0s 0.3s;
  transition-behavior: allow-discrete;
}

.panel-wrapper.panel-visible {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              display 0s;
  transition-behavior: allow-discrete;
}

@starting-style {
  .panel-wrapper.panel-visible {
    grid-template-rows: 0fr;
  }
}

.panel-wrapper > .map-panel {
  overflow: hidden;
  min-height: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.panel-wrapper.panel-visible > .map-panel {
  opacity: 1;
  transition: opacity 0.2s ease 0.05s;
}

/* ─────────────────────────────────────────
   PANEL HEADER
───────────────────────────────────────── */
.panel-header {
  flex: 0 0 auto;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  z-index: 2;
  transition: border-color 0.15s ease;
}

.map-panel.panel-hidden .panel-header {
  border-bottom-color: transparent;
}

.panel-drag-handle {
  display: none; /* shown on mobile only */
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 10px auto 4px;
  cursor: ns-resize;
  flex-shrink: 0;
}

.panel-header-row {
  display: grid;
  grid-template-columns: 1fr 36px;
  align-items: center;
  gap: 4px;
  padding: 16px;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-panel.panel-hidden .panel-header-row {
  grid-template-columns: 0fr 36px;
  padding: calc((var(--ui-element-dimension) - 36px) / 2);
  gap: 0;
}

.panel-header-collapsible {
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  opacity: 1;
  height: auto;
  transition: opacity 0.15s ease, height 0s 0.15s;
}

.map-panel.panel-hidden .panel-header-collapsible {
  opacity: 0;
  height: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, height 0s 0.15s;
}

.panel-header-title {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 4px;
}

.panel-title {
  font-size: 1.2rem;
  line-height: 1.1;
  color: var(--text-primary);
  font-family: 'Oswald', system-ui, sans-serif;
  text-transform: uppercase;
  font-weight: 400;
  letter-spacing: 0.05rem;
}

.sticky-section {
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 2;
  padding-top: var(--ui-control-padding);
  padding-bottom: var(--ui-control-padding);
}

.panel-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.panel-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.panel-btn img {
  width: 18px;
  height: 18px;
}
.panel-btn:hover { background: var(--bg-panel2); }
.panel-btn[hidden] { display: none; }
.panel-btn.all-hidden img { opacity: 0.4; }

.panel-title-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
}

.legend-search-input {
  width: 100%;
  height: 36px;
  padding: 0 calc(var(--ui-control-padding) * 4) 0 calc(var(--ui-control-padding) + 2px);
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel2);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
}
.legend-search-input::placeholder { color: var(--text-muted); }
.legend-search-input:focus {
  outline: none;
  border-color: rgba(215, 173, 49, 0.5);
  box-shadow: 0 0 0 3px rgba(215, 173, 49, 0.12);
}

.legend-filter-clear {
  position: absolute;
  top: 50%;
  right: var(--ui-control-padding);
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.legend-filter-clear[hidden] { display: none; }
.legend-filter-clear:hover { color: var(--accent); }

/* ─────────────────────────────────────────
   FLOATING MODE CONTROL (bottom-left)
───────────────────────────────────────── */

/* Mode tabs */
.panel-mode-tabs {
  display: flex;
  gap: var(--ui-control-padding);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--ui-border-radius);
  padding: var(--ui-control-padding);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.25);
}

.panel-mode-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: var(--ui-control-padding);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.panel-mode-tab img {
  display: block;
  width: 16px;
  height: 16px;
  transition: filter 0.15s;
}
.panel-mode-tab:hover { background: var(--bg-panel2); }
.panel-mode-tab.active { background: var(--accent); }
.panel-mode-tab.active img { filter: brightness(0); }

/* ─────────────────────────────────────────
   PANEL BODY
───────────────────────────────────────── */
.panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
}

.poi-info-panel .panel-body {
  max-height: calc((100vh - var(--topbar-h) - 32px) / 2);
}

.map-panel.panel-hidden .panel-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.map-panel.panel-hidden .panel-footer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top: 0;
  pointer-events: none;
}

.panel-body::-webkit-scrollbar { width: 5px; }
.panel-body::-webkit-scrollbar-track { background: var(--bg-panel); }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.panel-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-pane[hidden] { display: none; }


.panel-section {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.list-section {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 0;
  padding-bottom: 8px;
}

.list-section::-webkit-scrollbar { width: 5px; }
.list-section::-webkit-scrollbar-track { background: var(--bg-panel); }
.list-section::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.panel-section.sticky {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  z-index: 2;
}

.panel-footer {
  flex: 0 0 auto;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.panel-footer[hidden] { display: none; }

/* ─────────────────────────────────────────
   SETTINGS (sticky at bottom of map pane)
───────────────────────────────────────── */
.sidebar-settings-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}

.sidebar-settings-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sidebar-settings-chevron {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.sticky:not(.collapsed) .sidebar-settings-chevron {
  transform: rotate(180deg);
}

.sidebar-settings-body {
  margin-top: 12px;
  padding-bottom: 4px;
}

.map-panel.panel-hidden .sidebar-settings-body,
.sticky.collapsed .sidebar-settings-body {
  display: none;
}

/* ─────────────────────────────────────────
   EDIT PANE SPECIFICS
───────────────────────────────────────── */
.panel-edit-hint {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  gap: var(--ui-control-padding);
}


.panel-edit-hint-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.panel-edit-hint-sub kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--bg-panel2);
}

[data-mode="edit"] .panel-footer { gap: 16px; }
[data-mode="edit"] .panel-edit-action-btn { flex: 1; }

.panel-edit-action-btn {
  padding: var(--ui-control-padding) calc(var(--ui-control-padding) * 2);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.panel-edit-action-btn:hover {
  background: var(--bg-panel2);
  color: var(--text-primary);
  border-color: rgba(215, 173, 49, 0.35);
}


.panel-edit-action-btn-danger {
  border-color: rgba(220, 38, 38, 0.35);
  color: #fca5a5;
}

.panel-edit-action-btn-danger:hover {
  border-color: rgba(220, 38, 38, 0.55);
  color: #fecaca;
}

/* ─────────────────────────────────────────
   POI LIST (list mode)
───────────────────────────────────────── */
.poi-list {
  padding: 4px 0 12px;
}

.poi-list-group[hidden] { display: none; }

.poi-list-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 4px;
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 1;
}

.poi-list-type-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poi-list-type-header {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 20px 0;
}

.poi-list-type-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.poi-list-group-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--category-color, var(--accent));
}

.poi-list-group-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-panel2);
  padding: 1px 7px;
  border-radius: 10px;
}

.poi-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 20px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}
.poi-list-item:hover { background: var(--bg-panel2); }
.poi-list-item[hidden] { display: none; }

.poi-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--category-color, var(--accent));
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.2);
}

.poi-list-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.poi-list-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poi-list-type {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
/* ─────────────────────────────────────────
   MOBILE BOTTOM NAV (hidden on desktop)
───────────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
}

/* ─────────────────────────────────────────
   MOBILE BACKDROP
───────────────────────────────────────── */
.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 490;
  background: rgba(0, 0, 0, 0.55);
}
.panel-backdrop[hidden] { display: none; }

/* ─────────────────────────────────────────
   TABLET (641px – 1024px)
───────────────────────────────────────── */
@media (min-width: 641px) and (max-width: 1024px) {
  .map-panel { width: 340px; }
}

/* ─────────────────────────────────────────
   DESKTOP: Leaflet zoom controls
───────────────────────────────────────── */
@media (min-width: 641px) {
  .leaflet-bottom.leaflet-right {
    bottom: 20px;
    right: 20px;
  }
}

/* ─────────────────────────────────────────
   MOBILE (≤ 640px) — BOTTOM SHEET PATTERN
───────────────────────────────────────── */
@media (max-width: 640px) {
  /* POI info panel — slides up as its own sheet above the legend */
  .panel-wrapper {
    display: none;
  }

  .panel-wrapper.panel-visible > .map-panel {
    transform: translateY(0);
    z-index: 510;
  }

  @starting-style {
    .panel-wrapper.panel-visible > .map-panel {
      transform: translateY(100%);
    }
  }

  /* Restore fixed positioning for the legend panel inside panels-right */
  .panels-right {
    display: contents;
  }
  .panels-right .map-panel {
    position: fixed;
  }

  /* Topbar: hide title to save space */
  .topbar-logo,
  .topbar-title,
  .topbar-slash {
    display: none;
  }

  .topbar {
    padding: 0 16px;
    gap: 16px;
  }

  .title-region-picker select {
    font-size: 1.1rem;
  }

  /* Map sits below topbar, above mobile nav */
  #map {
    bottom: 56px;
  }

  /* Panel becomes a bottom sheet */
  .map-panel {
    top: auto;
    bottom: 56px; /* sits above mobile nav */
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    max-height: calc(100vh - var(--topbar-h) - 56px);
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.55);

    /* Peek: shows drag handle + toggle row (~68px) */
    transform: translateY(calc(100% - 68px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .map-panel.panel-expanded {
    transform: translateY(0);
  }

  .map-panel.panel-hidden {
    transform: translateY(100%);
    opacity: 1; /* stay opaque — just off-screen */
    pointer-events: none;
  }

  /* Show drag handle on mobile */
  .panel-drag-handle {
    display: block;
  }

  .panels-left {
    display: block;
    pointer-events: none;
  }

  .mobile-legend-control {
    position: fixed;
    top: calc(var(--topbar-h) + 16px);
    right: 16px;
    z-index: 520;
    width: var(--ui-element-dimension);
    height: var(--ui-element-dimension);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--ui-border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.25);
  }

  .panels-left-top {
    display: none;
  }

  .panels-left-bottom {
    position: fixed;
    left: 16px;
    bottom: calc(56px + 16px);
    z-index: 520;
    display: flex;
    align-items: stretch;
    gap: 16px;
  }

  body[data-mode="search"] .panels-left {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
  }

  body[data-mode="search"] .panels-left-top {
    position: static;
    display: flex;
    width: 100%;
  }

  body[data-mode="search"] .left-search-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  body[data-mode="search"] .left-search-tags-wrap {
    width: 100%;
    max-width: none;
  }

  body[data-mode="search"] .mobile-legend-control {
    position: static;
    flex-shrink: 0;
    align-self: flex-start;
  }

  /* Mobile search row tighter padding */
  .panel-header-row {
    padding: 16px;
  }

  /* Mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 510;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 5px 0 4px;
  }
  .mobile-nav-btn img {
    display: block;
    width: 20px;
    height: 20px;
    opacity: 0.4;
    transition: opacity 0.15s;
  }
  .mobile-nav-btn.active {
    color: var(--text-primary);
  }
  .mobile-nav-btn.active img { opacity: 1; }
  .mobile-nav-btn:hover img { opacity: 0.75; }


  /* Backdrop above panel but below mobile nav */
  .panel-backdrop { z-index: 495; }

  /* Leaflet zoom controls above mobile nav + panel peek */
  .leaflet-bottom.leaflet-right {
    bottom: calc(56px + 68px + 8px);
  }
}
