:root {
  --bg-app: #0b0f17;
  --bg-sidebar: #0f1522;
  --bg-surface: #151d2e;
  --bg-card: #172033;
  --bg-card-hover: #1c273d;
  --bg-input: #111827;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(99, 102, 241, 0.45);
  --text-main: #f8fafc;
  --text-sec: #cbd5e1;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --emerald: #10b981;
  --cyan: #06b6d4;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 13px;
}

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

html, body {
  height: 100%;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================================
   LAYOUT: КОМПАКТНИЙ САЙДБАР + ПОВНОЕКРАННА РОБОЧА ЗОНА
   ============================================================================ */
.app-layout {
  display: grid;
  grid-template-columns: 215px 1fr;
  height: 100vh;
  width: 100vw;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 14px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-btn.active {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.nav-text {
  flex: 1;
}

.nav-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
}

.nav-btn.active .nav-badge {
  background: var(--primary);
  color: #fff;
}

/* Швидкий фільтр по порталах у сайдбарі */
.sidebar-portals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 6px;
}

.portal-mini-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.portal-mini-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sec);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}

.portal-mini-item:hover,
.portal-mini-item.active {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: #fff;
}

.portal-mini-item .p-name {
  flex: 1;
  text-align: left;
}

.portal-mini-item strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
}

.p-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.p-dot.all { background: #818cf8; }
.p-dot.olx { background: #38bdf8; }
.p-dot.rieltor { background: #fbbf24; }
.p-dot.domria { background: #f87171; }
.p-dot.flatfy { background: #34d399; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.edge-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

/* ============================================================================
   MAIN AREA & SLIM TOPBAR (54px)
   ============================================================================ */
.main-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: 52px;
  min-height: 52px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-left::-webkit-scrollbar {
  display: none;
}

.kpi-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kpi-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.kpi-pill-label {
  color: var(--text-muted);
}

.kpi-pill strong {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #fff;
}

.kpi-pill.emerald {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}
.kpi-pill.emerald strong { color: #34d399; }

.kpi-pill.cyan {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}
.kpi-pill.cyan strong { color: #22d3ee; }

.kpi-pill.amber {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}
.kpi-pill.amber strong { color: #fbbf24; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.scan-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-select {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.ctrl-select:focus {
  border-color: var(--primary);
}

.btn-scan {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
  transition: 0.15s;
}

.btn-scan:hover {
  filter: brightness(1.1);
}

.btn-scan:disabled {
  opacity: 0.65;
  cursor: wait;
}

.view-switcher {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.view-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.view-btn.active {
  background: var(--primary);
  color: #fff;
}

/* ============================================================================
   TAB PANELS & SINGLE CLEAN FILTER TOOLBAR (46px)
   ============================================================================ */
.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

.filter-toolbar {
  height: 46px;
  min-height: 46px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-toolbar::-webkit-scrollbar {
  display: none;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 210px;
  max-width: 310px;
}

.search-ico {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.65;
}

.search-field input {
  width: 100%;
  height: 31px;
  padding: 0 10px 0 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}

.search-field input:focus {
  border-color: var(--primary);
}

.district-select {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.08);
  font-weight: 600;
}

.quick-toggles {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pill-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.pill-toggle input {
  display: none;
}

.pill-toggle span {
  height: 31px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-sec);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: 0.15s;
}

.pill-toggle input:checked + span {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--emerald);
  color: #34d399;
}

.filter-summary {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-summary strong {
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

.btn-reset {
  height: 26px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================================
   WORKSPACE: СПИСОК + КАРТА (ПОВНА ВИСОТА ЕКРАНУ)
   ============================================================================ */
.catalog-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  overflow: hidden;
}

.catalog-workspace.mode-split {
  grid-template-columns: 54% 46%;
}

.catalog-workspace.mode-grid {
  grid-template-columns: 1fr;
}
.catalog-workspace.mode-grid .map-pane {
  display: none;
}

.catalog-workspace.mode-map {
  grid-template-columns: 1fr;
}
.catalog-workspace.mode-map .listings-pane {
  display: none;
}

/* Ліва колонка списку */
.listings-pane {
  height: 100%;
  overflow-y: auto;
  padding: 12px 14px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

/* У режимі Split — практичні горизонтальні рядки (видно 3-4 об'єкти одночасно) */
.mode-split .listings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* У режимі Сітка — картки в 3-4 колонки */
.mode-grid .listings-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

/* ============================================================================
   ПРАКТИЧНА КАРТКА ОБ'ЄКТА (ГОРИЗОНТАЛЬНА У SPLIT / ВЕРТИКАЛЬНА У GRID)
   ============================================================================ */
.apt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
  display: grid;
}

.mode-split .apt-card {
  grid-template-columns: 215px 1fr;
  min-height: 168px;
}

.mode-grid .apt-card {
  grid-template-columns: 1fr;
  grid-template-rows: 205px 1fr;
}

.apt-card:hover,
.apt-card.highlighted {
  border-color: rgba(99, 102, 241, 0.55);
  background: var(--bg-card-hover);
}

/* Галерея реальних фото з перемикачем ‹ › */
.apt-gallery {
  position: relative;
  background: #0d131f;
  overflow: hidden;
  user-select: none;
}

.apt-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.apt-gallery:hover .apt-photo {
  transform: scale(1.03);
}

/* Кнопки гортання реальних фото прямо на картці */
.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  z-index: 4;
}

.apt-gallery:hover .photo-nav {
  opacity: 1;
}

.photo-nav:hover {
  background: var(--primary);
}

.photo-nav.prev { left: 6px; }
.photo-nav.next { right: 6px; }

.photo-counter {
  position: absolute;
  bottom: 7px;
  right: 7px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  z-index: 3;
}

.gallery-top-badges {
  position: absolute;
  top: 7px;
  left: 7px;
  right: 7px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  pointer-events: none;
  z-index: 3;
}

.source-pill {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
}
.src-olx { background: rgba(2, 132, 199, 0.92); }
.src-rieltor { background: rgba(217, 119, 6, 0.92); }
.src-domria { background: rgba(225, 29, 72, 0.92); }
.src-flatfy { background: rgba(5, 150, 105, 0.92); }

.dist-pill-map {
  background: rgba(6, 182, 212, 0.95);
  color: #082f49;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
}

/* Права інформаційна частина картки */
.apt-body {
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.apt-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.apt-price-group {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.apt-price-main {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16.5px;
  font-weight: 800;
  color: #fff;
}

.apt-price-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
}

.apt-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.seller-chip {
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.seller-chip.owner {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.seller-chip.agency {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-sec);
}

.crm-status-mini {
  height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-sec);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.apt-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.apt-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #f1f5f9;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.apt-title:hover {
  color: #818cf8;
}

.apt-loc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
}

.loc-district-btn {
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.loc-district-btn:hover {
  background: rgba(6, 182, 212, 0.22);
}

.loc-subway {
  color: #fbbf24;
  font-weight: 600;
}

.loc-complex {
  color: #a5b4fc;
  font-weight: 600;
}

.apt-specs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.spec-tag {
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sec);
  font-size: 11px;
  font-weight: 600;
}

.spec-tag.autonomy {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

.apt-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.apt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  flex-wrap: wrap;
}

.phone-cta {
  height: 27px;
  padding: 0 10px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  cursor: pointer;
}

.phone-cta.direct {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.phone-cta.portal {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-sec);
  font-family: 'Inter', sans-serif;
}

.apt-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.act-btn {
  height: 27px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-sec);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: 0.15s;
}

.act-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.act-btn.radius-here {
  border-color: rgba(6, 182, 212, 0.35);
  color: #22d3ee;
}
.act-btn.radius-here:hover {
  background: rgba(6, 182, 212, 0.2);
}

/* ============================================================================
   ПРАВА КОЛОНКА: ІНТЕРАКТИВНА КАРТА + ВБУДОВАНИЙ ГЕО-РАДАР (ТОЧКА + РАДІУС)
   ============================================================================ */
.map-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.map-geo-header {
  padding: 8px 10px;
  background: #121a2b;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 25;
}

.geo-street-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.geo-autocomplete-wrap {
  position: relative;
  flex: 1;
}

.geo-ico {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
}

.geo-autocomplete-wrap input {
  width: 100%;
  height: 31px;
  padding: 0 28px 0 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.geo-autocomplete-wrap input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.btn-clear-pin {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(244, 63, 94, 0.25);
  color: #fda4af;
  font-size: 11px;
  cursor: pointer;
}

.geo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #151f32;
  border: 1px solid rgba(6, 182, 212, 0.5);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65);
  max-height: 230px;
  overflow-y: auto;
  z-index: 2000;
}

.geo-drop-item {
  padding: 8px 11px;
  font-size: 12px;
  color: var(--text-sec);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.geo-drop-item:hover {
  background: rgba(6, 182, 212, 0.16);
  color: #fff;
}

.btn-geo-go {
  height: 31px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-pin-mode {
  height: 31px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-sec);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-pin-mode.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--emerald);
  color: #34d399;
}

.geo-radius-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.radius-title {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.radius-pills {
  display: inline-flex;
  gap: 3px;
}

.r-pill {
  height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-sec);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.r-pill.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #082f49;
  font-weight: 800;
}

.radius-range {
  width: 85px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.radius-readout {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #22d3ee;
  min-width: 44px;
}

.geo-status-chip {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.geo-status-chip.active-pin {
  background: rgba(6, 182, 212, 0.16);
  color: #22d3ee;
  font-weight: 700;
}

/* Сама карта */
.map-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.realtor-map {
  width: 100%;
  height: 100%;
  background: #e2e8f0;
}

.realtor-map.osm-dark-tiles .leaflet-tile-pane {
  filter: invert(92%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.map-floating-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 900;
  display: flex;
  gap: 6px;
}

.map-ctrl-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.map-ctrl-btn:hover {
  background: var(--primary);
}

/* Маркери цін на карті */
.price-pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: #1e293b;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease;
}

.price-pin.is-owner {
  background: #059669;
  border-color: #a7f3d0;
}

.price-pin.in-radius {
  background: #4f46e5;
  border-color: #22d3ee;
}

.price-pin:hover {
  transform: translate(-50%, -50%) scale(1.14);
  z-index: 999 !important;
}

.center-radar-pin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #06b6d4;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(6, 182, 212, 0.35), 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* ============================================================================
   КЛІЄНТИ, KANBAN ТА РАДАР ПАРСЕРІВ
   ============================================================================ */
.section-bar {
  padding: 14px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-bar h2 {
  font-size: 15px;
  font-weight: 800;
}

.section-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.clients-container {
  padding: 16px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}

.client-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.client-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.client-matches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 210px;
  overflow-y: auto;
}

.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 12px;
}

.kanban-board {
  padding: 14px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  overflow-x: auto;
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.kanban-col-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
}

.kanban-cards {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radar-cards {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.radar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radar-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-ok {
  font-size: 11px;
  font-weight: 700;
  color: #34d399;
}

.logs-box {
  margin: 0 16px 16px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex: 1;
  overflow-y: auto;
}

.logs-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-item {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

/* ============================================================================
   МОДАЛЬНІ ВІКНА ТА ДЕТАЛЬНА ГАЛЕРЕЯ КВАРТИРИ
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.8);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 3000;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-box.modal-lg {
  max-width: 820px;
}

.modal-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sec);
  cursor: pointer;
}

.modal-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.form-checks {
  display: flex;
  gap: 14px;
  padding-top: 4px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
}

.btn-secondary {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sec);
  cursor: pointer;
}

.detail-body {
  padding: 16px;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}

.detail-gallery-grid img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

.toast-wrap {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 14px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
