/* kl-lead-form.css — финальная версия (фикс чекбоксов + адаптив + без горизонтального скролла) */

/* Сброс отступов ТОЛЬКО внутри модалки */
.kl-modal, .kl-modal * {
  box-sizing: border-box;
}

.kl-modal * {
  margin: 0;
  padding: 0;
}

.kl-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

.kl-modal.is-open,
.kl-modal[aria-hidden="false"] {
  display: block;
}

/* Затемнённый фон */
.kl-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Модальное окно */
.kl-modal__dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: min(560px, calc(100% - 24px));
  max-height: 90vh;

  overflow-y: auto;
  overflow-x: hidden; /* ВАЖНО: убираем горизонтальный скролл */

  background: #fff;
  border-radius: 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 32px 28px;

  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Адаптивность модалки */
@media (max-width: 480px) {
  .kl-modal__dialog {
    padding: 24px 18px;
    border-radius: 24px;
  }
}

/* Кнопка закрытия */
.kl-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border: none;
  background: #f1f5f9;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kl-modal__close:hover {
  background: #e2e8f0;
  transform: rotate(90deg);
}

/* Шапка модалки */
.kl-modal__header {
  text-align: center;
  margin-bottom: 26px;
}

.kl-modal__badge {
  display: inline-block;
  background: #f0fdf4;
  color: #16a34a;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}

.kl-modal__title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.2;
}

.kl-modal__subtitle {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* Форма */
.kl-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0; /* ВАЖНО для переносов внутри flex */
}

/* Сетка для полей */
.kl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-width: 0;
}

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

/* Поле ввода */
.kl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.kl-field__label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
}

.kl-req {
  color: #dc2626;
  margin-left: 2px;
}

.kl-input {
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  background: #f8fafc;

  min-width: 0;
}

.kl-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  background: #fff;
}

.kl-input::placeholder {
  color: #94a3b8;
}

/* Блок со способами связи */
.kl-block {
  background: #f8fafc;
  padding: 18px 16px;
  border-radius: 22px;
  min-width: 0;
}

.kl-block__title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 14px;
}

/* Список чеков */
.kl-checks{
  display: grid;
  grid-template-columns: 1fr; /* всегда 1 колонка */
  gap: 10px;
}

/* Лейбл */
.kl-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;

  font-size: 0.95rem;
  color: #1e293b;

  max-width: 100%;
  min-width: 0;

  /* ВАЖНО: ломаем nowrap темы */
  white-space: normal !important;
}

.kl-check:hover {
  color: #2563eb;
}

/* ВАЖНО: ЖЁСТКО возвращаем чекбоксы (если тема их скрывает) */
.kl-check input[type="checkbox"] {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  clip: auto !important;
  clip-path: none !important;
  transform: none !important;
  pointer-events: auto !important;

  width: 20px !important;
  height: 20px !important;

  /* Чтобы чекбокс был НАТИВНЫЙ и видимый даже если тема убирает appearance */
  -webkit-appearance: auto !important;
  appearance: auto !important;

  accent-color: #2563eb !important;
}

/* Текст рядом с чекбоксом тоже переносим */
.kl-check span {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

/* Особый стиль для согласия */
.kl-check--consent {
  align-items: flex-start;
  gap: 12px;
}

.kl-check--consent input[type="checkbox"] {
  width: 22px !important;
  height: 22px !important;
  margin-top: 2px;
  flex-shrink: 0;
}

.kl-check--consent span {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.5;
}

.kl-check--consent a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.2s;
}

.kl-check--consent a:hover {
  border-bottom-color: #2563eb;
}

/* Подсказка об ошибке */
.kl-hint {
  font-size: 0.85rem;
  color: #991b1b;
  margin-top: 12px;
  padding: 10px 14px;
  background: #fee2e2;
  border-radius: 16px;
  border-left: 4px solid #dc2626;
  font-weight: 600;
}

/* Блок согласия */
.kl-consent {
  margin: 25px 0 2px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  min-width: 0;
}

/* Кнопка отправки */
.kl-submit {
  width: 100%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  padding: 18px 22px;
  border-radius: 40px;
  font-size: 1.08rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 4px 6px -2px rgba(37, 99, 235, 0.3);
  margin-top: 6px;
}

.kl-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: scale(1.01);
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.35);
}

.kl-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #94a3b8;
  box-shadow: none;
  transform: none;
}

.kl-note {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
  margin-top: 14px;
  line-height: 1.45;
  padding: 0 6px;
}

/* Toast */
.kl-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  background: #1e293b;
  color: #fff;

  padding: 18px 24px;
  border-radius: 60px;

  font-size: 1rem;
  font-weight: 600;

  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.22);
  z-index: 200000;

  opacity: 0;
  transition: opacity 0.25s ease;

  pointer-events: none;
  text-align: center;

  max-width: calc(100vw - 24px);
  width: max-content;
}

.kl-toast.is-show {
  opacity: 1;
}

.kl-toast--ok { background: #16a34a; }
.kl-toast--bad { background: #dc2626; }

.kl-toast__title {
  font-weight: 900;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.kl-toast__text {
  font-size: 0.9rem;
  opacity: 0.95;
  line-height: 1.35;
}

/* Доп. адаптация */
@media (max-width: 380px) {
  .kl-modal__title { font-size: 1.45rem; }
  .kl-submit { padding: 16px 18px; font-size: 1rem; }
  .kl-checks { gap: 12px 14px; }
}