:root {
  --map-shell-gap: 12px;
  --map-panel: #ffffff;
  --map-line: #dce8e3;
  --map-soft: #f6faf8;
  --map-ink: #102a38;
  --map-muted: #607575;
  --map-primary: #063047;
  --map-green: #006b57;
}

body.map-page {
  min-height: 100vh;
  background: #f6f1e8;
  color: var(--map-ink);
}

.map-topbar {
  background: #fff;
}

.map-topbar .w {
  min-height: 64px;
}

.map-header-title {
  margin-left: auto;
  color: #063047;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.1;
  white-space: nowrap;
}

.map-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 10px auto 24px;
  display: grid;
  gap: var(--map-shell-gap);
}

.map-titlebar,
.map-filterbar,
.map-list-panel,
.map-canvas-panel {
  background: var(--map-panel);
  border: 1px solid var(--map-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(6, 48, 71, .04);
}

.map-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.map-titlebar .eyebrow {
  margin: 0 0 4px;
  color: #006b57;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-titlebar h1 {
  margin: 0;
  color: #063047;
  font-size: 28px;
  line-height: 1.08;
  font-weight: 850;
}

.map-titlebar p {
  margin: 6px 0 0;
  color: var(--map-muted);
  font-size: 14px;
}

.map-filterbar {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow: visible;
}

.map-chip {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--map-line);
  border-radius: 999px;
  background: var(--map-soft);
  color: #063047;
  font-size: 12px;
  font-weight: 750;
}

.map-chip span {
  color: var(--map-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.map-chip select {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: #063047;
  font: inherit;
  outline: 0;
  text-overflow: ellipsis;
}

.map-chip-button {
  cursor: pointer;
}

.map-chip-button.is-active {
  background: #e7f7f1;
  border-color: #9fd4c5;
  color: #005f4e;
}

.map-layout {
  min-height: min(680px, calc(100vh - 178px));
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--map-shell-gap);
}

@media (min-width: 769px) {
  .map-shell {
    margin-top: 8px;
    gap: 8px;
  }

  .map-titlebar {
    min-height: 0;
    padding: 8px 12px;
    border-radius: 10px;
  }

  .map-titlebar .eyebrow,
  .map-titlebar p {
    display: none;
  }

  .map-titlebar h1 {
    font-size: 18px;
    line-height: 1.15;
  }

  .map-title-action {
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  .map-filterbar {
    padding: 8px;
  }

  .map-layout {
    min-height: min(720px, calc(100vh - 126px));
  }

  .map-canvas-panel,
  .map-canvas {
    min-height: min(720px, calc(100vh - 126px));
  }
}

.map-list-panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--map-line);
}

.map-list-head strong {
  color: #063047;
  font-size: 14px;
}

.map-link-button {
  border: 0;
  background: transparent;
  color: #006b57;
  font-weight: 800;
  cursor: pointer;
}

.map-list {
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 9px;
}

.map-list-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--map-line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.map-list-card:hover,
.map-list-card.is-active {
  border-color: #9fd4c5;
  background: #f7fcfa;
}

.map-list-card strong {
  color: #063047;
  font-size: 14px;
}

.map-list-card p,
.map-detail-sheet p {
  margin: 0;
  color: var(--map-muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.map-list-tags,
.map-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.map-mini-tag {
  border-radius: 999px;
  padding: 3px 7px;
  background: #eef6f2;
  color: #246453;
  font-size: 11px;
  font-weight: 750;
}

.map-mini-tag.is-promo {
  background: #fff3e8;
  color: #aa4a2a;
}

.map-canvas-panel {
  position: relative;
  min-height: 520px;
  overflow: hidden;
}

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 520px;
}

.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
}

.map-controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.map-north {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(6, 48, 71, .12);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #063047;
  box-shadow: 0 2px 8px rgba(6, 48, 71, .14);
  cursor: pointer;
}

.map-attribution-control {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
}

.map-attribution-toggle {
  min-width: 44px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(6, 48, 71, .12);
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: #44615e;
  box-shadow: 0 2px 8px rgba(6, 48, 71, .12);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
}

.map-attribution-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 190px;
  padding: 7px 10px;
  border: 1px solid rgba(6, 48, 71, .12);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  color: #44615e;
  box-shadow: 0 2px 8px rgba(6, 48, 71, .12);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.map-attribution-control.is-open .map-attribution-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.map-north {
  color: #006b57;
  font-size: 14px;
  font-weight: 900;
}

.map-brand {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 5;
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 7px 11px;
  border: 1px solid rgba(6, 48, 71, .1);
  background: rgba(255,255,255,.9);
  color: #44615e;
  font-size: 11px;
  font-weight: 750;
  box-shadow: 0 2px 8px rgba(6, 48, 71, .09);
  white-space: nowrap;
}

.map-locate-floating {
  position: absolute;
  right: 14px;
  top: 62px;
  z-index: 6;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(6, 48, 71, .14);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #1A73E8;
  box-shadow: 0 4px 14px rgba(6, 48, 71, .16);
}

.map-locate-floating span {
  position: relative;
  width: 26px;
  height: 26px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, currentColor 0 3px, transparent 3.5px);
  font-size: 0;
}

.map-locate-floating span::before,
.map-locate-floating span::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.map-locate-floating span::before {
  left: 50%;
  top: -6px;
  bottom: -6px;
  width: 2px;
  transform: translateX(-50%);
}

.map-locate-floating span::after {
  top: 50%;
  left: -6px;
  right: -6px;
  height: 2px;
  transform: translateY(-50%);
}

.map-locate-floating:hover,
.map-locate-floating:focus-visible {
  background: #F7FAF8;
  border-color: rgba(0, 107, 87, .28);
}

.map-locate-floating.is-loading span {
  animation: mapLocatePulse .9s ease-in-out infinite;
}

@keyframes mapLocatePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.86); opacity: .55; }
}

.map-results-pill {
  display: none;
}

.map-toast {
  position: absolute;
  left: 50%;
  bottom: 66px;
  z-index: 7;
  width: min(340px, calc(100% - 96px));
  transform: translateX(-50%);
  border: 1px solid rgba(6, 48, 71, .12);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #063047;
  padding: 9px 12px;
  box-shadow: 0 4px 16px rgba(6, 48, 71, .14);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  z-index: 4;
}

.map-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 36px));
  padding: 16px;
  border: 1px solid var(--map-line);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  color: #063047;
  text-align: center;
  font-weight: 750;
}

.map-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #063047;
  color: #fff;
  box-shadow: 0 4px 12px rgba(6, 48, 71, .28);
  cursor: pointer;
}

.map-marker::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.map-marker.is-promo {
  background: #006b57;
  color: #fff7d7;
}

.map-user-location-marker {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #1A73E8;
  box-shadow: 0 0 0 8px rgba(26, 115, 232, .18), 0 3px 12px rgba(6, 48, 71, .22);
}

.map-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 24, 28, .26);
}

.map-detail-sheet {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 81;
  width: min(420px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 18px;
  border: 1px solid var(--map-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(5, 27, 36, .22);
}

.map-detail-handle {
  display: none;
}

.map-detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #f2f7f5;
  color: #063047;
  font-size: 20px;
  cursor: pointer;
}

.map-detail-sheet h2 {
  margin: 0 38px 8px 0;
  color: #063047;
  font-size: 20px;
}

.map-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.map-detail-actions .btn {
  min-height: 38px;
}

.map-status {
  padding: 12px;
  border-radius: 10px;
  background: #f7fbf9;
  color: #3e5c58;
  font-size: 13px;
}

@media (max-width: 900px) {
  .map-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  body.map-page {
    overflow: hidden;
  }

  .map-topbar .w {
    display: grid;
    min-height: 54px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .map-topbar .top-actions {
    display: none;
  }

  .map-header-title {
    display: none;
  }

  .map-shell {
    position: relative;
    width: 100%;
    height: calc(100dvh - 54px - var(--mobile-nav-height, 74px));
    margin: 0;
    gap: 0;
    display: flex;
    flex-direction: column;
  }

  .map-titlebar {
    display: none;
  }

  .map-filterbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 7;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .map-chip {
    width: 100%;
    min-height: 38px;
    padding: 0 6px;
    justify-content: center;
    border-color: rgba(6, 48, 71, .13);
    background: rgba(255,255,255,.94);
    box-shadow: 0 4px 14px rgba(6, 48, 71, .11);
    font-size: 12px;
  }

  .map-chip span {
    display: none;
  }

  .map-layout {
    flex: 1;
    min-height: 0;
    display: block;
  }

  .map-canvas-panel {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .map-canvas {
    height: 100%;
    min-height: 0;
  }

  .map-controls {
    top: auto;
    right: 12px;
    bottom: 132px;
  }

  .map-north {
    width: 46px;
    height: 46px;
  }

  .maplibregl-ctrl-zoom-in,
  .maplibregl-ctrl-zoom-out {
    display: none !important;
  }

  .map-attribution-control {
    left: 10px;
    bottom: 10px;
  }

  .map-attribution-toggle {
    height: 24px;
    min-width: 42px;
    font-size: 9px;
  }

  .map-attribution-panel {
    min-width: 176px;
    font-size: 10px;
  }

  .map-brand {
    bottom: 10px;
  }

  .map-locate-floating {
    top: auto;
    right: 12px;
    bottom: 76px;
    width: 46px;
    height: 46px;
  }

  .map-locate-floating span {
    width: 28px;
    height: 28px;
  }

  .map-toast {
    bottom: 76px;
    width: min(300px, calc(100% - 88px));
  }

  .map-results-pill {
    display: inline-flex;
    align-items: center;
    justify-self: end;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #4e6566;
    box-shadow: none;
    font-size: 12px;
    font-weight: 850;
  }

  .map-list-panel {
    display: none;
  }

  .map-detail-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 80dvh;
    overflow-y: auto;
    transform: none;
    padding: 10px 16px 18px;
    border-radius: 18px 18px 0 0;
  }

  .map-detail-handle {
    display: block;
    width: 44px;
    height: 4px;
    margin: 2px auto 12px;
    border-radius: 999px;
    background: #c8d8d4;
  }

  .map-detail-sheet h2 {
    font-size: 19px;
  }
}
