:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --border: #e3e5e8;
  --accent: #2563eb;
  --green: #16a34a; /* brighter/more vivid than the old #15803d - it was reading too close to the grays next to it (user feedback 2026-07-23) */
  --green-bg: #dcfce7;
  --orange: #b45309;
  --orange-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --gray: #4b5563;
  --gray-bg: #e5e7eb;
  --blue: #1d4ed8;
  --blue-bg: #dbeafe;
  /* Structural (headers), deliberately NOT one of the status colors above -
     --accent and --blue read as near-identical blues, which blurred the
     report editor's "one color = one meaning" system (user feedback
     2026-07-23: headers vs primary-source pills looked like the same
     color). Purple has no status meaning anywhere in the app. */
  --purple: #7c3aed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  /* 1180 -> 1440 -> 1480 (эргономика 2026-08-04): по краям оставалось по
     ~370px пустоты на широком экране, а полезная часть не влезала. Последние
     +40px (по 20 на сторону) - по просьбе пользователя: на широких ценах
     (комп за $1,070,000) таблица компсов всё равно заводила горизонтальную
     прокрутку. Поля страницы 20 -> 12px дают содержимому ещё +16px. */
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 12px 60px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.topbar-search input {
  flex: 1 1 auto;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.search-hero {
  max-width: 640px;
  margin: 10vh auto 0;
  text-align: center;
}
.search-hero h1 { font-size: 1.8rem; margin-bottom: 8px; }
.search-hero .muted { font-size: 0.9rem; line-height: 1.5; margin-bottom: 24px; }
.search-form {
  display: flex;
  gap: 10px;
}
.search-form input {
  flex: 1 1 auto;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
}
.search-error {
  color: var(--red);
  margin-top: 12px;
  font-size: 0.9rem;
}

/* Search loading indicator (2026-07-28): the clicked button swaps its
   label for bouncing dots while the fan-out runs; both buttons are
   inert (pointer-events off) but the address input stays live so typing
   can cancel (see search.html's script - window.stop()). */
.search-form button { position: relative; }
.btn-dots { display: none; align-items: center; gap: 3px; }
.btn-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  animation: btn-dots-bounce 1s infinite ease-in-out both;
}
.btn-dots i:nth-child(2) { animation-delay: 0.15s; }
.btn-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes btn-dots-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
/* Не привязано к .search-form (эргономика 2026-08-04): та же анимация нужна
   форме на карточке (.topbar-search) - это второй и все последующие поиски. */
.is-searching button { pointer-events: none; opacity: 0.85; }
.is-searching .btn-label { display: none; }
.is-searching .btn-dots { display: inline-flex; }
.search-demo-link { margin-top: 20px; font-size: 0.85rem; }

.unavailable-notes {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 16px;
  color: var(--muted);
}
.unavailable-notes h2 { margin: 0 0 6px; font-size: 0.85rem; color: var(--text); }
.unavailable-notes ul { margin: 0; padding-left: 20px; font-size: 0.85rem; }

.hero {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 10px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

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

.match-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--orange);
  background: var(--orange-bg);
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-block;
}
/* Informational, not a warning - loaded-from-history is expected/normal
   behavior, not a caveat like address_match_note - so it overrides the
   shared .match-note's orange with the calmer accent blue. */
.history-notice { color: var(--accent); background: var(--blue-bg); }
/* Отказ показать данные (2026-08-19). Сильнее оранжевой оговорки: там
   «нашли, но с примечанием», здесь «сознательно НЕ показываем, потому что
   не уверены, что это тот дом». Блочный, а не inline-block: в тексте
   перечислены близкие кандидаты, в строку он не помещается. */
.refusal-note {
  color: var(--red);
  background: var(--red-bg);
  display: block;
  line-height: 1.45;
}

.badge {
  background: var(--gray-bg);
  color: var(--gray);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.hero-price { text-align: right; }
.price-label { font-size: 0.78rem; color: var(--muted); }
.price-value { font-size: 1.6rem; font-weight: 700; }

.hero-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.red-flags {
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  color: var(--red);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 10px;
}
.red-flags h2 { margin: 0 0 6px; font-size: 0.95rem; }
.red-flags ul { margin: 0; padding-left: 20px; }

.arv-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

/* Компсовая полоска (_comps.html) несёт только 3 плашки (без Zestimate,
   тот - только в property_card.html) - на 4-колоночной сетке они
   растягивались во всю ширину карточки с пустым местом справа
   (пользователь 2026-08-11: "квадратики ближе друг к другу"). Фиксированная
   узкая колонка вместо 1fr держит их компактной группой слева. */
.arv-strip.arv-strip-compact {
  grid-template-columns: repeat(3, minmax(110px, 170px));
}

.arv-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  text-align: center;
}

.arv-expected { border-color: var(--accent); border-width: 2px; }
.arv-zestimate { background: #f8fafc; }

.arv-label { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.arv-value { font-size: 1.2rem; font-weight: 700; }

.grid {
  display: grid;
  /* 1.4fr -> 1fr/1fr (эргономика 2026-08-04): таблице компсов на широких
     ценах нужно ~740px, иначе появляется горизонтальная прокрутка; фактам
     ровной доли достаточно - им и так вернули втрое больше тех 399px, до
     которых их сжимало распирание колонки компсов. */
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  /* start -> stretch (2026-08-15): колонки тянутся до общей нижней линии,
     последняя карточка короткой добирает высоту (см. .col-* flex ниже) -
     «пустота внутри блока лучше пустоты вне блока». */
  align-items: stretch;
}
/* КЛЮЧЕВОЕ (эргономика 2026-08-04): у grid-элементов min-width по умолчанию
   auto, поэтому таблица компсов шире своей доли распирала колонку - факты
   сжимались до 399px (отсюда башня из флуд-зоны), а страница вылезала за
   правый край экрана. min-width:0 возвращает колонкам заданные пропорции. */
.grid > * { min-width: 0; }

@media (max-width: 880px) {
  .grid { grid-template-columns: 1fr; }
  .arv-strip { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 10px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.facts-list { display: flex; flex-direction: column; }

.fact-row {
  border-top: 1px solid var(--border);
}
.fact-row:first-child { border-top: none; }

.fact-row summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 4px;
  cursor: pointer;
  list-style: none;
}
.fact-row summary::-webkit-details-marker { display: none; }
.fact-row summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 0.75rem;
  flex: 0 0 auto;
}
.fact-row[open] summary::before { content: "▾"; }

.fact-row-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 4px 5px 20px;
}

.fact-label { color: var(--muted); width: 34%; font-size: 0.9rem; flex: 0 0 34%; }
.fact-value { font-weight: 500; font-size: 0.9rem; flex: 1 1 auto; }

.fact-sources {
  padding: 0 4px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fafbfc;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
}
a.source-row:hover { border-color: var(--accent); background: #f0f5ff; }

.src-icon { flex: 0 0 auto; font-weight: 700; }
.source-ok .src-icon { color: var(--green); }
.source-warn .src-icon { color: var(--orange); }
.manual-check-link .src-icon { color: var(--accent); }
.manual-check-link .src-value { color: var(--muted); font-weight: 400; font-style: italic; }
.src-name { color: var(--muted); flex: 0 0 42%; }
.src-value { font-weight: 500; }

/* Roadmap #12: confirm-checkbox to the right of each source row. */
.source-row-wrap { display: flex; align-items: center; gap: 8px; }
.source-row-wrap .source-row { flex: 1 1 auto; min-width: 0; }
.confirm-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
}
.confirm-btn:hover { border-color: var(--accent); color: var(--accent); }
.confirm-btn-active { background: var(--green-bg); border-color: var(--green); color: var(--green); font-weight: 700; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
/* Кружок-статус на строках фактов (2026-08-14): прежний текстовый пилл
   съедал ширину на КАЖДОЙ строке - весь текст теперь в title. Цвет несёт
   ФОН кружка (var(--green) и т.д. - не -bg-вариант: 10px пятну нужен
   насыщенный цвет, пастельный фон пилла был бы неразличим). */
.pill-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: help;
}
.pill-dot.pill-confirmed { background: var(--green); }
/* Синий у кружка СВЕТЛЕЕ общего --blue (#1d4ed8), а «серый» - почти
   чёрный, не var(--gray) #4b5563: на 10px пятне тёмно-синий и
   тёмно-серый сливались на глаз (пользователь, 2026-08-14). */
.pill-dot.pill-primary_only { background: #3b82f6; }
.pill-dot.pill-partial_match { background: var(--orange); }
.pill-dot.pill-questionable { background: var(--orange); }
/* ярко-красный ТОЛЬКО у кружка конфликта (2026-08-15: --red #b91c1c
   на 13px читался бордово-рыжим) */
.pill-dot.pill-conflict { background: #ef4444; }
.pill-dot.pill-no_data { background: #111827; }
.pill-confirmed { background: var(--green-bg); color: var(--green); }
.pill-primary_only { background: var(--blue-bg); color: var(--blue); }
.pill-partial_match { background: var(--orange-bg); color: var(--orange); }
.pill-questionable { background: var(--orange-bg); color: var(--orange); }
.pill-conflict { background: var(--red-bg); color: var(--red); }
.pill-no_data { background: var(--gray-bg); color: var(--gray); }

.notes ul { margin: 0; padding-left: 20px; font-size: 0.9rem; }

.comps-panel { max-width: 100%; overflow-x: auto; }
/* width: max-content (2026-08-06, пользователь: «сделай чтобы они не могли
   друг друга сокращать... надо чтобы всё-всё влазило»): раньше width:100%
   заставляло таблицу ВТИСКИВАТЬСЯ в контейнер, и колонки резали друг
   друга - адрес с бейджами обрубался многоточием. Теперь таблица ровно
   такой ширины, какой требует содержимое, а лишнее скроллится вбок
   (.comps-panel overflow-x). min-width:100% - чтобы узкая таблица не
   схлопывалась в левый угол. */
.comps-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.comps-table th, .comps-table td { white-space: nowrap; }
.comps-table th {
  text-align: left;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  padding: 4px 2px;
  border-bottom: 1px solid var(--border);
}
/* Строка компса - ОДНА ЛИНИЯ (эргономика 2026-08-04): плотные отступы,
   ничего не переносится, вертикальное выравнивание по центру. */
.comps-table td { padding: 5px 2px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.comps-table .comp-nowrap { white-space: nowrap; }
/* Обрезка адреса (max-width 168px + ellipsis) убрана 2026-08-06 - адрес и бейджи видны целиком, таблица скроллится. */
.comps-table .comp-addr-cell { white-space: nowrap; }
.comp-badge {
  font-size: 0.72rem; margin-left: 4px; cursor: help; text-decoration: none;
  display: inline-block; vertical-align: baseline;
}
.comp-badge-nbhd { color: var(--green); }
.comp-badge-edge { color: var(--muted); }
.comp-badge-warn { color: var(--orange); }
.comp-links-cell { white-space: nowrap; }
.comp-links-cell a {
  display: inline-block; width: 17px; height: 17px; line-height: 17px;
  margin-left: 3px; text-align: center; font-size: 0.7rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 4px; text-decoration: none;
}
.comps-table tr.excluded { opacity: 0.5; text-decoration: line-through; }
.comps-table .comp-include { width: 18px; height: 18px; cursor: pointer; }
/* address cell's second line: sold-date/notes and the reference links share
   ONE line, side by side, instead of each stacking on its own row - the
   address column was tall while the numeric columns next to it (price/
   year/sqft/...) only ever use one line, wasting all that height. */
.comp-meta-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; }
.comp-meta-row .comp-meta { flex: 1 1 220px; }
.comp-meta-row .comps-links { flex: 0 0 auto; display: flex; gap: 10px; }
.comps-links a { display: inline-block; }
.muted { color: var(--muted); font-size: 0.78rem; }

/* --- Comps tabs (roadmap #36): Main + one tab per comp. ------------------ */
.comps-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 6px 0 8px; }
.comps-tab {
  border: 1px solid var(--border); background: var(--card-bg);
  border-radius: 6px; padding: 3px 9px; font-size: 0.8rem; cursor: pointer;
}
.comps-tab.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.comps-tab-arrows { margin-left: auto; display: flex; gap: 2px; }
.comps-tab-prev, .comps-tab-next {
  border: 1px solid var(--border); background: var(--card-bg);
  border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 0.85rem;
}
.comp-open { text-decoration: none; color: inherit; border-bottom: 1px dashed var(--muted); }
.comp-open:hover { color: var(--accent); border-bottom-color: var(--accent); }
.comp-tab-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 4px; }
.comp-tab-links { display: flex; gap: 6px; flex-shrink: 0; }
.comp-verdict { margin: 2px 0 8px; }

/* Delta-table «наш дом vs комп» (roadmap #34/#37) */
.delta-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.delta-table th {
  text-align: left; color: var(--muted); font-size: 0.72rem;
  text-transform: uppercase; padding: 4px; border-bottom: 1px solid var(--border);
}
.delta-table td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.delta-table tfoot td { border-bottom: none; padding-top: 8px; }
.delta-dollars { width: 90px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 5px; }
.delta-unknown td { background: #fffbeb; }
.delta-note { max-width: 220px; }

/* Repairs draft (roadmap #40) */
.repairs-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.repairs-table th {
  text-align: left; color: var(--muted); font-size: 0.72rem;
  text-transform: uppercase; padding: 4px; border-bottom: 1px solid var(--border);
}
.repairs-table td { padding: 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.repairs-table tfoot td { border-bottom: none; padding-top: 8px; }
.repairs-category td {
  font-weight: 600; font-size: 0.78rem; text-transform: uppercase;
  color: var(--muted); background: #f8fafc; padding: 5px 4px;
}
.repair-line.repair-off td { opacity: 0.55; }
.repair-check { width: 16px; height: 16px; cursor: pointer; }
.repair-cost { width: 84px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 5px; }
.repair-count { width: 48px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 5px; }
.repair-count-fixed { color: var(--muted); padding-left: 4px; }
.repair-badge {
  font-size: 0.65rem; border-radius: 4px; padding: 1px 5px; vertical-align: middle;
}
.repair-badge-auto { background: var(--green-bg); color: var(--green); }
.repair-badge-likely { background: var(--orange-bg); color: var(--orange); }

/* Offer ladder (roadmap #39) */
.offer-ladder label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.offer-ladder select { padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; }
.offer-checks { display: flex; flex-direction: column; gap: 6px; align-self: start; }
#offer-quick { display: contents; }
.offer-grid label.offer-check { flex-direction: row; align-items: center; justify-content: flex-start; }
.offer-check { flex-direction: row; }
.offer-check input { width: 15px; height: 15px; flex-shrink: 0; }
.offer-lines { margin: 6px 0; }
.offer-results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

.offer-calc { margin-top: 16px; }
.offer-calc h3 { margin: 0 0 6px; font-size: 0.9rem; }
.offer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 10px 0;
}
.offer-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}
.offer-grid input {
  font-size: 0.9rem;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--card-bg);
}
.offer-result { max-width: 220px; }

.report-editor-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-editor-header h2 { margin: 0; font-size: 1rem; }
.report-editor-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* On-screen syntax coloring: report-highlight (a <pre>, colored) sits
   directly under report-textarea (transparent text, real cursor) - both
   share the exact same box model so every character lines up. Copying
   the textarea's own text is always plain - only the pixels are colored.
   resize is disabled: a resized textarea would drift out of sync with the
   <pre>'s own height (no live resize-observer wiring for this). */
.report-editor-wrap { position: relative; margin-top: 10px; }
.report-textarea, .report-highlight {
  width: 100%;
  height: 320px;
  padding: 12px;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.report-highlight {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--text);
  background: var(--card-bg);
  overflow: auto;
  pointer-events: none;
}
.report-textarea {
  position: relative;
  resize: none;
  color: transparent;
  background: transparent;
  caret-color: var(--text);
}
.rt-header { color: var(--purple); font-weight: 700; }
.rt-good { color: var(--green); }
.rt-info { color: var(--blue); }
.rt-warn { color: var(--orange); }
.rt-bad { color: var(--red); font-weight: 600; }
/* [no data] gets its OWN (gray, not bold) - distinct from rt-bad's red so
   "nothing here" never reads as urgently as a real [conflict] does (same
   red for both made every empty field look like a problem at a glance -
   user feedback 2026-07-23). Matches .pill-no_data's own gray. */
.rt-nodata { color: var(--gray); }
.rt-muted { color: var(--muted); }
.rt-accent { color: var(--accent); font-weight: 700; }

.conclusion p { font-size: 0.9rem; line-height: 1.5; }
.analyst-notes { background: #f8fafc; border-radius: 8px; padding: 10px 12px; }

/* План Б: панель всех сайтов по адресу (app/address_links.py) */
.link-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.link-panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link-panel-header h2 { margin: 0; font-size: 1rem; }
.link-panel-hint { color: var(--muted); font-size: 0.8rem; margin: 6px 0 12px; }
/* Свёрнутый план Б (находка #1 аудита эргономики): в закрытом виде вся панель
   это ОДНА строка, по клику выезжает вниз. */
.link-panel-summary {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; list-style: none; font-size: 1rem; font-weight: 600;
}
.link-panel-summary::-webkit-details-marker { display: none; }  /* свой маркер ниже */
.link-panel-summary::before {
  content: "\25B8"; color: var(--muted); font-weight: 400;
  transition: transform 0.15s ease; display: inline-block;
}
.link-panel-fold[open] > .link-panel-summary::before { transform: rotate(90deg); }
.link-panel-fold[open] > .link-panel-summary { margin-bottom: 12px; }
.link-panel-title { flex: 1; min-width: 0; }
.link-panel-count { color: var(--muted); font-size: 0.8rem; font-weight: 400; white-space: nowrap; }
/* Фокус с клавиатуры должен быть виден - блок открывается Enter/Space. */
.link-panel-summary:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; border-radius: 6px; }
.link-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.link-group h3 { margin: 0 0 8px; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
/* ссылко-кнопки в столбик - требование фичи */
.link-row { display: flex; flex-direction: column; margin-bottom: 8px; }
.link-btn { display: block; text-align: left; width: 100%; box-sizing: border-box; }
.link-note { color: var(--muted); font-size: 0.72rem; margin: 2px 0 0 2px; }
.copy-address-btn { white-space: nowrap; flex-shrink: 0; }

/* Фото-анализ (roadmap #44): поле Drive-ссылки + блок результата */
.photos-bar { display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; }
.photos-url-input { flex: 1; min-width: 260px; padding: 8px 10px; border: 1px solid #d4dbe4; border-radius: 8px; font-size: 13px; }
.photos-status { font-size: 12.5px; color: #64748b; }

/* Шестерёнка настроек ИИ на странице поиска (2026-08-05): ключ Claude API +
   методика фото-промпта прямо там, где вставляют ссылку на папку с фото. */
.photos-row { display: flex; gap: 8px; align-items: center; }
.ai-gear-btn { flex: 0 0 auto; padding: 8px 12px; font-size: 15px; line-height: 1; }
.ai-settings {
  margin-top: 10px; padding: 14px 16px; text-align: left;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
}
.ai-settings h3 { margin: 0 0 10px; font-size: 0.95rem; }
.ai-field { display: block; margin-bottom: 10px; }
.ai-field > span { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 3px; }
.ai-field .ai-hint { font-weight: 400; font-size: 0.78rem; line-height: 1.45; margin-bottom: 5px; }
.ai-field input, .ai-field textarea {
  width: 100%; padding: 8px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px;
}
.ai-field textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; line-height: 1.5; resize: vertical; }
/* Тумблер провайдера фото-анализа (2026-08-07). Радио не должны
   наследовать width:100% от .ai-field input - иначе кружок уезжает на
   отдельную строку от своей подписи. */
.ai-provider-toggle { font-weight: 400; }
.ai-provider-toggle label {
  display: flex; align-items: center; gap: 7px;
  font-size: 0.88rem; font-weight: 400; cursor: pointer; margin: 3px 0;
}
.ai-provider-toggle input[type="radio"] { width: auto; margin: 0; }
.ai-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.ai-status { font-size: 12.5px; }

/* Панель актуальности данных (2026-08-10): красный = возраст нашей
   копии превысил потолок источника, жёлтый = последняя четверть срока. */
.fresh-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.fresh-table th, .fresh-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.fresh-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: #666; }
.fresh-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.fresh-dot-ok { background: #1a7f37; }
.fresh-dot-warn { background: #d4a017; }
.fresh-dot-late { background: #c62828; }
.fresh-dot-missing { background: #9e9e9e; }
.fresh-late td { background: #fff5f5; }
.fresh-warn td { background: #fffbe8; }
.fresh-action { max-width: 320px; }
/* Глубокие блоки Data-страницы свёрнуты под таблицу актуальности
   (2026-08-10): заголовок остаётся заголовком, но кликается. */
.deep-block summary { cursor: pointer; list-style: revert; }
.deep-block summary h2 { display: inline; }
.fresh-steps { margin-top: 4px; }
.fresh-steps summary { cursor: pointer; color: #1a56db; font-size: 0.82rem; }
.fresh-steps ol { margin: 6px 0 4px; padding-left: 18px; font-size: 0.82rem; line-height: 1.5; }
.fresh-steps li { margin-bottom: 3px; overflow-wrap: anywhere; }

/* Возраст ремонта / участок / плюсы - блоки фото-анализа (2026-08-05). */
.photo-reno h3, .photo-lot h3 { margin: 12px 0 4px; font-size: 0.9rem; }
.photo-lot ul { margin: 0; padding-left: 20px; font-size: 0.88rem; line-height: 1.6; }
.photo-pluses { background: var(--green-bg); color: #166534; border-radius: 8px; padding: 7px 12px; font-size: 0.88rem; }
.photo-sev { font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.photo-sev-severe { background: var(--red-bg); color: var(--red); }
.photo-sev-moderate { background: var(--orange-bg); color: var(--orange); }
.photo-sev-cosmetic { background: var(--gray-bg); color: var(--gray); }

/* Кадры «не про этот дом» (2026-08-05) - тот же красный вес, что у red flags:
   на этих фото иначе построились бы грейд и смета. */
.photo-foreign {
  background: var(--red-bg); border: 1px solid #fca5a5; color: var(--red);
  border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; line-height: 1.5;
}
.photo-grade { display: inline-block; margin-left: 8px; padding: 1px 10px; border-radius: 10px; font-size: 15px; background: #eef2f7; }
.photo-grade-a { background: #dcfce7; color: #166534; }
.photo-grade-b { background: #ecfccb; color: #3f6212; }
.photo-grade-c { background: #fef9c3; color: #854d0e; }
.photo-grade-d { background: #fee2e2; color: #991b1b; }
.photo-neighborhood { background: #f8fafc; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.photo-neighborhood h3 { margin: 0 0 4px; font-size: 14px; }
.photo-findings-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.photo-findings-table th, .photo-findings-table td { border-bottom: 1px solid #eef2f7; padding: 5px 8px; text-align: left; vertical-align: top; }
.photo-verdict-include td:nth-child(2) { color: #b91c1c; font-weight: 600; }
.photo-verdict-ok td:nth-child(2) { color: #15803d; }
.photo-verdict-conditional td:nth-child(2) { color: #a16207; }
.photo-verdict-not_visible td:nth-child(2) { color: #94a3b8; }
.photo-permits { margin: 4px 0 8px; padding-left: 18px; font-size: 13.5px; }
/* Режим детальной сметы: ремонтные галочки лестницы выключены (двойной счёт) */
.offer-check-disabled { opacity: 0.4; }

/* --- Постепенная догрузка компсов (2026-08-06) ---------------------------
   Ролл FDOR не содержит спален/ванных/типа дома (0 полей из 165), их даёт
   только сайт округа - ~12 секунд на комп. Таблица рисуется сразу из ролла,
   а эти ячейки ждут свой ответ с точечной анимацией вместо общего ожидания
   всей карточки (было 142 секунды, из них 120 - именно оно). */
.comp-pending {
  display: inline-block;
  letter-spacing: 2px;
  opacity: 0.35;
  animation: comp-pending-pulse 1.1s ease-in-out infinite;
}
@keyframes comp-pending-pulse {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 0.75; }
}
/* Уважаем системную настройку «меньше движения»: пульсация - украшение,
   а не носитель смысла (смысл несёт сам факт многоточия вместо значения). */
@media (prefers-reduced-motion: reduce) {
  .comp-pending { animation: none; opacity: 0.45; }
}

/* Комп не того типа жилья: ЗАЧЁРКНУТ, а не удалён (решение пользователя
   2026-08-06). Раньше гейт выбрасывал такие строки молча - при постепенной
   загрузке строка сначала появлялась бы, а потом пропадала. Зачёркнутая
   честно показывает: комп нашёлся, но округ считает его другим типом. */
tr.comp-wrong-type td {
  text-decoration: line-through;
  opacity: 0.5;
}
tr.comp-wrong-type td:first-child,
tr.comp-wrong-type .comp-links-cell {
  text-decoration: none;   /* галочку и ссылки перечёркивать незачем */
}

/* Сортируемые заголовки таблицы компсов (запрос пользователя 2026-08-06). */
.comps-sortable th[data-sort] { cursor: pointer; user-select: none; }
.comps-sortable th[data-sort]:hover { text-decoration: underline; }

/* «If cash (+$10k)» - мелкая строка внутри бокса Max Offer (2026-08-06,
   пользователь: была третья полноразмерная плашка, «сильно много внимания
   пункту который прибавляет 10к»). */
.offer-cash-hint {
  font-size: 0.78em;
  margin-top: 4px;
  white-space: nowrap;
}

/* «Уже был в журнале» (2026-08-14): жёлтая плашка НАД red flags -
   заметная, но не тревожная (это подсказка, не проблема). */
.journal-notice {
  background: #fef9c3;
  border: 1px solid #facc15;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
}
.journal-notice a { font-weight: 600; }
/* «Похожий адрес», а не «этот дом» (2026-08-19): другой цвет, чтобы
   аналитик не прочитал его на автомате как обычную жёлтую пометку
   «уже проверяли» - смысл ровно обратный. */
.journal-notice-near { background: var(--blue-bg); border-color: var(--accent); }

/* Красная ТЕСТ-рамка под ARV (2026-08-06): контейнер экспериментальных
   тумблеров, пока аналитики их не примут или не отвергнут. */
.test-block {
  border: 2px solid #d33;
  border-radius: 6px;
  padding: 10px 12px 8px;
  margin: 10px 0;
  position: relative;
}
/* Каждый тест-тумблер на своей строке (2026-08-14: два тумблера сливались
   в одну строку - галочка второго прилипала к тексту первого). */
.test-block .offer-check { display: flex; margin: 4px 0; }
.test-block-tag {
  position: absolute;
  top: -10px;
  left: 10px;
  background: #d33;
  color: #fff;
  font-size: 0.7em;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 1px 8px;
  border-radius: 3px;
}

/* Поправка на местность (пользователь 2026-08-20). Одна мастер-галочка,
   под ней список отдельных факторов. КЛЮЧЕВОЕ требование: «выпадающий
   список, который не перекрывает ничего» - поэтому это НЕ absolute/
   popover, а обычный блок в потоке: раскрываясь, он раздвигает страницу
   вниз. Никакого position/z-index здесь быть не должно. */
.adverse-block {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.adverse-list {
  margin: 6px 0 2px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
}
.adverse-note { margin: 0 0 8px; line-height: 1.45; }
/* Каждый фактор - своя строка: галочка, название, сумма, метка «авто».
   Название тянется, сумма прижата вправо - так колонка цифр читается
   сверху вниз одним взглядом. */
.test-block .adverse-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
}
.adverse-item > input.adverse-dollars {
  width: 72px;
  margin-left: auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--card-bg);
  color: var(--text);
}
/* Метка автоматической находки: галочку поставило правило по нашим слоям,
   а не оператор. Тултип метки несёт сам флаг («Railroad ~340 m away»). */
.adverse-auto {
  flex-shrink: 0;
  font-size: 0.66rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-bg);
  padding: 1px 5px;
  border-radius: 3px;
  cursor: help;
}

/* Рыночный DOM-контекст на компсе (2026-08-21): медиана days-on-market
   по ZIP компса в месяц его продажи (Realtor.com research). Нарочно
   мелкий и серый - это контекст рынка, не факт о доме. */
.comp-mkt-dom {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  cursor: help;
}

/* Колонки данных ролла в таблице компсов (аналитик 2026-08-06). Owner
   ограничен по ширине с многоточием - полное имя в тултипе; parcel id
   мелким моноширинным. Таблица шире экрана скроллится горизонтально
   (.comps-panel overflow-x уже стоит). */
/* Обрезка владельца убрана в тот же день, что вводилась (2026-08-06):
   «всё-всё влазило» - имя целиком, таблица скроллится. */
.comp-owner-cell { white-space: nowrap; }
.comp-parcel-cell {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
}

/* --- Repairs ⚙ edit mode (ветка repairs-editor, 2026-08-14) --- */
.repairs-edit-btn {
  float: right; font-size: 12px; padding: 2px 10px; border-radius: 6px;
  border: 1px solid var(--border, #d1d5db); background: transparent;
  cursor: pointer; color: var(--gray, #6b7280);
}
.repairs-edit-btn.repairs-edit-on { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.repair-cat-tag {
  font-size: 10px; color: var(--gray, #9ca3af); border: 1px solid var(--border, #e5e7eb);
  border-radius: 4px; padding: 0 4px; margin-left: 4px; vertical-align: middle;
}
.repair-drag { cursor: grab; color: var(--gray, #9ca3af); margin-right: 4px; user-select: none; }
.repair-quick-toggle {
  /* inline-flex + центрирование: дефолтный паддинг кнопки сдвигал +/-
     внутри круга (скрин пользователя 2026-08-14); размер 18 -> 21px */
  display: inline-flex; align-items: center; justify-content: center;
}
/* авторский display перебивает браузерный [hidden]{display:none} - без
   этого правила кружочки торчали и ВНЕ режима ⚙ edit (скрин 2026-08-14) */
.repair-quick-toggle[hidden] { display: none; }
.repair-quick-toggle {
  width: 21px; height: 21px; padding: 0; line-height: 1; border-radius: 50%;
  margin-right: 4px; vertical-align: middle; font-size: 14px;
  border: 1px solid #3b82f6; background: #fff; color: #3b82f6; cursor: pointer; font-weight: 700;
}
/* в быстром наборе - инверсия цветов (пользователь: «белосиний/синебелый») */
.repair-quick-toggle.in-quick { background: #3b82f6; color: #fff; }
body.repairs-edit .repair-line { cursor: move; }
body.repairs-edit .repair-cost:not([readonly]) { border-color: #3b82f6; }
.repair-cost[readonly] { background: transparent; border-color: transparent; }
body.repairs-edit .offer-quick-item { cursor: move; outline: 1px dashed #3b82f6; outline-offset: 2px; }
/* Колонки всегда дотягиваются до общей нижней линии (пользователь
   2026-08-15: «пустота внутри блока лучше пустоты вне блока») - колонка
   становится flex-стеком, и её ПОСЛЕДНЯЯ карточка растягивается до низа
   более длинной соседки; пустота оказывается внутри рамки последней
   карточки и читается как паддинг, а не как дыра между блоками. */
.col-main, .col-side { display: flex; flex-direction: column; }
.col-main > section.card:last-of-type,
.col-side > section.card:last-of-type { flex-grow: 1; }

/* fact-value pre-line (2026-08-15) */
/* переносы в display_value (Sewer/Water на карточке в две строки) */
.fact-value { white-space: pre-line; }
/* Прилипшие галочка+адрес в таблице компсов (2026-08-15: «листаем данные,
   а галочки и адрес остаются видны всегда»). Ширина первой колонки
   фиксируется, чтобы у адресной был точный left. */
.comps-table th:first-child, .comps-table td:first-child {
  position: sticky; left: 0; z-index: 2;
  background: #fff; width: 29px; min-width: 29px;
}
.comps-table th:nth-child(2), .comps-table td.comp-addr-cell {
  position: sticky; left: 29px; z-index: 2;
  background: #fff;
  /* тень-отбойник: видно, что данные уезжают ПОД адрес */
  box-shadow: 6px 0 6px -6px rgba(15, 23, 42, 0.25);
}
/* строка-исключение полупрозрачна целиком - прилипшие ячейки тоже */
.comps-table tr.excluded td:first-child,
.comps-table tr.excluded td.comp-addr-cell { background: #fff; }
.comps-table thead th:first-child, .comps-table thead th:nth-child(2) { z-index: 3; }

/* qty под текстом строки сметы + qty в быстром наборе (2026-08-17) */
.repair-qty-inline { display: block; margin-top: 2px; font-size: 11px; color: var(--gray, #6b7280); }
.repair-qty-inline .repair-count { width: 52px; }
/* qty в быстром наборе: перебиваем чекбоксовые 18x15 от .offer-check input
   (инпут рендерился пустым овальчиком - скрин пользователя 2026-08-17) */
.offer-check input.offer-quick-qty {
  width: 46px; height: auto; margin-left: 2px; padding: 1px 4px;
  font-size: 11px; border: 1px solid var(--border, #d1d5db); border-radius: 4px;
}

/* HOA fee - операторский ввод в Additional (2026-08-17) */
.hoa-fee-edit { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; }
.hoa-fee-edit input {
  width: 220px; padding: 3px 8px; border: 1px solid var(--border, #ccc);
  border-radius: 6px; font: inherit; background: var(--bg, #fff); color: inherit;
}

/* ============================================================
   МОБИЛЬНАЯ ВЁРСТКА (2026-08-20, требование пользователя:
   «чтобы на мобилках всё можно было смотреть»)

   Порог 720px, а не 880: на 880 уже стоит перевод сетки в одну
   колонку, и это правильно для планшета. Телефону нужно другое -
   там ломаются не пропорции, а РЯДЫ: строка поиска, шапка с ценой,
   сетки полей и широкие таблицы.

   Принцип: ничего не прячем. Аналитик на телефоне смотрит те же
   данные, просто в столбик, а широкие таблицы скроллятся внутри
   своей рамки, а не тянут за собой всю страницу.
   ============================================================ */
@media (max-width: 720px) {
  .page { padding: 12px 10px 40px; }

  /* Строка поиска: на телефоне поле + три кнопки в один ряд не
     влезают - поле занимает всю ширину, кнопки идут под ним. */
  .topbar-search { flex-wrap: wrap; gap: 8px; }
  .topbar-search input { flex: 1 1 100%; }
  .search-form { flex-wrap: wrap; }
  .search-form input { flex: 1 1 100%; }
  .search-form .btn, .topbar-search .btn, .topbar-search a.btn { flex: 1 1 auto; }
  .search-hero { margin-top: 4vh; }
  .search-hero h1 { font-size: 1.35rem; }

  /* Шапка: адрес и цена в столбик, цена по левому краю - «прижата
     к правому» на 375px читается как обрезанная. */
  .hero-top { flex-direction: column; gap: 8px; }
  .hero-price { text-align: left; }
  .hero h1 { font-size: 1.15rem; line-height: 1.3; word-break: break-word; }

  /* ARV-плашки: две на строку на телефоне сжимают сумму до
     нечитаемого; по одной - зато цифру видно. */
  .arv-strip, .arv-strip.arv-strip-compact { grid-template-columns: 1fr; }
  .offer-results, .offer-grid { grid-template-columns: 1fr; }
  .offer-result { max-width: none; }

  /* План Б: одна колонка ссылок вместо auto-fit от 260px. */
  .link-groups { grid-template-columns: 1fr; gap: 10px; }
  /* Заголовок «All sites for this address» рядом с кнопкой «Copy address»
     ломался на три строки в узкую щель (видно на скриншоте 375px).
     Кладём кнопку и счётчик под заголовок, а не сбоку. */
  .link-panel-summary { flex-wrap: wrap; row-gap: 6px; font-size: 0.92rem; }
  /* НЕ 100%: тогда стрелка-маркер (::before) остаётся одна на первой
     строке и съедает целый ряд - проверено скриншотом. Вычитаем её
     ширину вместе с gap, чтобы маркер и заголовок стояли рядом, а
     счётчик с кнопкой уходили на следующую строку. */
  .link-panel-title { flex: 1 1 calc(100% - 40px); order: 1; }
  .link-panel-count { order: 2; }
  .copy-address-btn { order: 3; margin-left: auto; }

  /* ШИРОКИЕ ТАБЛИЦЫ скроллятся ВНУТРИ своей рамки. Без этого они
     растягивают body, и по горизонтали ездит вся страница вместе с
     шапкой - самый частый способ сделать сайт непригодным на
     телефоне. У .comps-panel такая рамка уже была, остальным
     таблицам её здесь и добавляем. */
  .fresh-table, .delta-table, .repairs-table, .photo-findings-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .fresh-table { font-size: 0.8rem; }

  /* Пальцем нужно попадать: 36px - ниже этого промахи начинаются у
     всех, а у карточки кнопок много и они стоят плотно. */
  .btn { min-height: 36px; padding: 8px 12px; }
  .fact-row summary { padding: 8px 4px; }
  .repair-check, .comps-table .comp-include { width: 20px; height: 20px; }

  /* Поля ввода: 16px - порог, ниже которого iOS Safari ЗУМИТ страницу
     при фокусе и оставляет её зазумленной.
     `:not()` здесь не про фильтрацию, а про СПЕЦИФИЧНОСТЬ: голый `input`
     проигрывает любому правилу с классом (.photos-url-input задаёт 13px),
     и первая версия этого блока молча не применилась - проверено в
     браузере на 375px. Заодно чекбоксы исключены честно: им размер шрифта
     не нужен, у них своя ширина ниже. */
  input:not([type="checkbox"]):not([type="radio"]),
  .page select, .page textarea, .page input:not([type="checkbox"]) { font-size: 16px; }

  /* Ряды «поле + статус» переносятся, а не выдавливают страницу. */
  .photos-bar, .photos-row, .source-row-wrap { flex-wrap: wrap; }
  .photos-url-input { min-width: 0; flex: 1 1 100%; }
}

/* Совсем узкие экраны (iPhone SE и подобные) - только то, что
   на 375px всё ещё не помещается. */
@media (max-width: 400px) {
  .badges { gap: 5px; }
  .badge { font-size: 0.72rem; padding: 3px 7px; }
  .arv-value { font-size: 1.05rem; }
}

/* Последний рубеж: НИЧТО не должно уметь растянуть страницу по
   горизонтали. Если что-то новое окажется шире экрана, оно
   обрежется/перенесётся, но шапка и поиск останутся на месте. */
html, body { max-width: 100%; overflow-x: hidden; }

/* ============================================================
   КОМПСЫ НА ТЕЛЕФОНЕ: блок вместо строки (2026-08-20)

   Проблема, с которой пришёл пользователь: «как мы можем обыграть
   ширину компсов, очень узко мало места». Таблица несёт 17 колонок
   и на 375px это 997px содержимого в окошке 322px - чтобы
   прочитать одну строку, надо трижды проехать пальцем вбок.

   Выбранная им форма (вариант 1 из трёх): один комп = блок из трёх
   строк, список идёт вниз. Горизонтального скролла нет вовсе.

   ГЛАВНОЕ, что здесь сохранено: цифры стоят на ОДНИХ И ТЕХ ЖЕ
   местах у каждого компа. Это единственное свойство таблицы,
   которое действительно нужно аналитику - глаз сравнивает по
   столбику. Потеряй его, и «список компсов» превращается в
   двадцать несравнимых абзацев.

   Сделано ТОЛЬКО на CSS, разметка таблицы не тронута (кроме одной
   строчки-предупреждения о скрытых колонках). Поэтому и откат -
   удаление этого блока, без риска для большого экрана. Ячейки
   адресуются по позиции: порядок колонок задан в _comps.html и
   меняется вместе с ним - если колонку вставят в середину, здесь
   надо поправить номера.
   ============================================================ */
.comps-mobile-note { display: none; }
.comps-sort-bar { display: none; }   /* только мобильная раскладка */

@media (max-width: 720px) {
  .comps-mobile-note {
    display: block;
    font-size: 0.75rem;
    margin: 0 0 6px;
  }

  /* Полоса сортировки: на телефоне это ЕДИНСТВЕННЫЙ способ упорядочить
     список - шапка таблицы скрыта вместе с сортировкой по клику. */
  .comps-sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px;
  }
  .comps-sort-label { font-size: 0.75rem; color: var(--muted); }
  .comps-sort-btn {
    padding: 5px 10px;
    font-size: 0.78rem;
    min-height: 32px;
    line-height: 1.1;
  }
  /* Активная кнопка залита - иначе по одной стрелке непонятно, по чему
     список отсортирован ПРЯМО СЕЙЧАС. */
  .comps-sort-btn.comps-sort-active {
    background: var(--accent);
    color: #fff;
  }

  /* Панель больше не скроллер - скроллить нечего. */
  .comps-panel { overflow-x: visible; }
  .comps-table { width: 100%; min-width: 0; display: block; }
  .comps-table thead { display: none; }          /* заголовки уехали в подписи ниже */
  .comps-table tbody { display: block; }

  /* FLEX, а не grid. Первая попытка была на grid: шесть ячеек третьей
     строки получали одну и ту же клетку (grid-row 3 / grid-column 2) и
     НАЛОЖИЛИСЬ друг на друга - видно на скриншоте. У grid-элемента
     `display:inline` не заставляет соседей течь в строку: каждый
     остаётся отдельным элементом сетки.
     Во flex-раскладке строки получаются переносом, а порядок задаётся
     через `order`. Переносы в нужных местах ставят два генерируемых
     блока нулевой высоты с flex-basis:100% - они тоже участвуют в
     раскладке и слушаются `order`. */
  .comps-table .comp-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 6px;
    padding: 8px 2px;
    border-top: 1px solid var(--border);
  }
  .comps-table .comp-row > td { display: block; border: none; padding: 0; white-space: normal; }
  .comps-table .comp-row::before,
  .comps-table .comp-row::after { content: ""; flex: 0 0 100%; height: 0; }

  /* строка 1: галочка, адрес, ссылки */
  .comps-table .comp-row > td:nth-child(1)  { order: 1; flex: 0 0 auto; }
  .comps-table .comp-row > td:nth-child(2)  { order: 2; flex: 1 1 auto; font-weight: 600; }
  .comps-table .comp-row > td:nth-child(17) { order: 3; flex: 0 0 auto; }
  .comps-table .comp-row::before             { order: 4; }

  /* строка 2: цена, скорректированная цена, дата продажи */
  .comps-table .comp-row > td:nth-child(4)  { order: 5; flex: 0 0 auto; font-size: 1.05rem; font-weight: 700; }
  .comps-table .comp-row > td:nth-child(5)  { order: 6; flex: 1 1 auto; white-space: nowrap; }
  .comps-table .comp-row > td:nth-child(3)  { order: 7; flex: 0 0 auto; color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
  .comps-table .comp-row::after              { order: 8; }

  /* строка 3: площадь, спальни/санузлы, год, расстояние, бассейн, score */
  .comps-table .comp-row > td:nth-child(8)  { order: 9; }
  .comps-table .comp-row > td:nth-child(7)  { order: 10; }
  .comps-table .comp-row > td:nth-child(6)  { order: 11; }
  .comps-table .comp-row > td:nth-child(9)  { order: 12; }
  .comps-table .comp-row > td:nth-child(10) { order: 13; }
  .comps-table .comp-row > td:nth-child(11) { order: 14; }
  .comps-table .comp-row > td:nth-child(6),
  .comps-table .comp-row > td:nth-child(7),
  .comps-table .comp-row > td:nth-child(8),
  .comps-table .comp-row > td:nth-child(9),
  .comps-table .comp-row > td:nth-child(10),
  .comps-table .comp-row > td:nth-child(11) {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: var(--gray);
    white-space: nowrap;
  }

  /* Подписи к цифрам. Без шапки таблицы «1877» и «63» сами по себе
     ничего не значат - единица обязана стоять рядом с числом, иначе
     блок читается как набор случайных цифр. */
  .comps-table .comp-row > td:nth-child(8)::after   { content: " sqft ·"; }
  .comps-table .comp-row > td:nth-child(7)::after   { content: " ·"; }
  .comps-table .comp-row > td:nth-child(6)::after   { content: " ·"; }
  .comps-table .comp-row > td:nth-child(9)::after   { content: " mi ·"; }
  .comps-table .comp-row > td:nth-child(10)::before { content: "pool "; }
  .comps-table .comp-row > td:nth-child(10)::after  { content: " ·"; }
  .comps-table .comp-row > td:nth-child(11)::before { content: "score "; }
  .comps-table .comp-adjusted-cell::before { content: "→ "; color: var(--muted); }
  .comps-table .comp-adjusted-cell::after  { content: " adj"; color: var(--muted); font-size: 0.75rem; }

  /* Пять справочных колонок скрыты - о них честно сказано строкой
     выше (.comps-mobile-note), а не молча выброшены. */
  .comps-table .comp-row > td:nth-child(12),
  .comps-table .comp-row > td:nth-child(13),
  .comps-table .comp-row > td:nth-child(14),
  .comps-table .comp-row > td:nth-child(15),
  .comps-table .comp-row > td:nth-child(16) { display: none; }

  /* Исключённый комп заметен и в списке, не только в таблице. */
  .comps-table .comp-row.excluded { opacity: 0.55; }
  .comps-table .comp-row.excluded td:nth-child(2) { text-decoration: line-through; }
}

/* ============================================================
   ШАПКА СЕССИИ (2026-08-20). Показывается только при включённой
   авторизации - см. base.html.

   Не украшение: без неё вошедший не видит, КЕМ он вошёл, и выйти
   может только вручную набрав /logout. На хостинге, где у аккаунта
   ровно одна живая сессия и вход с другого устройства гасит эту,
   вопрос «кем я вошёл» перестаёт быть праздным.
   ============================================================ */
.session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 0.8rem;
}
.session-bar a { color: #93c5fd; text-decoration: none; }
.session-bar a:hover { text-decoration: underline; }
.session-who { font-weight: 600; margin-right: auto; }
.session-role {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}
.session-logout { font-weight: 600; }

@media (max-width: 720px) {
  /* На телефоне ссылки шапки - тоже цель для пальца. */
  .session-bar { gap: 10px; padding: 8px 10px; }
  .session-bar a { padding: 4px 2px; }
}

/* ============================================================
   СТРАНИЦА ЛОГИНА и смены пароля (2026-08-20)

   До этого дня классы `.login-*` использовались в шаблонах, а стилей
   для них не существовало ВООБЩЕ - страница входа рисовалась голым
   HTML. Плюс `/static/css/style.css` лежал за авторизацией, то есть
   даже общие стили до входа не доезжали. Оба конца поймал
   пользователь по скриншоту.

   Стили общие с сайтом (те же переменные, .card, .btn), а не своя
   мини-таблица: копия для одной страницы неизбежно разошлась бы с
   остальными.
   ============================================================ */
.login-page {
  max-width: 420px;
  margin: 0 auto;
  padding: 8vh 16px 40px;
}
.login-card { padding: 22px 24px; }
.login-card h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}
.login-card h2 {
  /* .card h2 в проекте - серый капс-подзаголовок; на этой странице это
     полноценный заголовок второй карточки, поэтому регистр обычный. */
  margin: 0 0 6px;
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.login-card > .muted { font-size: 0.87rem; line-height: 1.45; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 16px 0 4px;
}
.login-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 8px;
}
.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--blue-bg);
}
.login-form button {
  margin-top: 16px;
  padding: 11px 16px;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  width: 100%;
}

/* Ошибка входа - тем же красным, что и остальные отказы в проекте. */
.login-error {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 0.87rem;
  line-height: 1.4;
}
.login-note {
  margin: 14px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

/* Вторая карточка (смена логина) - отступ от первой. */
.login-page .login-card + .login-card { margin-top: 12px; }

@media (max-width: 720px) {
  .login-page { padding: 5vh 12px 32px; }
  .login-card { padding: 18px 16px; }
}

/* «Глазик» у полей пароля в админке (2026-08-20). Про НАБОР, а не про
   хранение: существующий пароль не покажет ни одна панель - в базе
   односторонний хэш. Здесь снимаются звёздочки с того, что печатают
   сейчас, чтобы не выдать аналитику пароль с опечаткой. */
.peek-wrap {
  display: inline-flex;
  align-items: stretch;
  position: relative;
}
.peek-wrap input { padding-right: 34px; }
.peek-btn {
  position: absolute;
  right: 2px;
  top: 2px;
  bottom: 2px;
  width: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  color: var(--muted);
}
.peek-btn:hover { color: var(--text); }
/* Когда пароль ОТКРЫТ - это видно по кнопке, а не только по полю: иначе
   легко уйти со страницы, оставив пароль на экране. */
.peek-btn.peek-on { color: var(--accent); }

/* Живая очередь исходящих запросов на /data (2026-08-23). */
.egress-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 8px; }
.egress-table th, .egress-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.egress-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: #666; }
.egress-hot td { background: #fff7e6; }         /* у хоста живая очередь - тёплая подсветка */
.egress-busy { color: #2e7d32; font-size: 0.7rem; }  /* ● запрос в полёте прямо сейчас */
#egress-panel summary { cursor: pointer; }
#egress-panel #egress-summary { margin-left: 10px; }

/* Кружки очереди (2026-08-24): состояние читается цветом и одной цифрой. */
.egress-dots { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0 14px; }
.egress-dot { width: 104px; height: 104px; border-radius: 50%; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  border: 3px solid var(--border); cursor: help; text-align: center;
  padding: 0 10px; box-sizing: border-box; }
.egress-dot-value { font-size: 1.3rem; font-weight: 700; line-height: 1.15; }
.egress-dot-label { font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.03em; color: #555; line-height: 1.25; margin-top: 2px;
  max-width: 100%; overflow-wrap: normal; }
.egress-idle { background: #f6f7f8; border-color: #dcdfe3; }
.egress-green { background: #e8f6ec; border-color: #34a853; }
.egress-amber { background: #fff6e0; border-color: #f2a600; }
.egress-red { background: #fdeceb; border-color: #d93025; }
.egress-blue { background: #e9f1fd; border-color: #4285f4; }

/* Именные траи (2026-08-24). */
.history-search { display: flex; gap: 8px; margin: 0 0 14px; }
.case-share-btn { font-size: 0.72rem; margin-left: 10px; vertical-align: middle; }
#case-share-status { font-size: 0.75rem; margin-left: 6px; }

/* Единый вид галочек во всех браузерах (Opera рисовала свои, 2026-08-24). */
input[type="checkbox"] { accent-color: #4285f4; }

/* Источники, не ответившие на этом прогоне (аудит 2026-08-25, 3.1).
   Намеренно НЕ красный: red flags - риск дома, а это наша неудача.
   Янтарный «внимание», но выше red flags на странице - потому что
   отсутствующий red flag может быть следствием именно этой строки. */
.source-failures {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 10px;
}
.source-failures h2 { margin: 0 0 6px; font-size: 0.95rem; }
.source-failures ul { margin: 0; padding-left: 20px; }
.source-failures .muted { margin: 6px 0 0; color: #92400e; opacity: 0.85; font-size: 0.85rem; }

/* Правки аналитика не сохраняются (аудит 2026-08-25, тир 8). Янтарный,
   как блок молчащих источников: это наша авария, а не риск объекта, но
   пропустить её нельзя - на кону час работы. */
.comps-save-problem {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
}
