:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #17212b;
  --muted: #6b7683;
  --line: #e5e8ec;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --ok: #16a34a;
  --ok-bg: #ecfdf3;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --pay: #00c2b3;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
/* Шапке нужна вся ширина: шесть пунктов + CTA в 760 px не помещаются */
.site-header .container { max-width: 1080px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.site-header nav { display: flex; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.logo {
  font-weight: 700; font-size: 18px; text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  letter-spacing: -.2px;
}
.logo img { display: block; }
.site-header nav a { margin-left: 16px; color: var(--muted); text-decoration: none; font-size: 15px; }
.site-header nav a:hover { color: var(--text); }

.hero { padding: 34px 0 8px; }
.hero h1 { font-size: 30px; line-height: 1.2; margin: 0 0 10px; }
.hero .sub { color: var(--muted); margin: 0 0 14px; }

.status-strip {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 14px; display: inline-block; margin: 0;
}
.status-strip.ok { background: var(--ok-bg); border-color: #bbf7d0; }
.status-strip.warn { background: var(--warn-bg); border-color: #fde68a; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin: 16px 0;
}

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: var(--bg);
  border-radius: 10px; font-size: 15px; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; color: var(--text); background: #fff; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

details.more { margin: 14px 0; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; }
details.more .grid { margin-top: 12px; }

.btn {
  display: inline-block; border: 0; border-radius: 10px; padding: 12px 20px;
  font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--accent); color: #fff; width: 100%; margin-top: 14px; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.pay { background: var(--pay); color: #fff; width: 100%; margin-top: 10px; }
.btn[disabled] { opacity: .6; cursor: wait; }

.hint { color: var(--muted); font-size: 13px; }
.form-error {
  background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca;
  border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0;
}
.hidden { display: none !important; }

.verdict { border-radius: 12px; padding: 14px 16px; font-size: 20px; font-weight: 700; margin-bottom: 14px; }
.verdict.market { background: var(--ok-bg); color: var(--ok); }
.verdict.above { background: var(--bad-bg); color: var(--bad); }
.verdict.below { background: var(--warn-bg); color: var(--warn); }
.verdict.no_data { background: var(--bg); color: var(--muted); font-size: 16px; font-weight: 500; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
@media (max-width: 560px) { .metrics { grid-template-columns: 1fr; } }
.metric { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.metric .v { font-size: 20px; font-weight: 700; }
.metric .l { font-size: 12.5px; color: var(--muted); }

.low-conf { background: var(--warn-bg); border: 1px solid #fde68a; border-radius: 10px;
  padding: 8px 12px; font-size: 14px; margin: 10px 0; }

.disclaimer { color: var(--muted); font-size: 12.5px; font-style: italic; margin-top: 12px; }

.comps-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.comps-table th, .comps-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.comps-table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.comps-wrap { overflow-x: auto; }

.paywall h2 { margin-top: 0; font-size: 20px; }
.paywall ul { margin: 8px 0; padding-left: 20px; }

.upsell { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
  padding: 12px 14px; font-size: 14.5px; margin-top: 14px; }

.code { background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: 15px; word-break: break-all; }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 18px 0 30px; }
.site-footer p { color: var(--muted); font-size: 12.5px; margin: 6px 0; }

.spinner {
  width: 34px; height: 34px; margin: 10px auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-h { margin: 14px 0 6px; font-size: 17px; }

.metrics-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .metrics-4 { grid-template-columns: 1fr 1fr; } }

.chart { margin: 0 0 18px; }
.chart-title { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.ch-axis { font-size: 11px; fill: var(--muted); }
.ch-value { font-size: 12px; font-weight: 600; fill: var(--text); }

.tag-new {
  background: var(--ok-bg); color: var(--ok); border-radius: 6px;
  font-size: 11px; padding: 2px 6px; vertical-align: middle;
}
.deal-discount { color: var(--ok); font-weight: 700; }
.price-story {
  background: var(--ok-bg); border: 1px solid #bbf7d0; border-radius: 10px;
  padding: 10px 14px; font-size: 14.5px; margin: 10px 0 14px;
}
.tag-drop { color: var(--ok); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.btn-link {
  background: none; border: 0; color: var(--muted); font-size: 13px;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.btn-link:hover { color: var(--bad); }
select[multiple] { min-height: 130px; padding: 6px; }
.deal-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.deal-card .row1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.deal-title { font-weight: 600; }
.deal-meta { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.locked-note {
  background: var(--bg); border: 1px dashed var(--line); border-radius: 12px;
  padding: 14px; text-align: center; color: var(--muted); margin-top: 10px;
}

.hero-links { font-size: 14.5px; margin-top: -4px; }
.hero-links a { color: var(--accent); }

.container.wide { max-width: 1080px; }

/* Каталог ЖК и интерактивные тренды: панель фильтров */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 10px; }
.filters label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; color: var(--muted); flex: 1 1 170px;
}
.filters input, .filters select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14.5px; background: #fff; color: var(--text); width: 100%;
}
.filters input:focus, .filters select:focus { outline: 2px solid #bfdbfe; border-color: var(--accent); }

.comps-table .num, .comps-table th.num { text-align: right; }
.center { text-align: center; margin-top: 12px; }

/* Сортируемые заголовки таблицы каталога */
.sortable th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable th[data-sort]:hover { color: var(--text); }
.sortable th[data-sort]::after { content: ""; }
.sortable th.sorted-asc::after { content: " ↑"; color: var(--accent); }
.sortable th.sorted-desc::after { content: " ↓"; color: var(--accent); }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge.high { background: var(--ok-bg); color: var(--ok); }
.badge.medium { background: #eff6ff; color: var(--accent-dark); }
.badge.low { background: var(--bg); color: var(--muted); }
.badge.stalled { background: var(--bad-bg); color: var(--bad); }

.empty-row td { color: var(--muted); text-align: center; padding: 18px 8px; }

/* Юридические страницы и методика */
.legal h2 { font-size: 18px; margin: 22px 0 8px; }
.legal h3 { font-size: 15px; margin: 16px 0 6px; }
.legal p, .legal li { font-size: 14.5px; line-height: 1.6; }
.legal ul, .legal ol { padding-left: 20px; }
.legal li { margin: 5px 0; }
.legal code {
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-size: 13px;
}
.steps li { margin: 8px 0; font-size: 14.5px; line-height: 1.6; }
.disclaimer-block { background: var(--warn-bg); border: 1px solid #fde68a; }
.disclaimer-block p { font-size: 14.5px; line-height: 1.6; }

.footer-links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { color: var(--muted); font-size: 12.5px; }

/* ============================== ЛЕНДИНГ ============================== */

.nav-cta {
  background: var(--accent); color: #fff !important; padding: 7px 14px;
  border-radius: 999px; font-weight: 600;
}
.nav-cta:hover { background: var(--accent-dark); }

.lp-hero { text-align: center; padding: 46px 0 10px; }
.lp-hero h1 {
  font-size: 40px; line-height: 1.15; margin: 14px 0 12px; letter-spacing: -.5px;
}
@media (max-width: 560px) { .lp-hero h1 { font-size: 30px; } }
.lp-hero .sub {
  max-width: 620px; margin: 0 auto 20px; color: var(--muted); font-size: 16.5px;
}
.pill {
  display: inline-block; background: #eff6ff; color: var(--accent-dark);
  border: 1px solid #bfdbfe; border-radius: 999px; padding: 5px 14px;
  font-size: 13px; font-weight: 600;
}
.cta-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.btn.lg { padding: 13px 22px; font-size: 16px; }
.btn.ghost {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary.lg { width: auto; margin-top: 0; }
.sources-line { margin-top: 12px; }
.lp-hero .status-strip { display: inline-block; }

.lp-stats { margin: 22px 0 8px; }
.lp-stats .metric { background: var(--card); border: 1px solid var(--line); }

.lp-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lp-chart-head h2 { margin: 0 0 10px; font-size: 20px; }
.link-more { color: var(--accent); font-size: 14px; white-space: nowrap; }
.lp-districts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.district-chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; color: var(--muted);
}
.district-chip b { color: var(--text); }

.lp-section { margin: 34px 0; }
.lp-h2 { font-size: 24px; margin: 0 0 16px; letter-spacing: -.3px; }

.trust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .trust-grid { grid-template-columns: 1fr; } }
.trust-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; font-size: 14.5px; line-height: 1.55;
  color: var(--muted);
}
.trust-item b { color: var(--text); display: block; margin-bottom: 4px; }

.tariffs { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; align-items: start; }
@media (max-width: 700px) { .tariffs { grid-template-columns: 1fr; } }
.tariff-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 20px; position: relative;
}
.tariff-card.pro { border: 2px solid var(--accent); box-shadow: 0 8px 30px rgba(37, 99, 235, .10); }
.tariff-badge {
  position: absolute; top: -11px; left: 20px; background: var(--accent);
  color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px;
  padding: 3px 10px; text-transform: uppercase; letter-spacing: .4px;
}
.tariff-card h3 { margin: 0 0 6px; font-size: 18px; }
.tariff-price { font-size: 30px; font-weight: 800; margin-bottom: 12px; }
.tariff-price span { font-size: 14px; font-weight: 500; color: var(--muted); }
.tariff-card ul { margin: 0 0 16px; padding-left: 20px; }
.tariff-card li { margin: 7px 0; font-size: 14.5px; line-height: 1.5; }
.tariff-card .btn { width: 100%; margin-top: 0; text-align: center; display: block; text-decoration: none; }

.faq {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin: 8px 0;
}
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.faq p { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 10px 0 2px; }

.lp-final { text-align: center; padding: 30px 20px; }
.lp-final h2 { margin: 0 0 6px; }
.lp-final .btn { margin-top: 12px; }

.tg-login { text-align: center; padding: 30px 20px; }
.tg-login .btn { width: auto; margin-top: 10px; }

/* Три пути ценности */
.paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
@media (max-width: 700px) { .paths { grid-template-columns: 1fr; } }
.path-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px; text-decoration: none;
  color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.path-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(37, 99, 235, .08); }
.path-card h2, .path-card h3 { font-size: 16.5px; margin: 8px 0 6px; }
.path-card p { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: 0 0 10px; }
.path-icon { font-size: 26px; }
.path-cta { color: var(--accent); font-size: 13.5px; font-weight: 600; }

/* Нижняя навигация — только на мобильных. На десктопе меню живёт в шапке. */
.tabbar { display: none; }

@media (max-width: 760px) {
  /* Шапка сжимается до логотипа: разделы уехали в таб-бар внизу, и
     header больше не съедает четверть экрана (было ~190 px из 812). */
  .header-inner { min-height: 52px; padding: 0; }
  .site-header nav { display: none; }
  .logo { font-size: 17px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);  /* «чёлка» снизу у iPhone */
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 2px 6px; text-decoration: none; color: var(--muted);
    font-size: 10.5px; line-height: 1.2; min-height: 50px;
    justify-content: center;
  }
  .tabbar a.on { color: var(--accent); font-weight: 600; }
  .tabbar .ic { font-size: 19px; line-height: 1; }
  /* контент не должен прятаться под панелью */
  body { padding-bottom: 62px; }

  /* iOS зумит страницу при фокусе в поле мельче 16px — портит всю вёрстку */
  .filters input, .filters select { font-size: 16px; }
  /* фильтры в один столбец: два селекта по 170px на телефоне режут текст */
  .filters label { flex: 1 1 100%; }

  /* Вертикальный ритм на телефоне: до правки заголовок начинался на 250 px,
     а между блоками зияли десктопные отступы. */
  .container { padding: 0 14px; }
  .lp-hero { padding: 16px 0 4px; }
  .lp-hero .sub { font-size: 15.5px; margin-bottom: 16px; }
  .lp-section { margin: 24px 0; }
  .card { margin: 12px 0; }
  .hero { padding: 20px 0 6px; }
  .hero h1 { font-size: 26px; }
  .metrics { gap: 8px; }
  .metric { padding: 9px 11px; }
  /* принудительный <br> в заголовке ломает перенос на узком экране */
  .lp-hero h1 br { display: none; }
  .lp-hero h1 { font-size: 28px; margin: 10px 0 10px; }
  /* бейдж в две строки не должен выглядеть таблеткой с обрезанными углами */
  .lp-hero .pill {
    font-size: 12px; white-space: normal; border-radius: 14px;
    line-height: 1.45; max-width: 100%;
  }
  .cta-row .btn { width: 100%; }
  .btn { min-height: 44px; }
  .tab { min-height: 44px; }

  /* заголовок блока графика: ссылка «Все тренды» уходит под заголовок */
  .lp-chart-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .lp-h2 { font-size: 21px; }
  .metric .v { font-size: 18px; }
  .tariff-price { font-size: 26px; }
  .lp-final { padding: 22px 14px; }
  .card { padding: 16px 14px; }
}
