/* kaia: телефонная версия главной (≤767px). Правило страницы — «один экран, одна мысль»:
   каждый блок из landing/tools/mobile-contract.json целиком помещается в видимую часть экрана
   телефона (высота экрана минус адресная строка и шапка), проверка — landing/tools/mobile-contract.mjs.
   Десктоп этот файл не меняет, кроме .km-only (скрыто) и постоянной высоты карточек-вкладок. */

.km-only { display: none !important; }

/* Хиро, телефон и планшет: четыре карточки-примера сменяются сами, и у каждой своя высота — вся
   страница под ними ездила на 117px каждые 8 секунд. Карточки лежат в одной ячейке сетки: место
   занято самой высокой, видна активная. */
@media (max-width: 991px) {
  .audio-playground-wrp { display: grid; }
  .audio-playground-wrp .hero-img-box { grid-area: 1 / 1; display: flex !important; align-items: stretch; visibility: hidden; }
  .audio-playground-wrp .hero-img-box.active { visibility: visible; }
  .audio-playground-wrp .hero-glass-effect.is-home { display: flex; flex-direction: column; justify-content: center; }
}

@media (max-width: 767px) {
  .km-only { display: block !important; }
  .km-only.km-inline { display: inline !important; }
  .km-off { display: none !important; }

  /* —— Общие отступы: блоки собраны, между блоками 32px вместо 48 —— */
  .sections_wrapper, .kaia-capabilities { gap: 32px; }
  .main-wrapper .common-heading-wrap { row-gap: 12px; }
  .main-wrapper .spacer.is-navy, .main-wrapper .spacer.is-paprika { height: 24px; }
  .main-wrapper .section_capabilities { gap: 24px; }
  .main-wrapper .common-heading-right.is-pt-12 { padding-top: 0; }

  /* —— Уведомление о cookie: одна строка у нижнего края, не закрывает содержимое —— */
  .kaia-cookie { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 12px; padding: 8px 8px 8px 16px; border-radius: 16px; }
  .kaia-cookie p { font-size: 12px; line-height: 16px; }
  .kaia-cookie button { min-height: 40px; padding: 0 16px; }

  /* —— «Не пропустите ни звонка»: карточки без картинок, переключает только палец —— */
  #never-miss-call .tab-card-wrapper.is-kaia-x:not(.is-main),
  #never-miss-call .tab-card-wrapper.is-main { min-height: 0; }
  :is(#never-miss-call, #outbound-campaigns) .progress-track { display: none; }
  :is(#never-miss-call, #outbound-campaigns) .tab-card-wrapper.is-kaia-x { gap: 8px; }
  :is(#never-miss-call, #outbound-campaigns) .tab-card-v2 { padding: 16px 20px; }
  :is(#never-miss-call, #outbound-campaigns) .tab-card-title.v2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  /* знак раскрытия: закрытая карточка должна читаться как нажимаемая */
  :is(#never-miss-call, #outbound-campaigns) .tab-card-title.v2::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px;
    border-right: 1.5px solid #6B7A88; border-bottom: 1.5px solid #6B7A88; transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
  :is(#never-miss-call, #outbound-campaigns) .tab-card-v2.active .tab-card-title.v2::after { transform: translateY(2px) rotate(-135deg); }

  /* вместо абзаца — пункты: главное тёмным, пояснение серым */
  #never-miss-call .tab-para { display: none; }
  #never-miss-call .tab-card-content { gap: 10px; padding-top: 10px; }
  .km-points { display: grid !important; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 16px; line-height: 22px; color: #42525B; }
  .km-points li { position: relative; padding-left: 18px; }
  .km-points li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: #78AF73; }
  .km-points b { font-weight: 500; color: #162129; }
  .km-points-tail { margin: 0; padding-top: 10px; border-top: 1px solid #b5dbb982; font-size: 16px; line-height: 22px; font-weight: 500; color: #162129; }

  /* —— «Верните пациентов»: под открытой карточкой пример кампании — группа, повод, результат —— */
  #outbound-campaigns .tab-main-clone { margin: 0; padding: 0; }
  #outbound-campaigns .tab-main-clone .kr-flow { display: grid; grid-auto-rows: auto; gap: 0; padding: 0; background: #fff; border: 1px solid #EBF2F7; border-radius: 16px; overflow: hidden; }
  #outbound-campaigns .tab-main-clone .kr-step { display: grid; grid-template-columns: 76px minmax(0, 1fr); column-gap: 8px; align-items: baseline; padding: 10px 20px; border: 0; border-radius: 0; background: none; animation: none; }
  #outbound-campaigns .tab-main-clone .kr-step + .kr-step { border-top: 1px solid #EBF2F7; }
  #outbound-campaigns .tab-main-clone .kr-step.is-result { background: #E3EEFB; border-top-color: #E3EEFB; }
  #outbound-campaigns .tab-main-clone .kr-step::before, #outbound-campaigns .tab-main-clone .kr-step::after { display: none; }

  /* —— Плеер звонка: кнопка и название в строку, под ними дорожка и время —— */
  .kaia-call { display: grid !important; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px; border-radius: 20px; }
  .kaia-call-text { grid-column: 1 / -1; grid-row: 1; }
  .kaia-call-title { font-size: 18px; line-height: 26px; white-space: normal; }
  .kaia-call-sub { font-size: 14px; line-height: 21px; }
  .kaia-call > a.button, .kaia-call-btn { grid-row: 2; width: 44px; height: 44px; }
  .kaia-call #waveform-cap, .kaia-call-wave { grid-column: 2; grid-row: 2; order: 0; }
  .kaia-call-time { grid-column: 3; grid-row: 2; }
  #confirmations .kaia-call { margin-top: 24px; }

  /* —— Результаты «Дентлайн»: своя телефонная версия вместо уменьшенной картинки —— */
  #stats .scheduling-img { display: none; }
  #stats .schedule-img-wr { display: flex; flex-direction: column; padding: 20px 16px 16px; }
  #stats .schedule-img-wr .text-overline { order: -1; position: static; padding: 0; margin: 0 0 16px; background: none; text-align: left; }
  .km-stats-nums { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
  .km-stats-nums li { display: grid; gap: 2px; align-content: start; }
  .km-stats-nums b { font-size: 28px; line-height: 34px; font-weight: 500; white-space: nowrap; }
  .km-stats-nums span { font-size: 12px; line-height: 17px; color: #42525B; }
  .km-stats-nums .is-blue { color: #0278FF; }
  .km-stats-nums .is-green { color: #5E9659; }
  .km-stats-nums .is-violet { color: #5B2DB4; }
  /* график: линии тянутся под ширину экрана, подписи остаются своим кеглем */
  .km-stats-chart { margin-top: 20px; padding: 16px 12px 12px 52px; background: #F7F9FB; border-radius: 12px; }
  .km-axis-title { margin: 0 0 28px -40px; font-size: 12px; line-height: 17px; color: #6B7A88; }
  .km-plot { position: relative; height: 132px; border-left: 1px solid #C3CDD6; border-bottom: 1px solid #C3CDD6; }
  .km-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .km-grid { fill: none; stroke: #DEE1E6; stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
  .km-area { fill: #0278FF; opacity: .08; }
  .km-line { fill: none; stroke: #0278FF; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
  .km-plot i { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; border: 2.5px solid #0278FF; }
  .km-plot i.is-end { background: #0278FF; }
  .km-plot i.is-green { border-color: #5E9659; background: #5E9659; }
  .km-val { position: absolute; transform: translate(-50%, calc(-100% - 10px)); font-size: 14px; line-height: 20px; font-weight: 500; color: #0278FF; white-space: nowrap; }
  .km-val.is-end { transform: translate(-100%, calc(-100% - 10px)); }
  .km-val.is-below { transform: translate(-20%, 10px); }
  .km-val.is-green { color: #5E9659; }
  .km-y { position: absolute; right: calc(100% + 8px); transform: translateY(-50%); font-size: 12px; line-height: 17px; color: #6B7A88; white-space: nowrap; }
  .km-y::after { content: ""; position: absolute; left: calc(100% + 4px); top: 50%; width: 4px; height: 1px; background: #C3CDD6; }
  /* четыре отметки времени стоят на 0, ⅓, ⅔ и конце оси */
  .km-x { position: relative; height: 26px; font-size: 12px; line-height: 17px; color: #6B7A88; }
  .km-x span { position: absolute; top: 8px; transform: translateX(-50%); white-space: nowrap; }
  .km-x span::before { content: ""; position: absolute; top: -8px; left: 50%; width: 1px; height: 5px; background: #C3CDD6; }
  .km-x span:nth-child(1) { left: 0; transform: none; }
  .km-x span:nth-child(1)::before { left: 0; }
  .km-x span:nth-child(2) { left: 33.3%; }
  .km-x span:nth-child(3) { left: 66.7%; }
  .km-x span:nth-child(4) { left: 100%; transform: translateX(-100%); }
  .km-x span:nth-child(4)::before { left: 100%; }

  /* Автор отзыва: имя и должность слева (60%), логотип клиники в своей плашке справа (40%) */
  #stats .scheduling-com { padding: 0; }
  #stats .scheduling-com-wrap.is-appointment { padding: 20px 16px; }
  #stats .ai-author-content-wrap.is-wrap { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 16px; }
  #stats .author-name-wrap { flex: 1; min-width: 0; }
  #stats .author-img-wrap { order: 2; flex: none; width: 64px; height: 64px; }
  #stats .author-img.is-ai { width: 64px; height: 64px; }
  #stats .spacer.is-jade { height: 16px; }

  /* Тёмный блок «3,1 млн ₽» остаётся, только плотнее */
  #never-miss-call .cta-block.mt-48 { margin-top: 24px; padding: 24px 20px; gap: 20px; align-items: flex-start; }
  #never-miss-call .cta-block .ts-h4.is-cta { text-align: left; }
  #never-miss-call .cta-block .ts-h4.is-cta br { display: none; }
  .km-cta-fig { display: block; margin-bottom: 8px; font-family: "PT Serif", serif; font-style: italic; font-weight: 400; font-size: 40px; line-height: 44px; color: #8FB8FF; }
  #never-miss-call .cta-block .button-group { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; align-self: stretch; gap: 8px; }
  #never-miss-call .cta-block .button-group .button { margin: 0; }

  /* —— «Подтверждайте приёмы»: одна цифра вместо столбцов —— */
  #confirmations .kc-cols, #confirmations .kc-big-note, #confirmations .hiw-content > p.ts-p { display: none; }
  #confirmations .hiw-wr { gap: 24px; }
  #confirmations .hiw-content::after { display: none; }
  #confirmations .kc-card.kc-split { display: block; padding: 16px 20px; background: #fff; border: 1px solid #EBF2F7; border-radius: 16px; }
  #confirmations .kc-big-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; align-items: center; }
  #confirmations .kc-muted { font-size: 16px; line-height: 22px; color: #42525B; }
  .kaia-call-own .kaia-call-title::first-letter { text-transform: uppercase; }
  #confirmations .hiw-img-wr.kaia-viz { order: -1; }
  #confirmations .hiw-content > .spacer { height: 12px; }
  /* довод «звонок, а не сообщение»: две строки друг против друга, вторая выделена */
  .km-versus { display: grid !important; gap: 8px; margin: 0; }
  .km-versus > div { padding: 14px 16px; border-radius: 12px; background: #fff; border: 1px solid #EBF2F7; }
  .km-versus dt { margin-bottom: 2px; font-size: 14px; line-height: 21px; color: #6B7A88; }
  .km-versus dd { margin: 0; font-size: 16px; line-height: 22px; color: #42525B; }
  .km-versus .is-kaia { background: #E3EEFB; border-color: #E3EEFB; }
  .km-versus .is-kaia dt { color: #0278FF; font-weight: 500; }
  .km-versus .is-kaia dd { color: #162129; }
  .km-versus b { font-weight: 500; }

  /* —— «Обучена для вашей клиники»: три правила и метки того, что настраивается под клинику —— */
  #customizability .dedicated-wrapper.is-agent, #customizability .agent-img-main-wr { display: none; }
  #customizability .agent-train-2-col { display: block; }
  .km-rules { display: grid !important; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .km-rules li { display: grid; gap: 4px; padding: 16px; border-radius: 16px; background: var(--color--black, #162129); }
  .km-rules b { font-size: 18px; line-height: 26px; font-weight: 500; color: #fff; }
  .km-rules span { font-size: 14px; line-height: 21px; color: #C3CDD6; }
  .km-rules p { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
  .km-rules i { padding: 2px 8px; border: 1px solid #78AF73; border-radius: 6px; font-style: normal; font-size: 14px; line-height: 20px; color: #A8D3A3; }

  /* —— «Всё на виду»: четыре строки со значком слева вместо четырёх экранов по центру —— */
  #observability .production-card-wrap { display: grid; gap: 0; padding: 4px 16px; }
  #observability .production-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: start; width: auto; max-width: none; padding: 12px 0; text-align: left; }
  #observability .production-card + .production-hr, #observability .production-hr { width: 100%; height: 1px; margin: 0; display: block; }
  #observability .production-icon-wrap { width: 40px; height: 40px; }
  #observability .production-card > .spacer { display: none; }
  #observability .production-content-wrap { align-items: flex-start; text-align: left; gap: 2px; }
  #observability .production-content-wrap > * { text-align: left; }

  /* —— «Становится лучше»: три ступени с цифрой вместо графика и трёх абзацев —— */
  #self-improvement .ki-grid2 { display: none; }
  .km-climb ol { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
  .km-climb-step { position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 12px; align-items: start; padding: 0 0 20px; }
  /* линия роста между ступенями */
  .km-climb-step:not(:last-child)::before { content: ""; position: absolute; left: 0; top: 44px; bottom: 4px; width: 2px; background: #C3D7F0; }
  .km-climb-step > b { font-size: 32px; line-height: 38px; font-weight: 500; color: #0278FF; font-variant-numeric: tabular-nums; }
  .km-climb-step.is-end > b { font-size: 40px; line-height: 44px; color: #5E9659; }
  .km-climb-step > div { display: grid; gap: 2px; padding-top: 6px; }
  .km-climb-step strong { font-size: 18px; line-height: 26px; font-weight: 500; color: #162129; }
  .km-climb-step span { font-size: 14px; line-height: 21px; color: #42525B; }
  .km-climb-step.is-end { padding-bottom: 0; }
  .km-climb { display: flex !important; flex-direction: column; }
  .km-climb > p { order: -1; margin: 0 0 16px; font-size: 14px; line-height: 21px; color: #6B7A88; }

  /* —— Интеграции: на телефоне только заголовок и вводка, логотипы убраны (владелец, 27.11) —— */
  #integrations .integrate-wrapper, #integrations .spacer.is-paprika { display: none; }

  /* —— «Результаты клиник»: карточка кейса по высоте текста, цифра в заголовке выделена —— */
  /* карточка была 422px при любом тексте: под логотипом оставалась пустота. Высоту по самому длинному
     заголовку ставит kaia-mobile.js (--km-case-h); 372px — запас, пока скрипт не отработал */
  #performance .video-wrapper.kaia-case-plain { padding-top: var(--km-case-h, 372px); }
  /* заголовок кейса и кнопка — по левому краю, как остальной текст страницы */
  #performance .overlay_inner-content, #performance .overlay_left { align-items: flex-start; text-align: left; }
  #performance .overlay_left .ts-h4 { text-align: left; }
  #performance .overlay_left .button-group { justify-content: flex-start; }
  .km-accent { font-family: "PT Serif", serif; font-style: italic; font-weight: 400; color: #8FB8FF; white-space: nowrap; }
  #performance .kp-lead { display: none; }
  #performance .common-heading-wrap.is-counter-home { padding: 24px 0 0; }
  #performance .common-heading-right.kp { gap: 12px; }
  #performance .kp-row { padding: 10px 0; }

  /* —— «Технологии»: рисунок, текст и стрелки — в одном экране —— */
  #technology .tech_imge-wr { padding: 16px 16px 0; }
  #technology .tech-grid-block { flex-direction: column; gap: 12px; }
  #technology .tech-grid-block > [class*="tech-vect"] { order: -1; width: auto; height: 148px; margin: 0 auto; }
  #technology .tech-grid-block .tech-vector-img { width: auto; height: 148px; }
  #technology .tech-content-wrp { gap: 6px; }
  #technology .arrows-tech-wrp { margin-top: 8px; padding-bottom: 16px; align-items: center; justify-content: center; gap: 20px; }
  #technology .arrows-tech-wrp :is(.btn-prev, .btn-next), #technology .arrows-tech-wrp img { width: 44px; height: 44px; }
  .km-tech-count { min-width: 44px; text-align: center; font-size: 14px; line-height: 20px; color: #C3CDD6; font-variant-numeric: tabular-nums; }

  /* —— «Запуск — бесплатно»: один счёт на три строки, цена справа —— */
  .kaia-launch { padding: 24px 16px; }
  .kaia-launch__cards { gap: 0; margin-top: 20px; background: #fff; border: 1px solid #EBF2F7; border-radius: 16px; overflow: hidden; }
  .kaia-launch__card { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; padding: 12px 16px; border: 0; border-radius: 0; background: none; }
  .kaia-launch__card + .kaia-launch__card { border-top: 1px solid #EBF2F7; }
  .kaia-launch__fig { grid-column: 2; grid-row: 1 / 3; margin: 0; font-size: 32px; line-height: 38px; font-weight: 500; color: #5E9659; white-space: nowrap; }
  .kaia-launch__card:last-child { background: #E3EEFB; }
  .kaia-launch__card:last-child .kaia-launch__fig { color: #0278FF; }
  .kaia-launch .kaia-launch__title { grid-column: 1; }
  .kaia-launch__text { grid-column: 1; margin-top: 2px; font-size: 14px; line-height: 21px; }
  .kaia-launch__foot { margin-top: 20px; }
  .kaia-launch__foot .button { width: 100%; justify-content: space-between; }
}

/* Узкие телефоны (320–359px): три цифры «Дентлайн» не помещаются в строку — главная сверху, две под ней */
@media (max-width: 359px) {
  .km-stats-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .km-stats-nums .is-main { grid-column: 1 / -1; }
}
