/* Путь Б кабинета (решение 213): запрос доступа у арендатора (макеты A4–A9) и «Арендаторы и запросы», карточка запроса у
   арендодателя (Г4, Д3, Д4). Только токены и элементы приложения: светлая и тёмная тема те же. Подключается только при
   включённом кабинете (tenancy.templatetags.cabinet, STYLE_APPS). */

/* «Моя аренда» пустая (A4): текст по центру, код — первым. */
.connect-empty { display: grid; justify-items: center; gap: 14px; text-align: center; }
.connect-empty-text { max-width: 46ch; margin: 0; color: var(--muted); line-height: 1.5; }
.connect-empty-actions { display: grid; justify-items: center; gap: 10px; }

/* Запрос по шагам (A5–A8). */
.connect-page .connect-form { margin-top: 4px; }
.connect-way-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.connect-way-grid.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Варианты «Как найти» — значками, как в макете A5: вместо кружка выбора значок, выбранный — залит. */
.connect-way { grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; align-items: center; }
.connect-way::before { display: none; }
.connect-way-icon { grid-row: 1 / span 2; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); }
.connect-way:has(input:checked) .connect-way-icon { background: var(--accent-fill); color: #fff; }
.connect-way .pf-kind-label { align-self: end; }
.connect-way .pf-kind-hint { align-self: start; }
.connect-note { margin: 14px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.connect-same { margin: 4px 0 0; background: var(--tone-info-soft); border-color: var(--tone-info-soft); color: var(--text); }
.connect-full { margin-bottom: 14px; }
.property-ui .connect-code-field .connect-code-input { height: 64px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.6rem; font-weight: 650; letter-spacing: .14em; text-align: center; text-transform: uppercase; }
.connect-attempts { color: var(--muted); }
/* Ответ на код — главное на шаге (макет A6): крупнее обычной ошибки поля. */
.property-ui .connect-code-field .error:not(:empty) { font-size: 1rem; font-weight: 650; line-height: 1.4; }
.connect-or { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; color: var(--muted); font-size: .9rem; }
.connect-or::before, .connect-or::after { content: ""; flex: 1; border-top: 1px solid var(--border-soft); }
.connect-qr { margin: 0 0 4px; }
.connect-qr > summary { display: flex; justify-content: center; width: 100%; list-style: none; cursor: pointer; }
.connect-qr > summary::-webkit-details-marker { display: none; }
.connect-qr > p { margin: 10px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.connect-counter { color: var(--muted); }

/* Выбор при первом входе (A1б): две плитки — кнопки со значком. */
.connect-choose-card h1 { margin: 0 0 8px; font-size: 1.6rem; }
.connect-choose-lede { margin: 0 0 18px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.connect-choose-lede strong { color: var(--muted); }
.connect-choices { display: grid; gap: 12px; margin: 0; }
.connect-choice { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; align-items: start; width: 100%;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; text-align: left; cursor: pointer; }
.connect-choice:hover { border-color: var(--accent); }
.connect-choice:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.connect-choice-text { display: grid; gap: 4px; }
.connect-choice-text strong { font-size: 1.15rem; line-height: 1.3; }
.connect-choice-text small { color: var(--muted); font-size: .92rem; line-height: 1.45; }
.connect-choose-links { align-items: center; }
.connect-choose-links form { margin: 0; }
.connect-home-choose { padding: 18px 20px 20px; }
.connect-home-choose h2 { margin: 0 0 12px; font-size: 1.2rem; }

/* Стык с блоком «Кабинет арендатора» S2: длинное состояние «ждёт подключения (по запросу доступа)» в узкой панели
   переносится, а не обрезается. */
.ta-name .status { max-width: 100%; white-space: normal; }

/* Свой запрос (A9). */
.connect-request { display: grid; gap: 10px; }
.connect-request-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.connect-request-head h2 { margin: 0; font-size: 1.15rem; }
.connect-request-facts, .connect-request-place, .connect-request-note { margin: 0; color: var(--muted); line-height: 1.45;
  overflow-wrap: anywhere; }
.connect-request-quote { margin: 0; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.connect-request .button { justify-self: start; }

/* «Арендаторы и запросы» (Г4). */
.connect-code-box { display: grid; gap: 6px; padding: 16px 18px; border-radius: var(--radius); background: var(--accent-soft); }
.connect-code-label, .connect-code-hint { margin: 0; color: var(--muted); font-size: .88rem; }
.connect-code { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 2.2rem; font-weight: 700;
  letter-spacing: .08em; color: var(--text); overflow-wrap: anywhere; }
.connect-code-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.connect-link-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; }
.connect-link-row .connect-link { flex: 1 1 auto; min-width: 0; max-width: 480px; }
.connect-settings .field-input, .connect-settings input[type="text"], .connect-settings input[type="tel"], .connect-settings select, .connect-settings .phone-box { max-width: 480px; }
.connect-lede { margin-bottom: 12px; max-width: 72ch; }
.connect-settings .connect-panel-body > p, .connect-settings p.muted, .connect-landlord p.panel-text, .connect-landlord p.muted, .connect-code-hint, .connect-toggle-text small { max-width: 72ch; }
.connect-panel-body { margin: 0; padding: 16px 22px 20px; }
.connect-small { margin: 0; color: var(--muted); font-size: .82rem; max-width: 72ch; }
.connect-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.connect-toggle-text { display: grid; gap: 2px; min-width: 0; }
.connect-toggle-text small { color: var(--muted); font-size: .82rem; }
.connect-toggle input[type="checkbox"] { flex: none; appearance: none; width: 40px; height: 24px; margin: 0;
  border-radius: 12px; background: var(--switch-off); position: relative; cursor: pointer; transition: background .15s; }
.connect-toggle input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s; }
.connect-toggle input[type="checkbox"]:checked { background: var(--accent-fill); }
.connect-toggle input[type="checkbox"]:checked::after { transform: translateX(16px); }
.connect-toggle input[type="checkbox"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.connect-intake .phone-box { margin-top: 14px; }
.connect-blocked { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.connect-blocked li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--border-soft); }
.connect-blocked li:first-child { border-top: 0; }
.connect-qr-window { display: grid; justify-items: center; gap: 10px; text-align: center; }
.connect-qr-image { width: 264px; max-width: 100%; height: auto; image-rendering: pixelated; background: #fff; padding: 8px;
  border-radius: 8px; }

/* Карточка запроса (Д3, Д4) и список запросов. */
.connect-head { display: grid; gap: 10px; }
.property-ui .panel.connect-head { padding: 16px 22px 18px; margin-bottom: 16px; }
.connect-head-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; overflow-wrap: anywhere; }
.connect-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 0; }
.connect-facts dt { color: var(--muted); font-size: .88rem; }
.connect-facts dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.connect-bound { margin: 0 0 12px; }
.connect-contracts { display: grid; margin: 0 0 12px; padding: 0; list-style: none; border: 1px solid var(--border);
  border-radius: var(--radius); }
.connect-contracts li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px;
  padding: 12px 14px; }
.connect-contracts li + li { border-top: 1px solid var(--border-soft); }
.connect-contract-name { min-width: 0; overflow-wrap: anywhere; }
.connect-show { display: inline-flex; align-items: center; gap: 8px; flex: none; cursor: pointer; }
.connect-show input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-fill); }
.connect-rows { display: grid; margin: 0; padding: 0; list-style: none; }
.connect-rows li { padding: 10px 0; border-top: 1px solid var(--border-soft); overflow-wrap: anywhere; }
.connect-rows li:first-child { border-top: 0; }
.connect-row-place { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

@media (max-width: 640px) {
  .connect-way-grid, .connect-way-grid.is-two { grid-template-columns: 1fr; }
  .connect-code { font-size: 1.8rem; }
  .connect-link-row { flex-direction: column; align-items: stretch; }
  .connect-link-row .connect-link, .connect-settings .field-input, .connect-settings input[type="text"], .connect-settings input[type="tel"], .connect-settings select, .connect-settings .phone-box { max-width: 100%; }
  .connect-facts { grid-template-columns: 1fr; gap: 2px; }
  .connect-facts dd + dt { margin-top: 8px; }
}
