:root {
  --form-green: #7ec11f;
  --form-green-top: #85c926;
  --form-green-bottom: #66a915;
  --form-green-hover-top: #8fd92a;
  --form-green-hover-bottom: #5f9d12;
  --form-red: #c92c2c;
  --form-text: #222;
  --form-muted: #555;
  --form-radius: 16px;
}

/* modal base */

.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.custom-modal.is-open {
  display: flex;
}

.custom-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .58);
}

.custom-modal__dialog {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 26px 28px 24px;
  border-radius: var(--form-radius);
  border-top: 6px solid var(--form-green);
  background: #f8f8f8;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}

.custom-modal__dialog--result,
.custom-modal__dialog--small {
  max-width: 430px;
  padding: 34px 28px 30px;
  text-align: center;
}

.custom-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #333;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}

.custom-modal__close:hover {
  color: #7ec11f;
}

.custom-modal__title {
  margin: 0 0 6px;
  font-size: 38px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--form-text);
  text-align: center;
}

.custom-modal__subtitle {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--form-muted);
  text-align: center;
}

body.modal-lock {
  overflow: hidden;
}

/* form */

.custom-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.custom-form__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.custom-form__input,
.custom-form__select {
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #fff;
  color: var(--form-text);
  font-size: 15px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.custom-form__select {
  cursor: pointer;
}

.custom-form__input:focus,
.custom-form__select:focus {
  border-color: var(--form-green);
  box-shadow: 0 0 0 3px rgba(126, 193, 31, .15);
}

.custom-form__input.is-error,
.custom-form__select.is-error {
  border-color: var(--form-red);
  box-shadow: 0 0 0 3px rgba(201, 44, 44, .10);
}

.custom-form__checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.custom-form__checkbox {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  color: #333;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}

.custom-form__checkbox input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  cursor: pointer;
}

.custom-form__checkbox a {
  color: #5d9d13;
  text-decoration: underline;
}

.custom-form__checkbox a:hover {
  color: #487b0d;
}

.custom-form__error {
  min-height: 14px;
  color: var(--form-red);
  font-size: 12px;
  line-height: 1.2;
}

.custom-form__message {
  min-height: 18px;
  color: var(--form-red);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
  text-align: center;
}

.custom-form__message.is-success {
  color: #4d8c0f;
}

.custom-form__hidden {
  position: absolute;
  left: -9999px;
  opacity: 0;
  visibility: hidden;
}

/* buttons */

.custom-form__submit,
.form-success__btn {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(to bottom, var(--form-green-top) 0%, var(--form-green-bottom) 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
  transition: background .2s ease, transform .2s ease;
}

.custom-form__submit:hover,
.form-success__btn:hover {
  background: linear-gradient(to bottom, var(--form-green-hover-top) 0%, var(--form-green-hover-bottom) 100%);
}

.custom-form__submit:active,
.form-success__btn:active {
  transform: translateY(1px);
}

.custom-form__submit {
  width: 100%;
  height: 50px;
  margin-top: 4px;
  font-size: 20px;
}

.custom-form__submit:disabled {
  opacity: .7;
  cursor: not-allowed;
}

.form-success__btn {
  display: inline-block;
  min-width: 170px;
  height: 44px;
  font-size: 18px;
}

/* success modal */

.form-success {
  text-align: center;
}

.form-success__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--form-green-top) 0%, var(--form-green-bottom) 100%);
  color: #fff;
  font-size: 42px;
  line-height: 64px;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}

.form-success__title {
  margin: 0 0 12px;
  color: var(--form-text);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  text-align: center !important;
}

.form-success__text {
  margin-bottom: 24px;
  color: #444;
  font-size: 17px;
  line-height: 1.45;
}

/* site callback button position */

#btn-callback {
  position: absolute;
  right: 0;
  top: 115px;
}

/* adaptive */

@media (max-width: 700px) {
  .custom-modal__dialog {
    max-width: 520px;
    padding: 22px 18px 20px;
  }

  .custom-modal__title {
    font-size: 32px;
  }

  .custom-form__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .custom-modal {
    padding: 10px;
  }

  .custom-modal__dialog {
    padding: 18px 14px;
    border-radius: 12px;
  }

  .custom-modal__title {
    font-size: 28px;
  }

  .custom-modal__subtitle {
    margin-bottom: 16px;
    font-size: 14px;
  }

  .custom-form__submit {
    height: 48px;
    font-size: 18px;
  }

  .custom-form__checkbox {
    font-size: 13px;
  }

  .form-success__title {
    font-size: 30px;
  }

  .form-success__text {
    font-size: 15px;
  }
}