:root {
    --accent: #f4511e;
    --accent-dark: #d93f10;
    --text: #17181c;
    --muted: #7a7f8a;
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e6e8ec;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 22, 28, .06), 0 8px 24px rgba(20, 22, 28, .06);
    --max: 1180px;
}

* { box-sizing: border-box; }

html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    padding-bottom: 64px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 16px;
}

.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.hidden { display: none; }

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

.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
    overflow: visible;
}

.header__inner {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 68px;
    overflow: visible;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--accent);
}

.logo--small { font-size: 20px; }

.city-picker { position: relative; flex-shrink: 0; }

.city-picker[open] {
    z-index: 100;
}

.city-picker summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    white-space: nowrap;
    font-size: 15px;
}

.city-picker summary::-webkit-details-marker { display: none; }
.city-picker summary::after { content: " ▾"; color: var(--muted); }

.city-picker--compact summary {
    padding: 7px 12px;
    font-size: 14px;
    border-radius: 999px;
    background: var(--bg);
}

.city-picker__menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    min-width: 200px;
    max-height: 320px;
    overflow: auto;
    padding: 6px;
    z-index: 100;
}

/* Мостик без зазора — иначе меню закрывается до клика (десктоп) */
.city-picker__menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
}

.city-picker__menu a {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 15px;
}

.city-picker__menu a:hover { background: var(--bg); }

.search {
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

.search input {
    flex: 1;
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--bg);
}

.search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
}

.search button {
    padding: 11px 14px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.search button:hover { background: var(--accent-dark); }

.header__nav {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 15px;
    white-space: nowrap;
    flex-shrink: 0;
}

.desktop-nav {
    display: none;
}

@media (min-width: 721px) {
    .desktop-nav {
        display: block;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }

    .desktop-nav__inner {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 0 16px 10px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .desktop-nav__inner::-webkit-scrollbar {
        display: none;
    }

    .desktop-nav__item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 500;
        color: var(--muted);
        white-space: nowrap;
        transition: background .15s, color .15s;
    }

    .desktop-nav__item:hover {
        color: var(--text);
        background: var(--bg);
    }

    .desktop-nav__item.is-active {
        color: var(--accent);
        background: rgba(244, 81, 30, 0.08);
    }
}

.badge {
    background: var(--accent);
    color: #fff;
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 12px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    background: none;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    transition: background .15s, border-color .15s, color .15s;
}

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); color: #fff; }
.btn--whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn--whatsapp:hover { background: #1da851; color: #fff; }
.btn--ghost { border-color: var(--border); background: var(--surface); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger { background: #fdecea; color: #c62828; }
.btn--danger:hover { background: #fbdbd7; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 12px; font-size: 14px; }

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font-size: 15px;
    cursor: pointer;
}

/* ---------- Сообщения ---------- */

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin: 16px 0 0;
    font-size: 15px;
}

.alert--success { background: #e8f5e9; color: #256029; }
.alert--error { background: #fdecea; color: #b3261e; }
.alert--warning { background: #fff4e5; color: #8a5300; }
.alert--info { background: #e8f1fe; color: #1a4fa0; }

/* ---------- Контент ---------- */

.main { padding: 22px 16px 40px; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 14px;
}

.section-head h1 { font-size: 26px; }
.section-head h2 { font-size: 21px; }
.subhead { font-size: 18px; margin: 26px 0 12px; }

.categories-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.categories-strip::-webkit-scrollbar { display: none; }

.categories-strip a {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    white-space: nowrap;
}

.categories-strip a:hover { border-color: var(--accent); }

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

body.page-home .main.app-main {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
}

.home-top.profile-top {
    display: block;
    padding-bottom: 12px;
}

.search-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: visible;
}

.search-bar:focus-within {
    border-color: var(--accent);
    background: var(--surface);
}

.city-picker--inline {
    position: relative;
    flex: 0 0 auto;
    max-width: 38%;
}

.city-picker--inline summary {
    display: flex;
    align-items: center;
    height: 100%;
    min-height: 46px;
    padding: 0 10px 0 12px;
    margin: 0;
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.city-picker--inline summary::after {
    flex: 0 0 auto;
    margin-left: 2px;
}

.city-picker--inline .city-picker__menu {
    left: 0;
    min-width: 200px;
}

.search-bar__input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: none;
    background: transparent;
    font-size: 16px;
}

.search-bar__input:focus {
    outline: none;
}

.home-meta {
    margin: 0 0 10px;
    font-size: 14px;
}

.home-content .categories-strip {
    margin-bottom: 12px;
}

.home-other-cities {
    margin-top: 28px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.home-other-cities__title {
    margin: 0 4px 4px;
    font-size: 18px;
    font-weight: 700;
}

.home-other-cities__hint {
    margin: 0 4px 14px;
}

.home-toolbar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.sort-picker {
    position: relative;
}

.sort-picker__btn {
    list-style: none;
    cursor: pointer;
    padding: 4px 0;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    -webkit-tap-highlight-color: transparent;
}

.sort-picker__btn::-webkit-details-marker {
    display: none;
}

.sort-picker__btn::after {
    content: " ▾";
    font-size: 11px;
}

.sort-picker[open] .sort-picker__btn {
    color: var(--accent);
}

.sort-picker__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    z-index: 40;
    min-width: 168px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 6px;
}

.sort-picker__menu a {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
}

.sort-picker__menu a:hover,
.sort-picker__menu a.is-active {
    background: var(--bg);
    color: var(--accent);
}

.search-top {
    align-items: flex-start;
}

.category-top {
    align-items: flex-start;
}

/* ---------- Страница категории (обложка как в iOS) ---------- */

.category-hero {
    position: relative;
    background: var(--bg);
}

.category-hero__cover {
    position: relative;
    height: 220px;
    width: 100%;
    overflow: hidden;
}

.category-hero__body {
    position: relative;
    margin-top: -36px;
    padding: 0 16px 16px;
    z-index: 2;
}

.category-hero__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    font-size: 34px;
    line-height: 1;
}

.category-hero__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.category-hero__desc {
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.45;
    color: var(--muted);
}

.category-hero__meta {
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.category-hero__subscribe {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.category-subscribe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.category-subscribe svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.category-subscribe--tg {
    background: rgba(41, 122, 235, 0.12);
    color: #297aeb;
}

.category-subscribe--wa {
    background: rgba(30, 158, 78, 0.12);
    color: #1e9e4e;
}

.category-subscribe:active {
    transform: scale(0.98);
}

body.page-category .header.app-bar {
    display: none;
}

body.page-category .profile-content {
    padding-top: 8px;
}

body.page-search .main.app-main {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
}

@media (min-width: 721px) {
    body.page-search .main.app-main {
        padding-bottom: 24px;
    }

    body.page-search .profile-content {
        max-width: var(--max);
        margin: 0 auto;
        padding: 16px;
    }
}

@media (min-width: 721px) {
    body.page-home .main.app-main {
        padding-bottom: 24px;
    }

    .home-content.profile-content {
        max-width: var(--max);
        margin: 0 auto;
        padding: 16px;
    }
}

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

.chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 14px;
}

.chip:hover { border-color: var(--accent); }

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 8px;
}

.breadcrumbs a::after { content: " /"; color: var(--border); }

/* ---------- Сетка карточек ---------- */

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

.card {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(20, 22, 28, .12); }

.card__image {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card__image img { width: 100%; height: 100%; object-fit: cover; }
.card__noimage { color: var(--muted); font-size: 14px; }

/* Главная: квадратные превью, фото целиком в зоне */
body.page-home .card__image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

body.page-home .card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.card__count {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 8px;
}

.card__body { padding: 12px 14px 14px; }
.card__price { font-size: 18px; font-weight: 700; }
.card__title { font-size: 15px; font-weight: 500; margin: 4px 0 6px; }
.card__meta, .card__date { font-size: 13px; color: var(--muted); }

.card__fav {
    position: absolute;
    top: 8px;
    right: 8px;
}

.card__fav button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .92);
    color: var(--muted);
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.card__fav button.is-active { color: var(--accent); }

.empty {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.empty p { color: var(--muted); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 28px 0 0;
}

.pagination a {
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.pagination__current { color: var(--muted); font-size: 14px; }

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

.cat-columns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.cat-block {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.cat-block h2 { font-size: 17px; margin-bottom: 10px; }
.cat-block ul { list-style: none; margin: 0; padding: 0; }
.cat-block li { padding: 5px 0; font-size: 15px; color: var(--muted); }
.cat-block li a:hover { color: var(--accent); }

/* ---------- Карточка объявления ---------- */

.ad-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
    margin-top: 14px;
}

.ad-main {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.gallery {
    position: relative;
    max-width: 100%;
}

.gallery__viewport {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    background: #eef0f3;
    border-radius: 12px;
    width: 100%;
    aspect-ratio: 4 / 3;
}

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

/* Слайды — прямые flex-дети viewport (Chromium / Яндекс.Браузер) */
.gallery__track {
    display: contents;
}

.gallery__slide {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.gallery__open {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

.gallery__open img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.gallery__counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
}

.gallery--empty {
    background: #eef0f3;
    border-radius: 12px;
    aspect-ratio: 16 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.gallery__thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 10px;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.gallery__thumbs button {
    flex: 0 0 auto;
    width: 84px;
    height: 64px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: none;
}

.gallery__thumbs button.is-active { border-color: var(--accent); }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }

.ad-title { font-size: 24px; margin-top: 18px; }
.ad-price { font-size: 30px; font-weight: 800; margin: 10px 0; }

.ad-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 14px;
    color: var(--muted);
    padding-bottom: 6px;
}

.ad-description { margin-top: 20px; }
.ad-description h2 { font-size: 18px; margin-bottom: 8px; }
.ad-description p { margin: 0; white-space: pre-line; }

.ad-page-foot {
    margin: 8px 12px 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    text-align: center;
}

.ad-page-foot__sep {
    margin: 0 6px;
    opacity: 0.6;
}

.seller-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.seller-card__name { font-size: 18px; font-weight: 700; }

.seller-card__contacts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seller-card__profile {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    padding: 4px 0;
    border-radius: 12px;
    transition: background .15s;
}

.seller-card__profile:active {
    background: var(--bg);
}

.seller-card__info {
    flex: 1;
    min-width: 0;
}

/* ---------- WhatsApp: выбор сообщения ---------- */

body.wa-sheet-open { overflow: hidden; }

.wa-sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.wa-sheet.hidden { display: none !important; }

.wa-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 22, 28, 0.45);
}

.wa-sheet__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: min(70vh, 520px);
    overflow: auto;
    background: var(--surface);
    border-radius: 20px;
    padding: 22px 16px 16px;
    box-shadow: var(--shadow);
}

.wa-sheet__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--muted);
    line-height: 1;
    cursor: pointer;
}

.wa-sheet__title {
    margin: 0 28px 8px 4px;
    font-size: 18px;
    font-weight: 700;
}

.wa-sheet__hint {
    margin: 0 4px 14px;
}

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

.wa-sheet__option {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.35;
    cursor: pointer;
}

.wa-sheet__option:hover,
.wa-sheet__option:focus-visible {
    border-color: #25d366;
    background: #f0fdf4;
}

.wa-sheet__option--custom {
    color: var(--muted);
    font-style: italic;
}

@media (min-width: 721px) {
    .wa-sheet {
        align-items: center;
    }

    .wa-sheet__panel {
        border-radius: 16px;
    }
}

.avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.avatar--md {
    width: 48px;
    height: 48px;
}

.avatar--lg {
    width: 64px;
    height: 64px;
}

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

.avatar__placeholder {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.avatar--md .avatar__placeholder { font-size: 18px; }
.avatar--lg .avatar__placeholder { font-size: 24px; }

.avatar-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-upload input[type="file"] {
    flex: 1;
    min-width: 0;
    font-size: 14px;
}

.row--deleted {
    filter: grayscale(1);
    opacity: 0.72;
}

.row__image--static {
    cursor: default;
    pointer-events: none;
}

.status--deleted {
    background: #eceff1;
    color: #6b7280;
}

.list--deleted {
    margin-top: 0;
}

.author-top {
    align-items: flex-start;
}

.author-top .avatar {
    margin-top: 2px;
}

.profile-top__back {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    -webkit-tap-highlight-color: transparent;
}

.profile-top__back svg {
    width: 20px;
    height: 20px;
}

.profile-top__back:active {
    transform: scale(0.96);
    color: var(--accent);
}

@media (min-width: 721px) {
    body.page-author .profile-content {
        max-width: 640px;
        margin: 0 auto;
        padding: 16px 16px;
    }
}

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

body.page-ad-detail {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
}

body.page-ad-detail .main.app-main {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
    max-width: 100%;
}

.ad-layout--detail {
    margin-top: 0;
}

.ad-hero {
    position: relative;
}

.ad-alert-wrap {
    padding: 10px 12px 0;
}

body.page-ad-detail .ad-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px 28px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.08) 65%, transparent 100%);
    border-bottom: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.page-ad-detail .ad-toolbar__btn {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.ad-toolbar,
.app-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px 8px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(230, 232, 236, 0.8);
}

body.page-category .category-hero__toolbar.ad-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 12;
    margin: 0;
    padding: max(8px, env(safe-area-inset-top, 0px)) 12px 28px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0%, rgba(0, 0, 0, 0.06) 70%, transparent 100%);
    border-bottom: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.page-category .category-hero__toolbar.ad-toolbar .ad-toolbar__btn {
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.app-toolbar--title {
    padding-left: 16px;
    padding-right: 12px;
}

.app-toolbar__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    flex: 1;
    min-width: 0;
}

.app-toolbar__spacer {
    flex: 0 0 44px;
    width: 44px;
}

.ad-toolbar__actions,
.app-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ad-toolbar__fav-form {
    margin: 0;
}

.ad-toolbar__btn,
.app-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(246, 247, 249, 0.95);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.app-toolbar__btn--accent {
    background: var(--accent);
    color: #fff;
}

.app-toolbar__btn--accent svg {
    width: 24px;
    height: 24px;
}

.ad-toolbar__btn svg,
.app-toolbar__btn svg {
    width: 22px;
    height: 22px;
}

.ad-toolbar__btn:active,
.app-toolbar__btn:active {
    transform: scale(0.96);
}

.ad-toolbar__fav.is-active {
    color: var(--accent);
}

.ad-toolbar__back-label {
    display: none;
}

body.page-ad-detail .ad-main {
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

body.page-ad-detail .gallery__viewport {
    border-radius: 0;
    aspect-ratio: 10 / 9;
    min-height: 280px;
}

body.page-ad-detail .gallery--empty {
    border-radius: 0;
    aspect-ratio: 10 / 9;
    min-height: 280px;
}

@media (max-width: 720px) {
    body.page-ad-detail .gallery__thumbs {
        display: none;
    }

    body.page-ad-detail .gallery__slide {
        max-width: 100%;
    }
}

.ad-main__body {
    padding: 16px;
}

.ad-similar {
    padding: 0 12px 20px;
}

.ad-more-ads {
    padding: 8px 12px 28px;
    margin-top: 8px;
}

.ad-more-ads__head {
    margin-top: 12px;
}

.ad-more-ads__sentinel {
    height: 1px;
}

.ad-more-ads__loading {
    text-align: center;
    padding: 16px 0 4px;
    font-size: 14px;
}

/* ---------- Lightbox галереи ---------- */

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
}

.gallery-lightbox[hidden] {
    display: none !important;
}

.gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
}

.gallery-lightbox__close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 3;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.gallery-lightbox__viewport {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior: contain;
}

.gallery-lightbox__viewport::-webkit-scrollbar { display: none; }

.gallery-lightbox__track {
    display: contents;
}

.gallery-lightbox__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(48px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
}

.gallery-lightbox__slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-lightbox__counter {
    position: absolute;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

body.gallery-lightbox-open {
    overflow: hidden;
}

@media (min-width: 721px) {
    body.page-ad-detail .main.app-main {
        max-width: var(--max);
        padding: 0 16px 40px;
    }

    body.page-ad-detail .ad-main {
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    body.page-ad-detail .ad-toolbar {
        padding-top: 10px;
        padding-bottom: 32px;
    }

    body.page-ad-detail .ad-toolbar__back {
        width: auto;
        height: 36px;
        padding: 0 12px 0 8px;
        border-radius: 8px;
        gap: 2px;
        font-size: 14px;
        font-weight: 500;
    }

    body.page-ad-detail .ad-toolbar__back-label {
        display: inline;
    }

    body.page-ad-detail .gallery__viewport,
    body.page-ad-detail .gallery--empty {
        max-height: 576px;
    }

    body.page-ad-detail .ad-main__body {
        padding: 20px 22px 22px;
    }

    body.page-ad-detail .ad-more-ads {
        padding: 12px 0 24px;
    }

    body.page-ad-detail .ad-page-foot {
        margin: 0 0 32px;
        padding-top: 20px;
    }
}

/* ---------- Списки «Мои объявления» ---------- */

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

.row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) auto;
    gap: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    align-items: center;
}

.row__image {
    width: 132px;
    height: 98px;
    border-radius: 10px;
    overflow: hidden;
    background: #eef0f3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
}

.row__image img { width: 100%; height: 100%; object-fit: cover; }
.row__title { font-size: 16px; font-weight: 600; }
.row__price { font-size: 18px; font-weight: 700; margin: 4px 0; }
.row__meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.row__reject-reason { color: #b3261e; font-weight: 500; }
.row__actions { display: flex; gap: 8px; align-items: center; }

.status {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status--active { background: #e8f5e9; color: #256029; }
.status--pending { background: #fff4e5; color: #8a5300; }
.status--rejected { background: #fdecea; color: #b3261e; }
.status--sold { background: #eceff1; color: #4a5560; }

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

.form-page, .auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
    max-width: 620px;
    margin: 0 auto;
}

.auth-card { max-width: 420px; text-align: center; }
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }

.auth-card__footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 16px;
}

.auth-card__footer--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.auth-action-form {
    margin: 0;
    width: 100%;
}

.auth-hint {
    margin-top: 12px;
    text-align: left;
}

body.page-login {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

body.page-login .site-footer,
body.page-login .tabbar {
    display: none !important;
}

.form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field__label { font-size: 14px; font-weight: 600; }
.field__label i { color: var(--accent); font-style: normal; }
.field__hint { font-size: 13px; color: var(--muted); }
.field__error { font-size: 13px; color: #b3261e; }

.field input[type="text"],
.field input[type="search"],
.field input[type="number"],
.field input[type="file"],
.field select,
.field textarea,
.form input[type="text"],
.form select,
.form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: var(--bg);
}

.field input:focus, .field select:focus, .field textarea:focus,
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
}

.code-input {
    text-align: center;
    letter-spacing: 12px;
    font-size: 26px !important;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    caret-color: var(--accent);
}

.form__actions { display: flex; gap: 12px; align-items: center; }

.previews { display: flex; flex-wrap: wrap; gap: 10px; }
.previews img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }

.uploaded { display: flex; flex-wrap: wrap; gap: 10px; }
.uploaded__item { position: relative; }
.uploaded__item img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }

.uploaded__remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #b3261e;
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 26px;
}

.danger-zone p { margin: 4px 0 0; }

.profile-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.profile-summary__phone { font-size: 18px; font-weight: 700; }

/* ---------- Профиль (app-style) ---------- */

body.page-profile .main.app-main,
body.page-profile-settings .main.app-main,
body.page-favorites .main.app-main,
body.page-categories .main.app-main,
body.page-category .main.app-main,
body.page-ad-form .main.app-main,
body.page-author .main.app-main {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
}

body.page-profile-settings {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.profile-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: max(12px, env(safe-area-inset-top, 0px)) 16px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.profile-top__info {
    flex: 1;
    min-width: 0;
}

.profile-top__name {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.profile-top__meta {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.profile-top__settings {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    -webkit-tap-highlight-color: transparent;
}

.profile-top__settings svg {
    width: 20px;
    height: 20px;
}

.profile-top__settings:active {
    transform: scale(0.96);
    color: var(--accent);
}

.profile-content {
    padding: 16px 12px 12px;
}

.profile-post {
    margin: 20px 0;
}

.profile-section__title {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 4px 10px;
}

.profile-empty {
    text-align: center;
    padding: 32px 16px;
}

.profile-empty__hint {
    padding: 8px 4px 0;
    font-size: 15px;
}

body.page-profile .list {
    gap: 10px;
}

body.page-profile .list .row {
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: none;
}

.favorites-grid {
    margin-top: 0;
}

body.page-category .chips {
    margin-top: 0;
}

body.page-ad-form .profile-content .form {
    margin-top: 0;
}

body.page-ad-form .profile-content .danger-zone {
    margin-top: 24px;
}

.wizard-steps {
    display: flex;
    gap: 8px;
    margin: 0 0 20px;
    padding: 0;
}

.wizard-steps__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.wizard-steps__num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    background: var(--surface);
}

.wizard-steps__item.is-active {
    color: var(--accent);
}

.wizard-steps__item.is-active .wizard-steps__num {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.wizard-steps__item.is-done .wizard-steps__num {
    border-color: var(--accent);
    color: var(--accent);
}

.wizard-section-title {
    margin: 8px 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.wizard-hint {
    margin: 0 0 8px;
}

.ad-attrs {
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.ad-attrs__row {
    display: grid;
    grid-template-columns: minmax(100px, 40%) 1fr;
    gap: 12px;
    font-size: 14px;
}

.ad-attrs__row dt {
    margin: 0;
    color: var(--muted);
    font-weight: 500;
}

.ad-attrs__row dd {
    margin: 0;
    font-weight: 600;
}

.profile-settings {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-settings__card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 16px;
}

.profile-settings__card.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-settings__heading {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.profile-settings__phone {
    font-size: 18px;
    font-weight: 700;
}

.profile-settings__actions {
    padding: 12px;
}

.profile-settings .danger-zone {
    margin-top: 0;
    border: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
}

@media (min-width: 721px) {
    body.page-profile .main.app-main,
    body.page-profile-settings .main.app-main,
    body.page-favorites .main.app-main,
    body.page-categories .main.app-main,
    body.page-category .main.app-main,
    body.page-ad-form .main.app-main,
    body.page-author .main.app-main {
        padding-bottom: 24px;
    }

    .profile-content {
        max-width: 640px;
        margin: 0 auto;
        padding: 16px 16px;
    }

    .profile-settings {
        max-width: 480px;
        margin: 0 auto;
        padding: 12px 0;
    }

    body.page-profile-settings .app-toolbar {
        position: static;
        background: transparent;
        backdrop-filter: none;
        border-bottom: none;
        padding-top: 0;
    }
}

/* ---------- Подвал и таббар ---------- */

.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 26px 0;
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer__nav { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.footer p { margin: 4px 0 0; font-size: 14px; }

.tabbar { display: none; }

/* ---------- PWA: баннер установки ---------- */

.install-banner {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    z-index: 60;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px 44px 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-banner.hidden { display: none !important; }

.install-banner__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.install-banner__text strong { font-size: 15px; }
.install-banner__text span { color: var(--muted); }

.install-banner__close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: none;
    font-size: 22px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}

.ios-home-tip {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(20, 22, 28, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.ios-home-tip.hidden { display: none !important; }

.ios-home-tip__card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 20px;
    padding: 22px 20px 18px;
    box-shadow: var(--shadow);
}

.ios-home-tip__card h2 {
    margin: 0 28px 14px 0;
    font-size: 18px;
    font-weight: 700;
}

.ios-home-tip__close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--muted);
    line-height: 1;
}

.ios-home-tip__steps {
    margin: 0 0 12px;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 15px;
    line-height: 1.4;
}

.ios-home-tip__icon {
    display: inline-flex;
    vertical-align: middle;
    color: var(--accent);
    margin: 0 2px;
}

.ios-home-tip__note {
    margin: 0 0 14px;
}

@media (min-width: 721px) {
    .install-banner,
    .ios-home-tip {
        display: none !important;
    }
}

/* ---------- Десктоп (веб) ---------- */

@media (min-width: 721px) {
    body {
        padding-bottom: 0;
    }

    /* Каталог и списки — на всю ширину контейнера */
    body.page-home .profile-content,
    body.page-home .home-content,
    body.page-search .profile-content,
    body.page-category .profile-content,
    body.page-categories .profile-content,
    body.page-favorites .profile-content,
    body.page-author .profile-content {
        max-width: var(--max);
    }

    .category-hero__body {
        max-width: var(--max);
        margin-left: auto;
        margin-right: auto;
    }

    body.page-profile .profile-content {
        max-width: 860px;
    }

    body.page-home .home-top {
        display: none;
    }

    body.page-home .main.app-main,
    body.page-search .main.app-main,
    body.page-category .main.app-main,
    body.page-categories .main.app-main,
    body.page-favorites .main.app-main,
    body.page-profile .main.app-main,
    body.page-author .main.app-main,
    body.page-ad-form .main.app-main {
        padding: 22px 16px 40px;
        max-width: var(--max);
    }

    .profile-top {
        max-width: var(--max);
        margin: 0 auto;
        padding: 4px 16px 16px;
        background: transparent;
        border-bottom: none;
    }

    .profile-top__back {
        display: none;
    }

    body.page-category .profile-top__back,
    body.page-search .profile-top__back,
    body.page-author .profile-top__back {
        display: inline-flex;
    }

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

    .categories-strip {
        flex-wrap: wrap;
        overflow: visible;
    }

    body.page-ad-detail .main.app-main {
        max-width: var(--max);
        padding: 0 16px 40px;
    }

    body.page-ad-detail .ad-layout--detail {
        margin-top: 0;
    }

    body.page-profile-settings .main.app-main {
        max-width: var(--max);
        padding: 22px 16px 40px;
    }

    body.page-profile-settings .app-toolbar {
        position: static;
        max-width: 480px;
        margin: 0 auto;
        padding: 0 0 12px;
        background: transparent;
        backdrop-filter: none;
        border-bottom: none;
    }

    body.page-profile-settings .app-toolbar__back {
        display: none;
    }

    body.page-ad-form .profile-content {
        max-width: 620px;
    }

}

/* ---------- Мобильные / приложение ---------- */

@media (max-width: 900px) {
    .ad-layout { grid-template-columns: 1fr; }
    .seller-card { position: static; }
}

@media (max-width: 720px) {
    body.page-home .header.app-bar,
    body.page-profile .header.app-bar,
    body.page-category .header.app-bar,
    body.page-search .header.app-bar,
    body.page-categories .header.app-bar,
    body.page-favorites .header.app-bar,
    body.page-author .header.app-bar,
    body.page-ad-form .header.app-bar,
    body.page-ad-detail .header.app-bar,
    body.page-profile-settings .header.app-bar {
        display: none;
    }

    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
        -webkit-tap-highlight-color: transparent;
    }

    .header.app-bar {
        position: sticky;
        top: 0;
        z-index: 40;
        backdrop-filter: blur(12px);
        background: rgba(255, 255, 255, 0.92);
    }

    .header__inner {
        height: auto;
        flex-wrap: wrap;
        padding: max(10px, env(safe-area-inset-top, 0px)) 0 10px;
        gap: 8px;
    }

    .header__nav { display: none; }
    .site-footer { display: none; }

    .logo { font-size: 20px; }

    .search.app-bar__search {
        order: 3;
        width: 100%;
        flex-basis: 100%;
    }

    .search input {
        border-radius: 12px;
        padding: 12px 14px;
        font-size: 16px; /* без зума на iOS */
    }

    .main.app-main {
        padding: 12px 12px 20px;
        max-width: 100%;
    }

    .container { padding: 0 12px; }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .card { border-radius: 12px; }
    .card__body { padding: 10px 10px 12px; }
    .card__price { font-size: 16px; }
    .card__title { font-size: 13px; line-height: 1.35; }

    .categories-strip { margin: 0 -4px; }

    .row { grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 10px; }
    .row__image { width: 88px; height: 68px; }
    .row__actions { grid-column: 1 / -1; }

    .section-head h1 { font-size: 20px; }
    .ad-price { font-size: 26px; }
    .form-page, .auth-card { padding: 16px; border-radius: 16px; margin: 0 -4px; }

    .ad-main { padding: 14px; border-radius: 16px; }
    .seller-card { border-radius: 16px; }

    .tabbar {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        z-index: 50;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 20px rgba(20, 22, 28, 0.06);
    }

    .tabbar__item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 500;
        padding: 4px 2px;
        min-height: 48px;
        border-radius: 10px;
        transition: color 0.15s;
    }

    .tabbar__item svg {
        width: 22px;
        height: 22px;
    }

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

    .tabbar__item--accent {
        color: #fff !important;
        align-self: center;
        justify-self: center;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--accent);
        box-shadow: 0 4px 14px rgba(244, 81, 30, 0.45);
        margin-top: -18px;
        padding: 0;
    }

    .tabbar__item--accent svg {
        width: 26px;
        height: 26px;
    }

    .tabbar__item--accent span { display: none; }
}

/* Режим «установлено как приложение» */
@media (display-mode: standalone) {
    body.is-standalone .site-footer { display: none; }

    body.is-standalone .header.app-bar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    body.is-standalone.page-home .home-top,
    body.is-standalone .page-home .home-top,
    body.is-standalone.page-home .profile-top.home-top {
        padding-top: max(12px, env(safe-area-inset-top, 0px));
    }
}

body.is-standalone .site-footer { display: none; }

/* ---------- Профиль: срок, жалоба ---------- */

.row__expiry--soon { color: var(--accent); }
.row__expiry--warn { color: #c62828; font-weight: 600; }

.row__actions {
    flex-wrap: wrap;
}

.ad-report {
    padding: 0 12px 24px;
    margin-top: 8px;
}

.ad-report__details {
    border: 1px solid #e8eaed;
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--surface, #fff);
}

.ad-report__summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.ad-report__summary::-webkit-details-marker { display: none; }

.ad-report__form {
    margin-top: 12px;
    display: grid;
    gap: 12px;
}

.ad-report__reasons {
    border: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.ad-report__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.ad-report__label input { accent-color: var(--accent); }

/* ---------- Панель оператора импорта (/operator/) ---------- */

body.page-operator {
    padding-bottom: 24px;
}

body.page-operator .main.app-main {
    padding-top: 0;
    max-width: 100%;
}

.operator-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.operator-bar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 920px;
    margin: 0 auto;
    padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
}

.operator-bar__brand {
    font-weight: 800;
    font-size: 16px;
    color: var(--text);
    text-decoration: none;
}

.operator-bar__nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.operator-bar__nav a {
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.operator-bar__logout {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
}

.operator-messages {
    max-width: 920px;
    margin: 0 auto;
    padding: 12px 16px 0;
}

.operator-page {
    max-width: 920px;
    margin: 0 auto;
    padding: 16px;
}

.operator-page__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.operator-page__head h1 {
    margin: 0;
    font-size: 22px;
}

.operator-auth {
    min-height: calc(100vh - 80px);
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.operator-auth__card {
    width: min(420px, 100%);
    padding: 24px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.operator-auth__title {
    margin: 0 0 8px;
    font-size: 22px;
}

.operator-auth__hint {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.operator-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.operator-stat {
    padding: 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
}

.operator-stat strong {
    display: block;
    font-size: 22px;
    line-height: 1.1;
}

.operator-stat span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.operator-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.operator-search {
    flex: 1;
    min-width: 0;
}

.operator-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.operator-row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.operator-row__thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: #eef0f3;
    display: grid;
    place-items: center;
    font-size: 10px;
    color: var(--muted);
}

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

.operator-row__title {
    font-weight: 700;
    line-height: 1.25;
}

.operator-row__meta,
.operator-row__source {
    margin-top: 4px;
    font-size: 13px;
    color: var(--muted);
}

.operator-row__price {
    font-weight: 700;
    white-space: nowrap;
}

.operator-form__section {
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.operator-form__section-title {
    margin: 0 0 12px;
    font-size: 16px;
}

.field--checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-direction: row;
}

.field--checkbox input {
    margin-top: 3px;
}

@media (max-width: 640px) {
    .operator-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .operator-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .operator-row {
        grid-template-columns: 56px 1fr;
    }

    .operator-row__price {
        grid-column: 2;
    }
}
