/* ============ Аренда · мини-апп — мягкий светлый стиль ============ */
:root {
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --txt: #1B1F24;
  --sub: #7C848F;
  --line: #E7EAEE;
  --accent: #3C7EFF;
  --accent-soft: #EAF1FF;
  --heart: #FF4D6D;
  --green: #23A55A;
  --zalo: #0068FF;
  --r: 16px;
  --shadow: 0 2px 14px rgba(16, 24, 40, .09);
  --tabbar-h: calc(56px + env(safe-area-inset-bottom));
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* атрибут hidden сильнее любых display: iначе .detail{display:flex} перекрывает карту */
[hidden] { display: none !important; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px;
  user-select: none; -webkit-user-select: none;
}
#app { height: 100dvh; position: relative; overflow: hidden; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
input { font: inherit; }

/* ---------- экраны ---------- */
.screen { position: absolute; inset: 0; bottom: var(--tabbar-h); display: none; }
.screen.active { display: block; }
#screen-list, #screen-favs { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px; }

/* ---------- карта ---------- */
#map { position: absolute; inset: 0; z-index: 0; background: #E8ECEF; }
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 500;
  padding: calc(8px + env(safe-area-inset-top)) 0 8px;
  pointer-events: none;
}
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 12px 6px;
  scrollbar-width: none; pointer-events: auto;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  background: var(--card); border-radius: 20px; padding: 8px 13px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap;
}
.chip.on { background: var(--accent); color: #fff; }
.chip .x { font-weight: 400; opacity: .8; margin-left: 2px; }

.float-count {
  position: absolute; z-index: 500; left: 50%; transform: translateX(-50%);
  bottom: 14px; background: var(--txt); color: #fff; font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: 24px; box-shadow: var(--shadow);
}
.map-note {
  position: absolute; z-index: 500; left: 12px; right: 12px; bottom: 62px;
  text-align: center; pointer-events: none;
}
.map-note span {
  background: rgba(27,31,36,.72); color: #fff; font-size: 11.5px;
  padding: 5px 10px; border-radius: 12px; backdrop-filter: blur(4px);
}

/* маркеры-«пилюли» с ценой */
.pin { display: flex; align-items: center; justify-content: center; }
.pin b {
  background: #fff; border: 1.5px solid #D6DBE1; color: var(--txt);
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 14px;
  white-space: nowrap; line-height: 1;   /* без box-shadow: тень на ~2000 пинов дорога при жестах */
}
.pin.viewed b { background: #EDF0F3; color: #8A929C; border-color: #E0E4E9; }
.pin.sel b { background: var(--accent); color: #fff; border-color: var(--accent); }
.cluster {
  background: var(--accent); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; box-shadow: 0 2px 8px rgba(60,126,255,.45);
  border: 2.5px solid #fff;
}

/* карточка-превью на карте */
.preview {
  position: absolute; z-index: 600; left: 10px; right: 10px; bottom: 12px;
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

/* ---------- карточки списка ---------- */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 4px 10px;
}
.list-head h1 { font-size: 19px; }
.list-head .sub { color: var(--sub); font-size: 13px; margin-top: 2px; }
.sort-btn {
  background: var(--card); border-radius: 18px; padding: 8px 13px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
}
.cards { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; }

.card {
  display: flex; gap: 12px; background: var(--card); border-radius: var(--r);
  padding: 10px; box-shadow: var(--shadow); position: relative; cursor: pointer;
}
.card .ph {
  flex: 0 0 116px; height: 116px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg,#E8EDF4,#DDE4EE);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .inf { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-right: 26px; }
.card .pr { font-size: 16.5px; font-weight: 700; }
.card .pr small { font-weight: 500; color: var(--sub); font-size: 12px; }
/* Пересчёт в рубли и доллары — подсказка, а не цена: мельче, приглушённо и всегда
   со знаком «≈». Платить всё равно в родной валюте объявления. */
.card .pr-alt { font-size: 11.5px; font-weight: 500; color: var(--sub); margin-top: 1px; }
.card .tt {
  font-size: 13.5px; color: var(--txt); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .sp { color: var(--sub); font-size: 12.5px; margin-top: 4px; }
.card .meta { margin-top: auto; display: flex; align-items: center; gap: 6px; color: var(--sub); font-size: 12px; padding-top: 6px; }
.card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--sub); }
.card .place { color: var(--accent); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.card .hb {
  position: absolute; top: 8px; right: 8px; font-size: 20px; line-height: 1;
  color: #B6BDC6; padding: 6px;
}
.card .hb.on { color: var(--heart); }
.card .badge-new {
  position: absolute; top: 14px; left: 14px; background: var(--green); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 9px;
}
.card.viewed .pr, .card.viewed .tt { color: #6F7680; }

.empty { text-align: center; padding: 80px 30px; color: var(--sub); }
.empty-ico { font-size: 52px; margin-bottom: 12px; color: #C6CCD4; }
.empty-txt { font-size: 14px; line-height: 1.5; }

/* ---------- нижняя навигация ---------- */
#tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; z-index: 800; padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: #9AA1AB; font-size: 10.5px; font-weight: 600; position: relative;
}
.tab svg { width: 23px; height: 23px; fill: currentColor; }
.tab.active { color: var(--accent); }
.tab b {
  position: absolute; top: 5px; left: calc(50% + 6px); background: var(--heart); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ---------- шторки ---------- */
.scrim { position: absolute; inset: 0; background: rgba(15,19,24,.45); z-index: 900; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 950;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 8px 18px 0;
  max-height: 88dvh; overflow-y: auto; animation: up .22s ease-out;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: #D8DDE3; margin: 4px auto 12px; }
.sheet h2 { font-size: 18px; margin-bottom: 14px; }
.f-sec { margin-bottom: 18px; }
.f-label { font-size: 13px; font-weight: 600; color: var(--sub); margin-bottom: 9px; }
.f-label b { color: var(--txt); font-size: 14px; }

.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--sub); }
.seg button.on { background: var(--card); color: var(--txt); box-shadow: 0 1px 4px rgba(16,24,40,.12); }

.chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.chipset button {
  padding: 8px 14px; border-radius: 18px; background: var(--bg);
  font-size: 13.5px; font-weight: 600; color: var(--txt);
}
.chipset button.on { background: var(--accent); color: #fff; }

input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; margin-bottom: 8px; }
.price-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--sub); }
.price-row input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 15px; width: 40%; background: var(--card); color: var(--txt); outline: none;
}
.price-row input:focus { border-color: var(--accent); }

.sheet-foot {
  display: flex; gap: 10px; position: sticky; bottom: 0; background: var(--card);
  padding: 12px 0 4px; border-top: 1px solid var(--line);
}
.btn { border-radius: 14px; padding: 14px; font-size: 15px; font-weight: 700; }
.btn.primary { background: var(--accent); color: #fff; flex: 1.6; }
.btn.ghost { background: var(--bg); color: var(--txt); flex: 1; }

/* ---------- детали объявления ---------- */
.detail {
  position: absolute; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; flex-direction: column; animation: up .22s ease-out;
}
.d-topbtns {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; justify-content: space-between; z-index: 20;
}
.roundbtn {
  width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.94);
  box-shadow: var(--shadow); font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.roundbtn.heart { font-size: 19px; color: #99A0AA; }
.roundbtn.heart.on { color: var(--heart); }
.d-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: #DDE2E9; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery .gph {
  flex: 0 0 100%; height: 46dvh; scroll-snap-align: center;
  display: flex; align-items: center; justify-content: center; font-size: 44px; color: #B4BCC7;
}
.gallery .gph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcount {
  position: absolute; right: 12px; top: calc(46dvh - 34px);
  background: rgba(15,19,24,.6); color: #fff; font-size: 12px; padding: 4px 9px; border-radius: 11px;
}
/* стрелки листания галереи — видно, что фото можно листать */
.gnav {
  position: absolute; top: calc(23dvh - 19px); width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.92); box-shadow: var(--shadow); color: var(--txt);
  font-size: 24px; line-height: 1; display: flex; align-items: center; justify-content: center;
  padding-bottom: 3px; z-index: 5;
}
.gnav.prev { left: 10px; }
.gnav.next { right: 10px; }
.d-wrap { position: relative; }
.d-info { padding: 16px 16px 8px; }
.d-inforow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mapjump { background: var(--accent-soft); color: var(--accent); font-weight: 700;
  border-radius: 12px; padding: 10px 14px; font-size: 13.5px; flex: 0 0 auto; white-space: nowrap; }
.d-price { font-size: 24px; font-weight: 800; }
.d-price small { font-size: 13px; font-weight: 500; color: var(--sub); }
.d-price + .pr-alt { font-size: 13px; font-weight: 500; color: var(--sub); margin-top: 3px; }
.d-title { font-size: 15px; margin-top: 6px; line-height: 1.4; }
.d-specs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.d-specs span { background: var(--card); border-radius: 12px; padding: 7px 11px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.d-row {
  display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--r);
  padding: 13px 14px; margin: 12px 16px 0; box-shadow: var(--shadow); font-size: 14px;
}
.d-row .ico { font-size: 18px; }
.d-row .lnk { margin-left: auto; color: var(--accent); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.d-sec { margin: 18px 16px 0; }
.d-sec h3 { font-size: 15px; margin-bottom: 8px; }
.d-desc { background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; user-select: text; -webkit-user-select: text; word-break: break-word; }
.d-desc.clip { max-height: 150px; overflow: hidden; position: relative; }
.d-desc.clip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48px;
  background: linear-gradient(transparent, var(--card)); }
.d-more { color: var(--accent); font-weight: 600; font-size: 13.5px; margin-top: 8px; }
.d-contact { display: flex; flex-direction: column; gap: 8px; }
.c-btn {
  display: flex; align-items: center; gap: 11px; background: var(--card); border-radius: var(--r);
  padding: 13px 14px; box-shadow: var(--shadow); font-size: 14.5px; font-weight: 600; text-align: left;
}
.c-btn .ci {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex: 0 0 34px;
}
.c-btn .sub2 { display: block; font-size: 12px; color: var(--sub); font-weight: 500; margin-top: 1px; }
.c-btn .go { margin-left: auto; color: #C0C6CE; }
.d-time { text-align: center; color: var(--sub); font-size: 12.5px; padding: 16px 0 8px; }
.d-actions {
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.d-actions .btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; }
.d-actions .btn.zalo { background: var(--zalo); color: #fff; }
.d-actions .btn.fb { background: var(--accent); color: #fff; }
.d-actions .favbig {
  flex: 0 0 52px; background: var(--bg); border-radius: 14px; font-size: 21px; color: #99A0AA;
  display: flex; align-items: center; justify-content: center;
}
.d-actions .favbig.on { color: var(--heart); }

/* ---------- загрузка ---------- */
.loader {
  position: absolute; inset: 0; z-index: 2000; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: var(--sub); font-size: 14px;
}
.spin { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.loader .btn { padding: 10px 22px; }

/* сердечко-иконка: контур → заливка при активации */
.heart-ic { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linejoin: round; display: block; }
.roundbtn.heart .heart-ic { width: 20px; height: 20px; }
.favbig .heart-ic { width: 24px; height: 24px; }
.hb.on .heart-ic, .roundbtn.heart.on .heart-ic, .favbig.on .heart-ic { fill: currentColor; }

/* toast */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 14px);
  background: rgba(27,31,36,.88); color: #fff; font-size: 13.5px; padding: 10px 16px;
  border-radius: 14px; z-index: 3000; animation: up .2s ease-out; max-width: 86%; text-align: center;
}

/* leaflet мелочи */
.leaflet-control-attribution { font-size: 9px !important; opacity: .75; }
.leaflet-control-zoom { display: none; }

/* Вкладки стран. Их всего две, поэтому это именно вкладки во всю ширину, а не
   выпадашка: человек приезжает искать одну страну и должен видеть, где он. */
.ctabs { display: flex; gap: 4px; margin: 2px 12px 6px; background: var(--card);
  border-radius: 12px; padding: 3px; box-shadow: var(--shadow); pointer-events: auto; }
.ctabs button { flex: 1; padding: 8px 6px; border-radius: 9px; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--sub); }
.ctabs button.on { background: var(--accent); color: #fff; }
#city-chips .chip { font-weight: 600; }

/* Подписка бота — отдельный блок под «Применить». Апка = просмотр, бот = рассылка;
   подписка меняется только этой кнопкой, а не любым тапом по фильтру. */
.btn.ghost { background: var(--bg); color: var(--accent); font-weight: 600; }
.btn.ghost[disabled] { color: var(--sub); }

/* Города в строке подписки — с крестиком: убрать можно, не переключая вкладку
   и не трогая фильтр просмотра. */
.sub-city { background: var(--bg); border-radius: 14px; padding: 4px 9px; margin: 0 5px 5px 0;
  font-size: 12px; font-weight: 600; color: var(--txt); }
.sub-city .x { opacity: .5; margin-left: 2px; }
.sub-city[disabled] { opacity: .5; }

/* Подвал шторки — ровно три равнозначные кнопки в один ряд. Список подписки
   переехал на вкладку «Фильтр»: в подвале он ломал ряд и растягивал кнопки. */
.sheet-foot .btn { padding: 12px 8px; font-size: 13.5px; font-weight: 700; }
.sheet-foot .btn.primary { flex: 1.4; }
#sub-btn { flex: 1; }
#sub-btn[disabled] { color: var(--sub); background: var(--bg); }

/* ---------- вкладка «Фильтр» ---------- */
.filter-body { padding: 0 14px 90px; }
.fs-block { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.fs-h { font-size: 12px; color: var(--sub); font-weight: 600; margin-bottom: 6px; }
.fs-v { font-size: 15px; font-weight: 600; }
.fs-n { font-size: 12.5px; color: var(--sub); margin-top: 4px; }
.fs-cities { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-hint { font-size: 12px; color: var(--sub); line-height: 1.45; margin-top: 10px; }

/* Цену вводим значащими цифрами, нули и валюта нарисованы рядом: «от 10 000 ฿».
   Так не надо объяснять подписью, в каких единицах поле — это видно. */
.price-row { flex-wrap: wrap; }
.p-pre { font-size: 13.5px; color: var(--sub); }
.p-cell { display: inline-flex; align-items: baseline; gap: 4px; background: var(--bg);
  border-radius: 12px; padding: 0 10px 0 0; flex: 1; min-width: 0; }
.p-cell input { flex: 1; min-width: 0; background: transparent; border: 0; }
.p-suf { font-size: 13.5px; font-weight: 600; color: var(--sub); white-space: nowrap; }
