:root {
  --bg: #ffffff;
  --surface: #f5f4f1;
  --surface-2: #efede8;
  --line: #e5e0d6;
  --line-strong: #cfc6b6;
  --text: #1e2321;
  --muted: #6d726e;
  --faint: #9a9e9a;
  --accent: #3f5752;
  --accent-press: #2f413d;
  --accent-soft: #e8edeb;
  --danger: #974036;
  --radius: 10px;
  --radius-lg: 14px;
  --font: "Golos Text", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
}

a { color: inherit; }
h1, h2 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 17px; }
img, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Header */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 600; font-size: 16px; text-decoration: none; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav > a:not(.btn) { color: var(--muted); text-decoration: none; }
.nav > a[aria-current="page"] { color: var(--text); }
.nav form { margin: 0; }

main.wrap { padding-top: 28px; padding-bottom: 64px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg); color: var(--text);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn-danger { color: var(--danger); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.link-muted { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: none; }
.link-muted:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Page heads */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 3px; border-radius: 9px; }
.tabs a { padding: 5px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a[aria-current="page"] { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 14px; font-size: 14px; }
.back:hover { color: var(--text); }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-size: 13px; color: var(--muted); padding: 0; }
.label em { font-style: normal; color: var(--faint); margin-left: 4px; }
input, select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg);
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236d726e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }

/* Filters */
.filters {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px;
  padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 20px;
}
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-rooms { grid-column: 1 / 3; }
.field-search { grid-column: 1 / -1; }
.field-search input { height: 44px; font-size: 16px; }
.filters-actions { display: flex; align-items: flex-end; gap: 16px; justify-content: flex-end; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  display: inline-flex; align-items: center; height: 36px; min-width: 44px; justify-content: center; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; font-size: 14px;
}
.segmented input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.result-count { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; text-decoration: none; border-radius: var(--radius-lg); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.card-slides {
  display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
}
.card-slides::-webkit-scrollbar { display: none; }
.card-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; }
.card-slide img, .card-slide video { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.card-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: var(--text);
  font-size: 20px; line-height: 32px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.card-nav.prev { left: 8px; }
.card-nav.next { right: 8px; }
.card:hover .card-nav, .card-nav:focus-visible { opacity: 1; }
@media (hover: none) { .card-nav { display: none; } }
.card-count {
  position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 6px;
  background: rgba(30, 35, 33, .62); color: #fff; font-size: 12px;
}
.card-body { padding: 12px 2px 0; display: flex; flex-direction: column; gap: 2px; }
.card-title { font-weight: 600; font-size: 16px; }
.card-specs { color: var(--muted); font-size: 14px; }
.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 6px; }
.card-price { font-weight: 600; }
.card-price small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 4px; }
.card-district { color: var(--muted); font-size: 13px; text-align: right; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 32px; color: var(--muted); }
.empty { padding: 56px 0; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 16px; }

/* Listing */
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.sub { margin: 4px 0 0; color: var(--muted); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.actions form { margin: 0; }
.alert { padding: 12px 14px; border: 1px solid #e4c9c3; background: #faf1ef; color: var(--danger); border-radius: 8px; margin: 0 0 20px; }

.gallery { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: start; }
.gallery > *, .details > *, .filters > *, .fields > * { min-width: 0; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-height: 720px; overflow-y: auto; padding: 2px; }
.thumb {
  position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius); background: var(--surface);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.thumb:hover { border-color: var(--line-strong); }
.thumb[aria-current="true"] { border-color: var(--line-strong); box-shadow: 0 0 0 1px var(--line-strong); }
.thumb[aria-current="true"]::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--bg); border-radius: var(--radius); }
.thumb-tag {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 5px;
  background: rgba(30, 35, 33, .62); color: #fff; font-size: 11px;
}

.stage { position: sticky; top: 84px; }
.viewer {
  position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--bg); overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.viewer img, .viewer video { width: 100%; height: 100%; object-fit: contain; }
.viewer video { background: #111; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 50%; background: rgba(255, 255, 255, .9);
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--text); opacity: 0; transition: opacity .15s;
}
.viewer:hover .viewer-nav, .viewer-nav:focus-visible { opacity: 1; }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }

.keyfacts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 44px; padding: 28px 8px 0; }
.kf { display: flex; flex-direction: column; gap: 2px; }
.kf-rooms { flex-direction: row; align-items: flex-start; gap: 18px; }
.kf-big { font-size: 64px; line-height: .9; font-weight: 600; letter-spacing: -0.03em; }
.kf-word { font-size: 34px; letter-spacing: -0.01em; }
.kf-pair { display: flex; flex-direction: column; gap: 2px; }
.kf-label { color: var(--muted); font-size: 17px; }
.kf-value { font-size: 19px; }
.kf-note { color: var(--muted); font-size: 13px; }

.details { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.facts { margin: 0; display: grid; gap: 0; align-content: start; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
.text-block + .text-block { margin-top: 28px; }
.text-block h2 { margin-bottom: 10px; }
.pre { white-space: pre-wrap; margin: 0; }

/* Form */
.form-title { margin-bottom: 24px; }
.form, .media-manage { max-width: 820px; }
.form-section { padding: 24px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section h2 { margin-bottom: 16px; }
.form-section h2 em { font-style: normal; font-weight: 400; font-size: 13px; color: var(--faint); margin-left: 6px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field-wide { grid-column: 1 / -1; }
.paste-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }
.hint.is-error { color: var(--danger); }
.hint.is-ok { color: var(--accent); }
.dropzone {
  display: flex; flex-direction: column; gap: 8px; padding: 22px; cursor: pointer;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--muted);
}
.dropzone { position: relative; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:focus-within { border-color: var(--accent); }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.form-actions { display: flex; align-items: center; gap: 20px; padding-top: 24px; border-top: 1px solid var(--line); }

.media-manage { margin-bottom: 8px; }
.media-manage h2 { margin-bottom: 6px; }
.media-manage > .hint { margin: 0 0 14px; }
.media-add { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.media-add .picker { width: 100%; }

/* File picker and sortable tiles */
.picker { display: flex; flex-direction: column; gap: 12px; }
.dropzone-title { color: var(--text); }
.dropzone.has-files { padding: 14px 18px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.picker-grid:empty { display: none; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.tile.is-dragging { cursor: grabbing; opacity: .85; transform: scale(1.04); box-shadow: 0 6px 18px rgba(30, 35, 33, .18); z-index: 2; }
.tile-cover {
  display: none; position: absolute; left: 6px; top: 6px; padding: 1px 7px; border-radius: 5px;
  background: rgba(255, 255, 255, .94); color: var(--text); font-size: 11px;
}
.tile:first-child .tile-cover { display: block; }
.tile-tag {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 5px;
  background: rgba(30, 35, 33, .62); color: #fff; font-size: 11px;
}
.tile form { margin: 0; }
.tile-remove {
  position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .94); color: var(--danger); font-size: 17px; line-height: 26px; cursor: pointer;
}
.tile-remove:hover { background: #fff; }

/* Lightbox */
.viewer img { cursor: zoom-in; }
html.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(20, 23, 22, .94); }
.lb-stage { position: absolute; inset: 56px 72px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-stage img { cursor: zoom-in; transition: transform .2s; }
.lb-stage img.is-zoomed { cursor: zoom-out; transform: scale(2.5); }
.lb-btn {
  position: absolute; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-close { right: 16px; top: 8px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: rgba(255, 255, 255, .7); font-size: 13px; }

.message { max-width: 520px; margin: 72px auto; text-align: center; }
.message p { color: var(--muted); }

/* Narrow screens */
@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .field-rooms { grid-column: 1 / -1; }
  .filters-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .gallery, .details { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .stage { position: static; order: -1; }
  .thumbs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84px; overflow-x: auto; max-height: none; }
  .title-row { flex-direction: column; gap: 14px; }
  .actions { justify-content: flex-start; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 20px; }
  h1 { font-size: 22px; }
  .nav { gap: 14px; }
  .top .btn-sm { padding: 0 10px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .filters { grid-template-columns: 1fr; padding: 16px; }
  .fields { grid-template-columns: 1fr; }
  .kf-big { font-size: 52px; }
  .keyfacts { gap: 12px 28px; padding-top: 20px; }
  .lb-stage { inset: 56px 8px 48px; }
  .lb-prev, .lb-next { top: auto; bottom: 6px; transform: none; }
}

@media (max-width: 420px) {
  .hide-xs { display: none; }
}

/* Login */
.login { max-width: 360px; margin: 64px auto; }
.login h1 { margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .btn { margin-top: 4px; }

/* Notices, avatars */
.notice { padding: 12px 14px; border: 1px solid #cfdcd7; background: var(--accent-soft); color: var(--accent); border-radius: 8px; margin: 0 0 20px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: var(--surface-2); color: var(--muted); font-weight: 600; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; font-size: 32px; }
.avatar-xl { width: 112px; height: 112px; font-size: 40px; }

/* Profile */
.profile-hint { margin: -12px 0 20px; }
.profile-photo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.profile-photo .btn { position: relative; }
.contacts-hint { margin: 12px 0 0; }

/* Share panel on the listing page */
.share { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.share form { margin: 0; }
.share-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; }
.share-label { font-weight: 600; margin-right: 4px; }
.share-url { flex: 1 1 260px; width: auto; color: var(--muted); }
.share .hint { margin: 0; }

/* Public listing page */
.wrap-public { padding-top: 24px; }
.public { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.public-main { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.public-gallery { position: relative; aspect-ratio: 16 / 10; background: var(--surface); }
.public-gallery .card-slide img, .public-gallery .card-slide video { object-fit: contain; background: #f1efeb; }
.public-gallery .card-slide img { cursor: zoom-in; }
.public-gallery .card-nav { opacity: 1; width: 40px; height: 40px; line-height: 40px; font-size: 24px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.public-count { position: absolute; left: 14px; bottom: 14px; padding: 5px 10px; border-radius: 8px; background: rgba(255, 255, 255, .92); font-size: 14px; }
.public-body { padding: 24px 28px 32px; }
.public-body h2 { margin: 28px 0 12px; font-size: 19px; }
.public-facts { padding: 0 0 20px; border-bottom: 1px solid var(--line); }
.public-facts .kf { flex-direction: column-reverse; }
.public-facts .kf-label { font-size: 13px; }
.facts-dotted { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.facts-dotted div { border-bottom: 0; padding: 7px 0; align-items: baseline; }
.facts-dotted dt { flex: none; }
.facts-dotted div::after { content: ""; order: 1; flex: 1; border-bottom: 1px dotted var(--line-strong); margin: 0 6px; transform: translateY(-4px); }
.facts-dotted dd { order: 2; font-weight: 500; }
.public-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.public-title { font-size: 22px; line-height: 1.3; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.public-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.public-price .price { font-size: 26px; font-weight: 600; }
.public-price .per, .public-price .note { color: var(--muted); font-size: 14px; }
.public-price .note { width: 100%; }
.public-place { margin: 16px 0 0; }
.public-place span { color: var(--muted); }
.agent { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.agent-name { font-size: 20px; font-weight: 600; margin-top: 4px; }
.agent-phone { font-size: 22px; text-decoration: none; }
.agent-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.msg { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 10px; text-decoration: none; color: #fff; font-weight: 500; }
.msg svg { width: 20px; height: 20px; fill: currentColor; }
.msg-wa { background: #2f8f5b; }
.msg-tg { background: #2f7fb8; }
.msg:hover { filter: brightness(1.06); }
.public-status { margin-bottom: 16px; }

@media (max-width: 900px) {
  /* On phones: photos first, then price, then details and the realtor. */
  .public { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .public-gallery { aspect-ratio: 4 / 3; }
  .facts-dotted { grid-template-columns: minmax(0, 1fr); }
  .public-main { display: contents; }
  .public-gallery { order: 0; border-radius: var(--radius-lg); overflow: hidden; }
  .public-side { display: contents; }
  .public-side > .panel:first-child { order: 1; }
  .public-body { order: 2; padding: 20px 18px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
  .public-side > .panel.agent { order: 3; }
}

/* Search bar and quick toggles (mobile-first) */
.search { margin-bottom: 18px; }
.search-top { display: flex; gap: 10px; margin-bottom: 12px; }
.search-top input { height: 46px; font-size: 16px; flex: 1; }
.filters-toggle { height: 46px; display: none; }
.filters-toggle .count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  margin-left: 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px;
}
.quick { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.segmented-fill { display: inline-flex; gap: 0; padding: 3px; background: var(--surface); border-radius: 10px; }
.segmented-fill span { border: 0; height: 34px; border-radius: 8px; min-width: 0; padding: 0 14px; color: var(--muted); }
.segmented-fill input:checked + span { background: var(--bg); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 17px;
  border: 1px solid var(--line-strong); font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-head, .sheet-backdrop { display: none; }
.search .filters { margin-bottom: 0; }

/* Cards */
.card-deal {
  position: absolute; left: 10px; top: 10px; z-index: 1; padding: 2px 8px; border-radius: 6px;
  background: rgba(255, 255, 255, .94); font-size: 12px; font-weight: 500;
}
.card-author { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Listing page: owner contacts */
.owner-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius-lg); background: var(--accent-soft);
}
.owner-card > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.owner-label { font-size: 13px; color: var(--muted); }
.owner-actions { display: flex; gap: 8px; }
.private-note { margin: 0 0 16px; }

/* Form */
.rooms-more { width: 90px; height: 36px; }
.form-section.private { background: var(--surface); margin: 0 -16px; padding: 20px 16px; border-radius: var(--radius-lg); border-top: 0; }
.form-section.private + .form-actions { border-top: 0; }
.profile-more { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-more form { margin: 0; }

/* Agency */
.panel h2 { margin-bottom: 12px; }
.panel + .panel { margin-top: 16px; }
.panel .hint { margin: 0 0 12px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.inline-form input { flex: 1 1 220px; width: auto; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows form { margin: 0; }
.member-who { display: flex; flex-direction: column; gap: 2px; }
.member-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.member-actions select { height: 34px; width: auto; min-width: 150px; }
.created { border-color: var(--accent); }
.credentials { font-size: 17px; line-height: 1.8; margin: 0 0 8px; }

/* Bottom tab bar: phones only */
.tabbar { display: none; }

@media (max-width: 900px) {
  .filters-toggle { display: inline-flex; }
  .search .filters {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0;
    max-height: 85vh; overflow-y: auto; grid-template-columns: minmax(0, 1fr); gap: 16px;
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 16px 16px 0 0;
    background: var(--bg); box-shadow: 0 -8px 30px rgba(30, 35, 33, .18);
  }
  .search .filters.is-open { display: grid; }
  .search .filters.is-open ~ .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 23, 22, .35); }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 2px; position: sticky; top: -8px; background: var(--bg); }
  .field-rooms, .filters-actions { grid-column: 1; }
  .filters-actions .btn-primary { flex: 1; height: 46px; }
}

@media (max-width: 600px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .nav { display: none; }
  .top-in { height: 52px; }
  .page-head h1 { font-size: 22px; }
  .quick { gap: 8px; }
  .segmented-fill { width: 100%; }
  .segmented-fill label { flex: 1; }
  .segmented-fill span { width: 100%; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--line); backdrop-filter: blur(8px);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
    color: var(--muted); text-decoration: none; font-size: 11px;
  }
  .tabbar svg { width: 24px; height: 24px; fill: currentColor; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .tab-add { flex: none; width: 52px; height: 52px; margin: -18px 10px 0; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(63, 87, 82, .35); }
  .tabbar .tab-add svg { width: 28px; height: 28px; }
  .tabbar .tab-add[aria-current="page"] { color: #fff; }
  .sticky-actions {
    position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 20; margin: 0 -16px;
    padding: 12px 16px; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
  }
  .sticky-actions .btn-primary { flex: 1; height: 48px; font-size: 16px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .actions form { flex: 1; display: flex; }
  .share-row .btn { flex: 1; }
  .owner-actions { width: 100%; }
  .owner-actions .btn { flex: 1; height: 44px; }
}

/* Icon buttons */
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-fill { fill: currentColor; stroke: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg); color: var(--text); cursor: pointer; text-decoration: none; list-style: none;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn.danger { color: var(--danger); }
.icon-btn::-webkit-details-marker { display: none; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar form { margin: 0; }
.filters-toggle .count { position: absolute; top: -6px; right: -6px; margin: 0; }
.fav-title { font-size: 20px; margin: 0 0 10px; }

/* Favorite heart */
.fav-form { position: absolute; top: 8px; right: 8px; z-index: 2; margin: 0; }
.fav {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: var(--text); cursor: pointer;
}
.fav .i, .fav-inline .i { transition: transform .15s; }
.fav.is-on, .fav-inline.is-on { color: #c2413b; }
.fav.is-on .i, .fav-inline.is-on .i { fill: currentColor; }
.fav:active .i, .fav-inline:active .i { transform: scale(.85); }

/* Card with a menu */
.card { position: relative; }
.card-slide { display: block; }
.card-body { display: flex; flex-direction: row; gap: 6px; align-items: flex-start; padding: 10px 2px 0; }
.card-link { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-decoration: none; }
.card-menu { position: relative; flex: none; }
.card-menu .icon-btn { width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--muted); }
.card-menu[open] .icon-btn { background: var(--surface); color: var(--text); }
.menu {
  position: absolute; right: 0; top: 36px; z-index: 30; min-width: 190px; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(30, 35, 33, .16);
}
.menu form { margin: 0; }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; cursor: pointer; font-size: 14px;
}
.menu button:hover { background: var(--surface); }
.menu button.danger { color: var(--danger); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

/* Compact sizing */
body { font-size: 14px; }
h1 { font-size: 22px; }
input, select { height: 38px; }
.btn { height: 38px; padding: 0 14px; }
.segmented span { height: 32px; min-width: 40px; font-size: 13px; }
.segmented-fill span { height: 30px; }
.chip span { height: 30px; padding: 0 12px; font-size: 13px; }
.search-top input, .filters-toggle { height: 42px; }
.filters-toggle { width: 42px; }
.grid { gap: 16px; }
.card-media { border-radius: 12px; }
.card-title { font-size: 15px; }
.card-specs, .card-author { font-size: 13px; }
.card-price { font-size: 15px; }
.form-section { padding: 18px 0; }
.form-section h2 { font-size: 16px; margin-bottom: 12px; }
.fields { gap: 12px 16px; }
.title-row { margin-bottom: 16px; }
.keyfacts { padding-top: 20px; }
.kf-big { font-size: 52px; }
.kf-label { font-size: 15px; }
.kf-value { font-size: 17px; }
.panel { padding: 18px; }

@media (max-width: 600px) {
  main.wrap { padding-top: 14px; padding-bottom: 32px; }
  h1 { font-size: 20px; }
  .top-in { height: 48px; }
  .search { margin-bottom: 12px; }
  .search-top { margin-bottom: 10px; }
  .quick { margin-bottom: 10px; }
  .result-count { margin-bottom: 10px; font-size: 13px; }
  .grid { gap: 18px; }
  .card-media { aspect-ratio: 16 / 11; }
  .title-row { gap: 10px; }
  .toolbar { width: 100%; }
  .toolbar .icon-btn { width: 44px; height: 40px; }
  .kf-big { font-size: 44px; }
  .keyfacts { gap: 10px 24px; }
  .tabbar { padding-top: 4px; }
  .tabbar a { font-size: 10px; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .tab-add { width: 46px; height: 46px; margin: -14px 6px 0; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sticky-actions .btn-primary { height: 44px; font-size: 15px; }
}
