:root {
  --bg: #FCFAF6;
  --bg-alt: #F2ECE1;
  --fg: #1B1A17;
  --fg-soft: #7A7468;
  --accent: #1E88E5;
  --accent-dark: #145DA8;
  --accent-gradient: linear-gradient(135deg, #3B8CE8 0%, #2A72D6 55%, #1D5BB8 100%);
  --accent-gradient-hover: linear-gradient(135deg, #2E7BD6 0%, #2263C0 55%, #164A94 100%);
  --forest: linear-gradient(160deg, #1E3C64 0%, #142B4A 60%, #0B1930 100%);
  --forest-fg: #FFFFFF;
  --line: rgba(27, 26, 23, .14);
  --line-strong: rgba(27, 26, 23, .24);
  --available: #3F8A5D;
  --reserved: #C98A3B;
  --sold: #C0392B;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow: 0 2px 6px rgba(27, 26, 23, .06), 0 26px 48px -14px rgba(33, 150, 243, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Karla', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Libre Franklin', system-ui, sans-serif;
  font-weight: 600;
  margin: 0;
  color: var(--fg);
  letter-spacing: -0.01em;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; }

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 40px;
}

.section { padding-top: 72px; padding-bottom: 72px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 40px; gap: 24px; flex-wrap: wrap; }

.complex-filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-tab {
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--fg-soft); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.filter-tab:hover { border-color: var(--accent); color: var(--accent); }
.filter-tab.active { background: var(--accent-gradient); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(33, 150, 243, .28); }

.filter-layout { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }

.filter-sidebar {
  position: sticky; top: 100px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; display: flex; flex-direction: column; gap: 18px;
  background: #fff;
}
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-label { font-size: 12.5px; font-weight: 600; color: var(--fg-soft); text-transform: uppercase; letter-spacing: .03em; }

.filter-select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-strong);
  font-size: 13.5px; color: var(--fg); background: #fff; font-family: inherit;
}

.filter-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { cursor: pointer; }
.filter-chip input { position: absolute; opacity: 0; pointer-events: none; }
.filter-chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 13px; color: var(--fg-soft); transition: all .15s;
}
.filter-chip input:checked + span { background: var(--accent-gradient); border-color: transparent; color: #fff; }

.filter-range-row { display: flex; align-items: center; gap: 8px; color: var(--fg-soft); font-size: 13px; }
.filter-range-row input {
  width: 100%; min-width: 0; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  font-size: 13.5px; font-family: inherit;
}

.filter-checkbox { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--fg-soft); cursor: pointer; }
.filter-checkbox input { width: 16px; height: 16px; }

.filter-reset { text-align: center; font-size: 13px; color: var(--fg-soft); text-decoration: underline; }
.filter-reset:hover { color: var(--accent); }

.filter-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.filter-count { font-size: 14px; color: var(--fg-soft); }
.filter-sort { width: auto; }

.secondary-empty { padding: 60px 24px; text-align: center; color: var(--fg-soft); font-size: 14.5px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }

/* ── SEO-текст унизу сторінки ЖК/головної ───────────────────── */
.seo-text { border-top: 1px solid var(--line); }
.seo-text-body { font-size: 14px; line-height: 1.7; color: var(--fg-soft); display: flex; flex-direction: column; gap: 14px; max-width: 1000px; }
.seo-text-body h2 { font-size: 20px; color: var(--fg); margin-bottom: 14px; }
.seo-text-body h3 { font-size: 16px; color: var(--fg); margin: 8px 0 4px; }
.seo-text-body p, .seo-text-body ul { margin: 0; }
.seo-text-body ul { padding-left: 20px; }
.seo-text-body li { margin-bottom: 4px; }

/* ── Паспорт об'єкта / комплектація квартири ─────────────────── */
.complex-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.complex-info-card { padding: 24px 26px; }
.complex-info-text { font-size: 13.5px; line-height: 1.8; color: var(--fg-soft); }
.complex-info-text p { margin: 0 0 6px; }
.complex-map { border-radius: var(--radius-lg); overflow: hidden; height: 320px; background: var(--bg-alt); }

@media (max-width: 900px) {
  .complex-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .filter-layout { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; }
}

@media (max-width: 640px) {
  .section { padding-top: 44px; padding-bottom: 44px; }
  .complex-filter-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .complex-filter-tabs .filter-tab { display: block; width: 100%; text-align: center; }
  /* «Будуються / Здано / Усі» на головній — рівно 3, в один рядок */
  .complex-filter-tabs-inline { display: flex; grid-template-columns: none; flex-wrap: nowrap; gap: 6px; width: 100%; }
  .complex-filter-tabs-inline .filter-tab {
    flex: 1; display: block; width: auto; text-align: center;
    padding: 10px 4px; font-size: 12.5px; white-space: nowrap;
  }
}

.eyebrow {
  font-family: 'Libre Franklin', sans-serif;
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  color: var(--accent-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: background .25s, border-color .2s, box-shadow .25s, transform .15s;
}
.btn-primary { background: var(--accent-gradient); color: #fff; box-shadow: 0 6px 18px rgba(33, 150, 243, .32); border: none; }
.btn-primary:hover { background: var(--accent-gradient-hover); box-shadow: 0 8px 22px rgba(33, 150, 243, .42); transform: translateY(-1px); }
.btn-outline { border: 1.5px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-gradient); border-color: transparent; color: #fff; }

.card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.badge-progress { background: rgba(33, 150, 243, .12); color: var(--accent-dark); }
.badge-done { background: rgba(63, 138, 93, .14); color: var(--available); }
.badge-sold { background: rgba(122, 116, 104, .16); color: var(--sold); }

/* Ці ж плашки статусу вживаються і поверх фото (картки ЖК/оголошень) —
   там напівпрозорий світлий фон+кольоровий текст майже не видно. Подвійний
   клас (специфічність 0,2,0) гарантовано перебиває колір статусу вище. */
.badge.badge-status,
.badge.secondary-card-badge,
.badge.catalog-card-badge {
  background: rgba(10, 12, 24, .62);
  color: #fff;
}

.nav-link { font-size: 14.5px; font-weight: 500; color: var(--fg-soft); }
.nav-link:hover, .nav-link.active { color: var(--accent-dark); }

/* ── Utility bar ─────────────────────────────────────────── */
.util-bar { background: var(--forest); position: relative; z-index: 130; }
.util-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 9px;
  padding-bottom: 9px;
  gap: 24px;
}
.util-info { display: flex; align-items: center; gap: 18px; font-size: 12.5px; color: rgba(255, 255, 255, .58); white-space: nowrap; }
.util-info a { color: rgba(255, 255, 255, .88); font-weight: 500; }
.util-info a.util-email { color: rgba(255, 255, 255, .58); }
.util-divider { width: 1px; height: 11px; background: rgba(255, 255, 255, .16); flex-shrink: 0; }
.social-row { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.social-icon-bare {
  width: auto; height: auto; border: none; border-radius: 6px;
  padding: 4px; display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
}
.social-icon-bare:hover { opacity: .75; }
.social-dot {
  width: 23px; height: 23px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .65);
}

/* ── Main header ─────────────────────────────────────────── */
.site-header { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(27, 26, 23, .04); position: sticky; top: 0; z-index: 120; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 15px; padding-bottom: 15px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-logo { height: 60px; display: block; background: var(--forest); border-radius: 10px; padding: 8px 14px; }
.brand-name { font-family: 'Libre Franklin', sans-serif; font-size: 19px; font-weight: 600; letter-spacing: .01em; color: var(--fg); white-space: nowrap; }
.main-nav { display: flex; gap: 18px; align-items: center; flex: 1; justify-content: center; white-space: nowrap; }
.main-nav-contact { display: none; }
.nav-count { background: rgba(33, 150, 243, .10); color: var(--accent-dark); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.header-phone { color: var(--fg); font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav-toggle { display: none; }

/* ── Випадаючий список телефонів ─────────────────────────── */
.phone-dropdown { position: relative; }
.phone-dropdown-toggle {
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; cursor: pointer;
  color: rgba(255, 255, 255, .88); font-weight: 500; font-size: 12.5px;
}
.phone-dropdown-light .phone-dropdown-toggle { color: var(--fg); font-weight: 600; font-size: 14px; }
.phone-dropdown-toggle svg { transition: transform .15s; flex-shrink: 0; }
.phone-dropdown-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.phone-dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 10px;
  background: #fff; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
  padding: 6px; min-width: 190px; z-index: 60;
}
.phone-dropdown-menu.open { display: block; }
.phone-dropdown-menu a {
  display: block; padding: 9px 12px; border-radius: 6px;
  color: var(--fg); font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.phone-dropdown-menu a:hover { background: var(--bg-alt); }

/* ── Спадне меню «Каталог квартир» (ЖК, що будуються) ───────── */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { display: flex; align-items: center; gap: 5px; }
.nav-dropdown-toggle svg { transition: transform .15s; }
.nav-dropdown:hover .nav-dropdown-toggle svg, .nav-dropdown:focus-within .nav-dropdown-toggle svg { transform: rotate(180deg); }
.nav-dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0; padding-top: 10px;
  min-width: 280px; z-index: 60;
}
.nav-dropdown-menu-inner {
  background: #fff; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
  padding: 6px;
}
.nav-dropdown:hover .nav-dropdown-menu, .nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 12px; border-radius: 6px;
  color: var(--fg); font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--bg-alt); }
.nav-dropdown-count { color: var(--fg-soft); font-weight: 500; font-size: 12px; flex-shrink: 0; }
.nav-dropdown-all { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px !important; color: var(--accent) !important; justify-content: flex-start !important; }

@media (max-width: 900px) {
  .brand-logo { height: 46px; padding: 6px 10px; }
  .util-info { display: none; }
  .nav-dropdown { width: 100%; }
  .nav-dropdown-menu {
    display: block; position: static; padding-top: 0;
    margin: 6px 0 4px 14px; min-width: 0; border-left: 2px solid var(--line);
  }
  .nav-dropdown-menu-inner { background: none; box-shadow: none; padding: 2px 0 2px 14px; }
  .nav-dropdown-toggle svg { display: none; }
  .main-nav {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 150;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 6px 22px 22px; display: none;
    box-shadow: 0 16px 28px rgba(6, 8, 16, .12);
    max-height: calc(100vh - 64px); overflow-y: auto;
  }
  .main-nav.open { display: flex; }
  .main-nav > .nav-link {
    width: 100%; padding: 17px 2px; font-size: 17px; font-weight: 600;
    color: var(--fg); border-bottom: 1px solid var(--line);
  }
  .main-nav .nav-dropdown-toggle {
    width: 100%; justify-content: space-between;
    padding: 17px 2px; font-size: 17px; font-weight: 600;
    color: var(--fg); border-bottom: 1px solid var(--line);
  }
  .main-nav-contact {
    display: flex; flex-direction: column; gap: 13px;
    width: 100%; margin-top: 14px; padding-top: 18px;
    border-top: 1px solid var(--line);
  }
  .main-nav-contact a { font-size: 16px; font-weight: 600; color: var(--fg); }
  .main-nav-contact a.main-nav-email { font-weight: 500; color: var(--fg-soft); }
  .header-phone { display: none; }
  .nav-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; flex-shrink: 0;
  }
}

/* ── Лайтбокс (перегляд зображення на весь екран) ───────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6, 8, 16, .92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 88vw; max-height: 88vh; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 20px; right: 24px; background: none; border: none;
  color: #fff; font-size: 36px; line-height: 1; cursor: pointer;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 48px; height: 48px; border-radius: 50%; font-size: 28px; cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255,255,255,.22); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ── Фотогалерея з мініатюрами (вторинка, новини) ───────────── */
.photo-gallery-main {
  display: block; width: 100%; border: none; padding: 0; cursor: zoom-in;
  border-radius: var(--radius-lg); overflow: hidden; height: 420px; background-color: var(--bg-alt);
}
.photo-gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.photo-gallery-thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.photo-gallery-thumb {
  aspect-ratio: 1; border-radius: 8px; border: 2px solid transparent;
  background-size: cover; background-position: center; background-color: var(--bg-alt);
  cursor: pointer; padding: 0;
}
.photo-gallery-thumb.active { border-color: var(--accent); }
.photo-gallery-thumb:hover { opacity: .85; }

.zoom-btn {
  position: absolute; top: 14px; right: 14px; z-index: 15;
  display: flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1;
  background: rgba(20, 19, 17, .92); color: #fff; border: none;
  padding: 8px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.zoom-btn svg { flex-shrink: 0; }
.zoom-btn span { flex-shrink: 0; }
.zoom-btn:hover { background: rgba(27, 26, 23, .88); }

/* ── Швидке редагування для персоналу (посилання на адмінку) ─ */
.staff-edit-link {
  position: fixed; bottom: 24px; right: 24px; z-index: 1200;
  display: flex; align-items: center; gap: 7px;
  background: #1B1A17; color: #fff; text-decoration: none;
  padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28); transition: background .15s;
}
.staff-edit-link:hover { background: var(--accent); }
.staff-edit-link-inline {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-alt); color: var(--fg-soft); text-decoration: none;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line-strong);
}
.staff-edit-link-inline:hover { color: var(--accent); border-color: var(--accent); }

/* ── Модалка «Залишити заявку» ───────────────────────────── */
.lead-modal {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(6, 8, 16, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lead-modal[hidden] { display: none; }
.lead-modal-card {
  position: relative; width: 100%; max-width: 400px;
  background: #fff; border-radius: var(--radius-lg); padding: 32px;
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, .35);
}
.lead-modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  color: var(--fg-soft); font-size: 26px; line-height: 1; cursor: pointer;
}
.lead-modal-card h3 { font-size: 21px; margin-bottom: 6px; }
.lead-modal-note { font-size: 13.5px; color: var(--fg-soft); margin-bottom: 18px; }
.lead-modal-field { margin-bottom: 14px; }
.lead-modal-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--fg-soft); margin-bottom: 6px; }
.lead-modal-field input {
  width: 100%; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line-strong);
  font-size: 14px; font-family: inherit;
}
.lead-modal-status { margin-top: 14px; font-size: 14px; text-align: center; }
.lead-modal-status-ok { color: var(--available); font-weight: 600; }
.lead-modal-status-error { color: #C0392B; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer { background: var(--forest); color: rgba(255, 255, 255, .75); }
.footer-top {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr 1.15fr;
  gap: 28px;
  padding-top: 96px;
  padding-bottom: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}
.footer-col-title { color: var(--forest-fg); font-weight: 600; font-size: 14px; margin-bottom: 16px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-bottom { padding-top: 24px; padding-bottom: 40px; font-size: 13px; }

@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-top { grid-template-columns: 1fr; gap: 36px; }
  .footer-top > div:last-child .social-row { justify-content: center; width: 100%; }
}
