/* ==========================================================================
   Danang Rent — Mini App. Светлый минималистичный дизайн, акцент — светло-голубой.
   Ориентиры: Циан, Суточно.ру, Booking.com — крупные фото, чистые карточки, чипы фильтров.
   ========================================================================== */

:root {
  --bg: #F5F8FB;            /* фон страницы */
  --surface: #FFFFFF;       /* карточки, панели */
  --surface-2: #EEF3F8;     /* второстепенные плашки */
  --line: #E3EAF2;          /* границы */
  --line-strong: #D3DDE8;
  --text: #0F1B2D;
  --text-2: #42526B;
  --muted: #6B7A90;
  --accent: #3AA5F0;        /* светло-голубой акцент */
  --accent-strong: #2E9BEA; /* кнопки */
  --accent-ink: #1677C9;    /* текст на светлом акценте */
  --accent-soft: #E8F4FE;
  --success: #1E8E4E;
  --success-soft: #E7F7EE;
  --warn: #B26A00;
  --warn-soft: #FFF4E0;
  --danger: #E5484D;
  --danger-soft: #FDECEC;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 4px 16px rgba(15, 27, 45, .06);
  --shadow-up: 0 -2px 16px rgba(15, 27, 45, .06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
  --vh: var(--tg-viewport-stable-height, 100dvh);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior-y: none;
}

body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
body.has-main-btn { padding-bottom: calc(80px + var(--safe-bottom)); }
body.has-tabbar.has-main-btn { padding-bottom: calc(var(--tabbar-h) + 80px + var(--safe-bottom)); }
body.no-scroll { overflow: hidden; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
img, video { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
svg { flex-shrink: 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.text { font-size: 15px; line-height: 1.55; color: var(--text-2); }
.text--pre { white-space: pre-line; }
.gap { height: 12px; }
.cta-spacer { height: 12px; }
[hidden] { display: none !important; }

/* ── Загрузка при старте ─────────────────────────────────────────────── */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader { display: flex; justify-content: center; padding: 72px 0; }

/* ── Страница и шапка ────────────────────────────────────────────────── */
.app { min-height: 100vh; }
.page { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }
.page--center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  min-height: 56px; margin: 0 -16px 8px; padding: 6px 16px;
  background: rgba(245, 248, 251, .92);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar__left:empty { display: none; }
.topbar__title { font-size: 22px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { display: flex; align-items: center; gap: 4px; }
.topbar--brand { position: static; margin-bottom: 0; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background .15s;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn:disabled { opacity: .35; }

.link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-ink); font-weight: 600; font-size: 14px; padding: 6px 2px; white-space: nowrap; }

/* ── Кнопки ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: center;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; transform: none; }
.btn--primary { background: var(--accent-strong); color: #fff; }
.btn--primary:active { background: #238CDA; }
.btn--secondary { background: var(--accent-soft); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost-danger { background: var(--danger-soft); color: var(--danger); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn--block { width: 100%; }

.main-btn-fallback {
  position: fixed; left: 16px; right: 16px; bottom: calc(12px + var(--safe-bottom)); z-index: 900;
  width: auto; max-width: 608px; margin: 0 auto; min-height: 52px; box-shadow: 0 6px 20px rgba(46, 155, 234, .35);
}
body.has-tabbar .main-btn-fallback { bottom: calc(var(--tabbar-h) + 12px + var(--safe-bottom)); }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + var(--safe-bottom)); z-index: 60;
  width: 56px; height: 56px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-strong); color: #fff; box-shadow: 0 8px 24px rgba(46, 155, 234, .4);
}
.fab:active { transform: scale(.96); }
@media (min-width: 672px) { .fab { right: calc(50% - 320px + 16px); } }

/* ── Чипы, сегменты, бейджи ──────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.chip--active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip:disabled { opacity: .4; }
.chip__count { font-size: 12px; color: var(--muted); font-weight: 500; }
.chip--active .chip__count { color: var(--accent-ink); }
.chip--soft { background: var(--surface); }
.chips--small .chip { min-height: 32px; font-size: 13px; padding: 0 12px; }

.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); max-width: 100%; }
.segmented__item {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1 0 auto;
  min-height: 34px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.segmented__item--active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 27, 45, .1); }
.segmented__count { font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(15, 27, 45, .06); border-radius: 999px; padding: 0 6px; }
.segmented__item--active .segmented__count { background: var(--accent-soft); color: var(--accent-ink); }

.scroll-x { overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 0 16px; }
.scroll-x::-webkit-scrollbar { display: none; }

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--neutral { background: var(--surface-2); color: var(--muted); }
.badge--dark { background: #1F2A37; color: #fff; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill--accent { background: var(--accent-soft); color: var(--accent-ink); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.tag--check svg { color: var(--accent); }

/* ── Уведомления и подсказки ─────────────────────────────────────────── */
.notice { display: flex; align-items: flex-start; gap: 8px; padding: 11px 13px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 14px; color: var(--text-2); margin: 10px 0; }
.notice svg { margin-top: 2px; }
.notice .link-btn { margin-left: auto; padding: 0; }
.notice--accent { background: var(--accent-soft); color: var(--accent-ink); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice--ok { background: var(--success-soft); color: var(--success); }

.hint { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.hint svg { margin-top: 2px; }
.hint:empty { display: none; }
.hint--row { justify-content: space-between; }
.counter { font-size: 12px; color: var(--muted); white-space: nowrap; }

.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 2000;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px;
  background: #1F2A37; color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 8px 28px rgba(15, 27, 45, .25);
  transform: translate(-50%, -16px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast--show { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: #C93A3F; }
.toast--success { background: #1C7C47; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 20px; text-align: center; }
.empty__icon { width: 64px; height: 64px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.empty__text { max-width: 320px; color: var(--text-2); font-size: 15px; }

/* ── Нижний лист ─────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 1500; background: rgba(15, 27, 45, .35);
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s;
}
.sheet-backdrop--open { opacity: 1; }
.sheet {
  width: 100%; max-width: 640px; max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-up);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet-backdrop--open .sheet { transform: translateY(0); }
.sheet--tall { height: 86vh; }
.sheet__grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 2px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 16px; }
.sheet__title { font-size: 18px; font-weight: 700; }
.sheet__body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet__actions { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); }
.sheet__actions .btn--block { flex: 1; }
.sheet__actions .btn--ghost { flex: 0 0 auto; }
.sheet-text { text-align: center; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.success-mark { width: 60px; height: 60px; margin: 4px auto 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--success-soft); color: var(--success); }
.link-box { margin-top: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; user-select: all; }

/* ── Списки и варианты выбора ────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; gap: 10px; }
.menu { display: flex; flex-direction: column; gap: 8px; }

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 50px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color .15s, background .15s;
}
.option--active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.option__title { font-weight: 600; }
.option__main { flex: 1; min-width: 0; }
.option__note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.option__count { font-size: 13px; color: var(--muted); font-weight: 600; min-width: 22px; text-align: right; }
.option-list--big .option { min-height: 56px; font-size: 16px; }

.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border-radius: 14px; background: var(--surface); text-align: left; box-shadow: var(--shadow);
}
.list-item > svg:last-child { color: var(--muted); }
.list-item--static { cursor: default; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }

.section { margin: 22px 0 0; }
.section__title { font-size: 17px; font-weight: 700; margin: 0 0 10px; letter-spacing: -.005em; }
.section__footer { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.kv { display: flex; flex-direction: column; margin: 14px 0; }
.kv__row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv__row:last-child { border-bottom: 0; }
.kv__label { color: var(--muted); }
.kv__value { text-align: right; font-weight: 500; word-break: break-word; }

.timeline { position: relative; padding-left: 18px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline__item { position: relative; padding: 0 0 14px; }
.timeline__item::before { content: ""; position: absolute; left: -24px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline__date { font-size: 12px; color: var(--muted); }
.timeline__text { font-size: 14px; color: var(--text-2); }

/* ── Поиск арендатора ────────────────────────────────────────────────── */
.search-head {
  position: sticky; top: 0; z-index: 40; display: flex; flex-direction: column; gap: 10px;
  margin: 0 -16px; padding: 8px 16px 10px; background: rgba(245, 248, 251, .94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.search-head__row { display: flex; }
.search-head__row .segmented { width: 100%; }

.filterbar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; align-items: center; }
.filterbar::-webkit-scrollbar { display: none; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--text); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.filter-btn--on { background: var(--accent-strong); }
.filter-btn__badge { min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; background: #fff; color: var(--accent-ink); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 10px; }
.toolbar__count { font-size: 14px; font-weight: 600; color: var(--text-2); }
.toolbar__right { display: flex; align-items: center; }

.filters { transition: opacity .15s; }
.filters.is-loading { opacity: .55; pointer-events: none; }
.filters__section { padding: 14px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 8px; }
.filters__section:last-child { border-bottom: 0; }
.filters__section h4 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }

/* ── Карточки объектов ───────────────────────────────────────────────── */
.cards { display: grid; gap: 16px; }
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }

.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
article.card { cursor: pointer; transition: transform .1s; }
article.card:active { transform: scale(.99); }
.card--pad { padding: 14px 16px; margin-bottom: 12px; overflow: visible; }
.card__media { position: relative; }
.card__img { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.card__img img, .card__img video { width: 100%; height: 100%; object-fit: cover; }
.card__img--empty, .row-card__img--empty, .map-preview__img--empty { display: flex; align-items: center; justify-content: center; color: var(--line-strong); }
.card__count {
  position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; background: rgba(15, 27, 45, .6); color: #fff; font-size: 12px; font-weight: 600;
}
.card__play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .9); color: var(--text); display: flex; align-items: center; justify-content: center;
}
.card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; }
.card__price { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.card__per { font-size: 14px; font-weight: 500; color: var(--muted); }
.card__approx { font-size: 13px; color: var(--muted); }
.card__title { font-size: 15px; font-weight: 600; margin-top: 4px; }
.card__meta { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card__tags .tag { padding: 4px 9px; font-size: 12px; }
.card--skeleton { pointer-events: none; }

.skel { background: linear-gradient(90deg, #EDF2F7 0%, #F6F9FC 50%, #EDF2F7 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
.skel--img { aspect-ratio: 16 / 10; border-radius: 0; }
.skel--line { height: 14px; margin: 6px 0; }
.skel--line.short { width: 55%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Компактная карточка (кабинет) */
.row-card {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; text-align: left;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer;
}
.row-card--static { cursor: default; margin-bottom: 12px; }
.row-card__img { position: relative; flex: 0 0 84px; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.row-card__img img, .row-card__img video { width: 100%; height: 100%; object-fit: cover; }
.row-card__img .card__play { width: 28px; height: 28px; }
.row-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-card__code { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.row-card__title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-card__meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-card__bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.row-card__price { font-size: 15px; font-weight: 700; }
.row-card__realtor { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.row-card__chevron { color: var(--muted); }

/* ── Карточка объекта ────────────────────────────────────────────────── */
.page--listing, .page--manage { padding: 0 0 24px; }
.listing { padding: 16px; max-width: 640px; margin: 0 auto; }
.listing__price { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.listing__per { font-size: 16px; font-weight: 500; color: var(--muted); }
.listing__approx { font-size: 14px; color: var(--muted); margin-top: 2px; }
.listing__title { font-size: 19px; font-weight: 650; margin-top: 10px; }
.listing__place { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 14px; }
.listing__code { margin-top: 28px; text-align: center; font-size: 12px; color: var(--muted); }

.manage__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.manage__code { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.manage__title { font-size: 18px; font-weight: 700; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 4px; }
.fact { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.fact__icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; }
.fact__label { font-size: 12px; color: var(--muted); }
.fact__value { font-size: 14px; font-weight: 650; }

.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; }
.action-grid--2 { grid-template-columns: 1fr 1fr; margin: 0 0 14px; }
.action-grid:not(.action-grid--2) .btn { flex-direction: column; gap: 4px; min-height: 64px; padding: 8px 6px; font-size: 13px; }
.action-list { display: flex; flex-direction: column; gap: 8px; }

.gallery { position: relative; background: var(--surface-2); aspect-ratio: 4 / 3; max-height: 56vh; width: 100%; overflow: hidden; }
@media (min-width: 672px) { .gallery { max-width: 640px; margin: 12px auto 0; border-radius: var(--radius); } }
.gallery--empty { display: flex; align-items: center; justify-content: center; color: var(--line-strong); }
.gallery__track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; background: #0F1B2D; }
.gallery__slide img, .gallery__slide video { width: 100%; height: 100%; object-fit: cover; }
.gallery__slide video { object-fit: contain; }
.gallery__counter { position: absolute; right: 12px; top: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(15, 27, 45, .6); color: #fff; font-size: 12px; font-weight: 600; }
.gallery__slide img { cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.gallery__track--drag { scroll-snap-type: none; cursor: grabbing; }
.gallery__track--drag img { cursor: grabbing; }
.gallery__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .92); color: var(--text); box-shadow: 0 2px 10px rgba(15, 27, 45, .25);
  opacity: 0; transition: opacity .15s, transform .15s;
}
.gallery__nav--prev { left: 12px; }
.gallery__nav--next { right: 12px; }
.gallery__nav:disabled { opacity: 0 !important; pointer-events: none; }
@media (hover: hover) { .gallery__nav { opacity: .85; } .gallery:hover .gallery__nav { opacity: 1; } }
.gallery__nav:active { transform: translateY(-50%) scale(.94); }
@media (hover: none) { .gallery--inline .gallery__nav { display: none; } }
.gallery__dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.gallery__dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .6); box-shadow: 0 0 2px rgba(0, 0, 0, .3); pointer-events: auto; cursor: pointer; transition: transform .15s, background .15s; }
.gallery__dot--active { background: #fff; transform: scale(1.3); }

/* Полноэкранный просмотр фото */
.viewer { position: fixed; inset: 0; z-index: 2500; background: #0B1420; display: flex; align-items: center; }
.viewer .gallery { position: relative; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; background: transparent; margin: 0; border-radius: 0; }
.viewer .gallery__slide { background: transparent; display: flex; align-items: center; justify-content: center; }
.viewer .gallery__slide img, .viewer .gallery__slide video { object-fit: contain; cursor: default; }
.viewer .gallery__nav { opacity: 1; background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; width: 46px; height: 46px; }
.viewer .gallery__counter { top: calc(16px + env(safe-area-inset-top, 0px)); bottom: auto; left: 16px; right: auto; }
.viewer .gallery__dots { bottom: calc(20px + var(--safe-bottom)); }
.viewer__close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .16); color: #fff; }

/* ── Карта ───────────────────────────────────────────────────────────── */
.map { position: relative; height: 240px; border-radius: var(--radius); overflow: hidden; background: #E9EFF5; z-index: 0; isolation: isolate; }
.map--mini { height: 210px; margin-top: 10px; }
.map--form { height: 260px; margin-top: 10px; }
.map--zones { height: 300px; }
.map--editor { height: 380px; }
.map--search { height: calc(var(--vh) - 190px); min-height: 360px; }
.map--failed { display: flex; align-items: center; justify-content: center; }
.map-fallback { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* MapLibre: элементы управления в стиле приложения */
.maplibregl-map { font: inherit; }
.maplibregl-ctrl-group { border-radius: 12px !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 38px !important; height: 38px !important; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(255, 255, 255, .8); }
.map--loading::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, #E9EFF5 0%, #F3F7FB 50%, #E9EFF5 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite;
}

/* Подписи районов (HTML-метки; пересекающиеся скрываются) */
.zone-label {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: var(--accent-ink); font-size: 12px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 6px rgba(15, 27, 45, .16); transition: opacity .15s; user-select: none;
}
.zone-label b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-soft); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.zone-label--active { background: var(--accent-strong); color: #fff; }
.zone-label--active b { background: rgba(255, 255, 255, .25); color: #fff; }
.zone-label--faded { opacity: .7; font-weight: 600; }
.zone-label--hidden { visibility: hidden; }

/* Ценники объектов */
.price-pin {
  position: relative; padding: 4px 9px; border-radius: 999px; background: var(--surface); color: var(--text);
  font-size: 12px; font-weight: 750; white-space: nowrap; box-shadow: 0 2px 8px rgba(15, 27, 45, .22); cursor: pointer;
  border: 1px solid rgba(15, 27, 45, .06); transition: background .15s, color .15s, transform .15s;
}
.price-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; margin-left: -4px;
  background: inherit; transform: rotate(45deg); border-radius: 0 0 2px 0;
}
.price-pin:hover { transform: scale(1.06); }
.price-pin--active { background: var(--accent-strong); color: #fff; }
.maplibregl-marker:has(.price-pin--active) { z-index: 5; }
.map--far .price-pin { padding: 0; width: 13px; height: 13px; background: var(--accent-strong); border: 2px solid #fff; }
.map--far .price-pin span, .map--far .price-pin::after { display: none; }
.map--far .price-pin--active { width: 17px; height: 17px; background: #1677C9; }

/* Метка улицы (форма объявления) и вершины границы (редактор районов) */
.street-pin { width: 32px; height: 42px; cursor: grab; filter: drop-shadow(0 3px 4px rgba(15, 27, 45, .3)); }
.street-pin svg { display: block; }
.vertex { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent-strong); box-shadow: 0 1px 4px rgba(15, 27, 45, .3); cursor: grab; }
.vertex--first { background: var(--accent-strong); }

/* Статус автопоиска улицы */
.geo-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.geo-status:empty { display: none; }
.geo-status__ok { width: 18px; height: 18px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.spinner--xs { width: 14px; height: 14px; border-width: 2px; flex-shrink: 0; }

.map-preview {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1000; cursor: pointer;
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 8px 28px rgba(15, 27, 45, .2);
}
.map-preview__img { position: relative; flex: 0 0 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.map-preview__img img, .map-preview__img video { width: 100%; height: 100%; object-fit: cover; }
.map-preview__body { flex: 1; min-width: 0; }
.map-preview__price { font-size: 17px; font-weight: 800; }
.map-preview__title { font-size: 14px; font-weight: 600; }
.map-preview__meta { font-size: 13px; color: var(--muted); }
.map-preview__go { color: var(--muted); }

.zone-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.editor-bar__btns { display: flex; gap: 8px; }

/* ── Формы ───────────────────────────────────────────────────────────── */
.page--form { padding-bottom: 32px; }
.form-section { background: var(--surface); border-radius: var(--radius); padding: 14px 14px 12px; margin-bottom: 12px; box-shadow: var(--shadow); border: 1px solid transparent; transition: border-color .15s; }
.form-section__title { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
.form-section > .section__title { font-size: 16px; }
.form-section__error { color: var(--danger); font-size: 13px; margin-top: 6px; }
.form-section__error:empty { display: none; }
.form-section--error { border-color: var(--danger); }
.form-footer { margin: 8px 0 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--muted); }
.field__hint:empty, .field__error:empty { display: none; }
.field__error { font-size: 12px; color: var(--danger); }

.input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(58, 165, 240, .18); }
.input::placeholder { color: #A3B0C2; }
.textarea { padding: 11px 14px; min-height: 96px; line-height: 1.45; resize: vertical; }
.input--num, .input--price { font-variant-numeric: tabular-nums; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .btn { flex-shrink: 0; min-height: 46px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 40px; font-size: 18px; font-weight: 650; }
.input-affix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input[type="date"] { line-height: 46px; }

.geo-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.geo-results:empty { display: none; }
.geo-result { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); text-align: left; font-size: 14px; }
.geo-result svg { color: var(--accent); margin-top: 2px; }

/* Переключатель */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin-top: 12px; font-size: 14px; user-select: none; }
.switch-row .switch { margin-top: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch__track { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--line-strong); transition: background .18s; flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 27, 45, .25); transition: transform .18s; }
.switch input:checked + .switch__track { background: var(--accent-strong); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(58, 165, 240, .3); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }

/* Фото и видео в форме */
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.media-tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; }
.media-tile--loading img, .media-tile--loading video { opacity: .55; }
.media-tile__cover { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 999px; background: var(--accent-strong); color: #fff; font-size: 11px; font-weight: 700; }
.media-tile__video { position: absolute; left: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(15, 27, 45, .6); color: #fff; display: flex; align-items: center; justify-content: center; }
.media-tile__actions { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
.media-tile__progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .6); overflow: hidden; }
.media-tile__progress div { height: 100%; background: var(--accent-strong); transition: width .15s; }
.mini-btn { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .92); color: var(--text); box-shadow: 0 1px 4px rgba(15, 27, 45, .2); }
.media-add {
  aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--accent); background: var(--accent-soft); color: var(--accent-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 600;
}

/* Итог по сделке */
.summary { display: flex; flex-direction: column; gap: 6px; }
.summary__row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.summary__row--strong { font-size: 17px; font-weight: 750; color: var(--accent-ink); }

/* ── Профиль, статистика, отчёт ──────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 6px 0 16px; }
.profile-head__name { font-size: 19px; font-weight: 700; }
.avatar { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 22px; font-weight: 750; flex-shrink: 0; }
.avatar--sm { width: 42px; height: 42px; font-size: 17px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat, .kpi { background: var(--surface); border-radius: 14px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.stat__value, .kpi__value { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.stat__label, .kpi__label { font-size: 11px; color: var(--muted); line-height: 1.25; margin-top: 2px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }

.month-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.month-switch__title { font-size: 16px; font-weight: 700; }

.money { display: flex; flex-direction: column; gap: 4px; }
.money__row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 15px; }
.money__row--accent b { color: var(--accent-ink); font-size: 17px; }

.bars { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.bar__label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.bar__track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s; }

.table { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table__row { display: grid; grid-template-columns: 1.6fr .8fr .8fr 1.3fr; gap: 6px; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--line); align-items: center; }
.table__row:last-child { border-bottom: 0; }
.table__row span:not(:first-child) { text-align: right; }
.table__row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table__row--head { font-size: 12px; font-weight: 600; color: var(--muted); background: #FAFCFE; }

.realtor { display: flex; flex-direction: column; gap: 10px; }
.realtor--off { opacity: .75; }
.realtor__head { display: flex; align-items: center; gap: 10px; }
.realtor__main { flex: 1; min-width: 0; }
.realtor__name { font-size: 16px; font-weight: 650; }
.realtor__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.realtor .notice { margin: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mini-stat { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 10px; background: var(--bg); }
.mini-stat b { font-size: 16px; }
.mini-stat span { font-size: 11px; color: var(--muted); }

/* ── Первый запуск ───────────────────────────────────────────────────── */
.onboarding { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.onboarding__logo { width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.onboarding h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.onboarding .option-list { margin-top: 12px; text-align: left; }

/* ── Нижняя панель вкладок ───────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
  display: flex; justify-content: space-around; height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tabbar__item { flex: 1; max-width: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabbar__item--active { color: var(--accent-strong); }

/* Автоперевод описания */
.translate-note { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.link-btn--sm { font-size: 12px; padding: 0; }

/* ── Избранное: сердечко и вкладка ───────────────────────────────────── */
.like-btn { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-2); transition: transform .15s, color .15s, background .15s; }
.like-btn--on { color: #F0445A; }
.like-btn--pop { animation: like-pop .3s ease; }
@keyframes like-pop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
.like-btn--overlay {
  position: absolute; right: 10px; top: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(15, 27, 45, .18);
}
.like-btn--inline { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); }
.like-btn--inline.like-btn--on { background: #FDECEF; }
.like-btn--small { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); }
@media (hover: hover) { .like-btn:hover { color: #F0445A; } }
.listing__price-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.card__off {
  position: absolute; left: 10px; top: 10px; z-index: 2; padding: 4px 10px; border-radius: 999px;
  background: rgba(15, 27, 45, .72); color: #fff; font-size: 12px; font-weight: 600;
}
.card--off .card__img { filter: grayscale(.7); opacity: .75; }
.card--off .card__price { color: var(--muted); }

.tabbar__icon { position: relative; display: inline-flex; }
.tabbar__badge {
  position: absolute; top: -5px; left: 14px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: #F0445A; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
/* Карта поиска с нижней панелью вкладок: высота меньше на панель */
body.has-tabbar .map--search { height: calc(var(--vh) - 190px - var(--tabbar-h) - var(--safe-bottom)); }

.fav-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.fav-head .segmented { width: 100%; }
.fav-head .segmented__item { flex: 1; justify-content: center; }
.inq-list { display: flex; flex-direction: column; gap: 12px; }
.inq-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.inq-card__main { display: flex; gap: 12px; padding: 12px; width: 100%; text-align: left; }
.inq-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.inq-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inq-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.inq-card__hint { font-size: 12.5px; color: var(--muted); }
.brand__mark--heart { background: #FDECEF; color: #F0445A; }
.link-btn--wrap { white-space: normal; text-align: center; justify-content: center; line-height: 1.35; margin-top: 4px; }
.form-subtitle { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.assign-note { margin-top: 12px; }
.hint--accent { color: var(--accent-ink); font-weight: 600; margin-top: 8px; }

/* «Просмотрено»: карточка в ленте и ценник на карте */
.card__viewed {
  position: absolute; left: 10px; bottom: 10px; z-index: 2; display: none; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px; background: rgba(15, 27, 45, .62); color: #fff; font-size: 12px; font-weight: 600;
}
.card--viewed .card__viewed { display: inline-flex; }
.card--viewed .card__title { color: var(--text-2); }
.price-pin--viewed { background: #E4EAF1; color: #5B6B80; box-shadow: 0 1px 4px rgba(15, 27, 45, .16); }
.price-pin--viewed.price-pin--active { background: var(--accent-strong); color: #fff; }
.map--far .price-pin--viewed { background: #9AAABD; }
.map--far .price-pin--viewed.price-pin--active { background: #1677C9; }

/* Примерный адрес (копируется нажатием) и центр круга на карте */
.address-copy {
  display: flex; align-items: center; gap: 10px; width: 100%; margin: 10px 0 0; padding: 11px 13px; text-align: left;
  border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink);
}
.address-copy:active { transform: scale(.99); }
.address-copy__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.address-copy__label { font-size: 12px; font-weight: 600; opacity: .8; }
.address-copy__text { font-size: 15px; font-weight: 600; color: var(--text); word-break: break-word; }
.address-copy__icon { opacity: .75; }
.center-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent-strong); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 27, 45, .35); }
