/* investhome — компоненты портала
   Заменяет app/static/css/app.css. Требует tokens.css.
   Классы совпадают с текущей вёрсткой Jinja (topnav, brand, btn, card,
   prop-card, catalog-grid, pill, table-wrap, field, notice...) —
   шаблоны менять почти не нужно. */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- Типографика */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; color: var(--ink); letter-spacing: -0.01em; margin: 0 0 var(--space-2); }
h1 { font-size: clamp(32px, 4vw, 46px); line-height: 1.05; }
h2 { font-size: 26px; line-height: 1.1; }
h3 { font-family: var(--font-body); font-size: 15.5px; font-weight: 700; }

p { margin: 0 0 var(--space-3); }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-2); }
small, .muted { color: var(--ink-2); font-size: 13px; }
.mono, code { font-family: var(--font-mono); }
::placeholder { color: var(--ink-3); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
hr { border: none; border-top: 1px solid var(--line); margin: var(--space-4) 0; }

/* микро-метка вместо старого .eyebrow */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.num { font-family: var(--font-display); font-size: 34px; line-height: 1.1; }

/* ---------------------------------------------------------------- Каркас */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 28px; width: 100%; }
main.content { flex: 1; padding: 34px 0 72px; }

.topnav { position: sticky; top: 0; z-index: 50; background: var(--paper); border-bottom: 1px solid var(--line); }
.topnav-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 24px; min-height: 66px; padding: 10px 20px; max-width: 1240px; margin: 0 auto; }

/* логотип-картинка вместо текстового бренда */
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand img { height: 19px; width: auto; display: block; filter: var(--logo-filter); }

.nav-links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav-links a { font-size: 13.5px; font-weight: 500; color: var(--ink-2); padding: 7px 11px; border-radius: var(--radius); }
.nav-links a:hover { color: var(--ink); background: var(--surface); }
.nav-links a.active { color: var(--ink); background: var(--accent-soft); font-weight: 600; }

.nav-toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-btn {
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 38px; height: 38px; flex-shrink: 0; margin-left: auto;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer;
}
.nav-toggle-btn .bar { width: 16px; height: 1.5px; background: var(--ink); transition: transform .15s ease, opacity .15s ease; }
.nav-toggle-input:checked ~ .nav-toggle-btn .bar:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle-input:checked ~ .nav-toggle-btn .bar:nth-child(2) { opacity: 0; }
.nav-toggle-input:checked ~ .nav-toggle-btn .bar:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.nav-user { display: flex; align-items: center; gap: 9px; padding-left: 10px; border-left: 1px solid var(--line); min-width: 0; }
.nav-user .avatar { width: 30px; height: 30px; flex-shrink: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; border-radius: var(--radius); }
.nav-user .meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.nav-user .meta b { font-size: 12.5px; font-weight: 600; }
.nav-user .meta span { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.theme-toggle { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer; color: var(--ink-2); }
.theme-toggle:hover { border-color: var(--line-2); color: var(--ink); }

.lang-switch { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 3px; }
.lang-switch a { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); padding: 4px 7px; border-radius: calc(var(--radius) - 3px); }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.active { background: var(--accent); color: var(--accent-ink); }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .container { padding: 28px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }
.site-footer img { height: 15px; opacity: .65; filter: var(--logo-filter); }

/* ---------------------------------------------------------------- Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px;
  padding: 12px 20px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; line-height: 1.2; transition: opacity .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { opacity: .88; color: var(--accent-ink); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { background: var(--sunk); color: var(--ink); }
.btn-danger { border-color: var(--line-2); color: var(--bad); background: none; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-good { background: var(--good); color: #fff; }
.btn-sm { font-size: 12px; padding: 5px 11px; }
.btn-block { width: 100%; }
/* "Скачать прайс-лист" на карточке условий: крупная, во всю ширину, с иконкой */
a.btn-price {
  display: flex; width: 100%; margin-top: 16px; padding: 14px 20px;
  font-size: 15px; letter-spacing: .01em; text-decoration: none; text-align: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .18), 0 6px 16px -6px rgba(0, 0, 0, .35);
  transition: transform .12s ease, box-shadow .12s ease, opacity .15s ease;
}
a.btn-price:hover { opacity: 1; filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 3px 0 rgba(0, 0, 0, .18), 0 10px 20px -6px rgba(0, 0, 0, .4); }
a.btn-price:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
a.btn-price:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a.btn-price .btn-price-icon { font-size: 17px; line-height: 1; }
.card > a.btn-price:first-child { margin-top: 0; }
a.btn-price.btn-bundle { margin-top: 10px; box-shadow: none; }
.card > a.btn-price.btn-bundle:first-child { margin-top: 0; }
a.btn-price.btn-bundle:hover { box-shadow: none; }
.bundle-hint { display: block; margin-top: 6px; font-size: 12px; text-align: center; }

.btn-link {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  color: var(--ink-2); background: none; border: none;
  border-bottom: 1px solid var(--line-2); padding: 0 0 1px;
  cursor: pointer; line-height: 1.3;
}
.btn-link:hover { color: var(--ink); border-color: var(--ink); }

/* ---------------------------------------------------------------- Формы */
form.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.field input, .field select, .field textarea {
  font: inherit; width: 100%; padding: 12px 13px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field.has-error input, .field.has-error textarea { border-color: var(--bad); }
.field-error { font-size: 12px; color: var(--bad); }

.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); background: var(--sunk); padding: 13px 14px; }
.check-row input[type=checkbox] { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }

/* чипы выбора (фильтры, слоты показа) */
.chip { padding: 6px 10px; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius); font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------------------------------------------------------------- Карточки, плашки */
.card { background: var(--surface); border: 1px solid var(--line); padding: var(--space-4); }
.card-strong { border-color: var(--ink); }
.card-tight { padding: 16px 18px; }

/* ---------------------------------------------------------------- Модальные окна */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(23, 28, 31, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-panel {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
  max-width: 640px; width: 100%; max-height: 84vh; overflow-y: auto;
  padding: 32px 30px 30px;
}
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--radius);
  color: var(--ink-2); font-size: 18px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--ink); background: var(--sunk); }
.modal-title { margin-top: 6px; }
.modal-text { white-space: pre-wrap; font-size: 13.5px; color: var(--ink-2); }

.pill { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .05em; padding: 4px 9px; border-radius: var(--radius); display: inline-block; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); text-transform: uppercase; }
.pill.approved, .pill.signed, .pill.completed, .pill.deal { background: var(--good-bg); color: var(--good); }
.pill.pending, .pill.offered, .pill.pending_signature, .pill.requested, .pill.negotiating { background: var(--warn-bg); color: var(--warn); }
.pill.rejected, .pill.blocked, .pill.declined, .pill.revoked, .pill.cancelled, .pill.no_show { background: var(--bad-bg); color: var(--bad); }
.pill.online { background: var(--good-bg); color: var(--good); }

.notice { border: 1px solid var(--line); background: var(--surface); padding: 18px 20px; }
.notice h3 { margin-bottom: 4px; }
.notice p:last-child { margin-bottom: 0; }
.notice.good { border-left: 2px solid var(--good); }
.notice.warn { border-left: 2px solid var(--warn); }
.notice.bad  { border-left: 2px solid var(--bad); }

.empty-state { border: 1px dashed var(--line-2); background: var(--surface); padding: 64px 28px; text-align: center; }
.empty-state h3 { font-family: var(--font-display); font-weight: 400; font-size: 26px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--ink-2); max-width: 44ch; margin: 0 auto var(--space-3); }
.error-banner { border: 1px solid var(--bad); background: var(--bad-bg); color: var(--bad); padding: 10px 13px; font-size: 13px; }

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

/* ---------------------------------------------------------------- Каталог */
.catalog-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.catalog-filters { position: sticky; top: 90px; border: 1px solid var(--line); background: var(--surface); padding: 18px; flex: 1 1 236px; min-width: 0; }
.catalog-main { flex: 6 1 380px; min-width: 0; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }

.prop-card { background: var(--surface); display: flex; flex-direction: column; color: inherit; }
.prop-card:hover { background: var(--sunk); color: inherit; }
.prop-photo { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.prop-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prop-tags { position: absolute; top: 0; left: 0; display: flex; gap: 1px; }
.prop-tags span { background: var(--surface); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 5px 8px; }
.prop-tags span.open { background: var(--good-bg); color: var(--good); }
.prop-card-locked { cursor: default; }
.prop-card-locked:hover { background: var(--surface); }
.prop-card-locked .prop-photo img { filter: grayscale(.4) brightness(.9); }
.prop-lock { position: absolute; right: 0; bottom: 0; display: flex; align-items: center; gap: 5px; background: rgba(20, 18, 14, .78); color: #fff; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; }
.prop-lock svg { flex: none; }
.prop-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prop-body .id { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.prop-loc { font-size: 13px; color: var(--ink-2); }
.prop-facts { display: flex; gap: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.prop-price-wrap { margin-top: auto; padding-top: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.prop-price { font-family: var(--font-display); font-size: 23px; line-height: 1.15; }
.prop-price-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* ---------------------------------------------------------------- Карточка объекта */
.project-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.project-main { flex: 5 1 400px; min-width: 0; }
.project-aside { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 16px; flex: 1 1 300px; min-width: 0; }

.project-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.project-figures { display: flex; gap: 36px; flex-wrap: wrap; }

.gallery-main { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-counter { position: absolute; bottom: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px 11px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); }
.thumbs-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.thumb-item { aspect-ratio: 4 / 3; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; overflow: hidden; }
.thumb-item.active { border-color: var(--ink); }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ход строительства - раскрывающийся блок под рендерами */
.construction-panel { margin-top: 12px; border: 1px solid var(--line); background: var(--surface); }
.construction-panel summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.construction-panel summary::-webkit-details-marker { display: none; }
.construction-panel summary:hover { background: var(--surface-2); }
.construction-summary-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.construction-summary-text .muted { font-size: 12px; }
.construction-summary-meta { display: flex; align-items: center; gap: 10px; }
.construction-chevron { transition: transform .2s; color: var(--ink-3); }
.construction-panel[open] .construction-chevron { transform: rotate(180deg); }
.construction-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; padding: 0 16px 16px; }
.construction-item { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; display: block; }
/* дата съёмки - плашка в стиле .gallery-counter, сверху (снизу у видео контролы) */
.construction-date { position: absolute; top: 0; left: 0; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .02em; color: var(--ink-2); pointer-events: none; }
.construction-item img, .construction-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.construction-file { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; padding: 10px; text-align: center; text-decoration: none; color: var(--ink); }
.construction-file .ext { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-3); }
.construction-file .name { font-size: 13px; font-weight: 600; }

/* закрытый объект */
.gallery-locked { filter: blur(14px) saturate(.75); }
.gallery-lock-plate { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in oklch, var(--paper) 55%, transparent); }
.gallery-lock-plate > div { background: var(--surface); border: 1px solid var(--line); padding: 22px 26px; max-width: 400px; text-align: center; }

/* характеристики / файлы строками, без карточек */
.spec-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 40px; }
.spec-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec-row span:first-child { color: var(--ink-2); }
.spec-row span:last-child { font-weight: 600; font-family: var(--font-mono); font-size: 13px; }

.file-row { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.file-row .ext { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--ink-3); width: 38px; }
.file-row .name { font-size: 14px; font-weight: 600; flex: 1; }
.file-row .size { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.docs-list.is-collapsed .file-row.is-extra { display: none; }
.docs-toggle { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 0; background: none; border: 0; cursor: pointer; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2, inherit); }
.docs-toggle:hover { color: var(--ink, inherit); }
.docs-toggle-chevron { display: inline-block; font-size: 14px; line-height: 1; transform: translateY(-2px); transition: transform .2s ease; }
.docs-toggle[aria-expanded="true"] .docs-toggle-chevron { transform: translateY(2px) rotate(180deg); }

/* ---------------------------------------------------------------- Кабинет / KPI */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 32px; }
.kpi-tile { background: var(--surface); padding: 18px 20px; }
.kpi-tile .n { font-family: var(--font-display); font-size: 34px; line-height: 1.1; margin-top: 8px; }
.kpi-tile .sub { font-size: 12px; color: var(--ink-2); }

/* ---------------------------------------------------------------- Табы и таблицы */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button, .tabs a { background: none; border: none; border-bottom: 2px solid transparent; padding: 12px 16px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-3); margin-bottom: -1px; }
.tabs button.active, .tabs a.active, .tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-row input, .filter-row select { font: inherit; border: 1px solid var(--line-2); background: var(--surface); padding: 9px 12px; border-radius: var(--radius); font-size: 13.5px; }
.filter-count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-left: auto; }

.table-wrap { border: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.tabs + .table-wrap { border-top: none; }
table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 13px; }
thead th { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--sunk); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 400; white-space: nowrap; }
tbody td { padding: var(--row-pad); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--sunk); }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
td.actions > div { display: inline-flex; gap: 6px; align-items: center; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* компактный режим таблиц: <body class="dense"> */
body.dense { --row-pad: 7px 14px; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }

/* ---------------------------------------------------------------- Мобильная навигация */
@media (max-width: 860px) {
  .nav-toggle-btn { display: flex; }
  .nav-links, .nav-right {
    display: none; flex-basis: 100%; flex-direction: column; align-items: stretch;
    order: 5; gap: 2px;
  }
  .nav-toggle-input:checked ~ .nav-links,
  .nav-toggle-input:checked ~ .nav-right { display: flex; }
  .nav-links a { padding: 12px; }
  .nav-right { order: 6; padding-top: 12px; border-top: 1px solid var(--line); gap: 12px; }
  .lang-switch { align-self: flex-start; }
  .nav-user { border-left: none; padding-left: 0; }
  .nav-user .meta span { white-space: normal; }
  .logout-form .btn, .nav-right > a.btn { width: 100%; }

  /* прижатые сайдбары на десктопе мешают на мобильном - экран не резиновый,
     а список объектов/показов под ними становится не пролистать */
  .catalog-filters, .project-aside { position: static; top: auto; }
}

@media (max-width: 640px) {
  .container { padding: 0 18px; }
  h1 { font-size: 30px; }
  .project-figures { gap: 20px; }

  /* iOS Safari зумит страницу при фокусе на поле с font-size < 16px */
  input[type="text"], input[type="search"], input[type="tel"],
  input[type="email"], input[type="number"], input[type="date"],
  select, textarea,
  .filter-row input, .filter-row select { font-size: 16px; }

  .chip { padding: 9px 12px; }
  .modal-overlay { padding: 12px; }
  .modal-panel { padding: 22px 18px 18px; max-height: 90vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ================================================================
   Страничные секции (лендинг, вход, карточка объекта, админка)
   ================================================================ */

.link-underline { border-bottom: 1px solid var(--line-2); padding-bottom: 1px; font-size: 13px; font-weight: 600; }
.link-underline:hover { border-color: var(--ink); }
.footer-links { display: flex; gap: 18px; font-size: 12.5px; color: var(--ink-2); font-family: var(--font-body); }

/* ---------------------------------------------------------------- Лендинг */
.hero { display: flex; flex-wrap: wrap; gap: 56px; align-items: center; padding: 60px 0 56px; }
.hero-text { flex: 1.05 1 380px; min-width: 0; }
.hero-text h1 { font-size: clamp(40px, 5.2vw, 72px); margin: 20px 0 22px; }
.hero-text h1 em { font-style: italic; color: var(--ink-2); }
.hero .lede { font-size: 17px; line-height: 1.6; color: var(--ink-2); max-width: 46ch; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.band { border-top: 1px solid var(--line); background: var(--surface); margin: 0 -28px; padding: 56px 28px 64px; }
.section-head.tight { margin-bottom: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); align-items: baseline; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); border-top: 1px solid var(--line); }
.step { padding: 26px 26px 30px 0; border-right: 1px solid var(--line); }
.step h3 { margin: 14px 0 8px; font-size: 17px; }
.step p { font-size: 13.5px; margin: 0; }

.split { display: flex; flex-wrap: wrap; gap: 40px 56px; align-items: flex-start; border-top: 1px solid var(--line); padding: 56px 0 64px; }
.split > div:first-child { flex: 1 1 280px; min-width: 0; }
.perk-list { flex: 1.2 1 320px; min-width: 0; border-top: 1px solid var(--line); }
.perk { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--line); }
.perk b { font-size: 15px; flex: 0 1 190px; }
.perk .eyebrow { width: 22px; flex-shrink: 0; }

/* ---------------------------------------------------------------- Вход / заявка */
/* justify-content: center - login/register/staff-login all dropped their
   testimonial .auth-aside (2026-09-24), leaving .auth-form as the only
   flex child; centered rather than left-hugging the container. */
.auth-layout { display: flex; flex-wrap: wrap; justify-content: center; gap: 40px; align-items: stretch; padding: 24px 0 56px; }
.auth-form { flex: 1 1 360px; min-width: 0; max-width: 520px; }
.auth-form h1 { margin: 24px 0 10px; font-size: 38px; }
.auth-form .tabs a { text-decoration: none; }
.auth-switch { font-size: 13px; color: var(--ink-2); margin-top: 20px; }
.maintenance-card { border: 1px solid var(--line); border-top: 3px solid var(--warn); background: var(--surface); padding: 28px 26px 24px; box-shadow: var(--shadow); }
.maintenance-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: var(--warn-bg); color: var(--warn); margin-bottom: 16px; }
.maintenance-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--warn-bg); padding: 4px 10px; border-radius: 999px; }
.maintenance-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: maintenance-pulse 1.6s ease-in-out infinite; }
@keyframes maintenance-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .maintenance-dot { animation: none; } }
.maintenance-card h3 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 14px 0 10px; }
.maintenance-card p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-bottom: 10px; }
.maintenance-card p:last-child { margin-bottom: 0; }
.form-foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.consent-text { font-size: 11.5px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.field-span { grid-column: 1 / -1; }

/* Structured agreement-clause editor (admin_property_form.html/admin_categories.html) */
.clause-empty { margin: 0; font-size: 13px; }
.clause-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius); }
.clause-row-head { display: flex; align-items: center; gap: 10px; }
.clause-row-n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.clause-row-head input { flex: 1; }

/* ---------------------------------------------------------------- Фильтры каталога */
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.filter-search { width: 100%; border: 1px solid var(--line-2); background: var(--sunk); padding: 10px 11px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 18px; }
.catalog-filters .eyebrow { display: block; margin-bottom: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.seg-row { display: flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.seg { flex: 1; text-align: center; padding: 8px 0; font-size: 12.5px; cursor: pointer; color: var(--ink-2); background: var(--surface); border-right: 1px solid var(--line-2); }
.seg:last-child { border-right: none; }
.seg.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.range-row { display: flex; gap: 8px; margin-bottom: 20px; }
.range-row input { width: 100%; border: 1px solid var(--line-2); background: var(--sunk); padding: 8px 10px; border-radius: var(--radius); font-family: var(--font-mono); font-size: 13px; }
.catalog-filters .check-row { margin-bottom: 16px; }
.sort-form { display: flex; gap: 10px; align-items: center; }
.sort-form select { border: 1px solid var(--line); background: var(--surface); padding: 8px 10px; border-radius: var(--radius); font-size: 13px; }
.prop-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pager-buttons { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- Карточка объекта */
.project-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.back-link { font-size: 13px; color: var(--ink-2); }
.project-loc { font-size: 14px; color: var(--ink-2); }
.project-head h1 { margin: 10px 0 8px; }
.project-figures .num { margin-top: 2px; }
.media-section { margin-top: 40px; }

/* ------------------------------------------------------- Медиа объекта (админка) */
.media-subsection { margin-top: 28px; }
.media-subsection:first-child { margin-top: 16px; }
.media-subsection-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.media-subsection-head h3 { margin: 0; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin: 16px 0; }
.media-card { border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; }
.media-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
[data-sortable] > .media-card { cursor: grab; }
[data-sortable] > .media-card.dragging { opacity: .4; }
[data-sortable] > .media-card.drop-target { outline: 2px dashed var(--ink); outline-offset: 2px; }
.media-sort-hint { font-size: 12px; margin: 8px 0 0; }
.media-file-icon { width: 100%; height: 110px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--ink-3); background: var(--surface-2); }
.media-card-meta { display: flex; align-items: center; gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
.media-card-meta .muted { font-size: 11.5px; }
.media-card-actions { display: flex; gap: 6px; padding: 0 10px 10px; }
.media-card-actions form { flex: 1; }
.media-card-actions button { width: 100%; }
.media-card-retype { padding: 0 10px 10px; }
.media-card-retype select { width: 100%; border: 1px solid var(--line); background: var(--surface); padding: 6px 8px; border-radius: var(--radius); font-size: 12px; }
.media-card-alt { display: flex; gap: 6px; padding: 8px 10px 0; }
.media-card-alt input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); padding: 6px 8px; border-radius: var(--radius); font-size: 12px; }
.media-card-alt button { flex: 0 0 auto; padding: 6px 10px; }
.media-card-preview { display: block; cursor: zoom-in; }
.media-card-date { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; }
.media-card-date label { font-size: 12px; white-space: nowrap; }
.media-card-date input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--surface); padding: 5px 8px; border-radius: var(--radius); font-size: 12px; font-family: var(--font-mono); color: var(--ink); }
.media-upload-form { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer; }
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }
.gallery-nav:hover { border-color: var(--ink); }

/* ---------------------------------------------- Полноэкранный просмотр фото */
.construction-item[data-lightbox] { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; background: rgba(15, 18, 20, .92); padding: 56px 64px; }
.lightbox.open { display: flex; }
body.lightbox-open { overflow: hidden; }
.lightbox-stage { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox-stage img { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; display: block; background-color: var(--surface-2); background-size: 100% 100%; background-repeat: no-repeat; }
.lightbox-full { display: block; cursor: zoom-in; }
.lightbox-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lightbox-open-full { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; text-decoration: none; }
.lightbox-open-full:hover { border-color: var(--ink); }
.lightbox-stage figcaption { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); padding: 4px 10px; }
.lightbox-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer; }
.lightbox-close:hover { border-color: var(--ink); }
.lightbox .lightbox-nav.prev { left: 14px; }
.lightbox .lightbox-nav.next { right: 14px; }
.lightbox-counter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); padding: 6px 11px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-2); }
@media (max-width: 640px) {
  .lightbox { padding: 56px 8px; }
  .lightbox .lightbox-nav { top: auto; bottom: 10px; transform: none; }
  .lightbox-counter { bottom: 16px; }
}
.thumbs-strip { overflow-x: auto; }

.terms-pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--ink-2); background: var(--sunk); border: 1px solid var(--line); padding: 14px; max-height: 260px; overflow-y: auto; margin: 12px 0 16px; }
.aside-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- Чаты WhatsApp (админка) */
tr.unread { background: var(--warn-bg); }
.chat-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.chat-bubble { max-width: 60%; border: 1px solid var(--line); background: var(--surface); padding: 10px 14px; border-radius: var(--radius); }
.chat-bubble p { margin: 0 0 4px; font-size: 14px; white-space: pre-wrap; }
.chat-bubble span.mono { font-size: 10.5px; color: var(--ink-3); }
.chat-bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.chat-bubble.out span.mono { color: inherit; opacity: .7; }
.chat-bubble.out .field-error { color: var(--bad); background: var(--surface); padding: 2px 6px; display: inline-block; margin-top: 4px; }
.chat-reply-form { display: flex; gap: 10px; align-items: flex-end; max-width: 640px; }
.chat-reply-form .field { flex: 1; }
.aside-actions form { display: block; }

.booking-card .eyebrow { display: block; }
.booking-form .chip-row { margin-bottom: 0; }
.booking-form [data-booking-times] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.booking-form [data-booking-dates] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; position: relative; }
.booking-note { font-size: 11.5px; text-align: center; margin: 0; }
.booking-date-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; border: 0; opacity: 0; overflow: hidden; pointer-events: none; }

.curator { display: flex; gap: 12px; align-items: center; margin: 12px 0 14px; }
.curator .avatar { width: 38px; height: 38px; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.curator b { display: block; font-size: 14px; }
.curator span { font-size: 12px; }
.curator-contacts { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.card-sunk { background: var(--sunk); }

/* ---------------------------------------------------------------- Админка */
.seg-tabs { border-bottom: none; border: 1px solid var(--line); background: var(--surface); }
.seg-tabs a { padding: 9px 14px; font-size: 12.5px; border-bottom: none; text-decoration: none; }
.seg-tabs a.active { background: var(--accent); color: var(--accent-ink); }

.offer-panel { border: 1px solid var(--line); background: var(--surface); padding: 14px 18px; margin-bottom: 20px; }
.offer-panel summary { cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: 14px; }
.offer-panel summary .muted { font-weight: 400; font-size: 12px; }
.offer-panel form { margin-top: 16px; }
.offer-panel h3 { margin: 20px 0 4px; }
.offer-panel h3:first-of-type { margin-top: 16px; }

.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.inline-form input, .inline-form select { font: inherit; font-size: 12px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); max-width: 150px; }
.timeline-row td { padding: 0; }
.timeline { padding: 12px 14px; background: var(--sunk); }
.timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.timeline li:last-child { border-bottom: none; }
.timeline-comment { flex-basis: 100%; }

@media (max-width: 640px) {
  .band { margin: 0 -18px; padding: 40px 18px 48px; }
  .step { border-right: none; border-bottom: 1px solid var(--line); padding-right: 0; }
  .booking-form [data-booking-times] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg { padding: 10px 0; }
  .sort-form select { font-size: 16px; }
  .chat-bubble { max-width: 88%; }
  .hero-text h1 { font-size: clamp(30px, 9vw, 72px); }
}

/* ---------------------------------------------------------------- Публикация по таймеру */
[x-cloak] { display: none !important; }

/* ------------------------------------------------- Сворачиваемые разделы (админка) */
[data-collapse-ready] > [data-collapse-head] { cursor: pointer; user-select: none; }
[data-collapse-ready] > [data-collapse-head] h2,
[data-collapse-ready] > [data-collapse-head] h3 { display: inline-flex; align-items: center; gap: 10px; }
.collapse-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; flex: none;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-2);
  font: 600 16px/1 var(--font-body); cursor: pointer;
}
.collapse-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.collapse-toggle .chev { display: inline-block; transition: transform .18s ease; }
.is-collapsed > [data-collapse-head] .collapse-toggle .chev { transform: rotate(-90deg); }
.is-collapsed > :not([data-collapse-head]) { display: none !important; }
.collapse-tools { display: inline-flex; gap: 8px; }
.prop-tags span.soon { background: var(--warn-bg); color: var(--warn); }
.prop-card-upcoming .prop-photo img { filter: grayscale(.4) brightness(.9); }
.prop-lock-timer { gap: 6px; }
.countdown { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.countdown b { font-weight: 600; }
.countdown-big { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.cd-seg { min-width: 62px; border: 1px solid var(--line); background: var(--sunk); padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cd-seg b { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1; }
.cd-seg span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.upcoming-plate { max-width: 440px !important; }
.upcoming-aside { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border: 1px solid var(--line); background: var(--sunk); padding: 12px 14px; }
.upcoming-aside .countdown { font-size: 16px; }
.terms-pre-locked { filter: blur(3px); user-select: none; pointer-events: none; }
.pub-modes { display: flex; flex-direction: column; gap: 8px; }
.blur-locked { filter: blur(7px); user-select: none; pointer-events: none; }
