:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #5d6b7b;
  --line: #e4e9ef;
  --brand: #0f6b57;
  --brand-2: #148f74;
  --warn: #b45309;
  --bad: #b42318;
  --ok: #067647;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100%;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.brand h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.toolbar {
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.toolbar input, .toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.filters {
  display: grid;
  gap: 8px;
}
.meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  padding: 0 2px;
}

.list {
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  background: #fff;
}
.card:hover, .card.active { border-color: #b7ddd3; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card .price { color: var(--brand); font-weight: 700; }
.card .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.available { background: #ecfdf3; color: var(--ok); }
.badge.rented { background: #fef3f2; color: var(--bad); }
.badge.hold { background: #fff7ed; color: var(--warn); }

.map-wrap { position: relative; }
#map { height: 100%; width: 100%; }

.legend {
  position: absolute;
  z-index: 500;
  right: 12px;
  bottom: 12px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: var(--shadow);
}
.legend b { display: block; margin-bottom: 6px; }

.leaflet-popup-content { margin: 10px 12px; min-width: 240px; }
.gallery { display: grid; gap: 8px; }
.gallery-main {
  width: 100%;
  height: 168px;
  object-fit: cover;
  border-radius: 10px;
  background: #eef2f6;
}
.thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 42px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f6;
  cursor: pointer;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb.active { border-color: var(--brand); }
.gallery-count {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.popup h3 { margin: 8px 0 4px; font-size: 16px; }
.popup .price { color: var(--brand); font-weight: 700; font-size: 15px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 46% 54%; }
  .sidebar { border-right: 0; border-top: 1px solid var(--line); }
}
