/* ─── SearchableSelect: общий выпадающий список кабинетов ───
   Единый визуальный язык с публичным .custom-select: белая панель,
   мягкая тень, скругления, мятное выбранное состояние и зелёная отметка.
   Нативный <select> остаётся в форме источником истины (no-JS fallback). */

select.adm-select-native {
    display: none !important;
}

.adm-select {
    display: block;
    position: relative;
    width: 100%;
}

.adm-select-btn {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
    border: 1.5px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #172033;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.adm-select-btn:hover {
    border-color: #94a3b8;
}

.adm-select-btn:focus-visible {
    outline: 3px solid rgba(16, 185, 129, .3);
    outline-offset: 2px;
}

.adm-select-btn[aria-invalid="true"] {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

.adm-select-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.adm-select[aria-expanded="true"] .adm-select-btn,
.adm-select-btn[aria-expanded="true"] {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .14);
}

.adm-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-select-chevron {
    flex-shrink: 0;
    color: #64748b;
    transition: transform .15s;
}

.adm-select-btn[aria-expanded="true"] .adm-select-chevron {
    transform: rotate(180deg);
}

.adm-select-panel {
    position: fixed;
    z-index: 900; /* ниже лайтбокса (1000), выше сайдбара/topbar */
    display: flex;
    flex-direction: column;
    max-height: 324px;
    padding: 6px;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .15s, transform .15s;
}

/* Закрытая панель не должна существовать для кликов: display:flex выше
   перекрывает UA-правило [hidden], поэтому без этих стражей невидимая
   панель оставалась кликабельным оверлеем поверх контента под ней. */
.adm-select-panel[hidden] {
    display: none;
}
.adm-select-panel:not(.is-open) {
    pointer-events: none;
}

.adm-select-panel.is-open {
    opacity: 1;
    transform: translateY(0);
}

.adm-select-panel.is-dropup {
    transform: translateY(4px);
}

.adm-select-panel.is-dropup.is-open {
    transform: translateY(0);
}

.adm-select-search {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0 0 6px;
    background: #fff;
}

.adm-select-search input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #172033;
    font: inherit;
    font-size: .82rem;
}

.adm-select-search input:focus {
    border-color: #10b981;
    outline: none;
    background: #fff;
}

.adm-select-list {
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 0;
    list-style: none;
    scrollbar-width: thin;
}

/* Фокус на списке программный; визуальный индикатор — .is-active у пункта. */
.adm-select-list:focus {
    outline: none;
}

.adm-select-option {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #334155;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}

.adm-select-option:hover,
.adm-select-option.is-active {
    background: #f1f5f9;
}

.adm-select-option[aria-selected="true"] {
    background: #ecfdf5;
    color: #047857;
}

.adm-select-option[aria-selected="true"]::after {
    content: "✓";
    flex-shrink: 0;
    color: #059669;
    font-weight: 800;
}

.adm-select-option[hidden] {
    display: none;
}

.adm-select-empty {
    padding: 10px;
    color: #64748b;
    font-size: .78rem;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .adm-select-btn,
    .adm-select-chevron,
    .adm-select-panel {
        transition: none;
    }
}

@media (max-width: 560px) {
    .adm-select-panel {
        max-width: calc(100vw - 16px);
        max-height: min(60vh, 324px);
    }

    .adm-select-search input,
    .adm-select-option {
        min-height: 44px;
    }
}

/* Remote multiple select for large dictionaries. The native select remains the form value source. */
select.arm-select-native {
    display: none !important;
}

.arm-select {
    display: grid;
    min-width: 0;
    gap: 7px;
}

.arm-select-btn {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
    border: 1.5px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #172033;
    font: inherit;
    font-size: .82rem;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

.arm-select-btn:hover,
.arm-select-btn[aria-expanded="true"] {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}

.arm-select-btn:focus-visible,
.arm-select-remove:focus-visible,
.arm-select-more:focus-visible,
.arm-select-option:focus-visible {
    outline: 3px solid rgba(16, 185, 129, .28);
    outline-offset: 2px;
}

.arm-select-chevron {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 1rem;
}

.arm-select-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.arm-select-selected[hidden] {
    display: none;
}

.arm-select-chip {
    display: inline-flex;
    max-width: 100%;
    min-height: 32px;
    align-items: center;
    gap: 5px;
    padding: 5px 6px 5px 9px;
    border: 1px solid #a7f3d0;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: .74rem;
    font-weight: 650;
}

.arm-select-chip > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.arm-select-remove {
    display: inline-grid;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #047857;
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.arm-select-remove:hover {
    background: #d1fae5;
}

.arm-select-panel {
    position: fixed;
    z-index: 910;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    max-height: min(420px, calc(100vh - 16px));
    overflow: hidden;
    gap: 6px;
    padding: 8px;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
}

.arm-select-panel[hidden] {
    display: none;
}

.arm-select-search {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #172033;
    font: inherit;
    font-size: .82rem;
}

.arm-select-search:focus {
    border-color: #10b981;
    outline: none;
    background: #fff;
}

.arm-select-list {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.arm-select-row {
    margin: 0;
    padding: 0;
}

.arm-select-option {
    display: grid;
    width: 100%;
    min-height: 42px;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font: inherit;
    font-size: .79rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.arm-select-option:hover,
.arm-select-option[aria-selected="true"] {
    background: #ecfdf5;
    color: #047857;
}

.arm-select-check {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    color: #fff;
    font-size: .72rem;
}

.arm-select-option[aria-selected="true"] .arm-select-check {
    border-color: #059669;
    background: #059669;
}

.arm-select-status {
    min-height: 20px;
    padding: 2px 6px;
    color: #64748b;
    font-size: .76rem;
    text-align: center;
}

.arm-select-more {
    min-height: 40px;
    padding: 7px 10px;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    background: #ecfdf5;
    color: #047857;
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
}

.arm-select-more[hidden] {
    display: none;
}

@media (max-width: 560px) {
    .arm-select-panel {
        max-width: calc(100vw - 16px);
        max-height: min(70vh, 420px);
    }

    .arm-select-option,
    .arm-select-more {
        min-height: 44px;
    }
}
