/* ---------- палитра ---------- */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --panel-2: #f8fafc; --text: #0f172a; --muted: #64748b; --line: #e2e8f0; --line-2: #cbd5e1;
  --accent: #2563eb; --accent-ink: #ffffff; --accent-soft: #eff4ff; --good: #15803d; --good-soft: #e9f7ee;
  --warn: #b45309; --warn-soft: #fff6e6; --danger: #b91c1c; --olx: #0f766e; --olx-soft: #e6f6f4;
  --radius: 12px; --radius-sm: 8px; --header-h: 56px; --bar-h: 56px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --panel: #111827; --panel-2: #0f172a; --text: #e5e7eb; --muted: #94a3b8; --line: #1f2937; --line-2: #334155;
    --accent: #60a5fa; --accent-ink: #0b1120; --accent-soft: #172554; --good: #4ade80; --good-soft: #052e16;
    --warn: #fbbf24; --warn-soft: #2a1d05; --danger: #f87171; --olx: #2dd4bf; --olx-soft: #042f2e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --panel: #111827; --panel-2: #0f172a; --text: #e5e7eb; --muted: #94a3b8; --line: #1f2937; --line-2: #334155;
  --accent: #60a5fa; --accent-ink: #0b1120; --accent-soft: #172554; --good: #4ade80; --good-soft: #052e16;
  --warn: #fbbf24; --warn-soft: #2a1d05; --danger: #f87171; --olx: #2dd4bf; --olx-soft: #042f2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- основа ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 26px 0 12px; letter-spacing: -.005em; }
h3 { font-size: 12px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ico { flex: none; display: block; }

/* ---------- шапка ---------- */
header.top { height: var(--header-h); display: flex; align-items: center; gap: 22px; padding: 0 20px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: relative; z-index: 30; }
header.top .logo { display: inline-flex; align-items: center; gap: 7px; color: var(--text); text-decoration: none; white-space: nowrap; }
header.top .logo-mark { width: 26px; height: 26px; flex: none; }
header.top .logo-mark path { fill: var(--accent); }
header.top .logo-mark path.shop { fill: var(--accent-ink); }
header.top .logo-word { font-weight: 800; font-size: 19px; letter-spacing: .04em; }
header.top .logo-word b { font-weight: 800; color: var(--accent); }
header.top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
header.top nav::-webkit-scrollbar { display: none; }
header.top nav a { padding: 7px 11px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; }
header.top nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
header.top nav a.active { color: var(--text); background: var(--accent-soft); }
header.top .tag { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- элементы управления ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; background: var(--accent); color: var(--accent-ink);
  border-radius: 10px; border: 0; cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500;
  color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .18); font-weight: 600; }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.field { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 14px; outline: none; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.range { display: flex; align-items: center; gap: 8px; }
.range .field { flex: 1; min-width: 0; }
.range span { color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--text); }
.chip:hover { border-color: var(--line-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip .x { opacity: .6; font-size: 15px; line-height: 1; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; cursor: pointer; font-size: 14px; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch .hint { display: block; color: var(--muted); font-size: 12.5px; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line-2);
  position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); margin-right: 4px; white-space: nowrap; }
.badge.traffic { background: var(--good-soft); color: var(--good); border-color: transparent; font-weight: 600; }
.badge.auction { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.new { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.badge.olx { background: var(--olx-soft); color: var(--olx); border-color: transparent; font-weight: 600; }

/* ---------- главная: полоса фильтров ---------- */
.app { height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); display: grid; grid-template-rows: var(--bar-h) 1fr; }
.fbar { display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: relative; z-index: 20; }
.fbar .scroll { display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 6px 0; }
.fbar .scroll::-webkit-scrollbar { display: none; }
.fbtn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  cursor: pointer; font-size: 13.5px; font-weight: 500; white-space: nowrap; color: var(--text); }
.fbtn:hover { border-color: var(--line-2); }
.fbtn.set { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.fbtn.set .caret { opacity: .85; }
.fbtn .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .55; }
.fbtn .n { background: var(--accent-ink); color: var(--accent); border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 17px; font-weight: 700; }
.fbar .city { width: 170px; flex: none; padding: 7px 12px; border-radius: 999px; }
.fbar .reset { flex: none; }
.pop { position: fixed; z-index: 40; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 16px; width: 360px; max-width: calc(100vw - 24px); max-height: calc(100vh - 140px); overflow-y: auto; }
.pop[hidden] { display: none; }
.pop h3 { margin-top: 2px; }
.pop .sect + .sect { margin-top: 16px; }
.pop .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pop.wide { width: 470px; }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind { --kc: #64748b; display: flex; align-items: center; gap: 10px; padding: 10px 11px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--panel); cursor: pointer; text-align: left; font-size: 13.5px; line-height: 1.25; color: var(--text); position: relative; }
.kind:hover { border-color: var(--line-2); }
.kind .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: var(--kc);
  background: color-mix(in srgb, var(--kc) 12%, transparent); }
.kind .lbl { flex: 1; min-width: 0; }
.kind .cnt { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.kind.on { border-color: var(--kc); background: color-mix(in srgb, var(--kc) 7%, var(--panel)); font-weight: 600; }
.kind.on .ic { background: var(--kc); color: #fff; }
.kind .tick { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; }
.kind.on .tick { background: var(--kc); border-color: var(--kc); }
.kind.on .tick::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------- главная: список и карта ---------- */
.main { display: grid; grid-template-columns: 410px 1fr; min-height: 0; }
.results { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.results .head { padding: 12px 16px 10px; border-bottom: 1px solid var(--line); }
.search { position: relative; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .field { padding-left: 36px; }
.rh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.rh .count { font-size: 13.5px; color: var(--muted); }
.rh .count b { color: var(--text); }
.rh select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: var(--panel); }
.list { overflow-y: auto; flex: 1; padding: 6px 8px 16px; }
.item { display: flex; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; }
.item:hover, .item.hl { background: var(--panel-2); }
.item .thumb { width: 92px; height: 72px; border-radius: 10px; flex: none; background: var(--panel-2) center / cover no-repeat; display: grid;
  place-items: center; color: var(--kc, var(--muted)); border: 1px solid var(--line); overflow: hidden; }
.item .thumb { position: relative; }
.item .thumb .ico { opacity: .7; }
.item .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.item .body { min-width: 0; flex: 1; }
.item .price { font-weight: 700; font-size: 15px; }
.item .price small { font-weight: 500; color: var(--muted); font-size: 12px; }
.item .t { font-size: 13.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .a { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .bd { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.item .bd .badge { margin: 0; font-size: 11.5px; padding: 1px 7px; }
.list .more { display: block; margin: 8px auto 0; }
.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.loading { padding: 18px 16px; color: var(--muted); font-size: 13.5px; }
.loading .bar { margin-top: 8px; }
.mapwrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #e8ecef; }
.sheet-handle { display: none; }

/* ---------- карта: попапы, карточка, веер ---------- */
.maplibregl-popup-content { padding: 12px 14px; border-radius: 12px; font-size: 13px; min-width: 220px; background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-lg); }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.maplibregl-popup-content .t { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.maplibregl-popup-content a.btn { margin-top: 8px; padding: 6px 12px; font-size: 13px; color: var(--accent-ink); }
.maplibregl-popup-content .b-list { margin-top: 4px; line-height: 1.5; max-height: 160px; overflow-y: auto; }
.maplibregl-popup-close-button { font-size: 18px; padding: 2px 8px; color: var(--muted); }
button.map-mode { font-weight: 700; font-size: 12px; width: 29px; height: 29px; }
.hover-card { pointer-events: none; }
.hover-card .maplibregl-popup-content { padding: 0; width: 250px; overflow: hidden; }
.hover-card img { display: block; width: 100%; height: 140px; object-fit: cover; background: var(--panel-2); }
.hover-card .hc { padding: 10px 12px 11px; }
.hover-card .p { font-weight: 700; font-size: 15px; }
.hover-card .t { font-weight: 600; font-size: 13px; line-height: 1.3; margin: 2px 0 0; }
.hover-card .m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hover-card .hint { font-size: 11.5px; color: var(--accent); margin-top: 6px; }
.fan { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 5; }
.fan svg { position: absolute; overflow: visible; left: 0; top: 0; pointer-events: none; }
.fan svg line { stroke: rgba(15, 23, 42, .35); stroke-width: 1.5; }
.fan .hub { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: var(--panel); color: var(--text);
  display: grid; place-items: center; font-weight: 700; font-size: 12px; box-shadow: var(--shadow); border: 2px solid var(--text); }
.fan .it { position: absolute; width: 124px; margin: -50px 0 0 -62px; border: 0; padding: 0; background: none; cursor: pointer; animation: fan-in .18s ease-out both; }
.fan .it .ph { width: 124px; height: 94px; border-radius: 12px; background: var(--panel-2) center / cover no-repeat; border: 2.5px solid #fff;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .35); display: grid; place-items: center; color: var(--kc, var(--muted)); }
.fan .it .pr { display: block; margin: -9px auto 0; width: max-content; max-width: 130px; position: relative; background: var(--panel); color: var(--text);
  font-size: 13px; font-weight: 700; padding: 1px 7px; border-radius: 999px; box-shadow: 0 1px 4px rgba(15, 23, 42, .3); white-space: nowrap; }
.fan .it:hover .ph, .fan .it:focus-visible .ph { border-color: var(--accent); transform: scale(1.06); }
.fan .detail { position: absolute; width: 250px; left: -125px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px 12px;
  font-size: 12.5px; pointer-events: none; }
.fan .detail .p { font-weight: 700; font-size: 14px; }
.fan .detail .m { color: var(--muted); }
@media (max-width: 599px) {
  .fan .it { width: 88px; margin: -36px 0 0 -44px; }
  .fan .it .ph { width: 88px; height: 66px; }
  .fan .it .pr { font-size: 12px; max-width: 96px; }
}
@keyframes fan-in { from { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(.4); } to { opacity: 1; transform: none; } }

/* ---------- страницы: отчёт, оценка, тексты ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid2 > .card, .grid3 > .card { margin: 0; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 7px 14px; font-size: 14px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.big { font-size: 42px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: 4px; border: 1px solid var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.hl { background: var(--accent-soft); }
.sat-none { color: var(--good); font-weight: 600; }
.sat-low { color: var(--good); }
.sat-mid { color: var(--warn); }
.sat-high { color: var(--danger); font-weight: 600; }
.flag { padding: 9px 13px; border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 8px 8px 0; margin: 8px 0; font-size: 13.5px; }
.photos { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scroll-snap-type: x mandatory; }
.photos img { height: 190px; border-radius: 12px; border: 1px solid var(--line); scroll-snap-align: start; }
#minimap, #checkmap { height: 400px; border-radius: 12px; overflow: hidden; }
.note { font-size: 13px; color: var(--muted); }
ul.plain { padding-left: 18px; }
ul.plain li + li { margin-top: 4px; }
.hero { padding: 26px 0 6px; }
.hero p { font-size: 17px; color: var(--muted); max-width: 720px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.card .kv + h3, .card .kv ~ h3 { margin-top: 18px; }
.summary .s { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.summary .s .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.summary .s .v { font-size: 22px; font-weight: 800; margin-top: 2px; letter-spacing: -.01em; }
.summary .s .d { font-size: 13px; color: var(--muted); }
.summary .s.good .v { color: var(--good); }
.summary .s.warn .v { color: var(--warn); }
.alts a { display: inline-block; margin-right: 10px; }
.share { float: right; }
footer { padding: 26px 20px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); background: var(--panel); }
.search-box { position: relative; }
.suggest { position: absolute; z-index: 1000; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  max-height: 260px; overflow-y: auto; box-shadow: var(--shadow); }
.suggest div { padding: 8px 12px; cursor: pointer; font-size: 13.5px; }
.suggest div:hover { background: var(--panel-2); }
.spinner { color: var(--muted); font-size: 13.5px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

/* ---------- телефон ---------- */
@media (max-width: 860px) {
  :root { --header-h: 52px; --bar-h: 52px; }
  header.top { gap: 10px; padding: 0 12px; }
  header.top .tag { display: none; }
  header.top nav a { padding: 6px 8px; font-size: 13.5px; }
  .fbar { padding: 0 10px; }
  .fbar .city { width: 130px; }
  .main { display: block; position: relative; }
  .mapwrap { position: absolute; inset: 0; }
  .results { position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; height: 78%; border-right: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 30px rgba(15, 23, 42, .18); transform: translateY(calc(100% - 128px)); transition: transform .25s ease; }
  .results.open { transform: none; }
  .sheet-handle { display: block; width: 100%; border: 0; background: none; padding: 8px 0 2px; cursor: pointer; }
  .sheet-handle::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 0 auto; }
  .results .head { padding-top: 4px; }
  .pop { left: 8px !important; right: 8px; width: auto !important; top: auto !important; bottom: 8px; max-height: 75vh; border-radius: 18px; }
  .grid2, .grid3, .summary { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv > div:nth-child(even) { margin-bottom: 8px; }
  .page { padding: 16px 14px 48px; }
  h1 { font-size: 22px; }
  .item .thumb { width: 80px; height: 64px; }
}
