/* ==========================================================================
   cdekmsk.ru — дизайн-система
   Ориентир — cdek.ru: белый фон, воздух, один яркий акцент, скруглённые формы.
   Мобильная вёрстка первична: 64 % визитов со смартфонов (Метрика, 30 дн.).
   ========================================================================== */

:root {
  /* Фирменный зелёный. ⚠ Значение подставлено «на глаз» по сайту СДЭК —
     заменить на точное из брендбука франчайзи, менять только здесь. */
  --brand: #1ab248;
  --brand-dark: #149a3d;
  --brand-light: #e8f7ed;

  --ink: #1a1d21;
  --ink-2: #4a5158;
  --ink-3: #7b848c;
  --line: #e4e8ec;
  --bg: #ffffff;
  --bg-2: #f6f8fa;

  --warn: #f5a623;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(26, 29, 33, .07);
  --shadow-lg: 0 12px 40px rgba(26, 29, 33, .12);

  --wrap: 1200px;
  --gap-section: 88px;
}

* { box-sizing: border-box; }

/* Шапка липкая и высотой 72px, поэтому переход по якорю (#zayavka с кнопки
   «Заключить договор») ставил цель ровно под шапку: у формы срезался
   заголовок и первая строка. scroll-padding-top отодвигает точку остановки
   вниз — 72px шапки плюс воздух, чтобы форма начиналась не впритык. */
html { scroll-behavior: smooth; scroll-padding-top: 92px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  /* Страховка от горизонтального скролла: страница не должна ездить вбок
     ни при каких условиях. Причины переполнения чинятся отдельно (см. шапку),
     но одна забытая широкая таблица не должна ломать весь мобильный вид. */
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- Типографика ---------- */

h1, h2, h3 { line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.02em; }
h1 { font-size: 44px; font-weight: 800; }
h2 { font-size: 34px; font-weight: 700; }
h3 { font-size: 21px; font-weight: 700; }
p { margin: 0 0 16px; }
.lead { font-size: 19px; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 15px; }

section { padding: var(--gap-section) 0; }
section.tinted { background: var(--bg-2); }
.section-head { max-width: 760px; margin-bottom: 40px; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 30px;
  font-size: 17px; font-weight: 600; font-family: inherit;
  border: 2px solid transparent; border-radius: 100px;
  cursor: pointer; transition: .15s ease; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-block { width: 100%; }
.btn-lg { padding: 18px 38px; font-size: 18px; }

/* ---------- Шапка ---------- */

.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
/* Шапка шире контента. Замеры (Chrome, Segoe UI): логотип с подписью 267 px,
   шесть пунктов меню 679 px, телефон с кнопкой 334 px, отступы 40 px — итого
   1320 px. В общие 1200 px это не влезало: браузер сжимал флексы и ломал
   подписи пунктов на две строки («шапка плыла»). Контент страниц оставляем
   в 1200 px, шире делаем только шапку: 1400 − 40 padding = 1360 px, запас 40. */
.header-in { display: flex; align-items: center; gap: 16px; height: 72px; max-width: 1400px; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px;
        color: var(--ink); letter-spacing: -0.02em; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo b { color: var(--brand); }
.logo span { font-size: 12px; font-weight: 600; color: var(--ink-3);
             letter-spacing: .04em; text-transform: uppercase; }

/* Официальный логотип СДЭК (assets/logo-cdek.svg, 69×18, монохром #181A1F).
   В подвале на тёмном фоне перекрашиваем в белый фильтром — отдельный файл
   ради одного цвета держать не нужно. */
.logo-img { height: 24px; width: auto; display: block; flex-shrink: 0; }
.footer .logo-img { filter: brightness(0) invert(1); }
.logo-divider { width: 1px; height: 22px; background: var(--line); flex-shrink: 0; }
.footer .logo-divider { background: rgba(255, 255, 255, .22); }

.nav { display: flex; gap: 18px; margin-left: auto; }
/* nowrap обязателен: без него пункты ломаются в две строки и шапка «пляшет» */
.nav a { color: var(--ink-2); font-weight: 500; font-size: 15px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--brand-dark); text-decoration: none; }

.header-cta { display: flex; align-items: center; gap: 14px; margin-left: 20px; }
.header-cta .btn { padding: 12px 22px; font-size: 15px; white-space: nowrap; }
.header-phone { font-weight: 700; font-size: 16px; color: var(--ink); white-space: nowrap; }

/* Два номера: федеральный 8 800 (бесплатный, вызывает доверие в B2B) первым,
   прямой мобильный — вторым, мельче. В одну строку они занимают слишком много
   места в и без того тесной шапке, поэтому ставим друг под другом. */
.header-phones { display: flex; flex-direction: column; line-height: 1.2; }
.header-phones .p-main { font-weight: 700; font-size: 16px; color: var(--ink);
                         white-space: nowrap; }
.header-phones .p-main:hover { color: var(--brand-dark); text-decoration: none; }
.header-phones .p-sub { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.header-phones .p-sub:hover { color: var(--brand-dark); text-decoration: none; }

/* В шапке одновременно шесть пунктов меню, логотип с подписью, телефон
   и кнопка. На 1280–1366 (типичный ноутбук) это не помещается: подпись
   наезжает на меню, кнопка уходит за край. Подпись убираем первой —
   она декоративная. Порог 1400, чтобы запас был и на 1366. */
@media (max-width: 1400px) {
  .logo span:not(.logo-divider) { display: none; }
  .logo-divider { display: none; }
  .nav { gap: 14px; }
  .nav a { font-size: 14px; }
}
.header-phone:hover { text-decoration: none; color: var(--brand-dark); }

.burger { display: none; width: 44px; height: 44px; border: 0; background: none;
          cursor: pointer; padding: 10px; }
.burger span { display: block; height: 2px; background: var(--ink); margin: 5px 0;
               border-radius: 2px; transition: .2s; }

/* ---------- Первый экран ---------- */

.hero { padding: 64px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: start; }
.hero h1 { margin-bottom: 20px; }
.hero .lead { margin-bottom: 28px; }

.hero-facts { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.fact {
  display: inline-flex; align-items: baseline; gap: 8px;
  background: var(--brand-light); color: var(--brand-dark);
  padding: 9px 16px; border-radius: 100px; font-size: 15px; font-weight: 600;
}
.fact b { font-size: 17px; }

/* ---------- Форма заявки ---------- */

.lead-form {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-lg);
}
.lead-form h3 { margin-bottom: 6px; }
.lead-form .muted { margin-bottom: 20px; display: block; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2);
               margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 14px 16px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand);
}
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 18px;
           font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.consent input { margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--brand); }
.form-note { margin-top: 14px; font-size: 13px; color: var(--ink-3); text-align: center; }
.form-ok { display: none; padding: 20px; background: var(--brand-light);
           border-radius: var(--radius-sm); color: var(--brand-dark); font-weight: 600; }

/* ---------- Карточки и сетки ---------- */

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; transition: .18s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--ink-2); font-size: 16px; margin-bottom: 12px; }
.card .card-link { font-weight: 600; }
.card-icon {
  width: 52px; height: 52px; border-radius: 14px; background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin-bottom: 18px;
}

/* ---------- Шаги ---------- */

.steps { counter-reset: step; display: grid; gap: 20px; grid-template-columns: repeat(4, 1fr); }
.step { position: relative; padding-top: 56px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.step h3 { font-size: 18px; }
.step p { color: var(--ink-2); font-size: 15px; margin: 0; }

/* ---------- Таблица сравнения ---------- */

.compare-wrap { overflow-x: auto; }
/* На узком экране таблица не влезает и листается вбок. Без подсказки этого
   никто не делает — половина таблицы просто остаётся непрочитанной. */
@media (max-width: 720px) {
  .compare-wrap::after {
    content: "← листайте таблицу вбок →";
    display: block; padding-top: 10px;
    font-size: 13px; color: var(--ink-3); text-align: center;
  }
}
table.compare { width: 100%; border-collapse: collapse; min-width: 560px; }
table.compare th, table.compare td {
  padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--line);
  font-size: 16px;
}
table.compare thead th { font-size: 15px; color: var(--ink-3); font-weight: 600;
                         text-transform: uppercase; letter-spacing: .03em; }
table.compare td.yes { color: var(--brand-dark); font-weight: 600; }
table.compare td.no { color: var(--ink-3); }
table.compare tbody tr:hover { background: var(--bg-2); }
.col-accent { background: var(--brand-light); }

/* ---------- Калькулятор ---------- */

.calc-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
            padding: 28px; box-shadow: var(--shadow); }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.calc-dims { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.city-wrap { position: relative; }
.city-list {
  display: none; position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.city-option {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 12px 16px; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer;
}
.city-option:hover { background: var(--brand-light); color: var(--brand-dark); }
.calc-error { color: #c0392b; font-weight: 500; }
.calc-table .price { font-weight: 700; font-size: 18px; white-space: nowrap; }
.calc-table .nowrap { white-space: nowrap; color: var(--ink-2); }
.calc-cta { margin-top: 26px; padding: 24px; background: var(--brand-light);
            border-radius: var(--radius); text-align: center; }
.calc-cta p { color: var(--ink-2); max-width: 620px; margin: 0 auto 18px; }

@media (max-width: 720px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-dims { grid-template-columns: repeat(2, 1fr); }
  .calc-box { padding: 20px; }
}

/* ---------- FAQ ---------- */

.faq-item { border-bottom: 1px solid var(--line); }
.faq-q {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 22px 44px 22px 0; position: relative;
  font-size: 18px; font-weight: 600; color: var(--ink); font-family: inherit;
}
.faq-q::after {
  content: "+"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 26px; font-weight: 400; color: var(--brand); line-height: 1;
}
.faq-item.open .faq-q::after { content: "–"; }
.faq-a { display: none; padding: 0 44px 24px 0; color: var(--ink-2); }
.faq-item.open .faq-a { display: block; }

/* ---------- Логотипы клиентов ---------- */

.logos { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.logos span {
  padding: 12px 24px; background: #fff; border: 1px solid var(--line);
  border-radius: 100px; font-weight: 600; color: var(--ink-2); font-size: 16px;
}

/* ---------- Отзывы ---------- */

.review { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
          padding: 26px; }
.review p { font-size: 16px; color: var(--ink-2); }
.review footer { display: flex; align-items: center; gap: 12px; margin-top: 18px;
                 padding-top: 18px; border-top: 1px solid var(--line); }
.review .ava { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-light);
               color: var(--brand-dark); display: flex; align-items: center;
               justify-content: center; font-weight: 700; flex-shrink: 0; }
.review .who { font-size: 14px; line-height: 1.35; }
.review .who b { display: block; color: var(--ink); font-size: 15px; }

/* ---------- CTA-полоса ---------- */

.cta-band {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-radius: 24px; padding: 52px; text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .9); max-width: 620px; margin: 0 auto 28px; }
.cta-band .btn-primary { background: #fff; color: var(--brand-dark); }
.cta-band .btn-primary:hover { background: #f2f2f2; }

/* ---------- Хлебные крошки ---------- */

.crumbs { padding: 20px 0 0; font-size: 14px; color: var(--ink-3); }
.crumbs a { color: var(--ink-3); }
.crumbs span { margin: 0 8px; }

/* ---------- Текстовый блок статьи ---------- */

.prose { max-width: 760px; }
.prose h2 { font-size: 28px; margin-top: 44px; }
.prose h3 { margin-top: 32px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; color: var(--ink-2); }
.prose li { margin-bottom: 9px; }
.prose table { width: 100%; border-collapse: collapse; margin: 22px 0; }
.prose th, .prose td { padding: 13px 15px; border: 1px solid var(--line);
                       text-align: left; font-size: 16px; }
.prose th { background: var(--bg-2); font-weight: 600; }

.callout {
  background: var(--brand-light); border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 20px 24px; margin: 26px 0;
}
.callout p:last-child { margin-bottom: 0; }

/* Карточка скачивания документа */
.doc-list { display: grid; gap: 14px; margin: 26px 0; }
.doc {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 18px 20px; background: #fff; transition: .15s;
}
.doc:hover { border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow); }
.doc-ico { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-light);
           color: var(--brand-dark); display: flex; align-items: center;
           justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.doc-name { font-weight: 600; color: var(--ink); }
.doc-meta { font-size: 14px; color: var(--ink-3); }

/* ---------- Подвал ---------- */

.footer { background: var(--ink); color: rgba(255, 255, 255, .72); padding: 56px 0 32px;
          font-size: 15px; }
.footer a { color: rgba(255, 255, 255, .72); }
.footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 36px;
               padding-bottom: 36px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.footer h4 { color: #fff; font-size: 16px; margin: 0 0 16px; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 10px; }
.footer .logo { color: #fff; margin-bottom: 14px; }
.footer-bottom { display: flex; justify-content: space-between; gap: 20px;
                 padding-top: 24px; font-size: 14px; color: rgba(255, 255, 255, .5); }
.footer-phone { display: block; color: #fff; font-size: 22px; font-weight: 700;
                margin-bottom: 10px; }
.footer-phone:hover { color: #fff; }
.messengers { display: flex; gap: 10px; margin-top: 14px; }
.messengers a {
  padding: 9px 18px; border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 100px; font-size: 14px; font-weight: 600; color: #fff;
}
.messengers a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; }

/* ---------- Адаптив ---------- */

@media (max-width: 960px) {
  :root { --gap-section: 60px; }
  h1 { font-size: 34px; }
  h2 { font-size: 27px; }
  body { font-size: 16px; }

  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 72px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 20px 16px; box-shadow: var(--shadow);
  }
  .nav.open a { padding: 13px 0; border-bottom: 1px solid var(--line); }
  .burger { display: block; margin-left: auto; order: 3; }
  .header-cta .btn { display: none; }

  /* Шапка на мобильном: логотип + телефон + бургер должны влезать в 360 px.
     Подпись «договор для бизнеса» и десктопные отступы съедали ~200 px
     и выталкивали страницу за экран — отсюда горизонтальный скролл. */
  .header-in { gap: 10px; }
  .logo span { display: none; }
  .header-cta { gap: 8px; margin-left: auto; }
  .header-phone { font-size: 15px; }
  /* Два номера в шапку телефона не влезают — оставляем федеральный,
     прямой мобильный доступен в меню, подвале и на странице контактов. */
  .header-phones .p-sub { display: none; }
  .header-phones .p-main { font-size: 15px; }

  .hero { padding: 36px 0 48px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .cta-band { padding: 36px 24px; }
  .footer-bottom { flex-direction: column; }
}

@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .lead-form { padding: 22px; }
  h1 { font-size: 29px; }
  .btn { width: 100%; }
  .wrap { padding: 0 16px; }

  /* На узких экранах номер целиком не нужен — достаточно иконки-кнопки:
     нажатие всё равно открывает звонилку (набирается бесплатный 8 800). */
  .header-phone, .header-phones .p-main {
    font-size: 0; padding: 10px 14px; border: 1.5px solid var(--line);
    border-radius: 100px; line-height: 1;
  }
  .header-phone::before, .header-phones .p-main::before { content: "📞"; font-size: 18px; }

  /* Кнопки в мессенджеры на всю ширину — попасть пальцем проще */
  .messengers { flex-wrap: wrap; }
  .messengers a { flex: 1 1 auto; text-align: center; }

  /* Таблицы: подсказываем, что их можно листать вбок */
  .compare-wrap, .prose table { -webkit-overflow-scrolling: touch; }
  table.compare th, table.compare td { padding: 13px 14px; font-size: 15px; }
}

/* Планшет: две колонки вместо одной — на 768 px одноколоночная сетка
   оставляет слишком много пустого места по бокам карточек. */
@media (min-width: 620px) and (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}

/* Печать — образцы договоров часто печатают */
@media print {
  .header, .footer, .lead-form, .cta-band, .burger { display: none; }
  body { font-size: 12pt; }
  .chat-root { display: none; }
}

/* ==========================================================================
   Чат-виджет (assets/chat.js, сервер — /chat.php)
   Окно как у Jivo, но внутри сценарий заявки на договор.
   Держим в общем CSS сознательно: отдельный файл — это лишний запрос ради
   300 строк, а правила кэширования для style.css уже настроены в .htaccess.
   ========================================================================== */

.chat-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  font-size: 16px; line-height: 1.45;
}

/* ---------- Круглая кнопка ---------- */

.chat-fab {
  position: relative;
  width: 60px; height: 60px; padding: 0;
  border: none; border-radius: 50%;
  background: var(--brand); color: #fff;
  box-shadow: 0 8px 24px rgba(26, 178, 72, .38);
  cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.chat-fab:hover { background: var(--brand-dark); transform: translateY(-2px); }
.chat-fab svg { width: 28px; height: 28px; margin: 0 auto; display: block; }
.chat-fab-x { display: none; }
.chat-root.open .chat-fab-i { display: none; }
.chat-root.open .chat-fab-x { display: block; }

/* Точка «есть незаконченный разговор» — тот же приём, что у мессенджеров */
.chat-fab-dot {
  position: absolute; top: 4px; right: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #ff3b30; border: 2px solid #fff;
  opacity: 0; transition: opacity .2s;
}
.chat-fab-dot.on { opacity: 1; }

/* ---------- Приглашение ---------- */

.chat-invite {
  position: absolute; right: 0; bottom: 74px; width: 268px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px 34px 16px 16px;
  font-size: 15px; color: var(--ink);
  cursor: pointer;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.chat-invite.show { opacity: 1; transform: none; pointer-events: auto; }
.chat-invite::after {                     /* «хвостик» к кнопке */
  content: ""; position: absolute; right: 22px; bottom: -7px;
  width: 12px; height: 12px; background: #fff;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.chat-invite-x {
  position: absolute; top: 6px; right: 8px;
  border: none; background: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ink-3);
}
.chat-root.open .chat-invite { display: none; }

/* ---------- Окно ---------- */

.chat-panel {
  position: absolute; right: 0; bottom: 74px;
  width: 372px; max-height: min(620px, calc(100vh - 120px));
  display: none; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.chat-root.open .chat-panel { display: flex; }

.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--brand); color: #fff;
}
.chat-ava {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.chat-head-t { display: flex; flex-direction: column; line-height: 1.25; }
.chat-head-t b { font-size: 16px; }
.chat-head-t span { font-size: 12.5px; opacity: .85; }
.chat-close {
  margin-left: auto; border: none; background: none; color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer; opacity: .85;
}
.chat-close:hover { opacity: 1; }

.chat-body {
  flex: 1 1 auto; overflow-y: auto; padding: 16px;
  background: var(--bg-2);
  display: flex; flex-direction: column; gap: 8px;
  min-height: 200px;
}

.chat-msg {
  max-width: 86%; padding: 10px 14px; font-size: 15px;
  border-radius: 16px; word-wrap: break-word;
}
.chat-msg.bot { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.chat-msg.me  { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.me a { color: #fff; text-decoration: underline; }

/* «Печатает…» — три точки. Пауза перед ответом делает диалог диалогом,
   мгновенный ответ читается как форма и обесценивает вопросы. */
.chat-typing { display: flex; gap: 4px; padding: 14px; }
.chat-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3);
  animation: chat-dot 1s infinite ease-in-out;
}
.chat-typing i:nth-child(2) { animation-delay: .15s; }
.chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30%           { opacity: 1;  transform: translateY(-3px); }
}

/* Карточка организации из DaData */
.chat-card {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 14px;
}
.chat-card b { font-size: 15px; }
.chat-card span { color: var(--ink-2); }
.chat-card .ok   { color: var(--brand-dark); font-weight: 600; }
.chat-card .warn { color: #c2410c; font-weight: 600; }

/* ---------- Низ: варианты ответа и поля ---------- */

.chat-foot {
  flex: none; padding: 12px; background: #fff;
  border-top: 1px solid var(--line);
  max-height: 45%; overflow-y: auto;
}
.chat-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-opt {
  padding: 9px 15px; font: inherit; font-size: 14.5px;
  color: var(--brand-dark); background: var(--brand-light);
  border: 1px solid transparent; border-radius: 100px;
  cursor: pointer; transition: .12s ease;
}
.chat-opt:hover { background: var(--brand); color: #fff; }

.chat-row { display: flex; gap: 8px; }
.chat-input {
  flex: 1 1 auto; min-width: 0;
  padding: 12px 14px; font: inherit; font-size: 16px;   /* 16px — иначе iOS зумит */
  border: 1.5px solid var(--line); border-radius: 100px;
  background: #fff; color: var(--ink);
}
.chat-input:focus { outline: none; border-color: var(--brand); }
.chat-send {
  flex: none; width: 46px; height: 46px; padding: 0;
  border: none; border-radius: 50%; background: var(--brand); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.chat-send:hover { background: var(--brand-dark); }
.chat-skip {
  margin-top: 8px; border: none; background: none; padding: 0;
  font: inherit; font-size: 14px; color: var(--ink-3);
  text-decoration: underline; cursor: pointer;
}
.chat-err { color: #c2410c; font-size: 13.5px; margin-top: 6px; }
.chat-err:empty { margin: 0; }

.chat-consent-box { display: flex; flex-direction: column; gap: 10px; }
.chat-consent { display: flex; gap: 9px; font-size: 13.5px; color: var(--ink-2); }
.chat-consent input { margin-top: 3px; flex: none; width: 17px; height: 17px; accent-color: var(--brand); }
.chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.chat-submit {
  padding: 14px 20px; font: inherit; font-size: 16px; font-weight: 600;
  border: none; border-radius: 100px; background: var(--brand); color: #fff;
  cursor: pointer;
}
.chat-submit:hover { background: var(--brand-dark); }
.chat-submit:disabled { opacity: .6; cursor: default; }

.chat-final { display: flex; flex-direction: column; gap: 8px; }
.chat-mess {
  padding: 12px; text-align: center; font-weight: 600; font-size: 15px;
  border-radius: 100px; color: #fff;
}
.chat-mess:hover { text-decoration: none; opacity: .92; }
.chat-mess.tg { background: #2aabee; }
.chat-mess.wa { background: #25d366; }

/* ---------- Мобильные: окно на весь экран ---------- */

@media (max-width: 560px) {
  .chat-root { right: 14px; bottom: 14px; }
  .chat-fab { width: 54px; height: 54px; }
  .chat-invite { width: min(280px, calc(100vw - 28px)); }

  .chat-panel {
    position: fixed; inset: 0;
    width: 100%; max-height: none; border-radius: 0;
  }
  .chat-root.open .chat-fab,
  .chat-root.open .chat-invite { display: none; }   /* кнопка перекрывала бы чат */
  .chat-foot { max-height: 55%; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .chat-msg { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-fab, .chat-invite, .chat-opt { transition: none; }
  .chat-typing i { animation: none; }
}
