.sfpd-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 100050;
    background: var(--sfpd-grad-teal, linear-gradient(90deg, #0d8577, #14f1d9));
    box-shadow: 0 0 12px rgba(20, 241, 217, .65);
    opacity: 0;
    transition: width .22s ease, opacity .22s ease;
    pointer-events: none;
}

.sfpd-progress.is-active {
    opacity: 1;
}

/* =========================================================================
 *  2. КОМАНДНАЯ ПАЛИТРА
 * ========================================================================= */
.sfpd-palette {
    position: fixed;
    inset: 0;
    z-index: 100040;
    display: none;
    padding: 12vh 16px 16px;
    background: rgba(4, 10, 18, .72);
    backdrop-filter: blur(6px);
}

.sfpd-palette.is-open {
    display: block;
    animation: sfpdPaletteFade .18s ease;
}

body.sfpd-palette-open {
    overflow: hidden;
}

@keyframes sfpdPaletteFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sfpd-palette__box {
    max-width: 620px;
    margin: 0 auto;
    border-radius: 22px;
    overflow: hidden;
    background: var(--sfpd-panel, #101e30);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 32px 70px rgba(0, 0, 0, .55);
    animation: sfpdPaletteRise .22s cubic-bezier(.22, .61, .36, 1);
}

@keyframes sfpdPaletteRise {
    from { opacity: 0; transform: translateY(-14px) scale(.985); }
    to { opacity: 1; transform: none; }
}

/* ---- поле ввода ---- */
.sfpd-palette__field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sfpd-palette__field > i {
    font-size: 16px;
    color: var(--sfpd-teal, #14f1d9);
}

.sfpd-palette__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.sfpd-palette__input::placeholder {
    color: rgba(255, 255, 255, .38);
    font-weight: 500;
}

.sfpd-palette__esc {
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, .45);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .10);
    cursor: pointer;
}

/* ---- результаты ---- */
.sfpd-palette__results {
    max-height: 52vh;
    overflow-y: auto;
    padding: 8px;
}

.sfpd-palette__group {
    padding: 12px 12px 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .35);
}

.sfpd-palette__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: background .15s ease;
}

.sfpd-palette__item:hover,
.sfpd-palette__item:focus {
    text-decoration: none;
    color: inherit;
}

.sfpd-palette__item.is-active {
    background: rgba(20, 241, 217, .10);
    box-shadow: inset 0 0 0 1px rgba(20, 241, 217, .28);
}

.sfpd-palette__icon,
.sfpd-palette__avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .55);
}

.sfpd-palette__avatar {
    border-radius: 50%;
    padding: 2px;
}

.sfpd-palette__avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sfpd-palette__avatar.online { background: linear-gradient(135deg, #10b981, #4ade80); }
.sfpd-palette__avatar.inactive { background: linear-gradient(135deg, #7f1d1d, #f87171); }

.sfpd-palette__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.sfpd-palette__title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfpd-palette__title mark {
    padding: 0 2px;
    border-radius: 4px;
    color: #04241f;
    background: rgba(20, 241, 217, .75);
}

.sfpd-palette__sub {
    margin-top: 2px;
    font-size: 12px;
    color: rgba(255, 255, 255, .45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sfpd-palette__nick {
    font-size: 12px;
    color: rgba(255, 255, 255, .50);
    white-space: nowrap;
}

.sfpd-palette__level {
    min-width: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    color: #04241f;
    background: var(--sfpd-grad-teal, linear-gradient(135deg, #0d8577, #14f1d9));
}

.sfpd-palette__enter {
    font-size: 11px;
    color: rgba(255, 255, 255, .25);
}

.sfpd-palette__item.is-active .sfpd-palette__enter {
    color: var(--sfpd-teal, #14f1d9);
}

.sfpd-palette__empty {
    padding: 42px 20px;
    text-align: center;
    color: rgba(255, 255, 255, .42);
    font-size: 14px;
}

.sfpd-palette__empty i {
    display: block;
    font-size: 30px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, .14);
}

/* ---- подвал с подсказками ---- */
.sfpd-palette__footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    font-size: 11px;
    color: rgba(255, 255, 255, .38);
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(255, 255, 255, .02);
}

.sfpd-palette__footer kbd {
    display: inline-block;
    padding: 2px 7px;
    margin-right: 5px;
    border-radius: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, .60);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .10);
}

/* ---- кнопка вызова в шапке ---- */
.sfpd-palette-trigger {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, .50);
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .10);
    cursor: pointer;
    transition: all .2s ease;
}

.sfpd-palette-trigger:hover {
    color: #fff;
    border-color: rgba(20, 241, 217, .40);
}

.sfpd-palette-trigger kbd {
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 10px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .10);
}

/* =========================================================================
 *  3. ЕДИНАЯ ПИЛЮЛЯ (заменяет status-pill / qv-pill / users-stat-chip)
 * ========================================================================= */
.sfpd-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.sfpd-pill i { font-size: 9px; }

.sfpd-pill--online {
    color: #4ade80;
    background: rgba(74, 222, 128, .12);
    border-color: rgba(74, 222, 128, .30);
}

.sfpd-pill--offline {
    color: rgba(255, 255, 255, .62);
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .12);
}

.sfpd-pill--inactive {
    color: #f87171;
    background: rgba(248, 113, 113, .12);
    border-color: rgba(248, 113, 113, .28);
}

.sfpd-pill--ok {
    color: var(--sfpd-teal, #14f1d9);
    background: rgba(20, 241, 217, .10);
    border-color: rgba(20, 241, 217, .28);
}

.sfpd-pill--warn {
    color: #fbbf24;
    background: rgba(251, 191, 36, .12);
    border-color: rgba(251, 191, 36, .28);
}

/* =========================================================================
 *  4. ФОКУС С КЛАВИАТУРЫ
 * ========================================================================= */
.sfpd-keyboard :focus-visible {
    outline: 2px solid var(--sfpd-teal, #14f1d9);
    outline-offset: 2px;
    border-radius: 6px;
}

/* мышкой — без рамок */
html:not(.sfpd-keyboard) :focus {
    outline: none;
}

/* «пропустить к содержимому» — появляется только по табу */
.sfpd-skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100060;
    padding: 10px 18px;
    border-radius: 0 0 12px 12px;
    font-weight: 700;
    color: #04241f;
    background: var(--sfpd-teal, #14f1d9);
    transition: top .2s ease;
}

.sfpd-skip-link:focus {
    top: 0;
    color: #04241f;
    text-decoration: none;
}

/* =========================================================================
 *  5. МОБИЛЬНЫЕ ТАБЛИЦЫ
 *  Повесьте классу таблицы .sfpd-stack — на узких экранах строки
 *  превращаются в карточки, подписи берутся из data-label (ставит JS).
 * ========================================================================= */
@media (max-width: 767px) {
    table.sfpd-stack,
    table.sfpd-stack tbody,
    table.sfpd-stack tr,
    table.sfpd-stack td {
        display: block;
        width: 100%;
    }

    table.sfpd-stack thead {
        display: none;
    }

    table.sfpd-stack tr {
        margin-bottom: 12px;
        padding: 6px 4px;
        border-radius: 18px;
        background: #0c1929;
        border: 1px solid rgba(255, 255, 255, .08);
    }

    table.sfpd-stack td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 10px 14px !important;
        border: 0 !important;
        text-align: right !important;
    }

    table.sfpd-stack td + td {
        border-top: 1px dashed rgba(255, 255, 255, .07) !important;
    }

    table.sfpd-stack td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-size: 12px;
        font-weight: 700;
        color: rgba(255, 255, 255, .45);
        text-align: left;
    }

    /* ячейка без подписи (кнопки действий) занимает всю ширину */
    table.sfpd-stack td:not([data-label]) {
        justify-content: center;
    }

    table.sfpd-stack td:not([data-label])::before {
        content: none;
    }
}

/* =========================================================================
 *  6. ПАЛИТРА НА УЗКИХ ЭКРАНАХ
 * ========================================================================= */
@media (max-width: 575px) {
    .sfpd-palette {
        padding: 8vh 10px 10px;
    }

    .sfpd-palette__results {
        max-height: 60vh;
    }

    .sfpd-palette__nick,
    .sfpd-palette__footer {
        display: none;
    }
}
