:root {
  /* Фирменная палитра в духе ПИК: белый, чёрная типографика, оранжевый акцент */
  --pik: #ff4f12;
  --pik-press: #e8430a;
  --bg: #ffffff;
  --sec: #f3f3f3;
  --card: #ffffff;
  --text: #111111;
  --hint: #8c8c8c;
  --sub: #5c5c5c;
  --accent: var(--pik);
  --accent-text: #ffffff;
  --ink: #111111;          /* выбранные чипсы, тёмные кнопки */
  --ink-text: #ffffff;
  --link: var(--pik);
  --danger: #e5383b;
  --ok: #17a34a;
  --line: rgba(0,0,0,.08);
  --soft: rgba(255,79,18,.1);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
  --r: 16px;
  --r-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar: 62px;
  color-scheme: light;
}
:root.dark {
  --bg: #121212; --sec: #0a0a0a; --card: #1b1b1b; --text: #f5f5f5; --hint: #8e8e8e; --sub: #b3b3b3;
  --ink: #f5f5f5; --ink-text: #111111; --line: rgba(255,255,255,.09); --soft: rgba(255,79,18,.16);
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.4 "Helvetica Neue", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--sec); color: var(--text);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
img { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- каркас */
#view { min-height: 100vh; padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px); }
body.nested #view { padding-bottom: calc(var(--safe-b) + 24px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.8) blur(18px); -webkit-backdrop-filter: saturate(1.8) blur(18px);
  border-top: .5px solid var(--line);
  transition: transform .2s ease;
}
body.nested .tabbar { transform: translateY(110%); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--hint); font-size: 10.5px; font-weight: 500; position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--accent); }
.tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }

.head { padding: 14px 16px 6px; background: var(--bg); }
.head h1 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.02em; font-weight: 750; }
.head .sub { color: var(--hint); font-size: 13px; margin-top: 3px; }
.sticky { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: .5px solid var(--line); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding: 0; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 17px; white-space: nowrap;
  background: var(--sec); color: var(--text); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, transform .1s;
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--accent); color: var(--accent-text); }
.chip small { opacity: .65; font-weight: 500; font-size: 12px; }
.chip.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

.search { margin: 4px 16px 10px; position: relative; }
.search input {
  width: 100%; height: 40px; border-radius: 12px; border: 0; outline: 0; background: var(--sec);
  padding: 0 12px 0 38px; font-size: 16px;
}
.search svg { position: absolute; left: 11px; top: 10px; width: 20px; height: 20px; color: var(--hint); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 16px 8px; font-size: 13px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; }
.section-title b { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 20px; font-weight: 700; }

.card { background: var(--card); border-radius: var(--r); margin: 0 12px 12px; overflow: hidden; }
.pad { padding: 14px 16px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ карточки ЖК */
.blocks { padding: 8px 12px 0; display: grid; gap: 14px; }
@media (min-width: 640px) { .blocks { grid-template-columns: 1fr 1fr; } }
.bcard { background: var(--card); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); text-align: left; width: 100%; transition: transform .12s; }
.bcard:active { transform: scale(.985); }
.bcard .ph { position: relative; aspect-ratio: 16 / 10; background: var(--sec); }
.bcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.bcard .ph::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.62)); }
.bcard .over { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; color: #fff; }
.bcard .over h3 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -.01em; text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.bcard .over .m { font-size: 13px; opacity: .95; margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.tagtop { position: absolute; top: 12px; left: 12px; z-index: 1; display: flex; gap: 6px; }
.tag { height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; background: rgba(0,0,0,.45); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tag.light { background: var(--soft); color: var(--accent); backdrop-filter: none; }
.tag.okk { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.bcard .info { padding: 12px 14px 14px; }
.price-big { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.rooms-mini { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.rooms-mini::-webkit-scrollbar { display: none; }
.rooms-mini span { flex: none; background: var(--sec); border-radius: 10px; padding: 6px 9px; font-size: 12px; line-height: 1.25; }
.rooms-mini span b { display: block; font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 1.5px rgba(255,255,255,.8); }

/* -------------------------------------------------------- карточки квартир */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.fcard { background: var(--card); border-radius: var(--r); overflow: hidden; text-align: left; position: relative; transition: transform .12s; display: flex; flex-direction: column; }
.fcard:active { transform: scale(.975); }
.fcard .plan { background: #fff; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 10px; }
.fcard .plan img { max-height: 100%; object-fit: contain; }
.fcard .body { padding: 10px 11px 12px; }
.fcard .p { font-size: 16.5px; font-weight: 750; letter-spacing: -.01em; }
.fcard .old { font-size: 12px; color: var(--hint); text-decoration: line-through; margin-left: 4px; font-weight: 500; }
.fcard .t { font-size: 13px; margin-top: 2px; }
.fcard .s { font-size: 12px; color: var(--hint); margin-top: 3px; line-height: 1.3; }
.heart { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.9); display: flex; align-items: center; justify-content: center; color: #b8bcc4; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.heart svg { width: 19px; height: 19px; }
.heart.on { color: #ff3b5c; }
.heart.pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.3); } }
.disc { position: absolute; top: 8px; left: 8px; background: #ff3b5c; color: #fff; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 3px 7px; }

.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .fcard { flex: none; width: 46%; scroll-snap-align: start; }

/* ------------------------------------------------------------------ фильтры */
.fbar { display: flex; gap: 8px; padding: 0 16px 10px; align-items: center; }
.fbar .count { margin-left: auto; font-size: 13px; color: var(--hint); white-space: nowrap; }
.budget { padding: 2px 16px 12px; }
.budget .lbl { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.budget .lbl b { font-weight: 650; }
.range2 { position: relative; height: 28px; }
.range2 .track { position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--sec); }
.range2 .fill { position: absolute; top: 12px; height: 4px; border-radius: 2px; background: var(--accent); }
.range2 input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; height: 28px; }
.range2 input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.28); border: 0; }
.range2 input::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.28); border: 0; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 0; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--sec) var(--p, 50%)); }
.slider::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--sec) var(--p, 50%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.28); }
.slider::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.28); border: 0; }

.scope { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 15px; background: var(--soft); color: var(--accent); font-weight: 600; font-size: 13px; margin: 0 16px 8px; max-width: calc(100% - 32px); }
.scope button { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ----------------------------------------------------------------- шторка */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; opacity: 0; transition: opacity .2s; }
.sheet-bg.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + var(--safe-b));
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.3,1);
}
.sheet.show { transform: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 10px; }
.sheet h2 { margin: 4px 0 4px; font-size: 21px; font-weight: 750; }
.field { margin-top: 14px; }
.field > label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 7px; font-weight: 500; }
.inp { width: 100%; height: 46px; border-radius: 12px; border: 0; outline: 0; background: var(--sec); padding: 0 14px; font-size: 16px; }
textarea.inp { height: 84px; padding: 12px 14px; resize: none; }
.inp:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.btn { width: 100%; height: 50px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 650; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: opacity .15s, transform .1s; }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .45; }
.btn.sec { background: var(--soft); color: var(--accent); }
.btn.plain { background: var(--card); color: var(--text); }
.sheet .btn.plain { background: var(--sec); }
.btns { display: grid; gap: 8px; }
.btns.two { grid-template-columns: 1fr 1fr; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--sub); margin-top: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--sec); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { height: 36px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--sub); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ---------------------------------------------------------------- экран ЖК */
.gallery { position: relative; background: #000; }
.gallery .track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; }
.gallery .track::-webkit-scrollbar { display: none; }
.gallery .track img { flex: none; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.gallery .dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; gap: 5px; justify-content: center; }
.gallery .dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.5); transition: width .2s, background .2s; }
.gallery .dots i.on { width: 16px; background: #fff; }
.gallery .cnt { position: absolute; top: 12px; right: 12px; }
.hero { background: var(--bg); padding: 16px 16px 14px; border-radius: 20px 20px 0 0; margin-top: -18px; position: relative; }
.hero h1 { margin: 0; font-size: 27px; letter-spacing: -.02em; line-height: 1.15; font-weight: 780; }
.metro { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; color: var(--sub); }
.metro span { display: inline-flex; align-items: center; gap: 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.stat { background: var(--sec); border-radius: 14px; padding: 11px 12px; }
.stat .k { font-size: 12px; color: var(--hint); }
.stat .v { font-size: 17px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.rtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.rtile { background: var(--sec); border-radius: 14px; padding: 11px 12px; text-align: left; transition: transform .1s; }
.rtile:active { transform: scale(.96); }
.rtile .n { font-weight: 700; }
.rtile .pr { font-size: 13px; margin-top: 3px; }
.rtile .c { font-size: 12px; color: var(--hint); }
.list .li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: .5px solid var(--line); }
.list .li:first-child { border-top: 0; }
.prog { padding: 12px 16px; border-top: .5px solid var(--line); }
.prog:first-child { border-top: 0; }
.prog .rate { font-size: 20px; font-weight: 750; color: var(--accent); }
.cams { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px; scrollbar-width: none; }
.cams img { flex: none; width: 70%; aspect-ratio: 16/9; object-fit: cover; border-radius: 14px; background: var(--sec); }
.mapbox { height: 190px; border-radius: var(--r); overflow: hidden; margin: 0 12px 12px; }

/* ----------------------------------------------------------- экран квартиры */
.planbox { background: #fff; margin: 0 12px; border-radius: 20px; padding: 18px; position: relative; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; }
.planbox img { max-height: 100%; object-fit: contain; }
.planbox .zoom { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.06); display: flex; align-items: center; justify-content: center; color: #333; }
.fhead { padding: 16px 16px 4px; }
.fhead .title { font-size: 15px; color: var(--sub); }
.fhead .price { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.fhead .oldp { color: var(--hint); text-decoration: line-through; font-size: 15px; margin-right: 8px; }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.params > div { background: var(--card); padding: 11px 16px; }
.params .k { font-size: 12px; color: var(--hint); }
.params .v { font-weight: 600; margin-top: 1px; }
.feat { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 14px; }
.feat span { background: var(--sec); padding: 6px 10px; border-radius: 10px; font-size: 13px; }

.calc .pay { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.calc .ctl { margin-top: 14px; }
.calc .ctl .row { justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.calc .ctl b { font-weight: 650; }
.calc .res { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pcard { border-radius: 14px; background: var(--sec); padding: 12px; margin-top: 8px; text-align: left; width: 100%; display: block; }
.pcard.on { box-shadow: inset 0 0 0 2px var(--accent); }
.pcard .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.pcard .nm { font-weight: 600; font-size: 14px; }
.pcard .pm { font-weight: 750; white-space: nowrap; }
.pcard .warn { color: #d48806; font-size: 12px; margin-top: 4px; }

.spark { width: 100%; height: 64px; display: block; }

/* ---------------------------------------------------------------- карта */
#map { position: fixed; inset: 0 0 calc(var(--tabbar) + var(--safe-b)) 0; z-index: 1; }
.pin { background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 12px; padding: 5px 8px; border-radius: 10px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.3); position: relative; transform: translate(-50%, -100%); display: inline-block; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--accent); }
.pin.sel { background: #111; color: #fff; z-index: 1000; }
.pin.sel::after { border-top-color: #111; }
.leaflet-div-icon { background: none; border: 0; }
.mapcard { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar) + var(--safe-b) + 12px); z-index: 500; }
.mapcard .bcard .ph { aspect-ratio: 16 / 7; }
.mapchips { position: fixed; top: 0; left: 0; right: 0; z-index: 500; }
.mapchips .chip { box-shadow: 0 2px 8px rgba(0,0,0,.15); background: var(--bg); }
.mapchips .chip.on { background: var(--accent); }

/* ------------------------------------------------------------ служебное */
.skel { background: linear-gradient(90deg, var(--sec) 0%, color-mix(in srgb, var(--sec) 60%, var(--bg)) 50%, var(--sec) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 14px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty { text-align: center; padding: 48px 28px; color: var(--hint); }
.empty .ic { font-size: 44px; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.toast { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); opacity: 0; z-index: 1200; background: rgba(17,17,17,.94); color: #fff; padding: 11px 16px; border-radius: 14px; font-size: 14px; transition: all .25s; max-width: 88vw; text-align: center; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.viewer { position: fixed; inset: 0; z-index: 1100; background: #fff; display: flex; align-items: center; justify-content: center; overflow: auto; touch-action: pinch-zoom pan-x pan-y; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer .x { position: fixed; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.08); color: #111; font-size: 22px; display: flex; align-items: center; justify-content: center; }
.success { text-align: center; padding: 26px 8px 10px; }
.success .ic { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); display: flex; align-items: center; justify-content: center; animation: pop .5s ease; }
.success .ic svg { width: 40px; height: 40px; }
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sec); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lead-item { padding: 12px 16px; border-top: .5px solid var(--line); }
.lead-item:first-child { border-top: 0; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--sec); flex: none; }
.iconbtn svg { width: 20px; height: 20px; }
.heart-inline.on { color: #ff3b5c; }
.heart-inline.pop { animation: pop .35s ease; }
.zlow .pin { font-size: 0; padding: 0; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid #fff; transform: translate(-50%, -50%); }
.zlow .pin::after { display: none; }
.zlow .pin.sel { width: 22px; height: 22px; }
.dark-map .osm-tiles { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
.leaflet-container { background: var(--sec); }
.valbtn { font-weight: 650; color: var(--text); border-bottom: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent); padding: 2px 0; }
.valbtn:active { opacity: .6; }
.unit .seg button.on { background: var(--bg); }
.head .iconbtn { margin-top: 2px; }
.lead-item .iconbtn { width: 34px; height: 34px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.fbar { flex-wrap: wrap; row-gap: 6px; }

/* ------------------------------------------------ карта не перекрывает шторки и просмотр фото */
.leaflet-container { isolation: isolate; z-index: 0; font: inherit; }
.mapbox { position: relative; isolation: isolate; z-index: 0; }
#map { isolation: isolate; }
.viewer.dark { background: #000; }
.viewer.dark .x { background: rgba(255,255,255,.18); color: #fff; }

/* ---------------------------------------------------------------- стиль ПИК */
h1, h2, .price-big, .fhead .price, .calc .pay, .fcard .p { letter-spacing: -.03em; }
.head h1 { font-size: 30px; font-weight: 800; }
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hint); margin-bottom: 6px; }
.brand i { width: 10px; height: 10px; background: var(--pik); border-radius: 2px; display: inline-block; }
.chip { border-radius: 10px; font-weight: 600; }
.chip.on { background: var(--ink); color: var(--ink-text); }
.chip.ghost { box-shadow: inset 0 0 0 1.5px var(--line); }
.chip.ghost.on { background: var(--ink); color: var(--ink-text); box-shadow: none; }
.btn { border-radius: 12px; font-weight: 700; letter-spacing: -.01em; }
.btn:not(.sec):not(.plain):active { background: var(--pik-press); }
.btn.sec { background: var(--ink); color: var(--ink-text); }
.seg { border-radius: 12px; }
.seg button { border-radius: 9px; }
.seg button.on { background: var(--card); color: var(--text); }
.search input { border-radius: 12px; background: var(--sec); }
.bcard { border-radius: 18px; box-shadow: var(--shadow); }
.bcard .price-big { font-weight: 800; }
.price-big { color: var(--text); }
.tag { border-radius: 6px; font-weight: 700; }
.tagtop .tag:first-child { background: var(--pik); }
.fcard { border-radius: 16px; box-shadow: var(--shadow); }
.fcard .p { font-weight: 800; }
.disc { background: var(--pik); border-radius: 6px; }
.heart.on, .heart-inline.on { color: var(--pik); }
.tab.on { color: var(--pik); }
.tab .badge { background: var(--pik); }
.pin { background: var(--pik); border-radius: 8px; font-weight: 800; }
.pin::after { border-top-color: var(--pik); }
.pin.sel { background: #111; }
.zlow .pin { background: var(--pik); }
.prog .rate { color: var(--pik); }
.stat { border-radius: 12px; }
.rtile { border-radius: 12px; }
.rtile .pr { font-weight: 700; }
.pcard.on { box-shadow: inset 0 0 0 2px var(--pik); }
.scope { background: var(--soft); color: var(--pik); border-radius: 10px; }
.valbtn { border-bottom-color: color-mix(in srgb, var(--pik) 60%, transparent); }
.slider::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--pik) var(--p, 50%), var(--sec) var(--p, 50%)); }
.slider::-moz-range-track { background: linear-gradient(90deg, var(--pik) var(--p, 50%), var(--sec) var(--p, 50%)); }
.range2 .fill { background: var(--pik); }
.slider::-webkit-slider-thumb, .range2 input::-webkit-slider-thumb { box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.25); }
.success .ic { background: var(--soft); color: var(--pik); }
.spinner { border-top-color: var(--pik); }
.check input { accent-color: var(--pik); }
.tag.okk { background: var(--soft); color: var(--pik); }
.footnote { text-align: center; font-size: 12px; color: var(--hint); padding: 18px 24px 4px; }
.leaflet-control-attribution { font-size: 10px; }

/* ----------------------------------------------------------------- подборки */
.colls { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.colls::-webkit-scrollbar { display: none; }
.coll { flex: none; width: 156px; background: var(--card); border-radius: 16px; overflow: hidden; text-align: left; scroll-snap-align: start; box-shadow: var(--shadow); transition: transform .12s; }
.coll:active { transform: scale(.97); }
.coll .ph { height: 84px; background: var(--sec); position: relative; }
.coll .ph img { width: 100%; height: 100%; object-fit: cover; }
.coll .ph::after { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--pik); }
.coll .cbody { padding: 10px 12px 12px; }
.coll .ct { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.coll .cs { font-size: 12px; color: var(--hint); margin-top: 1px; min-height: 30px; line-height: 1.25; }
.coll .cm { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; }
.coll .cm span { font-weight: 800; color: var(--pik); font-size: 14px; }
.coll .cm em { font-style: normal; font-size: 12px; color: var(--hint); }
.coll .cm em::after { content: " кв."; }

/* ------------------------------------------------------------------- отчёт */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 12px 0; }
.kpi { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--hint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px; }
.kpi .s { font-size: 12px; color: var(--hint); }
.kpi:first-child .v { color: var(--pik); }
.bars { display: grid; gap: 10px; }
.bar .bl { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bar .bl span { min-width: 0; }
.bar .bl b { white-space: nowrap; font-weight: 700; }
.bar .bl small { color: var(--hint); font-weight: 500; }
.bar .bt { height: 8px; background: var(--sec); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.bar .bt i { display: block; height: 100%; background: var(--pik); border-radius: 0 4px 4px 0; }
.days { display: flex; align-items: flex-end; gap: 2px; height: 130px; padding-bottom: 18px; position: relative; }
.day { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; padding: 0; }
.day i { display: block; background: var(--pik); border-radius: 4px 4px 0 0; min-height: 2px; }
.day i.zero { background: var(--line); }
.day.on i { background: var(--ink); }
.day span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--hint); white-space: nowrap; }

/* --------------------------------------------------------------- мой дом */
.homecard { background: var(--card); border-radius: 20px; overflow: hidden; margin: 12px 12px 0; box-shadow: var(--shadow); }
.homecard .ph { position: relative; aspect-ratio: 16 / 9; background: var(--sec); }
.homecard .ph img { width: 100%; height: 100%; object-fit: cover; }
.homecard .ph::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.homecard .over { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 1; color: #fff; }
.homecard .over h3 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.cd { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cd b { font-size: 44px; font-weight: 800; letter-spacing: -.03em; color: var(--pik); line-height: 1; }
.cd span { color: var(--sub); font-size: 15px; }
#mseg { padding: 8px 16px 10px; }

/* ======================================================================
   ДВИЖЕНИЕ. Пружинные кривые, как в iOS: быстрый старт, мягкая посадка.
   ====================================================================== */
:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --out: cubic-bezier(.2, .8, .2, 1);
  --glass: color-mix(in srgb, var(--bg) 80%, transparent);
}

/* ------------------------------------------------ переходы между экранами */
.enter-tab { animation: tabIn .32s var(--out) both; }
.enter-tab:has(#map) { animation-name: fadeIn; }
@keyframes tabIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes fadeIn { from { opacity: 0; } }
.enter-push { position: relative; z-index: 2; min-height: 100vh; background: var(--sec); animation: pushIn .42s var(--out) both; box-shadow: -14px 0 32px rgba(0,0,0,.14); }
@keyframes pushIn { from { transform: translateX(100%); } }
.enter-back { animation: backIn .4s var(--out) both; }
@keyframes backIn { from { transform: translateX(var(--b0, -28%)); opacity: .55; } }
.navghost { position: fixed; inset: 0; overflow: hidden; pointer-events: none; background: var(--sec); }
.navghost.g-under { z-index: 0; animation: gUnder .42s var(--out) forwards; }
.navghost.g-under::after { content: ""; position: absolute; inset: 0; background: #000; opacity: 0; animation: dim .42s var(--out) forwards; }
@keyframes gUnder { to { transform: translateX(-28%); } }
@keyframes dim { to { opacity: .18; } }
.navghost.g-over { z-index: 950; box-shadow: -14px 0 32px rgba(0,0,0,.16); animation: gOver .36s cubic-bezier(.3,.7,.4,1) forwards; }
@keyframes gOver { from { transform: translateX(var(--x0, 0)); } to { transform: translateX(100%); } }
.dragging { box-shadow: -14px 0 32px rgba(0,0,0,.16); transition: none !important; }

/* --------------------------------------------- проявление при прокрутке */
.rv { opacity: 0; transform: translateY(18px) scale(.97); }
.rv.in { opacity: 1; transform: none; transition: opacity .5s var(--out), transform .65s var(--spring); }

/* ---------------------------------------------------- отклик на нажатие */
.bcard, .fcard, .coll, .rtile, .chip, .btn, .iconbtn, .pcard, .kpi, .homecard, .tab, .scope button, .valbtn, .seg button {
  transition: transform .5s var(--spring), background-color .2s, color .2s, box-shadow .25s, opacity .2s;
}
.bcard:active, .coll:active, .homecard:active { transform: scale(.975); transition-duration: .12s; }
.fcard:active, .rtile:active, .pcard:active, .kpi:active { transform: scale(.96); transition-duration: .12s; }
.chip:active, .iconbtn:active, .seg button:active { transform: scale(.92); transition-duration: .1s; }
.btn:active { transform: scale(.97); transition-duration: .1s; }
.bcard .ph img, .homecard .ph img { transition: transform 1.2s var(--out); }
.bcard:active .ph img { transform: scale(1.04); }

/* ------------------------------------------------------ панель вкладок */
.tabbar { background: var(--glass); backdrop-filter: saturate(1.9) blur(22px); -webkit-backdrop-filter: saturate(1.9) blur(22px); transition: transform .45s var(--out); }
body.nested .tabbar { transform: translateY(115%); }
.tab-ind { position: absolute; top: 7px; left: 0; height: 32px; width: calc(100% / var(--n, 5)); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .55s var(--spring); pointer-events: none; display: flex; justify-content: center; }
.tab-ind::before { content: ""; width: 58px; height: 32px; border-radius: 16px; background: var(--soft); }
.tabbar.noind .tab-ind { opacity: 0; }
.tab { z-index: 1; }
.tab .ti { display: flex; transition: transform .45s var(--spring); }
.tab .tl { transition: color .2s, font-weight .2s; }
.tab.on .tl { font-weight: 700; }
.tab.jump .ti { animation: tabJump .55s var(--spring); }
@keyframes tabJump { 0% { transform: scale(1); } 30% { transform: scale(.78) translateY(2px); } 65% { transform: scale(1.18) translateY(-3px); } 100% { transform: none; } }
.tab.catch .ti { animation: tabCatch .6s var(--spring); }
@keyframes tabCatch { 0% { transform: none; } 25% { transform: scale(1.35); color: var(--pik); } 100% { transform: none; } }
.tab .badge { display: none; top: 4px; }
.tab .badge.show { display: block; }
.tab .badge.jump { animation: badgePop .5s var(--spring); }
@keyframes badgePop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: none; } }

/* ------------------------------------------------ шапка при прокрутке */
.sticky { transition: box-shadow .25s, background-color .25s; }
body.scrolled .sticky { box-shadow: 0 8px 18px -12px rgba(0,0,0,.28); }
:root.dark body.scrolled .sticky { box-shadow: 0 8px 18px -12px rgba(0,0,0,.9); }
.head h1 { animation: titleIn .5s var(--out) both; }
.head .sub, .head .brand { animation: titleIn .5s .06s var(--out) both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(6px); } }
.brand i { animation: brandSpin 1s .2s var(--spring) both; }
@keyframes brandSpin { from { transform: rotate(-90deg) scale(0); } }

/* --------------------------------------------------------- галерея ЖК */
.gallery { will-change: transform; z-index: 0; }
.hero { z-index: 1; box-shadow: 0 -10px 24px -14px rgba(0,0,0,.25); }
.gallery .dots { transition: opacity .2s; }
.gallery .dots i { transition: width .35s var(--spring), background .2s; }

/* ------------------------------------------------------ сердечко */
.heart, .heart-inline { transition: transform .45s var(--spring), color .2s, background-color .2s; }
.heart:active, .heart-inline:active { transform: scale(.8); transition-duration: .08s; }
.heart.pop, .heart-inline.pop { animation: heartPop .6s var(--spring); }
@keyframes heartPop { 0% { transform: scale(.6); } 40% { transform: scale(1.35); } 70% { transform: scale(.92); } 100% { transform: none; } }
.spark-dot { position: fixed; z-index: 1300; width: 7px; height: 7px; border-radius: 2px; background: var(--pik); pointer-events: none; }
.spark-dot.ink { background: var(--ink); }
.flyheart { position: fixed; z-index: 1300; width: 26px; height: 26px; color: var(--pik); pointer-events: none; filter: drop-shadow(0 4px 8px rgba(255,79,18,.45)); }
.flyheart svg { width: 100%; height: 100%; }
.confetto { position: fixed; z-index: 1300; pointer-events: none; border-radius: 2px; }

/* -------------------------------------------------------- шторки */
.sheet-bg { backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); transition: opacity .3s, backdrop-filter .3s, -webkit-backdrop-filter .3s; }
.sheet-bg.show { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { transition: transform .5s cubic-bezier(.22, 1.18, .36, 1); box-shadow: 0 -10px 40px rgba(0,0,0,.18); }
.sheet .grab { transition: width .25s var(--spring), background .2s; }
.sheet:active .grab { width: 52px; background: var(--hint); }
.sheet.show > :not(.grab) > * { animation: sheetItem .5s var(--out) both; }
.sheet.show > :not(.grab) > :nth-child(2) { animation-delay: .04s; }
.sheet.show > :not(.grab) > :nth-child(3) { animation-delay: .08s; }
.sheet.show > :not(.grab) > :nth-child(4) { animation-delay: .12s; }
.sheet.show > :not(.grab) > :nth-child(5) { animation-delay: .16s; }
.sheet.show > :not(.grab) > :nth-child(n+6) { animation-delay: .2s; }
@keyframes sheetItem { from { opacity: 0; transform: translateY(14px); } }

/* ---------------------------------------------- успех: галочка и конфетти */
.success .ic { animation: successIn .7s var(--spring) both; box-shadow: 0 0 0 0 var(--soft); }
@keyframes successIn { 0% { transform: scale(0) rotate(-30deg); } 100% { transform: none; } }
.success .ic svg path { stroke-dasharray: 26; stroke-dashoffset: 26; animation: draw .45s .35s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success .ic::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--pik); animation: ring 1s .25s ease-out both; }
.success .ic { position: relative; }
@keyframes ring { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }

/* ------------------------------------------------------ тост */
.toast { transition: transform .5s var(--spring), opacity .25s; transform: translate(-50%, -30px) scale(.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.show { transform: translate(-50%, 0) scale(1); }

/* --------------------------------------------- загрузка: фирменные квадраты */
.pikdots { display: flex; gap: 7px; }
.pikdots i { width: 11px; height: 11px; border-radius: 3px; background: var(--pik); animation: pd 1s var(--spring) infinite; }
.pikdots i:nth-child(2) { animation-delay: .12s; background: var(--ink); }
.pikdots i:nth-child(3) { animation-delay: .24s; }
@keyframes pd { 0%, 70%, 100% { transform: none; } 30% { transform: translateY(-10px) rotate(90deg); } }
.skel { position: relative; overflow: hidden; background: var(--card); animation: none; box-shadow: var(--shadow); }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--sec) 85%, var(--hint)) 50%, transparent 80%); transform: translateX(-100%); animation: shimmer 1.3s ease-in-out infinite; opacity: .9; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ------------------------------------------------- заставка при запуске */
.splash { position: fixed; inset: 0; z-index: 2000; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; transition: opacity .45s ease, transform .55s var(--out); }
.splash.out { opacity: 0; transform: scale(1.06); pointer-events: none; }
.splash .sq { display: grid; grid-template-columns: 22px 22px; gap: 5px; }
.splash .sq i { width: 22px; height: 22px; border-radius: 5px; background: var(--ink); animation: sqIn .6s var(--spring) both; }
.splash .sq i:nth-child(1) { background: var(--pik); }
.splash .sq i:nth-child(2) { animation-delay: .08s; }
.splash .sq i:nth-child(3) { animation-delay: .16s; }
.splash .sq i:nth-child(4) { animation-delay: .24s; background: var(--pik); }
.splash.wait .sq { animation: sqTurn 1.6s .7s var(--spring) infinite; }
@keyframes sqIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
@keyframes sqTurn { 0%, 40% { transform: none; } 60%, 100% { transform: rotate(90deg); } }
.splash b { font-size: 22px; font-weight: 800; letter-spacing: -.03em; color: var(--text); animation: titleIn .6s .25s var(--out) both; }
.splash span { font-size: 13px; color: var(--hint); margin-top: -12px; animation: titleIn .6s .35s var(--out) both; }

/* --------------------------------------------------------------- карта */
.pin { animation: pinIn .5s var(--spring) both; transition: background-color .2s; }
@keyframes pinIn { from { transform: translate(-50%, -60%) scale(.2); opacity: 0; } to { transform: translate(-50%, -100%); opacity: 1; } }
.zlow .pin { animation-name: pinInLow; }
@keyframes pinInLow { from { transform: translate(-50%, -50%) scale(0); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
.pin.sel { animation: pinSel .45s var(--spring) both; }
@keyframes pinSel { 0% { transform: translate(-50%, -100%) scale(.85); } 50% { transform: translate(-50%, -112%) scale(1.15); } 100% { transform: translate(-50%, -100%) scale(1.08); } }
.zlow .pin.sel { animation-name: pinSelLow; }
@keyframes pinSelLow { 0% { transform: translate(-50%, -50%) scale(.6); } 100% { transform: translate(-50%, -50%) scale(1.15); } }
.mapcard > * { animation: cardUp .5s var(--spring) both; }
@keyframes cardUp { from { transform: translateY(40px) scale(.95); opacity: 0; } }
.mapchips .chip { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

/* ------------------------------------------------------- графики отчёта */
.bar .bt i { transform-origin: left; animation: growX .9s var(--out) both; }
@keyframes growX { from { transform: scaleX(0); } }
.day i { transform-origin: bottom; animation: growY .7s var(--spring) both; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes growY { from { transform: scaleY(0); } }

/* ------------------------------------------------- мелочи, которые радуют */
.empty .ic { animation: float 3.2s ease-in-out infinite; display: inline-block; }
@keyframes float { 50% { transform: translateY(-7px) rotate(-4deg); } }
.screen .btn:not(.sec):not(.plain) { position: relative; overflow: hidden; }
.screen .btn:not(.sec):not(.plain)::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-18deg); animation: shine 3.6s 1s ease-in-out infinite; }
@keyframes shine { 0%, 65% { left: -60%; } 100% { left: 130%; } }
.disc { animation: discIn .6s .3s var(--spring) both; }
@keyframes discIn { from { transform: scale(0) rotate(-20deg); } }
.chip.on { box-shadow: 0 4px 12px -4px rgba(0,0,0,.35); }
.seg button.on { animation: segOn .35s var(--spring); }
@keyframes segOn { from { transform: scale(.94); } }
.cd b { display: inline-block; background: linear-gradient(90deg, var(--pik), #ff8a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi:first-child .v { background: linear-gradient(90deg, var(--pik), #ff8a3d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fhead .price { display: inline-block; }
.planbox img { animation: planIn .7s .1s var(--spring) both; }
@keyframes planIn { from { transform: scale(.9); opacity: 0; } }
.tagtop .tag { animation: tagIn .5s .25s var(--spring) both; }
@keyframes tagIn { from { transform: translateY(-8px) scale(.8); opacity: 0; } }

.fresh { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 950; transform: translateX(-50%); height: 38px; padding: 0 16px; border-radius: 19px; background: var(--pik); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px -6px rgba(255,79,18,.6); animation: freshIn .6s var(--spring) both; }
@keyframes freshIn { from { transform: translate(-50%, -60px) scale(.8); opacity: 0; } }
body.nested .fresh { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
