/* =====================================================================
   Perederzhka — тема «Аврора» (Apple-dark в духе портфолио)
   Чисто чёрный фон, синий акцент #0071E3, аврора-свечение, блик за
   курсором и свечение карточек. Тема всегда тёмная — так задумано.
   ===================================================================== */

:root {
  /* Акцент — системный синий Apple */
  --brand-primary: #0071E3;
  --brand-primary-2: #4D9FFF;
  --brand-primary-light: rgba(0,113,227,0.20);
  --brand-teal: #30D158;
  --brand-teal-light: rgba(48,209,88,0.14);
  --brand-amber: #FFD60A;
  --brand-amber-light: rgba(255,214,10,0.14);
  --brand-cream: #141416;
  --brand-cream-2: #1D1D1F;

  --text-900: #F5F5F7;
  --text-700: #E5E5EA;
  --text-500: #AEAEB2;
  --text-400: #86868B;

  --surface: #141416;
  --surface-2: #000000;
  --surface-3: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.10);
  --border-light: rgba(255,255,255,0.06);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-card-hover: 0 16px 40px rgba(0,0,0,0.6);
  --shadow-float: 0 10px 28px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-nav: 0 -1px 0 rgba(255,255,255,0.08);

  --radius-xl: 20px;
  --radius-l: 16px;
  --radius-m: 12px;
  --radius-s: 10px;
  --radius-pill: 999px;

  /* Telegram fallback — держим свою палитру для целостности */
  --tg-theme-bg-color: var(--surface-2) !important;
  --tg-theme-text-color: var(--text-900) !important;
  --tg-theme-hint-color: var(--text-400) !important;
  --tg-theme-link-color: var(--brand-primary) !important;
  --tg-theme-button-color: var(--brand-primary) !important;
  --tg-theme-button-text-color: #FFFFFF !important;
  --tg-theme-secondary-bg-color: rgba(255,255,255,0.08) !important;
  --tg-theme-destructive-text-color: var(--danger) !important;

  /* Семантические цвета (общие с другими темами) */
  /* Белый текст на верхней ступени обязан давать ≥4.5:1: #4D9FFF давал 2.7:1 */
  --grad-brand: linear-gradient(180deg,#0071E3 0%,#0059B3 100%);
  --grad-warm: linear-gradient(180deg,rgba(0,113,227,0.16) 0%,rgba(0,113,227,0.05) 100%);
  --grad-tg: linear-gradient(180deg,#339DFF 0%,#007AFF 100%);
  --grad-trust: linear-gradient(90deg,#0071E3,#30D158);
  --ok: #30D158; --ok-bg: rgba(48,209,88,0.16); --ok-border: rgba(48,209,88,0.35); --ok-fg: #30D158;
  /* Плотные версии для подложек с белым текстом: яркий зелёный давал 2.0:1 */
  --ok-solid: #1F7A35; --danger-solid: #D70015;
  --danger: #FF453A; --danger-bg: rgba(255,69,58,0.16); --danger-border: rgba(255,69,58,0.40); --danger-fg: #FF453A;
  --warn: #FFD60A; --warn-bg: rgba(255,214,10,0.16); --warn-border: rgba(255,214,10,0.40); --warn-fg: #FFD60A;
  --exchange-bg: rgba(191,90,242,0.18); --exchange-border: rgba(191,90,242,0.40); --exchange-fg: #BF5AF2;
  --stat-1: #0A84FF; --stat-2: #64D2FF; --stat-3: #BF5AF2; --stat-4: #30D158;
  --shadow-brand: 0 8px 24px rgba(0,113,227,0.35);
  --shadow-tg: 0 8px 20px rgba(0,122,255,0.25);
  --seg-active-bg: #48484A; --seg-active-fg: #FFFFFF;
  --track-bg: rgba(255,255,255,0.20);
  --pill-bg: rgba(28,28,30,0.90); --pill-fg: #FFFFFF;
  --muted-2: #86868B;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  /* Сильные кастомные кривые — встроенные ease-* вялые и «тормозят» интерфейс */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 140ms;
  --dur-fast: 180ms;
  --dur-base: 240ms;
}

/* =====================================================================
   СВЕТЛАЯ ТЕМА — Apple (палитра apple.com): фон #F5F5F7, белые карточки,
   текст #1D1D1F, тонкие линии, мягкие тени. Включается атрибутом
   data-theme="light" на <html> — переключатель iOS в шапке.
   ===================================================================== */
:root[data-theme="light"] {
  --brand-cream: #FFFFFF;
  --brand-cream-2: #F5F5F7;
  --brand-primary-light: rgba(0,113,227,0.14);
  --brand-primary-2: #0066CC;

  --text-900: #1D1D1F;
  --text-700: #424245;
  --text-500: #6E6E73;
  --text-400: #7A7A80;

  --surface: #FFFFFF;
  --surface-2: #F5F5F7;
  --surface-3: #E9E9EB;
  --border: rgba(0,0,0,0.10);
  --border-light: rgba(0,0,0,0.06);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-card-hover: 0 18px 44px rgba(0,0,0,0.14);
  --shadow-float: 0 12px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  --shadow-nav: 0 -1px 0 rgba(0,0,0,0.08);

  --tg-theme-bg-color: var(--surface-2) !important;
  --tg-theme-text-color: var(--text-900) !important;
  --tg-theme-hint-color: var(--text-400) !important;
  --tg-theme-link-color: var(--brand-primary) !important;
  --tg-theme-button-color: var(--brand-primary) !important;
  --tg-theme-button-text-color: #FFFFFF !important;
  --tg-theme-secondary-bg-color: rgba(120,120,128,0.16) !important;
  --tg-theme-destructive-text-color: var(--danger) !important;

  --ok: #248A3D; --danger: #D70015;
  --ok-solid: #1F7A35; --danger-solid: #D70015;
  --ok-fg: #248A3D; --ok-bg: rgba(48,209,88,0.16); --ok-border: rgba(48,209,88,0.45);
  --danger-fg: #D70015; --danger-bg: rgba(255,69,58,0.14); --danger-border: rgba(255,69,58,0.45);
  --warn-fg: #B25000; --warn-bg: rgba(255,149,0,0.18); --warn-border: rgba(255,149,0,0.45);
  --exchange-bg: rgba(191,90,242,0.14); --exchange-border: rgba(191,90,242,0.45); --exchange-fg: #8944AB;
  --seg-active-bg: #FFFFFF; --seg-active-fg: #1D1D1F;
  --track-bg: rgba(120,120,128,0.32);
}

/* --- Компоненты в светлой теме (жёстко зашитые тёмные цвета) --- */
:root[data-theme="light"] body::before,
:root[data-theme="light"] body::after,
:root[data-theme="light"] #app::before { opacity:.16; }
:root[data-theme="light"] .aurora-cursor { background: radial-gradient(circle, rgba(0,113,227,.08), rgba(0,113,227,.03) 42%, transparent 68%); }
:root[data-theme="light"] .topbar { background: rgba(245,245,247,0.80); border-bottom-color:transparent; }
:root[data-theme="light"] .topbar.scrolled { background: rgba(245,245,247,0.92); border-bottom-color:rgba(0,0,0,0.10); }
:root[data-theme="light"] .search-wrap { background:#E9E9EB; }
:root[data-theme="light"] .search-wrap:focus-within { background:#FFFFFF; }
:root[data-theme="light"] .topbar-city,
:root[data-theme="light"] .lang-toggle,
:root[data-theme="light"] .icon-btn,
:root[data-theme="light"] .cat-pill:not(.active) { background:rgba(0,0,0,0.05); }
:root[data-theme="light"] .cat-pill.active { background:var(--grad-brand); color:#FFFFFF; }
:root[data-theme="light"] .cat-pill.ghost { box-shadow: inset 0 0 0 1.5px rgba(0,0,0,0.22); }
:root[data-theme="light"] .cats-divider { background:rgba(0,0,0,0.16); }
:root[data-theme="light"] .badge { border:2px solid #F5F5F7; }
:root[data-theme="light"] .main::-webkit-scrollbar-thumb { background:rgba(0,0,0,0.20); }
:root[data-theme="light"] .btn-secondary,
:root[data-theme="light"] .load-more-btn { background:#E8E8ED; }
:root[data-theme="light"] .view-toggle { background:#E8E8ED; }
:root[data-theme="light"] .view-btn.active { box-shadow:0 1px 3px rgba(0,0,0,0.14); }
:root[data-theme="light"] .listing-card::before,
:root[data-theme="light"] .subscription-card::before { background: radial-gradient(380px circle at var(--mx,50%) var(--my,50%), rgba(0,113,227,0.10), transparent 60%); }
:root[data-theme="light"] .listing-card::after { background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent); }
:root[data-theme="light"] .listing-image { background:rgba(0,0,0,0.04); }
:root[data-theme="light"] .spinner { border-color:rgba(0,0,0,0.14); }
:root[data-theme="light"] .bottom-nav { background:rgba(250,250,252,0.86); border-top:1px solid rgba(0,0,0,0.08); }
:root[data-theme="light"] .modal,
:root[data-theme="light"] .modal-header,
:root[data-theme="light"] .modal-footer { background:#FFFFFF; }
:root[data-theme="light"] .modal-overlay { background:rgba(0,0,0,0.40); }
:root[data-theme="light"] .modal::before { background:rgba(0,0,0,0.2); }
:root[data-theme="light"] .modal-close { background:rgba(0,0,0,0.06); }
:root[data-theme="light"] .ai-fill { background: linear-gradient(180deg, rgba(0,113,227,0.07) 0%, rgba(0,113,227,0.03) 100%); border-color: rgba(0,113,227,0.24); }
:root[data-theme="light"] .ai-fill.filled { background:#FFFFFF; border-color:var(--border); }
:root[data-theme="light"] .msg-bubble { background:#E9E9EB; }
:root[data-theme="light"] .admin-subtab:not(.active),
:root[data-theme="light"] .admin-filters input,
:root[data-theme="light"] .admin-filters select { background:rgba(0,0,0,0.05); }
/* Трек переключателя на светлом фоне должен читаться (у Apple он заметно серый) */
:root[data-theme="light"] .theme-switch-track { background:#D8D8DD; }

/* ================= АВРОРА (анимированное свечение фона) ================= */
body::before, body::after {
  content: ""; position: fixed; border-radius: 50%;
  filter: blur(80px); opacity: .38; pointer-events: none; z-index: 0;
  animation: apFloat 18s ease-in-out infinite; will-change: transform;
}
body::before {
  width: 460px; height: 460px; left: -140px; top: -120px;
  background: radial-gradient(circle, rgba(0,113,227,.65), transparent 65%);
}
body::after {
  width: 420px; height: 420px; right: -120px; top: 40px;
  background: radial-gradient(circle, rgba(52,199,89,.5), transparent 65%);
  animation-delay: -6s;
}
#app::before {
  content: ""; position: fixed; width: 440px; height: 440px; left: 30%; top: 220px;
  border-radius: 50%; filter: blur(80px); opacity: .3; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(255,69,58,.4), transparent 65%);
  animation: apFloat 18s ease-in-out infinite; animation-delay: -12s; will-change: transform;
}
@keyframes apFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(46px, 34px) scale(1.08); }
  66%      { transform: translate(-34px, -24px) scale(.94); }
}
/* Свечение, следующее за курсором (div.aurora-cursor добавляется из app.js) */
.aurora-cursor {
  position: fixed; top: 0; left: 0;
  width: 720px; height: 720px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), rgba(120,140,255,.06) 42%, transparent 68%);
  filter: blur(3px); pointer-events: none; z-index: 0; will-change: transform;
}
#app { position: relative; z-index: 1; }

/* ---------- Base ---------- */
* { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; -webkit-text-size-adjust:100%; height:100%; }
html, body { height:100%; }
body {
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text-900);
  line-height: 1.45;
  min-height:100vh; min-height:100dvh; height:100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  overscroll-behavior:none;
  /* Крупный текст любит отрицательный трекинг, мелкий — нейтральный.
     Здесь база: 0 (раньше -0.01em сжимало мелкие подписи) */
  letter-spacing:0;
  /* Плавная смена светлой/тёмной темы — без резкого скачка яркости */
  transition: background-color var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
#app { display:flex; flex-direction:column; height:100dvh; min-height:100dvh; max-height:100dvh; overflow:hidden; }
h1,h2,h3,h4 { font-weight:600; letter-spacing:-0.02em; }
button { font-family: var(--font); -webkit-tap-highlight-color: transparent; }

/* ---------- Topbar ---------- */
.topbar {
  position:sticky; top:0; z-index:110;
  background: rgba(0,0,0,0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  /* В покое — без жёсткой линии: разделитель проявляется только когда контент
     реально уезжает под шапку (scroll edge вместо постоянного бордера) */
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.topbar.scrolled { background: rgba(0,0,0,0.86); border-bottom-color: rgba(255,255,255,0.10); }
.topbar-inner { width:100%; display:flex; align-items:center; gap:16px; height:60px; padding:0 20px; }
.topbar-left { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.logo {
  width:34px; height:34px; border-radius:9px;
  background: var(--grad-brand);
  display:flex; align-items:center; justify-content:center;
  font-size:17px; box-shadow: 0 2px 10px rgba(0,113,227,0.4);
}
.brand { display:flex; flex-direction:column; line-height:1.05; gap:1px; }
.brand-title { font-size:19px; font-weight:600; letter-spacing:-0.03em; color:var(--text-900); }
.brand-sub { font-size:10px; font-weight:600; letter-spacing:0.08em; text-transform:uppercase; color:var(--brand-primary); }
.topbar-city {
  display:inline-flex; align-items:center; gap:4px;
  padding:6px 12px; border-radius:999px;
  background: rgba(255,255,255,0.08);
  font-size:13px; font-weight:600; color:var(--text-900); cursor:pointer;
}
.topbar-center { flex:1; max-width:none; margin:0 16px; }
.search-wrap {
  display:flex; align-items:center; gap:8px;
  background: rgba(255,255,255,0.08);
  border-radius:10px; padding:2px 2px 2px 10px;
  transition: box-shadow .2s var(--spring);
}
.search-wrap:focus-within { box-shadow: 0 0 0 3px rgba(0,113,227,0.30); background: rgba(255,255,255,0.12); }
.search-wrap input { flex:1; border:none; background:transparent; outline:none; font-size:15px; color:var(--text-900); min-width:0; padding:8px 0; }
.search-wrap input::placeholder { color:var(--text-400); }
.search-btn {
  padding:8px 14px; border-radius:8px; background:var(--grad-brand); color:#fff;
  border:none; font-size:14px; font-weight:600; cursor:pointer; flex-shrink:0;
  box-shadow:0 3px 10px rgba(0,113,227,0.35);
}
.search-btn:active { transform:scale(0.96); opacity:0.9; }
.topbar-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.lang-toggle {
  min-width:40px; height:32px; padding:0 10px; border-radius:999px;
  background: rgba(255,255,255,0.08); border:none;
  font-size:12px; font-weight:700; color:var(--text-900); cursor:pointer;
}
.lang-toggle:active { transform:scale(0.94); opacity:0.85; }
/* Переключатель темы — iOS-свитч в стиле Apple: зелёный трек в тёмной теме,
   бегунок с мягкой тенью и пружинной анимацией, растягивается при нажатии */
.theme-switch { background:none; border:none; padding:0; margin:0; cursor:pointer; display:inline-flex; align-items:center; flex-shrink:0; -webkit-tap-highlight-color:transparent; }
.theme-switch-track {
  position:relative; width:62px; height:32px; border-radius:999px;
  background:#E9E9EB; transition:background .3s var(--spring);
  display:inline-flex; align-items:center;
}
:root[data-theme="dark"] .theme-switch-track { background:#34C759; }
.theme-switch-knob {
  position:absolute; top:2px; left:2px; width:28px; height:28px; border-radius:50%;
  background:#FFFFFF; box-shadow:0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.06);
  transition:transform .3s var(--spring), width .25s var(--spring); z-index:2;
}
:root[data-theme="dark"] .theme-switch-knob { transform:translateX(30px); }
.theme-switch:active .theme-switch-knob { width:33px; }
.theme-switch-icon { position:absolute; top:50%; transform:translateY(-50%); z-index:1; pointer-events:none; }
.theme-switch-icon.sun { left:9px; color:#FF9F0A; }
:root[data-theme="dark"] .theme-switch-icon.sun { color:#FFFFFF; }
.theme-switch-icon.moon { right:9px; color:#6E6E73; }
.topbar-action {
  display:none; align-items:center; gap:6px; padding:8px 14px;
  background:var(--grad-brand); color:#fff; border:none; border-radius:999px;
  font-size:14px; font-weight:600; cursor:pointer; box-shadow:0 4px 14px rgba(0,113,227,0.35);
}
@media(min-width:900px){ .topbar-action{display:inline-flex} }
.topbar-action-icon { width:18px; height:18px; background:rgba(255,255,255,0.25); border-radius:999px; display:flex; align-items:center; justify-content:center; font-size:13px; }
.icon-btn {
  width:36px; height:36px; border-radius:10px;
  background: rgba(255,255,255,0.08); border:none;
  color:var(--brand-primary); display:flex; align-items:center; justify-content:center;
  cursor:pointer; position:relative;
}
.icon-btn:active { transform:scale(0.92); opacity:0.85; }
.badge { position:absolute; top:-5px; right:-5px; min-width:18px; height:18px; padding:0 5px; background:var(--danger-solid); color:#fff; font-size:11px; font-weight:700; border-radius:999px; display:flex; align-items:center; justify-content:center; border:2px solid #000; }
/* Версия сборки в шапке — тихий моно-чип; по клику проверка обновления */
.app-version {
  flex-shrink:0; padding:5px 8px; border:none; border-radius:999px; cursor:pointer;
  background:rgba(255,255,255,0.06); color:var(--text-400);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  font-size:11px; font-weight:600; letter-spacing:0.02em; line-height:1;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), transform var(--dur-press) var(--ease-out);
}
.app-version:active { transform:scale(0.94); }
.app-version.is-checking { color:var(--brand-primary); }
@media (hover:hover) and (pointer:fine) { .app-version:hover { color:var(--brand-primary); background:rgba(255,255,255,0.10); } }
:root[data-theme="light"] .app-version { background:rgba(0,0,0,0.05); }
:root[data-theme="light"] .app-version:hover { background:rgba(0,0,0,0.08); }

.topbar-cats { width:100%; padding:10px 20px 12px; display:flex; gap:8px; justify-content:flex-start; overflow-x:auto; scrollbar-width:none;
  -webkit-mask-image:linear-gradient(90deg,#000 0%,#000 calc(100% - 48px),transparent 100%);
  mask-image:linear-gradient(90deg,#000 0%,#000 calc(100% - 48px),transparent 100%); }
.topbar-cats::-webkit-scrollbar{display:none}
.cat-pill {
  display:inline-flex; align-items:center; gap:6px; padding:7px 14px;
  background: rgba(255,255,255,0.08); border:none; border-radius:999px;
  font-size:13px; font-weight:500; color:var(--text-900); white-space:nowrap; cursor:pointer;
  transition: transform .15s var(--spring);
}
.cat-pill:active { transform:scale(0.95); }
.cat-pill.active { background:var(--grad-brand); color:#fff; font-weight:600; box-shadow:0 3px 12px rgba(0,113,227,0.4); }
.cat-pill.ghost { background:transparent; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.18); }
.cat-pill.ghost.active { background:var(--grad-brand); box-shadow:none; }
.cats-divider { width:1px; height:22px; background:rgba(255,255,255,0.16); flex-shrink:0; margin:0 4px; align-self:center; }
.clickable { cursor:pointer; }
.search-icon { color:var(--text-400); flex-shrink:0; }

/* ---------- Layout ---------- */
.layout { max-width:1280px; margin:0 auto; width:100%; display:flex; gap:16px; padding:16px; align-items:flex-start; flex:1; min-height:0; overflow:visible; position:relative; z-index:1; }
.main { flex:1; min-width:0; min-height:0; overflow-y:auto; overflow-x:hidden; padding-bottom:150px; scrollbar-width:thin; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; touch-action:pan-y; display:flex; flex-direction:column; }
.main::-webkit-scrollbar { width:3px; }
.main::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.2); border-radius:999px; }
.tab-content { padding:16px; animation: fadeIn var(--dur-fast) var(--ease-out); flex:1; }
@keyframes fadeIn { from{opacity:0; transform:translateY(4px)} to{opacity:1; transform:translateY(0)} }

/* ---------- Sidebar ---------- */
.sidebar {
  width:280px; flex-shrink:0; position:sticky; top:0;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-xl);
  padding:16px; display:flex; flex-direction:column; gap:18px;
  max-height:calc(100vh - 140px); overflow-y:auto; align-self:flex-start;
}
.sidebar-head { display:flex; align-items:center; justify-content:space-between; }
.sidebar-head h3 { font-size:15px; font-weight:600; }
.btn-ghost { background:transparent; border:none; color:var(--brand-primary); font-size:14px; font-weight:600; cursor:pointer; padding:6px 8px; }
.btn-ghost.small { font-size:13px; }
.filter-group { display:flex; flex-direction:column; gap:4px; }
.filter-group h4 { font-size:11px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase; color:var(--text-400); padding:0 10px; margin-bottom:2px; }
.radio, .check {
  display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:10px;
  cursor:pointer; font-size:14px; color:var(--text-900);
}
.radio:hover, .check:hover { background:var(--surface-3); }
.radio input { width:18px; height:18px; accent-color:var(--brand-primary); flex-shrink:0; }
.select {
  width:100%; padding:12px 14px; background:var(--surface-3); border:none;
  border-radius:10px; font-size:15px; font-weight:500; color:var(--text-900); min-height:44px; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2386868B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 14px center;
}
.sidebar-hint { font-size:11px; color:var(--text-400); line-height:1.4; text-align:center; }
/* Действия панели фильтров закреплены снизу: раньше кнопка уходила под внутренний скролл */
.sidebar-actions {
  position:sticky; bottom:-16px; z-index:2;
  display:flex; flex-direction:column; gap:8px;
  margin:0 -16px -16px; padding:12px 16px 16px;
  background:var(--surface); border-top:1px solid var(--border);
}
.filter-btn { position:relative; }
.filter-btn .filter-count {
  position:absolute; top:-5px; right:-5px; min-width:17px; height:17px; padding:0 4px;
  border-radius:999px; background:var(--brand-primary); color:#fff;
  font-size:10px; font-weight:700; line-height:1; display:flex; align-items:center; justify-content:center;
  border:2px solid var(--surface-2);
}
@media (min-width: 901px) { .filter-btn { display:none; } }
@keyframes sheetUp { from { transform: translateY(12px); opacity:0; } to { transform:none; opacity:1; } }

/* ---------- Блок доверия автора в листе объявления ---------- */
.author-card {
  display:flex; flex-direction:column; gap:10px;
  padding:14px; border-radius:var(--radius-l);
  background:var(--surface-3); border:1px solid var(--border);
}
.author-row { display:flex; align-items:center; gap:10px; }
.author-avatar {
  width:42px; height:42px; border-radius:50%; flex-shrink:0;
  background:var(--grad-brand); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:17px; font-weight:600;
}
.author-name { font-size:15px; font-weight:600; color:var(--text-900); letter-spacing:-0.01em; }
.author-sub { font-size:12.5px; color:var(--text-500); }
.trust-badges { display:flex; flex-wrap:wrap; gap:6px; }
.trust-badge {
  display:inline-flex; align-items:center; gap:5px; padding:4px 9px; border-radius:999px;
  font-size:11.5px; font-weight:600; letter-spacing:0.01em;
  background:var(--ok-bg); color:var(--ok-fg);
}
.trust-badge.neutral { background:var(--surface-3); color:var(--text-500); }
.trust-stats { display:flex; flex-wrap:wrap; gap:14px; }
.trust-stat { display:flex; flex-direction:column; gap:1px; }
.trust-stat b { font-size:15px; font-weight:600; color:var(--text-900); font-variant-numeric:tabular-nums; }
.trust-stat span { font-size:11.5px; color:var(--text-400); }
/* Строка доверия в карточке ленты */
.listing-trust { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-500); margin-top:6px; }
.listing-trust .dot { width:3px; height:3px; border-radius:50%; background:var(--text-400); }
.check input[type="checkbox"] {
  appearance:none; -webkit-appearance:none;
  width:47px; height:28px; flex-shrink:0;
  background:var(--track-bg); border-radius:999px;
  position:relative; transition:background .22s var(--spring); cursor:pointer;
}
.check input[type="checkbox"]::after {
  content:''; position:absolute; top:2px; left:2px;
  width:24px; height:24px; border-radius:50%;
  background:#fff; box-shadow:0 2px 6px rgba(0,0,0,0.4);
  transition:transform .22s var(--spring);
}
.check input[type="checkbox"]:checked { background:var(--brand-primary); }
.check input[type="checkbox"]:checked::after { transform:translateX(19px); }

/* ---------- Кнопки ---------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 18px; min-height:44px; border:none; border-radius:12px;
  font-size:15px; font-weight:600; cursor:pointer;
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
  text-decoration:none; white-space:nowrap;
}
/* Отклик на нажатие: мгновенное сжатие вместо простого затухания —
   интерфейс должен «слышать» палец ещё до отпускания */
.btn:active { transform: scale(0.97); opacity:0.92; }
.btn-primary { background:var(--grad-brand); color:#fff; box-shadow:0 6px 18px rgba(0,113,227,0.35); }
.btn-secondary { background:rgba(255,255,255,0.10); color:var(--text-900); }
.btn-ghost { background:transparent; color:var(--brand-primary); }
.btn-danger { background:var(--danger-solid); color:#fff; }
.btn.small { padding:8px 12px; min-height:36px; font-size:13px; border-radius:10px; }
.load-more-btn {
  width:100%; padding:13px; margin-top:8px;
  background:rgba(255,255,255,0.10); border:none; border-radius:12px;
  font-size:15px; font-weight:600; color:var(--text-900); cursor:pointer;
}
.load-more-btn:active { transform:scale(0.98); opacity:0.85; }

/* ---------- Контент ---------- */
.content-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:14px; }
.content-head h2 { font-size:24px; font-weight:600; letter-spacing:-0.03em; }
.content-head p { font-size:13px; color:var(--text-400); margin-top:2px; }
.view-toggle { display:flex; background:rgba(255,255,255,0.08); border-radius:9px; padding:2px; height:34px; align-items:center; }
.view-btn {
  padding:5px 14px; border-radius:7px; border:none; background:transparent;
  color:var(--text-900); font-size:13px; font-weight:600; cursor:pointer;
  height:100%; transition:background .18s var(--spring), box-shadow .18s var(--spring);
}
.view-btn.active { background:var(--seg-active-bg); color:var(--seg-active-fg); box-shadow:0 1px 3px rgba(0,0,0,0.4); }
.sort-select { width:auto; min-width:140px; min-height:34px; padding:6px 12px; }
.map-view { height:420px; border-radius:16px; overflow:hidden; margin-bottom:16px; box-shadow:var(--shadow-card); }

/* ---------- Карточки объявлений: свечение за курсором + блик ---------- */
.listings-grid { display:grid; grid-template-columns:1fr; gap:14px; padding-bottom:24px; }
.listing-card {
  position: relative;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-xl);
  overflow:hidden; box-shadow:var(--shadow-card);
  transition:transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
  cursor:pointer; display:flex; flex-direction:column; height:380px;
}
.listing-card.my-listing { height:auto; min-height:380px; }
/* Наведение — только для устройств с курсором: на тач-экранах :hover залипает
   после тапа, и карточка остаётся «приподнятой» до следующего касания */
@media (hover: hover) and (pointer: fine) {
  .listing-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-card-hover); border-color:rgba(255,255,255,0.16); }
  }
/* свечение внутри карточки, следующее за курсором */
.listing-card::before {
  content:""; position:absolute; inset:0;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(0,113,227,0.20), transparent 60%);
  opacity:0; transition:opacity .45s ease; pointer-events:none; z-index:2;
}
@media (hover: hover) and (pointer: fine) { .listing-card:hover::before { opacity:1; } }
/* блик, пробегающий по карточке */
.listing-card::after {
  content:""; position:absolute; top:0; bottom:0; left:-60%; width:55%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.07), transparent);
  transform: translateX(0) skewX(-18deg); opacity:0;
  transition: opacity 200ms linear;
  pointer-events:none; z-index:2;
}
/* Блик бежит только при наведении и не «возвращается» обратно: анимируем transform */
@media (hover: hover) and (pointer: fine) {
  .listing-card:hover::after { opacity:1; transform: translateX(360%) skewX(-18deg); transition: transform 620ms var(--ease-out), opacity 120ms linear; }
}
.listing-image {
  width:100%; height:160px; position:relative; overflow:hidden; flex-shrink:0;
  background: rgba(255,255,255,0.05);
  display:flex; align-items:center; justify-content:center;
}
.listing-image .img-emoji { font-size:60px; }
.badge-row { position:absolute; top:10px; left:10px; right:10px; display:flex; align-items:flex-start; justify-content:space-between; gap:8px; z-index:3; }
.badge-left, .badge-right { display:flex; gap:6px; flex-wrap:wrap; }
.pill {
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 10px; border-radius:999px;
  font-size:11px; font-weight:600; letter-spacing:0.02em;
  background:var(--pill-bg); color:var(--pill-fg);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  box-shadow:0 1px 4px rgba(0,0,0,0.3);
}
.pill-urgent { background:var(--danger-solid); color:#fff; }
.pill-type-offer { background:var(--pill-bg); color:var(--pill-fg); }
.pill-type-request { background:rgba(255,255,255,0.9); color:#1C1C1E; }
.pill-type-sale { background:rgba(28,28,30,0.9); color:#FF9F0A; }
.pill-type-buy { background:rgba(28,28,30,0.9); color:#64D2FF; }
.pill-type-donate { background:var(--ok-solid); color:#fff; }
.pill-verified { background:var(--ok-solid); color:#fff; }
.pill-trusted { background:var(--warn); color:#1C1C1E; }
.pill-photo { background:rgba(28,28,30,0.8); color:#fff; }
.listing-status-badge {
  position:absolute; top:10px; right:10px; z-index:3;
  padding:4px 10px; border-radius:999px; font-size:11px; font-weight:600;
  box-shadow:0 1px 4px rgba(0,0,0,0.3);
}
.listing-status-badge.pending { background:var(--warn); color:#1C1C1E; }
.listing-status-badge.approved { background:var(--ok-solid); color:#fff; }
.listing-status-badge.rejected { background:var(--danger-solid); color:#fff; }
.listing-status-badge.archived { background:var(--muted-2); color:#fff; }

.listing-content { padding:14px 16px 16px; flex:1; display:flex; flex-direction:column; overflow:hidden; position:relative; z-index:1; }
.listing-header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.listing-type { display:flex; align-items:center; gap:7px; font-size:11px; font-weight:600; letter-spacing:0.05em; text-transform:uppercase; color:var(--text-400); }
.listing-type .type-dot { width:7px; height:7px; border-radius:50%; background:var(--brand-primary); }
.listing-meta { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--text-400); }
.listing-views, .listing-distance { display:inline-flex; align-items:center; gap:4px; background:var(--surface-3); padding:3px 8px; border-radius:999px; font-weight:600; }
.listing-distance { background:var(--brand-primary-light); color:var(--brand-primary-2); }
.listing-title { font-size:17px; font-weight:600; letter-spacing:-0.02em; color:var(--text-900); line-height:1.2; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-bottom:6px; flex-shrink:0; }
.listing-dates { font-size:13px; color:var(--text-500); display:flex; align-items:center; gap:6px; margin-bottom:7px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex-shrink:0; }
.listing-dates::before { content:'📅'; font-size:12px; flex-shrink:0; }
.listing-location { font-size:13px; color:var(--text-500); display:flex; align-items:center; gap:6px; margin-bottom:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex-shrink:0; }
.listing-location svg { width:14px; height:14px; color:var(--text-400); flex-shrink:0; }
.listing-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; padding-top:12px; border-top:1px solid var(--border); margin-top:auto; flex-shrink:0; }
.listing-compensation { display:inline-flex; align-items:center; gap:6px; padding:6px 11px; background:var(--surface-3); border-radius:999px; font-size:12.5px; font-weight:600; color:var(--text-700); }
.listing-compensation.free { background:var(--ok-bg); color:var(--ok-fg); }
.listing-compensation.paid { background:var(--warn-bg); color:var(--warn-fg); }
.listing-compensation.exchange { background:var(--exchange-bg); color:var(--exchange-fg); }
.listing-actions { display:flex; align-items:center; gap:8px; }
.favorite-btn { width:40px; height:40px; border-radius:50%; border:none; background:var(--surface-3); color:var(--text-500); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform .15s var(--spring); }
.favorite-btn:active { transform:scale(0.92); }
.favorite-btn.active { background:var(--danger-bg); color:var(--danger); }
.favorite-btn.active svg { fill:var(--danger); stroke:var(--danger); }
.share-btn { width:40px; height:40px; border-radius:50%; border:none; background:var(--surface-3); color:var(--text-500); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform .15s var(--spring), color .15s; flex-shrink:0; }
.share-btn:active { transform:scale(0.92); }
.share-btn:hover { color:var(--brand-primary); }
.contact-btn { padding:10px 16px; min-height:40px; border-radius:999px; background:var(--grad-brand); color:#fff; border:none; font-size:13.5px; font-weight:600; cursor:pointer; box-shadow:0 4px 14px rgba(0,113,227,0.35); }
.contact-btn:active { transform:scale(0.96); opacity:0.9; }
.my-listing .listing-actions { flex-wrap:wrap; }
.my-listing .listing-actions .btn { flex:1; min-width:90px; }
.my-listing .listing-content { padding:12px 14px 14px; }
/* Подпись о вердикте ИИ-модерации в «Моих объявлениях» */
.listing-ai-note { font-size:12px; line-height:1.4; color:var(--text-400); margin-top:8px; }
.my-listing .listing-title { font-size:15px; }

/* ---------- Пустые состояния / загрузка ---------- */
.empty-state {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:48px 24px; text-align:center; gap:12px;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-xl);
}
.empty-illust { width:80px; height:80px; border-radius:22px; background:var(--surface-3); border:none; display:flex; align-items:center; justify-content:center; font-size:40px; }
.empty-state h3 { font-size:17px; font-weight:600; color:var(--text-900); }
.empty-state p { font-size:14px; color:var(--text-500); max-width:300px; line-height:1.45; }
.loading { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:40px 20px; gap:12px; color:var(--text-400); }
.spinner { width:26px; height:26px; border-radius:50%; border:2.5px solid rgba(255,255,255,0.14); border-top-color:var(--brand-primary); animation:spin 0.65s linear infinite; }
@keyframes spin { to{transform:rotate(360deg)} }

/* ---------- FAB ---------- */
.fab {
  position:fixed; bottom:calc(96px + env(safe-area-inset-bottom)); right:16px;
  width:56px; height:56px; border-radius:50%;
  background:var(--grad-brand); color:#fff; border:none;
  box-shadow:var(--shadow-float);
  cursor:pointer; z-index:1001;
  display:flex; align-items:center; justify-content:center;
  transition:transform .2s var(--spring), opacity .2s var(--spring);
}
.fab:hover { transform:scale(1.05); }
.fab:active { transform:scale(0.94); }
.fab.hidden { opacity:0; pointer-events:none; transform:scale(0.9); }
.fab .fab-icon { width:22px; height:22px; display:flex; align-items:center; justify-content:center; }
.fab > span:last-child { display:none; }
.fab .fab-icon svg { width:20px; height:20px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0;
  display:flex; align-items:stretch; justify-content:space-around;
  background:rgba(20,20,22,0.88);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  backdrop-filter:saturate(180%) blur(20px);
  border-top:1px solid rgba(255,255,255,0.08);
  padding:4px 8px calc(6px + env(safe-area-inset-bottom));
  z-index:1000;
}
.nav-item {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
  padding:6px 2px; border-radius:10px; background:transparent; border:none;
  color:var(--text-400); cursor:pointer; position:relative;
  transition:color .15s;
}
.nav-item.active { color:var(--brand-primary); }
.nav-item .nav-icon { width:30px; height:26px; border-radius:8px; display:flex; align-items:center; justify-content:center; }
.nav-item span { font-size:10px; font-weight:500; letter-spacing:0.01em; }

/* ---------- Модалка ---------- */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.55);
  -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
  z-index:2000; display:flex; align-items:flex-end; justify-content:center;
  opacity:1; transition: opacity var(--dur-fast) var(--ease-out);
  @starting-style { opacity: 0; }
}
.modal-overlay[data-state="closed"] { opacity:0; }
.modal {
  width:100%; max-width:560px; max-height:86dvh; background:#1D1D1F;
  border:1px solid var(--border);
  border-radius:20px 20px 0 0; overflow:hidden; display:flex; flex-direction:column;
  /* Вход — пружинная кривая листа, выход быстрее (система отвечает, а не думает) */
  transform: translateY(0); opacity:1;
  transition: transform 320ms var(--ease-drawer), opacity 220ms var(--ease-out), max-height .25s ease, margin-bottom .25s ease;
  will-change: transform;
  @starting-style { transform: translateY(100%); opacity: 0; }
}
.modal[data-state="closed"] { transform: translateY(100%); opacity:0; transition: transform 200ms var(--ease-out), opacity 160ms var(--ease-out); }
.modal.dragging { transition: none; }
@media(min-width:640px){ .modal-overlay { align-items:center; padding:24px; } .modal { border-radius:20px; } }
.modal::before { content:''; width:36px; height:5px; background:rgba(255,255,255,0.2); border-radius:999px; margin:8px auto 0; flex-shrink:0; }
/* Зона захвата листа — тянем за «ручку» и заголовок, как в iOS */
.modal-header { display:flex; align-items:center; justify-content:space-between; padding:14px 20px 12px; position:sticky; top:0; background:#1D1D1F; z-index:1; cursor:grab; touch-action:none; }
.modal-header:active { cursor:grabbing; }
.modal-header h2 { font-size:17px; font-weight:600; letter-spacing:-0.02em; pointer-events:none; }
.modal-close { width:30px; height:30px; border-radius:50%; background:rgba(255,255,255,0.10); border:none; color:var(--text-400); display:flex; align-items:center; justify-content:center; cursor:pointer; transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out); }
.modal-close:active { transform: scale(0.92); opacity:.85; }
.modal-body { padding:16px 20px 20px; overflow-y:auto; flex:1; }
.modal-footer { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:12px 20px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid var(--border); background:#1D1D1F; position:sticky; bottom:0; }
.modal-footer .btn { flex:1 1 0; }
/* блок контактных кнопок всегда занимает отдельную строку — иначе кнопки растягиваются по высоте */
.modal-footer > div { flex:1 1 100%; }
.modal-footer > div .btn { flex:1 1 0; }
:root[data-theme="light"] .modal-header { background:#FFFFFF; }

/* ---------- Формы ---------- */
/* Блок «опишите словами»: заметный, но не кричащий — ИИ предлагает, человек решает */
.ai-fill {
  display:flex; flex-direction:column; gap:10px;
  padding:14px; border-radius:var(--radius-l);
  background: linear-gradient(180deg, rgba(0,113,227,0.10) 0%, rgba(0,113,227,0.04) 100%);
  border:1px solid rgba(0,113,227,0.28);
}
.ai-fill-head { display:flex; flex-direction:column; gap:2px; }
.ai-fill-title { font-size:14px; font-weight:600; color:var(--brand-primary); letter-spacing:-0.01em; }
.ai-fill-hint { font-size:12px; color:var(--text-500); }
.ai-fill textarea {
  width:100%; min-height:64px; resize:vertical; padding:11px 13px;
  background:var(--surface-3); border:none; border-radius:12px;
  font-size:14px; font-family:inherit; color:var(--text-900); line-height:1.4;
}
.ai-fill textarea:focus { outline:none; box-shadow:0 0 0 3px rgba(0,113,227,0.30); }
.ai-fill .btn { align-self:flex-start; }
.ai-fill.filled { background:var(--surface-3); border-color:var(--border); }
.ai-fill.filled .ai-fill-title::after { content:' ✓'; }
.form-group { margin-bottom:14px; }
.form-group label { display:block; font-size:11px; font-weight:600; letter-spacing:0.05em; text-transform:uppercase; color:var(--text-400); margin-bottom:6px; }
.form-group input, .form-group select, .form-group textarea {
  width:100%; padding:11px 14px; background:var(--surface-3); border:none;
  border-radius:10px; font-size:15px; font-weight:400; color:var(--text-900); font-family:inherit;
  transition:box-shadow .18s var(--spring); min-height:44px;
  caret-color:var(--brand-primary); -webkit-text-fill-color:var(--text-900);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline:none; box-shadow:0 0 0 3px rgba(0,113,227,0.35); }
.form-group input::placeholder, .form-group textarea::placeholder { color:var(--text-400); -webkit-text-fill-color:var(--text-400); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-group.checkbox { display:flex; align-items:center; gap:10px; padding:12px; background:var(--surface-3); border-radius:10px; }
.form-group.checkbox input { width:20px; height:20px; min-height:20px; accent-color:var(--brand-primary); }

/* ---------- Toast ---------- */
.toast-container { position:fixed; bottom:96px; left:50%; transform:translateX(-50%); max-width:420px; width:calc(100% - 48px); margin:0 auto; z-index:3000; display:flex; flex-direction:column; gap:8px; pointer-events:none; }
.toast {
  display:flex; align-items:center; gap:10px; padding:12px 14px;
  background:rgba(60,60,67,0.94); border:none; border-radius:14px;
  color:#fff; box-shadow:0 10px 30px rgba(0,0,0,0.5);
  pointer-events:auto;
  -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px);
  /* Тост появляется из-за края и уходит туда же (пространственная согласованность),
     вход/выход — на переходах, чтобы быстрые обновления не перезапускались с нуля */
  opacity:1; transform: translateY(0) scale(1);
  transition: transform 300ms var(--ease-out), opacity 200ms var(--ease-out);
  @starting-style { opacity:0; transform: translateY(100%) scale(0.97); }
}
.toast[data-state="closed"] { opacity:0; transform: translateY(100%) scale(0.97); transition: transform 200ms var(--ease-out), opacity 160ms var(--ease-out); }
/* Статус читается подложкой и глифом, а не цветной полосой слева */
.toast.success { background: color-mix(in srgb, var(--ok) 18%, rgba(60,60,67,0.94)); }
.toast.error { background: color-mix(in srgb, var(--danger) 20%, rgba(60,60,67,0.94)); }
.toast.warning { background: color-mix(in srgb, var(--warn) 18%, rgba(60,60,67,0.94)); }
@supports not (background: color-mix(in srgb, red 10%, blue)) {
  .toast.success { background: rgba(38,74,48,0.96); }
  .toast.error { background: rgba(84,40,40,0.96); }
  .toast.warning { background: rgba(84,74,34,0.96); }
}
.toast-message { flex:1; font-size:13.5px; font-weight:500; color:#fff; line-height:1.35; }
.toast-close { width:28px; height:28px; border-radius:50%; background:rgba(255,255,255,0.16); border:none; color:rgba(255,255,255,0.8); display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out); }
.toast-close:active { transform: scale(0.9); opacity:.8; }

/* ---------- Подписки ---------- */
.subscription-card {
  position:relative;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-l);
  padding:16px; box-shadow:var(--shadow-card); display:flex; flex-direction:column; gap:14px;
  margin-bottom:8px; overflow:hidden;
}
.subscription-card::before {
  content:""; position:absolute; inset:0;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(0,113,227,0.20), transparent 60%);
  opacity:0; transition:opacity .45s ease; pointer-events:none; z-index:0;
}
.subscription-card:hover::before { opacity:1; }
.sub-filters { display:flex; flex-wrap:wrap; gap:8px; position:relative; z-index:1; }
.sub-filter {
  display:inline-flex; align-items:center; gap:6px;
  padding:7px 12px; background:var(--surface-3); border-radius:999px;
  font-size:13px; font-weight:500; color:var(--text-900);
}
.sub-filter::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--brand-primary); }
.sub-filter[data-type="animal"]::before { background:var(--ok); }
.sub-filter[data-type="location"]::before { background:var(--warn); }
.sub-filter[data-type="radius"]::before { background:var(--stat-3); }
.sub-actions { display:flex; gap:8px; justify-content:flex-end; position:relative; z-index:1; }

/* ---------- Чат ---------- */
.chat-thread {
  position:relative; display:flex; gap:12px; align-items:center;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-l);
  padding:13px; box-shadow:var(--shadow-card); cursor:pointer; overflow:hidden;
  transition:transform .15s var(--spring);
}
.chat-thread:active { transform:scale(0.98); }
.thread-main { flex:1; min-width:0; }
.thread-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.thread-head strong { font-size:15px; font-weight:600; color:var(--text-900); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-time { font-size:11px; color:var(--text-400); flex-shrink:0; }
.thread-partner { font-size:12px; color:var(--text-500); margin-top:1px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-last { font-size:13px; color:var(--text-500); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-unread { min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--brand-primary); color:#fff; font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.chat-messages { display:flex; flex-direction:column; gap:6px; max-height:44dvh; overflow-y:auto; padding:4px 2px; }
.msg-row { display:flex; }
.msg-row.mine { justify-content:flex-end; }
.msg-row.theirs { justify-content:flex-start; }
.msg-bubble {
  max-width:78%; padding:9px 13px; border-radius:18px;
  font-size:15px; line-height:1.35;
  background:#2C2C2E; color:var(--text-900); word-break:break-word;
}
.msg-row.mine .msg-bubble { background:var(--grad-brand); color:#fff; }
.msg-time { font-size:10px; opacity:.6; margin-top:3px; text-align:right; }
.chat-input { flex:1; min-width:0; padding:10px 14px; border:none; border-radius:999px; background:var(--surface-3); color:var(--text-900); font-size:15px; }
.chat-input:focus { outline:none; box-shadow:0 0 0 3px rgba(0,113,227,0.35); }

/* ---------- Рекламный блок в ленте ---------- */
/* Заметно, но не чужеродно: та же карточка, акцентная рамка и подпись «Реклама» */
.ad-card { border-color: rgba(0,113,227,0.35); }
.ad-card::before { opacity: 0; }
@media (hover:hover) and (pointer:fine) { .ad-card:hover { border-color: rgba(0,113,227,0.55); } }
.ad-card .listing-type { color: var(--brand-primary); }
.ad-card .listing-type .type-dot { background: var(--brand-primary); animation: adPulse 2.4s ease-in-out infinite; }
@keyframes adPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.ad-card .listing-image { background: linear-gradient(180deg, rgba(0,113,227,0.16) 0%, rgba(0,113,227,0.04) 100%); }
/* Текст креатива — до двух строк: реклама должна договаривать мысль */
.ad-text {
  font-size:13px; color:var(--text-500); line-height:1.4; margin-bottom:8px;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.ad-cta {
  display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border-radius:999px;
  background:var(--grad-brand); color:#fff; font-size:13.5px; font-weight:600;
  box-shadow:0 4px 14px rgba(0,113,227,0.35);
}
.ad-card:active { transform: scale(0.985); }
:root[data-theme="light"] .ad-card { border-color: rgba(0,113,227,0.28); }

/* ---------- Доп. блоки карточки: погода и памятка ---------- */
.detail-extra { margin-top:2px; }
.extra-card {
  display:flex; flex-direction:column; gap:6px;
  padding:12px 14px; border-radius:14px;
  background:var(--surface-3); border:1px solid var(--border);
}
.extra-head { display:flex; align-items:center; gap:8px; }
.extra-emoji { font-size:17px; line-height:1; }
.extra-title { font-size:14px; font-weight:600; color:var(--text-900); letter-spacing:-0.01em; }
.extra-sub { font-size:12.5px; color:var(--text-500); }
.extra-advice { font-size:13px; color:var(--brand-primary); line-height:1.45; }
.extra-list { display:flex; flex-direction:column; gap:7px; margin-top:2px; padding-left:16px; }
.extra-list li { font-size:13px; color:var(--text-500); line-height:1.45; }
.empty-tip {
  max-width:320px; margin-top:6px; padding:10px 12px; border-radius:12px;
  background:var(--surface-3); font-size:12.5px; color:var(--text-500); line-height:1.45; text-align:left;
}
.form-hint { font-size:12px; color:var(--brand-primary); margin-top:6px; line-height:1.4; }

/* ---------- Галерея / рейтинг ---------- */
.detail-gallery { border-radius:14px; overflow:hidden; background:var(--surface-3); }
.detail-emoji { font-size:56px; text-align:center; padding:28px 12px; background:var(--surface-3); border-radius:14px; }
.gallery-main img { display:block; width:100%; height:260px; object-fit:cover; background:var(--surface-3); }
.gallery-nav { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; gap:10px; }
.gallery-count { font-size:12px; font-weight:600; color:var(--text-500); }
.gallery-btn { width:38px; height:38px; border-radius:50%; border:none; background:var(--surface-3); color:var(--text-900); font-size:22px; line-height:1; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.gallery-btn:active { transform:scale(0.92); opacity:0.85; }
.rate-star { min-width:48px; padding:12px 10px; border-radius:12px; border:none; background:var(--surface-3); font-size:14px; font-weight:600; color:var(--text-900); cursor:pointer; transition:transform .15s var(--spring); }
.rate-star:active { transform:scale(0.94); }
.rate-star:hover { background:var(--warn-bg); }
.rate-star:disabled { opacity:.6; }

/* ---------- Админка ---------- */
.admin-stats { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px; margin-bottom:18px; }
.admin-stat-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px 16px; box-shadow:var(--shadow-card); }
.admin-stat-card .stat-label { font-size:11px; color:var(--text-400); font-weight:600; text-transform:uppercase; letter-spacing:0.04em; }
.admin-stat-card .stat-value { font-size:24px; font-weight:600; color:var(--text-900); margin-top:2px; }
.admin-subtabs { display:flex; gap:4px; margin-bottom:14px; overflow-x:auto; }
.admin-subtab {
  padding:8px 14px; border:none; background:rgba(255,255,255,0.08); border-radius:999px;
  font-size:13px; font-weight:600; color:var(--text-900); cursor:pointer; white-space:nowrap;
}
.admin-subtab.active { background:var(--grad-brand); color:#fff; }
.admin-filters { display:flex; gap:10px; margin-bottom:12px; flex-wrap:wrap; align-items:center; }
.admin-filters input, .admin-filters select {
  padding:9px 13px; background:var(--surface-3); border:none; border-radius:10px;
  font-size:13px; font-weight:500; color:var(--text-900); min-height:38px;
}
.admin-filters input:focus, .admin-filters select:focus { outline:none; box-shadow:0 0 0 3px rgba(0,113,227,0.35); }
.admin-table-wrap { overflow-x:auto; border-radius:14px; background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow-card); }
.admin-table { width:100%; border-collapse:collapse; font-size:13px; }
.admin-table th {
  background:transparent; color:var(--text-400); font-weight:600;
  text-align:left; padding:10px 14px; white-space:nowrap; font-size:11px;
  text-transform:uppercase; letter-spacing:0.04em;
  border-bottom:1px solid var(--border);
}
.admin-table td { padding:10px 14px; border-bottom:1px solid var(--border-light); vertical-align:middle; }
.admin-table tbody tr:last-child td { border-bottom:none; }
.admin-table tbody tr:hover { background:var(--surface-3); }
.admin-table .btn-sm {
  padding:7px 12px; font-size:12px; border-radius:9px; border:none;
  background:var(--surface-3); color:var(--text-900); cursor:pointer; font-weight:600;
  min-height:32px;
}
.admin-table .btn-sm.danger { background:var(--danger-bg); color:var(--danger-fg); }
.admin-table .btn-sm.success { background:var(--ok-bg); color:var(--ok-fg); }
.admin-table .btn-sm.primary { background:var(--brand-primary-light); color:var(--brand-primary-2); }
@media (max-width:768px) {
  .admin-stats { grid-template-columns:repeat(2,1fr); }
  .admin-table { font-size:12px; }
  .admin-table th, .admin-table td { padding:8px 10px; }
}

/* ---------- Футер ---------- */
.site-footer {
  margin-top:auto; padding:18px 0 8px; border-top:1px solid var(--border);
  display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px;
  font-size:12px; color:var(--text-400);
}
.site-footer a { color:var(--text-500); text-decoration:none; font-weight:500; }
.site-footer a:hover { color:var(--brand-primary); }
.footer-links { display:flex; gap:16px; align-items:center; }
.footer-links a { color:var(--brand-primary); font-weight:600; display:inline-flex; align-items:center; gap:5px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topbar-right { gap:6px; margin-left:auto; }
  .app-version { font-size:10px; padding:4px 6px; }
  /* На узких экранах — нативный размер свитча iOS (51×31) и без иконок: важна каждая точка */
  .theme-switch-track { width:51px; height:31px; }
  .theme-switch-knob { width:27px; height:27px; }
  :root[data-theme="dark"] .theme-switch-knob { transform:translateX(20px); }
  .theme-switch:active .theme-switch-knob { width:32px; }
  .theme-switch-icon { display:none; }
  /* На мобильных «Создать» живёт в шапке (как в iOS), а плавающая кнопка не перекрывает
     кнопки карточек — поэтому FAB скрываем, а действие шапки делаем компактным «+» */
  .fab { display:none; }
  .topbar-action { display:inline-flex; width:36px; height:36px; min-height:36px; padding:0; border-radius:50%; font-size:0; }
  .topbar-action-icon { width:100%; height:100%; background:transparent; font-size:15px; }
  .topbar-inner { height:auto; min-height:54px; flex-wrap:wrap; padding:8px 20px; gap:10px; }
  .topbar-left { flex:1; }
  .topbar-center { display:flex; flex:1 1 100%; order:3; max-width:none; margin:0; }
  .search-wrap { flex:1; }
  .topbar-cats { padding:10px 20px 12px; }
  .layout { flex-direction:column; padding:12px; gap:12px; }
  .sidebar { display:none; }
  /* Фильтры на телефоне — полноэкранный лист. Раньше их нельзя было открыть ничем. */
  .sidebar.open {
    display:flex; position:fixed; inset:0; z-index:1500;
    width:100%; max-height:none; border:none; border-radius:0;
    padding:16px 16px calc(20px + env(safe-area-inset-bottom));
    background:var(--surface-2); overflow-y:auto;
    animation: sheetUp 260ms var(--ease-drawer);
  }
  .sidebar.open .sidebar-head { position:sticky; top:0; z-index:2; background:var(--surface-2); padding:4px 0 10px; }
  /* Лист живёт внутри .layout, у которого свой контекст наложения, поэтому
     нижнее меню и FAB на время листа просто убираем — иначе они перехватывают нажатия. */
  html.sheet-open .bottom-nav, html.sheet-open .fab { display:none !important; }
  .sidebar.open .sidebar-actions { position:sticky; bottom:0; background:var(--surface-2); }
  .listings-grid { grid-template-columns:1fr; }
  .content-head { flex-direction:column; align-items:stretch; }
}
@media (min-width: 901px) {
  .main { padding-bottom:100px; }
  .listings-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (min-width: 1100px) { .listings-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
/* Пустое состояние занимает всю строку, а не одну колонку */
.listings-grid > .empty-state { grid-column: 1 / -1; }
/* Плавающая кнопка показывается только там, где справа есть свободное поле
   (иначе она перекрывает кнопки карточек — на узких экранах её роль берёт «Создать» в шапке) */
@media (max-width:1200px) { .fab { display:none; } }
@media (max-width:480px) {
  .modal { border-radius:20px 20px 0 0; }
  .fab { bottom:calc(92px + env(safe-area-inset-bottom)); right:14px; }
  /* Освобождаем место под бейдж версии, чтобы шапка осталась в одну строку */
  .topbar-city { display:none; }
  .topbar-inner { padding:8px 16px; }
  .brand-title { font-size:17px; }
  .logo { width:30px; height:30px; font-size:15px; }
  .icon-btn { width:32px; height:32px; }
  .lang-toggle { min-width:34px; height:30px; padding:0 8px; font-size:11px; }
  .app-version { font-size:9px; padding:3px 5px; }
}

/* ---------- Сайт (вне Telegram) ---------- */
html.is-website #app { height:auto; min-height:100vh; max-height:none; overflow:visible; }
html.is-website body { height:auto; min-height:100vh; overflow:auto; -webkit-overflow-scrolling:touch; }
html.is-website .layout { overflow:visible; flex:none; min-height:auto; }
/* В режиме сайта страница скроллится целиком, но ширина .main всё равно должна
   ограничиваться раскладкой: с flex:none он вырастал по содержимому и вылезал за вьюпорт. */
html.is-website .main { flex:1 1 auto; min-width:0; width:100%; min-height:auto; overflow:visible; height:auto; max-height:none; padding-bottom:100px; }
html.is-website .bottom-nav { position:sticky; }

/* ---------- Баннер входа на сайте ---------- */
.site-banner {
  position:relative; display:flex; flex-direction:column; gap:10px;
  padding:14px; margin-bottom:14px;
  border-radius:var(--radius-l);
  background:var(--grad-warm); border:1px solid var(--border-light);
}
.site-banner .btn { width:100%; }
.site-banner-close {
  position:absolute; top:8px; right:8px; width:28px; height:28px;
  border:none; border-radius:50%; background:transparent; color:var(--text-400);
  font-size:18px; line-height:1; cursor:pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.site-banner-close:hover { background:var(--surface-3); color:var(--text-900); }
.site-banner-note { font-size:12px; color:var(--text-500); line-height:1.45; }

/* ---------- Поверхности браузера (то, что мы не рисуем, но оно выглядит) ---------- */
::selection { background: rgba(0,113,227,0.35); color: #FFFFFF; }
:root[data-theme="light"] ::selection { background: rgba(0,113,227,0.22); color: #1D1D1F; }
a { text-underline-offset: 2px; text-decoration-thickness: 1px; }
/* Цифры в счётчиках и метаданных не должны «плясать» при обновлении */
.listing-views, .listing-distance, .gallery-count, .app-version, .thread-unread,
.pill, .listing-meta, .extra-sub, .rate-star, time { font-variant-numeric: tabular-nums; }

/* ---------- Прочее ---------- */
#cityList { min-height:300px; }
.city-picker-list { min-height:300px; max-height:400px; overflow-y:auto; }
:focus-visible { outline:2px solid var(--brand-primary); outline-offset:2px; }
/* Единый отклик на нажатие для мелких контролов: мгновенное сжатие вместо затухания —
   кнопка обязана реагировать в момент нажатия, а не после отпускания */
.search-btn, .lang-toggle, .icon-btn, .load-more-btn, .contact-btn, .gallery-btn, .nav-item {
  transition: transform var(--dur-press) var(--ease-out), opacity var(--dur-press) var(--ease-out), background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-item:active { transform: scale(0.94); }
.listing-card:active { transform: scale(0.985); transition-duration: var(--dur-press); }

/* ---------- Доступность: reduced motion / transparency / contrast ---------- */
/* Уменьшенное движение ≠ отсутствие движения: убираем перемещения и петли,
   но оставляем короткие переходы прозрачности и цвета, которые помогают пониманию */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after, #app::before { animation: none !important; }
  .aurora-cursor { display: none !important; }
  .listing-card::after { display: none !important; }
  .tab-content, .modal, .toast { animation: none !important; }
  .modal { transition: opacity 160ms ease !important; transform: none !important; }
  .modal-overlay { transition: opacity 160ms ease !important; }
  .modal[data-state="closed"] { transform: none !important; opacity: 0; }
  .toast { transition: opacity 160ms ease !important; transform: none !important; }
  .toast[data-state="closed"] { transform: none !important; opacity: 0; }
  .btn:active, .cat-pill:active, .favorite-btn:active, .share-btn:active, .icon-btn:active,
  .lang-toggle:active, .nav-item:active, .listing-card:active, .fab:active { transform: none !important; }
  .listing-card, .listing-card:hover { transform: none; }
  .theme-switch-knob { transition: transform 120ms linear !important; }
}
/* Прозрачность выключают — делаем материалы плотными, без blur */
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--surface-2) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .bottom-nav { background: var(--surface-2) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .toast { background: #3A3A3C !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .pill { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .modal-overlay { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: rgba(0,0,0,0.62); }
}
/* Высокий контраст — плотные поверхности и явные границы */
@media (prefers-contrast: more) {
  :root { --border: rgba(255,255,255,0.30); --border-light: rgba(255,255,255,0.20); --text-400: #C7C7CC; --text-500: #D1D1D6; }
  :root[data-theme="light"] { --border: rgba(0,0,0,0.32); --border-light: rgba(0,0,0,0.22); --text-400: #48484A; --text-500: #3A3A3C; }
  .topbar, .bottom-nav { background: var(--surface-2) !important; }
  .btn-secondary, .load-more-btn { background: rgba(127,127,127,0.28) !important; }
}
