/* Квартиры: список, карточка, форма, факты. */
.flat-deadline {
  align-self: center;
  max-width: 100%;
  white-space: normal;
  text-align: start;
  line-height: 1.4;
}

.flat-deadline a {
  color: inherit;
}

.flat-document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .25rem .5rem;
  margin-bottom: .5rem;
}

.flat-document-select,
.flat-document-title {
  min-width: 0;
}

.flat-document-description {
  grid-column: 1 / -1;
  margin-top: 0;
}

.flat-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}

.flat-icon-button[hidden] {
  display: none;
}

/*
 * Карточка квартиры. На телефоне — одна колонка, блоки по важности: суть → решение по квартире →
 * хронология → документы и задачи; обёртки колонок «растворяются» (display: contents), а порядок
 * задаёт order. На широком экране — две независимые колонки: высота правой не растягивает левую.
 */
.flat-view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.flat-view-col {
  display: contents;
}

.flat-view-summary { order: 1; }
.flat-view-decision { order: 2; }
.flat-view-timeline { order: 3; }
.flat-view-related { order: 4; }

.flat-view #status,
.flat-view #documents {
  scroll-margin-top: 5rem;
}

@media (min-width: 992px) {
  .flat-view-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1.5rem;
  }

  .flat-view-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
  }
}

/*
 * История изменений «Суть і підстави»: разница версий построчно. Удалённое — красным и
 * зачёркнуто, добавленное — зелёным; изменённая строка показывает правку по словам.
 */
.text-diff {
  font-size: .9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.text-diff__line {
  padding: .125rem .5rem;
  border-left: 3px solid transparent;
}

.text-diff__line--same {
  color: var(--bs-secondary-color);
}

.text-diff__line--del {
  border-left-color: var(--bs-danger);
  background: var(--bs-danger-bg-subtle);
}

.text-diff__line--ins {
  border-left-color: var(--bs-success);
  background: var(--bs-success-bg-subtle);
}

.text-diff__line--change {
  border-left-color: var(--bs-warning);
}

.text-diff del {
  color: var(--bs-danger-text-emphasis);
  background: var(--bs-danger-bg-subtle);
}

.text-diff ins {
  color: var(--bs-success-text-emphasis);
  background: var(--bs-success-bg-subtle);
  text-decoration: none;
}

.text-diff__skip {
  padding: .125rem .5rem;
  color: var(--bs-secondary-color);
  font-style: italic;
}

/*
 * Список квартир (flat/index): что горит, конвейер стадий, фильтры, группы по стадиям,
 * доска и панель квартиры справа. Цвет стадии задаёт класс arg-stage--<код> (FlatHtml::stageClass),
 * цвет приоритета — переменная --arg-priority на строке. Устройство — docs/15-product.md.
 */
.flat-index {
  --arg-p0: #e5484d;
  --arg-p1: #f5a524;
  --arg-p2: #5b8def;
  --arg-p3: #cfd5dd;
  --arg-radius: .625rem;
  --arg-border: #e3e6eb;
  --arg-muted: #6b7482;
  --arg-surface-2: #f8f9fb;
  --arg-surface-3: #eef0f3;
  --arg-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --arg-drawer-width: 560px;
}

.arg-stage--new { --stage: #64748b; --stage-bg: #eef1f5; }
.arg-stage--contacted { --stage: #0891b2; --stage-bg: #e4f6fa; }
.arg-stage--talking { --stage: #7c3aed; --stage-bg: #f2edff; }
.arg-stage--viewing { --stage: #d97706; --stage-bg: #fff4e2; }
.arg-stage--viewed { --stage: #2563eb; --stage-bg: #e9f0ff; }
.arg-stage--deal { --stage: #0f766e; --stage-bg: #e3f5f2; }
.arg-stage--bought { --stage: #15803d; --stage-bg: #e6f6ec; }
.arg-stage--frozen { --stage: #b45309; --stage-bg: #fff4e2; }
.arg-stage--rejected { --stage: #8b95a3; --stage-bg: #f0f1f3; }

.arg-stage-dot {
  display: inline-block;
  flex: none;
  width: .5625rem;
  height: .5625rem;
  border-radius: 50%;
  background: var(--stage, var(--arg-muted));
}

.arg-count {
  padding: 0 .4375rem;
  border-radius: 1rem;
  background: var(--arg-surface-3);
  color: #454e5c;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.25rem;
}

.arg-num {
  flex: none;
  color: var(--arg-muted);
  font-family: var(--bs-font-monospace);
  font-size: .8rem;
  font-weight: 500;
}

.flat-index kbd,
.arg-drawer kbd {
  padding: 0 .3125rem;
  border: 1px solid #d3d8df;
  border-bottom-width: 2px;
  border-radius: .3125rem;
  background: var(--arg-surface-2);
  color: var(--arg-muted);
  font-size: .6875rem;
  line-height: 1rem;
  box-shadow: none;
}

.arg-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}

.arg-new-button {
  display: inline-flex;
  align-items: center;
  gap: .4375rem;
}

.arg-new-button kbd {
  margin-left: .25rem;
  border-color: rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

/* Что горит: ближайшее событие и сигналы-фильтры. */
.arg-focus {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  padding: .75rem .875rem;
  border: 1px solid var(--arg-border);
  border-radius: var(--arg-radius);
  background: #fff;
  box-shadow: var(--arg-shadow);
}

.arg-focus__event {
  display: flex;
  align-items: center;
  gap: .875rem;
  min-width: 0;
}

.arg-focus__event--empty {
  gap: .5rem;
}

.arg-calendar {
  display: flex;
  flex: none;
  flex-direction: column;
  width: 3.25rem;
  overflow: hidden;
  border: 1px solid var(--arg-border);
  border-radius: .5625rem;
  text-align: center;
}

.arg-calendar__month {
  padding: .125rem 0;
  background: #c62a2f;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.arg-calendar__day {
  padding-top: .125rem;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}

.arg-calendar__weekday {
  padding-bottom: .25rem;
  color: var(--arg-muted);
  font-size: .65rem;
}

.arg-focus__text {
  min-width: 0;
}

.arg-focus__kicker {
  color: #c62a2f;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.arg-focus__title {
  color: var(--bs-emphasis-color);
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
}

.arg-focus__title:hover {
  text-decoration: underline;
}

.arg-focus__sub {
  color: #454e5c;
  font-size: .82rem;
}

.arg-focus__signals {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-left: auto;
}

.arg-signal {
  --tone: #454e5c;
  --tone-bg: var(--arg-surface-3);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: 0 .75rem;
  border: 1px solid transparent;
  border-radius: .5625rem;
  background: var(--tone-bg);
  color: var(--tone);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}

.arg-signal b {
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}

.arg-signal--hot { --tone: #c62a2f; --tone-bg: #fdecec; }
.arg-signal--revisit { --tone: #a15c07; --tone-bg: #fff3db; }
.arg-signal--unread { --tone: #2f5bea; --tone-bg: #edf1ff; }

.arg-signal:hover {
  border-color: var(--tone);
  color: var(--tone);
}

.arg-signal.is-on {
  background: var(--tone);
  color: #fff;
}

.arg-signal.is-empty {
  opacity: .5;
}

/* Конвейер стадий: путь квартиры слева направо, боковые выходы — отдельно. */
.arg-pipeline {
  display: flex;
  align-items: stretch;
  gap: .625rem;
  margin: 1rem 0 .875rem;
  padding: 1px 1px 2px;
  overflow-x: auto;
}

.arg-pipe {
  --stage: #454e5c;
  --stage-bg: var(--arg-surface-3);
  display: flex;
  flex: none;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 7rem;
  min-height: 3.75rem;
  padding: .5rem 1rem;
  border-radius: var(--arg-radius);
  background: #fff;
  box-shadow: inset 0 3px 0 var(--stage);
  color: #454e5c;
  text-decoration: none;
}

.arg-pipe__count {
  color: var(--bs-emphasis-color);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.arg-pipe__label {
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.arg-pipe:hover {
  background: var(--arg-surface-2);
  color: #454e5c;
}

.arg-pipe.is-on {
  background: var(--stage-bg);
}

.arg-pipe.is-on .arg-pipe__count,
.arg-pipe.is-on .arg-pipe__label {
  color: var(--stage);
}

.arg-pipe.is-empty {
  opacity: .5;
}

.arg-pipe--all,
.arg-pipeline__side .arg-pipe {
  border: 1px solid var(--arg-border);
  box-shadow: inset 0 3px 0 var(--stage), var(--arg-shadow);
}

.arg-pipeline__flow {
  display: flex;
  flex: 1 1 auto;
  min-width: 32rem;
  filter: drop-shadow(0 0 .5px rgba(16, 24, 40, .35)) drop-shadow(0 1px 1px rgba(16, 24, 40, .06));
}

.arg-pipeline__flow .arg-pipe {
  flex: 1 1 0;
  min-width: 0;
  margin-left: -.625rem;
  padding-left: 1.75rem;
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - .875rem) 0, 100% 50%, calc(100% - .875rem) 100%, 0 100%, .875rem 50%);
}

.arg-pipeline__flow .arg-pipe:first-child {
  margin-left: 0;
  padding-left: 1rem;
  border-radius: var(--arg-radius) 0 0 var(--arg-radius);
  clip-path: polygon(0 0, calc(100% - .875rem) 0, 100% 50%, calc(100% - .875rem) 100%, 0 100%);
}

.arg-pipeline__flow .arg-pipe:last-child {
  border-radius: 0 var(--arg-radius) var(--arg-radius) 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, .875rem 50%);
}

.arg-pipeline__flow .arg-pipe__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.arg-pipeline__side {
  display: flex;
  gap: .5rem;
  padding-left: .625rem;
  border-left: 1px dashed #d3d8df;
}

/* Панель фильтров. */
.arg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .625rem;
  margin-top: 1rem;
}

.arg-search {
  display: flex;
  flex: 1 1 18rem;
  align-items: center;
  gap: .5rem;
  min-height: 2.375rem;
  margin: 0;
  padding: 0 .625rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: #fff;
  color: var(--arg-muted);
}

.arg-search:focus-within {
  border-color: #86b7fe;
  box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

.arg-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--bs-body-color);
}

.arg-select {
  width: auto;
  max-width: 100%;
}

.arg-toolbar__reset {
  font-size: .875rem;
}

.arg-view-switch {
  display: inline-flex;
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: #fff;
}

.arg-view-switch a {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  min-height: 2.25rem;
  padding: 0 .75rem;
  color: #454e5c;
  font-size: .875rem;
  text-decoration: none;
}

.arg-view-switch a + a {
  border-left: 1px solid var(--bs-border-color);
}

.arg-view-switch a.is-on {
  background: var(--arg-surface-3);
  color: var(--bs-emphasis-color);
  font-weight: 600;
}


/* Группы по стадиям. */
.arg-group {
  margin-bottom: 1.25rem;
}

.arg-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: 0 .125rem .5rem;
  cursor: pointer;
  list-style: none;
}

.arg-group__head::-webkit-details-marker {
  display: none;
}

.arg-group__head::before {
  content: "";
  width: .45rem;
  height: .45rem;
  margin-right: .125rem;
  border-right: 1.5px solid var(--arg-muted);
  border-bottom: 1.5px solid var(--arg-muted);
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .15s;
}

.arg-group:not([open]) > .arg-group__head::before {
  transform: rotate(-45deg);
}

.arg-group__title {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
}

.arg-group__hint {
  color: var(--arg-muted);
  font-size: .82rem;
}

.arg-group--rejected {
  padding: .625rem .75rem .125rem;
  border: 1px dashed #d3d8df;
  border-radius: var(--arg-radius);
}

.arg-group--rejected:not([open]) {
  padding-bottom: .125rem;
}

.arg-rows {
  border: 1px solid var(--arg-border);
  border-radius: var(--arg-radius);
  background: #fff;
  box-shadow: var(--arg-shadow);
}

/* Строка квартиры. */
.arg-row {
  position: relative;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 0 1rem;
  padding: .75rem 1rem .75rem 0;
  border-top: 1px solid var(--arg-border);
  outline: none;
  cursor: pointer;
}

.arg-row:first-child {
  border-top: 0;
  border-radius: var(--arg-radius) var(--arg-radius) 0 0;
}

.arg-row:last-child {
  border-radius: 0 0 var(--arg-radius) var(--arg-radius);
}

.arg-row:only-child {
  border-radius: var(--arg-radius);
}

.arg-row:hover {
  background: var(--arg-surface-2);
}

.arg-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--bs-primary);
}

.arg-row.is-selected {
  background: #edf1ff;
}

.arg-row__priority {
  margin: 1px 0;
  border-radius: 0 3px 3px 0;
  background: var(--arg-priority);
}

.arg-row__main {
  display: flex;
  flex-direction: column;
  gap: .3125rem;
  min-width: 0;
}

.arg-row__title {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin: 0;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.38;
}

.arg-row__link {
  color: var(--bs-emphasis-color);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.arg-row:hover .arg-row__link {
  text-decoration: underline;
  text-decoration-color: #c3c9d2;
  text-underline-offset: 3px;
}

.arg-unread-dot {
  flex: none;
  align-self: center;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--bs-primary);
}

.arg-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .1875rem .875rem;
  color: var(--arg-muted);
  font-size: .8rem;
}

.arg-meta {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: inherit;
  text-decoration: none;
}

.arg-meta--link:hover {
  color: var(--bs-primary);
}

.arg-meta__new {
  margin-left: .125rem;
  color: var(--bs-primary);
}

.arg-tag {
  padding: 0 .375rem;
  border: 1px solid #d3d8df;
  border-radius: .3125rem;
  color: #454e5c;
  font-size: .72rem;
  line-height: 1.125rem;
}

.arg-row__frozen,
.arg-row__last {
  display: flex;
  align-items: center;
  gap: .375rem;
  min-width: 0;
  color: #454e5c;
  font-size: .82rem;
}

.arg-row__frozen {
  color: var(--arg-stage-frozen, #b45309);
}

.arg-row__frozen b {
  font-weight: 650;
}

.arg-row__frozen .arg-row__clip {
  color: #454e5c;
}

.arg-row__frozen .arg-row__clip b {
  color: #b45309;
}

.arg-row__clip {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arg-row__who {
  flex: none;
  color: var(--bs-emphasis-color);
  font-weight: 600;
}

.arg-row__ago {
  flex: none;
  color: var(--arg-muted);
}

.arg-decision-tag,
.arg-new-tag {
  flex: none;
  padding: 0 .375rem;
  border-radius: .25rem;
  background: #e8f6ee;
  color: #15803d;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.125rem;
}

.arg-new-tag {
  background: #fff3db;
  color: #a15c07;
}

.arg-row__side {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.arg-deadline {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .1875rem;
  text-align: right;
}

.arg-deadline__event {
  position: relative;
  z-index: 1;
  color: var(--arg-muted);
  font-size: .75rem;
  white-space: nowrap;
}

.arg-chip {
  display: inline-flex;
  align-items: center;
  gap: .3125rem;
  padding: .1875rem .5rem;
  border-radius: .375rem;
  background: var(--arg-surface-3);
  color: #454e5c;
  font-size: .8rem;
  font-weight: 650;
  white-space: nowrap;
}

.arg-chip--hot { background: #fdecec; color: #c62a2f; }
.arg-chip--overdue { background: #c62a2f; color: #fff; }
.arg-chip--revisit { background: #fff3db; color: #a15c07; }

.arg-empty {
  padding: 1.75rem;
  border: 1px dashed #d3d8df;
  border-radius: var(--arg-radius);
  background: #fff;
  color: var(--arg-muted);
  text-align: center;
}

.arg-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .875rem;
  margin: .5rem .125rem 0;
  color: var(--arg-muted);
  font-size: .8rem;
}

.arg-legend__item {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

.arg-legend__item i {
  width: 4px;
  height: .875rem;
  border-radius: 2px;
  background: var(--arg-priority);
}

.arg-legend__keys {
  align-items: center;
  gap: .375rem;
  margin-left: auto;
}

/* Доска: колонки стадий, карточки перетаскивают между колонками. */
.arg-board {
  display: grid;
  grid-template-columns: repeat(var(--arg-columns, 6), minmax(12rem, 1fr));
  align-items: start;
  gap: .75rem;
  margin-top: 1rem;
  padding-bottom: .5rem;
  overflow-x: auto;
}

.arg-column {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-height: 18rem;
  padding: .5rem;
  border-radius: var(--arg-radius);
  background: var(--arg-surface-3);
  box-shadow: inset 0 3px 0 var(--stage);
  transition: background .15s, box-shadow .15s;
}

.arg-column.is-over {
  background: var(--stage-bg);
  box-shadow: inset 0 0 0 2px var(--stage);
}

.arg-column__head {
  display: flex;
  align-items: center;
  gap: .4375rem;
  padding: .375rem .25rem 0;
}

.arg-column__title {
  margin: 0;
  font-size: .85rem;
  font-weight: 700;
}

.arg-column__hint {
  margin: 0;
  padding: 0 .25rem .25rem;
  color: var(--arg-muted);
  font-size: .75rem;
  line-height: 1.35;
}

.arg-column__empty {
  padding: 1.25rem .375rem;
  border: 1.5px dashed #d3d8df;
  border-radius: .5rem;
  color: var(--arg-muted);
  font-size: .8rem;
  text-align: center;
}

.arg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .4375rem;
  padding: .5625rem .625rem .625rem .8125rem;
  overflow: hidden;
  border: 1px solid var(--arg-border);
  border-radius: .5625rem;
  background: #fff;
  box-shadow: var(--arg-shadow);
  cursor: grab;
}

.arg-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--arg-priority);
}

.arg-card:hover {
  border-color: #d3d8df;
}

.arg-card:focus-visible {
  outline: 2px solid var(--bs-primary);
}

.arg-card.is-selected {
  outline: 2px solid var(--bs-primary);
  outline-offset: -1px;
}

.arg-card.is-dragging {
  opacity: .4;
}

.arg-card__top {
  display: flex;
  align-items: center;
  gap: .375rem;
}

.arg-card__title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.arg-card__title a {
  color: var(--bs-emphasis-color);
  text-decoration: none;
}

.arg-card .arg-deadline {
  align-items: flex-start;
}

.arg-card .arg-chip {
  align-self: flex-start;
}

.arg-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
  color: var(--arg-muted);
  font-size: .75rem;
}

.arg-column.arg-stage--rejected .arg-card {
  opacity: .75;
}

/* Панель квартиры справа. На широком экране список остаётся рядом, на узком панель поверх. */
.arg-drawer {
  position: fixed;
  top: var(--case-navbar-height, 57px);
  right: 0;
  bottom: 0;
  z-index: 1035;
  display: flex;
  flex-direction: column;
  width: var(--arg-drawer-width);
  max-width: 100vw;
  border-left: 1px solid var(--arg-border);
  background: #fff;
  box-shadow: -8px 0 32px rgba(16, 24, 40, .14);
  transform: translateX(105%);
  transition: transform .22s ease, visibility .22s;
  visibility: hidden;
}

.arg-drawer.is-open {
  transform: none;
  visibility: visible;
}

.arg-drawer:focus {
  outline: none;
}

.arg-drawer__loading {
  padding: 1.5rem;
  color: var(--arg-muted);
}

.arg-drawer-backdrop {
  position: fixed;
  inset: var(--case-navbar-height, 57px) 0 0 0;
  z-index: 1034;
  background: rgba(15, 18, 22, .28);
}

@media (min-width: 1500px) {
  .flat-index.has-panel {
    margin-right: calc(var(--arg-drawer-width) - max(0px, (100vw - 1320px) / 2) + 1rem);
  }

  .arg-drawer {
    box-shadow: -8px 0 24px rgba(16, 24, 40, .06);
  }

  .arg-drawer-backdrop {
    display: none;
  }
}

.arg-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.arg-panel__bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: .5rem;
  padding: .625rem .875rem .625rem 1.25rem;
  border-bottom: 1px solid var(--arg-border);
}

.arg-panel__bar .btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}

.arg-panel__house {
  overflow: hidden;
  color: var(--arg-muted);
  font-size: .82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arg-panel__body {
  flex: 1;
  padding: 1.125rem 1.375rem 3rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.arg-panel__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.arg-panel__label {
  margin-bottom: .4375rem;
  color: var(--arg-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.arg-stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .375rem;
  margin-bottom: 1.125rem;
}

.arg-step {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  min-height: 1.875rem;
  padding: 0 .625rem;
  border: 1px solid #d3d8df;
  border-radius: 1rem;
  background: #fff;
  color: #454e5c;
  font-size: .8rem;
  font-weight: 600;
}

.arg-step .arg-stage-dot {
  width: .5rem;
  height: .5rem;
}

.arg-step[data-stage-change]:hover {
  border-color: var(--stage);
  color: var(--bs-emphasis-color);
}

.arg-step.is-current {
  border-color: var(--stage);
  background: var(--stage-bg);
  color: var(--stage);
}

.arg-step:not([data-stage-change]) {
  cursor: default;
}

.arg-stepper__arrow {
  color: #c3c9d2;
  font-size: .75rem;
}

.arg-stepper__sep {
  width: 1px;
  height: 1.25rem;
  margin: 0 .25rem;
  background: #d3d8df;
}

.arg-panel__props {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: .5625rem .75rem;
  margin: 0 0 1.125rem;
  font-size: .875rem;
}

.arg-panel__props dt {
  color: var(--arg-muted);
  font-weight: 400;
}

.arg-panel__props dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  margin: 0;
}

.arg-panel__props .arg-deadline {
  flex-direction: row;
  align-items: center;
  gap: .5rem;
}

.arg-priority-bar {
  width: 4px;
  height: 1rem;
  border-radius: 2px;
  background: var(--arg-priority);
}

.arg-box {
  margin-bottom: 1rem;
  padding: .6875rem .8125rem;
  border-left: 3px solid var(--box, var(--arg-muted));
  border-radius: .5rem;
  background: var(--box-bg, var(--arg-surface-3));
}

.arg-box__label {
  color: var(--box, var(--arg-muted));
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.arg-box .md,
.arg-box p {
  margin: .25rem 0 .375rem;
}

.arg-box .md > :last-child {
  margin-bottom: 0;
}

.arg-box__by {
  display: flex;
  align-items: center;
  gap: .375rem;
  color: var(--arg-muted);
  font-size: .8rem;
}

.arg-box--decision { --box: #15803d; --box-bg: #e8f6ee; }
.arg-box--frozen { --box: #a15c07; --box-bg: #fff3db; }

.arg-panel__section {
  padding: .875rem 0 .375rem;
  border-top: 1px solid var(--arg-border);
}

.arg-panel__heading {
  display: flex;
  align-items: center;
  gap: .375rem;
  margin: 0 0 .5rem;
  color: var(--arg-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.arg-panel__heading a {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: none;
}

.arg-panel__heading .arg-count {
  letter-spacing: 0;
  text-transform: none;
}

.arg-panel__tasks,
.arg-panel__docs {
  margin: 0 0 .375rem;
  padding: 0;
  list-style: none;
}

.arg-panel__tasks li {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .25rem 0;
}

.arg-panel__tasks form {
  flex: none;
}

.arg-panel__tasks .task-icon-button {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  min-height: 1.75rem;
  padding: 0;
  font-size: .85rem;
}

.arg-panel__task-state {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--bs-border-radius);
  background: #15803d;
  color: #fff;
}

.arg-panel__task-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.arg-panel__tasks li.is-closed .arg-panel__task-title {
  color: var(--arg-muted);
  text-decoration: line-through;
}

.arg-panel__task-meta {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
}

.arg-panel__docs li {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .3125rem 0;
}

.arg-panel__doc-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 1.875rem;
  height: 2.125rem;
  border-radius: .3125rem;
  background: var(--arg-surface-3);
  color: var(--arg-muted);
}

.arg-panel__doc-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.arg-panel__doc-body a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arg-panel__doc-meta {
  color: var(--arg-muted);
  font-size: .75rem;
}

.arg-composer {
  margin: .25rem 0 .625rem;
  padding: .5rem .625rem;
  border: 1px solid #d3d8df;
  border-radius: .5625rem;
}

.arg-composer:focus-within {
  border-color: #86b7fe;
  box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

.arg-composer textarea {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  box-shadow: none !important;
  resize: vertical;
}

.arg-composer__bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .375rem;
  font-size: .85rem;
}

.arg-entry {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: .625rem;
  padding: .5625rem 0;
  border-top: 1px solid var(--arg-border);
}

.arg-entry.is-new {
  margin: 0 -.5rem;
  padding-inline: .5rem;
  background: #fffbeb;
}

.arg-entry__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
}

.arg-entry__head a {
  text-decoration: none;
}

.arg-entry__text {
  margin-top: .125rem;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.arg-entry__text > :last-child {
  margin-bottom: 0;
}

.arg-entry--decision .arg-entry__text {
  margin-top: .3125rem;
  padding: .375rem .5625rem;
  border-radius: .375rem;
  background: #e8f6ee;
}

.arg-entry--status {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--arg-muted);
  font-size: .8rem;
}

.arg-entry__text--status {
  margin: -.25rem 0 .375rem 1.5rem;
  color: #454e5c;
  font-size: .85rem;
}

.arg-panel__more {
  display: inline-block;
  margin-top: .375rem;
  font-size: .85rem;
}

.arg-stage-modal__eyebrow {
  color: var(--arg-muted, #6b7482);
  font-size: .8rem;
  font-weight: 600;
}

.arg-stage-modal__note {
  margin-right: auto;
  color: #6b7482;
  font-size: .8rem;
}

@media (max-width: 767.98px) {
  .arg-focus__signals {
    width: 100%;
    margin-left: 0;
  }

  .arg-signal {
    min-height: 2.25rem;
    padding: 0 .5625rem;
    font-size: .8rem;
  }

  .arg-pipeline__flow {
    min-width: 30rem;
  }

  .arg-view-switch {
    margin-left: 0;
  }

  .arg-select {
    flex: 1 1 9rem;
    min-width: 0;
  }

  .arg-row {
    grid-template-columns: 4px minmax(0, 1fr);
    gap: 0 .75rem;
    padding-right: .75rem;
  }

  .arg-row__side {
    grid-column: 2;
    justify-content: space-between;
    margin-top: .5rem;
  }

  .arg-row__side .arg-deadline {
    align-items: flex-start;
    text-align: left;
  }

  .arg-group__hint {
    flex-basis: 100%;
  }

  .arg-drawer {
    width: 100vw;
  }

  .arg-panel__props {
    grid-template-columns: 6.5rem minmax(0, 1fr);
  }
}

/* Факты о квартире строкой: комнаты, площадь, этаж, дом, цена и цена за м² (FlatHtml::factsLine). */
.arg-row__facts,
.arg-card__facts {
  color: #2f3742;
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

.arg-row__facts { margin: .125rem 0 .25rem; }
.arg-card__facts { margin: .125rem 0 .375rem; }
.arg-row__facts:empty,
.arg-card__facts:empty { display: none; }

.flat-facts dt { font-weight: 400; }
.flat-facts .md ul { padding-left: 1.1rem; margin-bottom: 0; }
.arg-panel .flat-facts { margin-top: .75rem; }

/* Инструменты (site/tools): курсы, сортируемая таблица сравнения. */
.tools-rate { width: 5.5rem; }
.tools-table th { white-space: nowrap; font-weight: 600; font-size: .8125rem; }
.tools-table td { font-variant-numeric: tabular-nums; }
.tools-sortable { cursor: pointer; user-select: none; }
.tools-sortable::after { content: ' ↕'; color: #b5bcc6; font-weight: 400; }
.tools-sortable[data-dir="asc"]::after { content: ' ↑'; color: inherit; }
.tools-sortable[data-dir="desc"]::after { content: ' ↓'; color: inherit; }

/* Фото квартиры (flat/_photos.php, flat-photos.js): плитки миниатюр и просмотр во весь экран. */
.flat-photos.is-dragover { outline: 2px dashed var(--bs-primary); outline-offset: -2px; }
.flat-photos__upload { display: flex; align-items: center; gap: .5rem; margin: 0; }
.flat-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: .5rem;
}
.flat-gallery__item { margin: 0; min-width: 0; }
.flat-gallery__link {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: .375rem;
  background: #eef0f3;
}
.flat-gallery__link img { width: 100%; height: 100%; object-fit: cover; transition: transform .15s; }
.flat-gallery__link:hover img { transform: scale(1.03); }
.flat-gallery__link:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.flat-gallery__cover {
  position: absolute;
  left: .375rem;
  top: .375rem;
  padding: .0625rem .375rem;
  border-radius: .25rem;
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: .6875rem;
}
.flat-gallery__caption {
  margin-top: .25rem;
  color: #5b6472;
  font-size: .75rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.flat-lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0d11;
  color: #fff;
}
.flat-lightbox[open] { display: flex; flex-direction: column; }
.flat-lightbox::backdrop { background: rgba(10, 12, 16, .6); }
.flat-lightbox__bar,
.flat-lightbox__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .625rem 1rem;
  font-variant-numeric: tabular-nums;
}
.flat-lightbox__foot { justify-content: space-between; }
.flat-lightbox__stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 3.5rem;
}
.flat-lightbox__image { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.flat-lightbox__nav {
  position: absolute;
  top: 50%;
  width: 2.75rem;
  height: 4rem;
  margin-top: -2rem;
  border: 0;
  border-radius: .375rem;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}
.flat-lightbox__nav:hover { background: rgba(255, 255, 255, .18); }
.flat-lightbox__nav--prev { left: .5rem; }
.flat-lightbox__nav--next { right: .5rem; }
.flat-lightbox__caption-form { display: flex; flex: 1 1 18rem; gap: .5rem; margin: 0; max-width: 36rem; }
.flat-lightbox__foot form { margin: 0; }

@media (max-width: 575.98px) {
  .flat-lightbox__stage { padding: 0; }
  .flat-lightbox__nav { display: none; }
}

/* Обложка квартиры в списке, на доске и в сравнении (FlatHtml::cover). */
.flat-cover {
  position: relative;
  display: block;
  overflow: hidden;
  background: #eef0f3;
}
.flat-cover img { width: 100%; height: 100%; object-fit: cover; }
.flat-cover__count {
  position: absolute;
  right: .25rem;
  bottom: .25rem;
  padding: 0 .3125rem;
  border-radius: .25rem;
  background: rgba(17, 24, 39, .72);
  color: #fff;
  font-size: .6875rem;
  line-height: 1.4;
}
.arg-row:has(.arg-row__cover) { grid-template-columns: 4px 5.5rem minmax(0, 1fr) auto; }
.arg-row__cover { align-self: start; width: 5.5rem; aspect-ratio: 4 / 3; border-radius: .375rem; }
.arg-card__cover {
  height: 6.5rem;
  margin: -.5625rem -.625rem 0 -.8125rem;
}
.tools-flat { display: flex; align-items: center; gap: .5rem; min-width: 12rem; }
.tools-flat__cover { flex: none; width: 3.5rem; aspect-ratio: 4 / 3; border-radius: .25rem; }

/* Узкий экран: колонка справа уходит под текст строки (max-width 767.98px выше), обложка остаётся слева. */
@media (max-width: 767.98px) {
  .arg-row:has(.arg-row__cover) { grid-template-columns: 4px 4rem minmax(0, 1fr); }
  .arg-row:has(.arg-row__cover) .arg-row__side { grid-column: 3; }
  .arg-row__cover { width: 4rem; }
}

/* Миниатюры в панели квартиры (FlatHtml::photoStrip). */
.flat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .375rem; margin: .5rem 0 .25rem; }
.flat-strip__item { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: .3125rem; background: #eef0f3; }
.flat-strip__item img { width: 100%; height: 100%; object-fit: cover; }
.flat-strip__more {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, .55);
  color: #fff;
  font-weight: 600;
}

.flat-lightbox__foot .btn { white-space: nowrap; }

/* Избранное (FlatHtml::favoriteButton, flat-favorite.js): своя звёздочка залита, чужая — контуром
   с числом отметивших; отмеченная кем-нибудь квартира подсвечена в списке, на доске и в сравнении. */
.flat-star-form { display: inline-flex; margin: 0; }
.flat-star {
  display: inline-flex;
  align-items: center;
  gap: .1875rem;
  padding: .125rem .25rem;
  border: 0;
  border-radius: .375rem;
  background: none;
  color: #a3abb6;
  font-size: 1.15rem;
  line-height: 1;
}
.flat-star:hover { background: #fff3cd; color: #c99700; }
.flat-star:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 1px; }
.flat-star.is-on { color: #d29b00; }
.flat-star.is-mine { color: #e0a800; }
.flat-star.is-mine .case-icon { fill: currentColor; }
.flat-star__count { font-size: .75rem; font-weight: 700; }
.flat-star__count:empty { display: none; }
.flat-star-form--bar .flat-star {
  height: 100%;
  min-height: calc(1.5em + .5rem + 2px);
  padding: .25rem .5rem;
  border: 1px solid #d3d8df;
  font-size: 1rem;
}
.flat-star-form--bar .flat-star.is-mine { border-color: #f0c64a; background: #fff8e1; }

.arg-row.is-favorite { background: #fffaeb; }
.arg-row.is-favorite:hover { background: #fff4d1; }
.arg-row.is-favorite.is-selected { background: #fdf0c4; }
.arg-card.is-favorite { border-color: #f0d48a; background: #fffaeb; }
.arg-signal--favorite { --tone: #946c00; --tone-bg: #fff6d6; }
.flat-favorite-names { color: #8a6800; font-size: .8125rem; }
.tools-favorite > td { background: #fffaeb; }
.tools-star { color: #e0a800; }

/* Карта ЖК (site/map, flat-map.js): схема, отметки квартир у подъездов и букв домов, список и карточка. */
.zhk-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1rem; align-items: start; }
.zhk-map { position: relative; overflow: hidden; border: 1px solid var(--arg-border, #e3e7ec); border-radius: .5rem; background: #eef0f3; }
.zhk-map img { display: block; width: 100%; height: auto; }
.zhk-pin {
  position: absolute;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: max-content;
  max-width: 8rem;
  transform: translate(10px, -50%);
  pointer-events: none;
}
.zhk-pin--house { transform: translate(18px, -50%); }
.zhk-chip {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0 .375rem;
  border: 2px solid var(--stage);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .35);
  color: #111827;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  pointer-events: auto;
  transition: transform .12s;
}
.zhk-chip:hover,
.zhk-chip:focus-visible { transform: scale(1.12); color: #111827; }
.zhk-chip.is-active { background: var(--stage); color: #fff; transform: scale(1.15); }
.zhk-chip__star { color: #e0a800; }
.zhk-chip.is-active .zhk-chip__star { color: #fff3b0; }
.zhk-chip.is-pulse { animation: zhk-pulse .9s ease-out 2; }
@keyframes zhk-pulse { 0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .6); } 100% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); } }

.zhk-map-card { overflow: hidden; }
.zhk-map-card__cover { position: relative; display: block; aspect-ratio: 4 / 3; background: #eef0f3; }
.zhk-map-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.zhk-map-card__title { display: block; margin-bottom: .25rem; color: inherit; font-weight: 600; text-decoration: none; }
.zhk-map-card__title:hover { text-decoration: underline; }
.zhk-map-card__stage { display: inline-flex; align-items: center; gap: .375rem; margin-bottom: .25rem; color: var(--stage); font-size: .8125rem; font-weight: 600; }

.zhk-map-list__head { margin: .75rem 0 .25rem; font-size: .8125rem; font-weight: 700; color: #5b6472; text-transform: uppercase; letter-spacing: .02em; }
.zhk-map-list__head:first-child { margin-top: 0; }
.zhk-map-list__item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 0 .375rem;
  width: 100%;
  padding: .3125rem .5rem;
  border: 0;
  border-radius: .375rem;
  background: none;
  font-size: .8125rem;
  text-align: left;
}
.zhk-map-list__item:hover { background: var(--stage-bg); }
.zhk-map-list__item.is-active { background: var(--stage-bg); box-shadow: inset 3px 0 0 var(--stage); }
.zhk-map-list__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zhk-map-list__place { grid-column: 3; color: #6b7480; font-size: .75rem; }

@media (max-width: 991.98px) {
  .zhk-map-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
  .zhk-chip { padding: 0 .25rem; font-size: .625rem; border-width: 1.5px; }
  .zhk-pin { transform: translate(6px, -50%); }
  .zhk-pin--house { transform: translate(10px, -50%); }
}
