/* Подбор контейнера с доставкой (модуль ctfinder).
   Значения — из дизайн-системы Container Trade (те же, что в теме сайта). */
.ctf {
  --ctf-brand: #31a6dd;
  --ctf-brand-hover: #1f8fc5;
  --ctf-brand-soft: #eaf2ff;
  --ctf-link: #1f6feb;
  --ctf-ink: #10161f;
  --ctf-muted: #5b6675;
  --ctf-subtle: #909aa8;
  --ctf-line: #dde3ec;
  --ctf-field: #f2f5fa;
  --ctf-field-hover: #e4e7eb;
  --ctf-tag: #f6f6f6;
  --ctf-success: #00c056;
  --ctf-note-bg: #fff7df;
  --ctf-note-ink: #6b5300;
  --ctf-shadow-card: 0 8px 24px rgba(0, 59, 150, .12);
  --ctf-shadow-pop: 0 8px 24px rgba(16, 22, 31, .16);

  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 40px;
  border-radius: 28px;
  background: rgba(255, 255, 255, .94);
  color: var(--ctf-ink);
  scroll-margin-top: 92px;
}
.ctf *, .ctf *::before, .ctf *::after { box-sizing: border-box; }
.ctf [hidden] { display: none !important; }
.ctf button { font-family: inherit; }

/* ---- Заголовок ---- */
.ctf__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; }
.ctf__intro { max-width: 760px; }
.ctf__title { margin: 0; }
.ctf__lead { margin: 12px 0 0; font-size: 16px; line-height: 20px; color: var(--ctf-muted); }
.ctf__stock { margin: 0; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-muted); white-space: nowrap; }

/* ---- Панель поиска ---- */
.ctf__bar { display: flex; align-items: flex-end; gap: 16px; }
.ctf__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.ctf__field--city { flex: 1 1 260px; }
.ctf__field--cond { flex: 0 0 180px; }
.ctf__label { font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-muted); }

.ctf__input {
  height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 8px;
  background: var(--ctf-field); border: 1px solid transparent; border-radius: 8px;
  transition: background-color .2s, border-color .2s;
}
.ctf__input:hover { background: var(--ctf-field-hover); }
.ctf__input:focus-within { border-color: var(--ctf-brand); background: #fff; }
.ctf__input input {
  flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 16px; line-height: 20px; font-weight: 400; color: var(--ctf-ink);
}
.ctf__input input::placeholder { color: var(--ctf-subtle); }
.ctf__pin { flex: none; color: var(--ctf-brand); }

.ctf__seg { height: 48px; padding: 4px; display: flex; gap: 4px; background: var(--ctf-field); border-radius: 8px; }
.ctf__seg-btn {
  flex: none; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  font-size: 14px; line-height: 18px; font-weight: 500; color: var(--ctf-ink); white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.ctf__seg-btn:hover { background: var(--ctf-field-hover); }
.ctf__seg-btn--muted { color: var(--ctf-muted); }
.ctf__seg-btn.is-active { background: var(--ctf-brand); color: #fff; }

.ctf__select { position: relative; display: block; }
.ctf__select select {
  width: 100%; height: 48px; padding: 0 40px 0 16px; border: 1px solid transparent; border-radius: 8px;
  background: var(--ctf-field); appearance: none; -webkit-appearance: none; cursor: pointer;
  font-family: inherit; font-size: 14px; line-height: 18px; font-weight: 400; color: var(--ctf-ink);
}
.ctf__select select:focus { outline: 0; border-color: var(--ctf-brand); background: #fff; }
.ctf__select svg { position: absolute; right: 14px; top: 16px; color: var(--ctf-muted); pointer-events: none; }

.ctf__qty { height: 48px; padding: 4px; display: flex; align-items: center; gap: 4px; background: var(--ctf-field); border-radius: 8px; }
.ctf__qty-btn {
  width: 40px; height: 40px; border: 0; border-radius: 6px; background: #fff; cursor: pointer;
  font-size: 18px; line-height: 18px; font-weight: 500; color: var(--ctf-ink);
}
.ctf__qty-btn:disabled { color: var(--ctf-subtle); cursor: default; }
.ctf__qty input {
  width: 40px; padding: 0; border: 0; background: transparent; text-align: center; -moz-appearance: textfield;
  font-family: inherit; font-size: 16px; line-height: 20px; font-weight: 700; color: var(--ctf-ink);
}
.ctf__qty input::-webkit-outer-spin-button, .ctf__qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ctf__qty input:focus { outline: 0; }

/* ---- «Другой тип» ---- */
.ctf__other { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px solid var(--ctf-line); border-radius: 16px; }
.ctf__other-ico { flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--ctf-brand-soft); color: var(--ctf-brand); }
.ctf__other-title { margin: 0 0 4px; font-size: 18px; line-height: 22px; font-weight: 800; }
.ctf__other p { margin: 0; font-size: 14px; line-height: 18px; color: var(--ctf-muted); }
.ctf__other-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ---- Результаты и карта ---- */
.ctf__body { display: flex; gap: 24px; height: 680px; }
.ctf__side { width: 420px; flex: none; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.ctf__count { margin: 0; font-size: 14px; line-height: 18px; color: var(--ctf-muted); }
.ctf__list { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 2px 6px 2px 2px; margin: -2px -6px -2px -2px; scrollbar-width: thin; }

.ctf__map { position: relative; flex: 1 1 auto; min-width: 0; border-radius: 16px; overflow: hidden; background: var(--ctf-field); }
.ctf__canvas { position: absolute; inset: 0; }
.ctf__map-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; font-size: 14px; line-height: 18px; color: var(--ctf-muted); }
.ctf__legend {
  position: absolute; top: 16px; left: 16px; padding: 8px 12px; display: flex; gap: 16px;
  background: #fff; border-radius: 8px; box-shadow: var(--ctf-shadow-pop);
  font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-muted);
}
.ctf__legend span { display: flex; align-items: center; gap: 6px; }
.ctf__dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ctf__dot--wh { background: var(--ctf-muted); }
.ctf__dot--sel { background: var(--ctf-ink); }
.ctf__dot--dest { background: var(--ctf-brand); }
.ctf__zoom { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; background: #fff; border-radius: 8px; box-shadow: var(--ctf-shadow-pop); overflow: hidden; }
.ctf__zoom button { width: 40px; height: 40px; border: 0; background: #fff; cursor: pointer; font-size: 20px; line-height: 20px; font-weight: 500; color: var(--ctf-ink); }
.ctf__zoom button + button { border-top: 1px solid var(--ctf-line); }
.ctf__zoom button:hover { background: var(--ctf-field); }
.ctf__loading {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255, 255, 255, .72); font-size: 14px; line-height: 18px; font-weight: 500;
}
.ctf__spinner { width: 18px; height: 18px; border: 2px solid var(--ctf-line); border-top-color: var(--ctf-brand); border-radius: 50%; animation: ctf-spin .8s linear infinite; }
@keyframes ctf-spin { to { transform: rotate(360deg); } }

/* ---- Карточка варианта ---- */
.ctf-card {
  flex: none; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: left;
  background: #fff; border: 1px solid var(--ctf-line); border-radius: 16px; cursor: pointer;
  transition: box-shadow .25s, border-color .2s; outline: 0;
}
.ctf-card:hover { box-shadow: var(--ctf-shadow-card); }
.ctf-card:focus-visible { border-color: var(--ctf-ink); }
.ctf-card.is-active { border-color: var(--ctf-brand); box-shadow: inset 0 0 0 1px var(--ctf-brand); }
.ctf-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ctf-card__city { font-size: 18px; line-height: 22px; font-weight: 800; }
.ctf-card__badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ctf-card__tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ctf-card__partial { font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-note-ink); }
.ctf-card__foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 8px; border-top: 1px solid var(--ctf-line); }
.ctf-card__total { font-size: 20px; line-height: 25px; font-weight: 700; white-space: nowrap; }
.ctf-card__meta { font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-muted); text-align: right; }
.ctf-card__more { align-self: flex-start; padding: 0; border: 0; background: none; cursor: pointer; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-link); }
.ctf-card__more:hover { color: var(--ctf-ink); }
.ctf-card__parts { display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 18px; }
.ctf-card__part { display: flex; justify-content: space-between; gap: 8px; }
.ctf-card__part span:last-child { color: var(--ctf-muted); white-space: nowrap; }
.ctf-card__term { margin-top: 4px; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-muted); }
.ctf-card__term:first-child { margin-top: 0; }
.ctf-term { display: block; white-space: nowrap; }
.ctf-row--terms > b { text-align: right; }
.ctf-card__debug { padding: 6px 8px; border-radius: 6px; background: var(--ctf-note-bg); color: var(--ctf-note-ink); font-size: 12px; line-height: 15px; }
.ctf-card__actions { display: none; gap: 8px; }

.ctf-alts { display: flex; flex-direction: column; gap: 6px; }
.ctf-alt {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px;
  background: var(--ctf-field); cursor: pointer; text-align: left; font-size: 14px; line-height: 18px; color: var(--ctf-ink);
}
.ctf-alt:hover { background: var(--ctf-field-hover); }
.ctf-alt.is-active { border-color: var(--ctf-brand); background: #fff; }
.ctf-alt__total { margin-left: auto; font-weight: 700; white-space: nowrap; }
.ctf-alt__days { color: var(--ctf-muted); font-size: 12px; white-space: nowrap; }

.ctf-badge { padding: 2px 8px; border-radius: 4px; color: #fff; font-size: 12px; line-height: 15px; font-weight: 500; white-space: nowrap; }
.ctf-badge--cheap { background: var(--ctf-success); }
.ctf-badge--fast { background: var(--ctf-brand); }
.ctf-tag { padding: 3px 8px; border-radius: 6px; background: var(--ctf-tag); font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ctf-muted); white-space: nowrap; }
.ctf-cond { padding: 2px 6px; border-radius: 4px; color: #fff; font-size: 12px; line-height: 15px; font-weight: 500; white-space: nowrap; }
.ctf-cond--new { background: #00c056; }
.ctf-cond--1 { background: #8ac000; }
.ctf-cond--2 { background: #bac000; }
.ctf-cond--3 { background: #e8b900; }
.ctf-cond--4 { background: #e87800; }
.ctf-cond--5 { background: #c05d00; }

.ctf-rows { display: flex; flex-direction: column; gap: 4px; }
.ctf-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 18px; }
.ctf-row > span:first-child { color: var(--ctf-muted); }
.ctf-row > b { font-weight: 500; white-space: nowrap; }

.ctf-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--ctf-note-bg); color: var(--ctf-note-ink); font-size: 12px; line-height: 15px; }
.ctf-empty { padding: 20px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--ctf-line); border-radius: 16px; }
.ctf-empty p { margin: 0; font-size: 14px; line-height: 18px; color: var(--ctf-muted); }
.ctf-empty .ctf__btn { width: 100%; }

.ctf__more-btn {
  flex: none; height: 44px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--ctf-muted); font-size: 14px; line-height: 18px; font-weight: 500; color: var(--ctf-muted);
}
.ctf__more-btn:hover { background: var(--ctf-field); color: var(--ctf-ink); }

/* ---- Итог на карте ---- */
.ctf__sum {
  position: absolute; left: 24px; bottom: 40px; z-index: 3; width: 380px; max-height: calc(100% - 96px); overflow: auto;
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  background: #fff; border-radius: 16px; box-shadow: var(--ctf-shadow-pop);
}
.ctf-sum__title { font-size: 18px; line-height: 22px; font-weight: 800; }
.ctf-sum__sub { margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; line-height: 18px; color: var(--ctf-muted); }
.ctf-sum__rows { display: flex; flex-direction: column; gap: 6px; }
.ctf-sum__total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; border-top: 1px solid var(--ctf-line); }
.ctf-sum__total span { font-size: 16px; line-height: 20px; font-weight: 500; }
.ctf-sum__total b { font-size: 26px; line-height: 30px; font-weight: 800; white-space: nowrap; }
.ctf-sum__actions { display: flex; gap: 8px; }

.ctf__btn {
  height: 44px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 8px; background: var(--ctf-brand); cursor: pointer; text-decoration: none; white-space: nowrap;
  font-size: 16px; line-height: 20px; font-weight: 500; color: #fff; transition: background-color .2s;
}
.ctf__btn:hover { background: var(--ctf-brand-hover); color: #fff; }
.ctf__btn:disabled { opacity: .6; cursor: default; }
.ctf__btn--grow { flex: 1 1 auto; }
.ctf__btn--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--ctf-muted); color: var(--ctf-muted); font-size: 14px; line-height: 18px; padding: 0 16px; }
.ctf__btn--outline:hover { background: var(--ctf-field); color: var(--ctf-ink); }

/* ---- Подсказка над маркером склада ---- */
.ctf-tip { font-family: inherit; color: #10161f; min-width: 180px; }
.ctf-tip b { display: block; margin-bottom: 4px; font-size: 14px; line-height: 18px; }
.ctf-tip__row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; line-height: 16px; color: #5b6675; }
.ctf-tip__row span:last-child { white-space: nowrap; }

.ctf__bottom { display: none; }

/* ---- Узкий десктоп ---- */
@media (max-width: 1279px) {
  .ctf__bar { flex-wrap: wrap; }
  .ctf__field--city { flex-basis: 100%; }
  .ctf__side { width: 360px; }
}

/* ---- Мобильная версия ---- */
@media (max-width: 1023px) {
  .ctf { gap: 16px; padding: 28px 16px; border-radius: 20px; }
  .ctf__head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ctf__lead { margin-top: 8px; font-size: 14px; line-height: 18px; }
  .ctf__stock { white-space: normal; }

  .ctf__bar { gap: 12px; }
  .ctf__field--size { flex-basis: 100%; }
  .ctf__seg { height: auto; padding: 0 16px 0 0; margin-right: -16px; background: none; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .ctf__seg::-webkit-scrollbar { display: none; }
  .ctf__seg-btn { height: 40px; border-radius: 8px; background: var(--ctf-field); }
  .ctf__field--cond { flex: 1 1 auto; }

  .ctf__other { flex-direction: column; align-items: flex-start; }
  .ctf__other-actions { margin-left: 0; width: 100%; flex-direction: column; }

  .ctf__body { flex-direction: column; height: auto; gap: 16px; }
  .ctf__map { order: -1; flex: none; height: 300px; border-radius: 12px; }
  .ctf__side { width: 100%; }
  .ctf__list { overflow: visible; margin: 0; padding: 0; }
  .ctf__legend, .ctf__zoom, .ctf__sum { display: none !important; }
  .ctf-card { padding: 14px; }
  .ctf-card.is-active .ctf-card__actions { display: flex; }

  .ctf__bottom {
    position: sticky; bottom: 0; z-index: 5; margin: 0 -16px -28px; padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
    background: #fff; border-top: 1px solid var(--ctf-line); border-radius: 0 0 20px 20px;
    box-shadow: 0 -8px 24px rgba(16, 22, 31, .12);
  }
  .ctf__bottom[hidden] { display: none !important; }
  .ctf-bottom__info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .ctf-bottom__total { font-size: 20px; line-height: 25px; font-weight: 800; }
  .ctf-bottom__route { font-size: 12px; line-height: 15px; color: var(--ctf-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Кнопка чата сайта — над панелью итога на телефоне */
html.ctf-bar-visible #bwc-widget-action { bottom: 96px !important; transition: bottom .2s; }
