/* F73.W2 — FilterPopover: единая воронка фильтров календаря v2.
   Premium slate/indigo, Lucide-иконка, поповер под кнопкой. */

.fp-host { position: relative; display: inline-flex; }

.fp-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}
.fp-trigger:hover { background: #f8fafc; border-color: #cbd5e1; }
.fp-trigger.is-open { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.fp-trigger.is-active { border-color: #c7d2fe; color: #4338ca; }
.fp-trigger svg { width: 16px; height: 16px; display: block; }

.fp-trigger-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #6366f1;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  border-radius: 999px;
}
.fp-trigger-badge[hidden] { display: none; }

.fp-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  width: 340px;
  max-height: min(72vh, 560px);
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fp-pop-in 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.fp-popover[hidden] { display: none; }

@keyframes fp-pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.fp-section { padding: 8px; border-radius: 8px; }
.fp-section + .fp-section { border-top: 1px solid #f1f5f9; }
.fp-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}

/* Тип-select внутри секции «Типы». */
.fp-section--types select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
}
.fp-section--types select:focus { outline: none; border-color: #6366f1; }

/* Секция уже титулована — гасим дублирующие внутренние заголовки picker/saved. */
.fp-section .rp-panel-header,
.fp-section .sf-header { display: none; }

/* ChipsBar внутри поповера: убрать внешние отступы, переносить chips по словам. */
.fp-section--groups .rg-chips-wrap { margin: 0; padding: 0; }
.fp-section--groups .rg-chips-scroll { flex-wrap: wrap; overflow: visible; }

/* picker/saved растягиваются на ширину секции (были рассчитаны на 240px sidebar). */
.fp-section .rp-panel,
.fp-section .sf-panel { width: 100%; }

/* F73.W8.fix — ограничить высоту списка ресурсов: длинный scope не должен
   выталкивать «Поля фильтра» (Ответственный/Контакт) за нижнюю границу поповера.
   Канон Bitrix/Linear: scope-список со собственным скроллом. Scoped только когда
   picker внутри воронки — на sidebar-использование не влияет.
   `.rp-panel` flex-column: header + поиск + строки; max-height + overflow ограничивает
   ВСЮ панель (поиск скроллится со списком — Bitrix-канон, приемлемо при 7+ ресурсах). */
.fp-section--resources .rp-panel {
  max-height: 240px;
  overflow-y: auto;
}

/* F73.W11 — toggle «Показывать отменённые» в секции «Отображение». Перенос бывшей
   кнопки «Отменённые» из сегмента режимов тулбара. Premium: чекбокс + подпись, без эмодзи. */
.fp-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text, #1e293b);
  padding: 2px 0;
}
.fp-toggle-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-primary, #4f46e5);
  cursor: pointer;
}
.fp-toggle-label { user-select: none; }

@media (max-width: 768px) {
  .fp-popover {
    width: calc(100vw - 24px);
    left: auto;
    right: 0;
  }
}
