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

:root {
  --green: #2d7a3a;
  --green-light: #e8f5e9;
  --orange: #e67e22;
  --red: #c0392b;
  --gray: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --text: #111827;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Header */
.header { background: var(--green); color: #fff; padding: 0 20px; height: 56px; flex-shrink: 0; display: flex; align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 1000; }
.header__inner { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.header__logo { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.header__stats { font-size: 13px; opacity: 0.85; }

/* Layout */
.layout { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.sidebar { width: 360px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--border); overflow: hidden; }

.filters { padding: 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.filters__title { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); margin-bottom: 12px; }
.filter-group { margin-bottom: 12px; }
.filter-group label { display: block; font-size: 12px; font-weight: 500; color: var(--gray); margin-bottom: 5px; }
.filter-group select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; background: var(--white); color: var(--text); }
.range-inputs { display: flex; gap: 6px; align-items: center; }
.range-inputs input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; width: 0; }
.range-inputs span { color: var(--gray); font-size: 12px; }
.checkbox-group { display: flex; flex-direction: column; gap: 5px; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); font-weight: 400; cursor: pointer; }
.checkbox-group input[type=checkbox] { accent-color: var(--green); width: 15px; height: 15px; }
.btn-reset { width: 100%; margin-top: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--white); font-size: 13px; color: var(--gray); cursor: pointer; transition: background 0.15s; }
.btn-reset:hover { background: #f3f4f6; }

/* List */
.list-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.list-header span { font-size: 13px; font-weight: 500; color: var(--gray); }
.list-header select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; color: var(--gray); background: var(--white); }
.object-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }

/* Object card in list */
.obj-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.obj-card:hover, .obj-card.active { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-light); }
.obj-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.obj-card__name { font-weight: 600; font-size: 13px; line-height: 1.4; flex: 1; }
.obj-card__photo { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #f3f4f6; }
.obj-card__photo-placeholder { width: 64px; height: 48px; border-radius: 6px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #d1d5db; }
.obj-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.obj-card__meta span { font-size: 12px; color: var(--gray); }
.obj-card__meta span.sep { color: var(--border); }
.obj-card__price { font-weight: 700; font-size: 14px; color: var(--green); }
.obj-card__status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
.status-available { background: #dcfce7; color: #166534; }
.status-reserved { background: #fef9c3; color: #713f12; }
.status-sold { background: #f3f4f6; color: #6b7280; }

/* Map */
.map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

/* Leaflet popup */
.leaflet-popup-content-wrapper { border-radius: var(--radius) !important; padding: 0 !important; box-shadow: var(--shadow) !important; }
.leaflet-popup-content { margin: 0 !important; }
.popup-inner { padding: 14px 16px; min-width: 220px; max-width: 280px; }
.popup-inner h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.popup-inner img { width: 100%; height: 140px; object-fit: cover; border-radius: 7px; margin-bottom: 10px; }
.popup-meta { font-size: 12px; color: var(--gray); margin-bottom: 4px; }
.popup-price { font-size: 16px; font-weight: 700; color: var(--green); margin: 8px 0; }
.popup-btn { display: block; width: 100%; padding: 9px; background: var(--green); color: #fff; border: none; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; text-align: center; margin-top: 10px; transition: background 0.15s; }
.popup-btn:hover { background: #245f2d; }

/* Marker icons */
.marker-icon { width: 32px; height: 32px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
.marker-available { background: var(--green); }
.marker-reserved { background: var(--orange); }
.marker-sold { background: var(--gray); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 16px; max-width: 800px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal__close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; width: 32px; height: 32px; border-radius: 50%; border: none; background: #f3f4f6; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; color: var(--gray); }
.modal__close:hover { background: #e5e7eb; }
.modal__body { padding: 24px; }

/* Modal content */
.modal-gallery { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 20px; border-radius: 10px; overflow: hidden; }
.modal-gallery img { height: 220px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.modal-gallery img:first-child:last-child { width: 100%; height: 280px; }
.modal-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.modal-status-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.modal-price { font-size: 24px; font-weight: 800; color: var(--green); }
.modal-price-per-ha { font-size: 14px; color: var(--gray); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.modal-field { background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.modal-field__label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); margin-bottom: 4px; }
.modal-field__value { font-size: 14px; font-weight: 500; color: var(--text); }
.modal-section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); margin-bottom: 10px; }
.modal-description { font-size: 14px; line-height: 1.7; color: var(--text); margin-bottom: 20px; white-space: pre-wrap; }
.modal-links { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-link { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; text-decoration: none; transition: background 0.15s; }
.modal-link-rosreestr { background: #e0f2fe; color: #0369a1; }
.modal-link-rosreestr:hover { background: #bae6fd; }
.modal-link-nspd { background: var(--green-light); color: var(--green); }
.modal-link-nspd:hover { background: #c8e6c9; }

/* Loading state */
.loading { display: flex; align-items: center; justify-content: center; height: 200px; color: var(--gray); font-size: 14px; }

/* Scrollbar */
.object-list::-webkit-scrollbar { width: 4px; }
.object-list::-webkit-scrollbar-track { background: transparent; }
.object-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* Mobile */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: 50vh; flex-direction: row; border-right: none; border-top: 1px solid var(--border); order: 2; }
  .filters { width: 220px; flex-shrink: 0; overflow-y: auto; font-size: 12px; }
  .list-section { flex: 1; }
  .map-container { order: 1; flex: none; height: 50vh; }
  #map { height: 100%; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-gallery img { height: 160px; }
}
