/* Визуальная система DESIGN.md (Mercury, раздел «Адаптация для SERVIS») — слой поверх report.css.
   Включается классом theme-night на body: ночной мир на фото Петербурга — у всех страниц сайта,
   включая отчёт (решение 2026-10-26: «в тёмном, белый не подходит»). Страницы без класса темы
   остаются на report.css как были. Спека: docs/superpowers/specs/2026-10-25-mercury-form-report-design.md.

   Золото (#C9AC77, по образцу Christie's International Real Estate) — только тонкие контуры,
   никогда кнопки и заливки. Один насыщенный цвет действия — primary, только главная кнопка. */

.theme-night {
  --m-primary: #5266eb;
  --m-primary-hover: #4356d6;
  --m-night: #171721;
  --m-night-raised: #1e1e2a;
  --m-on-dark: #ededf3;
  --m-fog: #c3c3cc;
  --m-canvas: #fbfcfd;
  --m-surface: #ffffff;
  --m-lavender: #edecfb;
  --m-ink: #28253b;
  --m-ink-secondary: #554e7b;
  --m-slate: #6b6b78;
  --m-gold-line: rgba(201, 172, 119, 0.75);
  --m-gold-line-light: rgba(201, 172, 119, 0.55);
  --m-pill: 40px;
  --m-shadow-night: 0 30px 60px -10px rgba(0, 0, 0, 0.65), 0 18px 36px -18px rgba(0, 0, 0, 0.55);
  --m-shadow-day: 0 30px 60px -12px rgba(40, 37, 59, 0.18), 0 18px 36px -18px rgba(40, 37, 59, 0.22);
  font-family: var(--font-body);
}

/* ---------- Ночная шапка (обе темы) ---------- */

.site-band {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  min-height: 72px;
  box-sizing: border-box;
  padding: 14px 32px;
  background: var(--m-night);
  color: var(--m-on-dark);
}

.site-band__brand {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.site-band .page-actions {
  margin: 0;
  gap: var(--space-2);
}

.site-band .button--ghost {
  min-height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--m-pill);
  background: rgba(237, 236, 251, 0.12);
  color: var(--m-on-dark);
  font-size: 0.94rem;
  font-weight: 500;
}

.site-band .button--ghost:hover {
  background: rgba(237, 236, 251, 0.2);
}

.site-band .print-ios-hint {
  color: var(--m-fog);
}

@media (max-width: 600px) {
  .site-band {
    padding: 14px 16px;
  }

  .site-band .button--ghost {
    min-height: 44px;
    padding: 0 16px;
  }
}

/* ---------- Ночной мир: форма оценки ---------- */

body.theme-night {
  background: var(--m-night);
  color: var(--m-on-dark);
}

/* Фото — отдельный слой, чтобы фильтр яркости не задевал текст; затемнение 38% (было 72% у
   прежнего .page-холста) — решение по макету 2026-10-25: «фото Питера ярче и чётче». */
body.theme-night::before,
body.theme-night::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
}

body.theme-night::before {
  background: url("/static/report/bg-spb.jpg") center / cover no-repeat;
  filter: brightness(1.15) contrast(1.15) saturate(1.25);
}

body.theme-night::after {
  background: rgba(23, 23, 33, 0.38);
}

.theme-night .page {
  position: relative;
  border-radius: 32px;
  background: rgba(30, 30, 42, 0.74);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--m-gold-line);
  box-shadow: var(--m-shadow-night), inset 0 1px 0 rgba(237, 236, 251, 0.1);
}

@media (min-width: 600px) {
  .theme-night .page {
    margin-top: 56px;
    padding: 40px 40px var(--space-10);
  }
}

.theme-night .headline {
  color: var(--m-on-dark);
  font-weight: 300;
  letter-spacing: 0.01em;
}

.theme-night .subhead {
  color: var(--m-fog);
  font-weight: 400;
}

.theme-night .field__label {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--m-fog);
}

.theme-night .subject-form input:not([type="checkbox"]),
.theme-night .subject-form select {
  min-height: 48px;
  border-radius: 12px;
  background: var(--m-night);
  border: 1px solid rgba(195, 195, 204, 0.22);
  color: var(--m-on-dark);
}

.theme-night .subject-form input:not([type="checkbox"]):focus,
.theme-night .subject-form select:focus {
  border-color: var(--m-primary);
}

.theme-night .field__checkbox-label {
  color: var(--m-on-dark);
  font-size: 1rem;
}

.theme-night .field__checkbox-label--under {
  margin-top: var(--space-2);
}

.theme-night .field-row--rooms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-4);
}

.theme-night .field-row--rooms .field:first-child {
  flex: none;
}

/* Галочка вне .field--checkbox (теперь под «Комнат») — общий стиль полей ввода растягивал её
   в белый квадрат 48 px. */
.theme-night input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  border: 0;
  background: none;
  box-shadow: none;
  accent-color: var(--m-primary);
  cursor: pointer;
}

.theme-night .button--primary {
  min-height: 52px;
  padding: 0 32px;
  border: 0;
  border-radius: 32px;
  background: var(--m-primary);
  color: #ffffff;
  font-size: 1.05rem;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.55);
}

.theme-night .button--primary:hover {
  background: var(--m-primary-hover);
  box-shadow: 0 14px 28px -10px rgba(0, 0, 0, 0.65);
}

.theme-night .disclaimer {
  border-top-color: rgba(195, 195, 204, 0.16);
  font-family: var(--font-body);
}

.theme-night a {
  color: #9cb4e8;
}

.theme-night .site-band a.button--ghost {
  color: var(--m-on-dark);
}

/* Остальные ночные страницы (главная, заявки, калькулятор, политика, состояние данных) —
   тот же лист-стекло с золотым контуром, что у формы (просьба пользователя 2026-10-26: «всё в
   стиле /create/»). Вложенные карточки — темнее листа, тонкий золотой контур, без тяжёлых теней. */
.theme-night {
  --accent: #5266eb;
  --accent-soft: #9cb4e8;
}

.theme-night .page .button--ghost {
  min-height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--m-pill);
  background: rgba(237, 236, 251, 0.12);
  color: var(--m-on-dark);
  font-weight: 500;
}

.theme-night .page .button--ghost:hover {
  background: rgba(237, 236, 251, 0.2);
}

.theme-night .eyebrow {
  background: rgba(23, 23, 33, 0.45);
  border-color: var(--m-gold-line-light);
  color: var(--m-fog);
}

.theme-night .card,
.theme-night .role-card,
.theme-night .proof-strip,
.theme-night .district-picker,
.theme-night .mortgage-calc__field {
  background: rgba(23, 23, 33, 0.55);
  border: 1px solid rgba(201, 172, 119, 0.35);
  box-shadow: none;
}

.theme-night .role-card:hover {
  background: rgba(23, 23, 33, 0.7);
  border-color: var(--m-gold-line);
  box-shadow: 0 18px 36px -18px rgba(0, 0, 0, 0.6);
}

.theme-night .role-card__icon {
  background: rgba(82, 102, 235, 0.22);
  color: var(--m-on-dark);
}

.theme-night .role-card__desc,
.theme-night .market-facts,
.theme-night .comparables__hint,
.theme-night .mortgage-calc__label,
.theme-night .mortgage-calc__figure dt,
.theme-night .status-table td:first-child {
  color: var(--m-fog);
}

.theme-night .role-card__arrow {
  color: #9cb4e8;
}

/* Цена-пример на главной: золото — только контур (правило DESIGN.md п.7), без заливки и мерцания. */
.theme-night .proof-strip__price-frame {
  background: rgba(23, 23, 33, 0.6);
  border: 1px solid var(--m-gold-line);
  box-shadow: none;
  animation: none;
}

.theme-night .proof-strip__eyebrow {
  color: var(--m-fog);
}

.theme-night .preset {
  background: rgba(23, 23, 33, 0.55);
  border-color: rgba(195, 195, 204, 0.22);
}

.theme-night .preset[aria-pressed="true"] {
  background: var(--m-primary);
  border-color: var(--m-primary);
}

.theme-night .lead-form input:not([type="checkbox"]):not([type="radio"]),
.theme-night .lead-form select,
.theme-night .lead-form textarea {
  border-radius: 12px;
  background: var(--m-night);
  border: 1px solid rgba(195, 195, 204, 0.22);
  color: var(--m-on-dark);
}

.theme-night .lead-form input[type="checkbox"],
.theme-night .district-chip input {
  width: 18px;
  height: 18px;
}

.theme-night .mortgage-calc__step {
  background: var(--m-night);
  border-color: rgba(195, 195, 204, 0.22);
}

.theme-night .mortgage-calc__donut-hole {
  background: var(--m-night-raised);
}

.theme-night .status-table td,
.theme-night .price-map th,
.theme-night .price-map td {
  border-bottom-color: rgba(195, 195, 204, 0.16);
}

.theme-night .price-map__note,
.theme-night .price-map__range,
.theme-night .price-map thead th {
  color: var(--m-fog);
}

.theme-night .price-map a {
  color: var(--m-on-dark);
}

/* Пояснение под полем заявки — у .field__hint раньше не было стиля вовсе, и оно набиралось
   как основной текст (крупно, белым). */
.theme-night .field__hint {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--m-fog);
}

/* Кольцо калькулятора: кредит — индиго вместо сплошного золота (золото — только контуры,
   DESIGN.md п.7), проценты — прежний голубой --data. */
.theme-night .mortgage-calc__donut {
  background: conic-gradient(
    var(--m-primary) 0% var(--loan-share),
    var(--data) var(--loan-share) 100%
  );
  box-shadow: 0 0 0 1px var(--m-gold-line-light), 0 10px 28px rgba(0, 0, 0, 0.5);
}

.theme-night .mortgage-calc__dot--loan {
  background: var(--m-primary);
}

.theme-night .utility-link {
  border-top-color: rgba(195, 195, 204, 0.16);
  color: var(--m-fog);
}

/* ---------- Особенности квартиры и дома (форма оценки) ---------- */

/* Решение 2026-10-27: прежнее «Особенности (старый фонд)» было непонятно, что нажимать. Теперь —
   стеклянная кнопка-заголовок с золотым контуром, подсказкой и счётчиком; варианты — чипы, как
   районы в заявке покупателя. Раскрывается сам при «Тип дома: Старый фонд» (feature_picker.js). */
.theme-night .feature-picker {
  margin-bottom: var(--space-5);
  border: 1px solid var(--m-gold-line-light);
  border-radius: 16px;
  background: rgba(23, 23, 33, 0.45);
}

.theme-night .feature-picker[open] {
  border-color: var(--m-gold-line);
}

.theme-night .feature-picker__summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "title count chevron" "hint count chevron";
  align-items: center;
  column-gap: var(--space-3);
  min-height: 56px;
  padding: 12px 18px;
  list-style: none;
  cursor: pointer;
}

.theme-night .feature-picker__summary::-webkit-details-marker {
  display: none;
}

.theme-night .feature-picker__summary::after {
  content: "";
  grid-area: chevron;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--m-fog);
  border-bottom: 1.5px solid var(--m-fog);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

.theme-night .feature-picker[open] .feature-picker__summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.theme-night .feature-picker__title {
  grid-area: title;
  font-size: 1rem;
  font-weight: 500;
  color: var(--m-on-dark);
}

.theme-night .feature-picker__hint {
  grid-area: hint;
  font-size: 0.82rem;
  color: var(--m-fog);
}

.theme-night .feature-picker__count {
  grid-area: count;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--m-primary);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
}

.theme-night .feature-picker__count[hidden] {
  display: none;
}

.theme-night .feature-picker__chips {
  margin: 0;
  padding: 4px 18px 18px;
}

/* CheckboxSelectMultiple: <div id="id_features"><div><label><input> Текст</label></div>…</div> */
.theme-night .feature-picker__chips > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.theme-night .feature-picker__chips label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(195, 195, 204, 0.22);
  border-radius: var(--m-pill);
  background: rgba(23, 23, 33, 0.55);
  color: var(--m-on-dark);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.theme-night .feature-picker__chips label:hover {
  border-color: var(--m-gold-line-light);
}

.theme-night .feature-picker__chips label:has(input:checked) {
  background: rgba(82, 102, 235, 0.28);
  border-color: var(--m-gold-line);
}

.theme-night .feature-picker__chips input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* ---------- Числовые поля с кнопками «−/+» ---------- */

/* В калькуляторе и в поле «Желаемая цена» отчёта рядом уже есть «−/+» — системные стрелки
   браузера делали то же самое (замечание пользователя 2026-10-27), убираем их. */
.theme-night .mortgage-calc__value,
.theme-night .readout {
  -moz-appearance: textfield;
  appearance: textfield;
}

.theme-night .mortgage-calc__value::-webkit-inner-spin-button,
.theme-night .mortgage-calc__value::-webkit-outer-spin-button,
.theme-night .readout::-webkit-inner-spin-button,
.theme-night .readout::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Отчёт — тот же ночной мир ---------- */

/* Решение пользователя 2026-10-26: «отчёт в том же стиле, в тёмном, белый не подходит» —
   светлый лист отменён. Отчёт — theme-night: фото фоном, лист-стекло с золотым контуром,
   внутри тёмные карточки с тонким золотым контуром. Шапка — ночная полоса + адрес и дата на фото. */
.site-band--report {
  display: block;
  padding: 0;
  background: none;
}

.site-band--report .site-band__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  min-height: 72px;
  box-sizing: border-box;
  padding: 14px 32px;
  background: var(--m-night);
}

.site-band--report .masthead {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 0;
  border: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--m-fog);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

.site-band--report .masthead__address {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--m-on-dark);
}

@media (max-width: 600px) {
  .site-band--report .site-band__bar {
    padding: 14px 16px;
  }

  .site-band--report .masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: 20px 16px 0;
  }
}

.theme-night .page--report {
  max-width: 880px;
}

@media (min-width: 600px) {
  .theme-night .page--report {
    margin-top: 28px;
  }
}

/* Цена и линейка, «Изменение цены», похожие объекты — тёмные карточки внутри стекла. */
.theme-night .hero,
.theme-night .market-index,
.theme-night .comparables {
  background: rgba(23, 23, 33, 0.55);
  border: 1px solid var(--m-gold-line-light);
  border-radius: 16px;
  box-shadow: 0 18px 36px -18px rgba(0, 0, 0, 0.55);
}

.theme-night .hero {
  padding: 36px 32px;
  color: var(--m-on-dark);
}

@media (max-width: 600px) {
  .theme-night .hero {
    padding: 24px 18px;
  }
}

.theme-night .hero__caption {
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--m-fog);
}

/* Рамка цены — золото только контуром (DESIGN.md п.7): без градиентной заливки и мерцания. */
.theme-night .hero__price-frame__border {
  padding: 10px 28px;
  border: 1px solid var(--m-gold-line);
  border-radius: 16px;
  background: rgba(23, 23, 33, 0.5);
  box-shadow: none;
  animation: none;
}

/* Цифры рыночной цены — мягкое золото с медленным переливом (просьба пользователя 2026-10-26;
   единственное исключение из правила «золото только контуром», DESIGN.md п.7). Перелив — сдвиг
   градиента внутри букв, без свечения вокруг; при reduce motion — неподвижное золото. */
.theme-night .hero__price {
  font-weight: 300;
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 1.05;
  color: #e4cf9f;
  text-shadow: none;
  background: linear-gradient(110deg, #d9c08a 0%, #f4e7c5 22%, #c9ac77 45%, #f1e2bb 68%, #d9c08a 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: m-price-shimmer 7s ease-in-out infinite;
}

@keyframes m-price-shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-night .hero__price {
    animation: none;
  }
}

.theme-night .hero__price-per-sqm {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--m-fog);
}

.theme-night .term-badge {
  font-family: var(--font-body);
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
}

.theme-night .hero__fact {
  background: rgba(23, 23, 33, 0.5);
  border: 1px solid var(--m-gold-line-light);
  color: var(--m-on-dark);
  font-weight: 400;
}

.theme-night .hero .notice,
.theme-night .hero .notice--muted {
  font-family: var(--font-body);
  color: var(--m-fog);
}

.theme-night .ruler-block__label {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--m-on-dark);
}

.theme-night .ruler-hint {
  font-weight: 400;
  color: var(--m-fog);
}

.theme-night .ruler input[type="range"]::-webkit-slider-thumb {
  background-color: var(--m-primary);
  box-shadow: 0 0 0 9px rgba(237, 236, 251, 0.14), 0 3px 12px rgba(0, 0, 0, 0.4);
}

.theme-night .ruler input[type="range"]:hover::-webkit-slider-thumb,
.theme-night .ruler input[type="range"]:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 11px rgba(237, 236, 251, 0.2), 0 3px 14px rgba(0, 0, 0, 0.45);
}

.theme-night .ruler input[type="range"]::-moz-range-thumb {
  background-color: var(--m-primary);
  box-shadow: 0 0 0 9px rgba(237, 236, 251, 0.14), 0 3px 12px rgba(0, 0, 0, 0.4);
}

.theme-night .readout,
.theme-night .readout-step {
  background: var(--m-night);
  border-radius: 12px;
}

.theme-night .readout-step {
  border-radius: 9999px;
  width: 48px;
}

.theme-night .llm-note {
  color: var(--m-on-dark);
}

.theme-night .market-index {
  padding: 20px 24px;
}

.theme-night .market-index__title,
.theme-night .comparables__summary,
.theme-night .card h2,
.theme-night .card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--m-on-dark);
}

.theme-night .card {
  border-radius: 16px;
  padding: 28px 32px;
}

/* Похожие объекты. Текст аналога занимает всё место между галочкой и кнопкой и прижат влево —
   раньше space-between ставил его посередине строки, и адреса «плясали». */
.theme-night .comparables {
  padding: 24px 24px 12px;
}

@media (max-width: 600px) {
  .theme-night .comparables {
    padding: 18px 16px 8px;
  }
}

.theme-night .comparable-row {
  justify-content: flex-start;
  border-top-color: rgba(195, 195, 204, 0.16);
}

.theme-night .comparable-row > div {
  flex: 1 1 auto;
  min-width: 0;
}

.theme-night .comparable-row__meta {
  color: var(--m-fog);
}

.theme-night .comparables-more summary {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: #9cb4e8;
}

.theme-night .card--inverted {
  background: rgba(23, 23, 33, 0.55);
  color: var(--m-on-dark);
}

.theme-night .card--inverted .card__date {
  color: var(--m-fog);
}

.theme-night .card--inverted .card__link {
  color: #9cb4e8;
}

.theme-night :focus-visible {
  outline-color: var(--m-primary);
}

/* ---------- Печать ---------- */

/* Печать — по правилам report.css (плоская чёрно-белая раскладка). Здесь только снимается то,
   что добавил этот слой: фото, ночная полоса, стекло, тени, золотые контуры. */
@media print {
  /* На бумаге не нужны (решение пользователя 2026-10-26): подсказка про «Исключить» — нажать
     нечего; блок «Желаемая цена» — цена и срок выбранного ползунком варианта уже в верхнем блоке,
     поле лишь повторяло цифру без пробелов. */
  body.theme-night::before,
  body.theme-night::after,
  .site-band__bar,
  .site-band__brand,
  .theme-night .ruler-block,
  .theme-night .comparables__hint {
    display: none !important;
  }

  .site-band--report .masthead,
  .site-band--report .masthead__address {
    color: #000 !important;
    text-shadow: none !important;
  }

  /* Золотой перелив цены — только на экране; на бумаге обычные чёрные цифры. */
  .theme-night .hero__price {
    background: none !important;
    -webkit-text-fill-color: #000 !important;
    color: #000 !important;
    animation: none !important;
  }

  .theme-night .page,
  .theme-night .hero,
  .theme-night .card,
  .theme-night .market-index,
  .theme-night .comparables,
  .theme-night .hero__price-frame__border {
    border: 0 !important;
    box-shadow: none !important;
    background: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .theme-night .hero,
  .theme-night .card,
  .theme-night .market-index,
  .theme-night .comparables {
    border-top: 1px solid #000 !important;
    border-radius: 0 !important;
  }

  /* Заголовок «Похожие объекты» не остаётся один внизу страницы, строки аналога не рвутся. */
  .theme-night .comparables__summary,
  .theme-night .market-index__title {
    break-after: avoid;
  }

  .theme-night .comparable-row,
  .theme-night .market-index {
    break-inside: avoid;
  }
}
