/*
 * «Полное ведение» application modal (static/js/full-service-lead.js).
 * The look repeats the modal of the owner's design docs/tz/glavnaya-design.html;
 * the fields follow docs/tz/landing-tariffs.md («Почта для связи», «Telegram —
 * по желанию»).  Self-contained: works on the landing (no CSS reset) and in the
 * cabinet (Tailwind preflight), so every control sets its own font, border and size.
 * Sizes follow the compact scale of the landing (docs/tz/landing-tariffs.md,
 * «Масштаб главной»): the whole form fits a 1366×768 window without scrolling.
 */

html.fsl-locked,
html.fsl-locked body {
  overflow: hidden;
}

.fsl-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(12px, 3vh, 40px) 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(21, 19, 26, 0.55);
  /* The modal lives under <body>, outside the page wrapper that sets the font
     on the landing; Archivo exists there, the cabinet falls back to system-ui. */
  font-family: Archivo, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-overflow-scrolling: touch;
}

.fsl-backdrop *,
.fsl-backdrop *::before,
.fsl-backdrop *::after {
  box-sizing: border-box;
}

.fsl-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 560px;
  padding: clamp(20px, 3vw, 32px);
  border-radius: 24px;
  background: #ffffff;
  color: #201e1d;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  box-shadow: 0 30px 80px rgba(21, 19, 26, 0.35);
}

.fsl-dialog:focus {
  outline: none;
}

.fsl-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(32, 30, 29, 0.06);
  color: #201e1d;
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.fsl-close:hover {
  background: rgba(32, 30, 29, 0.12);
}

.fsl-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 40px;
}

.fsl-title {
  margin: 0;
  color: #201e1d;
  font-family: inherit;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.fsl-subtitle {
  margin: 0;
  color: rgba(32, 30, 29, 0.64);
  font-size: 14px;
  line-height: 1.45;
}

.fsl-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}

.fsl-form[hidden],
.fsl-head[hidden],
.fsl-success[hidden],
.fsl-error[hidden] {
  display: none;
}

.fsl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.fsl-label {
  display: block;
  margin: 0;
  padding: 0;
  color: #201e1d;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.4;
}

/* «Какие магазины и сколько»: label, three rows and the total, 8px apart.
   A legend is not a flex item, so the gap under it is its own margin. */
.fsl-shops {
  gap: 8px;
}

.fsl-shops .fsl-label {
  margin-bottom: 8px;
}

.fsl-markets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fsl-market {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 6px 5px 12px;
  border-radius: 14px;
  background: rgba(32, 30, 29, 0.04);
}

.fsl-market__name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
}

.fsl-market__logo {
  display: block;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: contain;
}

.fsl-market__label {
  overflow-wrap: anywhere;
}

.fsl-counter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: #ffffff;
}

.fsl-counter__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(32, 30, 29, 0.06);
  color: #ec3013;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.fsl-counter__button:hover:not(:disabled) {
  background: rgba(32, 30, 29, 0.1);
}

.fsl-counter__button:disabled {
  cursor: default;
}

.fsl-counter__input {
  width: 32px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #201e1d;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.fsl-counter__input:focus {
  outline: 2px solid #201e1d;
  outline-offset: 0;
}

.fsl-total {
  margin: 0;
  color: rgba(32, 30, 29, 0.64);
  font-size: 12.5px;
}

.fsl-input {
  display: block;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid rgba(32, 30, 29, 0.16);
  border-radius: 12px;
  background: #ffffff;
  color: #201e1d;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  box-shadow: none;
  appearance: none;
}

.fsl-input::placeholder {
  color: #757575;
}

.fsl-input:focus {
  border-color: #201e1d;
  outline: none;
}

.fsl-input.is-invalid {
  border-color: #ec3013;
}

.fsl-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(236, 48, 19, 0.08);
  color: #b42310;
  font-size: 13.5px;
  line-height: 1.45;
}

/* «Отправить заявку» and the consent line under it, 10px apart. */
.fsl-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: #201e1d;
  color: #fdfcfb;
  font-family: inherit;
  line-height: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.fsl-submit:hover:not(:disabled) {
  background: #000000;
}

.fsl-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.fsl-consent {
  margin: -6px 0 0;
  color: rgba(32, 30, 29, 0.64);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.fsl-consent__link {
  color: inherit;
  text-decoration: none;
}

.fsl-consent__link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fsl-success {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 40px 4px 0;
}

.fsl-success__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
}

.fsl-success__icon svg {
  display: block;
}

.fsl-success__text {
  margin: 0;
  color: rgba(32, 30, 29, 0.65);
  font-size: 14px;
  line-height: 1.5;
}

.fsl-success__close {
  min-height: 42px;
  margin: 0;
  padding: 0 22px;
  border: 2px solid #201e1d;
  border-radius: 999px;
  background: transparent;
  color: #201e1d;
  font-family: inherit;
  line-height: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.fsl-success__close:hover {
  background: #201e1d;
  color: #fdfcfb;
}

.fsl-backdrop :focus-visible {
  outline: 2px solid #201e1d;
  outline-offset: 2px;
}

/* Fields show focus by their own border (counter: a tight ring), not by the
   offset ring of the buttons above. */
.fsl-backdrop .fsl-input:focus-visible {
  outline: none;
}

.fsl-backdrop .fsl-counter__input:focus-visible {
  outline-offset: 0;
}

@media (max-width: 560px) {
  /* 16px keeps iOS from zooming into a focused field. */
  .fsl-input {
    font-size: 16px;
  }

  /* «Яндекс Маркет» and its counter stay on one line at 375px; a finger
     gets slightly bigger −/+ than a mouse. */
  .fsl-market {
    gap: 8px;
    padding-left: 10px;
  }

  .fsl-market__name {
    gap: 8px;
  }

  .fsl-counter__button {
    width: 38px;
    height: 38px;
  }

  .fsl-counter__input {
    width: 28px;
    height: 38px;
  }
}

/* 320px: «Wildberries» keeps one line next to its counter instead of breaking
   inside the word. */
@media (max-width: 360px) {
  .fsl-market__name {
    font-size: 14px;
  }

  .fsl-counter__button {
    width: 34px;
    height: 34px;
  }

  .fsl-counter__input {
    width: 26px;
    height: 34px;
  }
}
