/*
 * ПОЛОСА ПОСЛЕДНИХ ВКЛАДОК — ТЗ п. 3.1, 3.3, 3.6.
 *
 * Отдельный файл, а не resources/css: тему проекта правит другая работа, и
 * общий файл означал бы, что две правки дерутся за одни строки. Цвета взяты
 * переменными облика (/css/theme.css) — полоса меняется вместе с темой и
 * сама собой темнеет в тёмной.
 */

.mp-tabs {
    /* Высота по ТЗ п. 3.6: 44 в обычной плотности, 40 в компактной. */
    --mp-tabs-h: 44px;

    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: stretch;
    min-height: var(--mp-tabs-h);
    background: var(--surface-1, #fff);
    border-bottom: 1px solid var(--line, #d3d8de);
    font-family: var(--font-sans, system-ui, sans-serif);
}

body.bf-density-compact .mp-tabs { --mp-tabs-h: 40px; }

.mp-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── лента вкладок ─────────────────────────────────────────────── */

.mp-tabs__scroll {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.mp-tabs__scroll::-webkit-scrollbar { height: 0; }

.mp-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 230px;
    padding: 0 6px 0 10px;
    border: 0;
    border-right: 1px solid var(--line, #d3d8de);
    background: var(--surface-2, #f3f5f7);
    color: var(--ink-2, #47505b);
    font: 500 13px/1.25 var(--font-sans, system-ui, sans-serif);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.mp-tab:hover { background: var(--surface-1, #fff); color: var(--ink, #161b21); }

.mp-tab.is-active {
    background: var(--surface-1, #fff);
    color: var(--ink, #161b21);
    font-weight: 600;
}

/* Активная вкладка отмечена чертой акцента — тем же приёмом, что активный
   пункт меню в гайдлайне. Акцентом не красится ничего крупнее черты:
   «один акцент на экран» (п. 4.3). */
.mp-tab.is-active::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 2px;
    background: var(--brand, #d4142a);
}

.mp-tab:focus-visible {
    outline: 2px solid var(--focus, #1c52c4);
    outline-offset: -2px;
}

.mp-tab__icon {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    color: var(--ink-3, #5c6571);
}

.mp-tab.is-active .mp-tab__icon { color: var(--brand, #d4142a); }

/* Название в одну-две строки с обрезкой (ТЗ п. 3.3). В компактной полосе
   строка одна: на 40 точек две не встают, не ломая высоту. */
.mp-tab__title {
    flex: 1 1 auto;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    line-height: 1.15;
    max-height: 2.3em;
}

body.bf-density-compact .mp-tab__title {
    -webkit-line-clamp: 1;
    max-height: 1.2em;
}

/* Точка несохранённых изменений. Стоит ДО крестика и не заменяет его:
   по ТЗ крестик на вкладке есть всегда, а точка — добавочный признак. */
.mp-tab__dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand, #d4142a);
}

.mp-tab__pin {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    color: var(--ink-3, #5c6571);
}

.mp-tab__close {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm, 3px);
    background: transparent;
    color: var(--ink-3, #5c6571);
    cursor: pointer;
}

.mp-tab__close:hover { background: var(--surface-3, #e1e5ea); color: var(--ink, #161b21); }
.mp-tab__close svg { width: 12px; height: 12px; }

/* ── правый конец полосы: колокольчик и кнопка списка ──────────── */

.mp-tabs__tail {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    padding: 0 8px 0 6px;
    border-left: 1px solid var(--line, #d3d8de);
    background: var(--surface-1, #fff);
}

.mp-tabs__bell { display: flex; align-items: center; }

.mp-tabs__menu-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 7px;
    border: 0;
    border-radius: var(--radius-md, 6px);
    background: transparent;
    color: var(--ink-2, #47505b);
    cursor: pointer;
}

.mp-tabs__menu-btn:hover { background: var(--surface-2, #f3f5f7); color: var(--ink, #161b21); }
.mp-tabs__menu-btn svg { width: 18px; height: 18px; }

.mp-tabs__menu-count {
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--surface-3, #e1e5ea);
    color: var(--ink-2, #47505b);
    font: 700 11px/17px var(--font-sans, system-ui, sans-serif);
    text-align: center;
}

/* ── список всех вкладок ───────────────────────────────────────── */

.mp-tabs__sheet {
    position: absolute;
    top: calc(var(--mp-tabs-h) + 2px);
    right: 8px;
    z-index: 40;
    width: 330px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line, #d3d8de);
    border-radius: var(--radius-lg, 10px);
    background: var(--surface-1, #fff);
    box-shadow: var(--shadow-pop, 0 12px 32px rgba(22, 27, 33, 0.18));
}

.mp-sheet__head {
    padding: 4px 8px 6px;
    color: var(--ink-3, #5c6571);
    font: 800 11.5px/1.3 var(--font-sans, system-ui, sans-serif);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mp-sheet__row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px 0 8px;
    border-radius: var(--radius-md, 6px);
}

.mp-sheet__row:hover { background: var(--surface-2, #f3f5f7); }
.mp-sheet__row.is-active { background: var(--brand-soft, #fce7ea); }

.mp-sheet__go {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink, #161b21);
    font: 500 13px/1.2 var(--font-sans, system-ui, sans-serif);
    text-align: left;
    cursor: pointer;
}

.mp-sheet__go svg { flex: 0 0 auto; width: 15px; height: 15px; color: var(--ink-3, #5c6571); }

.mp-sheet__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mp-sheet__btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm, 3px);
    background: transparent;
    color: var(--ink-3, #5c6571);
    cursor: pointer;
}

.mp-sheet__btn:hover { background: var(--surface-3, #e1e5ea); color: var(--ink, #161b21); }
.mp-sheet__btn.is-on { color: var(--brand, #d4142a); }
.mp-sheet__btn svg { width: 14px; height: 14px; }

.mp-sheet__sep {
    margin: 6px 4px;
    border-top: 1px solid var(--line, #d3d8de);
}

.mp-sheet__action {
    display: block;
    width: 100%;
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--radius-md, 6px);
    background: transparent;
    color: var(--ink, #161b21);
    font: 500 13px/30px var(--font-sans, system-ui, sans-serif);
    text-align: left;
    cursor: pointer;
}

.mp-sheet__action:hover { background: var(--surface-2, #f3f5f7); }
.mp-sheet__action:disabled { color: var(--ink-3, #5c6571); cursor: default; background: transparent; }

.mp-sheet__empty {
    padding: 8px;
    color: var(--ink-3, #5c6571);
    font: 500 13px/1.4 var(--font-sans, system-ui, sans-serif);
}

/* ── подтверждение закрытия вкладки с несохранёнными данными ───── */

.mp-ask-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(22, 27, 33, 0.45);
}

.mp-ask {
    width: 420px;
    max-width: 100%;
    padding: 20px;
    border-radius: var(--radius-lg, 10px);
    background: var(--surface-1, #fff);
    box-shadow: var(--shadow-pop, 0 12px 32px rgba(22, 27, 33, 0.18));
    font-family: var(--font-sans, system-ui, sans-serif);
}

.mp-ask__title {
    margin: 0 0 8px;
    color: var(--ink, #161b21);
    font: 800 16px/1.3 var(--font-sans, system-ui, sans-serif);
}

.mp-ask__text {
    margin: 0 0 18px;
    color: var(--ink-2, #47505b);
    font: 500 14px/1.45 var(--font-sans, system-ui, sans-serif);
}

.mp-ask__row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.mp-ask__btn {
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--line-control, #848d99);
    border-radius: var(--radius-md, 6px);
    background: var(--surface-1, #fff);
    color: var(--ink, #161b21);
    font: 600 13px/1 var(--font-sans, system-ui, sans-serif);
    cursor: pointer;
}

.mp-ask__btn:hover { background: var(--surface-2, #f3f5f7); }

/* Опасное действие — своим цветом, не акцентом раздела (гайдлайн стр. 8). */
.mp-ask__btn--danger {
    border-color: var(--brand, #d4142a);
    background: var(--brand, #d4142a);
    color: var(--on-brand, #fff);
}

.mp-ask__btn--danger:hover { background: var(--brand-hover, #ae0f22); }

/*
 * Колокольчик Filament из верхней панели убран с глаз: по ТЗ (п. 4.2)
 * верхней панели нет вовсе, а пока она есть — два колокольчика на экране.
 * Одна строка, которую снимут вместе с панелью.
 */
.fi-topbar .fi-topbar-database-notifications-btn { display: none; }
