/* === Design tokens (Apart.kg) ===
   Acent: emerald/teal — доверие, недвижимость
   Шкала: 4 / 8 / 12 / 16 / 24 / 32 / 48
   Радиусы: 8 / 12 / 16 / 20
*/
:root {
  /* Цвета (тёмная тема — по умолчанию) */
  --bg: #0b1310;
  --surface: #11201b;
  --surface2: #172a23;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef7f3;
  --muted: #9bb3aa;
  --accent: #14b8a6;
  --accent-hover: #2dd4bf;
  --accent-rgb: 20, 184, 166;
  --accent-soft: rgba(var(--accent-rgb), 0.16);
  --accent-line: rgba(var(--accent-rgb), 0.38);
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #f87171;

  /* Скругления */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --radius-lg: 20px;

  /* Отступы (token-scale) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;

  /* Тени */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);

  /* Типографика */
  --font: "Manrope", "Onest", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --fs-caption: clamp(0.75rem, 0.06vw + 0.74rem, 0.8125rem);
  --fs-body: clamp(0.875rem, 0.1vw + 0.86rem, 0.9375rem);
  --fs-lead: clamp(1rem, 0.15vw + 0.97rem, 1.0625rem);
  --fs-h3: clamp(1.0625rem, 0.25vw + 1rem, 1.1875rem);
  --fs-h2: clamp(1.25rem, 0.4vw + 1.15rem, 1.5rem);
  --fs-h1: clamp(1.5rem, 0.7vw + 1.3rem, 1.875rem);

  /* Кривые анимаций */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 280ms;

  /* Layout */
  --max-w: 1200px;
  --form-max: 640px;
  --nav-breakpoint: 900px;
  --tap-min: 44px;
}

body[data-theme="light"] {
  --bg: #f5fbf8;
  --surface: #ffffff;
  --surface2: #eef7f2;
  --border: rgba(10, 80, 60, 0.12);
  --text: #0d2620;
  --muted: #5b7a72;
  --accent: #0f9c8c;
  --accent-hover: #0c8576;
  --accent-rgb: 15, 156, 140;
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-line: rgba(var(--accent-rgb), 0.3);
  --shadow-sm: 0 2px 8px rgba(15, 80, 60, 0.08);
  --shadow: 0 8px 28px rgba(15, 80, 60, 0.12);
  --shadow-lg: 0 16px 48px rgba(15, 80, 60, 0.18);
}

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

html {
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100dvh;
  min-height: 100svh;
  font-family: var(--font);
  font-size: clamp(14px, 0.25vw + 13px, 16px);
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(165deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 86%, #000 14%) 60%, var(--bg) 100%);
  overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.app {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.view--active {
  display: flex;
}

.view .main {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

#view-home .segment,
#view-home .chips {
  flex-shrink: 0;
}

.header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header__search-wrap[hidden] {
  display: none !important;
}

.header__brand-line {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}

.header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.header__mark {
  width: clamp(32px, 8vw, 38px);
  height: clamp(32px, 8vw, 38px);
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35);
}

.header__wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-weight: 700;
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.header__name {
  background: linear-gradient(135deg, #faf5ff 0%, #e9d5ff 55%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__tld {
  color: #a78bfa;
  font-weight: 600;
}

.header__page-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(160px, 38vw);
}

.header__logo {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

@media (min-width: 480px) {
  .header__page-title {
    max-width: 240px;
    font-size: 0.875rem;
  }
}

@media (min-width: 900px) {
  .header__page-title {
    max-width: none;
  }
}

.header__search-wrap {
  margin-top: 10px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px 16px 8px;
}

.nav-main {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  min-width: 0;
}

.nav-main__item {
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-main__item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-main__item.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.header__actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border: none;
  border-radius: 12px;
  background: var(--surface);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--surface2);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search__icon {
  opacity: 0.6;
  font-size: 1rem;
}

.search__input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.search__input::placeholder {
  color: var(--muted);
}

/* Segments */
.segment {
  display: flex;
  gap: 6px;
  padding: 8px 16px 4px;
}

.segment__btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.segment__btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

/* Chips */
.chips {
  display: flex;
  gap: 8px;
  padding: 8px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chips--rooms {
  padding-top: 0;
  padding-bottom: 12px;
}

.chips--rooms .chip {
  min-width: 40px;
  text-align: center;
  padding: 6px 12px;
}

/* === Каталог агентств === */

.agencies {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agencies__title {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 700;
}

.agencies__lead {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
}

.agencies__search {
  display: flex;
}

.agencies__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.agency-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.agency-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.agency-card__logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--surface2);
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.agency-card__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agency-card__logo-ph {
  font-size: 1.5rem;
  color: var(--muted);
}

.agency-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.agency-card__name {
  margin: 0;
  font-weight: 600;
  font-size: var(--fs-body);
  display: flex;
  align-items: center;
  gap: 6px;
}

.agency-card__meta,
.agency-card__rating {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--muted);
}

.agency-card--skeleton {
  cursor: default;
}

.agency-card--skeleton:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.agency-page {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agency-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.agency-head__logo {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  background: var(--surface2);
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.agency-head__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agency-head__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agency-head__desc {
  margin: 4px 0 0;
  color: var(--text);
}

.agency-head__count {
  margin: 8px 0 0;
  color: var(--muted);
}

.agency-form .field {
  margin-bottom: 8px;
}

.agency-form__fields[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.agency-form__fields {
  border: 0;
  padding: 0;
  margin: 0 0 12px;
}

/* === Callbacks (заявки на обратный звонок) === */

.callbacks-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.callbacks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.callback-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
}

.callback-row__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.callback-row__head a {
  color: var(--accent);
  font-weight: 600;
}

.callback-row__meta {
  margin-top: 4px;
  font-size: var(--fs-caption);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.callback-row__comment {
  margin-top: 6px;
  font-size: var(--fs-caption);
  color: var(--text);
}

.callback-row__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* === Promo (тарифы) === */

.promo-tiers {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.promo-tier {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.promo-tier__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.promo-tier__days {
  font-size: var(--fs-caption);
  color: var(--muted);
}

.promo-tier__price {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 700;
}

.promo-tier__perks {
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-caption);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.promo-tier__action {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

/* === Detail modal: крошки, агентство, описание, похожие === */

.modal__crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: var(--fs-caption);
  color: var(--muted);
  margin-bottom: 8px;
}

.modal__crumb {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  text-decoration: none;
}

.modal__crumb:hover {
  text-decoration: underline;
}

.modal__crumb--last {
  color: var(--muted);
  cursor: default;
}

.modal__crumb--last:hover {
  text-decoration: none;
}

.modal__crumb-sep {
  color: var(--muted);
  opacity: 0.7;
}

.modal__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.modal__description {
  margin-top: 12px;
}

.modal__description-inner {
  background: var(--surface2);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  line-height: 1.55;
  color: var(--text);
  font-size: var(--fs-body);
}

.modal__agency-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 12px;
}

.modal__agency-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.modal__agency-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal__agency-name {
  margin: 0;
  font-weight: 600;
}

.modal__agency-card .btn {
  margin-left: auto;
}

.modal__similar {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.modal__similar-title {
  margin: 0 0 12px;
  font-size: var(--fs-h3);
  font-weight: 700;
}

.home-rail--in-modal {
  grid-auto-columns: minmax(180px, 220px);
}

/* На широких экранах модалки — две колонки: контент слева, контакты + похожие справа */
@media (min-width: 1400px) {
  .modal__panel--detail .modal__body {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    grid-column-gap: 24px;
    align-items: start;
  }
  .modal__panel--detail .modal__body > .modal__crumbs {
    grid-column: 1 / -1;
  }
  .modal__panel--detail .modal__body > .modal__similar {
    grid-column: 1 / -1;
  }
  .modal__panel--detail .modal__body > .modal__description,
  .modal__panel--detail .modal__body > .modal__media,
  .modal__panel--detail .modal__body > .modal__reviews {
    grid-column: 1;
  }
  .modal__panel--detail .modal__body > .modal__price,
  .modal__panel--detail .modal__body > .card__price,
  .modal__panel--detail .modal__body > .modal__title,
  .modal__panel--detail .modal__body > .modal__meta,
  .modal__panel--detail .modal__body > .modal__badges {
    grid-column: 1;
  }
  .modal__panel--detail .modal__body > .modal__trust,
  .modal__panel--detail .modal__body > .modal__agency,
  .modal__panel--detail .modal__body > .modal__owner,
  .modal__panel--detail .modal__body > .modal__actions,
  .modal__panel--detail .modal__body > .modal__live-actions,
  .modal__panel--detail .modal__body > .modal__deal-actions {
    grid-column: 2;
  }
}

/* List */
.main {
  padding: 0 16px 88px;
}

.results-count {
  margin: 4px 0 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.results-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
  flex-wrap: wrap;
}

.results-row .results-count {
  margin: 0;
}

.results-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.btn--ghost:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.saved-search-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--surface2);
}

.saved-search-item__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.saved-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.saved-search-toggle input {
  accent-color: var(--accent);
}

/* Trust */
.trust-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.trust-pill--ok {
  background: rgba(52, 211, 153, 0.18);
  color: #14b67e;
}

body[data-theme="dark"] .trust-pill--ok {
  color: #5be3b6;
}

.trust-pill--muted {
  background: rgba(168, 155, 196, 0.16);
  color: var(--muted);
}

.trust-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.trust-score__num {
  font-weight: 700;
  color: var(--text);
}

.trust-score__bar {
  display: inline-block;
  width: 56px;
  height: 6px;
  border-radius: 3px;
  background: rgba(168, 155, 196, 0.2);
  overflow: hidden;
  position: relative;
}

.trust-score__bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s;
}

.trust-score--ok .trust-score__bar > span {
  background: #34d399;
}
.trust-score--warn .trust-score__bar > span {
  background: #f59e0b;
}
.trust-score--bad .trust-score__bar > span {
  background: #f87171;
}

.trust-flags {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.trust-flags li {
  margin-bottom: 2px;
}

.trust-filter {
  padding: 0 16px 12px;
}

.trust-filter__check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.trust-filter__check input {
  accent-color: var(--accent);
}

.modal__trust {
  margin: 12px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
}

.modal__owner {
  margin: 8px 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.modal__owner-line {
  margin: 2px 0;
}

.modal__reviews {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.modal__reviews-title {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.review-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.review-item:last-child {
  border-bottom: none;
}

.review-item__head {
  margin: 0 0 4px;
  font-size: 0.875rem;
}

.review-item__text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.rating-stars {
  color: #f59e0b;
  letter-spacing: 1px;
}

.verify-photos {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.verify-photos img {
  width: 110px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.admin-section-title {
  margin: 16px 16px 6px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Tour 360 + WebRTC */
.modal__panel--full {
  max-width: 96vw;
  width: 96vw;
  height: 92vh;
  display: flex;
  flex-direction: column;
}

.tour-viewer {
  flex: 1;
  min-height: 320px;
  background: #000;
  border-radius: var(--radius-sm);
  margin: 8px 16px 16px;
}

.tour-photo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tour-photo-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.875rem;
}

.tour-photo-list select {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
}

.modal__media {
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal__media video {
  width: 100%;
  max-height: 360px;
  border-radius: var(--radius-sm);
  background: #000;
}

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

.modal__live-actions {
  margin-top: 6px;
}

.tour-icon {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rtc-grid {
  flex: 1;
  position: relative;
  margin: 0 16px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rtc-cell {
  position: relative;
  width: 100%;
  height: 100%;
}

.rtc-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rtc-cell .rtc-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.rtc-cell--small {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 30%;
  max-width: 220px;
  height: 30%;
  border: 2px solid #fff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #111;
}

.rtc-controls {
  padding: 8px 16px 16px;
}

.viewing-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.viewing-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.more__card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.deal-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.deal-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.deal-card__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.rent-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.rent-row {
  display: grid;
  grid-template-columns: 100px 1fr 90px auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.875rem;
}

.rent-row--ok {
  color: #14b67e;
}

body[data-theme="dark"] .rent-row--ok {
  color: #5be3b6;
}

.rent-row--bad {
  color: #f87171;
}

.modal__deal-actions {
  margin-top: 6px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 900px) {
  .list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (min-width: 1100px) {
  .list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.28);
}

.card__img-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface2);
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card__badge--rent {
  background: rgba(52, 199, 89, 0.9);
  color: #0a1a0c;
}

.card__badge--sale {
  background: rgba(var(--accent-rgb), 0.92);
  color: #fff;
}

.card__fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 20, 25, 0.65);
  backdrop-filter: blur(8px);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.card__fav:hover {
  background: rgba(15, 20, 25, 0.85);
}

.card__fav.is-liked {
  transform: scale(1.05);
}

.card__body {
  padding: 12px 14px 14px;
}

.card__price {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.card__price small {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.35;
}

.card__meta {
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.card__meta span::before {
  content: "·";
  margin-right: 6px;
  opacity: 0.5;
}

.card__meta span:first-child::before {
  content: none;
  margin: 0;
}

/* Подвал сайта */
.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0));
  background: rgba(10, 14, 18, 0.85);
  border-top: 1px solid var(--border);
}

@media (max-width: 899px) {
  .site-footer {
    padding-bottom: calc(88px + 20px + env(safe-area-inset-bottom, 0));
  }
}

.site-footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  text-align: center;
}

.site-footer__copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer__note {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.85;
}

/* Tab bar (мобильные — дублирует верхнее меню) */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
  background: rgba(26, 34, 45, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 20;
}

.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.625rem;
  font-weight: 500;
  cursor: pointer;
  max-width: 72px;
}

.tabbar__item.is-active {
  color: var(--accent);
}

.tabbar__icon {
  font-size: 1.25rem;
  line-height: 1;
}

.tabbar__label {
  white-space: nowrap;
}

/* РљР°СЂС‚Р° */
.map-hint {
  padding: 6px 16px 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  flex-shrink: 0;
}

.map-container {
  flex: 1;
  min-height: 280px;
  height: 100%;
  margin: 0 12px 88px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface2);
}

.map-container .leaflet-container {
  font-family: var(--font);
  z-index: 1;
  height: 100%;
  min-height: 280px;
}

.map-pin {
  background: transparent !important;
  border: none !important;
}

.map-pin__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin: 3px;
  background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.45);
}

/* Р¤РѕСЂРјР° */
.form {
  padding: 8px 16px 100px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.form__intro {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.4;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field__input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
}

.field__input:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.55);
}

.field-row {
  display: flex;
  gap: 10px;
}

.field--half {
  flex: 1;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-body);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease), filter var(--dur) var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 92%, white 8%) 0%,
    var(--accent) 50%,
    var(--accent-hover) 100%
  );
  color: #062e29;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.32);
}

body[data-theme="light"] .btn--primary {
  color: #ffffff;
}

.btn--primary:hover {
  filter: brightness(1.06);
}

.btn--primary:focus-visible,
.btn--secondary:focus-visible,
.icon-btn:focus-visible,
.nav-main__item:focus-visible,
.tabbar__item:focus-visible,
.segment__btn:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--block {
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}

/* РџСѓСЃС‚РѕРµ РёР·Р±СЂР°РЅРЅРѕРµ */
.empty {
  text-align: center;
  padding: 48px 24px;
}

.empty__title {
  font-weight: 600;
  font-size: 1.125rem;
  margin: 0 0 8px;
}

.empty__text {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.5;
}

/* Р•С‰С‘ */
.more {
  padding: 8px 16px 100px;
  overflow-y: auto;
  flex: 1;
}

.more__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.more__label {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.more__links {
  padding-top: 8px;
}

.more__link {
  background: none;
  border: none;
  color: #ff6b6b;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.more__note {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 12px 0 0;
  line-height: 1.45;
}

.inline-note {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* РњРѕРґР°Р»СЊРЅРѕРµ РѕРєРЅРѕ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal[hidden] {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: var(--max-w);
  max-height: 90dvh;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
  animation: modalUp 0.25s ease;
}

@keyframes modalUp {
  from {
    transform: translateY(100%);
    opacity: 0.8;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(15, 20, 25, 0.75);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal__img-wrap {
  aspect-ratio: 16 / 10;
  background: var(--surface2);
  flex-shrink: 0;
}

.modal__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal__body {
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0));
  overflow-y: auto;
}

.modal__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.35;
}

.modal__meta {
  margin-bottom: 20px;
}

.modal__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(var(--max-w) - 32px);
  width: calc(100% - 32px);
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  text-align: center;
  z-index: 4000;
  box-shadow: var(--shadow);
}

.toast[hidden] {
  display: none !important;
}

/* Веб: десктоп и планшет */
@media (min-width: 900px) {
  .nav-main {
    display: flex;
  }

  .tabbar {
    display: none !important;
  }

  .header__row {
    gap: 16px;
  }

  .main {
    padding: 0 24px 40px;
  }

  .map-container {
    margin: 0 24px 32px;
    min-height: 420px;
  }

  .form {
    padding: 16px 24px 48px;
    max-width: var(--form-max);
    margin: 0 auto;
    width: 100%;
  }

  .more {
    padding: 16px 24px 48px;
    max-width: var(--form-max);
    margin: 0 auto;
    width: 100%;
  }

  .admin-list {
    padding: 0 24px 40px;
  }

  .chat-panel {
    padding: 0 0 32px;
  }

  .site-footer {
    padding: 20px 24px 28px;
  }

  .toast {
    bottom: 32px;
  }
}

@media (min-width: 640px) {
  .modal {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .modal__panel {
    border-radius: var(--radius);
    border-bottom: 1px solid var(--border);
    max-width: min(560px, 100%);
    max-height: min(90dvh, 900px);
    margin-bottom: 0;
    animation: modalIn 0.2s ease;
  }

  /* Карточка объявления: шире на ультрашироких и две колонки от ~1200px */
  #modalDetail .modal__panel--detail {
    max-width: min(680px, 92vw);
    max-height: min(94dvh, 960px);
  }
}

@media (min-width: 1100px) {
  #modalDetail .modal__panel--detail {
    max-width: min(860px, 82vw);
  }
}

@media (min-width: 1400px) {
  #modalDetail .modal__panel--detail {
    max-width: min(1040px, 74vw);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
  }

  #modalDetail .modal__panel--detail .modal__close {
    grid-column: 1 / -1;
    justify-self: end;
  }

  #modalDetail .modal__panel--detail .modal__img-wrap {
    grid-column: 1;
    grid-row: 2;
    aspect-ratio: 4 / 3;
    min-height: 280px;
    max-height: none;
  }

  #modalDetail .modal__panel--detail .modal__body {
    grid-column: 2;
    grid-row: 2;
    overflow-y: auto;
    max-height: min(90dvh, 920px);
  }
}

@media (min-width: 2000px) {
  #modalDetail .modal__panel--detail {
    max-width: min(1240px, 68vw);
  }
}

@media (min-width: 2800px) {
  #modalDetail .modal__panel--detail {
    max-width: min(1400px, 62vw);
  }
}

/* === Р”РѕРїРѕР»РЅРµРЅРёСЏ: С‡Р°С‚, Р°РІС‚РѕСЂРёР·Р°С†РёСЏ, Р°РґРјРёРЅ === */
.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0 0 88px;
}

.chat-threads {
  list-style: none;
  margin: 0;
  padding: 0 16px;
  overflow-y: auto;
  flex: 1;
}

.chat-thread-item {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--surface);
}

.chat-thread-item:hover {
  border-color: rgba(var(--accent-rgb), 0.32);
}

.chat-thread-item__title {
  font-weight: 600;
  margin: 0 0 4px;
  font-size: 0.9375rem;
}

.chat-thread-item__preview {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

.chat-thread-item__meta {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 6px;
}

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.4;
}

.msg--mine {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.msg--them {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.msg__who {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.chat-compose {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--border);
  background: rgba(26, 34, 45, 0.95);
}

.chat-compose input {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.subheader {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.subheader__back {
  border: none;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}

.admin-list {
  padding: 0 16px 100px;
  overflow-y: auto;
  flex: 1;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 12px;
}

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.stat-chip__label {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.stat-chip__value {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.plan-item,
.payment-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.admin-card__title {
  font-weight: 600;
  margin: 0 0 6px;
}

.admin-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn--small {
  padding: 8px 12px;
  font-size: 0.8125rem;
  width: auto;
  margin: 0;
}

.auth-form {
  padding: 16px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}

.auth-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.auth-google {
  padding: 16px 16px 20px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.auth-google__sep {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.auth-google__btn {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
}

.auth-google__btn iframe {
  max-width: 100%;
}

/* Модалка входа: адаптив и доступность */
.modal__panel--auth {
  max-width: min(480px, 100%);
}

.auth-modal-body {
  max-width: 100%;
}

.auth-skip {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.auth-skip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-intro {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
}

.auth-calm-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.45;
  cursor: pointer;
}

.auth-calm-toggle input {
  margin-top: 3px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.recaptcha-host {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  min-height: 78px;
}

.auth-links {
  margin: 10px 0 0;
  text-align: center;
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}

.link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-oauth {
  margin-top: 8px;
}

/* Спокойный режим авторизации (СДВГ): крупнее, меньше анимаций */
html.auth-calm .modal__panel--auth {
  font-size: 1.05rem;
}

html.auth-calm .auth-intro,
html.auth-calm .form__intro {
  font-size: 1rem !important;
  line-height: 1.55 !important;
}

html.auth-calm .field__label {
  font-size: 0.95rem;
}

html.auth-calm .field__input,
html.auth-calm .btn {
  min-height: 48px;
  font-size: 1rem;
}

html.auth-calm .modal__panel--auth {
  animation: none;
}

@media (max-width: 639px) {
  .modal__panel--auth .modal__body {
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0));
  }
}

@media (min-width: 640px) {
  .modal__panel--auth {
    max-height: min(92dvh, 880px);
  }
}

  display: inline-block;
  min-width: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

.form__file {
  margin-bottom: 12px;
}

.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--surface2);
  color: var(--muted);
}

.status-pill--pending {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}
.newbuilds {
  padding: 16px;
}

.newbuilds__intro {
  margin-bottom: 16px;
}

.newbuilds__title {
  margin: 0 0 4px;
  font-size: 1.5rem;
}

.newbuilds__lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.newbuilds__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.newbuilds__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.complex-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.complex-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.complex-card__cover {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface2);
}

.complex-card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.complex-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.complex-card__meta,
.complex-card__dev,
.complex-card__counts {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.complex-card__stage {
  margin: 4px 0;
  font-weight: 600;
  color: var(--accent);
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface2);
  overflow: hidden;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4ade80, var(--accent));
  border-radius: 3px;
}

.complex {
  padding-bottom: 60px;
}

.complex__cover {
  height: 220px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface2);
}

.complex__head {
  padding: 14px 16px;
}

.complex__title {
  margin: 0;
  font-size: 1.6rem;
}

.complex__meta {
  margin: 4px 0 0;
  color: var(--muted);
}

.complex__developer {
  margin: 8px 0;
  font-weight: 600;
}

.complex__progress {
  padding: 4px 16px 12px;
}

.complex__progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.complex__tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.complex__tab {
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  border-bottom: 2px solid transparent;
}

.complex__tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.complex__pane {
  padding: 16px;
}

.feed-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.feed-item__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.feed-item__stage {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.feed-item__milestone {
  background: rgba(255, 196, 0, 0.18);
  color: #d99a00;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.feed-item__pp {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
}

.feed-item__text {
  margin: 0 0 8px;
  white-space: pre-line;
}

.feed-item__photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.feed-item__photos img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
}

.unit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.unit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.unit-card__img {
  height: 150px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface2);
}

.unit-card__body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.unit-card__title {
  margin: 0;
  font-weight: 600;
}

.unit-card__meta,
.unit-card__stage {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.unit-card__price {
  margin: 4px 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.roommate {
  padding: 16px 16px 80px;
}

.roommate__intro {
  margin-bottom: 12px;
}

.roommate__title {
  margin: 0;
}

.roommate__lead {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.roommate__myform {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.roommate__swipe {
  display: grid;
  gap: 12px;
}

.roommate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.roommate-card__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.roommate-card__name {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.roommate-card__meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.roommate-card__score {
  margin: 4px 0 0;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.875rem;
}

.roommate-card__bio {
  margin: 0;
  white-space: pre-line;
}

.roommate-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
}

.roommate-card__actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.roommate__matches {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.building {
  padding-bottom: 60px;
}

.trust-pill--ok {
  background: rgba(20, 182, 126, 0.18);
  color: #14b67e;
}

.lang-switch {
  height: 36px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0 8px;
  font: inherit;
  cursor: pointer;
  min-width: 56px;
}

.lang-switch--currency {
  font-weight: 600;
}

.card__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.card__price-alt {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================================
   Design-system additions (Apart.kg) — фаза A
   ============================================================ */

/* Универсальный фокус-ринг для всех интерактивных */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Скелетоны загрузки (Airbnb-style shimmer) */
.skeleton {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface2) 70%, var(--surface) 30%);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 1.4s var(--ease) infinite;
}

body[data-theme="light"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(15, 80, 60, 0.07) 50%,
    transparent 100%
  );
}

@keyframes skeleton-shimmer {
  to {
    transform: translateX(100%);
  }
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.skeleton-card__img {
  aspect-ratio: 4 / 3;
  width: 100%;
}

.skeleton-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-card__line {
  height: 12px;
  border-radius: 6px;
}

.skeleton-card__line--lg {
  height: 18px;
  width: 60%;
}

.skeleton-card__line--md {
  width: 85%;
}

.skeleton-card__line--sm {
  width: 45%;
}

/* Пустые и ошибочные состояния списка */
.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-5);
  color: var(--muted);
}

.state-block__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.6rem;
}

.state-block__title {
  margin: 0;
  font-size: var(--fs-h3);
  color: var(--text);
  font-weight: 700;
}

.state-block__text {
  margin: 0;
  font-size: var(--fs-body);
  max-width: 36ch;
  line-height: 1.55;
}

.state-block__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-2);
}

/* Универсальные размеры заголовков (можно использовать в новых разделах) */
.h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; margin: 0; }
.h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.005em; line-height: 1.25; margin: 0; }
.h3 { font-size: var(--fs-h3); font-weight: 700; line-height: 1.3; margin: 0; }
.caption { font-size: var(--fs-caption); color: var(--muted); }

/* Бейджи (срочно / VIP / TOP / Премиум / агентство) — единый кит */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge--urgent {
  background: rgba(248, 113, 113, 0.16);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.32);
  text-transform: none;
}

.badge--vip {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #3a2a00;
  border-color: rgba(245, 158, 11, 0.5);
}

.badge--top {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.badge--premium {
  background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
  color: #1f0a36;
  border-color: rgba(168, 85, 247, 0.5);
}

.badge--agency {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.34);
  text-transform: none;
}

body[data-theme="light"] .badge--top {
  color: var(--accent-hover);
}

/* Чуть мягче карточки (Airbnb-style) на широких экранах */
@media (min-width: 900px) {
  .card {
    border-radius: var(--radius-lg);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }

  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
  }
}

/* === Home sections (Продажа / Аренда / Новостройки / Агентства) === */

.home-section {
  padding: 0 var(--space-4) var(--space-5);
}

.home-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-3);
}

.home-section__title {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -0.005em;
}

.home-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 240px);
  gap: var(--space-3);
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--space-1) 0 var(--space-3);
  margin: 0;
  list-style: none;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--space-1);
  scrollbar-width: thin;
}

.home-rail::-webkit-scrollbar {
  height: 6px;
}

.home-rail::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 3px;
}

.home-rail__item {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.home-rail__item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--accent-line);
}

.home-rail__img-wrap {
  aspect-ratio: 4 / 3;
  background: var(--surface2);
}

.home-rail__img-wrap--complex,
.home-rail__img-wrap--agency {
  aspect-ratio: 16 / 10;
}

.home-rail__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
}

.home-rail__img--ph {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 2rem;
  background: var(--surface2);
}

.home-rail__body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.home-rail__price {
  margin: 0;
  font-weight: 700;
  font-size: var(--fs-h3);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.home-rail__price small {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8em;
}

.home-rail__title {
  margin: 0;
  font-weight: 600;
  font-size: var(--fs-body);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-rail__meta {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--muted);
  line-height: 1.35;
}

.home-rail__badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
}

.home-rail__img-wrap {
  position: relative;
}

.home-rail__item--skeleton {
  cursor: default;
}

.home-rail__item--skeleton:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

@media (max-width: 700px) {
  .home-section {
    padding: 0 var(--space-3) var(--space-4);
  }
  .home-rail {
    grid-auto-columns: minmax(180px, 70%);
    padding-left: 0;
  }
}
