:root {
  --brand: #0a9f6a;
  --brand-dark: #07845a;
  --brand-soft: #e6f6ef;
  --accent: #ff6a3d;
  --accent-dark: #ec5428;
  --ink: #1b1d1f;
  --muted: #7a7f85;
  --line: #e7e9ec;
  --soft: #f4f5f7;
  --bg: #ffffff;
  --danger: #e0393e;
  --warn: #f2a516;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(20, 30, 40, .08);
  --wrap: 1240px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 Manrope, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
h1 { font-size: 28px; line-height: 1.2; margin: 8px 0 16px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 20px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 17px; margin: 0 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.danger { color: var(--danger); }
.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  font-weight: 700; font-size: 15px; white-space: nowrap; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: var(--soft); color: var(--ink); }
.btn-ghost:hover { background: #e9ebee; color: var(--ink); }
.btn-danger-ghost { background: #fdeeee; color: var(--danger); }
.btn-danger-ghost:hover { background: #fadcdc; color: var(--danger); }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; }

/* ---------- шапка ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 1px 0 var(--line); }
.topbar { background: var(--soft); font-size: 13px; }
.topbar-in { display: flex; justify-content: space-between; height: 32px; align-items: center; }
.toplinks { display: flex; gap: 18px; align-items: center; }
.toplinks a, .toplinks .linkbtn { color: var(--ink); }
.toplinks a:hover, .toplinks .linkbtn:hover { color: var(--accent); }
.mainbar { display: flex; align-items: center; gap: 14px; height: 68px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 24px; color: var(--ink); letter-spacing: -.02em; flex-shrink: 0; }
.logo:hover { color: var(--ink); }
.logo-sm { font-size: 18px; }
.catbtn {
  display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 16px;
  background: var(--brand); color: #fff; border: 0; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; flex-shrink: 0;
}
.catbtn:hover { background: var(--brand-dark); }
.burger, .burger::before, .burger::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.burger::before, .burger::after { content: ''; position: absolute; left: 0; }
.burger::before { top: -5px; } .burger::after { top: 5px; }
.catbtn[aria-expanded="true"] .burger { background: transparent; }
.catbtn[aria-expanded="true"] .burger::before { top: 0; transform: rotate(45deg); }
.catbtn[aria-expanded="true"] .burger::after { top: 0; transform: rotate(-45deg); }

.searchbar { flex: 1; display: flex; min-width: 0; border: 2px solid var(--brand); border-radius: var(--radius-sm); overflow: hidden; height: 44px; }
.searchbar input { flex: 1; min-width: 0; border: 0; padding: 0 14px; outline: none; background: #fff; }
.searchbar .search-city { border: 0; border-left: 1px solid var(--line); padding: 0 8px; background: #fff; max-width: 170px; outline: none; cursor: pointer; }
.searchbar .btn { border-radius: 0; height: 100%; }
.usernav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.iconlink { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--ink); }
.iconlink:hover { background: var(--soft); color: var(--accent); }
.iconlink svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
}
.iconlink .badge { position: absolute; top: 2px; right: 0; }

.catmenu { border-top: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); max-height: calc(100vh - 100px); overflow: auto; }
.catmenu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; padding-top: 20px; padding-bottom: 24px; }
.catmenu-col { display: flex; flex-direction: column; gap: 4px; }
.catmenu-col a { color: var(--ink); font-size: 14px; }
.catmenu-col a:hover { color: var(--accent); }
.catmenu-head { font-weight: 800; font-size: 15px !important; margin-bottom: 4px; }

/* ---------- общие блоки ---------- */
.page { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--brand-soft); color: var(--brand-dark); }
.flash-warn { background: #fff5e0; color: #8a5a00; }
.flash-error { background: #fdeeee; color: var(--danger); }
.notice { padding: 12px 16px; border-radius: var(--radius-sm); background: #fff5e0; margin-bottom: 16px; }
.notice-sold { background: var(--soft); }
.notice-blocked { background: #fdeeee; color: var(--danger); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 14px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs > *:not(:last-child)::after { content: '›'; margin-left: 6px; color: #b6babf; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--soft); font-size: 12px; font-weight: 700; color: #4b5056; }
.tag-new { background: var(--brand-soft); color: var(--brand-dark); }
.empty { text-align: center; padding: 56px 16px; background: var(--soft); border-radius: var(--radius); }
.empty-icon { font-size: 48px; margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }

/* ---------- главная ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 26px 28px; border-radius: var(--radius); margin-bottom: 18px;
  background: linear-gradient(120deg, #0a9f6a 0%, #13b37c 55%, #ffb36b 140%); color: #fff;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; }
.hero p { margin: 0; opacity: .92; }
.cat-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.cat-tile {
  position: relative; display: block; height: 96px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--tile, var(--soft)); color: var(--ink); overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.cat-tile:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-name { position: relative; z-index: 1; font-weight: 700; font-size: 14px; line-height: 1.2; display: block; max-width: 75%; }
.cat-count { position: relative; z-index: 1; font-size: 12px; color: var(--muted); }
.cat-icon { position: absolute; right: 8px; bottom: 2px; font-size: 44px; line-height: 1; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 17px; border: 0;
  background: var(--soft); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.pill:hover { background: #e9ebee; color: var(--ink); }
.pill.on { background: var(--ink); color: #fff; }

/* ---------- карточки ---------- */
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px 16px; }
.grid-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { position: relative; min-width: 0; }
.card-photo { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--soft); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .card-photo img { transform: scale(1.03); }
.nophoto { display: grid; place-items: center; width: 100%; height: 100%; font-size: 40px; opacity: .6; }
.nophoto.big { font-size: 90px; min-height: 320px; }
.photo-count { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; }
.sold-label { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.6); font-weight: 800; font-size: 18px; color: var(--ink); }
.fav {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgba(255,255,255,.9); cursor: pointer; color: var(--ink);
}
.fav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.fav:hover { color: var(--accent); }
.fav.on { color: var(--accent); }
.fav.on svg { fill: currentColor; }
.card-body { padding-top: 8px; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.35; }
.card-title:hover { color: var(--accent); }
.card-price { font-weight: 800; font-size: 17px; margin-top: 4px; }
.card-approx { font-size: 12px; color: var(--muted); }
.card-tags { display: flex; gap: 4px; margin: 4px 0; flex-wrap: wrap; }
.card-tags:empty { display: none; }
.card-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.is-sold .card-price { color: var(--muted); text-decoration: line-through; }

/* ---------- поиск ---------- */
.search-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.search-head h1 { margin-bottom: 10px; }
.subcats { margin-bottom: 20px; }
.search-layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.filters { position: sticky; top: 120px; }
.filters-toggle { display: none; }
.filters-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: #4b5056; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input:not([type]), select, textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: #fff; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; }
select { cursor: pointer; }
.price-range { display: grid; grid-template-columns: 1fr 1fr 64px; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.segmented { display: inline-flex; background: var(--soft); border-radius: var(--radius-sm); padding: 3px; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.segmented input:checked + span { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
.sortbar { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; font-size: 14px; flex-wrap: wrap; }
.sort { color: var(--ink); font-weight: 600; }
.sort.on { color: var(--brand-dark); border-bottom: 2px solid var(--brand); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 40px; height: 40px; display: grid; place-items: center; padding: 0 12px; border-radius: var(--radius-sm); background: var(--soft); color: var(--ink); font-weight: 700; }
.pager .on { background: var(--ink); color: #fff; }

/* ---------- объявление ---------- */
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 36px; align-items: start; }
.item-title { font-size: 30px; }
.gallery-main { position: relative; background: var(--soft); border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.9); font-size: 28px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.gallery-nav.prev { left: 12px; } .gallery-nav.next { right: 12px; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb { flex: 0 0 auto; width: 76px; height: 58px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: var(--soft); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.on { border-color: var(--brand); }
.item-section { margin-top: 28px; }
.specs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.specs li { display: flex; gap: 8px; }
.specs span { color: var(--muted); min-width: 110px; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; }
.item-meta { margin-top: 24px; }
.report { margin-top: 12px; font-size: 14px; }
.report summary { cursor: pointer; color: var(--muted); }
.report form { margin-top: 10px; max-width: 420px; }
.item-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 120px; }
.price-box { display: flex; flex-direction: column; gap: 4px; }
.item-price { font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.fav-inline { position: static; width: auto; height: 36px; padding: 0 12px; border-radius: 18px; background: var(--soft); display: inline-flex; gap: 6px; align-self: flex-start; margin-top: 6px; font-weight: 600; font-size: 14px; }
.contact-box, .owner-box { display: flex; flex-direction: column; gap: 8px; }
.contacts { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--soft); border-radius: var(--radius-sm); }
.contacts a, .contacts span { font-weight: 700; font-size: 16px; }
.seller-box { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.seller-box:hover { color: var(--ink); border-color: #cfd3d8; }
.rating { color: #f29b16; font-weight: 700; }
.rating.big { font-size: 18px; }
.tip { padding: 14px; border-radius: var(--radius); background: var(--brand-soft); font-size: 14px; }
.tip p { margin: 4px 0 0; }
.avatar {
  flex-shrink: 0; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #13b37c, #0a7f56); color: #fff; font-weight: 800; object-fit: cover;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 80px; height: 80px; font-size: 26px; }
.avatar.xl { width: 120px; height: 120px; font-size: 40px; }
.avatar-link { display: block; margin: 0 4px; }

/* ---------- формы ---------- */
.form-page { max-width: 760px; }
.form-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.listing-form .field + .field, .listing-form .field + fieldset, .listing-form fieldset + .field { margin-top: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-input { display: grid; grid-template-columns: 1fr 140px; gap: 8px; margin-top: 12px; max-width: 420px; }
.price-input input { font-size: 18px; font-weight: 700; }
.dropzone { display: grid; place-items: center; text-align: center; min-height: 110px; padding: 16px; border: 2px dashed #cfd3d8; border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.previews, .photo-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.photo-edit { margin: 0 0 12px; }
.preview, .photo-edit-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--soft); }
.preview img, .photo-edit-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-edit-item label { display: flex; gap: 4px; align-items: center; padding: 2px 6px; }
.preview button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.preview .main-label { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 4px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-actions p { width: 100%; margin: 0; }
.auth-card { max-width: 460px; margin: 20px auto; padding: 28px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-tabs { display: flex; gap: 20px; margin-bottom: 20px; }
.auth-tabs a { font-size: 22px; font-weight: 800; color: var(--muted); }
.auth-tabs a.on { color: var(--ink); }
.avatar-row { display: flex; align-items: center; gap: 16px; }

/* ---------- мои объявления, вкладки ---------- */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 0; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--ink); }
.tabs a span { color: var(--muted); font-weight: 600; margin-left: 4px; }
.my-list { display: flex; flex-direction: column; }
.my-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.my-photo { display: block; width: 120px; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--soft); }
.my-photo img { width: 100%; height: 100%; object-fit: cover; }
.my-info { min-width: 0; }
.my-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- продавец, отзывы ---------- */
.seller-page { display: grid; grid-template-columns: 300px 1fr; gap: 36px; align-items: start; }
.seller-card { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seller-card h1 { margin: 10px 0 0; font-size: 24px; }
.seller-facts { list-style: none; padding: 0; margin: 12px 0 0; text-align: left; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.seller-about { white-space: pre-wrap; text-align: left; font-size: 14px; margin: 8px 0 0; }
.reviews { margin-top: 36px; }
.review { padding: 14px 0; border-bottom: 1px solid var(--line); }
.review-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review p { margin: 8px 0 0; white-space: pre-wrap; }
.stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.stars input { position: absolute; opacity: 0; }
.stars label { font-size: 30px; color: #d3d6da; cursor: pointer; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #f29b16; }
.stars-static { color: #f29b16; letter-spacing: 1px; }
.stars-static .muted { color: #d3d6da; }

/* ---------- сообщения ---------- */
.dialogs { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dialog { display: flex; gap: 12px; align-items: center; padding: 12px 16px; color: var(--ink); border-bottom: 1px solid var(--line); }
.dialog:last-child { border-bottom: 0; }
.dialog:hover { background: var(--soft); color: var(--ink); }
.dialog.unread { background: #f3fbf7; }
.dialog-photo { flex-shrink: 0; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--soft); display: grid; place-items: center; font-size: 24px; }
.dialog-photo img { width: 100%; height: 100%; object-fit: cover; }
.dialog-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dialog-top { display: flex; justify-content: space-between; gap: 8px; }
.dialog-title, .dialog-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.dialog-role { flex-shrink: 0; }
.chat { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.chat-head { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.chat-back { font-size: 22px; color: var(--ink); }
.chat-listing { flex: 1; display: flex; gap: 10px; align-items: center; color: var(--ink); min-width: 0; }
.chat-listing > span:last-child, .chat-peer > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.chat-listing b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-peer { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.chat-log {
  height: min(60vh, 560px); overflow-y: auto; padding: 16px; border-radius: var(--radius); background: var(--soft);
  display: flex; flex-direction: column; gap: 8px;
}
.chat-empty { margin: auto; }
.msg { max-width: 75%; align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg-body { padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.msg.mine .msg-body { background: #d8f3e6; border-radius: 16px 16px 4px 16px; }
.msg-time { font-size: 11px; color: var(--muted); margin-top: 2px; padding: 0 4px; }
.msg.mine .msg-time { text-align: right; }
.read { color: var(--brand); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; }
.chat-form .btn { height: 44px; width: 52px; padding: 0; font-size: 18px; }

/* ---------- админка ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stats div { padding: 16px; border-radius: var(--radius); background: var(--soft); display: flex; flex-direction: column; }
.stats b { font-size: 28px; }
.stats span { color: var(--muted); font-size: 13px; }
.stats .warn { background: #fff5e0; }
.admin-block { margin-bottom: 32px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.blocked td { opacity: .55; }
.inline-form { display: flex; gap: 8px; max-width: 420px; margin-bottom: 12px; }

/* ---------- тексты ---------- */
.prose { max-width: 760px; font-size: 16px; line-height: 1.6; }
.prose h2 { margin-top: 28px; }
.prose li { margin-bottom: 6px; }

/* ---------- подвал и нижняя панель ---------- */
.site-footer { background: var(--soft); padding: 32px 0; margin-top: 24px; }
.footer-in { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.footer-in p { margin: 10px 0 0; max-width: 460px; }
.footer-in .small { grid-column: 1 / -1; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--ink); }
.tabbar { display: none; }

/* ---------- адаптивность ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cat-tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .hide-sm { display: none !important; }
  .topbar { display: none; }
  .mainbar { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .logo { order: 1; font-size: 21px; }
  .usernav { order: 2; margin-left: auto; }
  .catbtn { order: 3; padding: 0 12px; height: 40px; }
  .searchbar { order: 4; flex-basis: 100%; }
  .searchbar .search-city { max-width: 110px; font-size: 13px; }
  .searchbar .btn { padding: 0 12px; }
  .grid, .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-layout, .item-layout, .seller-page { grid-template-columns: 1fr; }
  .filters { position: static; }
  .filters-toggle { display: flex; width: 100%; }
  .filters-form { display: none; margin-top: 12px; }
  .filters-form.open { display: flex; }
  .item-side { position: static; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .tabbar a.on { color: var(--brand-dark); }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .tabbar .badge { position: absolute; top: 2px; left: 55%; }
  .tab-add span { display: grid; place-items: center; width: 34px; height: 26px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 22px; line-height: 1; font-weight: 700; }
  .tab-add { color: var(--accent) !important; }
  body { padding-bottom: 64px; }
  .usernav .iconlink { display: none; }
}
@media (max-width: 640px) {
  h1, .item-title { font-size: 22px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 21px; }
  .hero .btn { width: 100%; }
  .cat-tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cat-tile { height: 84px; padding: 10px; }
  .cat-name { font-size: 12.5px; max-width: 100%; }
  .cat-icon { font-size: 32px; }
  .city-pills .pills { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; }
  .grid, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 10px; }
  .card-price { font-size: 15px; }
  .searchbar .search-city { display: none; }
  .row-2 { grid-template-columns: 1fr; }
  .specs { grid-template-columns: 1fr; }
  .item-price { font-size: 26px; }
  .my-row { grid-template-columns: 88px 1fr; }
  .my-photo { width: 88px; }
  .my-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .footer-in { grid-template-columns: 1fr; }
  .chat-log { height: 58vh; padding: 10px; }
  .msg { max-width: 88%; }
  .auth-card { padding: 20px; margin: 0; box-shadow: none; border: 0; }
  .form-card { padding: 16px; }
  .price-input { grid-template-columns: 1fr 120px; }
  .dialog-role { display: none; }
}

/* поправки форм */
.field > .segmented { align-self: flex-start; }
.listing-form .row-2 > .field { margin-top: 0; }
.listing-form .row-2 { margin-top: 0; }
