/* Общий компонент поиска и фильтров. Разделы задают только размещение панели. */
:root {
 --crm-control-height: 34px;
 --crm-control-border: #d5dee7;
 --crm-control-text: #526b82;
 --crm-control-radius: 6px;
}
.crm-search-control {
 display: flex;
 align-items: stretch;
 min-width: 0;
}
.crm-search-control > .form-control,
.crm-search-control > .input-group-addon,
.crm-search-control > .input-group-btn > .btn,
.btn.crm-filter-toggle {
 height: var(--crm-control-height) !important;
 min-height: var(--crm-control-height);
 border: 1px solid var(--crm-control-border) !important;
 background: #fff !important;
 box-shadow: none !important;
}
.crm-search-control > .form-control {
 flex: 1 1 0;
 width: 1%;
 min-width: 0;
 margin: 0;
 padding: 6px 10px !important;
 color: #555;
 border-radius: 0 !important;
 z-index: auto;
}
/* Служебное скрытое поле после поиска не меняет скругление видимого края. */
.crm-search-control > .form-control:not(:has(~ :not(input[type="hidden"]))),
.crm-search-control:has(> .input-group-btn > .btn.hidden):not(:has(> .input-group-btn > .btn:not(.hidden))) > .form-control {
 border-radius: 0 var(--crm-control-radius) var(--crm-control-radius) 0 !important;
}
.crm-search-control > .form-control:focus {
 border-color: var(--crm-control-border) !important;
 outline: 0;
}
.crm-search-control > .input-group-addon {
 display: flex;
 align-items: center;
 justify-content: center;
 flex: 0 0 36px;
 width: 36px;
 margin-right: -1px;
 padding: 0 !important;
 color: var(--main-color) !important;
 border-radius: var(--crm-control-radius) 0 0 var(--crm-control-radius) !important;
 position: relative;
 z-index: 4;
}
.crm-search-control > .input-group-btn {
 display: flex;
 flex: 0 0 auto;
 width: auto !important;
 font-size: 14px;
}
.crm-search-control > .input-group-btn > .btn,
.btn.crm-filter-toggle {
 display: inline-flex;
 align-items: center;
 justify-content: center;
 padding: 6px 12px !important;
 min-width: 40px;
 width: auto !important;
 color: var(--crm-control-text) !important;
 border-radius: var(--crm-control-radius) !important;
}
.crm-search-control > .input-group-btn > .btn {
 margin: 0 0 0 -1px;
 border-radius: 0 !important;
 position: relative;
 z-index: 4;
}
.crm-search-control > .input-group-btn > .btn:last-child {
 border-radius: 0 var(--crm-control-radius) var(--crm-control-radius) 0 !important;
}
.crm-search-control > .input-group-btn > .btn:not(.disabled):not([disabled]):is(:hover,:focus,:active),
.btn.crm-filter-toggle:not(.disabled):not([disabled]):is(:hover,:focus,:active) {
 background: #e6e6e6 !important;
 border-color: #adadad !important;
 color: var(--crm-control-text) !important;
}
.btn.crm-filter-toggle > .fa-filter,
.crm-search-control .fa-search { color: var(--main-color) !important; font-size: 14px; margin: 0; }
.btn.crm-filter-toggle .filter-toggle-label { display: inline-block; margin: 0; vertical-align: middle; }
.btn.crm-filter-toggle :is(.filter-active-count,.catalog-filter-count,.badge) {
 background: var(--main-color);
 color: #fff;
 border-radius: 9px;
 font-size: 11px;
 line-height: 18px;
 min-width: 18px;
 height: 18px;
 padding: 0 5px;
 margin: 0;
}
@media (max-width: 767px) {
 :root { --crm-control-height: 36px; }
 .btn.crm-filter-toggle .filter-toggle-label { display: none !important; }
}

/* Одинаковая высота строк справочников: иконка не увеличивает строку группы. */
:is(#select2-tags-results, #select2-crpt_group_filter-results) .select2-results__option {
 padding: 6px 12px;
 line-height: 20px;
 min-height: 32px;
}
#select2-crpt_group_filter-results .crpt-group-option { display: flex; min-height: 20px; line-height: 20px; }
#select2-crpt_group_filter-results .crpt-group-option__icon { width: 18px; height: 18px; }
/* У каждого выбранного значения уже есть удаление; второй крестик не нужен. */
:is(#tags, #crpt_group_filter) + .select2-container .select2-selection__clear { display: none !important; }

/* Пустая кнопка очистки не оставляет зазор и не лишает поле скругления. */
.crm-search-control > .input-group-btn:has(> .hidden):not(:has(> .btn:not(.hidden))) { display: none; }
.crm-search-control > .form-control:first-child { border-top-left-radius: var(--crm-control-radius) !important; border-bottom-left-radius: var(--crm-control-radius) !important; }
.crm-search-control > .input-group-btn > .btn.hidden { display: none !important; }
/* Общий крестик заменяет встроенный браузерный, чтобы очистка не дублировалась. */
.crm-search-control > input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
/* Мобильные фильтры привязаны к экрану; отступы настольных панелей здесь не действуют. */
@media (max-width: 767px) {
 .contragent-filters-popover {
  position: fixed !important;
  top: 60px !important;
  right: 10px !important;
  left: 10px !important;
  width: auto !important;
  max-width: none !important;
  max-height: calc(100vh - 80px) !important;
  max-height: calc(100dvh - 80px) !important;
  overflow-y: auto;
  overscroll-behavior: contain;
 }
}
/* Соседние с поиском действия используют ту же высоту на компьютере и телефоне. */
:is(.contragents-toolbar-actions, .workers-toolbar-actions) .btn,
.tasks-type-tabs > .btn,
:is(.leads-toolbar, .kb-workbar, .cash-journal-toolbar, .warehouse-toolbar, .warehouse-inventory-actionbar) > .btn,
:is(.warehouse-toolbar, .warehouse-inventory-actionbar) > .btn-group > .btn,
.warehouse-toolbar-utilities .btn,
.warehouse-create-actions .btn,
.catalog-category-toggle {
 height: var(--crm-control-height) !important;
 min-height: var(--crm-control-height) !important;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 padding-top: 6px !important;
 padding-bottom: 6px !important;
 margin-top: 0 !important;
 margin-bottom: 0 !important;
}
:is(.contragents-toolbar-row, .workers-toolbar, .leads-toolbar, .kb-workbar, .cash-journal-toolbar, .warehouse-toolbar) {
 align-items: center;
}
.tasks-period-control :is(.form-control, .btn) {
 height: var(--crm-control-height) !important;
 min-height: var(--crm-control-height);
}
/* Контейнер составной кнопки сохраняет общую высоту панели поиска. */
#cashRegisterListSection .kkt-create-actions,
#cashRegisterListSection .kkt-create-actions > .btn {
 height: var(--crm-control-height) !important;
}
/* Поле пароля сжимается внутри окна, оставляя место обеим кнопкам. */
.crm-password-control {
 display: flex;
 width: 100%;
 min-width: 0;
 align-items: stretch;
}
.crm-password-control > .form-control {
 flex: 1 1 0;
 width: 1%;
 min-width: 0;
 height: var(--crm-control-height);
}
.crm-password-control > .input-group-btn {
 display: flex;
 flex: 0 0 auto;
 width: auto;
}
.crm-password-control > .input-group-btn > .btn {
 height: var(--crm-control-height);
 margin-top: 0;
 margin-bottom: 0;
}
