/* ===== Протокол24 — legal modal TEXT fit fix v2.0.8 ===== */

/*
  Это правило работает только внутри iframe popup:
  /offer/?p24_modal=1 и /personal-data-consent/?p24_modal=1

  Не трогаем обычные страницы документов.
*/

body.p24-legal-v13-body.p24-legal-modal-view-v203,
body.p24-legal-v13-body.p24-legal-modal-view-v204 {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  background: #fff !important;
}

body.p24-legal-v13-body.p24-legal-modal-view-v203 *,
body.p24-legal-v13-body.p24-legal-modal-view-v204 * {
  box-sizing: border-box !important;
}

/* Сам документ внутри iframe */
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-page-v13,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-page-v13 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #fff !important;
}

body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-shell-v13,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-shell-v13 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 26px 32px 38px !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow-x: hidden !important;
  background: #fff !important;
}

body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
}

/* Главное: заголовок не должен быть размером как на отдельной странице */
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 h1,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 h1 {
  max-width: 100% !important;
  margin: 24px 0 16px !important;
  font-size: clamp(32px, 3.2vw, 46px) !important;
  line-height: 1.08 !important;
  letter-spacing: -0.035em !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  white-space: normal !important;
}

body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 h2,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 h2 {
  max-width: 100% !important;
  font-size: 24px !important;
  line-height: 1.18 !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
}

body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 h3,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 h3 {
  max-width: 100% !important;
  font-size: 20px !important;
  line-height: 1.22 !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
}

/* Абзацы и длинные строки */
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 p,
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 li,
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 a,
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 td,
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 th,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 p,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 li,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 a,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 td,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 th {
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}

/* Переключатель документов внутри popup */
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-doc-nav-v13,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-doc-nav-v13 {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin: 0 0 22px !important;
  overflow: visible !important;
}

body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-doc-nav-v13 a,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-doc-nav-v13 a {
  max-width: 100% !important;
  white-space: normal !important;
  text-align: center !important;
}

/* Таблицы только внутри popup */
body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 table,
body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 table {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* На узких экранах popup */
@media (max-width: 767px) {
  body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-shell-v13,
  body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-shell-v13 {
    padding: 20px 16px 34px !important;
  }

  body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13,
  body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 {
    font-size: 15px !important;
    line-height: 1.58 !important;
  }

  body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 h1,
  body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 h1 {
    font-size: 30px !important;
    line-height: 1.08 !important;
    letter-spacing: -0.035em !important;
  }

  body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-content-v13 h2,
  body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-content-v13 h2 {
    font-size: 22px !important;
  }

  body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-doc-nav-v13,
  body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-doc-nav-v13 {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.p24-legal-v13-body.p24-legal-modal-view-v203 .p24-legal-doc-nav-v13 a,
  body.p24-legal-v13-body.p24-legal-modal-view-v204 .p24-legal-doc-nav-v13 a {
    width: 100% !important;
    justify-content: center !important;
  }
}