/* Форма заявки (OR0090): страница /lead, окно и шторка, встроенные формы
   карточки и пустого поиска. Отдельно от site.css: тот целиком в <style>,
   а с формой не укладывается в первый ответ TCP. Подключение — <link> в
   <head> на страницах с формой от сервера (page.Lead), на остальных
   lead.js грузит файл сам, окно ждёт его перед показом. */
/* заявка (OR0090, A-Forms): одна форма — страница /lead, окно ≥ 768,
   шторка < 768, встроенный блок. Контейнер .lf подменяет ответ htmx. */
.lead { padding-top: var(--s-6); padding-bottom: var(--s-12); }
.lf { display: flex; flex-direction: column; gap: 16px; }
.lf--page { max-width: 560px; }
.lf__form, .lf__fields, .lf__offline, .lf__done { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lf__fields { margin: 0; padding: 0; border: 0; }
.lf__title { font-size: 26px; line-height: 1.2; font-weight: 700; padding-right: 48px; }
.lf--page .lf__title { font-size: var(--fs-h1); line-height: var(--lh-h1); padding-right: 0; }
.lf--embed .lf__title { font-size: 24px; padding-right: 0; }
.lf__sub, .lf__text { font-size: 15px; line-height: 1.5; color: #3A3F47; margin-top: -4px; }
.lf__text { font-size: 16px; line-height: 1.55; margin: 0; }
.lf__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lf__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.lf__row--3 .lf__qty-row { flex-direction: column; align-items: stretch; gap: 6px; }
.lf__row--3 .lf__step { display: none; }
.lf .lf__row--3 .lf__stepper input { width: 100%; padding: 0 14px; text-align: left; font-weight: 400; }
.lf .field select { width: 100%; height: 48px; padding: 0 12px; border: 1.5px solid var(--c-field); border-radius: 8px; font: 400 16px var(--font); color: var(--c-ink); background: var(--c-white); }
.lf .field select:focus { outline: 0; border-color: var(--c-ink); }
.lf .field textarea { height: auto; padding: 12px 14px; resize: vertical; }
.lf .field input:disabled, .lf .field textarea:disabled { background: var(--c-soft); border-color: var(--c-line); color: var(--c-gray-dark); }
.lf .field input::placeholder, .lf .field textarea::placeholder { color: #8A9099; }
.lf__hint { font-size: 13px; line-height: 1.4; color: var(--c-gray); }
.lf__alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r);
  background: #FDE8E8; color: #8E1515; font-size: 14px; line-height: 1.45;
}
.lf__alert .i { margin-top: 1px; }
.lf__alert--big { flex-direction: column; padding: 16px; border-radius: var(--r-md); }
.lf__alert--big b { display: flex; gap: 10px; align-items: center; font-size: 16px; }
/* блок товара */
.lf__product { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--c-line); border-radius: var(--r-md); }
.lf__product-img { width: 64px; height: 64px; flex: none; border-radius: var(--r); background: var(--c-soft); display: flex; align-items: center; justify-content: center; color: #8A9099; overflow: hidden; }
.lf__product-img img { width: 100%; height: 100%; object-fit: contain; }
.lf__product-img .i { width: 28px; height: 28px; }
.lf__product-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lf__product-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.lf__product-line { font-size: 13px; color: var(--c-gray); }
/* количество: счётчик −/+ (на телефоне — числовое поле) */
.lf__qty { gap: 6px; }
.lf__qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lf__stepper { display: flex; align-items: center; height: 44px; border: 1.5px solid var(--c-field); border-radius: var(--r); }
.field--error .lf__stepper { border-color: var(--c-red); }
.lf .lf__stepper input { width: 72px; height: 40px; padding: 0; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.lf__stepper input::-webkit-outer-spin-button, .lf__stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lf__step { width: 40px; height: 40px; border: 0; background: none; font: 600 18px var(--font); color: var(--c-ink); cursor: pointer; }
/* свёрнутые подробности и «Прикрепить» */
.lf__more > summary, .lf__attach > summary {
  display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--c-red-dark);
}
.lf__more > summary::-webkit-details-marker, .lf__attach > summary::-webkit-details-marker { display: none; }
.lf__more[open] > summary, .lf__attach[open] > summary { margin-bottom: 14px; }
.lf__more-in { display: flex; flex-direction: column; gap: 16px; }
/* файлы */
.lf__zone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px;
  border: 1.5px dashed #9AA0A8; border-radius: var(--r-md); background: var(--c-soft); text-align: center;
  font-size: 15px; font-weight: 400; cursor: pointer;
}
.lf__zone:focus-within { outline: 2px solid var(--c-ink); outline-offset: 2px; }
.lf__zone--over { border-color: var(--c-red); background: #FFF5F5; }
.lf__link { color: var(--c-red-dark); font-weight: 600; text-decoration: underline; }
.lf[data-js] .lf__zone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.lf__zone input[type=file] { font: 400 14px var(--font); }
.lf__filelist { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lf__file { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1.5px solid var(--c-line); border-radius: var(--r); font-weight: 400; }
.lf__file--error { border-color: var(--c-red); background: #FFF5F5; }
.lf__file-row { display: flex; align-items: center; gap: 10px; }
.lf__file-ext { width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--c-ink); color: var(--c-white); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.lf__file--error .lf__file-ext { background: #FDE8E8; color: var(--c-red-dark); }
.lf__file-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lf__file-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink); }
.lf__file-size { font-size: 13px; color: var(--c-gray); }
.lf__file-del { width: 36px; height: 36px; flex: none; border: 0; border-radius: 8px; background: none; display: flex; align-items: center; justify-content: center; color: var(--c-ink); cursor: pointer; }
.lf__file-err { font-size: 13px; line-height: 1.4; color: var(--c-red-dark); }
/* согласие */
.lf__consent { display: flex; flex-direction: column; gap: 6px; }
.lf__consent label { display: flex; align-items: flex-start; gap: 10px; min-height: 24px; font-size: 13px; line-height: 1.45; color: #3A3F47; cursor: pointer; }
.lf__consent input[type=checkbox] { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--c-red); }
.lf__consent a { color: var(--c-red-dark); text-decoration: underline; }
.lf .field__error { display: block; line-height: 17px; }
.lf__consent--error { padding: 10px 12px; border: 1.5px solid var(--c-red); border-radius: var(--r); }
.lf__consent .field__error, .lf__ctext { padding-left: 28px; font-size: 13px; color: var(--c-red-dark); }
.lf__ctext { color: var(--c-gray); line-height: 1.45; }
.lf__ctext summary { cursor: pointer; text-decoration: underline; width: max-content; }
.lf__ctext p { margin-top: 6px; }
/* подсказка под кнопкой: первое согласие обязательно, ссылка на политику (OR0424) */
.lf__cnote { text-align: center; }
.lf__cnote a { color: inherit; text-decoration: underline; }
.lf[aria-busy=true] .lf__cnote { display: none; }
.lead__trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* отправка: кнопка неактивна, индикатор (A-Forms 5) */
.lf__submit { position: relative; }
.lf__sending, .lf__spin, .lf__wait { display: none; }
.lf[aria-busy=true] .lf__submit { background: var(--c-line); color: var(--c-gray-dark); pointer-events: none; }
.lf[aria-busy=true] .lf__send, .lf[aria-busy=true] .lf__note { display: none; }
.lf[aria-busy=true] .lf__sending, .lf[aria-busy=true] .lf__wait { display: inline; }
.lf[aria-busy=true] .lf__spin {
  display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: lf-spin .8s linear infinite;
}
@keyframes lf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .lf[aria-busy=true] .lf__spin { animation: none; } }
/* итог и «нет связи» */
.lf__ok { width: 72px; height: 72px; border-radius: 50%; background: #E8F4EE; color: #1E7A46; display: flex; align-items: center; justify-content: center; }
.lf__ok .i { width: 32px; height: 32px; }
.lf__next { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--c-soft); }
.lf__next ol { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.lf__next li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.45; counter-increment: step; }
.lf__next li::before {
  content: counter(step); width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--c-ink); color: var(--c-white);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.lf__summary { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r); font-size: 14px; line-height: 1.5; }
.lf__contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.lf__contacts .btn { padding: 0 12px; font-size: 15px; }
.lf__contacts { grid-template-columns: minmax(0, 1fr); }
.lf__contacts .chat-pills { justify-content: flex-start; }
.lf .btn--block { height: 52px; }
.lf__close { height: 48px; }
/* встроенный блок (A-Search, A-Product) */
/* форма карточки товара (A-Product, A-System 5): на ≥ 1024 вместо кнопок
   .prod-lead, на телефоне и планшете — кнопки, они открывают шторку */
.prod-form { margin-bottom: var(--s-4); padding: var(--s-5); border-radius: var(--r-xl); background: var(--c-soft); }
.prod-form ~ .prod-lead { display: none; }
.lf--card { gap: 14px; }
.lf--card .lf__form, .lf--card .lf__fields { gap: 12px; }
.lf--card .lf__title { font-size: 17px; line-height: 1.3; padding-right: 0; }
.lf--card .lf__sub { font-size: 14px; line-height: 1.45; color: var(--c-gray); margin-top: -6px; }
.lf--embed { max-width: 640px; padding: 28px; border: 1px solid var(--c-line); border-radius: var(--r-xl); background: var(--c-white); }

/* окно (≥ 768) и шторка (< 768) заявки — один каркас .ldlg */
.ldlg { position: fixed; inset: 0; z-index: 120; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; overscroll-behavior: contain; }
.ldlg__shade { position: fixed; inset: 0; background: rgba(20, 22, 26, 0.55); }
.ldlg__panel {
  position: relative; width: 560px; max-width: 100%; margin: auto 0; padding: 32px; border-radius: var(--r-xl);
  background: var(--c-white); box-shadow: 0 24px 60px rgba(20, 22, 26, 0.25);
}
.ldlg__close {
  position: absolute; top: 16px; right: 16px; z-index: 1; width: 40px; height: 40px; border: 0; border-radius: var(--r);
  background: var(--c-soft); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--c-ink);
}
.ldlg__close:disabled { opacity: .5; cursor: default; }
.ldlg__grip { display: none; }
.ldlg__load { min-height: 200px; display: flex; align-items: center; justify-content: center; color: var(--c-gray); }
html.lead-open { overflow: hidden; }

@media (max-width: 1023px) {
  .prod-form { display: none; }
  .prod-form ~ .prod-lead { display: block; }
}

@media (max-width: 767px) {
  /* к низу — отступом сверху, а не flex-end: высокая шторка (ошибки,
     клавиатура) начинается у верха и прокручивается, а не уходит за край */
  .ldlg { align-items: flex-start; padding: 56px 0 0; }
  .ldlg__panel { width: 100%; margin: auto 0 0; padding: 26px 16px 24px; border-radius: 20px 20px 0 0; }
  .ldlg__grip { display: block; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #C9CDD3; }
  .ldlg__close { top: 22px; right: 16px; }
  .lf__title { font-size: 22px; }
  .lf--page .lf__title { font-size: 28px; line-height: 31px; }
  .lf__row { grid-template-columns: minmax(0, 1fr); }
  .lf__product { padding: 10px; background: var(--c-soft); border: 0; }
  .lf__product-img { width: 56px; height: 56px; background: var(--c-white); }
  .lf__qty-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .lf__step { display: none; }
  .lf__stepper { height: 48px; }
  .lf .lf__stepper input { width: 100%; height: 44px; padding: 0 14px; text-align: left; font-weight: 400; }
  .lf--embed { padding: 20px 16px; }
}
