/* ==========================================================================
   Апарт-отель «Грушевый цвет» — шахматка лотов
   Палитра и типографика взяты с grushevyi.com
   ========================================================================== */

/* Заголовочный шрифт бренда. На grushevyi.com к одному семейству привязаны
   три начертания; здесь используется только то, которым набраны заголовки. */
@font-face {
  font-family: 'GC Display';
  src: url('../fonts/TenorSans-Regular.woff') format('woff');
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Бренд */
  --brown:        #6c5a48;
  --brown-dark:   #534332;
  --brown-soft:   #8d7c6b;
  --cream:        #f8f7f1;
  --cream-deep:   #efece1;
  --gold:         #ccb366;
  --line:         #ddd6c8;
  --line-soft:    #e9e4d8;
  --white:        #ffffff;

  /* Статусы лотов */
  --st-available:      #e7efe3;
  --st-available-line: #8fae7c;
  --st-available-text: #3f5733;

  --st-reserved:       #fbf0d8;
  --st-reserved-line:  #ccb366;
  --st-reserved-text:  #7d6420;

  --st-sold:           #efe7e2;
  --st-sold-line:      #bfa595;
  --st-sold-text:      #7d6152;

  --st-notsale:        #eceae4;
  --st-notsale-line:   #c6c0b2;
  --st-notsale-text:   #7d7767;

  --radius: 4px;
  --shadow-sm: 0 1px 2px rgba(83, 67, 50, .06);
  --shadow-md: 0 8px 28px rgba(83, 67, 50, .12);
  --shadow-lg: 0 24px 70px rgba(83, 67, 50, .28);
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --display: 'GC Display', 'Times New Roman', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* Собственный display у элемента иначе перебивает атрибут hidden */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--cream);
  color: var(--brown-dark);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, select, input { font-family: inherit; font-size: inherit; color: inherit; }

.page {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px);
}

/* ============================ Шапка ============================ */

.header { padding: clamp(24px, 4vw, 48px) 0 0; }

.header-inner {
  display: flex;
  gap: clamp(24px, 4vw, 56px);
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: clamp(16px, 2vw, 28px); align-items: flex-start; max-width: 760px; }

.brand-mark {
  width: clamp(64px, 8vw, 104px);
  height: auto;
  flex: none;
  opacity: .9;
  margin-top: 4px;
}

.brand-wordmark { display: block; width: clamp(190px, 22vw, 260px); height: auto; margin-bottom: 14px; }

.title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.1;
  letter-spacing: .01em;
  margin: 0 0 10px;
  color: var(--brown-dark);
}

.subtitle {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--brown);
  max-width: 62ch;
}

.project-meta { display: flex; flex-wrap: wrap; gap: 10px 28px; }

.project-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--brown-dark);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.project-link:hover { border-color: var(--gold); }

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brown-soft);
}

/* Описание проекта: на десктопе раскрыто всегда, на телефоне сворачивается */
.about { margin: 0; }
.about > summary {
  display: none;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  color: var(--brown);
  border-bottom: 1px dashed var(--line);
  width: max-content;
}
.about > summary::-webkit-details-marker { display: none; }

.kpis-mobile { display: none; }

/* KPI */

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 0;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  flex: none;
}

/* Рамка на самой ячейке: при переносе на узких экранах
   незанятое место остаётся белым фоном, а не «дырой» в сетке. */
.kpi {
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px 18px 16px;
  min-width: 96px;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--brown-soft);
  white-space: nowrap;
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1;
  color: var(--brown-dark);
  font-variant-numeric: tabular-nums;
}

.kpi-available .kpi-value { color: var(--st-available-text); }
.kpi-reserved  .kpi-value { color: var(--st-reserved-text); }
.kpi-sold      .kpi-value { color: var(--st-sold-text); }
.kpi-not_sale  .kpi-value { color: var(--st-notsale-text); }

/* ============================ Фильтры ============================ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  padding: 20px 0 22px;
}

.control { display: flex; flex-direction: column; gap: 6px; }

.control label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--brown-soft);
}

.control select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--white) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%236c5a48' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 36px 9px 12px;
  min-width: 168px;
  cursor: pointer;
  transition: border-color .2s;
}
.control select:hover { border-color: var(--brown-soft); }
.control select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.reset-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 18px;
  cursor: pointer;
  color: var(--brown);
  transition: border-color .2s, color .2s;
}
.reset-btn:hover { border-color: var(--brown); color: var(--brown-dark); }

.toolbar-status {
  margin-left: auto;
  font-size: 13px;
  color: var(--brown-soft);
  padding-bottom: 9px;
}
.toolbar-status b { color: var(--brown-dark); font-weight: 600; }

/* ------------------- Чипы и шторка (только мобильные) ------------------- */

.chips { display: none; }

.chip {
  flex: none;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--brown-dark);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.is-active { background: var(--brown-dark); color: var(--cream); border-color: var(--brown-dark); }
.chip-badge:empty { display: none; }
.chip-badge {
  background: var(--gold);
  color: var(--brown-dark);
  border-radius: 100px;
  min-width: 22px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.chip.is-active .chip-badge { background: var(--cream); }
.chip-reset { border-style: dashed; color: var(--brown); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(46, 37, 27, .45);
}

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 70;
  display: none;
  flex-direction: column;
  max-height: 82dvh;
  background: var(--cream);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(83, 67, 50, .22);
  transform: translateY(100%);
  transition: transform .25s ease;
}
.sheet.open { display: flex; transform: none; }

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

.sheet-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 19px;
  color: var(--brown-dark);
}

.sheet-close {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--brown);
  cursor: pointer;
}

.sheet-body { overflow-y: auto; padding: 6px 16px 16px; -webkit-overflow-scrolling: touch; }

.sheet-group { padding: 14px 0 4px; }
.sheet-group + .sheet-group { border-top: 1px solid var(--line-soft); }

.sheet-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--brown-soft);
  margin-bottom: 10px;
}

.sheet-options { display: flex; flex-wrap: wrap; gap: 8px; }

.sheet-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--white);
}

.sheet-apply {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brown-dark);
  color: var(--cream);
  font-size: 16px;
  cursor: pointer;
}
.sheet-apply:disabled { opacity: .5; }

/* --------------------- Липкая панель связи (мобильные) --------------------- */

.mobile-cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--cream);
  border-top: 1px solid var(--line);
}

.mcta {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 16px;
  text-decoration: none;
  border: 1px solid var(--brown-dark);
}
.mcta-call { background: var(--brown-dark); color: var(--cream); }
.mcta-tg { background: transparent; color: var(--brown-dark); }

/* ============================ Раскладка ============================ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(20px, 2.5vw, 36px);
  align-items: start;
  padding-bottom: 48px;
}

.board-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2vw, 26px);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(18px, 2vw, 24px);
  margin: 0;
  color: var(--brown-dark);
}

.board-toolbar { display: flex; align-items: center; gap: 8px; }

.zoom-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--brown);
  font-size: 17px;
  line-height: 1;
  transition: border-color .2s, background .2s;
}
.zoom-btn:hover { border-color: var(--brown); background: var(--cream); }

.zoom-value {
  font-size: 12px;
  color: var(--brown-soft);
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Ячейки переносятся по строкам, поэтому прокрутка не нужна. Важно оставить
   overflow видимым: при overflow-x:auto браузер делает прокручиваемой и
   вертикальную ось, и приподнятая при наведении ячейка обрезается сверху. */
.board-viewport { overflow: visible; padding: 4px 0 6px; }
.board-surface { width: 100%; }

.board { display: flex; flex-direction: column-reverse; gap: 10px; }

.board-loading, .board-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--brown-soft);
}

.floor-row { display: flex; align-items: stretch; gap: 12px; }

.floor-label {
  flex: none;
  width: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 10px;
  background: var(--cream);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.floor-label .n {
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  color: var(--brown-dark);
}
.floor-label .c { font-size: 11px; color: var(--brown-soft); margin-top: 3px; }

.floor-cells { display: flex; flex-wrap: wrap; gap: 6px; }

/* Ячейка лота */

.cell {
  position: relative;
  width: var(--cell-w, 96px);
  min-height: var(--cell-h, 78px);
  padding: 8px 9px 9px;
  border: 1px solid var(--st-notsale-line);
  border-radius: var(--radius);
  background: var(--st-notsale);
  color: var(--st-notsale-text);
  text-align: left;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: inherit;
}
/* Подъём только там, где есть настоящий курсор: на тач-экране hover
   «залипает» после тапа и ячейка остаётся приподнятой */
@media (hover: hover) {
  .cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); z-index: 2; }
}
.cell:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.cell.available { background: var(--st-available); border-color: var(--st-available-line); color: var(--st-available-text); }
.cell.reserved  { background: var(--st-reserved);  border-color: var(--st-reserved-line);  color: var(--st-reserved-text); }
.cell.sold      { background: var(--st-sold);      border-color: var(--st-sold-line);      color: var(--st-sold-text); }
.cell.not_sale  { background: var(--st-notsale);   border-color: var(--st-notsale-line);   color: var(--st-notsale-text); }

.cell.sold::after,
.cell.not_sale::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(83,67,50,.07) 6px 7px);
  pointer-events: none;
  border-radius: inherit;
}


.cell-num {
  font-family: var(--display);
  font-weight: 500;
  font-size: 19px;
  line-height: 1;
  letter-spacing: .01em;
}
.cell-rooms { font-size: 11px; opacity: .82; }
.cell-area { font-size: 12px; font-variant-numeric: tabular-nums; }
.cell-price { font-size: 11px; margin-top: auto; opacity: .9; font-variant-numeric: tabular-nums; }

/* Легенда */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--brown);
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.swatch { width: 14px; height: 14px; border-radius: 2px; border: 1px solid; display: inline-block; }
.legend-item.available .swatch { background: var(--st-available); border-color: var(--st-available-line); }
.legend-item.reserved  .swatch { background: var(--st-reserved);  border-color: var(--st-reserved-line); }
.legend-item.sold      .swatch { background: var(--st-sold);      border-color: var(--st-sold-line); }
.legend-item.not_sale  .swatch { background: var(--st-notsale);   border-color: var(--st-notsale-line); }

.data-note { margin: 14px 0 0; font-size: 12px; color: var(--brown-soft); }
.data-note.error { color: #9d4b32; }

/* Замечания к таблице — видны менеджеру, а не спрятаны в консоли */
.data-issues {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #e0c9a6;
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  background: #fdf8ec;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--brown-dark);
}
.data-issues p { margin: 0 0 6px; }
.data-issues p:last-child { margin-bottom: 0; }

.issues-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #9d7a35;
  margin-bottom: 8px;
}

/* ============================ Сайдбар ============================ */

.sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }

.contacts-card, .summary-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.contacts-card {
  background: linear-gradient(160deg, var(--brown-dark), var(--brown));
  border-color: var(--brown-dark);
  color: var(--cream);
}

.contacts-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .72;
  margin-bottom: 10px;
}

.contacts-phone {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: 25px;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: .01em;
}
.contacts-phone:hover { color: var(--gold); }

.contacts-note { font-size: 12px; opacity: .68; margin: 8px 0 16px; line-height: 1.45; }

.contacts-links { display: flex; flex-wrap: wrap; gap: 8px; }

.contact-link {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid rgba(248, 247, 241, .3);
  border-radius: var(--radius);
  color: var(--cream);
  text-decoration: none;
  font-size: 13px;
  transition: background .2s, border-color .2s, color .2s;
}
.contact-link:hover { background: var(--cream); color: var(--brown-dark); border-color: var(--cream); }

.summary-card h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 17px;
  margin: 0 0 14px;
  color: var(--brown-dark);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.summary-row:last-child { border-bottom: 0; }
.summary-row span:first-child { color: var(--brown-soft); }
.summary-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }

/* ============================ Футер ============================ */

.footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  font-size: 12px;
  color: var(--brown-soft);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-note { max-width: 60ch; }

/* ============================ Модальное окно ============================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
}
.modal.open { display: flex; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(46, 37, 27, .55); backdrop-filter: blur(2px); }

.modal-dialog {
  position: relative;
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(1080px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in .22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  color: var(--brown);
  z-index: 3;
  transition: background .2s, color .2s;
}
.modal-close:hover { background: var(--brown-dark); color: var(--cream); border-color: var(--brown-dark); }

.modal-body { overflow-y: auto; padding: clamp(20px, 3vw, 34px); }

.lot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.lot-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(24px, 3vw, 34px);
  margin: 0 0 6px;
  line-height: 1.1;
  color: var(--brown-dark);
}
/* Фокус на заголовок переводится программно при открытии карточки, чтобы
   скринридер прочитал её начало. Заголовок не интерактивен — рамка не нужна. */
.lot-title:focus { outline: none; }
.lot-subtitle { color: var(--brown); font-size: 14px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border-radius: 100px;
  border: 1px solid;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-badge.available { background: var(--st-available); border-color: var(--st-available-line); color: var(--st-available-text); }
.status-badge.reserved  { background: var(--st-reserved);  border-color: var(--st-reserved-line);  color: var(--st-reserved-text); }
.status-badge.sold      { background: var(--st-sold);      border-color: var(--st-sold-line);      color: var(--st-sold-text); }
.status-badge.not_sale  { background: var(--st-notsale);   border-color: var(--st-notsale-line);   color: var(--st-notsale-text); }

.lot-price-block { text-align: right; }
.lot-price {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(22px, 2.6vw, 30px);
  color: var(--brown-dark);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lot-price-sub { font-size: 13px; color: var(--brown-soft); margin-top: 4px; font-variant-numeric: tabular-nums; }

.lot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(20px, 3vw, 34px);
  align-items: start;
}

/* На узком экране колонки распускаются (display: contents) и выстраиваются
   в одну: сводка параметров, кнопки связи, планировка, фото.
   align-items: stretch обязателен — у .lot-grid задан start для широкой
   раскладки, и во flex-колонке он сжимал бы блоки по содержимому. */
@media (max-width: 900px) {
  .lot-grid { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
  .lot-col-main, .lot-col-plan { display: contents; }
  .lot-grid .params { order: 1; }
  .lot-grid .cta-row { order: 2; margin-top: 0; }
  .lot-grid .plan-panel { order: 3; }
  .lot-grid .block-title { order: 4; margin: 0; }
  .lot-grid .visuals { order: 5; }
}

/* Параметры */

.params { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.param { background: var(--white); padding: 12px 14px; }
.param-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--brown-soft); margin-bottom: 4px; }
.param-value { font-size: 15px; font-weight: 500; color: var(--brown-dark); font-variant-numeric: tabular-nums; }
.param.wide { grid-column: 1 / -1; }
.param.wide .param-value { font-weight: 400; font-size: 14px; }

.block-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  margin: 24px 0 12px;
  color: var(--brown-dark);
}

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.cta {
  display: inline-block;
  padding: 12px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid var(--brown-dark);
  transition: background .2s, color .2s;
}
.cta.primary { background: var(--brown-dark); color: var(--cream); }
.cta.primary:hover { background: var(--brown); border-color: var(--brown); }
.cta.ghost { color: var(--brown-dark); background: transparent; }
.cta.ghost:hover { background: var(--brown-dark); color: var(--cream); }

/* Переключатель планировка / этаж */

.plan-panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.plan-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--cream-deep); }

.plan-tab {
  flex: 1;
  padding: 12px 10px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--brown);
  transition: background .2s, color .2s, border-color .2s;
}
.plan-tab:hover { background: rgba(255,255,255,.6); }
.plan-tab.active { background: var(--white); color: var(--brown-dark); border-bottom-color: var(--gold); font-weight: 500; }

.plan-stage { padding: 14px; min-height: 280px; display: flex; align-items: center; justify-content: center; }
.plan-stage svg { width: 100%; height: auto; max-height: 440px; }

/* План этажа — длинная лента корпуса, прокручивается по горизонтали */
.plan-stage.floor { overflow-x: auto; justify-content: flex-start; }
.plan-stage.floor svg { width: auto; height: 240px; max-height: none; flex: none; }
.plan-stage.floor .fp-unit:hover rect:first-of-type { filter: brightness(.96); }
.plan-caption { padding: 0 16px 14px; font-size: 12px; color: var(--brown-soft); text-align: center; line-height: 1.45; }

/* Кнопка «развернуть» поверх плана */

.plan-panel { position: relative; }

.plan-expand {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  color: var(--brown);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.plan-expand:hover { border-color: var(--brown); color: var(--brown-dark); background: var(--white); }
.plan-expand svg { width: 13px; height: 13px; }

.plan-stage.zoomable { cursor: zoom-in; }

/* Полноэкранный просмотр плана */

.plan-viewer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  flex-direction: column;
  background: var(--cream);
}
.plan-viewer.open { display: flex; }

.plan-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(12px, 2vw, 22px);
  border-bottom: 1px solid var(--line);
  background: var(--white);
  flex: none;
}

.plan-viewer-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(15px, 2vw, 19px);
  color: var(--brown-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-viewer-tools { display: flex; align-items: center; gap: 8px; flex: none; }

.plan-viewer-close {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  color: var(--brown);
  margin-left: 6px;
  transition: background .2s, color .2s;
}
.plan-viewer-close:hover { background: var(--brown-dark); color: var(--cream); border-color: var(--brown-dark); }

.plan-viewer-stage {
  flex: 1;
  overflow: auto;
  padding: clamp(10px, 2vw, 24px);
  -webkit-overflow-scrolling: touch;
}
.plan-viewer-stage svg { display: block; margin: 0 auto; height: auto; }

.plan-viewer-hint {
  flex: none;
  padding: 10px clamp(12px, 2vw, 22px) 14px;
  border-top: 1px solid var(--line);
  background: var(--white);
  font-size: 12px;
  color: var(--brown-soft);
  line-height: 1.45;
}

/* Экспликация помещений */

.explication { padding: 4px 18px 16px; }

.expl-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--brown-soft);
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.expl-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  font-size: 12.5px;
  border-bottom: 1px dotted var(--line-soft);
}
.expl-row span:last-child { font-variant-numeric: tabular-nums; color: var(--brown); white-space: nowrap; }
.expl-row.total {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 8px;
  font-weight: 600;
}
.expl-row.total span:last-child { color: var(--brown-dark); }

/* Визуализации */

.visuals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.visual-thumb {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--cream-deep);
  aspect-ratio: 4 / 3;
  transition: border-color .2s, transform .12s;
}
@media (hover: hover) {
  .visual-thumb:hover { border-color: var(--brown); transform: translateY(-2px); }
}
.visual-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.modal-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(20px, 3vw, 34px);
  border-top: 1px solid var(--line);
  background: var(--cream-deep);
}

.modal-nav-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 18px;
  cursor: pointer;
  color: var(--brown);
  transition: border-color .2s, color .2s, opacity .2s;
}
.modal-nav-btn:hover:not(:disabled) { border-color: var(--brown); color: var(--brown-dark); }
.modal-nav-btn:disabled { opacity: .35; cursor: default; }

/* ============================ Лайтбокс ============================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(37, 30, 22, .93);
  padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: var(--radius); }

.lightbox-close, .lightbox-nav {
  position: absolute;
  background: rgba(248, 247, 241, .1);
  border: 1px solid rgba(248, 247, 241, .3);
  color: var(--cream);
  cursor: pointer;
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 24px;
  line-height: 1;
  transition: background .2s;
}
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(248, 247, 241, .25); }
.lightbox-close { top: 24px; right: 24px; }
.lightbox-nav.prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-counter { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: var(--cream); font-size: 13px; opacity: .75; }

/* ============================ Адаптив ============================ */

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .contacts-card, .summary-card { flex: 1 1 300px; }
}

@media (max-width: 900px) {
  .lot-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(90px, 1fr)); width: 100%; }
  .brand { flex-direction: column; }
  .brand-mark { width: 62px; }
}

@media (max-width: 620px) {
  body { font-size: 14px; }

  /* --- Шапка: только логотип, название и свёрнутое описание --- */
  .header-inner { padding-bottom: 0; border-bottom: 0; }
  .header { padding-top: 14px; }
  .brand { flex-direction: row; align-items: center; gap: 12px; }
  .brand-mark { width: 44px; margin-top: 0; }
  .brand-wordmark { width: 168px; margin-bottom: 8px; }
  .title { font-size: 24px; margin-bottom: 6px; }
  .about > summary { display: block; min-height: 44px; line-height: 44px; }
  .about[open] > summary { margin-bottom: 6px; }
  .subtitle { margin-bottom: 12px; }

  /* Плитки статистики заменяются одной строкой */
  .kpis { display: none; }
  .kpis-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 13px;
    color: var(--brown);
    padding: 12px 0;
    margin-top: 12px;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
  }
  .kpis-mobile b { color: var(--brown-dark); font-weight: 600; }

  /* --- Фильтры: липкая строка чипов вместо селектов --- */
  .toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: 0 calc(-1 * clamp(16px, 3vw, 40px));
    padding: 10px clamp(16px, 3vw, 40px);
    background: var(--cream);
    box-shadow: 0 1px 0 var(--line-soft);
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .control, .reset-btn, .toolbar-status { display: none; }
  .chips { display: flex; gap: 8px; }

  /* --- Шахматка: резиновые ячейки, всегда 4 в ряд --- */
  .board-wrap { padding: 14px; display: flex; flex-direction: column; }
  .legend { order: -1; margin: 0 0 14px; padding-top: 0; border-top: 0; gap: 8px 16px; font-size: 12px; }
  .board-toolbar { display: none; }
  .floor-row { flex-direction: column; gap: 8px; }
  .floor-label {
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 6px 12px;
  }
  .floor-label .n { font-size: 17px; }
  .floor-label .c { margin-top: 0; }
  .floor-cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .cell { width: auto; min-height: 76px; padding: 6px 7px 7px; }
  .cell-num { font-size: 16px; }
  .cell-rooms, .cell-price { font-size: 10px; }
  .cell-area { font-size: 11px; }

  /* --- Карточка лота на весь экран --- */
  .modal { padding: 0; }
  .modal-dialog { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .modal-close { width: 44px; height: 44px; top: 8px; right: 8px; }
  .lot-head { flex-direction: column; }
  .lot-price-block { text-align: left; }
  /* Две колонки и на телефоне: в один столбец сводка растянулась бы почти
     на весь экран и отодвинула кнопки связи */
  .params { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .param { padding: 10px 12px; }
  .param-value { font-size: 14px; }
  .cta-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .cta { min-height: 52px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
  .visuals { grid-template-columns: repeat(3, 1fr); }
  .modal-nav-btn { min-height: 44px; }
  .plan-expand { min-height: 44px; padding: 0 14px; top: 52px; }
  /* План этажа внутри карточки нечитаем — показываем «обложку» с переходом
     в полноэкранный просмотр */
  .plan-stage.floor { max-height: 190px; overflow: hidden; position: relative; }

  /* --- Прочее --- */
  .contact-link, .contacts-phone { min-height: 44px; display: inline-flex; align-items: center; }
  .project-link { min-height: 44px; justify-content: center; }
  .zoom-btn, .plan-viewer-close, .lightbox-close { width: 44px; height: 44px; }
  .lightbox { padding: 16px; }
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }

  /* Липкая панель связи и запас под неё */
  .mobile-cta-bar.is-visible { display: grid; }
  body.has-cta-bar { padding-bottom: 76px; }
  body.modal-open .mobile-cta-bar { display: none; }
}

/* iOS зумит страницу при фокусе на контроле мельче 16px */
@media (max-width: 900px) {
  select, input, textarea { font-size: 16px; }
}

/* Ландшафт на телефоне: цена не должна уезжать под крестик */
@media (max-height: 480px) and (orientation: landscape) {
  .lot-head { flex-direction: column; }
  .lot-price-block { text-align: left; }
  .lot-head > div:first-child { padding-right: 56px; }
  .modal-close { top: 6px; right: 6px; }
  .modal-nav { display: none; }
  .modal-dialog { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .modal { padding: 0; }
}

@media print {
  .toolbar, .sidebar, .board-toolbar, .modal, .lightbox, .footer { display: none !important; }
}
