:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-soft: #f0f2f4;
  --text: #151515;
  --muted: #667085;
  --line: #e4e7ec;
  --orange: #f97316;
  --orange-dark: #c2410c;
  --blue: #2563eb;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --surface: #1b1c1f;
  --surface-soft: #24262a;
  --text: #f6f7f9;
  --muted: #a5adba;
  --line: #333842;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto minmax(0, 720px) auto;
  gap: 14px;
  align-items: center;
  padding: 14px clamp(12px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 92px;
}

.brand img {
  display: block;
  height: 36px;
}

.searchbar {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.here-button,
.icon-button,
.install-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 42px;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.here-button {
  padding: 0 18px;
  background: var(--text);
  color: var(--surface);
  font-weight: 750;
}

.icon-button {
  width: 42px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--text);
}

.search-button {
  background: var(--orange);
  color: #fff;
}

.theme-toggle {
  justify-self: end;
}

.here-button:hover,
.icon-button:hover,
.install-button:hover {
  transform: translateY(-1px);
}

.search-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}

.filter-pill,
.install-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-pill input,
.filter-pill select {
  width: min(42vw, 190px);
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.filter-pill svg,
.install-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.install-button {
  color: #fff;
  background: var(--orange);
  border-color: var(--orange);
}

.layout {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  overflow: hidden;
}

.layout.is-empty {
  display: grid;
  place-items: center;
}

.layout.is-empty .map-pane,
.layout.is-empty .detail-pane {
  display: none;
}

.empty-state {
  width: min(560px, calc(100vw - 32px));
  text-align: center;
  padding: 38px 20px;
}

.empty-mark {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.empty-mark img {
  width: 56px;
  height: 56px;
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.empty-state p {
  margin: 16px auto 0;
  max-width: 460px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.map-pane {
  position: relative;
  min-width: 0;
  min-height: calc(100vh - 126px);
}

#map {
  position: absolute;
  inset: 0;
  background: var(--surface-soft);
}

.map-status {
  position: absolute;
  left: 16px;
  bottom: 18px;
  z-index: 600;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.map-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.detail-pane {
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.detail-placeholder {
  height: 100%;
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.detail-placeholder svg {
  width: 44px;
  height: 44px;
  color: var(--orange);
}

.property-card {
  animation: panelIn 220ms ease both;
}

.hero-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-soft);
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--orange);
}

.hero-fallback svg {
  width: 72px;
  height: 72px;
}

.detail-body {
  padding: 20px;
}

.detail-kicker {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.price {
  margin-top: 12px;
  font-size: 1.6rem;
  font-weight: 850;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
}

.data-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.data-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.data-row dt {
  color: var(--muted);
  font-weight: 700;
}

.data-row dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  margin: 20px 0;
  color: #fff;
  background: #16a34a;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 800;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.marker-pin {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 4px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
  transform: rotate(-45deg);
}

.marker-pin svg {
  width: 17px;
  height: 17px;
  transform: rotate(45deg);
}

.marker-house {
  background: var(--blue);
}

.marker-apartment {
  background: var(--orange);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 2000;
  width: min(460px, calc(100vw - 32px));
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: shimmer 1.2s infinite;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 840px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .brand {
    display: none;
  }

  .searchbar {
    grid-column: 1 / 2;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 50% 50%;
    height: calc(100vh - 176px);
  }

  .map-pane {
    min-height: 0;
  }

  .detail-pane {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .layout:not(.has-detail) {
    grid-template-rows: 1fr 0;
  }

  .layout:not(.has-detail) .detail-pane {
    overflow: hidden;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 10px;
  }

  .searchbar {
    gap: 6px;
  }

  .here-button {
    padding: 0 12px;
  }

  .filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 10px;
  }

  .filter-pill {
    flex: 0 0 auto;
  }

  .filter-pill input,
  .filter-pill select {
    width: 150px;
  }

  .detail-body {
    padding: 16px;
  }

  .data-row {
    grid-template-columns: 112px minmax(0, 1fr);
  }
}
