:root {
  --map-safe-top: max(18px, env(safe-area-inset-top));
  --map-safe-right: max(18px, env(safe-area-inset-right));
  --map-safe-bottom: max(18px, env(safe-area-inset-bottom));
  --map-safe-left: max(18px, env(safe-area-inset-left));
}

html,
body {
  width: 100%;
  height: 100%;
}

body.map-body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

.map-screen {
  position: relative;
  display: grid;
  grid-template-columns: clamp(360px, 29vw, 440px) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.1), transparent 24%),
    radial-gradient(circle at top right, rgba(94, 92, 230, 0.08), transparent 26%),
    var(--bg);
}

.map-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: clamp(180px, 18vw, 212px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-solid) 94%, transparent);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.map-mode-switch__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.map-mode-switch__item.is-active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(10, 132, 255, 0.18);
}

.map-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) 18px calc(18px + var(--map-safe-bottom)) calc(18px + var(--map-safe-left));
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-solid) 96%, transparent), color-mix(in srgb, var(--bg) 98%, transparent));
  backdrop-filter: saturate(180%) blur(22px);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
  z-index: 20;
}

.map-sidebar__header {
  display: block;
}

.map-sidebar__toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.map-sidebar__hero {
  display: grid;
  gap: 8px;
  padding: 0 2px;
}

.map-sidebar__copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.map-sidebar__eyebrow {
  display: none;
}

.map-sidebar__eyebrow:empty {
  display: none;
}

.map-sidebar__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.map-sidebar__title {
  margin: 0;
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: clamp(1.26rem, 1.55vw, 1.5rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
}

.map-sidebar__subtitle {
  margin: 0;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  line-height: 1.25;
}

.map-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-solid) 95%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.map-pill:hover {
  transform: translateY(-1px);
}

.map-pill--nav {
  justify-content: flex-start;
  min-width: fit-content;
  padding-inline: 11px 13px;
}

.map-pill__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.map-pill__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-sidebar__sheet-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 0;
  top: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-solid) 95%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
  transform: translateY(-50%);
}

.map-sidebar__sheet-toggle svg {
  width: 18px;
  height: 18px;
}

.map-sidebar__sheet-toggle:hover {
  transform: translateY(calc(-50% - 1px));
}

.map-sidebar__sheet-toggle[aria-expanded="false"] svg {
  transform: rotate(180deg);
}

.map-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--bg-solid) 96%, transparent);
  box-shadow: var(--shadow-sm);
}

.map-filters {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.map-summary {
  display: none !important;
}

.map-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-muted) 76%, transparent);
}

.map-segmented--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 286px);
}

.map-segmented [data-transaction-type="all"] {
  display: none !important;
}

.map-segmented__button {
  min-width: 0;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.map-segmented__button:hover {
  color: var(--ink);
}

.map-segmented__button.is-active {
  background: color-mix(in srgb, var(--accent) 82%, white 6%);
  color: white;
  box-shadow: 0 10px 22px rgba(10, 132, 255, 0.18);
}

.map-floating-hud {
  position: absolute;
  left: 50%;
  top: calc(var(--map-safe-top) + 16px);
  z-index: 720;
  width: min(calc(100% - 232px), 320px);
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.map-map-shell__back {
  position: absolute;
  left: calc(var(--map-safe-left) + 12px);
  top: calc(var(--map-safe-top) + 12px);
  z-index: 721;
  min-height: 32px;
  padding-inline: 9px 12px;
  background: color-mix(in srgb, var(--bg-solid) 78%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
}

.map-floating-hud__copy {
  display: grid;
  gap: 2px;
  justify-items: center;
  width: min(100%, 320px);
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.34);
}

.map-floating-hud__title {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.06rem, 1.35vw, 1.22rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.map-floating-hud__subtitle {
  margin: 0;
  color: color-mix(in srgb, var(--ink) 70%, white 18%);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.map-map-shell__back .map-pill__label {
  max-width: 62px;
}

.map-segmented--floating {
  width: min(100%, 178px);
  padding: 2px;
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg-solid) 76%, transparent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  backdrop-filter: saturate(180%) blur(18px);
  pointer-events: auto;
}

.map-segmented--floating .map-segmented__button {
  min-height: 27px;
  padding: 0 8px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.map-segmented--floating .map-segmented__button.is-active {
  box-shadow: 0 6px 16px rgba(10, 132, 255, 0.16);
}

.map-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.map-panel__handle {
  display: none !important;
}

.map-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.map-panel__header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.map-panel__label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-panel__hint {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

.map-panel__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-solid) 94%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  flex-shrink: 0;
}

.map-panel__toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.18s ease;
}

.map-panel__body {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 8px 10px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}

.map-list {
  display: grid;
  gap: 8px;
}

.map-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-solid) 98%, transparent);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.map-group:hover,
.map-group.is-hovered,
.map-group.is-active {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-solid));
  box-shadow: var(--shadow-sm);
}

.map-group__main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.map-group__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
}

.map-group__meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 0.81rem;
}

.map-group__meta:empty {
  display: none;
}

.map-group__side {
  display: grid;
  justify-items: end;
  min-width: 3.4rem;
}

.map-group__count {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: right;
}

.map-map-shell {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.08), transparent 24%),
    var(--bg-muted);
}

.map-map,
.map-map-shell .leaflet-container {
  width: 100%;
  height: 100%;
}

.map-map-shell .leaflet-container {
  background:
    radial-gradient(circle at top left, rgba(10, 132, 255, 0.08), transparent 28%),
    var(--bg-muted);
  font: inherit;
}

.map-map-shell .leaflet-control-zoom,
.map-map-shell .leaflet-bar {
  border: 1px solid var(--line) !important;
  border-radius: 18px !important;
  overflow: hidden;
  box-shadow: var(--shadow-sm) !important;
}

.map-map-shell .leaflet-bar a {
  width: 42px;
  height: 42px;
  border-bottom-color: var(--line) !important;
  background: color-mix(in srgb, var(--bg-solid) 92%, transparent);
  color: var(--ink);
  line-height: 42px;
}

.map-map-shell .leaflet-bar a:hover {
  background: var(--bg-muted);
}

.map-map-shell .leaflet-top.leaflet-right {
  top: 0;
  right: 0;
}

.map-map-shell .leaflet-bottom.leaflet-right {
  right: max(8px, env(safe-area-inset-right));
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

.map-map-shell .leaflet-bottom.leaflet-right .leaflet-control-zoom {
  margin: 0 !important;
}

.map-map-shell .leaflet-control-attribution {
  margin-right: calc(var(--map-safe-right) + 12px) !important;
  margin-top: calc(var(--map-safe-top) + 10px) !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-solid) 92%, transparent) !important;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  font-size: 0.7rem;
  line-height: 1.2;
  backdrop-filter: saturate(180%) blur(12px);
  padding: 3px 8px;
}

.map-map-shell .leaflet-control-attribution a {
  color: inherit;
}

.map-map-shell .map-listing-dot.is-interactive {
  cursor: pointer;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.34));
  transition: fill-opacity 0.18s ease, stroke-width 0.18s ease;
}

.map-map-shell .map-listing-dot.is-interactive:hover {
  fill-opacity: 1;
  stroke-width: 2;
}

.map-state {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 650;
  display: grid;
  gap: 8px;
  min-width: min(360px, calc(100vw - 40px));
  max-width: min(460px, calc(100vw - 40px));
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--bg-solid) 96%, transparent);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -50%);
  text-align: center;
  backdrop-filter: saturate(180%) blur(22px);
}

.map-state p {
  margin: 0;
  color: var(--ink-soft);
}

.map-area-label-shell,
.map-street-pin-shell,
.map-listing-pin-shell {
  background: none;
  border: 0;
}

.map-area-label-shell__offset {
  transform: translate(calc(-50% + var(--offset-x, 0px)), calc(-50% + var(--offset-y, 0px)));
}

.map-street-pin-shell__offset {
  transform: translate(calc(-50% + var(--offset-x, 0px)), calc(-100% + var(--offset-y, 0px)));
}

.map-listing-pin-shell__offset {
  transform: translate(calc(-50% + var(--offset-x, 0px)), calc(-100% + var(--offset-y, 0px)));
}

.map-area-label {
  display: inline-grid;
  justify-items: center;
  gap: 5px;
  width: min(96px, 24vw);
  padding: 8px 8px 7px;
  border: 1px solid color-mix(in srgb, var(--marker-color) 34%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-solid) 97%, var(--marker-color) 3%);
  color: var(--ink);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.14);
  contain: layout paint style;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.map-area-label__name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  text-align: center;
  text-wrap: balance;
  line-height: 1.06;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.map-area-label__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--marker-color) 82%, rgba(255, 255, 255, 0.12));
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.map-area-label--street {
  width: min(128px, 30vw);
  gap: 6px;
  padding: 9px 10px 8px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-solid) 95%, var(--marker-color) 5%);
}

.map-area-label--street .map-area-label__name {
  font-size: 0.76rem;
  line-height: 1.08;
}

.map-area-label--street .map-area-label__count {
  min-width: 38px;
  min-height: 26px;
  font-size: 0.75rem;
}

.map-area-label.is-hovered {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  border-color: color-mix(in srgb, var(--marker-color) 46%, var(--line));
  background: color-mix(in srgb, var(--bg-solid) 94%, var(--marker-color) 6%);
}

.map-area-label.is-selected {
  border-color: color-mix(in srgb, var(--accent) 84%, white 10%);
  background: color-mix(in srgb, var(--bg-solid) 88%, var(--accent) 12%);
  box-shadow: 0 12px 26px rgba(10, 132, 255, 0.24);
}

.map-area-label.is-selected .map-area-label__count {
  background: color-mix(in srgb, var(--accent) 84%, white 6%);
}

.map-street-pin {
  position: relative;
  display: inline-grid;
  justify-items: center;
  contain: layout paint style;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.map-street-pin__bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--marker-color) 78%, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  background: color-mix(in srgb, var(--marker-color) 88%, rgba(13, 16, 24, 0.18));
  color: white;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}

.map-street-pin__tail {
  position: absolute;
  left: 50%;
  top: 23px;
  width: 12px;
  height: 12px;
  border-right: 1px solid color-mix(in srgb, var(--marker-color) 78%, rgba(255, 255, 255, 0.14));
  border-bottom: 1px solid color-mix(in srgb, var(--marker-color) 78%, rgba(255, 255, 255, 0.14));
  border-radius: 0 0 4px 0;
  background: color-mix(in srgb, var(--marker-color) 88%, rgba(13, 16, 24, 0.18));
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.14);
}

.map-street-pin.is-hovered {
  transform: scale(1.04);
}

.map-street-pin.is-selected {
  transform: scale(1.06);
}

.map-street-pin.is-selected .map-street-pin__bubble,
.map-street-pin.is-selected .map-street-pin__tail {
  border-color: color-mix(in srgb, var(--accent) 88%, white 12%);
  background: color-mix(in srgb, var(--accent) 84%, white 6%);
}

.map-street-pin.is-hovered .map-street-pin__bubble,
.map-street-pin.is-hovered .map-street-pin__tail {
  filter: brightness(1.04);
}

.map-listing-pin {
  position: relative;
  display: grid;
  gap: 3px;
  min-width: 108px;
  max-width: 172px;
  padding: 7px 9px 8px;
  border: 1px solid color-mix(in srgb, var(--marker-color) 55%, rgba(255, 255, 255, 0.14));
  border-radius: 15px;
  background: color-mix(in srgb, var(--bg-solid) 91%, var(--marker-color) 9%);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  contain: layout paint style;
  cursor: pointer;
}

.map-listing-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  border-right: 1px solid color-mix(in srgb, var(--marker-color) 55%, rgba(255, 255, 255, 0.14));
  border-bottom: 1px solid color-mix(in srgb, var(--marker-color) 55%, rgba(255, 255, 255, 0.14));
  border-radius: 0 0 3px 0;
  background: color-mix(in srgb, var(--bg-solid) 91%, var(--marker-color) 9%);
  transform: translateX(-50%) rotate(45deg);
}

.map-listing-pin__address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.map-listing-pin__price {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.map-listings {
  display: grid;
  gap: 10px;
}

.map-listings .listing-card {
  background: var(--bg-solid);
}

.map-listings .listing-card__footer {
  padding-bottom: 14px;
}

.map-listings .listing-card__seen {
  font-size: 0.82rem;
}

.map-body .detail-drawer {
  z-index: 1200;
}

.map-body .gallery-viewer {
  z-index: 1300;
}

.map-listing {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-solid);
  box-shadow: var(--shadow-sm);
}

.map-listing__main {
  display: grid;
  width: 100%;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.map-listing__media {
  position: relative;
  aspect-ratio: 1.38 / 1;
  background: var(--bg-muted);
}

.map-listing__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-listing__source {
  position: absolute;
  left: 12px;
  top: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-solid) 90%, transparent);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.map-listing__body {
  display: grid;
  gap: 7px;
  padding: 13px;
}

.map-listing__price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.map-listing__price {
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.map-listing__ppm,
.map-listing__location {
  color: var(--ink-soft);
}

.map-listing__title {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.98rem;
  line-height: 1.28;
  letter-spacing: -0.03em;
}

.map-listing__location {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.38;
}

.map-listing__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-muted) 88%, transparent);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.map-listing__footer {
  padding: 0 13px 13px;
}

.map-listing__link {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.map-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

@media (max-width: 1024px) {
  .map-screen {
    grid-template-columns: 1fr;
  }

  .map-mode-switch {
    min-width: 0;
    width: 100%;
  }

  .map-mode-switch__item {
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.79rem;
  }

  .map-sidebar {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 18px;
    max-height: min(48vh, 500px);
    grid-template-rows: auto minmax(0, 1fr);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    background: color-mix(in srgb, var(--bg-solid) 96%, transparent);
    z-index: 760;
  }

  .map-sidebar__header {
    display: block;
  }

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

  .map-pill {
    min-height: 36px;
    padding-inline: 12px;
    font-size: 0.82rem;
  }

  .map-pill--nav {
    padding-inline: 11px 13px;
  }

  .map-pill__label {
    max-width: 18vw;
  }

  .map-sidebar__copy {
    gap: 3px;
  }

  .map-sidebar__heading {
    gap: 10px;
  }

  .map-sidebar__title {
    font-size: 1.18rem;
    line-height: 1.05;
    letter-spacing: -0.04em;
  }

  .map-sidebar__subtitle {
    max-width: min(54vw, 260px);
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .map-sidebar__sheet-toggle {
    display: inline-flex;
    width: 36px;
    height: 36px;
    position: static;
    right: auto;
    top: auto;
    transform: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  }

  .map-sidebar__sheet-toggle:hover {
    transform: none;
  }

  .map-sidebar__sheet-toggle svg {
    transition: transform 0.18s ease;
  }

  .map-sidebar.is-mobile-collapsed {
    grid-template-rows: auto;
    gap: 0;
    max-height: 82px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .map-sidebar.is-mobile-collapsed .map-filters,
  .map-sidebar.is-mobile-collapsed .map-summary,
  .map-sidebar.is-mobile-collapsed .map-panel {
    display: none;
  }

  .map-sidebar.is-mobile-collapsed .map-sidebar__header {
    cursor: pointer;
  }

  .map-sidebar.is-mobile-collapsed .map-sidebar__sheet-toggle svg {
    transform: rotate(180deg);
  }

  .map-sidebar.is-mobile-collapsed .map-sidebar__subtitle {
    -webkit-line-clamp: 1;
  }

  .map-summary {
    display: none;
  }

  .map-filters {
    justify-content: stretch;
  }

  .map-floating-hud {
    top: calc(var(--map-safe-top) + 12px);
    width: min(calc(100% - 148px), 260px);
  }

  .map-floating-hud__copy {
    gap: 2px;
    width: min(100%, 250px);
  }

  .map-floating-hud__title {
    font-size: 0.98rem;
  }

  .map-floating-hud__subtitle {
    font-size: 0.68rem;
  }

  .map-map-shell__back {
    left: max(4px, env(safe-area-inset-left));
    top: calc(var(--map-safe-top) + 6px);
    min-height: 26px;
    padding-inline: 6px 9px;
  }

  .map-map-shell__back .map-pill__icon {
    width: 13px;
    height: 13px;
  }

  .map-map-shell__back .map-pill__label {
    max-width: 40px;
    font-size: 0.72rem;
  }

  .map-segmented--floating {
    width: min(100%, 164px);
  }

  .map-segmented--floating .map-segmented__button {
    min-height: 25px;
    padding: 0 6px;
    font-size: 0.72rem;
  }

  .map-segmented {
    gap: 6px;
    padding: 5px;
  }

  .map-segmented--two:not(.map-segmented--floating) {
    width: 100%;
  }

  .map-segmented__button {
    min-height: 35px;
    padding: 0 10px;
    font-size: 0.9rem;
  }

  .map-sidebar.is-listings {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    max-height: min(66vh, 680px);
  }

  .map-sidebar.is-listings .map-filters,
  .map-sidebar.is-listings .map-summary {
    display: none;
  }

  .map-sidebar.is-listings .map-sidebar__header {
    gap: 9px;
  }

  .map-sidebar.is-listings .map-sidebar__copy {
    gap: 3px;
  }

  .map-sidebar.is-listings .map-sidebar__title {
    font-size: 1.12rem;
    letter-spacing: -0.04em;
  }

  .map-sidebar.is-listings .map-sidebar__subtitle {
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .map-sidebar.is-listings .map-panel {
    border-radius: 20px;
    overflow: visible;
  }

  .map-sidebar.is-listings .map-panel__handle {
    display: block !important;
    margin-top: -2px;
    margin-bottom: 8px;
  }

  .map-sidebar:not(.is-listings) .map-panel {
    border-radius: 20px;
  }

  .map-sidebar:not(.is-listings) .map-panel__handle {
    display: none !important;
  }

  .map-sidebar:not(.is-listings) .map-panel__body {
    padding-top: 8px;
  }

  .map-sidebar.is-listings .map-panel__header {
    padding: 12px 12px 10px;
  }

  .map-sidebar.is-listings .map-panel__header.is-clickable {
    cursor: pointer;
  }

  .map-sidebar.is-listings .map-panel__header.is-clickable:active {
    background: color-mix(in srgb, var(--bg-muted) 28%, transparent);
  }

  .map-sidebar.is-listings .map-panel__body {
    padding: 0 8px 8px;
  }

  .map-sidebar.is-listings.is-collapsed {
    grid-template-rows: auto auto;
    max-height: 122px;
    gap: 8px;
  }

  .map-sidebar.is-listings.is-collapsed .map-panel {
    height: auto;
  }

  .map-sidebar.is-listings.is-collapsed .map-panel__body {
    display: none;
  }

  .map-sidebar.is-listings.is-collapsed .map-panel__header {
    border-bottom: 0;
  }

  .map-sidebar.is-listings.is-collapsed .map-panel__handle {
    margin-bottom: 2px;
  }

  .map-sidebar.is-listings.is-collapsed .map-panel__hint {
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-sidebar.is-listings.is-collapsed .map-panel__toggle svg {
    transform: rotate(180deg);
  }

  .map-map-shell {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .map-map-shell .leaflet-control-zoom {
    margin: 0 !important;
  }

  .map-map-shell .leaflet-bottom.leaflet-right {
    display: none;
  }

  .map-map-shell .leaflet-control-attribution {
    margin-right: max(4px, env(safe-area-inset-right)) !important;
    margin-top: calc(var(--map-safe-top) + 6px) !important;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    font-size: 0.69rem;
    line-height: 1;
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-area-label {
    width: min(82px, 23vw);
    gap: 4px;
    padding: 6px 6px 6px;
    border-radius: 16px;
  }

  .map-area-label__name {
    font-size: 0.64rem;
    line-height: 1.04;
  }

  .map-area-label__count {
    min-width: 28px;
    min-height: 21px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

  .map-street-pin__bubble {
    min-width: 38px;
    min-height: 28px;
    padding: 0 9px;
    font-size: 0.8rem;
  }

  .map-street-pin__tail {
    top: 20px;
    width: 11px;
    height: 11px;
  }

  .map-listing-pin {
    min-width: 98px;
    max-width: 142px;
    padding: 6px 8px 7px;
    border-radius: 14px;
  }

  .map-listing-pin__address {
    font-size: 0.62rem;
  }

  .map-listing-pin__price {
    font-size: 0.73rem;
  }

  .map-listings {
    gap: 10px;
  }

  .map-listing {
    border-radius: 20px;
  }

  .map-listing__media {
    aspect-ratio: 1.56 / 1;
  }

  .map-listing__source {
    left: 10px;
    top: 10px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.72rem;
  }

  .map-listing__body {
    gap: 8px;
    padding: 14px;
  }

  .map-listing__price {
    font-size: 1.32rem;
  }

  .map-listing__title {
    font-size: 1rem;
    line-height: 1.28;
  }

  .map-listing__location,
  .map-listing__ppm {
    font-size: 0.9rem;
  }

  .map-chip {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .map-listing__footer {
    padding: 0 14px 14px;
  }

  .map-listing__link {
    font-size: 0.88rem;
  }
}
