*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-width: 300px;

  /* Imobiliárias — cores por fonte (usadas no JS) */
  --color-pioneira:   #2563eb;
  --color-tomazoni:   #16a34a;
  --color-casarilfb:  #dc2626;
  --color-slimobi:    #0891b2;
  --color-sendeski:   #9333ea;
  --color-ghisi:      #ea580c;
  --color-andreimove: #047857;
  --color-bn7:        #6366f1;
  --color-vieira:     #be185d;
  --color-novaera:    #ca8a04;
  --color-luanatondo: #b45309;
  --color-claudiobor: #475569;
  --color-jrs:        #0e7490;

  /* Paleta principal — quente, residencial */
  --color-bg:           #faf8f5;
  --color-surface:      #ffffff;
  --color-border:       #e5ddd5;
  --color-border-focus: #2563eb;
  --color-text:         #1c1917;
  --color-muted:        #6b5e57;
  --color-accent:       #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-accent-shadow: rgba(37, 99, 235, 0.32);
  --color-price:        #166534;
  --color-surface-warm: #fef8f3;
  --color-surface-hover: #f1f5f9;

  /* Shape */
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-sheet: 0 -6px 32px rgba(0,0,0,0.14);
}

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* Layout */
body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#map {
  flex: 1;
  height: 100%;
}

/* ── Sidebar header ───────────────────────────────────────────────────── */
#sidebar-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#brand-icon {
  color: var(--color-accent);
  flex-shrink: 0;
}

#brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

#sidebar-header h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#subtitle {
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 500;
  letter-spacing: 0.01em;
}

#social-proof {
  font-size: 11px;
  color: var(--color-muted);
  font-weight: 400;
  margin-top: 2px;
}
#social-proof.hidden { display: none; }

/* ── Filter groups ───────────────────────────────────────────────────── */
.filter-group {
  padding: 14px 16px 0;
}

.filter-group > label:first-child {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin-bottom: 8px;
}

/* ── Radio pills ─────────────────────────────────────────────────────── */
.radio-group {
  display: flex;
  flex-direction: row;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.radio-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--color-border);
  color: var(--color-muted);
  position: relative;
}
.radio-group label:last-child { border-right: none; }

.radio-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.radio-group label:has(input[type="radio"]:checked),
.radio-group label.radio-selected {
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

/* ── Multi-select dropdown ───────────────────────────────────────────── */
.multi-select {
  position: relative;
}

.ms-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ms-trigger:hover { border-color: var(--color-muted); }
.multi-select.open .ms-trigger {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ms-arrow {
  font-size: 12px;
  color: var(--color-muted);
  transition: transform 0.15s;
}
.multi-select.open .ms-arrow { transform: rotate(180deg); }

.ms-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 500;
  padding: 4px 0;
}
.multi-select.open .ms-dropdown { display: block; }

.ms-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}

.ms-search {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 0;
  transition: border-color 0.15s;
}
.ms-search:focus { border-color: var(--color-border-focus); }

.ms-deselect {
  white-space: nowrap;
  font-size: 12px;
  color: var(--color-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-family: inherit;
}
.ms-deselect:hover { background: var(--color-surface-hover); }

.ms-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  margin: 1px 4px;
  transition: background 0.12s;
}
.ms-option:hover { background: var(--color-surface-hover); }

/* ── Custom checkboxes ───────────────────────────────────────────────── */
.ms-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  background: var(--color-surface);
  position: relative;
}
.ms-option input[type="checkbox"]:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.ms-option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 8px;
  height: 11px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Select ──────────────────────────────────────────────────────────── */
select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b5e57'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── Price range ─────────────────────────────────────────────────────── */
.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
.range-row input::-webkit-outer-spin-button,
.range-row input::-webkit-inner-spin-button { -webkit-appearance: none; }
.range-row input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.range-row span {
  color: var(--color-muted);
  font-size: 12px;
}

/* ── Dot indicators ──────────────────────────────────────────────────── */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-pioneira   { background: var(--color-pioneira); }
.dot-tomazoni   { background: var(--color-tomazoni); }
.dot-casarilfb  { background: var(--color-casarilfb); }
.dot-slimobi    { background: var(--color-slimobi); }
.dot-sendeski   { background: var(--color-sendeski); }
.dot-ghisi      { background: var(--color-ghisi); }
.dot-andreimove { background: var(--color-andreimove); }
.dot-bn7        { background: var(--color-bn7); }
.dot-vieira     { background: var(--color-vieira); }
.dot-novaera    { background: var(--color-novaera); }
.dot-luanatondo { background: var(--color-luanatondo); }
.dot-claudiobor { background: var(--color-claudiobor); }
.dot-jrs        { background: var(--color-jrs); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 10px 16px;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Sidebar footer ──────────────────────────────────────────────────── */
#sidebar-footer {
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

#btn-filter {
  flex: 2;
  background: var(--color-accent);
  color: white;
  min-height: 44px;
  font-size: 15px;
}
#btn-filter:hover { background: var(--color-accent-hover); }
#btn-filter:not(:disabled):active { transform: translateY(1px); }

#btn-reset {
  flex: 1;
  background: var(--color-surface-warm);
  color: var(--color-muted);
  min-height: 44px;
}
#btn-reset:hover { background: var(--color-border); }
#btn-reset:active { transform: translateY(1px); }

#listing-count {
  flex: 0 0 100%;
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
}
#listing-count.has-results {
  color: var(--color-accent);
  font-weight: 500;
}


/* ── Map markers ─────────────────────────────────────────────────────── */
.marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.marker-pin.pioneira   { background: var(--color-pioneira); }
.marker-pin.tomazoni   { background: var(--color-tomazoni); }
.marker-pin.casarilfb  { background: var(--color-casarilfb); }
.marker-pin.slimobi    { background: var(--color-slimobi); }
.marker-pin.sendeski   { background: var(--color-sendeski); }
.marker-pin.ghisi      { background: var(--color-ghisi); }
.marker-pin.andreimove { background: var(--color-andreimove); }
.marker-pin.bn7        { background: var(--color-bn7); }
.marker-pin.vieira     { background: var(--color-vieira); }
.marker-pin.novaera    { background: var(--color-novaera); }
.marker-pin.luanatondo { background: var(--color-luanatondo); }
.marker-pin.claudiobor { background: var(--color-claudiobor); }
.marker-pin.jrs        { background: var(--color-jrs); }

/* ── Popup overlay ───────────────────────────────────────────────────── */
#popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#popup-overlay.hidden { display: none; }

#popup-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.24);
  display: flex;
  flex-direction: column;
}

#popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 16px;
  transition: background 0.15s;
  backdrop-filter: blur(4px);
}
#popup-close:hover { background: rgba(0,0,0,0.65); }

#popup-images {
  position: relative;
  width: 100%;
  height: 230px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-border);
  flex-shrink: 0;
}
#popup-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Carousel ────────────────────────────────────────────────────────── */
.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease;
  will-change: transform;
}
.carousel-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.carousel-btn:hover { background: rgba(0,0,0,0.7); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-btn:disabled { opacity: 0.3; cursor: default; }
.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  max-width: calc(100% - 80px);
  overflow: hidden;
}
.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: background 0.2s;
}
.carousel-dot.active { background: #fff; }
.carousel-counter {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(0,0,0,0.45);
  border-radius: 10px;
  padding: 2px 8px;
}

/* ── Lightbox ────────────────────────────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox.hidden { display: none; }
#lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  border-radius: 4px;
}
#lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 28px;
  cursor: pointer;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-nav:disabled { opacity: 0.25; cursor: default; }
#lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.4);
  border-radius: 10px;
  padding: 3px 12px;
}
.carousel-expand {
  position: absolute;
  top: 8px;
  left: 10px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.carousel-expand:hover { background: rgba(0,0,0,0.7); }
#popup-images.expandable img { cursor: zoom-in; }

/* ── Popup body ──────────────────────────────────────────────────────── */
#popup-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
}

#popup-badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.pioneira-bg   { background: #dbeafe; color: var(--color-pioneira); }
.badge.tomazoni-bg   { background: #dcfce7; color: var(--color-tomazoni); }
.badge.casarilfb-bg  { background: #fee2e2; color: var(--color-casarilfb); }
.badge.slimobi-bg    { background: #cffafe; color: var(--color-slimobi); }
.badge.sendeski-bg   { background: #f3e8ff; color: var(--color-sendeski); }
.badge.ghisi-bg      { background: #ffedd5; color: var(--color-ghisi); }
.badge.andreimove-bg { background: #d1fae5; color: var(--color-andreimove); }
.badge.bn7-bg        { background: #e0e7ff; color: var(--color-bn7); }
.badge.vieira-bg     { background: #fce7f3; color: var(--color-vieira); }
.badge.novaera-bg    { background: #fef9c3; color: var(--color-novaera); }
.badge.luanatondo-bg { background: #fef3c7; color: var(--color-luanatondo); }
.badge.claudiobor-bg { background: #f1f5f9; color: var(--color-claudiobor); }
.badge.jrs-bg        { background: #cffafe; color: var(--color-jrs); }
.badge.venda-bg    { background: #dcfce7; color: #166534; }
.badge.aluguel-bg  { background: #ede9fe; color: #5b21b6; }
.badge.secondary   { background: var(--color-surface-warm); color: var(--color-muted); }

#popup-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: 6px;
}

#popup-address {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 14px;
}

#popup-specs {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}
.spec-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-muted);
  font-weight: 500;
}
.spec-icon { font-size: 15px; }

#popup-price-row {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--color-surface-warm);
  border-radius: var(--radius);
  border-left: 3px solid var(--color-price);
}
#popup-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-price);
  display: block;
}

#popup-description {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.65;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#popup-description.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.desc-toggle {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-top: -12px;
  margin-bottom: 12px;
}
.desc-toggle:hover { text-decoration: underline; }

.btn-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-accent);
  color: white;
  padding: 13px 18px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  text-align: center;
}
.btn-link:hover { background: var(--color-accent-hover); }
.btn-link:active { transform: translateY(1px); }
#popup-action-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
#popup-action-row #popup-link { flex: 1; }

/* ── WhatsApp contact CTA (primary conversion action) ──────────────── */
.btn-wa-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #25D366;
  color: white;
  padding: 14px 18px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
}
.btn-wa-cta:hover { background: #1ebe5c; }
.btn-wa-cta:active { transform: translateY(1px); }

/* ── Utility row (copy link + share) ───────────────────────────────── */
.popup-utility-row {
  display: flex;
  gap: 1px;
  margin-top: 8px;
  background: var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.btn-utility {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--color-surface-warm);
  color: var(--color-muted);
  border: none;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-utility:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* ── Copy search link button ────────────────────────────────────────── */
.btn-copy-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: none;
  color: var(--color-accent);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-copy-search:hover {
  background: var(--color-surface-warm);
  border-color: var(--color-accent);
}
.btn-copy-search.hidden { display: none; }

/* ── Sidebar close (mobile only) ─────────────────────────────────────── */
#sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface-warm);
  color: var(--color-muted);
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  padding: 0;
  flex-shrink: 0;
}
#sidebar-close:hover { background: var(--color-border); }

/* ── Mobile FAB (hidden on desktop) ─────────────────────────────────── */
#filter-toggle {
  display: none;
}

/* ── FAB badge ───────────────────────────────────────────────────────── */
.fab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
}
.fab-badge.hidden { display: none; }

/* ── Mobile layout ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    overflow: hidden;
  }

  #map {
    position: fixed;
    inset: 0;
    z-index: 0;
    height: 100% !important;
  }

  /* Bottom sheet */
  #sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: clamp(420px, 72vh, 88vh);
    max-height: clamp(420px, 72vh, 88vh);
    min-width: unset;
    border-right: none;
    border-top: none;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-sheet);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 1000;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Drag handle */
  #sidebar::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 12px auto 4px;
    flex-shrink: 0;
  }

  #sidebar.open { transform: translateY(0); }

  /* Sticky header inside sheet */
  #sidebar-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-surface);
    padding: 6px 16px 14px;
  }

  /* Close button shown on mobile */
  #sidebar-close {
    display: flex;
  }

  /* Filter group spacing */
  .filter-group {
    padding: 16px 16px 0;
  }

  /* FAB */
  #filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    bottom: 28px;
    right: 20px;
    z-index: 999;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 13px 22px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 20px var(--color-accent-shadow);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  }
  #filter-toggle:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 6px 24px var(--color-accent-shadow);
  }
  #filter-toggle:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px var(--color-accent-shadow);
  }

  /* Popup bottom sheet */
  #popup-overlay {
    align-items: flex-end;
    padding: 0;
    background: rgba(28, 25, 23, 0.6);
  }

  #popup-card {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 88vh;
    padding-bottom: env(safe-area-inset-bottom);
  }

  #popup-images {
    height: 210px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  #popup-body {
    padding: 16px 16px 20px;
  }

  #popup-price { font-size: 20px; }

  #popup-overlay:not(.hidden) #popup-card {
    animation: popupSlideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  /* Footer with safe area */
  #sidebar-footer {
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  }

  button#btn-filter,
  button#btn-reset {
    min-height: 44px;
  }
}

/* ── Leaflet popup ───────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0;
}
.leaflet-popup-content {
  margin: 0;
  min-width: 200px;
}
.map-popup {
  padding: 12px 14px;
  cursor: pointer;
}
.map-popup-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}
.map-popup-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-price);
}
.map-popup-meta {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 2px;
}
.map-popup-cta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-accent);
  font-weight: 600;
}

/* ── Map overlays ────────────────────────────────────────────────────── */
.map-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  pointer-events: none;
}
.map-overlay.hidden { display: none; }
.map-overlay-box {
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.map-overlay-error {
  top: 16px;
  transform: translateX(-50%);
  pointer-events: auto;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: #b91c1c;
  box-shadow: var(--shadow-sm);
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
#btn-filter:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* ── Delight: popup entry animation ──────────────────────────────────── */
@keyframes popupEnter {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes popupSlideUp {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

#popup-overlay:not(.hidden) #popup-card {
  animation: popupEnter 0.22s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

/* ── Delight: marker hover spring ───────────────────────────────────── */
.leaflet-marker-icon {
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 50% 100%;
}
.leaflet-marker-icon:hover {
  transform: scale(1.28) translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Share toast ─────────────────────────────────────────────────────── */
#share-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 10001;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}
#share-toast.hidden { display: none; }

/* ── MarkerCluster custom styles ───────────────────────────────────────── */
.marker-cluster-small {
  background-color: rgba(37, 99, 235, 0.2);
}
.marker-cluster-small div {
  background-color: rgba(37, 99, 235, 0.7);
}
.marker-cluster-medium {
  background-color: rgba(37, 99, 235, 0.25);
}
.marker-cluster-medium div {
  background-color: rgba(37, 99, 235, 0.75);
}
.marker-cluster-large {
  background-color: rgba(37, 99, 235, 0.3);
}
.marker-cluster-large div {
  background-color: rgba(37, 99, 235, 0.85);
}
.marker-cluster div {
  width: 32px;
  height: 32px;
  margin-left: 4px;
  margin-top: 4px;
  text-align: center;
  border-radius: 50%;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.marker-cluster {
  background-clip: padding-box;
  border-radius: 50%;
}
