/* ════════════════════════════════════════════════════════════
   ADMIN USERS — стили страницы управления пользователями
   ════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. ИНПУТЫ И СЕЛЕКТЫ (фильтры + форма)
   ───────────────────────────────────────────── */
.au-input,
.au-select {
    height: 34px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #f0f6fc;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.au-input:focus,
.au-select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.au-select {
    min-width: 170px;
    padding-right: 28px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #8b949e 50%),
        linear-gradient(135deg, #8b949e 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 14px,
        calc(100% - 9px)  14px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}
.au-select option {
    padding: 8px 12px;
    background-color: #161b2c;
    color: #e6edf3;
}
.au-select option:checked {
    background: linear-gradient(0deg, rgba(139, 92, 246, 0.4), rgba(139, 92, 246, 0.4));
    color: #fff;
    font-weight: 500;
}

/* Дизейбл инпутов и селектов */
.au-input:disabled,
.au-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

/* Заблокированный select роли (на себе) */
#fRole:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.02);
}

/* ─────────────────────────────────────────────
   2. ТАБЛИЦА ПОЛЬЗОВАТЕЛЕЙ
   ───────────────────────────────────────────── */
.au-table-wrap {
    overflow-x: auto;
    max-width: 100%;
}
.au-table {
    width: 100%;
    min-width: 1100px;       /* ← ключ! не даём колонкам схлопнуться */
    border-collapse: collapse;
    font-size: 13px;
}
.au-table thead th {
    padding: 10px 14px;
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    color: #8b949e;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.12);
    white-space: nowrap;
}
.au-table tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #c9d1d9;
    vertical-align: middle;
}
.au-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}
.au-table tbody tr:hover     { background: rgba(139, 92, 246, 0.05); }
.au-table tbody tr.is-self   { background: rgba(56, 139, 253, 0.04); }
.au-table tbody tr.is-inactive { opacity: 0.55; }

.au-empty {
    text-align: center;
    padding: 28px !important;
    color: #8b949e;
    font-style: italic;
}

.au-username {
    color: #f0f6fc;
    font-weight: 500;
}
.au-username small {
    display: block;
    margin-top: 1px;
    color: #8b949e;
    font-size: 11px;
    font-weight: 400;
}

/* ─────────────────────────────────────────────
   3. БЕЙДЖИ РОЛЕЙ И СТАТУСОВ
   ───────────────────────────────────────────── */
.au-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.au-badge-user       { color: #8b949e; border-color: rgba(139, 148, 158, 0.30); background: rgba(139, 148, 158, 0.06); }
.au-badge-admin      { color: #58a6ff; border-color: rgba(56, 139, 253, 0.35);  background: rgba(56, 139, 253, 0.08); }
.au-badge-superadmin {
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.15);
}

.au-status-active,
.au-status-inactive {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
.au-status-active   { color: #3fb950; }
.au-status-inactive { color: #f85149; }

.au-status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   4. БОКОВАЯ ПАНЕЛЬ (BACKDROP + PANEL)
   ───────────────────────────────────────────── */
.au-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(5, 8, 18, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.au-panel-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.au-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 480px;
    max-width: 100vw;
    height: 100vh;
    z-index: 999;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 80%, rgba(56, 139, 253, 0.05) 0%, transparent 50%),
        rgba(16, 20, 35, 0.92);
    backdrop-filter: blur(28px) saturate(1.5);
    -webkit-backdrop-filter: blur(28px) saturate(1.5);
    border-left: 1px solid transparent;
    box-shadow: none;
    visibility: hidden;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease,
                visibility 0s linear 0.3s;
}
.au-panel.is-open {
    right: 0;
    visibility: visible;
    border-left-color: rgba(167, 139, 250, 0.4);
    box-shadow:
        -16px 0 30px -8px rgba(128, 70, 255, 0.30),
        -7px  0 16px -3px rgba(160, 125, 252, 0.38);
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease,
                visibility 0s linear 0s;
}

/* Шапка панели */
.au-panel-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.au-panel-title {
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #e6edf3, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.au-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #8b949e;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.15s;
}
.au-panel-close:hover {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
}
.au-panel-close:focus,
.au-panel-close:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Тело и футер */
.au-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px;
}
.au-panel-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(13, 17, 30, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Режимы отображения формы (создание / редактирование) */
.au-panel.is-mode-create .au-edit-only   { display: none; }
.au-panel.is-mode-edit   .au-create-only { display: none; }

/* ─────────────────────────────────────────────
   5. HERO БЛОК С АВАТАРОМ ВНУТРИ ПАНЕЛИ
   ───────────────────────────────────────────── */
.au-panel-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}
.au-panel-hero-info {
    flex: 1;
    min-width: 0;
}
.au-panel-hero-name {
    margin-bottom: 2px;
    font-size: 15px;
    font-weight: 600;
    color: #f0f6fc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.au-panel-hero-login {
    margin-bottom: 6px;
    font-size: 12px;
    color: #8b949e;
}
.au-panel-hero-role {
    display: inline-block;
}

/* Обёртка вокруг аватара в hero */
.au-panel-hero-avatar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   6. АВАТАР (image + initials fallback)
   ───────────────────────────────────────────── */
.user-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Тонкая внутренняя обводка */
.user-avatar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    pointer-events: none;
}

/* Инициалы (fallback) */
.user-avatar .user-avatar-initials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Картинка поверх инициалов */
.user-avatar .user-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Размеры */
.user-avatar.user-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
}
.user-avatar.user-avatar-hero {
    width: 72px;
    height: 72px;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
    position: relative;
    cursor: pointer;
}

/* Hero-аватар: картинка/инициалы — нижний слой */
.user-avatar-hero > .user-avatar-img,
.user-avatar-hero > .user-avatar-initials {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Оверлей с кнопками управления — верхний слой */
.au-avatar-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 24px;
    padding: 0 4px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.user-avatar-hero:hover .au-avatar-overlay,
.user-avatar-hero:focus-within .au-avatar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Сами кнопки */
.au-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.22);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    line-height: 0;
    transition: background 0.15s, transform 0.15s;
}
.au-avatar-btn:hover {
    background: rgba(139, 92, 246, 0.95);
    transform: scale(1.08);
}
.au-avatar-btn-danger:hover {
    background: rgba(248, 81, 73, 0.95);
}
.au-avatar-btn svg {
    width: 11px;
    height: 11px;
    display: block;
    stroke: #fff;
    fill: none;
    pointer-events: none;
}

/* ─────────────────────────────────────────────
   7. FIELDSET И ФОРМА
   ───────────────────────────────────────────── */
.au-fieldset {
    margin: 0 0 20px;
    padding: 0;
    border: none;
    background: transparent;
}
.au-fieldset legend {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0 0 10px;
    color: #a78bfa;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.au-fieldset.au-danger-zone {
    padding-top: 14px;
    border-top: 1px solid rgba(248, 81, 73, 0.25);
}
.au-fieldset.au-danger-zone legend {
    color: #f85149;
}

.au-field {
    margin-bottom: 10px;
}
.au-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #8b949e;
}
.au-req {
    color: #f85149;
}
.au-field .au-input,
.au-field .au-select {
    width: 100%;
    height: 34px;
}
.au-field textarea.au-input {
    height: auto;
    min-height: 60px;
    resize: vertical;
}
.au-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.au-hint {
    margin-top: 4px;
    font-size: 11px;
    color: #8b949e;
    font-style: italic;
}

/* Валидация */
.au-field.has-error .au-input,
.au-field.has-error .au-select {
    border-color: rgba(248, 81, 73, 0.5);
    box-shadow: 0 0 0 2px rgba(248, 81, 73, 0.1);
}
.au-field-error {
    display: none;
    margin-top: 4px;
    font-size: 11px;
    color: #f85149;
}
.au-field.has-error .au-field-error {
    display: block;
}

/* ─────────────────────────────────────────────
   8. TOGGLE «Аккаунт активен» в панели админа
   (перебивает глобальные стили .toggle-item)
   ───────────────────────────────────────────── */
.au-toggle-field {
    padding: 6px 0;
}
.au-toggle-field .toggle-item {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    width: auto;
    padding: 4px 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
}
.au-toggle-field .toggle-item:hover,
.au-toggle-field .toggle-item:focus,
.au-toggle-field .toggle-item:focus-within,
.au-toggle-field .toggle-item:active {
    background: transparent !important;
    box-shadow: none !important;
}
.au-toggle-field .toggle-item > span {
    color: #c9d1d9;
    font-size: 13px;
    line-height: 1;
    user-select: none;
}

/* Заблокированный toggle активности */
.toggle-switch.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
    /* pointer-events не отключаем — иначе клик не дойдёт до JS и пользователь
       не увидит подсказку «нельзя деактивировать себя» */
}

/* Когда сам свитч заблокирован — приглушаем родительский label/тогглер */
.au-toggle-field:has(.toggle-switch.is-disabled) > label,
.au-toggle-field:has(.toggle-switch.is-disabled) .toggle-item {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ─────────────────────────────────────────────
   9. ОПАСНЫЕ ДЕЙСТВИЯ
   ───────────────────────────────────────────── */
.au-danger-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.au-danger-row:last-child {
    border-bottom: none;
}
.au-danger-title {
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
    color: #e6edf3;
}
.au-danger-desc {
    font-size: 11px;
    color: #8b949e;
}

/* ─────────────────────────────────────────────
   10. CUSTOM SELECT — disabled-состояние
   ───────────────────────────────────────────── */
.cs-wrap.is-disabled,
.cs-wrap:has(select:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none; /* режем все клики */
    user-select: none;
}
.cs-wrap.is-disabled .cs-trigger,
.cs-wrap:has(select:disabled) .cs-trigger {
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(230, 237, 243, 0.5);
}
.cs-wrap.is-disabled .cs-menu,
.cs-wrap:has(select:disabled) .cs-menu {
    display: none !important;
}

/* Крестик закрытия в профиле — без рамки, с красным hover */
#profilePanelClose,
#profilePanelClose:hover,
#profilePanelClose:focus,
#profilePanelClose:focus-visible,
#profilePanelClose:active {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ─────────────────────────────────────────────
   11. ИНДИКАЦИЯ ИЗМЕНЕНИЙ В ПАНЕЛИ
   (кнопка «Сохранить» + бейдж «изменено»)
   ───────────────────────────────────────────── */

/* Базовое состояние кнопки — приглушённая */
#userPanel #btnPanelSave {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transition: opacity 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.15s ease;
}

/* Активное состояние — есть несохранённые изменения */
#userPanel.has-changes #btnPanelSave {
    opacity: 1;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(63, 185, 110, 0.35),
                0 0 14px rgba(63, 185, 110, 0.25);
}
#userPanel.has-changes #btnPanelSave:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(63, 185, 110, 0.55),
                0 0 18px rgba(63, 185, 110, 0.4);
}
#userPanel.has-changes #btnPanelSave:active {
    transform: translateY(0);
}

/* Плашка «изменено» возле заголовка */
#userPanel .changes-badge {
    display: none;
    margin-left: 8px;
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: lowercase;
    vertical-align: middle;
}
#userPanel.has-changes .changes-badge {
    display: inline-block;
}

/* ─────────────────────────────────────────────
   12. CONFIRM-OVERLAY ВНУТРИ #userPanel
   (копия из profile.css под своим селектором,
    чтобы работало независимо от подключения profile.css)
   ───────────────────────────────────────────── */
#userPanel .profile-confirm-overlay {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 23, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
#userPanel .profile-confirm-overlay.is-open {
    display: flex !important;
}

#userPanel .profile-confirm-box {
    width: 90%;
    max-width: 360px;
    padding: 20px 22px;
    background: rgba(22, 27, 44, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
#userPanel .profile-confirm-box h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #e6edf3;
}
#userPanel .profile-confirm-box p {
    margin: 0 0 16px;
    font-size: 12px;
    color: #8b949e;
    line-height: 1.5;
}
#userPanel .profile-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
/* ════════════════════════════════════════════════════════════
   13. ЧЕКБОКСЫ В ТАБЛИЦЕ + МАССОВЫЙ ВЫБОР
   ════════════════════════════════════════════════════════════ */

.au-col-check {
    width: 20px;
    text-align: center;
    padding-left: 15px !important;
    padding-right: 0 !important;
}

.au-table tbody td.au-cell-check {
    width: 42px;
    text-align: center;
    padding-left: 4px;
    padding-right: 0;
}
.au-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    line-height: 0;
}

.au-checkbox input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.au-checkbox-box {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.au-checkbox-box::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 4px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.15s ease-out;
}

.au-checkbox:hover .au-checkbox-box {
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.08);
}

.au-checkbox input:checked + .au-checkbox-box {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border-color: #8b5cf6;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.35);
}
.au-checkbox input:checked + .au-checkbox-box::after {
    transform: rotate(45deg) scale(1);
}

/* Indeterminate (мастер-чекбокс в шапке) */
.au-checkbox input:indeterminate + .au-checkbox-box {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border-color: #8b5cf6;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.35);
}
.au-checkbox input:indeterminate + .au-checkbox-box::after {
    content: "";
    top: 6px;
    left: 3px;
    width: 8px;
    height: 0;
    border: none;
    border-top: 2px solid #fff;
    transform: none;
}

/* Disabled */
.au-checkbox input:disabled + .au-checkbox-box {
    opacity: 0.35;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}
.au-checkbox input:disabled:checked + .au-checkbox-box {
    background: rgba(139, 92, 246, 0.25);
}
.au-checkbox:has(input:disabled) {
    cursor: not-allowed;
}

/* Подсветка выбранной строки */
.au-table tbody tr.is-selected {
    background: rgba(139, 92, 246, 0.08);
}
.au-table tbody tr.is-selected:hover {
    background: rgba(139, 92, 246, 0.12);
}

/* ════════════════════════════════════════════════════════════
   14. КНОПКА «ДЕЙСТВИЯ» + ВЫПАДАЮЩЕЕ МЕНЮ
   ════════════════════════════════════════════════════════════ */

.au-bulk-actions {
    position: relative;
    display: inline-flex;
}

.au-bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.au-bulk-caret {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.au-bulk-actions.is-open .au-bulk-caret {
    transform: rotate(180deg);
}

.au-bulk-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    min-width: 220px;
    padding: 6px;
    background: rgba(22, 27, 44, 0.98);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(139, 92, 246, 0.08);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.au-bulk-menu:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.au-bulk-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.au-bulk-menu-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.au-bulk-menu-item:hover {
    background: rgba(139, 92, 246, 0.12);
    color: #f0f6fc;
}
.au-bulk-menu-item:hover svg {
    opacity: 1;
}

.au-bulk-menu-item-danger {
    color: #f85149;
}
.au-bulk-menu-item-danger:hover {
    background: rgba(248, 81, 73, 0.12);
    color: #ff6b6b;
}

.au-bulk-menu-sep {
    height: 1px;
    margin: 4px 6px;
    background: rgba(255, 255, 255, 0.06);
}

/* ════════════════════════════════════════════════════════════
   15. МОДАЛКИ BULK (превью списка + ошибки)
   ════════════════════════════════════════════════════════════ */

.au-bulk-preview {
    margin-top: 12px;
    max-height: 180px;
    overflow-y: auto;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    font-size: 12px;
    color: #c9d1d9;
}

.au-bulk-preview-item {
    padding: 3px 0;
    color: #c9d1d9;
}
.au-bulk-preview-item small {
    color: #8b949e;
    margin-left: 6px;
}

.au-bulk-preview-more {
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    color: #8b949e;
    font-style: italic;
    font-size: 11px;
}

.au-bulk-result-errors {
    margin-top: 14px;
    padding: 10px 12px;
    background: rgba(248, 81, 73, 0.06);
    border: 1px solid rgba(248, 81, 73, 0.2);
    border-radius: 8px;
}
.au-bulk-result-errors-title {
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #f85149;
}
.au-bulk-result-errors ul {
    margin: 0;
    padding-left: 18px;
    max-height: 160px;
    overflow-y: auto;
}
.au-bulk-result-errors li {
    font-size: 12px;
    color: #c9d1d9;
    padding: 2px 0;
}
.au-bulk-result-errors li b {
    color: #f0f6fc;
    font-weight: 500;
}
.au-bulk-result-errors li small {
    color: #f85149;
    margin-left: 4px;
}
.au-count-selected {
    color: #f0f6fc;
    font-weight: 500;
}
.au-count-selected b {
    color: #f0f6fc;
    font-weight: 700;
}
/* ════════════════════════════════════════════════════════════
   16. ИКОНКИ В МОДАЛКАХ РЕЗУЛЬТАТА / ПОДТВЕРЖДЕНИЯ
   ════════════════════════════════════════════════════════════ */

/* Заголовок модалки — выравниваем иконку и текст по базовой линии */
.custom-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.au-result-icon {
    /* Полностью убираем фон/рамку/круг */
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    font-size: 0; /* срезаем любые эмодзи/текстовые остатки */
    line-height: 1;
}

.au-result-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* ─── Цвета по типу (без фона, только цвет линии) ─── */
.au-result-icon.is-success { color: #22c55e; }   /* зелёный */
.au-result-icon.is-error   { color: #f85149; }   /* красный */
.au-result-icon.is-warning { color: #f59e0b; }   /* оранжевый */
.au-result-icon.is-info    { color: #a78bfa; }   /* фиолетовый */

/* Подкрутим заголовки внутри хедера — чтобы не было лишних маржинов */
.custom-modal-header h3,
.custom-modal-header h4,
.custom-modal-header .custom-modal-title {
    margin: 0;
    line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
    .au-panel {
        width: 100vw;
    }
    .au-grid-2 {
        grid-template-columns: 1fr;
    }
    .au-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .au-filters .au-select {
        min-width: 0;
        width: 100%;
    }
    .au-count {
        margin-left: 0;
        text-align: center;
    }
    /* На мобиле скрываем менее важные колонки */
    .au-table thead th:nth-child(4),
    .au-table tbody td:nth-child(4),
    .au-table thead th:nth-child(5),
    .au-table tbody td:nth-child(5) {
        display: none;
    }
	.au-col-check {
		width: 36px;
	}
	.au-bulk-menu {
		right: auto;
		left: 0;
		min-width: 180px;
	}	
}
/* ═══════════════════════════════════════════════
   КАТЕГОРИИ — chips + модалка выбора
   ═══════════════════════════════════════════════ */

/* ── Контейнер chips в форме ───────────────────── */
.au-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--border, #30363d);
    border-radius: 8px;
    background: var(--bg-secondary, #0d1117);
    min-height: 44px;
}

.au-chips-empty {
    color: var(--text-muted, #8b949e);
    font-size: 13px;
    padding: 2px 4px;
}

/* ── Сам chip ──────────────────────────────────── */
.au-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border, #30363d);
    border-radius: 999px;
    font-size: 12.5px;
    line-height: 1.2;
    color: var(--text, #c9d1d9);
    transition: background 0.15s, border-color 0.15s;
}
.au-chip:hover {
    background: rgba(255, 255, 255, 0.07);
}

.au-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.04);
}

.au-chip-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.au-chip-remove {
    cursor: pointer;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #8b949e);
    background: transparent;
    border: none;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.au-chip-remove:hover {
    color: #fff;
    background: rgba(255, 80, 80, 0.5);
}

/* ── Кнопка "+" добавить категорию ─────────────── */
.au-chip-add {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px dashed var(--border, #30363d);
    background: transparent;
    color: var(--text-muted, #8b949e);
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: all 0.15s;
}
.au-chip-add:hover {
    border-style: solid;
    border-color: var(--accent, #2f81f7);
    color: var(--accent, #2f81f7);
    background: rgba(47, 129, 247, 0.08);
}

/* ── Палитра цветов (10 штук) ──────────────────── */
.au-chip-dot-c0 { background: #2f81f7; } /* синий */
.au-chip-dot-c1 { background: #a371f7; } /* фиолетовый */
.au-chip-dot-c2 { background: #f778ba; } /* розовый */
.au-chip-dot-c3 { background: #ff7b72; } /* красный */
.au-chip-dot-c4 { background: #f0883e; } /* оранжевый */
.au-chip-dot-c5 { background: #d29922; } /* жёлтый */
.au-chip-dot-c6 { background: #3fb950; } /* зелёный */
.au-chip-dot-c7 { background: #2ea3a8; } /* бирюзовый */
.au-chip-dot-c8 { background: #79c0ff; } /* голубой */
.au-chip-dot-c9 { background: #db61a2; } /* малиновый */

/* ═══════════════════════════════════════════════
   МОДАЛКА выбора категорий
   ═══════════════════════════════════════════════ */

/* Уширяем модалку (на узких базовых стилях может быть зажата) */
#categoriesModal .custom-modal {
    max-width: 520px;
    width: 100%;
}

/* Поиск */
.au-catmodal-search {
    position: relative;
    margin-bottom: 10px;
}
.au-catmodal-search input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border, #30363d);
    border-radius: 8px;
    background: var(--bg-secondary, #0d1117);
    color: var(--text, #c9d1d9);
    font-size: 14px;
    box-sizing: border-box;
}
.au-catmodal-search input:focus {
    outline: none;
    border-color: var(--accent, #2f81f7);
}

/* Список ролей в модалке */
.au-catmodal-list {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--border, #30363d);
    border-radius: 8px;
    padding: 4px;
    background: var(--bg-secondary, #0d1117);
}

.au-catmodal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.au-catmodal-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.au-catmodal-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.au-catmodal-check {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border, #30363d);
    border-radius: 4px;
    background: var(--bg, #161b22);
    position: relative;
    transition: all 0.15s;
}
.au-catmodal-item input:checked + .au-catmodal-check {
    background: var(--accent, #2f81f7);
    border-color: var(--accent, #2f81f7);
}
.au-catmodal-item input:checked + .au-catmodal-check::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.au-catmodal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
}

.au-catmodal-name {
    flex: 1;
    font-size: 14px;
    color: var(--text, #c9d1d9);
}

.au-catmodal-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted, #8b949e);
    font-size: 13px;
}
/* ═══════════════════════════════════════════════
   17. КОЛОНКА «АКТИВНОСТЬ» — индикатор онлайн-статуса
   ═══════════════════════════════════════════════ */

.au-cell-activity {
    white-space: nowrap;
}

.user-activity {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.user-activity-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;             /* серый — оффлайн */
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.18);
}

/* Онлайн — зелёная пульсирующая */
.user-activity-dot.is-online {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
    animation: user-activity-pulse 2s ease-in-out infinite;
}

/* Недавно был (< 30 мин) — янтарная */
.user-activity-dot.is-recent {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}

/* Никогда не заходил */
.user-activity-dot.is-never {
    background: transparent;
    border: 1px dashed #6b7280;
    box-shadow: none;
}

.user-activity-text {
    font-size: 12px;
    color: #c9d1d9;
}
.user-activity-text.is-muted {
    color: #8b949e;
    font-style: italic;
}

@keyframes user-activity-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25); }
    50%      { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.10); }
}
/* ═══════════════════════════════════════════════════════════
   СОРТИРОВКА КОЛОНОК (как в admin_directories)
   ═══════════════════════════════════════════════════════════ */
.au-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
    padding-right: 22px;  /* место под стрелку */
    position: relative;
}
.au-table th.sortable:hover {
    color: var(--accent, #a78bfa);
}

/* Стрелка-индикатор */
.au-table th.sortable::after {
    content: '';
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    transform: translateY(2px);
    border: 4px solid transparent;
    border-top-color: currentColor;
    opacity: 0.3;
    transition: opacity 0.15s, transform 0.15s;
}
.au-table th.sortable.sort-asc::after {
    opacity: 1;
    border-top-color: transparent;
    border-bottom-color: var(--accent, #a78bfa);
    transform: translateY(-2px);
}
.au-table th.sortable.sort-desc::after {
    opacity: 1;
    border-top-color: var(--accent, #a78bfa);
    transform: translateY(2px);
}
