/* Свой каталог ЖК: стеклянная панель с видами, фильтрами и подбором. */
.cat { position: relative; min-height: 420px; padding: 10px; border-radius: 32px; }
.cat-wait, .cat-empty { display: grid; place-items: center; min-height: 360px; margin: 0; padding: 24px; color: var(--ink-2); text-align: center; }
.cat-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 2px 10px; }
.cat-tabs { display: flex; gap: 2px; padding: 4px; overflow-x: auto; border-radius: 999px; background: rgba(15, 36, 39, 0.06); scrollbar-width: none; }
.cat-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font-size: 0.95rem; font-weight: 600; color: var(--ink-2); transition: background-color 0.2s, color 0.2s, box-shadow 0.2s; }
.cat-tab:hover { color: var(--ink); }
.cat-tab[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-s); }
.cat-tools { display: flex; gap: 6px; }
.cat-ftoggle { display: none; }
.chip-sm { min-height: 32px; padding: 0 12px; font-size: 0.85rem; }
.chip-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: rgba(15, 36, 39, 0.08); font-size: 0.75rem; font-weight: 650; }
.chip[aria-pressed="true"] .chip-n { background: rgba(255, 255, 255, 0.2); }

.cat-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 10px; padding: 12px 14px; border-radius: 22px; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 1px rgba(15, 36, 39, 0.06); }
.cf-rooms { display: flex; gap: 6px; }
.cf-range { display: grid; gap: 2px; min-width: 190px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.cf-range output { margin-left: 4px; font-size: 0.9rem; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--ink); }
.cf-range input { width: 100%; accent-color: var(--teal-2); }
.cf-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 550; }
.cf-check input { width: 18px; height: 18px; accent-color: var(--teal-2); }
.cf-layout { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--ink); font-size: 0.85rem; font-weight: 600; color: #fff; }
.cf-layout[hidden] { display: none; }
.cf-layout button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.18); color: #fff; }
.cf-count { margin-left: auto; font-weight: 650; }
.cf-reset { padding: 4px; border: 0; background: none; font-weight: 600; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }

.cat-body { position: relative; }
.cat-tip { position: absolute; top: 0; left: 0; z-index: 8; display: grid; gap: 2px; max-width: 280px; padding: 10px 12px; border-radius: 14px; font-size: 0.85rem; line-height: 1.3; pointer-events: none; }
.cat-tip[hidden] { display: none; }
.cat-tip b { font-weight: 650; }
.cat-tip span { color: rgba(255, 255, 255, 0.78); }

/* Генплан и другие виды: картинка, поверх неё SVG-разметка и подписи домов. */
.scn-tabs { display: flex; gap: 6px; padding: 0 2px 10px; overflow-x: auto; scrollbar-width: none; }
.scn-tabs .chip { flex: none; }
.scn-scroll { overflow-x: auto; border-radius: 24px; scrollbar-width: thin; }
.scn-stage { position: relative; min-width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 24px; background: var(--paper-2); }
.scn-stage.is-broken::after { content: "Не удалось загрузить изображение"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); }
.scn-img, .scn-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scn-img { object-fit: fill; }
.z { fill: rgba(29, 131, 124, 0.18); stroke: rgba(255, 255, 255, 0.9); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill 0.18s; }
.z:hover { fill: rgba(29, 131, 124, 0.45); }
.z-building.is-off { fill: rgba(242, 240, 234, 0.3); }
.z-link { fill: rgba(255, 255, 255, 0.1); stroke-dasharray: 6 5; }
.z-link:hover { fill: rgba(255, 255, 255, 0.35); }
.z-flat.st-available { fill: rgba(29, 131, 124, 0.5); }
.z-flat.st-available:hover { fill: rgba(29, 131, 124, 0.75); }
.z-flat.st-reserved { fill: rgba(255, 138, 92, 0.55); }
.z-flat.st-sold { fill: rgba(120, 116, 106, 0.55); }
.z-flat.is-off { fill: rgba(242, 240, 234, 0.25); stroke: rgba(255, 255, 255, 0.45); }
.scn-labels { position: absolute; inset: 0; pointer-events: none; }
.scn-label { position: absolute; display: grid; gap: 1px; padding: 8px 12px; border: 0; border-radius: 16px; font-size: 0.8rem; text-align: center; white-space: nowrap; pointer-events: auto; transform: translate(-50%, -50%); transition: transform 0.18s var(--ease-out), opacity 0.2s; }
.scn-label b { font-size: 0.92rem; font-weight: 650; }
.scn-label span { font-weight: 600; color: var(--teal); }
.scn-label:hover { transform: translate(-50%, -50%) scale(1.04); }
.scn-label.is-off { opacity: 0.72; }
.scn-label.is-off span { color: var(--ink-3); }
.scn-label span i { font-style: normal; }
.scn-labels.is-compact .scn-label { display: flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: 12px; font-size: 0.74rem; }
.scn-labels.is-compact .scn-label b { font-size: 0.8rem; }
.scn-labels.is-compact .lb-p { display: none; }
.scn-back { margin: 10px 2px 0; }
.scn-hint { margin: 10px 4px 2px; }

/* Шахматка: секции рядом, этажи сверху вниз, ячейка — квартира. */
.chs-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 12px; }
.chs-bld { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chs-bld .chip { flex: none; }
.chs-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); }
.chs-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chs-legend i { width: 12px; height: 12px; border-radius: 4px; }
.chs-scroll { max-height: min(720px, 72vh); overflow: auto; border-radius: 22px; background: rgba(255, 255, 255, 0.5); overscroll-behavior: contain; }
.chs-grid { display: flex; gap: 26px; width: max-content; padding: 14px; }
.chs-sec-name { position: sticky; top: -14px; z-index: 2; padding: 12px 0 8px 34px; margin-top: -12px; font-size: 0.82rem; font-weight: 650; color: var(--ink-2); background: linear-gradient(rgba(249, 248, 245, 0.96) 75%, rgba(249, 248, 245, 0)); }
.chs-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.chs-fl { width: 28px; font-size: 0.75rem; color: var(--ink-3); text-align: right; }
.chs-cells { display: grid; grid-template-columns: repeat(var(--cols), 34px); gap: 4px; }
.cell { height: 30px; border: 0; border-radius: 8px; font-size: 0.78rem; font-weight: 650; color: #fff; transition: transform 0.12s var(--ease-out), opacity 0.15s, box-shadow 0.15s; }
.cell:hover, .cell:focus-visible { position: relative; z-index: 1; transform: scale(1.14); box-shadow: var(--shadow-s); }
.cell.st-available, .chs-legend .st-available { background: var(--teal-2); }
.cell.st-reserved, .chs-legend .st-reserved { background: var(--coral); }
.cell.st-sold, .chs-legend .st-sold { background: #cbc6ba; color: rgba(15, 36, 39, 0.55); }
.cell.is-off { opacity: 0.28; }
.chs-legend .is-off-key { background: var(--teal-2); opacity: 0.28; }

/* Подбор и избранное. */
.fl-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 12px; }
.fl-count { font-weight: 650; }
.fl-sort select {
  min-height: 36px;
  padding: 0 34px 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%230f2427' stroke-width='1.8'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 13px center;
  box-shadow: inset 0 0 0 1px rgba(15, 36, 39, 0.1);
  font-size: 0.9rem;
  font-weight: 550;
  appearance: none;
}
.fl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.fcard { position: relative; height: 100%; border-radius: 22px; background: rgba(255, 255, 255, 0.72); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), var(--shadow-s); transition: transform 0.18s var(--ease-out), box-shadow 0.2s; }
.fcard:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6), var(--shadow-l); }
.fcard.is-gone { opacity: 0.72; }
.fcard-main { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 3px; width: 100%; height: 100%; padding: 10px 10px 14px; border: 0; border-radius: inherit; background: none; text-align: left; }
.fcard-img { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 8px; overflow: hidden; border-radius: 16px; background: #fff; }
.fcard-img img { width: 100%; height: 100%; padding: 8px; object-fit: contain; }
.fcard-img.is-broken::after, .fcard-img:empty::after { content: "Планировка"; font-size: 0.85rem; color: var(--ink-3); }
.fcard-title, .fcard-price, .fcard-meta { padding: 0 4px; }
.fcard-title { font-weight: 650; }
.fcard-price { font-size: 1.1rem; font-weight: 680; letter-spacing: -0.01em; }
.fcard-meta { font-size: 0.8rem; color: var(--ink-3); }
.fav { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.88); box-shadow: var(--shadow-s); transition: transform 0.15s var(--ease-out); }
.fav svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.8; }
.fav[aria-pressed="true"] svg { fill: var(--coral); stroke: var(--coral); }
.fav:active { transform: scale(0.9); }
.fl-more { display: flex; justify-content: center; padding: 18px 0 6px; }

/* Во весь экран каталог встаёт поверх страницы плотным стеклом. */
.cat.is-full { position: fixed; inset: 10px; z-index: 70; overflow: auto; border-radius: 28px; background: rgba(242, 240, 234, 0.94); }
.cat.is-full .chs-scroll { max-height: calc(100svh - 220px); }
html.is-catalog-full, html.is-modal { overflow: hidden; }
/* Страница и лист — свои контексты наложения: без подъёма каталог ушёл бы под шапку. */
html.is-catalog-full .view, html.is-catalog-full .sheet { z-index: 60; }

/* Карточка квартиры: панель справа, на телефоне — лист снизу. */
.fcd { position: fixed; inset: 0; z-index: 80; }
.fcd[hidden] { display: none; }
.fcd-scrim { position: absolute; inset: 0; background: rgba(15, 36, 39, 0.12); opacity: 0; transition: opacity 0.3s var(--ease-out); }
.fcd.is-open .fcd-scrim { opacity: 1; }
.fcd-panel { position: absolute; top: 10px; right: 10px; bottom: 10px; width: min(460px, calc(100% - 20px)); border-radius: 28px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.36)); -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%); transform: translateX(calc(100% + 24px)); transition: transform 0.42s var(--ease-out); }
.fcd.is-open .fcd-panel { transform: none; }
.fcd-body { height: 100%; padding: 20px 22px 26px; overflow-y: auto; overscroll-behavior: contain; }
.fcd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fcd-head .kicker { margin-bottom: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; letter-spacing: 0.02em; text-transform: none; color: #fff; }
.badge.st-available { background: var(--teal-2); }
.badge.st-reserved { background: var(--coral); }
.badge.st-sold { background: #a9a396; }
.fcd-close { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(15, 36, 39, 0.08); font-size: 1rem; }
.fcd-close:hover { background: rgba(255, 255, 255, 0.85); }
.fcd-media { margin-bottom: 16px; }
.fcd-media:empty, .fcd-pdf:empty { display: none; }
.fcd-mtabs { display: flex; gap: 6px; margin-bottom: 8px; }
.fcd-img { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 8px 24px -14px rgba(15, 36, 39, 0.35); }
.fcd-img img { width: 100%; height: 100%; padding: 12px; object-fit: contain; }
/* 3D квартиры: сцена во весь квадрат, управление поверх снизу. */
.f3d { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 20px; background: radial-gradient(120% 90% at 50% 18%, #fcfbf8, #e9e5dc); touch-action: none; }
.f3d[hidden], .fcd-img[hidden], .f3d-state[hidden], .f3d-tools[hidden] { display: none; }
.f3d-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.f3d-state { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--ink-2); text-align: center; }
.f3d-tools { position: absolute; right: 10px; bottom: 10px; left: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none; }
.f3d-tools > * { pointer-events: auto; }
.f3d-hint { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); font-size: 0.78rem; color: var(--ink-3); }
.fcd-pricebox { margin-bottom: 16px; }
.fcd-pricebox p { margin: 0; }
.fcd-price { margin: 0 0 16px; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; }
.fcd-pricebox .fcd-price { margin: 0; }
.fcd-price s { margin-left: 8px; font-size: 1rem; font-weight: 500; color: var(--ink-3); }
.fcd-promo { margin: 10px 0 0; padding: 10px 12px; border-radius: 14px; background: rgba(200, 242, 106, 0.35); font-size: 0.88rem; list-style: none; }
.fcd-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0 0 16px; padding: 14px 0; border-block: 1px solid var(--line); }
.fcd-facts dt { font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.fcd-facts dd { margin: 0; font-weight: 600; }
.fcd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.fcd-wait { display: flex; align-items: center; }

.lead { display: grid; gap: 10px; padding: 16px; border-radius: 22px; background: rgba(255, 255, 255, 0.42); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.5); }
.lead-title { margin: 0; font-size: 1.05rem; font-weight: 680; }
.field { display: grid; gap: 4px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.field input { min-height: 46px; padding: 0 14px; border: 0; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px rgba(15, 36, 39, 0.14); font-size: 1rem; }
.field input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--teal-2); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.85rem; color: var(--ink-2); }
.check input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal-2); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lead-err { margin: 0; font-size: 0.88rem; font-weight: 550; color: #b4441c; }
.lead-err:empty { display: none; }
.lead .btn { width: 100%; }
.lead .btn:disabled { opacity: 0.6; }
.lead .muted { margin: 0; }
.lead-ok { padding: 18px; border-radius: 22px; background: rgba(200, 242, 106, 0.4); }
.lead-ok .lead-title { margin-bottom: 4px; }
.lead-ok p { margin: 0; }

@media (max-width: 820px) {
  .cat { padding: 6px; border-radius: 26px; }
  .cat-bar { flex-wrap: wrap; }
  .cat-tabs { width: 100%; }
  .cat-tab { flex: 1; justify-content: center; padding: 0 8px; font-size: 0.86rem; }
  .cat-tools { justify-content: space-between; width: 100%; }
  .cat-ftoggle { display: inline-flex; }
  .cat-filters { display: none; }
  .cat.is-filters .cat-filters { display: flex; }
  .cf-range { min-width: 100%; }
  .cf-count { margin-left: 0; }
  .scn-stage { min-width: 760px; }
  .fl-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fcard-main { padding: 6px 6px 10px; }
  .fcard-title { font-size: 0.92rem; }
  .fcard-price { font-size: 1rem; }
  .fav { top: 10px; right: 10px; width: 32px; height: 32px; }
  .fcd-panel { top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: 92svh; border-radius: 26px 26px 0 0; transform: translateY(100%); }
  .fcd-body { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .fcd-panel { opacity: 0; transform: none; transition: opacity 0.2s; }
  .fcd.is-open .fcd-panel { opacity: 1; }
}
