/* УКФ v4 (2026-11-04). Все селекторы под .ukf, ничего вне неё не трогаем.
   Цвета (паспорт УКФ §1, ukf_v4.py): карточка #ebf1f4, текст #2f4858,
   синий активный #476d85, слабо-синий #87a9bf, красный #ff0e00,
   красный плейсхолдер обязательного #d60c00, hover #5988a6, press #2f4858. */

.ukf {
  box-sizing: border-box;
  max-width: 760px;
  margin: 0 auto;
  padding: 56px;
  background: #ebf1f4;
  border-radius: 6px;
  font-family: 'Montserrat', sans-serif;
  color: #2f4858;
}
.ukf *,
.ukf *::before,
.ukf *::after {
  box-sizing: border-box;
}
.ukf-h {
  margin: 0 0 24px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  color: #2f4858;
  hyphens: none;
  overflow-wrap: normal;
  word-break: normal;
}
.ukf-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 0;
  padding: 24px;
  background: #ffffff;
  border-radius: 6px;
}
.ukf-form[hidden],
.ukf-fail[hidden],
.ukf-modal[hidden],
.ukf-calltime[hidden],
.ukf-tape[hidden],
.ukf-or[hidden] {
  display: none !important;
}
.ukf-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.ukf-field {
  min-width: 0;
}
.ukf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.ukf-field input:not([type="checkbox"]),
.ukf-field select,
.ukf-field textarea {
  display: block;
  width: 100%;
  height: 56px;
  padding: 16px;
  border: 1px solid #476d85;
  border-radius: 4px;
  background: #ffffff;
  color: #2f4858;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5714;
  -webkit-appearance: none;
  appearance: none;
}
.ukf-field input::placeholder,
.ukf-field textarea::placeholder {
  font-style: italic;
}
.ukf-req::placeholder {
  color: #d60c00;
  opacity: 0.82;
}
.ukf-opt::placeholder {
  color: #87a9bf;
}
.ukf-field textarea {
  min-height: 96px;
  height: auto;
  border-radius: 6px;
  resize: vertical;
  overflow: auto;
}
.ukf-field input:not([type="checkbox"]):hover,
.ukf-field select:hover,
.ukf-field textarea:hover {
  border-color: #2f4858;
}
.ukf-field input:not([type="checkbox"]):focus,
.ukf-field select:focus,
.ukf-field textarea:focus {
  border-color: #476d85;
  outline: none;
  box-shadow: inset 0 0 0 1px #476d85;
}
/* рамка мигания полей: фаза 1 красная, фаза 2 гаснет; устойчивая ошибка — красная */
.ukf-field input.ukf-input--err,
.ukf-field textarea.ukf-input--err {
  border-color: #ff0e00 !important;
  box-shadow: none !important;
}
.ukf-field input.ukf-input--off,
.ukf-field textarea.ukf-input--off {
  border-color: #ebf1f4 !important;
  box-shadow: none !important;
}

/* трубка рядом с телефоном */
.ukf-phone {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.ukf-phone input {
  flex: 1 1 auto;
}
.ukf-handset {
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 56px;
  border: 0;
  padding: 0;
  border-radius: 4px;
  background: #ebf1f4;
  color: #ff0e00;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.ukf-handset.is-red {
  background: #ebf1f4;
  color: #ff0e00;
}
.ukf-handset.is-red_weak {
  background: #87a9bf;
  color: #ff0e00;
}
.ukf-handset.is-active {
  background: #476d85;
  color: #ffffff;
}
.ukf-handset.is-cooldown {
  background: #87a9bf;
  color: #ffffff;
}
.ukf-handset.is-active:hover {
  background: #5988a6;
}
.ukf-handset.is-active:active {
  background: #2f4858;
}
.ukf-handset:focus-visible {
  outline: 2px solid #476d85;
  outline-offset: 2px;
}
.ukf-handset[aria-busy="true"] {
  cursor: progress;
}

/* строка «Когда перезвонить?» */
.ukf-calltime {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.4;
  color: #2f4858;
}
.ukf-calltime-label {
  font-weight: 500;
}
.ukf-calltime-controls {
  display: flex;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}
.ukf-calltime-controls select {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  height: 56px;
  padding: 0 32px 0 12px;
  border: 1px solid #476d85;
  border-radius: 4px;
  background: #ffffff;
  color: #2f4858;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5714;
  cursor: pointer;
}

/* строка «ИЛИ» */
.ukf-or {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  color: #2f4858;
}
.ukf-or strong {
  font-weight: 700;
}

/* лента чата */
.ukf-tape {
  border: 1px solid #87a9bf;
  border-radius: 6px;
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ukf-tape-item {
  font-size: 13px;
  line-height: 1.45;
}
.ukf-tape-name {
  font-size: 12px;
  font-weight: 600;
  color: #476d85;
  margin: 0 0 2px;
}
.ukf-tape-status {
  font-style: italic;
  font-weight: 400;
  color: #2f4858;
}
.ukf-tape-typing {
  font-style: italic;
  color: #476d85;
}
.ukf-tape-bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: #2f4858;
  overflow-wrap: break-word;
}
.ukf-tape-item--me {
  align-self: flex-end;
}
.ukf-tape-item--me .ukf-tape-bubble {
  background: #ebf1f4;
}
.ukf-tape-item--agent {
  align-self: flex-start;
}
.ukf-tape-item--agent .ukf-tape-bubble {
  background: #ffffff;
  border: 1px solid #87a9bf;
}

/* галочки */
.ukf-cb {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 400;
  color: #2f4858;
  cursor: pointer;
}
.ukf-cb input {
  position: absolute;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.ukf-cb-box {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
}
.ukf-cb-box::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 2px solid #ff0e00; /* юридическая галочка: красная рамка */
  border-radius: 3px;
  background: #ffffff;
}
.ukf-cb--opt .ukf-cb-box::before {
  border-color: #87a9bf; /* подписка: не красная */
}
.ukf-cb--off .ukf-cb-box::before {
  border-color: #ebf1f4; /* фаза 2 мигания: рамка гаснет, внутри белое */
}
.ukf-cb-box svg {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  color: #ffffff;
  visibility: hidden;
}
.ukf-cb input:checked + .ukf-cb-box::before {
  background: #476d85;
  border-color: #476d85;
}
.ukf-cb input:checked + .ukf-cb-box svg {
  visibility: visible;
}
.ukf-cb input:focus-visible + .ukf-cb-box {
  outline: 2px solid #476d85;
  outline-offset: 2px;
}
.ukf-cb-text {
  min-width: 0;
}
.ukf-cb-text a {
  color: #476d85;
  text-decoration: underline;
}
.ukf-star {
  color: #ff0e00;
  font-weight: 700;
  margin-left: 2px;
}
.ukf-subscribe[hidden] {
  display: none;
}
.ukf-hp {
  position: absolute;
  left: -100vw;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* кнопка чата */
.ukf-actions {
  display: flex;
}
.ukf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.ukf-btn.is-red {
  background: #ebf1f4;
  color: #ff0e00;
}
.ukf-btn.is-red_weak {
  background: #87a9bf;
  color: #ff0e00;
}
.ukf-btn.is-neutral {
  background: #87a9bf;
  color: #ffffff;
}
.ukf-btn.is-active {
  background: #476d85;
  color: #ffffff;
}
.ukf-btn.is-active:hover {
  background: #5988a6;
}
.ukf-btn.is-active:active {
  background: #2f4858;
}
.ukf-btn[aria-busy="true"] {
  cursor: progress;
}
.ukf-btn:focus-visible {
  outline: 2px solid #476d85;
  outline-offset: 2px;
}

/* блок аварии 14 */
.ukf-fail {
  padding: 12px 16px;
  border-radius: 4px;
  background: #ebf1f4;
  color: #2f4858;
  font-size: 14px;
  line-height: 1.6;
}
.ukf-fail a {
  color: #2f4858;
  font-weight: 700;
}

/* «Выйти» */
.ukf-exit {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: #476d85;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-decoration: underline;
  cursor: pointer;
}
.ukf-exit:hover {
  color: #2f4858;
}

/* модалка */
.ukf-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
}
.ukf-modal-inner {
  box-sizing: border-box;
  max-width: 520px;
  width: 100%;
  padding: 32px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  text-align: center;
}
.ukf-modal-text {
  margin: 0 0 24px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  color: #2f4858;
}
.ukf-modal-dots {
  margin: 0 0 24px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.ukf-modal-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #476d85;
  animation: ukf-blink 1s infinite;
}
.ukf-modal-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.ukf-modal-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes ukf-blink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}
.ukf-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 24px;
  border: 0;
  border-radius: 6px;
  background: #476d85;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
}
.ukf-modal-close:hover {
  background: #5988a6;
}
.ukf-modal-close:focus-visible {
  outline: 2px solid #476d85;
  outline-offset: 2px;
}
.ukf-modal-close[hidden] {
  display: none;
}

/* телефон: одна колонка, заголовок 24, поля на всю колонку, цели не меньше 44px */
@media (max-width: 767.98px) {
  .ukf {
    padding: 24px 16px;
  }
  .ukf-h {
    font-size: 24px;
  }
  .ukf-form {
    padding: 16px;
  }
  .ukf-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .ukf-field input:not([type="checkbox"]),
  .ukf-field select,
  .ukf-field textarea {
    font-size: 16px;
  }
  .ukf-btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
  .ukf-handset {
    min-height: 44px;
    min-width: 44px;
  }
}

/* снижение движения: мигание выключено (рамка устойчиво красная) */
@media (prefers-reduced-motion: reduce) {
  .ukf-modal-dots span {
    animation: none;
  }
}

/* сверка с кадрами 01, 01F, 10 */
.ukf-modal-dots[hidden] { display: none; }
.ukf-consents { display: flex; flex-direction: column; gap: 8px; }
.ukf-consents[hidden] { display: none; }
.ukf-consents .ukf-field { margin: 0; }
@media (max-width: 767px) { .ukf-calltime-controls select { padding-left: 12px; padding-right: 20px; min-width: 0; } #ukf-time { min-width: 92px; } }
