/* ==========================================================================
   Общие элементы формы инструментов (первыми — в калькуляторе единого пособия):
   шаги-карточки .tf-group, свой список с поиском .tf-combo (на телефоне — шторка),
   переключатель .tf-seg, счётчик «− 2 +» .tf-stepper, тумблер .tf-switch,
   поле суммы .tf-money, раскрывашка .tf-more, кнопка-капсула .tf-calc-btn.
   Скрипт списка и счётчиков — в скрипте страницы. Подключается через CSS_DEPS.
   Цвет акцента — переменные ниже; страница может переопределить их цветом своего раздела.
   ========================================================================== */
:root {
  --tf-accent: #7d62d9;
  --tf-accent-soft: #efeafd;
  --tf-line: #e7e3f0;
  --tf-field: #fbfaff;
}

.tf-form [hidden],
.tf-combo-panel[hidden],
.tf-combo-panel [hidden],
.tf-combo-backdrop[hidden] {
  display: none !important;
}

/* ---------- Шаги формы ---------- */
.tf-group {
  min-width: 0;
  margin: 0 0 14px;
  padding: 16px 18px 18px;
  border: 1px solid var(--tf-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.tf-group legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  font: 800 16px/1.2 "Montserrat", sans-serif;
  color: var(--main-bg-color);
}

.tf-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tf-accent);
  box-shadow: 0 0 0 4px var(--tf-accent-soft);
}

.tf-row-label {
  display: block;
  margin: 2px 0 8px;
  font: 700 13px/1.3 "Montserrat", sans-serif;
  color: var(--main-bg-color);
}

.tf-row {
  margin-top: 12px;
}

.tf-hint {
  margin: 8px 0 0 !important;
  font-size: 12.5px !important;
  line-height: 1.45;
  color: var(--dark-text-color);
}

/* Нативный select остаётся источником значения и события change, но скрыт */
.tf-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Свой список (регион, район) ---------- */
.tf-combo {
  position: relative;
}

.tf-combo-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 9px 14px 9px 10px;
  border: 1.5px solid var(--tf-line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tf-combo-btn:hover,
.tf-combo[data-open="true"] .tf-combo-btn {
  border-color: var(--tf-accent);
}

.tf-combo-btn:focus-visible {
  outline: none;
  border-color: var(--tf-accent);
  box-shadow: 0 0 0 4px var(--tf-accent-soft);
}

.tf-combo-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tf-accent-soft);
  color: var(--tf-accent);
}

.tf-combo-value {
  flex: 1;
  min-width: 0;
  font: 700 15.5px/1.3 "Montserrat", sans-serif;
  color: var(--main-bg-color);
  overflow-wrap: anywhere;
}

.tf-combo-value small {
  display: block;
  margin-top: 2px;
  font: 600 12.5px/1.3 "Nunito", sans-serif;
  color: var(--dark-text-color);
}

.tf-combo[data-empty="true"] .tf-combo-value {
  color: #6b6878;
}

.tf-combo-caret {
  flex: none;
  color: #8a8697;
  transition: transform 0.2s;
}

.tf-combo[data-open="true"] .tf-combo-caret {
  transform: rotate(180deg);
}

.tf-combo-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-height: 360px;
  overflow: hidden;
  border: 1px solid var(--tf-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 48px -18px rgba(37, 33, 60, 0.35);
}

.tf-combo-head {
  display: none;
}

.tf-combo-search {
  flex: none;
  position: relative;
  padding: 10px 10px 6px;
}

.tf-combo-search svg {
  position: absolute;
  left: 22px;
  top: 50%;
  margin-top: 2px;
  transform: translateY(-50%);
  color: #8a8697;
  pointer-events: none;
}

.tf-combo-search input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--tf-line);
  border-radius: 12px;
  background: var(--tf-field);
  font: 600 16px "Nunito", sans-serif;
  color: var(--main-bg-color);
}

.tf-combo-search input:focus {
  outline: none;
  border-color: var(--tf-accent);
}

.tf-combo-list {
  flex: 1;
  margin: 0;
  padding: 4px 6px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.tf-combo-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 15px !important;
  line-height: 1.3;
  color: var(--main-bg-color);
  cursor: pointer;
}

.tf-combo-list li.is-active {
  background: #f4f1fb;
}

.tf-combo-list li[aria-selected="true"] {
  font-weight: 700;
  color: var(--tf-accent);
}

.tf-combo-list li[aria-selected="true"]::after {
  content: "";
  flex: none;
  width: 16px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='M1.5 6.5 6 10.5 14.5 1.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 12'%3E%3Cpath d='M1.5 6.5 6 10.5 14.5 1.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tf-combo-empty {
  flex: 1;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--dark-text-color);
}

.tf-combo-backdrop {
  display: none;
}

/* ---------- Переключатель-сегменты ---------- */
.tf-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f1eff6;
}

.tf-seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.tf-seg label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 11px;
  font: 700 14px/1.2 "Montserrat", sans-serif !important;
  text-align: center;
  color: var(--dark-text-color);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tf-seg input:checked + label {
  background: #fff;
  color: var(--main-bg-color);
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.08);
}

.tf-seg input:focus-visible + label {
  outline: 2px solid var(--tf-accent);
  outline-offset: 1px;
}

.tf-seg-sm label {
  min-height: 38px;
  font-size: 13px !important;
}

/* ---------- Счётчики «− 2 +» ---------- */
.tf-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f0edf5;
}

/* первая строка группы сразу под заголовком — без разделительной линии */
.tf-group > legend + .tf-count,
.tf-group > legend + .tf-switch {
  margin-top: 4px;
  padding-top: 0;
  border-top: 0;
}

.tf-count-text b,
.tf-switch-text b {
  display: block;
  font: 700 14.5px/1.3 "Montserrat", sans-serif;
  color: var(--main-bg-color);
}

.tf-count-text small,
.tf-switch-text small {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--dark-text-color);
}

.tf-stepper {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #f1eff6;
}

.tf-stepper button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--main-bg-color);
  box-shadow: 0 1px 4px rgba(17, 17, 17, 0.1);
  cursor: pointer;
}

.tf-stepper button:disabled {
  color: #c3c0cc;
  box-shadow: none;
  cursor: default;
}

.tf-stepper input {
  width: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  font: 800 17px "Montserrat", sans-serif;
  text-align: center;
  color: var(--main-bg-color);
  -moz-appearance: textfield;
}

.tf-stepper input::-webkit-outer-spin-button,
.tf-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tf-stepper input:focus {
  outline: none;
}

.tf-stepper:focus-within {
  box-shadow: 0 0 0 3px var(--tf-accent-soft), 0 0 0 1px var(--tf-accent);
}

/* ---------- Тумблеры ---------- */
.tf-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f0edf5;
  cursor: pointer;
}

.tf-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tf-switch-ui {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #dcd8e5;
  transition: background 0.18s;
}

.tf-switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(17, 17, 17, 0.25);
  transition: transform 0.18s;
}

.tf-switch input:checked + .tf-switch-ui {
  background: var(--tf-accent);
}

.tf-switch input:checked + .tf-switch-ui::after {
  transform: translateX(20px);
}

.tf-switch input:focus-visible + .tf-switch-ui {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* ---------- Сумма ---------- */
.tf-money {
  position: relative;
  margin-top: 12px;
}

.tf-money input {
  width: 100%;
  height: 58px;
  padding: 0 44px 0 16px;
  border: 1.5px solid var(--tf-line);
  border-radius: 14px;
  background: #fff;
  font: 800 22px "Montserrat", sans-serif;
  letter-spacing: -0.01em;
  color: var(--main-bg-color);
}

.tf-money input:focus {
  outline: none;
  border-color: var(--tf-accent);
  box-shadow: 0 0 0 4px var(--tf-accent-soft);
}

.tf-money span {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font: 800 20px "Montserrat", sans-serif;
  color: #8a8697;
}

.tf-more {
  margin-top: 10px;
}

.tf-more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 13px "Montserrat", sans-serif;
  color: var(--tf-accent);
  cursor: pointer;
  list-style: none;
}

.tf-more summary::-webkit-details-marker {
  display: none;
}

.tf-more summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s;
}

.tf-more[open] summary::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.tf-more p {
  margin: 8px 0 0 !important;
  font-size: 13px !important;
  line-height: 1.5;
  color: var(--dark-text-color);
}

/* «Рассчитать пособие» — капсула, как «Написать нам» и кнопки каталога (.tb-cta в tools.css) */
button.tf-calc-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  width: 100%;
  height: 56px;
  margin-top: 6px;
  padding: 0 24px;
  border-radius: 999px;
  background-color: #fff3c4;
  background-image: linear-gradient(180deg, #fff 0%, #fff3c4 55%, #f0d561 100%);
  box-shadow:
    inset 0 0 0 1px rgba(189, 160, 0, 0.22),
    inset 0 -2px 0 rgba(150, 120, 0, 0.25),
    0 10px 30px rgba(189, 160, 0, 0.35),
    0 0 50px rgba(242, 211, 91, 0.22);
  color: var(--main-bg-color);
  font-size: 17px;
  letter-spacing: -0.01em;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

button.tf-calc-btn:hover {
  background: linear-gradient(180deg, #fff 0%, #fff3c4 55%, #f0d561 100%) #fff3c4;
  box-shadow:
    inset 0 0 0 1px rgba(189, 160, 0, 0.3),
    inset 0 -2px 0 rgba(150, 120, 0, 0.25),
    0 14px 36px rgba(189, 160, 0, 0.45),
    0 0 60px rgba(242, 211, 91, 0.3);
}

button.tf-calc-btn svg {
  flex: none;
  stroke-width: 2.2;
}

/* блик бежит по transform, а не по left — без перерисовки соседей */
button.tf-calc-btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  transform: translateX(-133%) skewX(-18deg);
  animation: tf-cta-shine 4s ease-in-out infinite 1.5s;
  pointer-events: none;
}

@keyframes tf-cta-shine {
  0%,
  60% {
    transform: translateX(-133%) skewX(-18deg);
  }
  100% {
    transform: translateX(433%) skewX(-18deg);
  }
}

@media (max-width: 639px) {
  .tf-group {
    margin-bottom: 12px;
    padding: 14px 14px 16px;
  
  }

  .tf-seg label {
    font-size: 13px !important;
  
  }

  /* список — шторкой снизу экрана */
  .tf-combo-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10010; /* выше шапки (10000) и плашки cookie */
    display: block;
    background: rgba(17, 15, 24, 0.45);
    animation: tf-fade 0.22s ease-out; /* затемнение проявляется вместе со шторкой, а не вспышкой */
  
  }

  .tf-combo-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    z-index: 10011;
    max-height: 82svh;
    border: 0;
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: tf-sheet 0.22s ease-out;
  
  }

  .tf-combo-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 12px 4px 20px;
  
  }

  .tf-combo-head b {
    font: 800 17px "Montserrat", sans-serif;
    color: var(--main-bg-color);
  
  }

  .tf-combo-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1eff6;
    color: var(--main-bg-color);
  
  }

  .tf-combo-list li {
    padding: 13px 14px;
    font-size: 16px !important;
  
  }
}

/* пока шторка открыта, страница под ней не прокручивается; --sbw — ширина исчезнувшей полосы
   прокрутки (ставит скрипт списка), чтобы страница и шапка не дёргались вбок, как у меню */
html.tf-sheet-open {
  overflow: hidden;
  padding-right: var(--sbw, 0px);
}

html.tf-sheet-open .site-header {
  right: var(--sbw, 0px);
}

/* фокус на списке ставится скриптом, где выбор — видно по подсветке пункта */
.tf-combo-list:focus {
  outline: none;
}

@keyframes tf-fade {
  from {
    opacity: 0;
  }
}

@keyframes tf-sheet {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tf-combo-panel,
  .tf-combo-backdrop,
  button.tf-calc-btn::after {
    animation: none;
  
  }
}
