.sold-map-section {
  --map-border: #d9dedf;
  --map-muted: #52646c;
  background: #f2f4f4;
}
.sold-map-section .section-head { margin-bottom: 30px; }
.map-intro { max-width: 36rem; margin: 0; color: var(--map-muted); line-height: 1.65; }
.sales-hero + .sold-map-section { padding-top: 40px; }
.map-controls {
  display: grid;
  grid-template-columns: minmax(200px, 1.45fr) repeat(3, minmax(132px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}
.map-controls label { display: grid; gap: 6px; color: var(--navy); font-size: .875rem; font-weight: 700; }
.map-controls input, .map-controls select {
  height: 46px;
  width: 100%;
  min-width: 0;
  border: 1px solid #bac5ca;
  border-radius: 7px;
  background: white;
  padding: 0 12px;
  color: var(--navy);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
}
.map-controls select { appearance: none; padding-right: 30px; }
.select-wrap { position: relative; display: block; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 13px;
  top: 18px;
  width: 7px;
  height: 7px;
  border: solid #39515c;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  pointer-events: none;
}
.map-interface-button {
  min-height: 42px;
  border: 1px solid #bac5ca;
  border-radius: 7px;
  padding: 8px 13px;
  background: white;
  color: var(--navy);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
}
.map-controls .map-interface-button { min-height: 46px; }
.map-interface-button:not(:disabled):hover { background: #edf2f3; }
.map-interface-button:disabled { opacity: .55; cursor: default; }
.map-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 8px;
  color: var(--navy);
}
.map-view-switch { display: none; }
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--map-border);
  border-radius: 13px;
  background: white;
  box-shadow: 0 12px 25px #162a3a0b;
}
.map-frame { position: relative; min-width: 0; display: flex; flex-direction: column; }
.map-viewport { position: relative; }
.sales-map {
  height: clamp(480px, 50vw, 610px);
  background: #e4ebe5;
  color: var(--navy);
  font-family: var(--font);
  isolation: isolate;
}
[data-sales-map="home"] .sales-map { height: clamp(455px, 44vw, 540px); }
.sales-map .leaflet-tile-pane { filter: saturate(.62) contrast(.97) brightness(1.015); }
.sales-map .leaflet-control-zoom a { width: 38px; height: 38px; line-height: 38px; color: var(--navy); }
.sales-map .leaflet-control-attribution { font-size: .75rem; }
.sales-map .leaflet-control-attribution a { text-decoration: underline; }
.sales-map .leaflet-control-scale-line { font-size: .75rem; }
.km-map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
}
.km-price-pill {
  position: relative;
  display: block;
  min-width: 48px;
  padding: 5px 8px;
  text-align: center;
  color: white;
  background: var(--navy);
  border: 1px solid white;
  border-radius: 999px;
  box-shadow: 0 2px 5px #152b3a55;
  font-size: .875rem;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
}
.km-price-pill::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: calc(50% - 4px);
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: inherit;
  border: solid white;
  border-width: 0 1px 1px 0;
}
.km-price-pill.is-approximate { border-style: dashed; }
.km-map-pin:hover .km-price-pill,
.km-map-pin:focus-visible .km-price-pill,
.km-map-pin.is-selected .km-price-pill {
  color: #142c3c;
  background: #f0ce91;
  border-color: #162a3a;
}
.km-map-cluster {
  display: grid;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  background: #24495b;
  box-shadow: 0 1px 6px #152b3a66;
  font-size: 1rem;
  font-weight: 700;
}
.km-map-cluster:hover, .km-map-cluster:focus-visible { background: var(--navy); }
.pin-summary { display: grid; gap: 3px; font-size: .875rem; color: var(--navy); }
.pin-summary span { color: var(--map-muted); }
.map-tile-message {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 65px);
  margin: 0;
  border-radius: 7px;
  background: white;
  box-shadow: 0 1px 6px #152b3a33;
  padding: 10px 12px;
  font-size: .875rem;
  line-height: 1.35;
}
.map-note {
  margin: 0;
  padding: 11px 15px;
  border-top: 1px solid var(--map-border);
  color: var(--map-muted);
  font-size: .8125rem;
  line-height: 1.5;
}
.map-note a, .map-toolbar .action-note a { text-decoration: underline; text-underline-offset: .15em; }
.map-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border-left: 1px solid var(--map-border);
}
.map-sidebar-top { padding: 17px 18px; border-bottom: 1px solid var(--map-border); }
.map-sidebar-top h3 { margin: 0; color: var(--navy); font: 400 1.42rem/1.2 var(--serif); }
.sales-list {
  min-width: 0;
  height: 0;
  min-height: 100%;
  overflow-y: auto;
  scrollbar-color: #a7b7bd #f3f6f6;
}
.sold-item {
  display: grid;
  width: 100%;
  min-height: 70px;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid #e2e7e9;
  border-left: 3px solid transparent;
  padding: 13px 14px 12px 15px;
  color: var(--navy);
  background: white;
  text-align: left;
  cursor: pointer;
}
.sold-item:hover, .sold-item[aria-pressed="true"] { background: #f4f6f6; border-left-color: var(--gold); }
.sold-item:focus-visible { outline-offset: -3px; }
.sold-item-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
.sold-item-address { font-size: .9375rem; font-weight: 700; overflow-wrap: anywhere; }
.sold-item-price { font-size: .9375rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sold-item-sub { color: var(--map-muted); font-size: .875rem; line-height: 1.4; }
.portfolio-empty, .map-list-note { margin: 0; padding: 16px; color: var(--map-muted); font-size: .875rem; }
.sale-detail {
  position: absolute;
  z-index: 3;
  bottom: 48px;
  left: 14px;
  width: min(335px, calc(100% - 28px));
  border: 1px solid #c5d0d3;
  border-radius: 10px;
  box-shadow: 0 6px 24px #102a3d40;
  padding: 15px 49px 15px 16px;
  background: white;
  color: var(--navy);
}
.sale-detail-close {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: var(--navy);
  background: #edf2f3;
  font-size: 1.37rem;
  line-height: 1;
  cursor: pointer;
}
.sale-detail-price { display: block; margin-bottom: 4px; font: 700 1.4rem/1.15 var(--font); }
.sale-detail-address { margin: 0; font: 400 1.17rem/1.3 var(--serif); }
.sale-detail-meta, .sale-detail-location { margin: 5px 0; color: var(--map-muted); font-size: .875rem; line-height: 1.4; }
.sale-detail a { display: inline-block; margin-top: 6px; color: #264d62; font-size: .875rem; text-decoration: underline; }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }
.map-toolbar .action-note { margin: 0; color: var(--map-muted); font-size: .875rem; line-height: 1.55; }
.no-map .map-frame, .no-map .map-sidebar { display: block; }
.no-map .map-tile-message, .no-map .sale-detail { position: relative; inset: auto; box-shadow: none; }
.no-map .sales-list { height: auto; max-height: 510px; min-height: 0; }
@media (max-width: 1000px) {
  .map-controls { grid-template-columns: minmax(0, 1.15fr) repeat(3, minmax(0, 1fr)); }
  .map-controls .map-interface-button { grid-column: 4; justify-self: end; min-height: 40px; }
}
@media (max-width: 760px) {
  .map-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .map-controls label:first-child { grid-column: 1 / -1; }
  .map-controls .map-interface-button { grid-column: auto; justify-self: stretch; min-height: 46px; }
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .map-view-switch { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--map-border); border-radius: 9px; background: white; }
  .map-view-switch button { min-width: 52px; min-height: 38px; padding: 5px 9px; border: 0; }
  .map-view-switch button[aria-pressed="true"] { background: var(--navy); color: white; }
  .map-view-switch button[aria-pressed="true"]:hover { background: var(--navy); }
  .map-layout[data-view="map"] .map-sidebar, .map-layout[data-view="list"] .map-frame { display: none; }
  .map-sidebar { border-left: 0; display: block; }
  .sales-list { min-height: 0; height: auto; }
  .sales-map, [data-sales-map="home"] .sales-map { height: clamp(330px, 56vh, 490px); }
  .map-results-bar { flex-wrap: wrap; }
  .map-results-bar .map-fit { margin-left: auto; }
  .sale-detail { bottom: 44px; left: 9px; width: min(335px, calc(100% - 18px)); }
  .map-toolbar { align-items: flex-start; flex-direction: column; }
  .no-map .map-layout .map-frame, .no-map .map-layout .map-sidebar { display: block; }
  .no-map .map-view-switch { display: none; }
}
.map-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-width: 760px) {
  .sales-hero + .sold-map-section { padding-top: 26px; }
}
@media (max-width: 375px) {
  .map-results-bar { gap: 5px; }
  .map-view-switch button { min-width: 42px; padding-inline: 7px; }
  .map-results-bar .map-fit { padding-inline: 8px; font-size: .8125rem; }
}
