:root {
  color-scheme: dark;
  --bg: #101010;
  --card: #181818;
  --card2: #212121;
  --text: #f3f3f3;
  --muted: #a1a1a1;
  --accent: #377531;
  --accent2: var(--accent);
  --good: var(--accent);
  --mint: var(--accent);
  --radius: 18px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-b, 0px));
  --tabbar-bg: rgba(16, 16, 16, .96);
  --line: rgba(55, 117, 49, .15);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid #377531;
  outline-offset: 2px;
}

/* телефон-первым: без задержки тапа, без случайного выделения текста в UI */
body, button, input, select { touch-action: manipulation; }

/* длинная лента на телефоне: офскрин-карточки не пейнтятся */
.deal { content-visibility: auto; contain-intrinsic-size: auto 176px; }
button, .deal, .tabbar, .tabbar button, .cat-tile, .m-row, .sub-chip,
.bb-item, .hist-row, .mp-item, .tool-btn, .cat-btn {
  -webkit-user-select: none; user-select: none;
}

/* атрибут hidden всегда сильнее любого display:flex/grid в классах */
[hidden] { display: none !important; }

/* без боковой полосы прокрутки (в мини-аппе скролл остаётся, полоска — нет) */
html { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  padding-bottom: calc(76px + var(--safe-b));
}

/* Show only the splash until Telegram initData or the site session is verified. */
.auth-pending body > :not(#bootScreen) { visibility: hidden; }

/* Экран запуска виден до первого ответа ленты и закрывает пустой WebView. */
.boot-screen {
  position: fixed; inset: 0; z-index: 80;
  display: grid; grid-template-rows: 1fr auto;
  min-height: 100dvh;
  padding: calc(20px + max(env(safe-area-inset-top, 0px), var(--fs-safe-t, 0px)))
           24px calc(28px + var(--safe-b));
  background: #377531; color: #131313;
  overflow: hidden;
  transition: opacity .32s ease, visibility .32s ease;
}
.boot-screen.boot-complete { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-center, .boot-bottom { position: relative; z-index: 1; }
.boot-center { display: grid; place-items: center; }
.boot-mark { display: block; width: min(88vw, 430px); height: auto; }
.boot-bottom { width: min(100%, 520px); margin: 0 auto; }
.boot-progress { height: 8px; overflow: hidden; border-radius: 99px;
  background: rgba(24, 24, 24, .19); }
.boot-progress span { display: block; width: 40%; height: 100%; border-radius: inherit;
  background: #131313; animation: bootSweep 1.5s ease-in-out infinite alternate; }
.boot-screen.boot-complete .boot-progress span { width: 100%; animation: none; }
@keyframes bootSweep { from { transform: translateX(0); } to { transform: translateX(150%); } }
.boot-bottom p { margin-top: 16px; font-size: 13px; font-weight: 650; }
.boot-bottom strong { display: block; margin-top: 20px;
  font-size: clamp(28px, 8vw, 43px); line-height: 1.02; letter-spacing: -.055em; }
#bootRetry { margin-top: 18px; padding: 11px 18px; border: 1px solid #131313;
  border-radius: 6px; background: transparent; color: #131313;
  font: inherit; font-weight: 750; cursor: pointer; }
#bootRetry:focus-visible { outline: 2px solid #131313; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .boot-progress span { animation: none; }
  .boot-screen { transition: none; }
}

/* ---------------- hero ---------------- */
.hero {
  background: #141414;
  padding: calc(14px + max(env(safe-area-inset-top, 0px), var(--fs-safe-t, 0px))) 16px 16px;
  border-bottom: 1px solid rgba(55, 117, 49, .15);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-actions { display: flex; gap: 8px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand > div { min-width: 0; }
/* плитка-логотип: тихое тёмное стекло — маскот виден, но не кричит */
.logo {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 42px; height: 42px; font-size: 30px; line-height: 1;
  background: none; border: none;
}
/* чистый знак без плитки: размер обязателен — иначе исходный SVG
   вырывается наружу (min-width:auto у flex-элемента) */
.logo img {
  width: 100%; height: 100%;
  object-fit: contain; border-radius: 8px; display: block;
  filter: drop-shadow(0 2px 8px rgba(8, 8, 8, .55));
}
.brand h1 { font-size: 21px; letter-spacing: .3px; line-height: 1.1; color: #ffffff; }
.brand p .mark { width: 12px; height: 12px; stroke: var(--accent); vertical-align: -1.5px; margin-right: 4px; }
.brand p { font-size: 11.5px; letter-spacing: .25px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.icon-btn {
  background: rgba(255, 255, 255, .08); color: var(--text); border: none;
  width: 40px; height: 40px; border-radius: 13px; font-size: 17px;
  cursor: pointer; transition: transform .15s;
}
.icon-btn:active { transform: scale(.9); }

.hero-stats { display: flex; gap: 10px; margin-top: 4px; flex-wrap: nowrap; }
.freshness-alert {
  margin: 12px 16px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, .45);
  border-radius: 12px;
  background: rgba(245, 158, 11, .1);
  color: #fbbf24;
  font-size: 13px;
  line-height: 1.45;
}
.stat { min-width: 0; }
#stUpdated { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.stat {
  flex: 1; background: #1b1b1b;
  border-radius: 14px; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 66px;
}
.stat b { font-size: 21px; color: #d4d4d4; letter-spacing: .3px; }
/* «N минут назад» — переносится на 2 строки, как остальные плитки */
#stUpdated {
  font-size: 13px; line-height: 1.2; padding: 2px 0 1px;
  white-space: normal; letter-spacing: .1px;
}
.stat:nth-child(1) b { color: #d4d4d4; }
.stat span { font-size: 11px; color: var(--muted); line-height: 1.25; }

/* ---------------- mode switch ---------------- */
.mode-seg {
  display: flex; gap: 6px; margin: 10px 16px 0;
  background: var(--card); border-radius: 14px; padding: 4px;
}
.mode-seg button {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 10px 0; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.mode-seg button.active {
  background: var(--accent);
  color: #101010;
}

/* ---------------- категории: кнопка + лист ---------------- */
.cat-btn {
  display: flex; align-items: center; gap: 6px;
  width: calc(100% - 32px); margin: 10px 16px 0;
  background: var(--card); border: 1px solid var(--card2);
  color: var(--text); border-radius: 13px; padding: 11px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.cat-btn .cat-arrow { margin-left: auto; color: var(--muted); font-size: 13px; }
.cat-btn:active { transform: scale(.99); }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-tile {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  background: var(--card2); border: 1px solid transparent; color: var(--text);
  border-radius: 12px; padding: 8px 10px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-align: left;
}
.cat-tile .cat-emoji {
  flex: none; width: 22px; text-align: center;
  font-size: 15px; line-height: 1;
}
.cat-tile .cat-label { flex: 1; line-height: 1.2; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.cat-tile.active { border-color: var(--accent); background: rgba(55, 117, 49, .12); }
.cat-tile:active { transform: scale(.97); }

/* ---------------- toolbar ---------------- */
/* поиск, сортировка и фильтры — один ряд вместо двух строк хрома */
.toolbar { display: flex; gap: 8px; padding: 10px 16px 0; min-width: 0; }
.toolbar #search { flex: 1; min-width: 0; width: auto; }
.toolbar .tool-btn { flex: none; display: flex; align-items: center; justify-content: center;
  gap: 6px; min-height: 44px; padding: 11px 12px; }
.toolbar .tb-icon { width: 44px; padding-left: 0; padding-right: 0; }
.toolbar .tb-icon span { display: none; }   /* имя остаётся для скринридера */
.toolbar .tool-btn::before { flex: none; font-size: 15px; line-height: 1; }
.toolbar .tool-btn .ic { width:17px; height:17px; }
#search, #modelSearch {
  width: 100%; display: block; background: var(--card); border: 1px solid var(--card2);
  color: var(--text); border-radius: 14px; padding: 11px 14px; font-size: 16px;
  outline: none;
}
#search:focus, #modelSearch:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 117, 49, .18);
}
#search::placeholder, #modelSearch::placeholder { color: var(--muted); }
#modelSearch { margin: 0; }
.segmented {
  display: flex; background: var(--card); border-radius: 13px; overflow: hidden;
}
.segmented button {
  border: none; background: transparent; color: var(--muted);
  padding: 0 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.segmented button.active { background: var(--card2); color: var(--text); }
.tool-btn {
  border: 1px solid var(--card2); background: var(--card); color: var(--text);
  border-radius: 13px; padding: 11px 14px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.tool-btn:active { transform: scale(.96); }

/* меню сортировки */
.sort-list { display: flex; flex-direction: column; gap: 6px; }
.sort-list button {
  display: flex; align-items: center; gap: 12px;
  border: none; background: transparent; color: var(--text);
  text-align: left; padding: 9px 12px; border-radius: 12px; cursor: pointer;
}
.s-ico {
  width: 38px; height: 38px; border-radius: 10px; background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.s-t { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.s-t b { font-size: 14px; font-weight: 600; }
.s-t span { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.s-check { color: #d4d4d4; font-size: 15px; font-weight: 800; opacity: 0; }
.sort-list button.active { background: var(--card2); }
.sort-list button.active .s-check { opacity: 1; }

/* тренд модели */
.mp-trend {
  font-size: 13px; font-weight: 600; margin: 12px 4px 0;
  padding: 10px 12px; border-radius: 12px; background: var(--card);
}

/* история просмотров */
.hist-row {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border-radius: 12px; padding: 9px 12px; margin: 0 16px 6px; cursor: pointer;
}
.hist-row img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; }
.hist-row .t { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row .p { font-size: 13px; font-weight: 800; color: #d4d4d4; white-space: nowrap; }
.hist-title { padding: 14px 16px 6px; font-size: 14px; color: var(--muted); }

/* toast */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(86px + var(--safe-b));
  max-width: 520px; margin-inline: auto;
  z-index: 40; background: var(--card); border: 1px solid var(--accent);
  border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.4;
  box-shadow: 0 8px 30px rgba(8, 8, 8, .35); animation: rise .25s ease both;
}
.toast b { color: #d4d4d4; }

/* онбординг */
.onboard {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 8, 8, .55);
  display: flex; align-items: flex-end;
}
.onboard-card {
  width: 100%; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 20px 20px calc(24px + var(--safe-b));
}
.ob-row { display: flex; gap: 12px; margin-bottom: 14px; }
.ob-row span { font-size: 24px; }
.ob-row b { font-size: 14.5px; }
.ob-row p { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
#obClose { width: 100%; margin-top: 4px; }

/* ---------------- feed ---------------- */
#feed { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }

.deal {
  display: flex; gap: 12px; background: var(--card);
  border-radius: var(--radius); padding: 10px; cursor: pointer;
  position: relative; overflow: hidden; min-height: 128px;
  transition: transform .12s;
  animation: rise .28s ease both;
}
.deal:active { transform: scale(.985); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.deal-img {
  width: 92px; height: 92px; border-radius: 13px; flex-shrink: 0;
  object-fit: cover; background: var(--card2);
}
.deal-img.ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}

.deal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-right: 46px; }
.deal-title {
  font-size: 14px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.deal-prices { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.price { font-size: 18px; font-weight: 800; color: #d4d4d4; }
.market { font-size: 12.5px; color: var(--muted); text-decoration: line-through; }
.save {
  margin-top: 5px;
}
.deal-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.badge {
  background: var(--good); color: #ffffff;
  font-weight: 800; font-size: 12px;
  padding: 3px 8px; border-radius: 8px;
  flex-shrink: 0; align-self: center;
}
.tag {
  display: inline-block; background: var(--card2); color: var(--muted);
  border-radius: 6px; padding: 1px 7px; margin-right: 2px;
}

/* лучшая находка */
.deal.hot {
  background: #1b1b1b;
  border: 1px solid rgba(55, 117, 49, .38);
}
.deal.hot .badge {
  background: var(--accent);
  color: #ffffff;
}
.hot-label {
  display: inline-block; margin-right: 6px; vertical-align: middle;
  background: var(--accent);
  color: #ffffff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 7px;
}
/* красные метки на карточке: дефект, просевший аккумулятор */
.deal-badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 3px 0 2px; align-items: center; }
.deal-badges:empty { display: none; }
/* метки — сплошные чипы в стилистике «+N похожих» */
/* все метки в одном стиле: тихая тёмная плашка, смысл — цветом текста */
.flag-bad, .flag-warn, .flag-good, .flag-info {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(255, 255, 255, .08); color: var(--muted);
}
.flag-bad  { color: #ff6b81; }
.flag-warn { color: #e0662c; }
.flag-good { color: #d4d4d4; }
.flag-info { color: var(--muted); }

/* ---------------- skeleton: геометрия карточки объявления ---------------- */
.skel {
  min-height: 140px; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 12px; padding: 11px;
}
.sk-img {
  width: 98px; height: 98px; border-radius: 9px; background: #292929; flex: none;
}
.sk-lines { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; padding-top: 3px; }
.sk-l { height: 11px; border-radius: 4px; background: #292929; display: block; }
.sk-l.w1 { width: 78%; height: 14px; }
.sk-l.w2 { width: 48%; height: 14px; }
.sk-l.w3 { width: 34%; height: 19px; margin-top: 20px; }
.sk-l.w4 { width: 62%; height: 9px; }
.skel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 25%, rgba(55, 117, 49, .12) 50%, transparent 75%);
  transform: translateX(-100%); animation: skeletonSweep 1.7s ease-in-out infinite;
}
@keyframes skeletonSweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after { animation: none; display: none; } }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------------- empty ---------------- */
.empty { text-align: center; color: var(--muted); padding: 46px 30px; }
.empty-emoji { font-size: 44px; margin-bottom: 10px; }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.btn-main {
  margin-top: 14px; border: none; cursor: pointer;
  background: var(--accent);
  color: #101010; font-weight: 700; font-size: 14px;
  padding: 11px 22px; border-radius: 13px;
}

/* ---------------- footer ---------------- */
.foot {
  padding: 12px 0 calc(12px + var(--safe-b)); text-align: center;
  font-size: 11px; color: var(--muted);
}

/* ---------------- bottom sheet ---------------- */
.backdrop {
  position: fixed; inset: 0; background: rgba(8, 8, 8, .5);
  z-index: 20; opacity: 0; transition: opacity .2s;
}
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(20px + var(--safe-b));
  transform: translateY(105%); transition: transform .25s ease;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.dragging { transition: none; }
body.no-scroll { overflow: hidden; }
.sheet.open { transform: translateY(0); }
.backdrop.above-page { z-index: 40; }
#calcSheet { z-index: 41; }
#catSheet, #sheet {
  height: min(560px, 62dvh); max-height: none;
  display: flex; flex-direction: column; overflow: hidden;
}
#catSheet .sheet-handle, #sheet .sheet-handle { flex: none; }
.sheet-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
#catSheet .sheet-scroll, #sheet .sheet-scroll { flex: 1; }
#catSheet .cat-actions, #catSheet #catSub, #sheetApply { flex: none; }
#calcSheet { max-height: min(620px, 80dvh); }
#calcSheet .deal-calc { max-height: min(420px, 58dvh); overflow-y: auto; }
#calcSheet .calc-done { display: block; width: 100%; margin-top: 16px; }
.calc-plus { float: right; color: #d4d4d4; font-size: 12px; }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--card2); margin: 0 auto 12px;
}
.sheet h3 { font-size: 17px; margin-bottom: 14px; }
.sheet-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--muted); margin: 14px 0 8px;
}
.sheet h3 { margin-bottom: 6px; }
.sheet-row b { color: var(--text); font-size: 15px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.src-toggles { display: flex; gap: 8px; margin: 4px 0 6px; }
.src {
  flex: 1; border: 1px solid var(--card2); background: transparent;
  color: var(--muted); border-radius: 12px; padding: 10px 0;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.src.on {
  background: var(--card2); color: var(--text); border-color: var(--accent);
}
#sheetApply { width: 100%; margin-top: 16px; }

/* ---------------- оплата Flip+: тарифы, способы, баланс ---------------- */
.tar-seg { display: flex; gap: 8px; }
.tar {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; cursor: pointer; text-align: left;
}
.tar b { display: block; font-size: 14px; }
.tar span { font-size: 12px; color: var(--muted); }
.tar span i { font-style: normal; }
.tar.on { border-color: var(--accent); background: rgba(55, 117, 49, .08); }

.pm-list { display: flex; flex-direction: column; gap: 8px; }
.pm-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; text-align: left; transition: .15s;
}
.pm-row:disabled { opacity: .45; cursor: default; }
.pm-row[data-method="card"]:not(:disabled),
.pm-row[data-method="crypto"]:not(:disabled) { border-color: rgba(55, 117, 49, .55); }
.pm-row .pm-ic {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  background: var(--card2); display: flex; align-items: center;
  justify-content: center; color: #d4d4d4;
}
.pm-svg { width: 17px; height: 17px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }
.pm-badge {
  font-style: normal; font-size: 10.5px; font-weight: 700; color: #d4d4d4;
  background: rgba(55, 117, 49, .12); border: 1px solid rgba(55, 117, 49, .3);
  border-radius: 6px; padding: 2px 6px; vertical-align: 1px; margin-left: 4px;
}
.pm-row .pm-t { min-width: 0; }
.pm-row .pm-t b { display: block; font-size: 14px; }
.pm-row .pm-t i { font-style: normal; font-size: 12px; color: var(--muted); }
.pm-dot {
  margin-left: auto; flex: none; width: 19px; height: 19px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .22); position: relative; transition: .15s;
}
.pm-row.on { border-color: var(--accent); }
.pm-row.on .pm-dot {
  border-color: var(--accent); background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--card);
}

.topup-row { display: flex; gap: 8px; }
.topup {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 0; color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.topup:active { transform: scale(.96); }
.topup.on { border-color: var(--accent); background: rgba(55, 117, 49, .08); }

.promo-row { display: flex; gap: 8px; margin-top: 12px; }
.promo-row input {
  flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px; color: var(--text);
  font-size: 13.5px; text-transform: uppercase;
}
.promo-row input::placeholder { text-transform: none; color: var(--muted); }
.promo-row button {
  flex: none; background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 16px; color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}

/* ============ v3: views, tabbar, страницы ============ */

.view { min-height: 100vh; }
.page-head { padding: 18px 16px 6px; }
.page-head h2 { font-size: 22px; }
.page-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.tabbar {
  position: fixed; left: 50%; bottom: calc(8px + var(--safe-b)); z-index: 15;
  transform: translateX(-50%);
  width: min(calc(100% - 36px), 410px); display: flex; gap: 2px; padding: 4px;
  background: #1b1b1b;
  border: 1px solid rgba(218, 218, 218, .22); border-radius: 20px;
  box-shadow: 0 8px 24px rgba(10, 10, 10, .32);
  transition: width .25s ease, padding .25s ease;
}
.tabbar button {
  flex: 1; min-width: 0; min-height: 48px; border: none;
  background: transparent; color: #c9c9c9;
  font-size: 11px; font-weight: 700; display: flex; flex-direction: column; gap: 2px;
  align-items: center; justify-content: center; padding: 5px 2px;
  border-radius: 15px; cursor: pointer;
  transition: background .2s ease, color .2s ease, min-height .25s ease;
}
.tabbar button:hover { background: rgba(255, 255, 255, .07); }
.tabbar button:focus-visible { outline: 2px solid #377531; outline-offset: -3px; }
.tabbar button.active { background: #303030; color: #d4d4d4; }
.tabbar button .tab-label { display: block; max-height: 16px; overflow: hidden;
  white-space: nowrap; line-height: 16px; transition: opacity .2s ease, max-height .25s ease; }
.tabbar button svg { width: 21px; height: 21px; display: block; }
.tabbar.compact { width: min(calc(100% - 100px), 252px); padding: 3px; }
.tabbar.compact button { min-height: 42px; }
.tabbar.compact .tab-label { max-height: 0; opacity: 0; }
/* SVG-иконки хрома: один стиль, краска от текста */
.ic {
  width: 16px; height: 16px; vertical-align: -3px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic.fill { fill: currentColor; }
.ic.ic12 { width: 12px; height: 12px; vertical-align: -2px; }
.ic.ic36 { width: 44px; height: 44px; vertical-align: 0; opacity: .8; }
.mode-seg .ic { vertical-align: -3px; }
.s-ico .ic { width: 18px; height: 18px; vertical-align: -4px; }
.cat-tile .cat-emoji .ic { width: 16px; height: 16px; vertical-align: -3px; }
.cat-emoji .ic { width: 20px; height: 20px; vertical-align: -4px; }
.bb-ico .ic { width: 22px; height: 22px; vertical-align: 0; }
.p-chip .ic { width: 14px; height: 14px; vertical-align: -2px; }
.bb-emoji .ic { width: 26px; height: 26px; }
.views-badge .ic { vertical-align: -2px; }
.drop-badge .ic { vertical-align: -2px; }
.similar-badge .ic { vertical-align: -2px; }
.recent-chip .ic { vertical-align: -2px; }
.btn-ghost .ic { vertical-align: -3px; }
.btn-main .ic { vertical-align: -3px; }
.alert-ico .ic { stroke: var(--accent); }
h3 .ic { vertical-align: -3px; }
h2 .ic { vertical-align: -3px; }
/* каскад появления первых карточек — только на первом экране ленты */
.deal:nth-child(2) { animation-delay: .035s; }
.deal:nth-child(3) { animation-delay: .07s; }
.deal:nth-child(4) { animation-delay: .105s; }
.deal:nth-child(5) { animation-delay: .14s; }
.deal:nth-child(6) { animation-delay: .175s; }

.loader-row { text-align: center; color: var(--muted); padding: 14px; font-size: 13px; }

/* карточка: действия и просмотренность */
.deal-actions {
  position: absolute; right: 6px; top: 6px;
  display: flex; flex-direction: column; gap: 5px;
}
.act {
  width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .10); color: var(--text); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
.act:active { transform: scale(.88); }
.act.fav { color: #ff6b81; }
.deal.seen { opacity: .55; }
.deal-meta { padding-right: 8px; }
.market { cursor: pointer; text-decoration: line-through underline dotted rgba(152, 152, 152, .6); }

/* список моделей */
#favFeed { display: flex; flex-direction: column; gap: 11px; padding: 6px 16px 12px; }
#modelsList { padding-top: 0; }
/* аккордеон категорий в «Моделях» */
.cat-block { margin: 12px 16px 0; animation: rise .25s ease both; }
#view-models .toolbar { padding: 12px 16px 0; }
#view-models .page-head { padding-bottom: 0; }
.cat-head {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--card2); border-radius: 14px;
  padding: 11px 14px; cursor: pointer; color: var(--text);
  line-height: 1;
}
.cat-head.open { border-color: var(--accent); }
.cat-emoji {
  width: 30px; height: 30px; border-radius: 9px; background: var(--card2);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0; line-height: 1;
}
.cat-name { flex: 1; text-align: left; font-size: 14.5px; font-weight: 700; line-height: 1.2; }
.cat-n {
  background: var(--card2); color: var(--muted); font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; min-width: 20px; text-align: center;
  flex-shrink: 0; line-height: 1;
}
.cat-arrow {
  width: 14px; text-align: center; flex-shrink: 0;
  color: var(--muted); font-size: 13px; line-height: 1;
}
.cat-body { margin-top: 6px; }
.cat-body .m-row { margin: 0 0 6px; }
.cat-body .m-row:last-child { margin-bottom: 0; }

.m-row {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border-radius: 14px; padding: 12px 14px; margin: 0 16px 8px; cursor: pointer;
  animation: rise .25s ease both;
}
.m-emoji { font-size: 24px; }
.m-info { flex: 1; min-width: 0; }
.m-name { font-weight: 600; font-size: 14px; text-transform: capitalize; }
.m-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.m-med { text-align: right; }
.m-med b { font-size: 14px; }
.m-med span { display: block; font-size: 11px; color: var(--muted); }

/* уведомления */
.alerts { padding: 8px 16px; }

/* ---------- «Мой BB» ---------- */
.mybb { padding: 8px 16px calc(110px + var(--safe-b)); }
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 16px;
}
.bb-avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent);
}
.bb-emoji {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--card2); display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #d4d4d4;
}
.bb-who { min-width: 0; }
.bb-who b { display: block; font-size: 16px; overflow-wrap: anywhere; }
.bb-who span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* меню-разделы кабинета */
.bb-menu { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.bb-section-title { margin: 22px 2px 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mybb > .sub-card { margin: 16px 0 0; }
.bb-menu .bb-item { min-height: 64px; width: 100%; }
.bb-menu .bb-item .bb-t { min-width: 0; font-size: 14px; }
.bb-menu .bb-item b { margin-left: auto; }
.bb-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; color: var(--text); cursor: pointer; text-align: left;
  transition: transform .12s;
}
.bb-item:active { transform: scale(.98); }
.bb-ico { font-size: 20px; }
.bb-t { flex: 1; font-size: 14.5px; font-weight: 600; }
.bb-item b {
  background: var(--card2); color: #d4d4d4; font-size: 12px;
  padding: 2px 9px; border-radius: 999px;
}
.bb-arr { color: var(--muted); }

.alert-card {
  display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; align-items: flex-start;
}
.alert-ico {
  flex: none; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; line-height: 1;
  background: var(--card2); border-radius: 10px;
}
.alert-card b { font-size: 15px; }
.alert-card p { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 14px; }
.hint.dim { opacity: .7; font-size: 11.5px; }
#openBot { width: 100%; margin-top: 14px; }

/* подписки в мини-аппе */
.subs-box { min-height: 30px; }
.sub-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card2); border-radius: 20px; padding: 7px 8px 7px 12px;
  font-size: 13px; margin: 0 6px 6px 0; animation: rise .25s ease both;
}
.sub-chip button {
  background: rgba(255, 255, 255, .08); border: none; color: var(--muted);
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px;
  cursor: pointer; line-height: 1; position: relative;
}
/* визуально 20px, тап 30px — минимум доступности */
.sub-chip button::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.subs-add-row { display: flex; gap: 8px; margin-top: 4px; align-items: stretch; }
.subs-add-row input {
  flex: 1; min-width: 0; background: var(--card2); border: 1px solid transparent;
  border-radius: 12px; padding: 10px 12px; color: var(--text); font-size: 16px;
  outline: none;
}
.subs-add-row input:focus { border-color: var(--accent); }
.subs-add-row .btn-main {
  width: 44px; flex: 0 0 44px; padding: 0; margin-top: 0;
  font-size: 22px; font-weight: 500; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
#subsDisc { width: 100%; }

/* город */
.city-sel {
  width: 100%; background: var(--card2); color: var(--text);
  border: 1px solid transparent; border-radius: 12px; padding: 10px 12px;
  font-size: 14px; outline: none;
}
/* широкий тумблер скупки/аренды */
#buyoutToggle {
  width: 100%; text-align: left; background: var(--card2); color: var(--muted);
  border: 1px solid transparent; border-radius: 12px; padding: 10px 12px;
  font-size: 13px; cursor: pointer;
}
#buyoutToggle.on {
  background: rgba(55, 117, 49, .14); color: var(--text);
  border-color: var(--accent);
}

/* полноэкранные страницы (детали, модель) */
.page {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); transition: transform .25s ease;
}
.page.open { transform: translateY(0); }
.page-top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg);
}
.page-top h3 { font-size: 17px; text-transform: capitalize; }

.d-photo { width: 100%; aspect-ratio: 4/3; max-height: 44vh; object-fit: cover; }
.d-photo-ph {
  width: 100%; aspect-ratio: 4/3; max-height: 44vh; display: flex; align-items: center;
  justify-content: center; font-size: 64px; background: var(--card);
}
.d-body { padding: 16px; }
.d-title { font-size: 18px; font-weight: 700; line-height: 1.3; }
.d-priceline { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.d-price { font-size: 26px; font-weight: 800; color: #d4d4d4; }
.d-meta { margin-top: 10px; font-size: 13px; color: var(--muted); }
.trust-note { margin-top: 6px; font-size: 11px; line-height: 1.35; color: var(--muted); }
.d-desc { margin-top: 14px; font-size: 13.5px; line-height: 1.5; color: var(--text); opacity: .85; }
.repost-note, .deal-calc { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.repost-note { display: grid; gap: 5px; font-size: 13px; line-height: 1.45; }
.repost-note[hidden] { display: none; }
.repost-note b { color: #d4d4d4; }
.repost-note span, .deal-calc p { color: var(--muted); }
.deal-calc h4 { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 16px; font-size: 16px; }
.deal-calc h4 span { color: #d4d4d4; font-size: 12px; }
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.calc-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.calc-grid label:last-child { grid-column: 1 / -1; }
.calc-grid input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; font-size: 15px; }
.calc-grid input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.deal-calc output { display: block; margin-top: 14px; font-size: 18px; font-weight: 750; }
.deal-calc output.positive { color: #d4d4d4; }
.deal-calc output.negative { color: #d4d4d4; }
.deal-calc p { margin: 7px 0 0; font-size: 11px; line-height: 1.4; }
@media (min-width: 700px) {
  #detail .page-top, #detailBody .d-body, #detail .d-bar { padding-left: max(24px, calc((100vw - 680px) / 2)); padding-right: max(24px, calc((100vw - 680px) / 2)); }
  #detailBody .d-g-wrap, #detailBody > .d-photo, #detailBody > .d-photo-ph { max-width: 680px; margin-left: auto; margin-right: auto; }
  .deal-calc { padding: 22px; }
  .calc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calc-grid label:last-child { grid-column: auto; }
}
.d-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
/* карточка объявления: шапка + скроллящийся контент + закреплённая снизу
   панель с «Открыть объявление» — кнопка видна всегда, листать не нужно */
#detail { display: flex; flex-direction: column; overflow: hidden; }
/* шапка с ✕ — обычный ряд НАД фото, ничего не перекрывает */
#detail .page-top {
  position: relative;
  background: var(--bg);
}
#detailBody {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#detailBody::-webkit-scrollbar { display: none; }
.ai-box {
  margin: 18px 0 0; padding: 14px; border-radius: 14px;
  background: rgba(55, 117, 49, .08); border: 1px solid rgba(55, 117, 49, .35);
  color: var(--text); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap;
}
.d-bar {
  flex: none; padding: 10px 16px calc(12px + var(--safe-b));
  background: var(--bg);
}
.d-bar-btn { display: block; width: 100%; padding: 14px 22px; font-size: 15px;
  text-align: center; box-shadow: 0 10px 26px rgba(8, 8, 8, .4); }
.d-actions .btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-width: 0; min-height: 58px; padding: 9px 10px;
  line-height: 1.2; text-align: center;
}
.d-actions .btn-ghost .ic { flex: none; width: 18px; height: 18px; }
.d-actions .btn-ghost:last-child:nth-child(odd) { grid-column: 1 / -1; }
.btn-ghost {
  border: 1px solid var(--card2); background: transparent; color: var(--text);
  border-radius: 13px; padding: 11px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer;
}

/* экран модели */
.model-body { padding: 4px 16px 30px; }
.mp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mp-stat { background: var(--card); border-radius: 14px; padding: 10px 6px; text-align: center; }
.mp-stat b { font-size: 15.5px; display: block; white-space: nowrap; }
.mp-stat span { font-size: 11px; color: var(--muted); }
.mp-stat.med b { color: #d4d4d4; }
.spark-box { background: var(--card); border-radius: 16px; padding: 12px 14px; margin-top: 10px; }
.spark-box h4 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.spark { width: 100%; height: 56px; }
.spark-empty { font-size: 12px; color: var(--muted); padding: 14px 0; text-align: center; }
.mp-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.mp-item {
  display: flex; gap: 10px; background: var(--card); border-radius: 12px;
  padding: 10px; cursor: pointer; align-items: center;
}
.mp-item img, .mp-item .mph {
  width: 44px; height: 44px; border-radius: 9px; object-fit: cover;
  background: var(--card2); display: flex; align-items: center;
  justify-content: center; font-size: 20px; flex-shrink: 0;
}
.mp-item .t { flex: 1; min-width: 0; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-item .p { font-weight: 800; color: #d4d4d4; font-size: 14px; white-space: nowrap; }

/* дифф-лента: без анимаций при фоновом обновлении */
.no-anim .deal, .no-anim .m-row, .no-anim .cat-block { animation: none !important; }

/* цена мин/макс в фильтрах */
.price-range { display: flex; gap: 8px; align-items: center; }
.price-range input {
  flex: 1; min-width: 0; background: var(--card2); border: 1px solid transparent;
  color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 14px;
  outline: none; text-align: center;
}
.price-range input:focus { border-color: var(--accent); }
.price-range span { color: var(--muted); }
.check-row {
  display: flex; flex-direction: column; gap: 12px; margin: 16px 0 6px;
  padding: 12px 14px; background: var(--card2); border-radius: 12px;
}
.check-row label { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
#sheetApply { margin-top: 16px; }

/* кнопка «наверх»: пилюля, выпадающая сверху по центру */
.top-btn {
  position: fixed; top: -60px; left: 50%; transform: translateX(-50%);
  z-index: 14; border: 1px solid var(--card2); cursor: pointer;
  background: var(--card); color: var(--text);
  border-radius: 999px; padding: 8px 18px; font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(8, 8, 8, .35);
  transition: top .3s cubic-bezier(.34,1.56,.64,1);
  display: flex; align-items: center; gap: 6px;
}
.top-btn.show { top: 10px; }
.top-btn:active { transform: translateX(-50%) scale(.95); }

/* зум фото */
.zoom {
  position: fixed; inset: 0; z-index: 60; background: rgba(8, 8, 8, .92);
  display: flex; align-items: center; justify-content: center;
}
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* pull-to-refresh индикатор */
.ptr {
  position: fixed; top: -40px; left: 50%; transform: translateX(-50%); z-index: 45;
  background: var(--card); border: 1px solid var(--card2); color: var(--muted);
  border-radius: 999px; padding: 7px 16px; font-size: 12.5px;
  transition: top .2s ease;
}
.ptr.show { top: 10px; }

/* переходы между табами */
.view { animation: viewIn .16s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } }

/* галерея фото в детальной странице */
.d-g-wrap { position: relative; }
.d-gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.d-gallery::-webkit-scrollbar { display: none; }
.d-g-img {
  width: 100%; flex-shrink: 0; aspect-ratio: 4/3; max-height: 44vh; object-fit: cover;
  scroll-snap-align: start; cursor: zoom-in; background: var(--card2);
}
.d-g-count {
  position: absolute; right: 22px; bottom: 12px;
  background: rgba(8, 8, 8, .55); color: #ffffff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 10px; pointer-events: none;
}
.d-g-dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 2px; }
.d-g-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--card2); }
.d-g-dots .dot.on { background: var(--accent); }

/* недавние поисковые запросы */
.recent-box { display: flex; gap: 6px; padding: 2px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.recent-box::-webkit-scrollbar { display: none; }
.recent-chip {
  flex-shrink: 0; background: var(--card2); border: none; color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.recent-chip:active { transform: scale(.96); }
.recent-clear { color: #d4d4d4; }

/* кнопки Применить/Сбросить в листе категорий */
.cat-actions { display: flex; gap: 8px; margin-top: 12px; }
.cat-actions .btn-main { flex: 1; margin-top: 0; }
.cat-actions .btn-ghost {
  flex: 0 0 auto; padding: 11px 16px; border: 1px solid var(--card2);
  background: transparent; color: var(--muted); border-radius: 13px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}

/* NEW-бейдж и снижение цены */
.new-badge {
  display:inline-flex; align-items:center; background:var(--accent2); color:#ffffff;
  font-size:10.5px; font-weight:800; padding:2px 7px; border-radius:6px;
}
.old-badge {
  display:inline-flex; align-items:center; gap:3px; border-radius:6px;
  padding:2px 7px; background:rgba(245,158,11,.12); color:#fbbf24;
  font-size:10.5px; font-weight:650;
}
.drop-badge {
  font-size: 11px; font-weight: 700; color: #d4d4d4;
  background: rgba(167,139,250,.12); border-radius: 8px; padding: 2px 8px;
  margin-top: 4px; align-self: flex-start;
}

/* скелетон: сканирование с брендом */
.scan-row {
  text-align: center; color: var(--muted); font-size: 13px; padding: 4px 0 10px;
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse { 50% { opacity: .45; } }

/* баннер суммарной выгоды */
.save-banner {
  margin: 12px 16px 0; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); color: var(--text);
  border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600;
}
.save-banner .ic { color: #d4d4d4; }
/* подпись не должна налезать на сумму: обрезаем с многоточием */
.save-banner-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-banner-total { white-space: nowrap; }
.save-banner b { color: #d4d4d4; font-size: 14px; }

/* счётчик просмотров */
.views-badge {
  background: var(--card2); color: var(--muted); font-size: 11px;
  border-radius: 6px; padding: 1px 6px; font-weight: 600;
}

/* скан-строка в скелетоне */
.scan-row {
  text-align: center; color: var(--muted); font-size: 13px; padding: 4px 0 10px;
  animation: pulse 1.4s ease infinite;
}
@keyframes pulse { 50% { opacity: .45; } }

/* === Мобильные тап-таргеты и тактильность ===
   Визуальный размер кнопок карточек 34px, зона тапа 46px (::before),
   :active — тактильная отдача; hover-правила в проекте отсутствуют. */
.act { position: relative; }
.act::before {
  content: ""; position: absolute; inset: -6px; border-radius: 14px;
}
.act:active { transform: scale(.88); }
.tool-btn:active, .cat-btn:active, .bb-item:active, .btn-main:active,
.btn-ghost:active, .cat-tile:active, .src:active, .m-row:active,
.mp-item:active, .hist-row:active, .tabbar button:active, .recent-chip:active {
  transform: scale(.96); opacity: .85;
}
.tabbar button, .tool-btn, .cat-btn, .bb-item, .act, .recent-chip, .sub-chip button {
  touch-action: manipulation;
}

/* тактильная отдача для оставшихся интерактивных элементов */
.sheet-handle:active, .icon-btn:active { transform: scale(.92); }
.icon-btn { transition: transform .12s; }

/* прокрутка без видимой полосы: шторки фильтров и полноэкранные страницы */
.sheet, .page { scrollbar-width: none; -ms-overflow-style: none; }
.sheet::-webkit-scrollbar, .page::-webkit-scrollbar { display: none; }

/* быстрый тумблер дефектов + бейдж похожих + окно истории */
.tool-btn.on {
  background: var(--accent);
  color: #101010;
}
.similar-badge {
  font-size: 11px; font-weight: 700; color: #d4d4d4;
  background: rgba(55, 117, 49, .14); padding: 2px 7px; border-radius: 6px;
}
.mp-days { display: flex; gap: 6px; margin: 8px 0 10px; }
.mp-day {
  flex: 1; min-height: 36px; border: none; cursor: pointer;
  border-radius: 10px; background: var(--card2); color: var(--muted);
  font-size: 12px; font-weight: 700;
}
.mp-day.on {
  background: var(--accent); color: #101010;
}
.mp-volume { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }

/* похожие предложения: отдельная строка-чип, мета-строку не ломает */
.sim-row { display: flex; margin: 2px 0; }
.similar-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; color: #d4d4d4;
  background: rgba(55, 117, 49, .14); padding: 2px 8px; border-radius: 6px;
}

/* «Мой Морж»: фиксированная колонка иконок — текст не плавает */
.bb-ico {
  flex: none; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1;
  background: var(--card2); border-radius: 9px;
}
.bb-t { line-height: 1.25; }
.alert-ico { flex: none; width: 32px; text-align: center; line-height: 1.2; }

/* сохранённые поиски: пустое состояние и быстрые пресеты */
.subs-empty {
  text-align: center; background: var(--card); border-radius: 16px;
  padding: 22px 16px; margin-bottom: 12px;
}
.subs-empty .se-emoji { font-size: 34px; margin-bottom: 6px; }
/* то же правило, что и в шапке: логотип-картинка живёт в рамке, не наружу */
.subs-empty .se-emoji img {
  width: 44px; height: 44px; object-fit: cover;
  border-radius: 12px; display: block; margin: 0 auto 6px;
}
.subs-empty b { font-size: 15px; }
.subs-empty p { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 5px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.p-chip {
  font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--card2); border: 1px solid transparent;
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.p-chip:active { transform: scale(.96); }
/* гостю настройки синхронизации ни о чём — приглушаем */
.page.guest #subsDisc, .page.guest #subsCity,
.page.guest #subsPrice, .page.guest .sheet-row span {
  opacity: .55;
}

.flag-warn { background: #f5a524; color: #101010; }
.flag-good { background: #377531; color: #ffffff; }
/* раздельные медианы новый/б/у на странице модели */
.mp-cond {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 8px;
}
.mp-cond-item {
  background: var(--card); border-radius: 14px; padding: 8px 6px;
  text-align: center; font-size: 12px; color: var(--muted);
}
.mp-cond-item b { color: var(--text); font-size: 13.5px; margin-left: 4px; }
.mp-cond-item:first-child {
  background: #252525;
}
.mp-cond-item:last-child {
  background: #232323;
}

/* Метки занимают отдельную строку; место и время идут ниже. */
.deal { flex-wrap: wrap; }
.deal > .deal-badges {
  flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 5px;
  align-items: center; margin: 4px 0 0;
}
.deal > .deal-badges > span { white-space: nowrap; }
.deal > .deal-geo {
  flex-basis: 100%; min-width: 0; margin-top: 5px;
  font-size: 12px; line-height: 1.4; color: var(--muted);
  text-align: right; overflow-wrap: anywhere;
}
.views-badge { font-size: 11px; color: var(--muted); }
.deal > .deal-badges .tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; margin: 0;
}
.deal > .deal-badges .flag-good {
  background: #242424; border: 1px solid #377531; color: #d4d4d4;
}
.deal > .deal-badges .flag-warn {
  background: #232323; border: 1px solid #6b6b6b; color: #f5c578;
}
.deal > .deal-badges .flag-bad {
  background: #1b1b1b; border: 1px solid #5a5a5a; color: #cecece;
}

/* детальная страница: равные отступы вокруг строки меток */
#detailBody .deal-badges { margin: 10px 0 12px; }
#detailBody .d-actions { margin-top: 12px; }

/* фидбек */
.fb-textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: var(--card); color: var(--text); border: 1px solid var(--card2);
  border-radius: 13px; padding: 12px; font-size: 14px; font-family: inherit;
  outline: none; margin-top: 8px;
}
.fb-textarea:focus { border-color: var(--accent); }

/* Цены читаются одним стабильным цветом на любом фоне. */
.d-price, .price, .m-med b {
  color: #d4d4d4;
}

/* масштабируемая иллюстрация пустого состояния */
.empty-img { display:block; width:110px; height:110px; margin:0 auto 12px; }

/* Все иконки в одном боксе; профиль показывает фото Telegram либо инициал. */
.tabbar button .tab-icon {
  display: flex; align-items: center; justify-content: center;
  flex: none; height: 25px; width: 25px; line-height: 1;
}
.tabbar button .tab-avatar {
  width: 28px; height: 28px; overflow: hidden; border-radius: 50%;
  border: 1px solid #929292;
  background: #303030; color: #fbfbfb;
  box-shadow: none;
}
.tabbar .tab-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.tabbar .tab-avatar #navInitial { display: grid; place-items: center;
  width: 100%; height: 100%; font-size: 13px; font-weight: 800; }
.tabbar .tab-avatar #navInitial svg { width: 18px; height: 18px; }
.tabbar button.active .tab-avatar { border-color: var(--accent); box-shadow: none; }
.tabbar button .tab-avatar [hidden] { display: none !important; }

/* ---------------- гейт подписки ---------------- */
.gate {
  position: fixed; inset: 0; z-index: 70;
  background: #0f0f0f;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px; text-align: center;
}
.gate-logo {
  display: flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 22px; overflow: hidden;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
  margin-bottom: 4px;
}
.gate-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gate h2 { font-size: 21px; letter-spacing: .2px; }
.gate p { color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 300px; }
.gate .btn-main { margin-top: 6px; text-decoration: none; display: inline-block; padding: 13px 22px; }
.gate-hint { font-size: 11.5px; color: var(--muted); opacity: .75; }
.gate-hint::after {
  content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-left: 7px; vertical-align: middle;
  animation: gatePulse 1.6s ease-in-out infinite;
}
@keyframes gatePulse {
  0%, 100% { opacity: .25; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* уважение к системной настройке Reduce Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
.flag-info { background: var(--card2); color: var(--muted); }

/* ---------------- жесты ---------------- */
/* свайп карточки: подложка-подсказка направления, 1:1 за пальцем */
.deal { position: relative; }
.deal.swiping { transition: none !important; }
.deal::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  opacity: var(--sw-o, 0); pointer-events: none; transition: opacity .08s;
}
.deal.sw-r::before { background: rgba(55, 117, 49, .22); }
.deal.sw-l::before { background: rgba(229,72,77,.22); }

/* строки листа быстрых действий */
.act-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 10px; }
.act-row {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  background: var(--card); border: 1px solid var(--card2); border-radius: 12px;
  color: var(--text); font-size: 14.5px; text-align: left; cursor: pointer;
}
.act-row:active { transform: scale(.98); }


/* полноэкранный режим Telegram: просторнее шапка, крупнее заголовок */
body.fs .tabbar { background: rgba(27, 27, 27, .98); backdrop-filter: none; }
body.fs .hero { padding-top: calc(16px + max(var(--fs-safe-t, 0px), 112px)); padding-bottom: 18px; }
body.fs .brand h1 { font-size: 20px; }
body.fs .brand p { max-width: 210px; }

/* Фуллскрин: безопасная область принадлежит шапке. Она прилипает к верху
   страницы и не пересекает содержимое посередине при прокрутке. */
body.fs .view:not(#view-feed) { padding-top: calc(12px + max(var(--fs-safe-t, 0px), 108px)); }
body.fs .page { padding-top: 0; }
body.fs .page-top {
  top: 0;
  padding-top: calc(12px + max(var(--fs-safe-t, 0px), 108px));
  background: var(--bg);
}
/* Фото в деталях НЕ заходит под статус-бар: отступ = безопасная зона
   Telegram (чёлка + шапка). В fullscreen — запас 48px на случай, если
   Telegram не отдал свои инсерты. Кнопка закрытия sticky на том же отступе. */
/* В fullscreen шапка деталей держит статус-бар И плавающую шапку Telegram:
   запас 108px — как у остальных экранов (48px не хватало, «Назад» налезал). */
body.fs #detail .page-top { padding-top: calc(12px + max(var(--fs-safe-t, 0px), 108px)); }


/* подписка в кабинете */
.sub-card { margin: 4px 0 14px; padding: 14px; border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line); }
.sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sub-ic { width: 40px; height: 40px; border-radius: 12px; background: #242424;
  display: flex; align-items: center; justify-content: center; color: #d4d4d4; flex: none; }
.sub-head b { display: block; font-size: 15.5px; }
.sub-head span { font-size: 12.5px; color: var(--muted); }
.sub-actions { display: flex; align-items: center; gap: 12px; }
.sub-actions .btn-main { padding: 9px 18px; font-size: 14px; border: none; cursor: pointer;
  background: var(--accent); color: #ffffff; border-radius: 11px; font-weight: 700; }
.sub-link { color: var(--muted); font-size: 13.5px; }

/* AI-бокс: перенос длинных слов, ограничение высоты */
.ai-box { overflow-wrap: anywhere; word-break: break-word; }
.toast { overflow-wrap: anywhere; }

/* Flip+ тарифы в кабинете */
.flip-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.flip-plan { background: var(--card2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 10px; text-align: left; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 4px; transition: .15s; }
.flip-plan:active { transform: scale(.97); }
.flip-plan:hover { border-color: rgba(55, 117, 49, .5); }
.flip-plan b { font-size: 14.5px; }
.flip-plan span { font-size: 13px; color: #d4d4d4; font-weight: 700; }
.flip-plan i { font-style: normal; color: var(--muted); font-weight: 400; font-size: 12px; }
.flip-plan em { font-style: normal; color: #d4d4d4; font-size: 11px; font-weight: 700; }

/* В карточке оставляем одну спокойную строку сравнения цен. */
.save { align-self: flex-start; max-width: 100%; color: var(--muted);
  font-size: 11.5px; line-height: 1.35; }
.save strong { color: #d4d4d4; font-weight: 700; white-space: nowrap; }

/* --- подписка на поисковый запрос (полоса над лентой) --- */
.sub-strip { display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin:10px 16px 0; padding:10px 12px; background:var(--card);
  border:1px solid var(--line); border-radius:13px; font-size:13px; color:var(--muted); }
.sub-strip > span { min-width: 0; overflow-wrap: anywhere; }
.sub-strip b { color:var(--text); font-weight:600; }
.sub-strip .btn-ghost { padding:8px 12px; font-size:13px; border-radius:10px; white-space:nowrap; }

/* --- история цены на карточке лота --- */
.d-drop { margin-top:10px; padding:10px 12px; background:var(--card, #0e0e0e);
  border:1px solid var(--line, #1c1c1c); border-radius:12px; font-size:13px; color:var(--muted); }
.d-drop b { color:#d4d4d4; }
.d-drop s { opacity:.7; }
.d-drop .lot-spark { display:block; width:100%; height:44px; margin-top:6px; }

/* --- блок доверия: цена лота среди цен модели --- */
.trust-bar { margin-top:12px; }
.tb-track { position:relative; height:6px; border-radius:3px;
  background:#303030; }
.tb-track i { position:absolute; top:50%; width:14px; height:14px; margin:-7px 0 0 -7px;
  border-radius:50%; background:var(--accent); box-shadow:0 0 0 3px rgba(55, 117, 49, .22); }
.tb-cap { margin-top:7px; font-size:12.5px; color:var(--muted); }

/* DeltaFlip interface system: readable Cyrillic type and calmer surfaces. */
@font-face {
  font-family: "Golos Text";
  src: url("/fonts/GolosText-VF.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}
:root {
  --bg: #0e0e0e;
  --card: #181818;
  --card2: #232323;
  --text: #f5f5f5;
  --muted: #b7b7b7;
  --accent: #377531;
  --accent2: var(--accent);
  --good: var(--accent);
  --mint: var(--accent);
  --line: rgba(55, 117, 49, .16);
  --tabbar-bg: rgba(14, 14, 14, .97);
}
body, button, input, select, textarea { font-family: "Golos Text", sans-serif; }
body { background: var(--bg); line-height: 1.45; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
.hero {
  background: radial-gradient(ellipse at 95% -25%, rgba(55, 117, 49, .18), transparent 60%), #181818;
  padding-bottom: 18px;
}
.hero-stats { gap: 0; margin-top: 4px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.stat { min-height: 72px; border-radius: 0; background: rgba(11, 11, 11, .24); padding: 10px 9px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { font-size: 22px; line-height: 1.1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 10px; line-height: 1.25; }
.freshness-alert { border-radius: 10px; }
.mode-seg { margin-top: 14px; border: 1px solid var(--line); background: #161616; }
.mode-seg button { min-height: 44px; transition: background .22s ease, color .22s ease, transform .22s ease; }
.mode-seg button:active, .cat-btn:active, .tool-btn:active { transform: scale(.98); }
.cat-btn, #search, #modelSearch, .tool-btn {
  border: 1px solid var(--line);
  background: #181818;
  border-radius: 11px;
  transition: background .22s ease, border-color .22s ease, transform .22s ease;
}
.cat-btn:hover, .tool-btn:hover { background: #232323; border-color: rgba(55, 117, 49, .45); }
#search::placeholder, #modelSearch::placeholder { color: #aaaaaa; }
#feed { gap: 11px; padding-top: 15px; }
.deal {
  min-height: 140px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #181818;
  transition: background .22s ease, border-color .22s ease, transform .22s ease;
}
.deal:hover { background: #1e1e1e; border-color: rgba(55, 117, 49, .4); }
.deal.hot { background: #232323; border-color: rgba(55, 117, 49, .42); }
.deal-img { width: 98px; height: 98px; border-radius: 9px; }
.deal-title { font-size: 14px; line-height: 1.35; letter-spacing: -.01em; text-wrap: pretty; }
.price { color: #d4d4d4; font-size: 19px; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.badge, .hot-label { border-radius: 4px; }
.deal-actions { right: 7px; top: 7px; }
.act { width: 38px; height: 38px; border-radius: 9px; background: rgba(9, 9, 9, .32); }
.act:hover { background: rgba(55, 117, 49, .16); }
.page-head { padding-top: 28px; padding-bottom: 12px; }
.page-head h2 { font-size: 25px; line-height: 1.1; letter-spacing: -.045em; }
.page-head p { margin-top: 8px; font-size: 13px; line-height: 1.45; }
.tabbar { background: var(--tabbar-bg); border-color: var(--line); box-shadow: 0 12px 30px rgba(8, 8, 8, .38); }
.tabbar button { color: #c9c9c9; }
.tabbar button.active { background: #303030; color: #f4f4f4; }
.sheet, .onboard-card { background: #181818; }
.sheet h3 { font-size: 20px; letter-spacing: -.035em; }
.empty { margin: 14px 16px; padding: 42px 24px; border: 1px dashed rgba(55, 117, 49, .3); border-radius: 14px; background: #161616; }
.empty h2 { font-size: 22px; letter-spacing: -.04em; }
.empty p { max-width: 35ch; margin-inline: auto; line-height: 1.6; }
.profile-card, .bb-item, .cat-head, .m-row, .sub-card { border-color: var(--line); background: #181818; }
.bb-avatar, .bb-emoji { border-radius: 14px; }
.bb-item, .cat-head, .m-row { transition: background .22s ease, border-color .22s ease, transform .22s ease; }
.bb-item:hover, .cat-head:hover, .m-row:hover { background: #232323; }
.btn-main, .btn-ghost { transition: background .22s ease, color .22s ease, transform .22s ease, border-color .22s ease; }
.btn-main:hover { background: #377531; }
.btn-ghost:hover { border-color: var(--accent); }
@media (min-width: 700px) {
  .view { max-width: 790px; margin-inline: auto; }
  .hero { border-inline: 1px solid var(--line); }
  .tabbar { width: min(calc(100% - 36px), 560px); }
}
@media (max-width: 380px) {
  .stat { padding-inline: 7px; }
  .stat b { font-size: 18px; }
  .deal-img { width: 86px; height: 86px; }
  .deal-body { padding-right: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .deal, .bb-item, .cat-head, .m-row, .mode-seg button { animation: none; transition: none; }
}

/* Category chooser: compact, even targets and a quieter follow action. */
#catSheet {
  height: min(620px, 78dvh);
  padding: 12px 18px calc(18px + var(--safe-b));
  background: #181818;
}
#catSheet h3 { margin: 2px 2px 14px; font-size: 21px; line-height: 1.2; }
#catSheet .sheet-scroll {
  padding: 2px 2px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#catSheet .sheet-scroll::-webkit-scrollbar { display: none; }
#catSheet .cat-grid { gap: 9px; }
#catSheet .cat-tile {
  min-width: 0;
  min-height: 58px;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid rgba(55, 117, 49, .12);
  border-radius: 13px;
  background: #232323;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.2;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
#catSheet .cat-tile:hover { background: #2d2d2d; border-color: rgba(55, 117, 49, .4); }
#catSheet .cat-tile.active { background: #303030; border-color: var(--accent); color: #fafafa; }
#catSheet .cat-tile .cat-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 29px;
  height: 29px;
  border-radius: 8px;
  background: #242424;
  color: #d4d4d4;
}
#catSheet .cat-tile.active .cat-emoji { background: var(--accent); color: #131313; }
#catSheet .cat-tile .cat-emoji .ic { width: 17px; height: 17px; vertical-align: 0; }
#catSheet .cat-tile .cat-label { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
#catSheet .cat-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); gap: 9px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
#catSheet .cat-actions button { min-height: 48px; width: 100%; margin: 0; border-radius: 11px; font-size: 14px; font-weight: 700; }
#catSheet #catReset { border: 1px solid var(--line); background: transparent; color: #d4d4d4; }
#catSheet #catReset:hover { background: #232323; border-color: rgba(55, 117, 49, .4); }
#catSheet #catApply { background: var(--accent); color: #131313; }
#catSheet #catApply:hover { background: #377531; }
#catSheet #catSub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  width: 100%;
  margin-top: 9px;
  padding: 9px 12px;
  border: 1px solid rgba(55, 117, 49, .45);
  border-radius: 11px;
  background: rgba(55, 117, 49, .08);
  color: #d4d4d4;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
#catSheet #catSub:hover { background: rgba(55, 117, 49, .16); border-color: var(--accent); }
#catSheet #catSub .ic { flex: none; width: 17px; height: 17px; }
#catSheet #catSub span { min-width: 0; overflow-wrap: anywhere; }

/* Listing actions: utility buttons recede behind the primary source link. */
#detailBody .d-actions { gap: 8px; margin-top: 14px; }
#detailBody .d-actions .btn-ghost {
  min-height: 48px;
  padding: 10px 12px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #181818;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.2;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
#detailBody .d-actions .btn-ghost:hover { background: #232323; border-color: rgba(55, 117, 49, .45); }
#detailBody .d-actions .btn-ghost .ic { width: 17px; height: 17px; }
#detail .d-bar { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
#detail .d-bar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  border-radius: 11px;
  box-shadow: none;
}
#detail #dAi { min-height: 44px; padding: 9px 16px; border-color: var(--line); background: #181818; color: #d4d4d4; font-size: 13.5px; }
#detail #dAi:hover { background: #232323; border-color: var(--accent); }
#detail #dOpen { min-height: 54px; padding: 12px 18px; background: var(--accent); color: #131313; font-size: 15px; font-weight: 750; }
#detail #dOpen:hover { background: #377531; }
#detail .d-bar-btn .ic { flex: none; width: 17px; height: 17px; }
@media (max-width: 360px) {
  #catSheet { padding-inline: 14px; }
  #catSheet .cat-tile { gap: 6px; padding-inline: 8px; font-size: 12.5px; }
  #catSheet .cat-tile .cat-emoji { width: 26px; height: 26px; }
  #detailBody .d-actions .btn-ghost { padding-inline: 7px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  #catSheet .cat-tile, #catSheet #catSub, #detailBody .d-actions .btn-ghost { transition: none; }
}

/* Black surfaces with the single reference green for actions. */
:root {
  --bg: #080808;
  --card: #171717;
  --card2: #242424;
  --text: #f5f5f5;
  --muted: #adadad;
  --accent: #377531;
  --accent2: #377531;
  --good: #377531;
  --mint: #377531;
  --line: rgba(255, 255, 255, .12);
  --tabbar-bg: rgba(12, 12, 12, .97);
}
.boot-screen { background: #080808; color: var(--text); }
.boot-progress { background: #292929; }
.boot-progress span { background: var(--accent); }
#bootRetry { border-color: var(--text); color: var(--text); }
#bootRetry:focus-visible { outline-color: var(--accent); }
.hero { background: #111; border-bottom-color: var(--line); }
.stat { background: #181818; }
.stat b, .price, .d-drop b { color: #d4d4d4; }
.deal.hot { background: #202020; border-color: rgba(55, 117, 49, .55); }
.deal:hover { background: #1e1e1e; }
.mode-seg button.active, .btn-main, #catSheet #catApply,
#detail #dOpen, .boot-screen .btn-main { background: var(--accent); color: #fff; }
.mode-seg button.active:hover, .btn-main:hover,
#catSheet #catApply:hover, #detail #dOpen:hover { background: #43883b; color: #fff; }
.tabbar button.active { background: #242424; color: #d4d4d4; }
.sheet, .onboard-card, #catSheet { background: #151515; }
.empty { background: #141414; border-color: var(--line); }
#catSheet .cat-tile.active { background: #242424; color: #fff; }
#catSheet .cat-tile.active .cat-emoji { background: var(--accent); color: #fff; }

/* Desktop keeps the mobile workflow readable without stretching overlays. */
@media (min-width: 900px) {
  .view { max-width: 720px; }
  .tabbar { width: min(calc(100% - 48px), 520px); }
  .sheet { width: min(calc(100% - 48px), 620px); margin-inline: auto; }
  .page {
    width: min(calc(100% - 48px), 760px);
    margin-inline: auto;
    border-inline: 1px solid var(--line);
    box-shadow: 0 0 80px rgba(0, 0, 0, .42);
  }
  #detail .page-top, #detailBody .d-body, #detail .d-bar { padding-inline: 28px; }
  #detailBody .d-g-wrap, #detailBody > .d-photo, #detailBody > .d-photo-ph { max-width: 100%; }
  .onboard { justify-content: center; }
  .onboard-card { width: min(100%, 620px); }
}

/* Compact sheets keep every control visible in the Telegram viewport. */
#calcSheet {
  max-height: calc(100dvh - 12px);
  padding: 8px 14px calc(12px + var(--safe-b));
}
#calcSheet .sheet-handle { margin-bottom: 8px; }
#calcSheet h3 { margin-bottom: 8px; }
#calcSheet .deal-calc {
  margin: 0; padding: 12px; max-height: none; overflow: visible;
}
#calcSheet .calc-grid { gap: 9px 12px; }
#calcSheet .calc-grid label { gap: 4px; line-height: 1.2; }
#calcSheet .calc-grid input { height: 44px; padding: 8px 11px; }
#calcSheet .deal-calc output { margin-top: 10px; font-size: 15px; line-height: 1.28; }
#calcSheet .deal-calc p { margin-top: 4px; line-height: 1.3; }
#calcSheet .calc-done { margin-top: 10px; min-height: 46px; }
@media (min-width: 700px) {
  #calcSheet .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #calcSheet .calc-grid label:last-child { grid-column: 1 / -1; }
}

#proSheet {
  max-height: calc(100dvh - 8px);
  padding: 8px 16px calc(12px + var(--safe-b));
}
#proSheet .sheet-handle { margin-bottom: 8px; }
#proSheet h3 { margin-bottom: 2px; }
#proStatus { margin: 0 0 9px; font-size: 12px; line-height: 1.3; }
#proSheet .tar { padding: 9px 11px; }
#proSheet .pro-method-label { margin: 10px 0 6px; font-size: 12px; }
#proSheet .pm-list { gap: 6px; }
#proSheet .pm-row { min-height: 58px; padding: 8px 11px; gap: 10px; }
#proSheet .pm-row .pm-ic { width: 32px; height: 32px; }
#proSheet .pm-row .pm-t i { font-size: 11.5px; }
#proPay { width: 100%; min-height: 46px; margin-top: 10px; }
#proSheet .promo-row { margin-top: 9px; }
#proSheet .promo-row input { min-height: 42px; padding-block: 8px; }
#proSheet .pro-terms { margin-top: 8px; font-size: 11px; line-height: 1.3; }

/* Empty favorites is a viewport state, while a populated feed still scrolls. */
html.favorites-empty { height: 100dvh; overflow: hidden; }
body.favorites-empty { height: 100dvh; overflow: hidden; padding-bottom: 0; }
body.favorites-empty #view-favorites {
  height: 100dvh; min-height: 0; display: flex; flex-direction: column;
}
body.favorites-empty #favFeed { display: none; }
body.favorites-empty #favEmpty {
  min-height: 0; flex: none; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  height: min(440px, calc(100dvh - 190px));
  margin: clamp(12px, 4dvh, 32px) 16px 0;
  padding: 16px 20px;
}
body.fs.favorites-empty #favEmpty { height: min(440px, calc(100dvh - 310px)); }
body.favorites-empty #favEmpty .empty-img { width: 92px; height: 92px; margin-bottom: 8px; }
body.favorites-empty #favEmpty h2 { font-size: 20px; }
body.favorites-empty #favEmpty p { line-height: 1.45; }
@media (max-height: 640px) {
  body.favorites-empty #favEmpty { margin-top: 10px; padding: 8px 14px; }
  body.favorites-empty #favEmpty .empty-img { width: 66px; height: 66px; }
  body.favorites-empty #favEmpty p { font-size: 12px; line-height: 1.3; }
}

.bb-avatar { border: 0; }
.ai-box {
  background: #171717; border: 1px solid var(--line);
  border-left: 2px solid var(--accent); color: var(--text);
}
.ai-box > .ic { color: var(--accent); }

/* Saved searches use one quiet set of line icons and flat controls. */
#subsPage .model-body { max-width: 640px; margin-inline: auto; padding: 4px 18px 42px; }
#subsPage .page-top { border-bottom: 1px solid var(--line); }
#subsPage .page-top h3 { text-transform: none; font-size: 18px; }
.subs-empty .se-emoji { width: 40px; height: 40px; margin: 0 auto 10px;
  display: grid; place-items: center; background: #242424; border-radius: 10px; }
.subs-empty .se-emoji .ic { width: 21px; height: 21px; color: #d4d4d4; }
.subs-intro { margin: 8px 0 20px; color: var(--muted); font-size: 12.5px; }
.subs-label {
  margin: 0 0 9px; color: var(--text); font-size: 13px;
  font-weight: 700; letter-spacing: -.01em;
}
.subs-label-small { color: var(--muted); margin: 15px 0 0; font-size: 11.5px; font-weight: 600; }
.subs-label-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
#subsPage .subs-box { min-height: 0; }
#subsPage .sub-chip {
  background: #1a1a1a; border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 8px 7px 11px;
  margin: 0 6px 7px 0; animation: none;
}
#subsPage .sub-chip button { background: #2a2a2a; }
#subsPage .subs-add-row { margin-top: 2px; }
#subsPage .subs-add-row input { background: #1a1a1a; border-color: var(--line); }
#subsPage .subs-add-row .btn-main { border-radius: 10px; }
#subsPage .subs-add-row .btn-main .ic { width: 20px; height: 20px; }
#subsPage .preset-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 8px 0 0; }
#subsPage .p-chip {
  min-width: 0; min-height: 40px; padding: 8px 9px;
  display: flex; align-items: center; justify-content: flex-start; gap: 6px;
  background: #171717; border: 1px solid var(--line); border-radius: 9px;
  color: #dedede; font-size: 11.5px; font-weight: 600; text-align: left;
}
#subsPage .p-chip:hover { border-color: var(--accent); background: #202020; }
#subsPage .p-chip .ic { flex: none; width: 16px; height: 16px; color: #aaa; vertical-align: 0; }
#subsPage .sheet-row { margin-top: 14px; }
#subsPage .city-sel, #subsPrice { background: #1a1a1a !important; border: 1px solid var(--line) !important; }
@media (max-width: 360px) {
  #subsPage .preset-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
