/* =========================================================================
   Sharby — дизайн-система интерфейса.
   Токены цвета/шрифтов — из BRAND_BOOK.md (сняты пипеткой с утверждённых
   ассетов, не выдуманы). Здесь их не переопределять «на глаз»: если цвет
   меняется — сначала бренд-бук, потом этот файл.
   Порядок: токены → база → лейаут → компоненты → экраны → адаптив.
   ========================================================================= */

/* ---------- 1. Токены ---------------------------------------------------- */

:root {
  /* Палитра (BRAND_BOOK.md) */
  --cream: #fbf6ea;
  --cream-deep: #f1e7d3;
  --terracotta: #d6692f;
  --terracotta-deep: #a5501f;
  --sage: #9ca88c;
  --sage-deep: #75816a;
  --peach: #f3b99c;
  --ink: #241c16;
  --ink-soft: #6b5844;

  /* Производные (для поверхностей и границ) */
  --surface: #fffdf7;
  --surface-2: var(--cream);
  --surface-sunken: var(--cream-deep);
  --line: rgba(36, 28, 22, 0.1);
  --line-strong: rgba(36, 28, 22, 0.18);
  --ink-faint: rgba(36, 28, 22, 0.45);
  --terracotta-tint: rgba(214, 105, 47, 0.1);
  --sage-tint: rgba(156, 168, 140, 0.22);
  --peach-tint: rgba(243, 185, 156, 0.28);
  --danger: #b3402c;
  --danger-tint: rgba(179, 64, 44, 0.1);

  /* Типографика */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Manrope", var(--font-body);

  /* Скругления */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* Тени — тёплые, не серые */
  --shadow-xs: 0 1px 2px rgba(36, 28, 22, 0.05);
  --shadow-sm: 0 2px 8px rgba(36, 28, 22, 0.06);
  --shadow-md: 0 6px 20px rgba(36, 28, 22, 0.08);
  --shadow-lg: 0 16px 40px rgba(36, 28, 22, 0.12);

  /* Ритм */
  --gap: 16px;
  --container: 1180px;
  --header-h: 72px;

  --ease: cubic-bezier(0.2, 0.8, 0.3, 1);
  --dur: 0.18s;
}

/* ---------- 2. База ------------------------------------------------------ */

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

/* Атрибут hidden обязан выигрывать у классов, задающих display.
   Правило вроде `.btn { display: inline-flex }` специфичнее браузерного
   `[hidden] { display: none }` — из-за этого скрытые кнопки оставались
   на экране. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Form-контролы не наследуют шрифт от body — это поведение браузера, а не
   упущение вёрстки. Без этой строки любая кнопка, которой не прописали
   font-family вручную, рисуется системным шрифтом ОС и выпадает из
   типографики страницы. Компоненты (.btn и прочие) шрифт задают, но
   полагаться на то, что о нём вспомнят в каждом новом месте, нельзя. */
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "cv05" 1;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
}
h2 {
  font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem);
}
h3 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--terracotta-deep);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

a:hover {
  color: var(--terracotta);
}

img {
  max-width: 100%;
  display: block;
  /* height: auto обязателен. Атрибуты width/height в разметке (они нужны,
     чтобы не прыгал лейаут при загрузке) браузер применяет как CSS-подсказку:
     если переопределить только ширину, высота останется от атрибута и
     картинка растянется. */
  height: auto;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--peach);
  color: var(--ink);
}

/* Скроллбар в тон бренду (webkit) */
* {
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--r-pill);
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke-width: 1.9;
}
.icon-sm {
  width: 16px;
  height: 16px;
}
.icon-lg {
  width: 26px;
  height: 26px;
  stroke-width: 1.7;
}
.icon-xl {
  width: 34px;
  height: 34px;
  stroke-width: 1.6;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 3. Лейаут ---------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.page {
  flex: 1;
  padding-block: 32px 56px;
}

.page-narrow {
  max-width: 720px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
}

.page-head .subtitle {
  color: var(--ink-soft);
  margin: 6px 0 0;
}

.stack > * + * {
  margin-top: var(--gap);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 14px;
}

.back-link:hover {
  color: var(--ink);
}

/* --- Шапка --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 246, 234, 0.88);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--gap);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.logo img {
  height: 44px;
  width: auto;
}

.logo__text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}

.logo__tagline {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0;
  color: var(--ink-soft);
  margin-top: 3px;
}

/* Поиск в шапке появляется только на узких экранах — см. медиазапрос. */
.header-search {
  display: none;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-link:hover {
  background: var(--cream-deep);
  color: var(--ink);
}

.nav-link.is-active {
  color: var(--ink);
  background: var(--cream-deep);
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--terracotta);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Подвал --- */

.site-footer {
  background: var(--cream-deep);
  border-top: 1px solid var(--line);
  padding-block: 40px;
  margin-top: auto;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
  justify-content: space-between;
}

.site-footer p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  max-width: 34ch;
  margin: 8px 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 0.92rem;
}

.footer-links a {
  color: var(--ink-soft);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--terracotta-deep);
}

/* --- Нижняя навигация (мобильная) --- */

.tabbar {
  display: none;
  position: fixed;
  z-index: 45;
  inset: auto 0 0 0;
  background: rgba(251, 246, 234, 0.94);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}

.tabbar__list {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
}

.tabbar__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 500;
}

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

.tabbar__item--accent {
  color: var(--terracotta-deep);
}

.tabbar__dot {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--terracotta);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 4. Компоненты ------------------------------------------------ */

/* --- Кнопки --- */

.btn {
  --btn-bg: var(--cream-deep);
  --btn-fg: var(--ink);
  --btn-bd: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:hover {
  color: var(--btn-fg);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.btn--primary {
  --btn-bg: var(--terracotta);
  --btn-fg: #fff;
  box-shadow: 0 4px 14px rgba(214, 105, 47, 0.28);
}

.btn--primary:hover {
  --btn-bg: var(--terracotta-deep);
  box-shadow: 0 8px 22px rgba(214, 105, 47, 0.32);
}

.btn--secondary {
  --btn-bg: transparent;
  --btn-bd: var(--line-strong);
  --btn-fg: var(--ink);
}

.btn--secondary:hover {
  --btn-bg: var(--cream-deep);
  --btn-bd: transparent;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-soft);
  padding-inline: 14px;
}

.btn--ghost:hover {
  --btn-bg: var(--cream-deep);
  --btn-fg: var(--ink);
}

.btn--danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
}

.btn--danger:hover {
  --btn-bg: #93341f;
}

.btn--sm {
  padding: 8px 14px;
  font-size: 0.87rem;
}

.btn--lg {
  padding: 14px 26px;
  font-size: 1.02rem;
}

.btn--block {
  width: 100%;
}

.btn--icon {
  padding: 10px;
  border-radius: var(--r-pill);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* --- Карточка --- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card--flat {
  box-shadow: none;
  background: var(--cream-deep);
  border-color: transparent;
}

.card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card__title .icon {
  color: var(--sage-deep);
}

/* --- Бейджи --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  color: var(--ink-soft);
  font-size: 0.79rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge--active {
  background: var(--sage-tint);
  color: var(--sage-deep);
}

.badge--reserved {
  background: var(--peach-tint);
  color: #a2542f;
}

.badge--given {
  background: rgba(36, 28, 22, 0.07);
  color: var(--ink-soft);
}

.badge--archived {
  background: rgba(36, 28, 22, 0.07);
  color: var(--ink-faint);
}

.badge--danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.badge--accent {
  background: var(--terracotta-tint);
  color: var(--terracotta-deep);
}

.meta {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.meta-row > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-row .icon {
  width: 15px;
  height: 15px;
  color: var(--sage-deep);
}

/* --- Аватар --- */

.avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--r-pill);
  background: var(--sage-tint);
  color: var(--sage-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: none;
  user-select: none;
}

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

.avatar--sm {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.avatar--lg {
  width: 68px;
  height: 68px;
  font-size: 1.4rem;
}

.avatar--xl {
  width: 104px;
  height: 104px;
  font-size: 2.1rem;
}

/* --- Cookie-баннер --- */

.cookie-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 70;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.cookie-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-block: 16px;
}

.cookie-banner__inner p {
  flex: 1 1 320px;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.cookie-banner__inner a {
  color: inherit;
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  flex: none;
  gap: 10px;
}

/* --- Уведомления (django messages) --- */

.alerts {
  position: fixed;
  z-index: 60;
  top: calc(var(--header-h) + 12px);
  right: 20px;
  left: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
  pointer-events: none;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-size: 0.93rem;
  font-weight: 500;
  pointer-events: auto;
  animation: alert-in 0.32s var(--ease) both;
}

.alert .icon {
  margin-top: 1px;
  color: var(--sage-deep);
}

.alert--success .icon {
  color: var(--sage-deep);
}
.alert--error,
.alert--warning {
  border-color: rgba(179, 64, 44, 0.28);
}
.alert--error .icon,
.alert--warning .icon {
  color: var(--danger);
}

.alert__close {
  margin-left: auto;
  border: 0;
  background: none;
  padding: 2px;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: var(--r-xs);
}

.alert__close:hover {
  color: var(--ink);
  background: var(--cream-deep);
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

/* --- Формы --- */

.form-field {
  margin-bottom: 18px;
}

.form-field > label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
}

.form-field .required-star {
  color: var(--terracotta);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.4;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  appearance: none;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-tint);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B5844' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 17px;
  padding-right: 38px;
  cursor: pointer;
}

.form-field__help {
  font-size: 0.83rem;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

.form-field__help ul,
.form-field__help ol {
  margin: 0;
  padding-left: 18px;
}

.form-field__help li + li {
  margin-top: 3px;
}

.form-field__errors {
  list-style: none;
  margin: 7px 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--danger);
  font-weight: 500;
}

.form-field--invalid input,
.form-field--invalid select,
.form-field--invalid textarea {
  border-color: var(--danger);
}

.form-errors {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 18px;
}

.form-errors .icon {
  flex: none;
  margin-top: 1px;
}

.form-errors ul {
  margin: 0;
  padding-left: 18px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
}

/* Поле загрузки файла (аватар) — Django рендерит ClearableFileInput
   как текст + чекбокс «очистить» + сам input, поэтому стилизуем блоком. */
.form-field input[type="file"] {
  display: block;
  width: 100%;
  /* Без min-width:0 нативный file input не даёт колонке сузиться и
     раздвигает мобильный вьюпорт (страница уезжает вбок). */
  min-width: 0;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--cream-deep);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.87rem;
  cursor: pointer;
}

.form-field input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

.form-field input[type="file"]:hover {
  border-color: var(--terracotta);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.93rem;
  cursor: pointer;
}

.checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--terracotta);
  cursor: pointer;
}

/* --- Пустое состояние --- */

.empty {
  text-align: center;
  padding: 44px 20px 52px;
}

.empty img {
  width: min(190px, 45vw);
  margin: 0 auto 18px;
}

.empty h2,
.empty h3 {
  margin-bottom: 8px;
}

.empty p {
  color: var(--ink-soft);
  max-width: 42ch;
  margin-inline: auto;
}

.empty .btn-row {
  justify-content: center;
  margin-top: 20px;
}

/* --- Табы --- */

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--cream-deep);
  border-radius: var(--r-pill);
}

.tabs a {
  padding: 8px 18px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* --- Карта --- */

.map {
  height: 420px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--cream-deep);
}

.map--compact {
  height: 260px;
}

.map-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  background: var(--cream-deep);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  min-height: 140px;
}

.map-placeholder .icon {
  color: var(--sage-deep);
}

/* --- Карточка объявления в балуне карты ---
   Балун Яндекса кладёт свои отступы вокруг содержимого, из-за чего карточка
   с фото смотрелась смещённой и обрезанной. Версия API зашита в имена его
   классов (ymaps-2-1-79-…), поэтому цепляемся по вхождению подстроки. */
[class*="balloon__content"] {
  margin: 0 !important;
  padding: 0 !important;
}

[class*="balloon__content"] > ymaps {
  height: auto !important;
}

.map-balloon {
  display: block;
  width: 220px;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
}

.map-balloon__photo {
  display: block;
  width: 100%;
  height: 124px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--cream-deep);
}

.map-balloon__body {
  display: block;
  padding: 8px 2px 2px;
}

.map-balloon__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--terracotta-deep);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.map-balloon__meta {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

/* ---------- 5. Экраны ---------------------------------------------------- */

/* --- Главная: hero --- */

/* Подложка собрана из двух мягких радиальных пятен палитры поверх крема:
   в отличие от линейного градиента она даёт объём и не читается как
   дефолтная заготовка. */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 26px;
  padding: 28px 24px 26px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  text-align: center;
  background:
    radial-gradient(88% 120% at 12% -14%, rgba(243, 185, 156, 0.55), transparent 58%),
    radial-gradient(78% 110% at 88% 114%, rgba(156, 168, 140, 0.4), transparent 62%),
    linear-gradient(180deg, var(--surface) 0%, var(--cream) 100%);
}

/* Фактура фона — собственные иконки категорий: намекают на вещи и
   привязывают блок именно к этому сайту. */
.hero__deco {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.hero__glyph {
  position: absolute;
  color: var(--ink);
  opacity: 0.055;
  stroke-width: 1.1;
}

.hero__glyph--1 { width: 92px; height: 92px; left: 3%; top: 12%; transform: rotate(-12deg); }
.hero__glyph--2 { width: 64px; height: 64px; left: 15%; bottom: 10%; transform: rotate(9deg); }
.hero__glyph--3 { width: 78px; height: 78px; right: 5%; top: 16%; transform: rotate(11deg); }
.hero__glyph--4 { width: 70px; height: 70px; right: 16%; bottom: 8%; transform: rotate(-8deg); }
.hero__glyph--5 { width: 54px; height: 54px; left: 30%; top: 6%; transform: rotate(14deg); }
.hero__glyph--6 { width: 58px; height: 58px; right: 31%; bottom: 4%; transform: rotate(-14deg); }

.hero__body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__mascot {
  height: 76px;
  width: auto;
  margin-bottom: 6px;
}

.hero h1 {
  margin-bottom: 6px;
  font-size: clamp(1.5rem, 1.05rem + 1.5vw, 2.05rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 20ch;
  text-wrap: balance;
}

.hero p {
  color: var(--ink-soft);
  font-size: clamp(0.93rem, 0.9rem + 0.2vw, 1.05rem);
  max-width: 40ch;
  margin-bottom: 18px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* --- Путь пользователя в hero ---
   Одна разметка, две раскладки. На телефоне линия вертикальная и идёт
   слева от кружков (обычный список сверху вниз), на широком экране —
   горизонтальная, поперёк ряда. Линию рисует ::after у каждого шага, а не
   одна общая полоса на контейнере: так она всегда кончается ровно на
   следующем кружке, чем бы ни отличалась длина подписей, и у последнего
   шага её просто нет. */
.flow {
  list-style: none;
  counter-reset: flow;
  margin: 22px 0 0;
  padding: 0;
  width: 100%;
  max-width: 30rem;
  display: grid;
  gap: 16px;
  text-align: left;
}

.flow__step {
  position: relative;
  counter-increment: flow;
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: start;
  gap: 12px;
}

/* Кружок — «станция» на линии. Номер стоит бейджем в углу: цифра говорит
   «шагов немного и они по порядку», иконка — что именно происходит. */
.flow__dot {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  color: var(--terracotta-deep);
}

.flow__dot::before {
  content: counter(flow);
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--terracotta);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
}

.flow__step:not(.flow__step--final)::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: -16px;
  width: 2px;
  background: linear-gradient(180deg, var(--line-strong), var(--line));
}

.flow__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 3px;
  min-width: 0;
}

.flow__title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
}

.flow__hint {
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

@media (min-width: 720px) {
  .flow {
    max-width: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 0 10px;
    text-align: center;
  }

  .flow__step {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
  }

  .flow__step:not(.flow__step--final)::after {
    /* Полоса уходит от края кружка до кружка соседа: 50% + половина
       колонки, минус радиус с обеих сторон и половина зазора. */
    left: calc(50% + 24px);
    right: calc(-50% + 24px);
    top: 19px;
    bottom: auto;
    width: auto;
    height: 2px;
    background: linear-gradient(90deg, var(--line-strong), var(--line));
  }

  .flow__text {
    padding-top: 0;
    align-items: center;
    max-width: 22ch;
  }
}

/* --- Категории --- */

.categories {
  margin-bottom: 28px;
}

.categories__title {
  font-size: 1.25rem;
  margin: 0 0 14px;
}

/* Два ряда с общей горизонтальной прокруткой. Колонка grid'а —
   minmax(max-content, 1fr): если ряды шире экрана, она берёт ширину
   самого длинного (и блок прокручивается), если у́же — растягивается на
   всю ширину. В обоих случаях оба ряда получают ОДНУ ширину, поэтому
   короткий больше не обрывается раньше длинного. */
.categories__scroller {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr);
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-bottom: 4px;
}

.categories__row {
  display: flex;
  gap: 10px;
  min-width: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Плитка близка к квадрату: высота фиксирована, ширина отталкивается от
   названия. flex-grow добирает остаток ряда поровну на все плитки —
   разница между ними сохраняется, но ряд заполняется до конца.
   Ряды считаются независимо, поэтому верхняя и нижняя плитки не
   совпадают по ширине. */
.categories__row > li {
  flex: 1 1 auto;
  width: max-content;
  min-width: 104px;
  max-width: 260px;
  scroll-snap-align: start;
}

.cat-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 104px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.cat-tile__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.cat-tile__glyph {
  flex: none;
  align-self: flex-end;
  width: 38px;
  height: 38px;
  stroke-width: 1.4;
  transition: transform var(--dur) var(--ease);
}

.cat-tile--sage {
  background: linear-gradient(145deg, rgba(156, 168, 140, 0.3), rgba(156, 168, 140, 0.12));
}

.cat-tile--sage .cat-tile__glyph {
  color: var(--sage-deep);
}

.cat-tile--terracotta {
  background: linear-gradient(145deg, rgba(214, 105, 47, 0.22), rgba(214, 105, 47, 0.07));
}

.cat-tile--terracotta .cat-tile__glyph {
  color: var(--terracotta);
}

.cat-tile--peach {
  background: linear-gradient(145deg, rgba(243, 185, 156, 0.5), rgba(243, 185, 156, 0.16));
}

.cat-tile--peach .cat-tile__glyph {
  color: #b25f31;
}

.cat-tile--sand {
  background: linear-gradient(145deg, var(--cream-deep), rgba(241, 231, 211, 0.4));
}

.cat-tile--sand .cat-tile__glyph {
  color: var(--ink-soft);
}

.cat-tile:hover {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.cat-tile:hover .cat-tile__glyph {
  transform: scale(1.08) rotate(-4deg);
}

.cat-tile.is-active {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 1px var(--terracotta);
  color: var(--terracotta-deep);
}

/* --- Панель фильтров --- */

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filters__main {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-field .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}

.search-field input {
  padding-left: 42px;
  border-radius: var(--r-pill);
}

.filters__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur) var(--ease);
}

.filters__toggle:hover {
  background: var(--peach-tint);
}

/* Счётчик применённых фильтров — как на Авито: видно, что фильтры
   включены, не открывая панель. */
.filters__count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--terracotta);
  color: #fff;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filters details > summary {
  list-style: none;
}
.filters details > summary::-webkit-details-marker {
  display: none;
}

.filters__panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Шапка со «Сбросить» и крестиком нужна только в полноэкранной шторке. */
.filters__head {
  display: none;
}

.filters__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-group {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.filter-group > legend {
  padding: 0;
  margin-bottom: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}

.filter-group__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-group__row input[type="text"] {
  flex: 1 1 220px;
  min-width: 0;
}

.filters__hint {
  margin: 8px 0 0;
  font-size: 0.83rem;
  color: var(--danger);
}

/* --- Чипсы выбора --- */

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

.chip {
  display: inline-flex;
  cursor: pointer;
}

/* Радиокнопка спрятана, а стилизуется соседний span: так состояние
   «выбрано» описывается обычным соседним селектором и работает
   без :has() — на старых мобильных браузерах тоже. */
.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chip__pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.chip__pill .icon {
  width: 16px;
  height: 16px;
  color: var(--sage-deep);
  transition: color var(--dur) var(--ease);
}

.chip:hover .chip__pill {
  border-color: var(--line-strong);
  background: var(--cream-deep);
}

.chip input:checked + .chip__pill {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fff;
  font-weight: 600;
}

.chip input:checked + .chip__pill .icon {
  color: #fff;
}

.chip input:focus-visible + .chip__pill {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

.filters__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* --- Результаты + переключатель вида --- */

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.results-bar h2 {
  margin: 0;
  font-size: 1.3rem;
}

.results-bar .meta {
  margin-left: 4px;
  font-weight: 500;
}

.view-switch {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--cream-deep);
  border-radius: var(--r-pill);
}

.view-switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.view-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* --- Сетка объявлений --- */

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

.listing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.listing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.listing-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--cream-deep);
  overflow: hidden;
}

.listing-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.listing-card:hover .listing-card__media img {
  transform: scale(1.04);
}

.listing-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
}

.listing-card__placeholder .icon {
  width: 40px;
  height: 40px;
  stroke-width: 1.4;
}

.listing-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 253, 247, 0.92);
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-xs);
}

.listing-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 18px;
  flex: 1;
}

.listing-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.03rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Заголовок карточки — обычный текст: терракота зарезервирована за
   действиями, иначе лента превращается в «стену ссылок». */
.listing-card__link,
.my-listing__title,
.conversation__title,
.chat__head-title {
  color: inherit;
}

.listing-card__link:hover,
.my-listing__title:hover,
.conversation__title:hover,
.chat__head-title:hover {
  color: var(--terracotta-deep);
}

.listing-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.listing-card__foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  color: var(--ink-faint);
  font-size: 0.8rem;
}

/* В узкой карточке район не должен выдавливать дату за край. */
.listing-card__place {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}

.listing-card__place span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-card__foot time {
  white-space: nowrap;
}

.listing-card--rejected {
  border-color: rgba(179, 64, 44, 0.35);
}

/* --- Страница объявления --- */

/* Раскладка страницы объявления. Области, а не просто две колонки:
   на мобильном порядок должен быть «заголовок → фото → автор и кнопка
   → описание», иначе кнопка «Написать автору» уезжает под всю страницу. */
/* --- Страница объявления ---
   Порядок блоков повторяет порядок решения: фото → «Даром» и название →
   кнопка → подробности. На широком экране фото и подробности идут слева
   одной колонкой, а «Даром» с кнопкой закрепляются справа. */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  grid-template-areas:
    "media lead"
    "body  lead";
  gap: 28px 32px;
  align-items: start;
}

.detail__media {
  grid-area: media;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail__lead {
  grid-area: lead;
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.detail__body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* --- Карусель фото --- */
.carousel {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--cream-deep);
  border: 1px solid var(--line);
}

.carousel__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

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

.carousel__counter {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: rgba(36, 28, 22, 0.62);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 253, 247, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: opacity var(--dur) var(--ease);
}

.carousel__nav--prev {
  left: 12px;
}

.carousel__nav--next {
  right: 12px;
}

.carousel__nav--next .icon {
  transform: rotate(180deg);
}

.carousel__nav:disabled {
  opacity: 0;
  pointer-events: none;
}

/* Стрелки — только там, где есть курсор: на телефоне листают пальцем. */
@media (hover: hover) and (min-width: 721px) {
  .carousel__nav {
    display: inline-flex;
  }
}

.carousel__thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.carousel__thumb {
  flex: none;
  width: 84px;
  height: 68px;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--cream-deep);
  padding: 0;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
  opacity: 0.72;
}

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

.carousel__thumb:hover {
  opacity: 1;
}

.carousel__thumb.is-active {
  border-color: var(--terracotta);
  opacity: 1;
}

.detail__no-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  background: var(--cream-deep);
  border: 1px dashed var(--line-strong);
  color: var(--ink-faint);
  font-size: 0.9rem;
}

/* --- Верхняя строка страницы объявления ---
   Возврат слева, второстепенные действия справа. Иконки без подписей: с
   подписями они весили бы столько же, сколько «Написать автору», а это
   разные по важности вещи. Смысл держится на title/aria-label. */
.detail__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.detail__topbar .back-link {
  margin-bottom: 0;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.tool-btn:hover {
  color: var(--terracotta-deep);
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
}

.tool-btn:active {
  transform: scale(0.92);
}

/* Активное избранное — закрашенное сердце: обводка того же цвета читается
   на маленьком размере хуже, чем заливка. */
.tool-btn--fav.is-active {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-tint);
}

.tool-btn--fav.is-active .icon {
  fill: currentColor;
}

/* «Скопировано» — короткая подсветка самой кнопки вместо отдельного тоста. */
.tool-btn.is-done {
  color: var(--sage-deep);
  border-color: var(--sage);
  background: var(--sage-tint);
}

/* --- Модальное окно (жалоба) --- */
.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(36, 28, 22, 0.5);
}

.modal__body {
  padding: 22px;
}

.modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.modal__title {
  margin: 0;
  font-size: 1.1rem;
}

.modal__close {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}

.modal__close:hover {
  background: var(--cream-deep);
}

.modal__lead {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* --- Главный блок: название, категория, действие ---
   Название — самый крупный элемент страницы: именно оно отвечает на вопрос
   «что это». Категория идёт подписью под ним, мелко. */
.detail__title {
  margin: 0;
  font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.detail__category {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.detail__category a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
}

.detail__category a:hover {
  color: var(--terracotta-deep);
}

.detail__category .icon {
  color: var(--sage-deep);
}

.detail__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.detail__fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail__fact .icon {
  color: var(--sage-deep);
}

.detail__action {
  margin-top: 20px;
}

.detail__author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: inherit;
}

.detail__author:hover .detail__author-name {
  color: var(--terracotta-deep);
}

.detail__author-chevron {
  margin-left: auto;
  flex: none;
  color: var(--ink-faint);
}

.detail__author-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail__author-name {
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail__author-meta {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* --- Подробности --- */
.detail__section-title {
  margin: 0 0 14px;
  font-size: 1.15rem;
}

/* Таблица характеристик.
   Название параметра и его значение раньше были одного веса и цвета, и
   строка «Состояние Новое» читалась как обрывок фразы. Разводим их тремя
   независимыми средствами сразу — цветом, насыщенностью и точечным
   отбоем между ними: одного цвета мало на светлом фоне, одного веса мало
   при коротких значениях. Отбой рисуется фоном у dt, а не «лидерами» из
   точек-символов: он тянется ровно до значения при любой длине. */
.specs {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.specs__row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.specs__row:first-child {
  padding-top: 0;
}

.specs__row:last-child {
  border-bottom: 0;
}

.specs dt {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  /* Точечный отбой: повторяющаяся точка в подложке, обрезанная по высоте
     строки. `white-space: nowrap` держит название в одну строку — иначе
     точки уезжают под перенос. */
  white-space: nowrap;
  overflow: hidden;
}

.specs dt::after {
  content: "";
  display: inline-block;
  width: 100%;
  margin-left: 8px;
  vertical-align: middle;
  border-bottom: 1px dotted var(--line-strong);
}

.specs dd {
  flex: 0 1 auto;
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

.detail__description {
  font-size: 1.02rem;
  line-height: 1.65;
  position: relative;
}

.detail__description p:last-child {
  margin-bottom: 0;
}

.detail__description.is-clamped {
  max-height: 260px;
  overflow: hidden;
  /* Текст не обрывается ступенькой, а растворяется — видно, что он длиннее. */
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.detail__more {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--terracotta-deep);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

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

.detail__address {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--ink);
  font-weight: 500;
}

.detail__address .icon {
  flex: none;
  color: var(--sage-deep);
}

.detail__address--metro {
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-weight: 400;
}

/* --- Закреплённая панель действия (мобильный) ---
   Только кнопка, во всю ширину: панель существует ровно затем, чтобы
   «Написать» всегда было под большим пальцем. Фон полупрозрачный с
   размытием — под панелью видно, что страница продолжается. */
.detail-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: none;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  /* Первое правило — запасное: браузер без color-mix берёт плотный фон. */
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  animation: detail-bar-in 0.22s var(--ease) both;
}

@keyframes detail-bar-in {
  from {
    transform: translateY(100%);
  }
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.notice .icon {
  flex: none;
  margin-top: 2px;
}

.notice--info {
  background: var(--sage-tint);
  color: var(--sage-deep);
}

.disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  list-style: none;
  padding: 6px 0;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary:hover {
  color: var(--ink);
}

.disclosure[open] > summary {
  margin-bottom: 12px;
}

/* --- Лайтбокс --- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(36, 28, 22, 0.86);
  backdrop-filter: blur(4px);
}

.lightbox.is-open {
  display: flex;
  animation: fade-in 0.2s var(--ease);
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--r-md);
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.28);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* --- Форма объявления: фото --- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  display: block;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--dur) var(--ease), filter var(--dur) var(--ease);
}

/* Крестик удаления в углу карточки.
   У уже загруженного фото (photo-item--existing) это подпись к скрытому
   чекбоксу — работает без скрипта; у только что выбранного
   (photo-item--new) настоящая кнопка, её вешает listing-form.js. Вид у
   них общий: разное поведение внутри, одинаковый жест снаружи. */
.photo-item__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(36, 28, 22, 0.62);
  color: #fff;
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.photo-item__remove svg {
  width: 15px;
  height: 15px;
}

.photo-item__remove:hover {
  background: var(--danger);
}

.photo-item__remove:active {
  transform: scale(0.88);
}

/* Подпись «удалим при сохранении» видна только у отмеченного фото —
   до отметки объяснять нечего. */
.photo-item__mark {
  position: absolute;
  inset: auto 0 0 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

.photo-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.photo-item:has(input:checked) img {
  opacity: 0.35;
  filter: grayscale(1);
}

.photo-item:has(input:checked) {
  border-color: var(--danger);
}

.photo-item:has(input:checked) .photo-item__mark {
  display: flex;
}

.photo-item:has(input:checked) .photo-item__remove {
  background: var(--danger);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--cream-deep);
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.dropzone:hover,
.dropzone.is-hot {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
  color: var(--terracotta-deep);
}

.dropzone .icon {
  color: var(--sage-deep);
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone strong {
  font-weight: 600;
  color: var(--ink);
}

/* --- Мастер создания объявления ------------------------------------------
   Базовые стили описывают форму БЕЗ скрипта: все шаги видны подряд, кнопка
   «Опубликовать» одна. Режим «по одному шагу» включает JS, добавляя классы
   is-wizard / is-active — если скрипт не отработал, форма остаётся рабочей.
   -------------------------------------------------------------------------- */

.wizard {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.wizard__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.wizard__quit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border-radius: var(--r-pill);
  color: var(--ink);
  flex: none;
  touch-action: manipulation;
}

.wizard__quit:hover {
  background: var(--cream-deep);
  color: var(--ink);
}

.wizard__step-label {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 500;
}

.wizard__back {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.wizard__back:hover {
  background: var(--cream-deep);
  color: var(--ink);
}

.wizard__progress {
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--cream-deep);
  overflow: hidden;
}

.wizard__progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--terracotta);
  transition: width 0.25s var(--ease);
}

.wizard__draft {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--cream-deep);
  border: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.wizard__draft .icon {
  margin-top: 1px;
  color: var(--sage-deep);
  flex: none;
}

.wizard__draft-clear {
  margin-left: auto;
  flex: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}

.wizard__draft-clear:hover {
  color: var(--ink);
}

.wizard__step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wizard__title {
  margin: 0;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  letter-spacing: -0.02em;
}

.wizard__lead {
  margin: -6px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.wizard__error {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Подсказка про лимит фото. Выглядит как ошибка, но классом с ней не
   совпадает намеренно: по `form-field__error` мастер ищет шаг, на котором
   сервер вернул ошибку (см. listing-form.js). */
.photo-hint {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
}

.wizard__foot {
  display: flex;
  gap: 10px;
}

.wizard__foot .btn {
  flex: 1;
}

/* Включается скриптом: видно только текущий шаг. */
.wizard.is-wizard .wizard__step {
  display: none;
}

.wizard.is-wizard .wizard__step.is-active {
  display: flex;
}

/* --- Список вариантов (категория, состояние) --- */

.option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: block;
  cursor: pointer;
}

.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.option__body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.option:hover .option__body {
  border-color: var(--line-strong);
  background: var(--cream-deep);
}

.option__icon {
  display: inline-flex;
  flex: none;
  color: var(--sage-deep);
}

.option__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.option__name {
  font-weight: 600;
  font-size: 0.98rem;
}

.option__hint {
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.35;
}

/* Кружок-отметка справа, как в списках выбора на мобильных. */
.option__mark {
  flex: none;
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong);
  position: relative;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.option input:checked + .option__body {
  border-color: var(--terracotta);
  background: var(--terracotta-tint);
}

.option input:checked + .option__body .option__mark {
  border-color: var(--terracotta);
  background: var(--terracotta);
}

.option input:checked + .option__body .option__mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.option input:focus-visible + .option__body {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

/* --- Адрес с подсказками --- */

.address-field {
  position: relative;
}

.address-suggest {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: 100%;
  margin: 4px 0 0;
  padding: 6px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.address-suggest li {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.92rem;
}

.address-suggest li:hover,
.address-suggest li.is-highlighted {
  background: var(--cream-deep);
}

.address-suggest__hint {
  display: block;
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin-top: 2px;
}

.address-picked {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
  font-size: 0.88rem;
  color: var(--sage-deep);
  font-weight: 500;
}

/* --- Авторизация --- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 40px;
  align-items: center;
  padding-block: 24px;
}

.auth__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  width: 100%;
  margin-inline: auto;
}

.auth__card h1 {
  margin-bottom: 6px;
}

.auth__lead {
  color: var(--ink-soft);
  margin-bottom: 24px;
}

.auth__aside {
  text-align: center;
}

.auth__aside img {
  width: min(280px, 70%);
  margin: 0 auto 20px;
}

.auth__aside blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  max-width: 26ch;
  margin-inline: auto;
}

.auth__aside p {
  color: var(--ink-soft);
  max-width: 32ch;
  margin: 10px auto 0;
  font-size: 0.94rem;
}

.auth__foot {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
}

/* --- Публичная витрина пользователя (/user/<id>/) ---
   Горизонтальная карточка, а не центрированная как в личном кабинете:
   это заголовок чужой страницы, а не «вот вы», и ниже сразу идут вещи. */
.public-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.public-profile__text {
  min-width: 0;
}

.public-profile__name {
  margin: 0 0 4px;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);
  line-height: 1.2;
}

.public-profile__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.public-profile__meta .icon {
  color: var(--sage-deep);
}

.public-profile__edit {
  margin-left: auto;
}

/* --- Профиль --- */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.6fr);
  gap: 28px;
  align-items: start;
}

/* Колонки раскладок обязаны уметь сужаться: min-width:auto у grid-элемента
   иначе передаёт наружу min-content самого широкого содержимого. */
.profile-layout > *,
.detail > *,
.auth > * {
  min-width: 0;
}

/* Карточка «кто я»: аватар, имя, почта — по центру, как в мобильных
   приложениях. Всё остальное (форма, меню) выравнивается по левому краю. */
.profile-card {
  text-align: center;
}

.avatar-edit {
  margin-bottom: 22px;
}

.avatar-edit__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 14px 0 2px;
}

.profile-card__email {
  color: var(--ink-soft);
  font-size: 0.88rem;
  word-break: break-all;
  margin: 0;
}

/* Форму выравниваем обратно по левому краю: по центру читаются только
   аватар с почтой, а подпись поля и ошибка под ним — нет. */
.profile-card .form-field {
  text-align: left;
}

.profile-card__avatar-remove {
  margin-top: 14px;
}

.avatar-edit__hint {
  margin-bottom: 12px;
  color: var(--sage-deep);
  font-weight: 500;
}

.profile-card__limit {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  text-align: left;
  margin: -8px 0 16px;
}

.profile-card__limit .icon {
  flex: none;
  margin-top: 2px;
  color: var(--ink-faint);
}

/* Аватар как кнопка: клик по фото и открывает выбор файла. Отдельное поле
   «Обзор…» под формой ради одной картинки — лишний элемент интерфейса. */
.avatar-edit__target {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: var(--r-pill);
}

/* Фокус рисуем на аватарке: сам input прозрачный, и без этого при ходьбе
   по табам не видно, где ты находишься. */
.avatar-edit__target:focus-within .avatar {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

.avatar-edit__target .avatar {
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.avatar-edit__target:hover .avatar {
  box-shadow: 0 0 0 1px var(--terracotta), var(--shadow-md);
  transform: translateY(-1px);
}

.avatar-edit__badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--terracotta);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}

.avatar-edit__badge .icon {
  color: #fff;
  width: 15px;
  height: 15px;
}

.avatar-edit__target:hover .avatar-edit__badge {
  transform: scale(1.08);
}

/* Нативный input растянут поверх аватарки и полностью прозрачен: система
   рисует «Выберите файл» своим шрифтом и своей кнопкой, что выбивается из
   вёрстки, а так на экране остаётся только аватар. Поле при этом настоящее
   и кликают именно по нему — посредника-label нет намеренно, см.
   profile.html. Не display:none и не visually-hidden: скрытое поле часть
   мобильных браузеров отказывается открывать. */
.avatar-edit__field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  /* Гасим общее оформление input[type=file] из блока форм. */
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  font-size: 0;
}

/* Текстовая кнопка без рамки — для второстепенных действий вроде
   «Убрать фото», где полноценная кнопка перетянула бы внимание. */
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.87rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.link-btn:hover {
  color: var(--terracotta);
  text-decoration-color: currentColor;
}

/* --- Меню аккаунта --- */

.account-menu {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.account-menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  background: none;
  border: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

/* Разделители между пунктами. Один из пунктов обёрнут в <form> (выход —
   это POST, а не ссылка), поэтому граница вешается на прямых детей меню,
   а не на сами пункты. */
.account-menu > * + * {
  border-top: 1px solid var(--line);
}

.account-menu__item:hover {
  background: var(--cream-deep);
}

/* Иконка в подложке-кружке: так строки читаются как список действий, а не
   как текст со значками. */
.account-menu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--sage-tint);
}

.account-menu__icon .icon {
  color: var(--sage-deep);
}

.account-menu__label {
  flex: 1;
  min-width: 0;
}

.account-menu__chevron {
  flex: none;
  color: var(--ink-faint);
  transition: transform var(--dur) var(--ease);
}

.account-menu__item:hover .account-menu__chevron {
  transform: translateX(2px);
}

.account-menu__item--danger {
  color: var(--danger);
}

.account-menu__item--danger .account-menu__icon {
  background: var(--danger-tint);
}

.account-menu__item--danger .account-menu__icon .icon,
.account-menu__item--danger .account-menu__chevron {
  color: var(--danger);
}

.account-menu__item--danger:hover {
  background: var(--danger-tint);
}

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

.my-listing {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.my-listing:hover {
  box-shadow: var(--shadow-sm);
  border-color: transparent;
}

.my-listing__thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--cream-deep);
  flex: none;
}

.my-listing__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
}

.my-listing__body {
  min-width: 0;
  flex: 1;
}

.my-listing__title {
  font-weight: 600;
  color: var(--ink);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-listing__title::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* --- Чат: список --- */

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

.conversation {
  position: relative;
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.conversation:hover {
  box-shadow: var(--shadow-sm);
  border-color: transparent;
  transform: translateY(-1px);
}

/* Непрочитанное подсвечиваем самой строкой, а не только счётчиком: взгляд
   ловит пятно раньше, чем цифру. */
.conversation.is-unread {
  background: var(--terracotta-tint);
  border-color: rgba(214, 105, 47, 0.28);
}

.conversation__thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--cream-deep);
  flex: none;
}

.conversation__thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
}

.conversation__body {
  flex: 1;
  min-width: 0;
}

/* Имя и время в одной строке: время прижато вправо и не сжимается, имя
   занимает остаток и обрезается многоточием. */
.conversation__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.conversation__title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.97rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ссылка растянута на всю карточку: нажимать нужно в строку, а не в текст. */
.conversation__title::after {
  content: "";
  position: absolute;
  inset: 0;
}

.conversation__time {
  flex: none;
  font-size: 0.76rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.conversation__listing {
  margin: 1px 0 0;
  font-size: 0.83rem;
  color: var(--sage-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation__bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}

.conversation__preview {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation__preview .icon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  color: var(--sage-deep);
}

.conversation__unread {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--terracotta);
  color: #fff;
  font-size: 0.73rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Чат: диалог ---
   На десктопе это карточка внутри страницы. На мобильном (см. .chat-screen
   в разделе адаптива) — отдельный экран во всю высоту: шапка сайта, подвал
   и таббар прячутся, и вся высота достаётся переписке. Раньше окно
   сообщений было зажато между всей обвязкой и на телефоне оставалось щелью
   на две реплики. */

.chat {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-h) - 110px);
  min-height: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}

/* Кнопка «назад» заменяет ссылку «Все диалоги» над карточкой: на отдельном
   экране выход должен быть в самом экране, а не над ним. */
.chat__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-pill);
  color: var(--ink);
  transition: background var(--dur) var(--ease);
}

.chat__back:hover {
  background: var(--cream-deep);
}

/* Вся шапка — ссылка на объявление: отдельная кнопка «посмотреть» съедала
   место ради того, что и так очевидно по фото и названию. */
.chat__head-main {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  color: inherit;
  transition: background var(--dur) var(--ease);
}

.chat__head-main:hover {
  background: var(--cream-deep);
}

.chat__listing-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--cream-deep);
  flex: none;
}

.chat__listing-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
}

.chat__head-body {
  min-width: 0;
  flex: 1;
  display: block;
}

.chat__head-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.97rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.chat__head-sub {
  display: block;
  font-size: 0.81rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--cream);
  scroll-behavior: smooth;
}

/* Короткая переписка прижимается к полю ввода, а не висит вверху пустого
   окна. Через auto-отступ первого элемента, а не justify-content: flex-end —
   тот ломает прокрутку к началу, когда сообщений много. */
.chat__messages > :first-child {
  margin-top: auto;
}


.msg {
  max-width: min(72%, 520px);
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  align-self: flex-start;
  animation: msg-in 0.22s var(--ease) both;
  overflow-wrap: anywhere;
}

.msg[data-mine="1"] {
  align-self: flex-end;
  background: var(--terracotta);
  border-color: transparent;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg:not([data-mine="1"]) {
  border-bottom-left-radius: 6px;
}

.msg__author {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 3px;
}

.msg__text {
  white-space: pre-wrap;
}

.msg__status {
  display: block;
  text-align: right;
  font-size: 0.7rem;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.75);
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* --- Событие договорённости в ленте переписки ---
   Не «чьё-то» сообщение: у события нет стороны, оно одинаково для обоих.
   Поэтому по центру, без хвостика и без пометки «прочитано». */

.msg-system {
  align-self: center;
  max-width: min(88%, 560px);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--sage-tint);
  color: var(--sage-deep);
  font-size: 0.86rem;
  font-weight: 500;
  text-align: left;
  animation: msg-in 0.22s var(--ease) both;
  overflow-wrap: anywhere;
}

.msg-system .icon {
  flex: none;
  margin-top: 2px;
}

/* Закрытие сделки — заметнее прочих событий: это конец истории. */
.msg-system[data-event="handover_done"] {
  background: var(--terracotta-tint);
  color: var(--terracotta);
}

.msg-system[data-event="listing_taken"],
.msg-system[data-event="reservation_cancelled"],
.msg-system[data-event="reservation_declined"] {
  background: var(--cream-deep);
  color: var(--ink-soft);
}

/* --- Панель договорённости ---
   Одна строка над полем ввода: состояние слева, действия справа. Нажимают
   её один раз за всю жизнь диалога, поэтому места она занимать не должна —
   раньше блок с пояснением съедал треть экрана переписки. */

.deal {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: var(--cream-deep);
  font-size: 0.88rem;
}

/* Пустая панель (нечего показывать) не должна оставлять полосу. */
.deal:empty {
  display: none;
}

.deal__state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  font-weight: 500;
  color: var(--ink);
}

.deal__state > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal__state .icon {
  flex: none;
  color: var(--sage-deep);
}

.deal__state--active,
.deal__state--active .icon,
.deal__state--done,
.deal__state--done .icon {
  color: var(--terracotta);
}

/* Ожидание ответа — требует действия, поэтому не приглушаем. */
.deal__state--pending,
.deal__state--pending .icon {
  color: var(--sage-deep);
}

.deal__state--muted {
  color: var(--ink-soft);
}

.deal__state--muted .icon {
  color: var(--ink-faint);
}

.deal__actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.chat__composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}

.chat__composer input {
  border-radius: var(--r-pill);
  /* 16px, а не мельче: при меньшем размере Safari на iOS при фокусе
     насильно зумит страницу, и человек оказывается в увеличенной вёрстке
     без возможности вернуться. */
  font-size: 16px;
  padding: 10px 16px;
}

.chat__empty {
  margin: auto;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
  max-width: 34ch;
}

.chat__empty img {
  width: 130px;
  margin: 0 auto 12px;
}

.chat__banner {
  display: none;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 9px;
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 500;
}

.chat__banner.is-visible {
  display: flex;
}

/* ---------- 6. Адаптив --------------------------------------------------- */

@media (max-width: 960px) {
  .detail {
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "lead"
      "body";
    gap: 20px;
  }

  /* Карточка перестаёт быть карточкой: на узком экране «Даром» с кнопкой
     идут прямо по странице, без рамки и лишних отступов. */
  .detail__lead {
    position: static;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .detail-bar.is-visible {
    display: flex;
  }

  /* Чтобы закреплённая панель не накрывала последний блок страницы. */
  .detail__body {
    padding-bottom: 72px;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .auth {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .auth__aside {
    order: -1;
  }

  .auth__aside img {
    width: 150px;
    margin-bottom: 12px;
  }

  .auth__aside blockquote {
    font-size: 1.1rem;
  }

  .auth__aside p {
    display: none;
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 60px;
  }

  body {
    padding-bottom: 68px; /* место под нижнюю навигацию */
  }

  .site-nav {
    display: none;
  }

  .tabbar {
    display: block;
  }

  /* Логотип ужимается, но остаётся: бренд должен запоминаться, поэтому
     поиск делит строку с ним, а не вытесняет его. */
  .logo img {
    height: 30px;
  }

  .logo__text {
    font-size: 1.02rem;
  }

  .logo__tagline {
    display: none;
  }

  .header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
    padding: 8px 14px;
    border-radius: var(--r-pill);
    background: var(--surface);
    border: 1px solid var(--line);
  }

  .header-search .icon {
    flex: none;
    color: var(--ink-faint);
  }

  .header-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    padding: 0;
    background: none;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--ink);
  }

  .header-search input:focus {
    outline: none;
  }

  .header-search:focus-within {
    border-color: var(--terracotta);
  }

  /* Поиск переехал в шапку — дублировать его в ленте не нужно. Поле
     остаётся в DOM (display:none), поэтому запрос не теряется, когда
     пользователь применяет фильтры. */
  .filters__main {
    display: none;
  }

  /* Фильтры разворачиваются во весь экран: на телефоне выбирать
     категорию удобнее на отдельном экране, а не в подпанели, которая
     толкает ленту вниз. Основа — обычный <details>, поэтому без JS
     панель всё равно раскрывается, просто внутри страницы. */
  .filters__details[open] .filters__panel {
    position: fixed;
    inset: 0;
    z-index: 80;
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
  }

  .filters__details[open] .filters__head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    /* Верхний отступ учитывает вырез/чёлку: иначе крестик оказывается
       вплотную к краю экрана и по нему тяжело попасть. */
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    border-bottom: 1px solid var(--line);
  }

  /* Место под крестик: сам крестик — это <summary>, он выведен из потока
     фиксированным позиционированием, поэтому в шапке нужна распорка,
     чтобы заголовок остался по центру. */
  .filters__head-spacer {
    width: 44px;
    flex: none;
  }

  /* Крестик = <summary>. Закрытие работает нативно, без JS: раньше оно
     висело на обработчике, и если скрипт не отрабатывал, шторка (она
     раскрывается чистым CSS) переставала закрываться вовсе. */
  .filters__details[open] > .filters__toggle {
    position: fixed;
    z-index: 81;
    top: env(safe-area-inset-top, 0px);
    left: 0;
    display: flex;
    width: 44px;
    height: 52px;
    padding: 0;
    margin: 0;
    background: none;
    border-radius: 0;
    touch-action: manipulation;
  }

  /* Прячем «Фильтры», иконку и счётчик — на их месте рисуется крестик. */
  .filters__details[open] > .filters__toggle > * {
    display: none;
  }

  .filters__details[open] > .filters__toggle::before,
  .filters__details[open] > .filters__toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
  }

  .filters__details[open] > .filters__toggle::before {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .filters__details[open] > .filters__toggle::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .filters__head-title {
    flex: 1;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
  }

  .filters__reset {
    color: var(--terracotta-deep);
    font-size: 0.9rem;
    font-weight: 600;
  }

  .filters__details[open] .filters__body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 14px 20px;
    gap: 22px;
  }

  .filters__details[open] .filters__foot {
    flex: none;
    margin: 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  /* На узком экране кнопка «Показать» — главное действие, дублирующий
     «Сбросить» уже есть в шапке шторки. */
  .filters__foot .btn--primary {
    flex: 1;
  }

  .filters__foot-reset {
    display: none;
  }

  /* Пока шторка открыта, страница под ней не должна прокручиваться. */
  body.filters-open {
    overflow: hidden;
  }

  .page {
    padding-block: 20px 32px;
  }

  .container {
    padding-inline: 16px;
  }

  /* Фото раскрываются во всю ширину экрана — на телефоне галерея и есть
     первый экран, рамка и поля только съедают её. Отступ повторяет
     padding контейнера выше, поэтому меняются они вместе. */
  .carousel {
    margin-inline: -16px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .card {
    padding: 18px;
    border-radius: var(--r-md);
  }

  .alerts {
    top: auto;
    bottom: 78px;
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .hero {
    padding: 13px 14px 14px;
    border-radius: var(--r-lg);
    margin-bottom: 12px;
  }

  .hero__mascot {
    height: 38px;
    margin-bottom: 2px;
  }

  /* Третий маркер переносил строку на второй ряд — на десктопе он
     остаётся, здесь важнее уместить категории в первый экран. */
  .hero__trust li:nth-child(3) {
    display: none;
  }

  .hero h1 {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  .hero p {
    max-width: none;
    font-size: 0.85rem;
    margin-bottom: 11px;
  }

  /* Крупные глифы на узком экране лезут под текст — оставляем только
     угловые, помельче. */
  .hero__glyph--5,
  .hero__glyph--6 {
    display: none;
  }

  .hero__glyph--1 { width: 62px; height: 62px; left: -2%; top: 8%; }
  .hero__glyph--2 { width: 46px; height: 46px; left: 4%; bottom: 6%; }
  .hero__glyph--3 { width: 54px; height: 54px; right: -1%; top: 10%; }
  .hero__glyph--4 { width: 48px; height: 48px; right: 5%; bottom: 5%; }

  .hero__actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  /* Иерархия вместо двух равных кнопок: основная — во всю ширину,
     «Отдать вещь» рядом не конкурирует, а читается как второй шаг. */
  .hero__cta {
    width: 100%;
    padding: 11px 16px;
    font-size: 0.94rem;
  }

  .hero__cta-alt {
    --btn-bg: transparent;
    --btn-bd: transparent;
    --btn-fg: var(--terracotta-deep);
    width: 100%;
    padding: 7px 12px;
    font-size: 0.88rem;
    box-shadow: none;
  }

  .hero__cta-alt:hover {
    --btn-bg: transparent;
  }

  .hero__trust {
    margin-top: 8px;
    gap: 3px 12px;
    font-size: 0.73rem;
  }

  .hero__trust .icon {
    width: 14px;
    height: 14px;
  }

  .categories__title {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  /* Лента уходит под края экрана: обрезанная плитка справа — сигнал,
     что блок листается. Боковой отступ живёт на самих рядах, а не на
     скроллере: у ряда ширина max-content, и padding контейнера его не
     удерживает — первая плитка прилипала к краю экрана. */
  .categories__scroller {
    gap: 8px;
    margin-inline: -16px;
    /* Без scroll-padding привязка (scroll-snap-align: start) подтягивает
       первую плитку вплотную к краю скроллпорта и гасит отступ ряда. */
    scroll-padding-inline: 16px;
    scrollbar-width: none;
  }

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

  .categories__row {
    gap: 8px;
    padding-inline: 16px;
  }

  .categories__row > li {
    min-width: 96px;
    max-width: 140px;
  }

  .cat-tile {
    height: 88px;
    padding: 10px 12px;
  }

  .cat-tile__name {
    font-size: 0.8rem;
  }

  .cat-tile__glyph {
    width: 34px;
    height: 34px;
  }

  .listing-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

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

  .listing-card__title {
    font-size: 0.95rem;
  }

  .map {
    height: 320px;
  }

  /* --- Диалог на телефоне: отдельный экран во всю высоту ---
     Переписке нужна высота, а не рамка вокруг. Поэтому на странице диалога
     прячем всю обвязку сайта: шапку, подвал и таббар. Выход — стрелкой в
     шапке самого диалога, она же заменяет ссылку «Все диалоги».
     Тот же приём у любого мессенджера и у Авито: пока читаешь переписку,
     навигация по сайту не нужна и только отнимает экран. */
  .chat-screen .site-header,
  .chat-screen .site-footer,
  .chat-screen .tabbar {
    display: none;
  }

  /* Диалог прижат к вьюпорту через position:fixed, а не через высоту в
     vh/dvh. Единицы вьюпорта на мобильных браузерах меряют разное: у vh
     это «большой» вьюпорт без адресной строки (страница получалась выше
     экрана и прокручивалась), у dvh — в Яндекс.Браузере наоборот меньше
     видимой области, и под полем ввода оставалась пустая полоса.

     inset:0 у fixed-элемента отмеряется по тому же вьюпорту, которым
     браузер пользуется для собственных панелей, поэтому совпадает с
     экраном при любом положении адресной строки. Заодно при открытии
     клавиатуры Android ужимает этот вьюпорт — и поле ввода само
     поднимается над ней. */
  .chat-screen {
    overflow: hidden;
    /* Гасим «оттягивание» экрана за край — вместе с ним уезжала вёрстка. */
    overscroll-behavior: none;
  }

  .chat-screen .page {
    padding: 0;
  }

  .chat-screen .chat-shell {
    padding: 0;
    max-width: none;
  }

  .chat-screen .chat {
    position: fixed;
    inset: 0;
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    z-index: 5;
  }

  /* Уведомления на этом экране висят поверх, а не раздвигают переписку. */
  .chat-screen .alerts {
    position: fixed;
    inset: 8px 8px auto;
    z-index: 60;
  }

  /* Поле ввода не должно уезжать под жестовую полосу iPhone/Android. */
  .chat-screen .chat__composer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .chat__head {
    padding-top: max(9px, env(safe-area-inset-top));
  }

  .msg {
    max-width: 84%;
  }

  .chat__head .btn__label {
    display: none;
  }

  .btn--lg {
    padding: 12px 20px;
    font-size: 0.97rem;
  }

  .form-actions .btn {
    flex: 1;
  }
}

/* На узких экранах лента остаётся в две колонки — так за экран видно
   вчетверо больше вещей; в одну сваливаемся только на совсем узких. */
@media (max-width: 330px) {
  .listing-grid {
    grid-template-columns: 1fr;
  }
}

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

@media print {
  .site-header,
  .site-footer,
  .tabbar,
  .alerts,
  .filters,
  .btn {
    display: none !important;
  }
}
