:root {
  --bg: #f4f7fb;
  --paper: #ffffff;
  --ink: #12243c;
  --ink-soft: #5c6e86;
  --line: #e4ebf4;
  --blue-50: #eef4fc;
  --blue-100: #e5f0fb;
  --blue: #2b6cb0;
  --orange: #f97316;
  --orange-2: #ea580c;
  --ok: #15803d;
  --ok-bg: #e8f8ee;
  --warn: #c2410c;
  --warn-bg: #fff1e8;
  --bad: #dc2626;
  --bad-bg: #fdecec;
  --sold: #475569;
  --shadow: 0 14px 40px rgba(18, 38, 64, 0.08);
  --shadow-sm: 0 6px 18px rgba(18, 38, 64, 0.05);
  --radius: 18px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max: 1180px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
.shell, .workspace, .dash, .dialogs, .wrap, .topbar-inner, .top-main, .top-actions,
.cards, .card, .pcard, .panel, .table-card, .cal-card, .kpis, .filters, .hero,
.prop-grid, .calc-grid, .split, .services, .reviews, .dialog-list, .dialog-thread {
  min-width: 0;
  max-width: 100%;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 15px; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.muted { color: var(--ink-soft); }
.tiny { font-size: 13px; color: var(--ink-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 11px 16px;
  font-weight: 650;
  line-height: 1;
  background: #fff;
  transition: .15s background, .15s transform, .15s box-shadow;
}
.btn:hover { transform: translateY(-1px); }
.btn-orange { background: var(--orange); color: #fff; box-shadow: 0 8px 18px rgba(249, 115, 22, .28); }
.btn-orange:hover { background: var(--orange-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--blue-50); }
.btn-blue { background: #1d4f91; color: #fff; }
.btn-icon {
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
}
.btn-icon.vk { color: #3b6ea5; font-weight: 800; font-size: 13px; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 650; }
.link-quiet { color: var(--ink-soft); font-weight: 650; font-size: 14px; padding: 8px; }
.link-quiet:hover { color: var(--ink); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(228, 235, 244, .8);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 74px; }
.top-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.top-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  width: 44px; height: 44px; border-radius: 14px; background: var(--blue-50);
  display: grid; place-items: center; color: #1d4f91; flex: none;
}
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand small { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fav-btn { position: relative; }
.fav-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.fav-count.show { display: flex; }

.hero { display: grid; grid-template-columns: minmax(280px, .9fr) 1.15fr; gap: 28px; align-items: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.02; letter-spacing: -.04em; font-weight: 750; }
.hero .lead { margin-top: 16px; color: var(--ink-soft); font-size: 18px; max-width: 440px; }
.hero-photo { position: relative; border-radius: 26px; overflow: hidden; min-height: 280px; box-shadow: var(--shadow); }
.hero-photo img { width: 100%; height: 360px; object-fit: cover; object-position: center 62%; }
.hero-photo:after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(244,247,251,1) 0%, rgba(244,247,251,0) 22%);
  pointer-events: none;
}
.hero-chip {
  position: absolute; left: 14px; top: 14px; z-index: 1;
  background: rgba(255,255,255,.92); border-radius: 999px; padding: 8px 12px;
  font-size: 13px; font-weight: 700; color: var(--ink);
}

.search-wrap { position: relative; z-index: 2; margin-top: -18px; }
.search-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 14px; border: 1px solid rgba(255,255,255,.8); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 12px; padding: 10px 14px; color: var(--ink); font-weight: 650; background: transparent;
}
.tab svg { opacity: .7; }
.tab.is-on { background: var(--blue-100); color: #16325c; }
.filters { display: grid; grid-template-columns: 1.1fr 1fr .8fr .9fr .9fr auto; gap: 10px; padding: 8px 4px 4px; }
.field { position: relative; }
.field input, .field select, .area input, .area select, .area textarea {
  width: 100%; background: #f6f8fb; border: 1px solid #e7eef6; border-radius: 12px;
  padding: 13px 14px; outline: none;
}
.field input:focus, .field select:focus, .area input:focus, .area select:focus, .area textarea:focus {
  border-color: #b9d0ea; background: #fff; box-shadow: 0 0 0 4px rgba(47, 111, 237, .08);
}
.field select { appearance: none; padding-right: 32px; }
.filters .btn { min-height: 48px; padding-inline: 18px; white-space: nowrap; }

.section { padding: 34px 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 28px; letter-spacing: -.03em; }
.section-head a { color: var(--blue); font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pcard { background: #fff; border-radius: 18px; overflow: hidden; border: 1px solid #edf2f8; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.pcard-media { position: relative; display: block; aspect-ratio: 4/3; background: #e8eef6; }
.pcard-media img { width: 100%; height: 100%; object-fit: cover; }
.badges { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 54px); }
.badge {
  background: rgba(255,255,255,.94); color: #16325c; border-radius: 999px;
  padding: 4px 8px; font-size: 12px; font-weight: 750;
}
.badge-deposit { background: #fff4ec; color: var(--warn); }
.heart {
  position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.94); color: #8aa; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(16,35,60,.12);
}
.heart.is-on { color: #e11d48; }
.pcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.price { font-size: 20px; font-weight: 780; letter-spacing: -.03em; }
.meta { display: flex; gap: 8px; align-items: flex-start; color: #3e5168; font-size: 14px; }
.meta svg { flex: none; margin-top: 2px; color: #7d91a8; }

.empty {
  background: #fff; border: 1px dashed #d5e0ee; border-radius: 18px; padding: 28px; text-align: center;
}
.empty h3 { margin-bottom: 6px; }

.services { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.service {
  background: #fff; border-radius: 18px; padding: 16px; border: 1px solid #edf2f8;
  display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: start;
}
.service i {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-50); color: #1d4f91;
}
.service:nth-child(2n) i { background: #fff3ea; color: var(--orange-2); }
.service strong { display: block; font-size: 15px; line-height: 1.35; }
.service span { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 4px; }

.calc-grid, .split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.panel { background: #fff; border-radius: 22px; padding: 22px; border: 1px solid #edf2f8; box-shadow: var(--shadow-sm); }
.panel h2 { font-size: 28px; letter-spacing: -.03em; margin-bottom: 6px; }
.stack { display: grid; gap: 12px; margin-top: 16px; }
.stack label, .area label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: #31475f; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--orange); }
.result {
  background: linear-gradient(180deg, #f3f8ff, #fff); border-radius: 18px; padding: 18px; border: 1px solid #e5eef8;
}
.result .sum { font-size: 36px; font-weight: 780; letter-spacing: -.04em; margin: 6px 0 12px; }
.result dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0 0 16px; }
.result dt { color: var(--ink-soft); }
.result dd { margin: 0; font-weight: 750; }

.site-footer { margin-top: 40px; background: #fff; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding: 28px 0; flex-wrap: wrap; }
.footer-inner strong { font-size: 18px; }

.drawer-back, .modal-back {
  position: fixed; inset: 0; background: rgba(15, 28, 46, .45); z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 100%); background: #fff; z-index: 41;
  box-shadow: -20px 0 50px rgba(0,0,0,.12); display: flex; flex-direction: column;
}
.drawer header, .modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer .body, .modal .body { padding: 16px 18px; overflow: auto; }
.modal {
  position: fixed; z-index: 50; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(640px, calc(100% - 24px)); max-height: min(86vh, 820px); background: #fff;
  border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.modal.wide { width: min(860px, calc(100% - 24px)); }
.modal pre {
  white-space: pre-wrap; background: #0f2744; color: #e8eef8; border-radius: 14px; padding: 14px;
  font-size: 13px; line-height: 1.45; max-height: 360px; overflow: auto;
}
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #12243c; color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 70;
  max-width: min(520px, calc(100% - 24px)); box-shadow: var(--shadow);
}
.fav-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fav-row img { width: 72px; height: 56px; object-fit: cover; border-radius: 8px; }

.gallery-main { position: relative; border-radius: 22px; overflow: hidden; background: #dbe4ef; }
.gallery-main img { width: 100%; height: min(520px, 62vw); object-fit: cover; }
.gal-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.92); font-size: 20px;
}
.gal-nav.prev { left: 12px; }
.gal-nav.next { right: 12px; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow: auto; }
.thumbs button { border: 2px solid transparent; padding: 0; border-radius: 12px; background: none; flex: none; }
.thumbs button.is-on { border-color: var(--orange); }
.thumbs img { width: 92px; height: 68px; object-fit: cover; border-radius: 10px; }
.prop-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; align-items: start; padding-top: 18px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.spec { background: var(--blue-50); border-radius: 14px; padding: 12px; }
.spec b { display: block; font-size: 16px; }
.sticky-buy { position: sticky; top: 88px; }
.prose { white-space: pre-wrap; color: #24384f; }
.mobile-bar { display: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); background: #f3f6fb; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.side-brand strong { display: block; font-size: 14px; line-height: 1.25; }
.side-brand small { color: var(--ink-soft); font-size: 12px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px;
  color: #31475f; font-weight: 650; margin-bottom: 4px;
}
.nav-link svg { flex: none; }
.nav-link.is-on { background: var(--blue-100); color: #14345f; }
.nav-link .count {
  margin-left: auto; background: var(--orange); color: #fff; border-radius: 99px; min-width: 20px; height: 20px;
  font-size: 12px; display: grid; place-items: center; padding: 0 6px;
}
.side-user { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: #f6f8fb; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #1d4f91; color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.workspace { padding: 22px 22px 40px; min-width: 0; }
.toprow { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.toprow h1 { font-size: 28px; letter-spacing: -.03em; }
.menu-btn { display: none; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 16px; padding: 14px; border: 1px solid #edf2f8; display: flex; gap: 12px; align-items: center; }
.kpi i { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-50); color: #1d4f91; flex: none; }
.kpi:nth-child(2) i { background: #eef3ff; }
.kpi:nth-child(3) i { background: #f3f0ff; color: #5b4b8a; }
.kpi:nth-child(4) i { background: #fff3ea; color: var(--orange-2); }
.kpi b { display: block; font-size: 28px; letter-spacing: -.04em; line-height: 1; }
.kpi span { color: var(--ink-soft); font-size: 13px; }

.dash { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 14px; align-items: start; }
.table-card, .cal-card { background: #fff; border-radius: 18px; border: 1px solid #edf2f8; box-shadow: var(--shadow-sm); }
.table-card header, .cal-card header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.table-wrap { overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; min-width: 860px; }
.phone-cards { display: none; }
table.grid th { text-align: left; font-size: 12px; color: var(--ink-soft); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 12px; border-bottom: 1px solid #f0f4f9; vertical-align: middle; }
table.grid td.num { white-space: nowrap; font-weight: 750; }
.obj { display: flex; gap: 10px; align-items: center; min-width: 210px; }
.obj img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; background: #e8eef6; }
.pill { display: inline-flex; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 750; background: var(--blue-50); color: #1d4f91; }
.pill.rent { background: #f3f0ff; color: #5b4b8a; }
.status-select { border-radius: 999px; border: 0; padding: 6px 10px; font-weight: 750; }
.st-active { background: var(--ok-bg); color: var(--ok); }
.st-deposit { background: var(--warn-bg); color: var(--warn); }
.st-sold { background: #eef2f6; color: var(--sold); }
.st-removed { background: var(--bad-bg); color: var(--bad); }
.switch { width: 44px; height: 26px; border-radius: 99px; border: 0; background: #d5deea; position: relative; }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; display: block; }
.switch.is-on { background: #2f6fed; }
.switch.is-on i { left: 21px; }
.row-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 158px; }
.row-actions .btn { white-space: nowrap; justify-content: center; font-size: 12px; padding: 7px 8px; }
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 16px 16px; }
.pager a, .pager span { min-width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #f4f7fb; font-weight: 700; }
.pager .is-on { background: #1d4f91; color: #fff; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 0 12px 12px; }
.cal-grid span, .cal-grid button { height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; background: none; border: 0; }
.cal-grid .dow { color: var(--ink-soft); font-size: 11px; height: 22px; }
.cal-grid .today { background: #1d4f91; color: #fff; }
.cal-grid .has { box-shadow: inset 0 -2px 0 var(--orange); font-weight: 800; }
.cal-list { padding: 0 14px 14px; display: grid; gap: 10px; }
.cal-item { display: grid; grid-template-columns: 64px 1fr; gap: 8px; font-size: 13px; }
.cal-item b { color: #1d4f91; }

.banner {
  background: #e9f8ef; color: #166534; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-weight: 650;
}
.banner.warn { background: #fff4ec; color: #9a3412; }

.composer { max-width: 760px; margin: 0 auto; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-tile { position: relative; aspect-ratio: 1.15; border-radius: 14px; overflow: hidden; background: #f4f7fb; border: 1px solid var(--line); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .x, .photo-tile .cover-flag {
  position: absolute; border: 0; background: rgba(255,255,255,.94); border-radius: 999px; font-size: 12px; font-weight: 750;
}
.photo-tile .x { top: 6px; right: 6px; width: 26px; height: 26px; }
.photo-tile .cover-flag { left: 6px; bottom: 6px; padding: 4px 8px; }
.photo-tile .cover-flag.is-on { background: #1d4f91; color: #fff; }
.add-photo {
  border: 1.5px dashed #b9cbe0; border-radius: 14px; background: #f8fbff; min-height: 120px;
  display: grid; place-items: center; text-align: center; color: #1d4f91; font-weight: 750; padding: 10px;
}
.deal-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.deal-toggle label {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; gap: 8px; align-items: center;
  justify-content: center; font-weight: 750; background: #fff;
}
.deal-toggle input { display: none; }
.deal-toggle label.is-on { background: #1d4f91; color: #fff; border-color: #1d4f91; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.price-field { position: relative; }
.price-field span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-weight: 700; }
.counter { text-align: right; color: var(--ink-soft); font-size: 12px; }

.filters-inline { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.chip { border-radius: 999px; padding: 8px 12px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.chip.is-on { background: #1d4f91; color: #fff; border-color: #1d4f91; }
.lead-list { display: grid; gap: 10px; }
.lead-card { background: #fff; border-radius: 16px; padding: 14px; border: 1px solid #edf2f8; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.note { width: 100%; min-height: 120px; border-radius: 12px; border: 1px solid var(--line); padding: 12px; background: #f7f9fc; }

.pick { display: grid; gap: 8px; }
.pick label { display: grid; grid-template-columns: 20px 64px 1fr; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.pick img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #eef4fb, #f7f9fc 40%, #fff); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 28px; letter-spacing: -.03em; margin: 8px 0; }

.private-card { background: #fff8f1; border: 1px dashed #f0c9a0; border-radius: 16px; padding: 14px; }
.reviews { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.chat-launcher {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  background: var(--orange); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 18px; font-weight: 750; box-shadow: 0 10px 24px rgba(249,115,22,.35);
  min-height: 44px; white-space: nowrap;
}
.chat-panel {
  position: fixed; right: 18px; bottom: 74px; z-index: 50; width: min(360px, calc(100% - 24px));
  background: #fff; border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column;
  max-height: min(520px, calc(100vh - 110px));
}
.chat-identity.is-done .chat-fields { display: none; }
.chat-identity-summary { display: none; background: none; border: 0; color: var(--ink-soft); font-size: 13px; text-align: left; padding: 0; min-height: 32px; }
.chat-identity.is-done .chat-identity-summary { display: block; }
.chat-panel header, .thread-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#chat-close { white-space: nowrap; min-height: 40px; }
.chat-log, .thread-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 180px; background: #f7f9fc; }
.chat-form { padding: 10px; display: grid; gap: 8px; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.chat-compose textarea, .chat-form input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.bubble { max-width: 85%; border-radius: 14px; padding: 8px 10px; background: #fff; }
.bubble.in { align-self: flex-start; }
.bubble.out { align-self: flex-end; background: #e7f0fb; }
.bubble p { margin: 0; }
.dialogs { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; min-height: 560px; align-content: start; }
.dialog-filters { grid-column: 1 / -1; }
.dialog-list, .dialog-thread { background: #fff; border-radius: 18px; border: 1px solid #edf2f8; overflow: hidden; display: flex; flex-direction: column; }
.dialog-item { display: grid; gap: 2px; padding: 12px; border-bottom: 1px solid var(--line); position: relative; }
.dialog-item.is-on { background: #f3f7fd; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); position: absolute; right: 12px; top: 16px; }
body.has-bar .chat-launcher { bottom: 86px; }
.back-dialogs { display: none; }
.side-close { display: none; }
.bottom-nav { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(15,28,46,.45); z-index: 30; display: none; }
.scrim.show { display: block; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .services { grid-template-columns: 1fr 1fr; }
  .dash, .kpis, .prop-grid, .calc-grid, .split, .hero { grid-template-columns: 1fr; }
  .hero-photo:after { background: linear-gradient(180deg, rgba(244,247,251,0) 70%, rgba(244,247,251,1)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .sticky-buy { position: static; }
}

@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar {
    position: fixed; z-index: 40; transform: translateX(-110%); transition: .2s transform; width: min(300px, 88vw);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .workspace { padding: 14px 14px 32px; }
  .top-actions .btn-ghost span.hide-sm, .link-quiet span { }
}

@media (max-width: 768px) {
  .wrap { width: min(100%, calc(100% - 20px)); }
  .topbar-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; min-height: 0; padding: 10px 0 12px; align-items: center; }
  .top-main { grid-column: 1; grid-row: 1; }
  .top-tools { grid-column: 2; grid-row: 1; margin-left: 0; }
  .top-actions { grid-column: 1 / -1; grid-row: 2; width: 100%; flex-wrap: nowrap; }
  .top-actions .btn { white-space: nowrap; min-height: 44px; flex: 1 1 auto; padding: 10px 12px; }
  .top-actions .btn-icon { flex: 0 0 44px; }
  .brand strong { font-size: 15px; line-height: 1.2; }
  .brand small { font-size: 12px; }
  .cards, .services, .reviews, .two, .three, .filters, .kpis { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .hero-photo img { height: 210px; width: 100%; }
  .section-head { align-items: flex-start; }
  .section-head h2, .panel h2, .toprow h1 { font-size: 22px; }
  .toprow { align-items: center; }
  .toprow .desk-link { display: none; }
  .field input, .field select, .area input, .area select, .area textarea, .chat-compose textarea { max-width: 100%; min-height: 44px; }
  .mobile-bar {
    display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    background: #fff; border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .mobile-bar .btn { padding: 12px 8px; font-size: 13px; min-height: 44px; }
  body.has-bar { padding-bottom: 84px; }
  .only-desktop { display: none !important; }
  .phone-cards { display: grid; gap: 12px; padding: 0 12px 12px; }
  .m-card { background: #fff; border: 1px solid #edf2f8; border-radius: 16px; padding: 12px; display: grid; gap: 8px; }
  .m-card-top { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; }
  .m-card-top img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
  .m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .m-actions .btn { min-height: 40px; white-space: nowrap; }
  .cal-grid { gap: 2px; padding: 0 8px 10px; }
  .cal-grid span { font-size: 12px; height: 32px; }
  .cal-item { grid-template-columns: 56px minmax(0, 1fr); }
  .workspace { padding: 12px 12px 88px; }
  .sidebar { z-index: 60; height: 100dvh; }
  .side-close { display: inline-flex; margin-left: auto; }
  .side-brand { justify-content: space-between; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    background: none; border: 0; color: var(--ink-soft); font-size: 11px; font-weight: 750;
    min-height: 44px; display: grid; place-items: center; text-align: center; line-height: 1.15; padding: 4px;
  }
  .bottom-nav .is-on { color: #1d4f91; }
  .scrim { z-index: 45; }
  .dialogs { grid-template-columns: 1fr; min-height: 0; }
  .dialogs.list-mode .dialog-thread, .dialogs.list-mode .filters-inline.thread-only { display: none; }
  .dialogs.thread-mode .dialog-list, .dialogs.thread-mode .dialog-filters { display: none; }
  .dialogs.thread-mode .back-dialogs { display: inline-flex; margin: 0 0 8px; }
  .dialog-list { max-height: none; }
  .chat-panel {
    left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 82dvh; z-index: 1000;
    border-radius: 16px; box-shadow: 0 16px 40px rgba(18, 38, 64, .2);
  }
  .chat-launcher { z-index: 90; }
  .photo-grid { grid-template-columns: 1fr 1fr; }
  .lead-card, .pick label { grid-template-columns: 1fr; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
}
