/* ====================================================================
   «Тарифы»: конструктор из модулей, подбор по описанию, итог справа.
   Токены — из ui.css; --pb-color — цвет группы модулей (как у меню).
   ==================================================================== */

.pb {
  --pb-summary-bg: #1a1a1a;
  --pb-summary-line: rgba(255, 255, 255, .1);
  --pb-summary-muted: #a3a3a3;
  --pb-good: #16a34a;
  --pb-ai: #9333ea;
  /* Карточки и сборки переключаются кликом — двойной клик не должен выделять текст. */
  -webkit-user-select: none;
  user-select: none;
}

.pb :is(input, textarea, [contenteditable="true"]) {
  -webkit-user-select: text;
  user-select: text;
}

/* Карточки, тумблеры, сборки и степперы нажимаются — без синей вспышки касания на телефоне
   (фокус с клавиатуры остаётся видимым). */
.pb, .pb * {
  -webkit-tap-highlight-color: transparent;
}

/* Разделы модуля с подсказкой (data-ui-tooltip): наведение и фокус с клавиатуры. */
.pb-module__sections li[data-ui-tooltip] {
  cursor: help;
}
.pb-module__sections li[data-ui-tooltip]:focus-visible {
  outline: 2px solid var(--ui-focus, #005bd3);
  outline-offset: 2px;
}

/* Внизу экрана висит плашка «Ваш тариф» (.pb-mobilebar) — оставляем под неё место. */
@media (max-width: 1180px) {
  .pb {
    padding-bottom: 72px;
  }
}

html.dark-theme .pb {
  --pb-summary-bg: #1c1d20;
  --pb-good: #4ade80;
  --pb-ai: #c084fc;
}

.pb__inner {
  max-width: 1240px;
}

/* :where — без веса: шрифт кнопок наследуется, но классы кнопок (.pb-cta и др.) его переопределяют. */
:where(.pb) button {
  font: inherit;
}

.pb-section-title {
  margin: 0;
  color: var(--ui-text-strong);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* --- Шапка ------------------------------------------------------------- */
.pb-hero {
  padding: 28px 0 22px;
  text-align: center;
}

.pb-hero__title {
  margin: 0;
  color: var(--ui-text-strong);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.pb-hero__lead {
  max-width: 56ch;
  margin: 10px auto 0;
  color: var(--ui-text-subdued);
  font-size: 15px;
  line-height: 1.5;
}

.pb-hero__facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ui-text);
  font-weight: 550;
}

.pb-hero__facts li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pb-hero__facts svg {
  width: 16px;
  height: 16px;
  color: var(--pb-good);
}

.pb-banner {
  background: var(--ui-success-surface);
}

.pb-banner svg {
  color: var(--ui-success-text);
}

/* --- Подбор по описанию ------------------------------------------------ */
.pb-ai {
  position: relative;
  margin: 0 auto 28px;
  padding: 18px;
  border-radius: 16px;
  background:
    linear-gradient(var(--ui-surface), var(--ui-surface)) padding-box,
    linear-gradient(120deg, color-mix(in srgb, var(--pb-ai) 70%, transparent),
      color-mix(in srgb, #0891b2 55%, transparent), color-mix(in srgb, #e11d48 45%, transparent)) border-box;
  border: 1.5px solid transparent;
  box-shadow: 0 10px 30px -18px color-mix(in srgb, var(--pb-ai) 60%, transparent);
}

.pb-ai__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.pb-ai__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pb-ai) 14%, var(--ui-surface));
  color: var(--pb-ai);
}

.pb-ai__icon svg {
  width: 20px;
  height: 20px;
}

.pb-ai__title {
  margin: 0;
  color: var(--ui-text-strong);
  font-size: 16px;
  font-weight: 700;
}

.pb-ai__hint {
  margin: 2px 0 0;
  color: var(--ui-text-subdued);
}

.pb-ai__form {
  position: relative;
}

.pb .pb-ai__input {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 12px 148px 12px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-surface-subdued);
  color: var(--ui-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: none;
  field-sizing: content;
  min-height: 67px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: none !important;
  transition: border-color .2s ease, background-color .2s ease;
}

.pb .pb-ai__input:focus {
  border-color: var(--ui-border-strong) !important;
  outline: none;
  background: var(--ui-surface);
}

.pb .pb-ai__input:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 1px;
}

/* Кнопка внутри поля стоит от нижнего края, без transform: общий ui-btn:hover задаёт свой
   transform (подъём) и раньше сбрасывал центровку — кнопка прыгала. В пустом поле (67px)
   отступ 17px ставит её ровно по центру, а когда поле растёт — она остаётся внизу справа. */
.pb-ai__submit {
  position: absolute;
  right: 10px;
  bottom: 17px;
}

.pb-ai__submit:disabled {
  opacity: .6;
  cursor: progress;
}

.pb-ai__examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pb-chip {
  padding: 5px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--ui-surface);
  color: var(--ui-text-subdued);
  font-size: 12.5px;
  line-height: 18px;
  text-align: left;
  cursor: pointer;
  transition: var(--ui-motion);
}

.pb-chip:hover {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-hover);
  color: var(--ui-text-strong);
  transform: var(--ui-lift);
}

.pb-ai__result {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pb-ai) 9%, var(--ui-surface));
  color: var(--ui-text);
  font-weight: 500;
}

.pb-ai__result.is-error {
  background: var(--ui-critical-surface);
}

.pb-ai__result .ui-loader {
  flex-direction: row;
  gap: 8px;
}

/* --- Готовые сборки ---------------------------------------------------- */
.pb-presets {
  margin-bottom: 28px;
}

.pb-presets__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.pb-preset {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 14px 12px;
  border: 0;
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
  color: var(--ui-text);
  text-align: left;
  cursor: pointer;
  transition: var(--ui-motion);
}

.pb-preset:hover {
  transform: var(--ui-lift-wide);
  box-shadow: var(--ui-shadow-card), 0 8px 20px -12px rgba(0, 0, 0, .25);
}

.pb-preset[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--ui-text-strong);
}

.pb-preset__badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--ui-text-strong);
  color: var(--ui-surface);
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
}

.pb-preset__name {
  color: var(--ui-text-strong);
  font-size: 14px;
  font-weight: 700;
}

.pb-preset__audience {
  flex: 1;
  color: var(--ui-text-subdued);
  font-size: 12.5px;
}

.pb-preset__price {
  margin-top: 6px;
  color: var(--ui-text-subdued);
  font-size: 12.5px;
}

.pb-preset__price strong {
  color: var(--ui-text-strong);
  font-size: 15px;
}

/* --- Конструктор ------------------------------------------------------- */
.pb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 20px;
  scroll-margin-top: 16px;
}

.pb-modules__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 4px;
}

.pb-modules__bundle {
  margin: 0;
  color: var(--ui-text-subdued);
  font-size: 12.5px;
}

.pb-modules__bundle span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  color: var(--pb-good);
  font-weight: 600;
  white-space: nowrap;
}

.pb-modules__addons {
  display: block;
  margin-top: 2px;
  color: var(--ui-text-subdued);
  font-size: 11.5px;
  text-align: right;
}

.pb-modules__bundle span svg {
  width: 12px;
  height: 12px;
  opacity: .75;
}

.pb-prorate__arrow {
  display: inline-flex;
  margin: 0 4px;
  vertical-align: -2px;
}

.pb-prorate__arrow svg {
  width: 14px;
  height: 14px;
}

.pb-group {
  margin-top: 18px;
}

.pb-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--ui-text-subdued);
  font-size: 13px;
  font-weight: 650;
}

.pb-group__title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--pb-color);
}

.pb-module {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
  cursor: pointer;
  transition: box-shadow .2s ease, background-color .2s ease, transform .2s ease;
}

.pb-module + .pb-module {
  margin-top: 8px;
}

.pb-module:hover {
  background: var(--ui-surface-hover);
}

.pb-module.is-required {
  cursor: default;
}

.pb-module.is-required:hover {
  background: var(--ui-surface);
}

.pb-module.is-on {
  background: color-mix(in srgb, var(--pb-color) 5%, var(--ui-surface));
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--pb-color) 55%, transparent), 0 6px 18px -14px var(--pb-color);
}

.pb-module.is-flash {
  animation: pb-flash .9s var(--ui-ease, ease);
}

@keyframes pb-flash {
  0% { transform: scale(.985); box-shadow: 0 0 0 6px color-mix(in srgb, var(--pb-color) 25%, transparent); }
  100% { transform: none; }
}

.pb-module__main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pb-module__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pb-color) 14%, var(--ui-surface));
  color: var(--pb-color);
}

.pb-module__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Логотип площадки (TikTok, Meta) — на нейтральной плитке, чтобы фирменные цвета не спорили с цветом группы. */
.pb-module__icon:has(.crm-brand-icon) {
  background: var(--ui-surface);
  box-shadow: inset 0 0 0 1px var(--ui-border);
  color: var(--ui-text-strong);
}

.pb-module__icon .crm-brand-icon--meta {
  width: 22px;
  height: 22px;
}

.pb-module__text {
  flex: 1;
  min-width: 0;
}

.pb-module__name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ui-text-strong);
  font-size: 14px;
  font-weight: 700;
}

.pb-module__summary {
  margin: 2px 0 0;
  color: var(--ui-text-subdued);
}

.pb-soon {
  padding: 0 6px;
  border-radius: 6px;
  background: var(--ui-info-surface);
  color: var(--ui-info-text);
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
}

/* Дополнение: дешёвый модуль, который получает скидку за набор, но не повышает её. */
.pb-addon {
  padding: 0 6px;
  border-radius: 6px;
  background: var(--ui-neutral-surface);
  color: var(--ui-text-subdued);
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
}

/* Площадки модуля «Реклама»: работает сейчас и скоро. */
.pb-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.pb-platforms li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ui-text);
  font-size: 12.5px;
  font-weight: 600;
}
.pb-platforms li.is-soon { color: var(--ui-text-subdued); }
.pb-platforms__icon { display: inline-flex; width: 16px; height: 16px; }
.pb-platforms__icon svg { width: 16px; height: 16px; }

.pb-module__price--included {
  color: var(--ui-text-subdued);
  font-size: 13px;
  font-weight: 650;
}

.pb-module__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.pb-module__price {
  color: var(--ui-text-strong);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pb-module__per {
  margin-left: 1px;
  color: var(--ui-text-subdued);
  font-size: 12px;
  font-weight: 500;
}

.pb-module__fixed {
  color: var(--ui-text-subdued);
  font-size: 12px;
}

.pb-module__reason {
  display: flex;
  gap: 6px;
  margin: 10px 0 0 48px;
  padding: 7px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--pb-ai) 9%, var(--ui-surface));
  color: var(--ui-text);
  font-size: 12.5px;
}

.pb-module__reason::before {
  content: "ИИ";
  flex-shrink: 0;
  color: var(--pb-ai);
  font-weight: 700;
}

/* Модель выключена — тариф собран по ключевым словам, не называем это ИИ. */
.pb[data-pb-source="keywords"] .pb-module__reason::before {
  content: "Зачем";
}

.pb-module__sections {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 10px 0 0 48px;
  padding: 0;
  list-style: none;
}

.pb-module__sections li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px 0 6px;
  border-radius: 7px;
  background: var(--ui-neutral-surface);
  color: var(--ui-text-subdued);
  font-size: 12px;
  font-weight: 550;
  transition: background-color .2s ease, color .2s ease;
}

.pb-module.is-on .pb-module__sections li {
  background: color-mix(in srgb, var(--pb-color) 11%, transparent);
  color: var(--ui-text);
}

.pb-module__section-icon {
  display: inline-flex;
  color: color-mix(in srgb, var(--pb-color) 70%, var(--ui-text-subdued));
}

.pb-module__section-icon svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.pb-module.is-soon {
  background: var(--ui-surface-subdued);
}

/* Опции видны только у включённого модуля: цена за лимиты появляется вместе с ним. */
.pb-module__options {
  display: none;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: 12px 0 0 48px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-divider);
  cursor: default;
}

.pb-module.is-on .pb-module__options {
  display: flex;
}

.pb-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.pb-option__label {
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
}

.pb-option__note {
  color: var(--ui-text-subdued);
  font-size: 12px;
}

/* --- Степпер ------------------------------------------------------------ */
.pb-stepper {
  display: inline-flex;
  align-items: center;
  height: 32px;
  border-radius: 9px;
  background: var(--ui-neutral-surface);
}

.pb-stepper__btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-text-strong);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: var(--ui-motion);
}

.pb-stepper__btn:hover {
  background: var(--ui-surface-selected);
  transform: scale(1.06);
}

.pb .pb-stepper__input {
  width: 48px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-text-strong);
  font: inherit;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: none !important;
  -moz-appearance: textfield;
}

.pb .pb-stepper__input:focus {
  outline: none;
  border: 0 !important;
}

.pb .pb-stepper__input:focus-visible {
  outline: 2px solid var(--ui-focus);
  border-radius: 6px;
}

.pb-stepper__input::-webkit-outer-spin-button,
.pb-stepper__input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

/* --- Сегменты (тариф по аккаунтам) -------------------------------------- */
.pb-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: var(--ui-neutral-surface);
}

.pb-seg__item {
  position: relative;
  margin: 0;
}

.pb-seg__item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pb-seg__item span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ui-text-subdued);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ui-motion);
}

.pb-seg__item span em {
  color: var(--ui-text-subdued);
  font-style: normal;
  font-weight: 500;
}

.pb-seg__item:hover span {
  color: var(--ui-text-strong);
  transform: scale(1.02);
}

.pb-seg__item input:checked + span {
  background: var(--ui-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  color: var(--ui-text-strong);
}

.pb-seg__item input:focus-visible + span {
  outline: 2px solid var(--ui-focus);
  outline-offset: 1px;
}

/* --- Переключатель модуля ------------------------------------------------ */
.pb-switch {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.pb-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.pb-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--ui-border-strong);
  transition: background-color .18s ease, transform .2s ease;
  pointer-events: none;
}

.pb-switch__track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  transition: transform .2s var(--ui-ease, ease);
}

.pb-switch:hover .pb-switch__track {
  transform: scale(1.06);
}

.pb-switch input:checked + .pb-switch__track {
  background: var(--ui-primary);
}

.pb-switch input:checked + .pb-switch__track::before {
  transform: translateX(14px);
}

html.dark-theme .pb-switch input:checked + .pb-switch__track::before {
  background: #111214;
}

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

/* «Сообщить о запуске» — кнопка: запись уходит сразу, после неё — «Напишем о запуске». */
.pb .pb-notify svg {
  width: 14px;
  height: 14px;
}

.pb .pb-notify.is-done,
.pb .pb-notify.is-done:disabled {
  background: var(--ui-success-surface);
  box-shadow: none;
  color: var(--ui-success-text);
  opacity: 1;
  cursor: default;
  transform: none;
}

/* Подписка есть: что поменяется в модуле относительно оплаченного состава. */
.pb-change {
  padding: 0 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
  white-space: nowrap;
}

.pb-change[hidden] {
  display: none;
}

.pb-change--add {
  background: var(--ui-success-surface);
  color: var(--ui-success-text);
}

.pb-change--remove {
  background: var(--ui-critical-surface);
  color: var(--ui-critical-text);
}

.pb-change--edit {
  background: var(--ui-attention-surface);
  color: var(--ui-attention-text);
}

.pb-module.is-removing {
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--ui-critical) 45%, transparent);
}

/* --- Итог ---------------------------------------------------------------- */
/* Итог всегда во всю свою высоту, без своей прокрутки. Если он выше экрана, plans.js делает
   top отрицательным: при прокрутке страницы блок доезжает до низа экрана и липнет низом. */
.pb-summary {
  position: sticky;
  top: var(--pb-summary-top, 16px);
}

.pb-summary__card {
  padding: 18px;
  border-radius: 16px;
  background: var(--pb-summary-bg);
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .6);
  color: #f5f5f5;
}

html.dark-theme .pb-summary__card {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 18px 40px -24px rgba(0, 0, 0, .8);
}

.pb-summary__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pb-summary__title {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.pb-period {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .08);
}

.pb-period label {
  position: relative;
  margin: 0;
}

.pb-period input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pb-period span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--pb-summary-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ui-motion);
}

.pb-period span em {
  color: #4ade80;
  font-style: normal;
}

.pb-period label:hover span {
  color: #fff;
  transform: scale(1.03);
}

.pb-period input:checked + span {
  background: #fff;
  color: #1a1a1a;
}

.pb-period input:checked + span em {
  color: var(--pb-good);
}

.pb-period input:focus-visible + span {
  outline: 2px solid var(--ui-focus);
  outline-offset: 1px;
}

.pb-seats {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
}

.pb-seats__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pb-seats__label {
  margin: 0;
  color: #fff;
  font-weight: 650;
}

.pb-stepper--dark {
  background: rgba(255, 255, 255, .1);
}

.pb-stepper--dark .pb-stepper__btn,
.pb .pb-stepper--dark .pb-stepper__input {
  color: #fff;
}

.pb-stepper--dark .pb-stepper__btn:hover {
  background: rgba(255, 255, 255, .14);
}

.pb-seats__range {
  --fill: 0%;
  width: 100%;
  height: 4px;
  margin: 14px 0 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff var(--fill), rgba(255, 255, 255, .16) var(--fill));
  cursor: pointer;
  appearance: none;
}

.pb-seats__range::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
  appearance: none;
  transition: transform .15s ease;
}

.pb-seats__range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.pb-seats__range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #fff;
}

.pb-seats__range:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 4px;
}

.pb-seats__note {
  margin: 0;
  color: var(--pb-summary-muted);
  font-size: 12px;
}

.pb-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.pb-lines li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.pb-lines li > span:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: #e5e5e5;
}

.pb-lines li > span:last-child {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pb-lines small {
  color: var(--pb-summary-muted);
  font-size: 11.5px;
}

.pb-lines li.is-good > span {
  color: #4ade80 !important;
}

/* Сумма, которой нет (сотрудники входят в Основу): $0 приглушённо, не как цена. */
.pb-lines li.is-muted > span:last-child {
  color: var(--pb-summary-muted);
  font-weight: 500;
}

.pb-nudge {
  margin-top: 14px;
}

.pb-nudge__bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

.pb-nudge__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #4ade80;
  transition: width .35s var(--ui-ease, ease);
}

.pb-nudge p {
  margin: 6px 0 0;
  color: var(--pb-summary-muted);
  font-size: 12px;
}

.pb-total {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--pb-summary-line);
}

.pb-total__amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.pb-total__amount [data-pb-total] {
  color: #fff;
  font-size: 40px;
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.pb-total__per {
  color: var(--pb-summary-muted);
  font-size: 13px;
}

.pb-total__note {
  margin: 6px 0 0;
  color: var(--pb-summary-muted);
  font-size: 12.5px;
}

.pb-market {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(74, 222, 128, .1);
  color: #bbf7d0;
  font-size: 12.5px;
  line-height: 1.45;
}

.pb-synergies {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.pb-synergies li {
  display: flex;
  gap: 8px;
  color: #e5e5e5;
  font-size: 12.5px;
}

.pb-synergies li.pb-synergies__more::before {
  display: none;
}

.pb-synergies__more button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 0 0 22px;
  border: 0;
  background: none;
  color: var(--pb-summary-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.pb-synergies__more button:hover {
  color: #fff;
}

.pb-synergies__more button::after {
  content: "";
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%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 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .18s ease;
}

.pb-synergies__more button[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.pb-synergies li::before {
  content: "";
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  background: #4ade80;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%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 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.pb-summary__form {
  margin: 16px 0 0;
}

.pb-cta {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--ui-motion);
}

/* На лендинге «Попробовать» — ссылка на регистрацию, выглядит так же, как кнопка. */
a.pb-cta {
  /* На лендинге кнопка идёт сразу за списком итога — без формы с её отступом. */
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.pb-cta:hover {
  background: #f0f0f0;
  transform: var(--ui-lift-wide);
}

.pb-cta:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.pb-summary__fine {
  margin: 10px 0 0;
  color: var(--pb-summary-muted);
  font-size: 12px;
  text-align: center;
}

.pb-summary__fine--note {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
  line-height: 1.45;
}
.pb-summary__fine--note a { color: #fff; font-weight: 650; }

/* Подписка уже есть: как пересчитается оплаченный срок после сохранения. */
.pb-prorate {
  margin: 0 0 10px;
  color: #e5e5e5;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
}
.pb-prorate.is-down { color: #fed7aa; }

.pb-limit-warn {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(248, 113, 113, .14);
  color: #fecaca;
  font-size: 12.5px;
  line-height: 1.45;
}
.pb-prorate.is-up { color: #bbf7d0; }

/* «Оплатить» под главной кнопкой: вторичная, но заметная на тёмном итоге. */
.pb-pay {
  width: 100%;
  height: 40px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: var(--ui-motion);
}

.pb-pay:hover {
  border-color: rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .06);
  transform: var(--ui-lift-wide);
}

.pb-pay:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.pb-cta:disabled {
  background: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .55);
  cursor: default;
  transform: none;
}

/* Стопка монет на кнопках оплаты: монеты внахлёст, кольцо цвета фона кнопки отделяет их друг от друга;
   при наведении стопка немного раскрывается веером. */
.pb-coins {
  display: inline-flex;
  align-items: center;
  margin: 0 3px 0 2px;
  vertical-align: -5px;
}

.pb-coin {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--pb-coin-ring, #fff);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}

.pb-coin + .pb-coin { margin-left: -7px; }
.pb-coin:nth-child(1) { z-index: 3; }
.pb-coin:nth-child(2) { z-index: 2; }
.pb-coin:nth-child(3) { z-index: 1; }
.pb-cta:hover .pb-coins { --pb-coin-ring: #f0f0f0; }
.pb-pay .pb-coins { --pb-coin-ring: var(--pb-summary-bg); }
.pb-cta:disabled .pb-coins { opacity: .6; }

:is(.pb-cta, .pb-pay):hover .pb-coin:nth-child(2) { transform: translateX(2px) rotate(-6deg); }
:is(.pb-cta, .pb-pay):hover .pb-coin:nth-child(3) { transform: translateX(4px) rotate(-12deg); }

@media (prefers-reduced-motion: reduce) {
  .pb-coin { transition: none; }
}

/* Текущая подписка над конструктором. */
.pb-current {
  align-items: center;
  margin-bottom: 20px;
}
.pb-current p { flex: 1 1 auto; }
.pb-current svg { color: #ea580c; }
.pb-current--grace { background: var(--ui-attention-surface); }
.pb-current--expired { background: var(--ui-critical-surface); }

/* --- Плашка итога на узком экране ---------------------------------------- */
.pb-mobilebar {
  display: none;
}

/* --- Вопросы и свой сервер ----------------------------------------------- */
.pb-faq {
  margin-top: 40px;
}

.pb-faq__list {
  margin-top: 8px;
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}

.pb-faq__item {
  padding: 14px 16px;
}

.pb-faq__item + .pb-faq__item {
  border-top: 1px solid var(--ui-divider);
}

.pb-faq__item > summary {
  justify-content: space-between;
  width: 100%;
  color: var(--ui-text-strong);
  font-weight: 650;
}

.pb-faq__item p {
  max-width: 72ch;
  margin: 8px 0 0;
  color: var(--ui-text-subdued);
}

.pb-server {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-card);
}

.pb-server__title {
  margin: 0;
  color: var(--ui-text-strong);
  font-size: 15px;
  font-weight: 700;
}

.pb-server__text {
  max-width: 70ch;
  margin: 4px 0 0;
  color: var(--ui-text-subdued);
}

/* --- Адаптив -------------------------------------------------------------- */
@media (max-width: 1180px) {
  .pb-presets__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pb-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .pb-summary {
    position: static;
  }

  .pb-mobilebar {
    position: fixed;
    right: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--pb-summary-bg);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
    color: #fff;
    text-decoration: none;
    transition: opacity .2s ease, transform .2s ease;
  }

  .pb-mobilebar.is-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
  }

  /* Пока сайдбар стоит колонкой (шире 768px), плашка начинается после него, а не под ним:
     248px — развёрнутое меню, 64px — рейка иконок (crm_sidebar.css: --sb-w-open / --sb-w). */
  @media (min-width: 769px) {
    body:has(.crm-sidebar--pinned) .pb-mobilebar {
      left: calc(248px + 16px);
    }

    body:has(.crm-sidebar:not(.crm-sidebar--pinned)) .pb-mobilebar {
      left: calc(64px + 16px);
    }
  }

  .pb-mobilebar__label {
    color: var(--pb-summary-muted);
    font-size: 12.5px;
  }

  .pb-mobilebar__total {
    font-size: 18px;
    font-variant-numeric: tabular-nums;
  }

  .pb-mobilebar__go {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 9px;
    background: #fff;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 650;
  }
}

@media (max-width: 640px) {
  .pb-presets__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pb .pb-ai__input {
    padding-right: 14px;
  }

  .pb-ai__submit {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .pb-module__sections,
  .pb-module__options,
  .pb-module__reason {
    margin-left: 0;
  }

  .pb-module__main {
    flex-wrap: wrap;
  }

  .pb-module__side {
    flex-direction: row;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    padding-left: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pb-module.is-flash {
    animation: none;
  }
}
