/* AdminShell — дизайн-система: базовые переменные и компоненты */

/* ============================================================
   CSS-переменные (светлая тема по умолчанию)
   ============================================================ */
:root {
    --color-primary:       #2E4DA5;
    --color-primary-hover: #1E3A8A;
    --color-danger:        #DC2626;
    --color-danger-hover:  #B91C1C;
    --color-success:       #16A34A;
    --color-warning:       #D97706;
    --color-info:          #0284C7;

    --color-bg:            #F4F6FB;
    --color-sidebar:       #1A1A2E;
    --color-card:          #FFFFFF;
    --color-text:          #1A1A2E;
    --color-text-muted:    #6B7280;
    --color-border:        #E5E7EB;
    --color-input-bg:      #FFFFFF;

    --color-sidebar-text:        #CBD5E1;
    --color-sidebar-text-active: #FFFFFF;
    --color-sidebar-item-active: rgba(255,255,255,.12);
    --color-sidebar-item-hover:  rgba(255,255,255,.07);

    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 16px;

    --shadow: 0 1px 3px rgba(0,0,0,.10);
    --shadow-md: 0 4px 12px rgba(0,0,0,.10);

    --font: 'Inter', Arial, sans-serif;
    --sidebar-width:  240px;
    --topbar-height:  60px;
    --transition:     .18s ease;
}

/* ============================================================
   Сброс и базовые стили
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: .875rem;   /* 14px */
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

/* SVG-иконки: все 20×20 по умолчанию (задаётся в ui.js).
   Переопределяем только там, где нужен другой размер. */

/* Иконки в кнопках — чуть компактнее */
.btn svg            { width: 18px; height: 18px; }
.btn--sm svg        { width: 16px; height: 16px; }

/* Топбар */
.topbar__btn svg    { width: 22px; height: 22px; }

/* Пустое состояние — крупнее */
.empty-state__icon svg { width: 40px; height: 40px; }

/* Переключатель темы — мельче */
.theme-toggle__btn svg { width: 16px; height: 16px; }

/* Поле ввода */
.field__icon svg    { width: 16px; height: 16px; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

ul, ol { list-style: none; }

/* ============================================================
   Типографика
   ============================================================ */
.page-title    { font-size: 1.5rem;  font-weight: 700; }   /* 24px */
.section-title { font-size: 1.125rem; font-weight: 600; }  /* 18px */
.text-muted    { color: var(--color-text-muted); font-size: .75rem; } /* 12px */

/* ============================================================
   Макет (Layout)
   ============================================================ */
.shell-layout {
    display: flex;
    min-height: 100vh;
}

/* Боковая панель */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}

.sidebar__logo {
    padding: 1.25rem 1rem 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.sidebar__logo-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--color-sidebar-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar__logo-text {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -.02em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-sidebar-text);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

.sidebar__collapse-btn:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.sidebar__collapse-btn svg { width: 16px; height: 16px; }

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .5rem 0;
}

.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem 1rem;
    color: var(--color-sidebar-text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: .125rem .5rem;
    white-space: nowrap;
    overflow: hidden;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.nav-item:hover { background: var(--color-sidebar-item-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--color-sidebar-item-active); color: var(--color-sidebar-text-active); }

.nav-item__icon { flex-shrink: 0; width: 20px; height: 20px; }
.nav-item__label { overflow: hidden; text-overflow: ellipsis; }

/* Заголовок группы модулей */
.nav-group {
    list-style: none;
    padding: 1rem .75rem .25rem;
}
.nav-group__label {
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-text-muted);
    opacity: .6;
    white-space: nowrap;
    overflow: hidden;
}

/* Нижняя часть сайдбара */
.sidebar__footer {
    padding: .75rem;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar__user:hover { background: var(--color-sidebar-item-hover); }

.sidebar__user svg { color: var(--color-sidebar-text); }

.sidebar__user-name {
    color: var(--color-sidebar-text);
    font-size: .8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.sidebar__actions {
    display: flex;
    gap: .25rem;
}

.sidebar__icon-btn {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    cursor: pointer;
    color: var(--color-sidebar-text);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.sidebar__icon-btn:hover {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.25);
    color: #fff;
}

.sidebar__logout-btn {
    width: 100%;
    justify-content: flex-start;
    gap: .5rem;
    padding: .5rem;
}

/* Десктоп: иконка скрыта, только текст */
.sidebar__logout-icon { display: none; }

/* Основная область */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.main__content {
    flex: 1;
    padding: 1rem 1.5rem 4rem 1.5rem;
    position: relative;
}

/* Верхняя мобильная панель */
.topbar {
    display: none;
    height: var(--topbar-height);
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    align-items: center;
    padding: 0 1rem;
    gap: .5rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow);
}

.topbar__title {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: .9375rem;
}

.topbar__btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.topbar__btn:hover { background: var(--color-border); }

/* Оверлей для мобильного меню */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* ============================================================
   Карточка
   ============================================================ */
.card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.card__body { padding: 1.25rem; }

/* ============================================================
   Кнопки
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    height: 38px;
    padding: 0 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), opacity var(--transition), box-shadow var(--transition);
    text-decoration: none;
    min-width: 44px;
}

.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}
.btn--primary:hover { background: var(--color-primary-hover); }

.btn--secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn--secondary:hover { background: var(--color-border); }

.btn--danger {
    background: var(--color-danger);
    color: #fff;
}
.btn--danger:hover { background: var(--color-danger-hover); }

.btn--ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
}
.btn--ghost:hover { background: var(--color-bg); }

.btn:disabled, .btn[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn--loading { pointer-events: none; opacity: .75; }
.btn--sm { height: 32px; padding: 0 .75rem; font-size: .8125rem; }
.btn--icon.btn--ghost:hover { background: rgba(46,77,165,.08); }
.btn--ghost-danger { background: transparent; border: 1px solid transparent; }
.btn--ghost-danger svg { color: var(--color-danger); }
.btn--ghost-danger:hover { background: rgba(220,38,38,.08); }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }

/* ============================================================
   Поля ввода
   ============================================================ */
.field {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.field__label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--color-text);
}

.field__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field__icon {
    position: absolute;
    left: .75rem;
    color: var(--color-text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.field__input {
    width: 100%;
    height: 42px;
    padding: 0 .875rem;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.field__input--icon { padding-left: 2.5rem; }

.field__input--selected {
    border-color: var(--color-primary);
    background: rgba(46, 77, 165, .06);
}

/* Иконка нативного date/time/datetime-local пикера — инвертируем на тёмной теме */
.field__input::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(.6);
    cursor: pointer;
}
.field__input::-webkit-calendar-picker-indicator:hover {
    filter: invert(1) opacity(1);
}

.field__input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(46,77,165,.15);
}

.field__input.has-error { border-color: var(--color-danger); }
.field__input.has-error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.15); }

.field__error {
    font-size: .75rem;
    color: var(--color-danger);
    min-height: 1.2em;
}

textarea.field__input {
    height: auto;
    min-height: 4.5rem;
    padding: .625rem .875rem;
    resize: vertical;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: .875rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.field-checkbox {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .875rem;
    color: var(--color-text);
}

.field-checkbox input[type="checkbox"] {
    accent-color: var(--color-primary);
    cursor: pointer;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.field__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

/* ============================================================
   Таблица
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card);
}

.data-table th {
    padding: .75rem 1.5rem;
    text-align: left;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover { color: var(--color-text); }

.data-table td {
    padding: .75rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    font-size: .875rem;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-bg); }
.data-table tbody tr.row--clickable { cursor: pointer; }

.data-table .actions {
    display: flex;
    gap: .25rem;
    justify-content: flex-end;
}

/* ============================================================
   Бейджи
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2em .6em;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge--success { background: rgba(22,163,74,.12);  color: var(--color-success); }
.badge--danger  { background: rgba(220,38,38,.12);  color: var(--color-danger); }
.badge--info    { background: rgba(2,132,199,.12);  color: var(--color-info); }
.badge--warning { background: rgba(217,119,6,.12);  color: var(--color-warning); }
.badge--neutral { background: var(--color-bg);      color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge--purple  { background: rgba(124,58,237,.12); color: #7C3AED; }

/* Бейдж с произвольным цветом (задаётся через CSS-переменные) */
.badge[style*="--badge-bg"] {
    background: var(--badge-bg);
    color: var(--badge-color, #fff);
}

/* ============================================================
   Модальное окно
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn .15s ease;
}

.modal {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp .2s ease;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 1rem;
}

.modal__title { font-size: 1.0625rem; font-weight: 600; }

.modal__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}
.modal__close:hover { background: var(--color-bg); color: var(--color-text); }

.modal__body { padding: 0 1.5rem 1.25rem; overflow-y: auto; }

.modal__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0 } to { transform: none; opacity: 1 } }

.modal--lg { max-width: 680px; }

/* ============================================================
   Матрица прав доступа
   ============================================================ */
.perms-matrix {
    overflow-x: auto;
}

.perms-matrix table {
    width: 100%;
    border-collapse: collapse;
}

.perms-matrix th {
    padding: .5rem .75rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--color-border);
}

.perms-matrix th:first-child { text-align: left; }

.perms-matrix td {
    padding: .625rem .75rem;
    font-size: .875rem;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.perms-matrix td:first-child { text-align: left; font-weight: 500; }

.perms-matrix tr:last-child td { border-bottom: none; }
.perms-matrix tr:hover td { background: var(--color-bg); }

.perms-matrix input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.perms-matrix input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .4; }

/* ============================================================
   Уведомления (toast)
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 280px;
    max-width: 380px;
    pointer-events: all;
    animation: toastIn .2s ease;
}

.toast--success { border-left: 4px solid var(--color-success); }
.toast--error   { border-left: 4px solid var(--color-danger); }
.toast--warning { border-left: 4px solid var(--color-warning); }
.toast--info    { border-left: 4px solid var(--color-info); }

.toast__icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: .1em; }
.toast--success .toast__icon { color: var(--color-success); }
.toast--error   .toast__icon { color: var(--color-danger); }
.toast--warning .toast__icon { color: var(--color-warning); }
.toast--info    .toast__icon { color: var(--color-info); }

.toast__text { flex: 1; font-size: .875rem; }

.toast__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    width: 20px;
    height: 20px;
}

@keyframes toastIn { from { transform: translateY(12px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ============================================================
   Скелетон
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-bg) 50%, var(--color-border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   Пустое состояние
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
    text-align: center;
    gap: .75rem;
}

.empty-state__icon { width: 48px; height: 48px; opacity: .5; }
.empty-state__title { font-size: .9375rem; font-weight: 600; color: var(--color-text); }
.empty-state__text  { font-size: .875rem; max-width: 320px; }

/* ============================================================
   Спиннер
   ============================================================ */
.spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    animation: spin .7s linear infinite;
}

.spinner svg { width: 20px; height: 20px; display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Таблица в состоянии загрузки */
.table-wrap--loading {
    opacity: .45;
    pointer-events: none;
    transition: opacity .15s;
}

/* ============================================================
   Форма входа
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--color-bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.auth-card__title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: .375rem;
}

.auth-card__subtitle {
    font-size: .875rem;
    color: var(--color-text-muted);
    margin-bottom: 1.75rem;
}

.auth-card__form { display: flex; flex-direction: column; gap: 1rem; }

.auth-card__footer {
    margin-top: 1rem;
    font-size: .8125rem;
    color: var(--color-text-muted);
}

/* ============================================================
   Страница ошибок
   ============================================================ */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    gap: 1rem;
    padding: 2rem;
}

.error-page__code   { font-size: 4rem; font-weight: 700; color: var(--color-primary); line-height: 1; }
.error-page__title  { font-size: 1.25rem; font-weight: 600; }
.error-page__text   { color: var(--color-text-muted); max-width: 380px; }

/* ============================================================
   Хлебные крошки
   ============================================================ */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .8125rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs__sep { color: var(--color-border); }
.breadcrumbs__current { color: var(--color-text); }

/* ============================================================
   Утилиты
   ============================================================ */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-xs       { gap: .25rem; }
.gap-sm       { gap: .5rem; }
.gap-md       { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.ml-auto      { margin-left: auto; }
.w-full       { width: 100%; }
.mt-1         { margin-top: .25rem; }
.mt-2         { margin-top: .5rem; }
.mt-4         { margin-top: 1rem; }
.mb-4         { margin-bottom: 1rem; }
.hidden       { display: none !important; }
.sr-only      { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ============================================================
   Свёрнутая боковая панель (только десктоп >= 1024 px)
   ============================================================ */
@media (min-width: 1024px) {
    .sidebar__collapse-btn { display: flex; }

    .sidebar--collapsed { width: 64px; }

    .sidebar--collapsed ~ .main { margin-left: 64px; }

    .sidebar--collapsed .sidebar__logo {
        justify-content: center;
        padding: 1rem .5rem;
    }

    .sidebar--collapsed .sidebar__logo-icon,
    .sidebar--collapsed .sidebar__logo-text { display: none; }

    .sidebar--collapsed .nav-item__label,
    .sidebar--collapsed .sidebar__user-name,
    .sidebar--collapsed .nav-group { display: none; }

    .sidebar--collapsed .nav-item {
        justify-content: center;
        padding: .625rem;
        margin: .125rem .25rem;
    }

    .sidebar--collapsed .sidebar__footer {
        align-items: center;
        padding: .5rem .25rem;
    }

    .sidebar--collapsed .sidebar__user {
        justify-content: center;
        padding: .25rem;
    }

    .sidebar--collapsed .sidebar__logout-btn {
        justify-content: center;
        padding: .5rem .25rem;
        gap: 0;
    }

    .sidebar--collapsed .sidebar__logout-icon { display: flex; }
}

/* ============================================================
   Адаптивность — Планшет (768–1023 px)
   ============================================================ */
@media (max-width: 1023px) {
    .sidebar {
        width: 64px;
    }

    .sidebar__logo-text,
    .nav-item__label,
    .sidebar__user-name {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: .625rem;
        margin: .125rem .25rem;
    }

    .sidebar__footer {
        align-items: center;
        padding: .5rem .25rem;
    }

    .sidebar__user { padding: .25rem; justify-content: center; }

    .sidebar__logout-btn { justify-content: center; padding: .5rem .25rem; gap: 0; }
    .sidebar__logout-icon { display: flex; }

    .main { margin-left: 64px; }
}

/* ============================================================
   Адаптивность — Смартфон (< 768 px)
   ============================================================ */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open { display: block; }

    .sidebar__logo-text,
    .nav-item__label,
    .sidebar__user-name {
        display: block;
    }

    .nav-item {
        justify-content: flex-start;
        padding: .625rem 1rem;
        margin: .125rem .5rem;
    }

    .sidebar__footer { align-items: stretch; padding: .75rem; }
    .sidebar__user { justify-content: flex-start; }
    .sidebar__logout-btn { justify-content: flex-start; padding: .5rem; gap: .5rem; }
    .sidebar__logout-icon { display: flex; }

    .main    { margin-left: 0; }
    .topbar  { display: flex; }

    .main__content { padding: 1rem; }

    /* Модалки — bottom sheet на мобильных */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        animation: slideSheet .2s ease;
    }

    @keyframes slideSheet { from { transform: translateY(100%) } to { transform: none } }

    /* Таблица — горизонтальная прокрутка */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ============================================================
   Поиск в таблице / панель инструментов
   ============================================================ */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* Таблица-компонент внутри карточки */
.card > .table-component > .table-toolbar {
    padding: .75rem 1.25rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--color-border);
}

.card > .table-component > .table-wrap {
    border: none;
    border-radius: 0;
}

.table-pager {
    padding: 1rem;
    justify-content: flex-end;
}

.table-pager__info { margin-right: auto; }
.table-pager__page { min-width: 32px; }

.search-field {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0 .75rem;
    height: 38px;
    flex: 1;
    min-width: 180px;
    max-width: 320px;
    transition: border-color var(--transition);
}

.search-field:focus-within { border-color: var(--color-primary); }

.search-field__icon { color: var(--color-text-muted); width: 16px; height: 16px; flex-shrink: 0; }

.search-field__input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--color-text);
}

/* Мягко удалённые строки */
.row--deleted td { opacity: .45; }
.row--deleted td:first-child { text-decoration: line-through; }
.row--deleted .col-check + td { text-decoration: line-through; }

/* Контейнер дополнительных элементов тулбара */
.table-toolbar-extras {
    display: flex;
    align-items: center;
    gap: .375rem;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

.table-toolbar-extras .field__input {
    width: auto;
    height: 38px;
    flex-shrink: 0;
}

/* Иконочные кнопки в тулбаре: видимая обводка */
.table-toolbar .btn--icon {
    border-color: var(--color-border);
    background: var(--color-card);
}
.table-toolbar .btn--icon:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(46,77,165,.06);
}
.table-toolbar .btn--icon.btn--ghost-danger {
    border-color: var(--color-border);
}
.table-toolbar .btn--icon.btn--ghost-danger:hover:not(:disabled) {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: rgba(220,38,38,.08);
}
.table-toolbar .btn--icon:disabled {
    opacity: .35;
    cursor: not-allowed;
}
.table-toolbar .btn--icon.btn--icon-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(46,77,165,.08);
}

/* Чекбокс-колонка таблицы */
.col-check, .col-action {
    width: 1%;
    padding: .75rem .5rem .75rem 1.25rem;
    white-space: nowrap;
}

/* Утилита скрытия */
.is-hidden { display: none !important; }

/* Разделитель в тулбаре таблицы */
.toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin: 0 .125rem;
    flex-shrink: 0;
}


/* ============================================================
   Drag & Drop сортировка строк таблицы
   ============================================================ */
.col-drag {
    width: 32px;
    padding: .75rem .25rem .75rem .5rem;
    white-space: nowrap;
}

.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 24px;
    color: var(--color-text-muted);
    cursor: grab;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.drag-handle:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.drag-handle svg { width: 16px; height: 16px; }

.color-swatch-wrap {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,.1);
    flex-shrink: 0;
}

.row--dragging {
    opacity: .4;
}

.row--drag-over td {
    background: rgba(46,77,165,.04);
}

.row--drag-over td:first-child {
    box-shadow: inset 0 2px 0 0 var(--color-primary);
}

.entity-list-item.row--drag-over {
    background: rgba(46,77,165,.04);
    box-shadow: inset 0 2px 0 0 var(--color-primary);
}

/* ============================================================
   Автодополнение (autocomplete)
   ============================================================ */

.autocomplete-wrap {
    position: relative;
}

.autocomplete-wrap .field__input-wrap {
    position: relative;
}

.autocomplete-clear {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #8b949e;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
    transition: color .15s, background .15s;
}

.autocomplete-clear:hover {
    color: #c9d1d9;
    background: rgba(139,148,158,.15);
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
}

.autocomplete-option {
    padding: .5rem .75rem;
    font-size: .8125rem;
    color: #c9d1d9;
    cursor: pointer;
    transition: background .1s;
    display: flex;
    align-items: baseline;
    gap: .5rem;
}
.autocomplete-option__hint {
    font-size: .75rem;
    opacity: .55;
    margin-left: auto;
    white-space: nowrap;
}

.autocomplete-option:hover,
.autocomplete-option--active {
    background: rgba(56,139,253,.15);
    color: #fff;
}

.autocomplete-option--empty {
    padding: .5rem .75rem;
    font-size: .8125rem;
    color: #484f58;
    cursor: default;
}

.autocomplete-option--create {
    color: var(--color-primary);
    border-top: 1px solid rgba(255,255,255,.07);
    font-style: italic;
}

/* ============================================================
   Вкладки внутри модального окна
   ============================================================ */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.25rem;
}

.modal-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    padding: .5rem 1rem .625rem;
    margin-bottom: -1px;
    transition: color var(--transition), border-color var(--transition);
}
.modal-tab-btn:hover { color: var(--color-text); }
.modal-tab-btn--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.modal-tab-panel--hidden { display: none; }

/* ============================================================
   Контентный слой (поверх списка, с X-кнопкой)
   ============================================================ */
.content-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    z-index: 10;
    background: var(--color-bg);
    padding: 1rem 1.5rem 4rem;
}
@media (max-width: 767px) {
    .content-layer { padding: 1rem 1rem 4rem; }
}

/* Кнопка «Назад к списку» в карточных модулях */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: var(--color-text-muted);
    font-size: .8125rem;
    padding: .375rem .75rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-card);
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.back-btn svg { width: 15px; height: 15px; }
.back-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
    background: rgba(139,148,158,.08);
}

/* ============================================================
   Модуль «Исполнители»
   ============================================================ */

/* Грид чекбоксов (роли, инструменты) */
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .4rem;
    margin-bottom: 1rem;
}

.check-grid-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--color-text);
}

.check-grid-item__primary {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .25rem;
    color: var(--color-text-muted);
    font-size: .75rem;
    flex-shrink: 0;
}

/* Тег-пилюли (роли, инструменты) */
.pf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}

.pf-tag {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .5rem 1rem;
    border-radius: 999px;
    border: 1.5px solid var(--color-border);
    font-size: .9375rem;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    transition: background .15s, border-color .15s, color .15s;
}

.pf-tag:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
}

.pf-tag--active {
    background: var(--color-primary-soft, rgba(59,130,246,.12));
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pf-tag__star {
    font-size: 1rem;
    opacity: .3;
    cursor: pointer;
    transition: opacity .15s, color .15s;
    line-height: 1;
    padding: .3rem .4rem;
    margin: -.3rem -.4rem -.3rem .25rem;
    border-radius: 999px;
}

.pf-tag--active .pf-tag__star:hover { opacity: .8; }
.pf-tag--primary .pf-tag__star { opacity: 1; color: #f59e0b; }

.pf-tag__edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    transition: opacity .15s;
    line-height: 1;
    padding: .3rem .4rem;
    margin: -.3rem -.2rem -.3rem 0;
    border-radius: 999px;
}
.pf-tag__edit svg { pointer-events: none; }
.pf-tag:hover .pf-tag__edit { opacity: .45; }
.pf-tag__edit:hover { opacity: 1 !important; }

.pf-tags-hint {
    font-size: .8rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.pf-tags-add {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
}

.pf-tags-add__input {
    width: 200px;
    flex-shrink: 0;
}

/* Строки в списках (награды, состав) */
.entity-list-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem .75rem;
    background: var(--color-surface-2, rgba(255,255,255,.04));
    border-radius: var(--radius-sm);
}

.entity-list-item__info { flex: 1; font-size: .875rem; }
.entity-list-item--clickable { cursor: pointer; transition: background .15s; }
.entity-list-item--clickable:hover { background: var(--color-surface-3, rgba(255,255,255,.08)); }

.entity-list-item__meta {
    font-size: .8rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* Строка добавления участника */
.member-add-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: 1rem;
}
.member-add-row__ac {
    flex: 2;
    min-width: 0;
}
.member-add-row__role {
    flex: 1;
    min-width: 0;
}

/* Список сущностей (награды, состав) */
.entity-list {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    margin-bottom: 1rem;
}

/* Подзаголовки внутри вкладок */
.tab-section-title {
    font-weight: 600;
    font-size: .875rem;
    color: var(--color-text);
    margin: .75rem 0 .5rem;
}

.tab-section-title:first-child { margin-top: 0; }

/* Форма основных данных внутри вкладки */
.user-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Матрица прав доступа */
.perms-matrix {
    overflow-y: auto;
    max-height: 320px;
}
.perms-matrix table {
    width: 100%;
    border-collapse: collapse;
}
.perms-matrix th,
.perms-matrix td {
    padding: .5rem .625rem;
    text-align: left;
    font-size: .8125rem;
    border-bottom: 1px solid var(--color-border);
}
.perms-matrix th {
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--color-card);
}
.perms-matrix td:first-child { color: var(--color-text); min-width: 100px; }
.perms-matrix td:not(:first-child) { text-align: center; width: 1%; }
.perms-matrix input[type="checkbox"] { accent-color: var(--color-primary); cursor: pointer; }
.perms-matrix input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .45; }
.perms-loading { padding: .5rem 0; }

/* ============================================================
   Консоль журнала событий (sliding bottom drawer)
   ============================================================ */

/* Отступ снизу для основного контента, когда drawer видим */
.shell-layout.console--open .main { padding-bottom: 340px; }

/* Drawer */
.log-drawer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 40px;
    background: #0d1117;
    border-top: 1px solid #30363d;
    color: #e6edf3;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: .8125rem;
    z-index: 88;
    display: flex;
    flex-direction: column;
    transition: height .22s ease;
    overflow: hidden;
}

.log-drawer--open {
    height: 340px;
}

body.noscroll {
    overflow: hidden;
}

.log-drawer--expanded {
    height: calc(100vh - 8px);
}

.shell-layout.console--expanded .main {
    padding-bottom: calc(100vh - 8px);
}

/* Подстройка left при свёрнутой панели */
.sidebar--collapsed ~ .main,
.sidebar--collapsed + * .log-drawer,
.shell-layout:has(.sidebar--collapsed) .log-drawer {
    left: 64px;
}

/* Bar */
.log-drawer__bar {
    display: flex;
    align-items: center;
    height: 40px;
    flex-shrink: 0;
    padding: 0 .75rem 0 0;
    gap: .5rem;
}

/* Handle */
.log-drawer__handle {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 0 1rem;
    height: 100%;
    font-family: inherit;
    font-size: .8125rem;
    flex: 1;
    transition: color var(--transition);
}
.log-drawer__handle:hover { color: #e6edf3; }

.log-drawer__handle-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.log-drawer__count {
    margin-left: .375rem;
    background: rgba(139,148,158,.18);
    border-radius: 10px;
    padding: 0 .4rem;
    font-size: .75rem;
    color: #8b949e;
    min-width: 20px;
    text-align: center;
}

/* Drawer button (refresh, pager) */
.log-drawer__btn {
    background: none;
    border: 1px solid #30363d;
    border-radius: var(--radius-sm);
    color: #8b949e;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    flex-shrink: 0;
    transition: color var(--transition), border-color var(--transition);
}
.log-drawer__btn:hover:not(:disabled) { color: #e6edf3; border-color: #8b949e; }
.log-drawer__btn:disabled { opacity: .35; cursor: not-allowed; }

@keyframes log-spin { to { transform: rotate(360deg); } }
.log-drawer__btn--spin { animation: log-spin .6s linear infinite; }

/* Filters */
.log-drawer__filters {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .75rem;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
}

.log-drawer__filter-input,
.log-drawer__filter-select {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: var(--radius-sm);
    color: #c9d1d9;
    font-family: inherit;
    font-size: .8125rem;
    height: 28px;
    padding: 0 .5rem;
    outline: none;
    transition: border-color var(--transition);
}
.log-drawer__filter-input { flex: 1; min-width: 150px; }
.log-drawer__filter-select { cursor: pointer; }
.log-drawer__filter-input:focus,
.log-drawer__filter-select:focus { border-color: #58a6ff; }

/* Console output */
.log-drawer__console {
    flex: 1;
    overflow-y: auto;
    padding: .25rem 0;
}

.log-drawer__console::-webkit-scrollbar { width: 6px; }
.log-drawer__console::-webkit-scrollbar-track { background: transparent; }
.log-drawer__console::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* Log entry */
.log-entry {
    display: flex;
    align-items: baseline;
    gap: .625rem;
    padding: .25rem .75rem;
    border-bottom: 1px solid #161b22;
    white-space: nowrap;
    overflow: hidden;
}
.log-entry:hover { background: #161b22; }

.log-entry__time {
    color: #484f58;
    font-size: .75rem;
    flex-shrink: 0;
    min-width: 150px;
}

.log-entry__tag {
    display: inline-block;
    font-size: .6875rem;
    font-weight: 600;
    padding: .1rem .4rem;
    border-radius: 3px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.log-entry__tag--success { background: rgba(46,160,67,.2);  color: #3fb950; }
.log-entry__tag--info    { background: rgba(56,139,253,.2); color: #58a6ff; }
.log-entry__tag--warning { background: rgba(210,153,34,.2); color: #d29922; }
.log-entry__tag--danger  { background: rgba(248,81,73,.2);  color: #f85149; }
.log-entry__tag--neutral { background: rgba(139,148,158,.15); color: #8b949e; }

.log-entry__actor {
    color: #e6edf3;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.log-entry__actor--anon { color: #484f58; }

.log-entry__details {
    color: #8b949e;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-entry__target {
    color: #c9d1d9;
    border-bottom: 1px dotted #484f58;
    cursor: default;
}

.log-entry__ip {
    color: #484f58;
    font-size: .75rem;
    flex-shrink: 0;
    margin-left: auto;
}

/* Pager */
.log-drawer__pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .375rem;
    padding: .375rem .75rem;
    border-top: 1px solid #21262d;
    flex-shrink: 0;
}

.log-drawer__pager-info {
    font-size: .75rem;
    color: #8b949e;
    padding: 0 .25rem;
}

/* Empty state */
.log-drawer__empty {
    padding: 1rem .75rem;
    color: #484f58;
    font-size: .8125rem;
}
.log-drawer__empty--error { color: #f85149; }

/* Адаптив */
@media (max-width: 1023px) {
    .log-drawer { left: 64px; }
}
@media (max-width: 767px) {
    .log-drawer { left: 0; }
    .shell-layout.console--open     .main { padding-bottom: 340px; }
    .log-drawer--expanded                  { height: calc(100vh - var(--topbar-height) - 8px); }
    .shell-layout.console--expanded .main  { padding-bottom: calc(100vh - var(--topbar-height) - 8px); }
}

/* ============================================================
   Редактор программы концерта
   Сетка: [1fr content] [32px btn] [32px btn] [24px grip]
   ============================================================ */

.prog-row {
    display: grid;
    grid-template-columns: 1fr 32px 32px 32px;
    column-gap: .5rem;
    align-items: start;
    padding: .5rem 1rem;
}

.prog-section__head {
    grid-template-columns: 1fr 32px 32px 32px 32px;
    padding: .625rem 1rem;
    border-bottom: 1px solid var(--color-border);
    align-items: center;
}

.prog-intermission-btn--on {
    color: var(--color-warning) !important;
}

.prog-item + .prog-item {
    border-top: 1px solid var(--color-border);
}

.prog-item--disabled {
    opacity: .45;
}

.prog-item:hover {
    background: rgba(0, 0, 0, .04);
}

.prog-grip {
    align-self: start;
    margin-top: 4px;
}

.prog-item__num {
    font-weight: 700;
    margin-right: .35rem;
}

.prog-section__title {
    font-weight: 600;
    font-size: 1rem;
}

.prog-section__dur {
    font-size: .8125rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-left: .4rem;
}

.prog-item__content {
    min-width: 0;
}

.prog-item__content--editable {
    cursor: pointer;
}

.prog-item__main {
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prog-item__sub {
    font-size: .75rem;
    color: var(--color-text-muted);
    margin-top: .1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prog-item__performers {
    font-size: .75rem;
    color: var(--color-text-muted);
    margin-top: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Поля ввода длительности: [мин.] [сек.] */
.dur-inputs {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.dur-inputs__cell {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.dur-inputs__field {
    width: 4rem;
    text-align: center;
}

.dur-inputs__unit {
    font-size: .8125rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.prog-item__dur {
    font-size: .8125rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-left: .35rem;
}

.prog-item__notes {
    font-size: .75rem;
    font-style: italic;
    color: var(--color-text-muted);
    margin-top: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .8;
}

.prog-add-row {
    padding: .4rem 1rem;
    border-top: 1px solid var(--color-border);
}

.prog-intermission {
    margin: -.25rem 0 .75rem;
    padding: .3rem .5rem;
}

.prog-intermission__label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8125rem;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.prog-intermission__label input[type="checkbox"] {
    accent-color: var(--color-primary);
}

.prog-intermission__divider {
    text-align: center;
    padding: .35rem 1rem;
    font-size: .8125rem;
    color: var(--color-text-muted);
    margin-top: .35rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
}

.prog-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: .75rem;
}

.prog-section {
    margin-bottom: .75rem;
}

.prog-item__empty {
    padding: .75rem 1rem;
    margin: 0;
    font-size: .875rem;
    color: var(--color-text-muted);
}

.prog-item__toggle--active {
    color: var(--color-success);
}

.prog-intermission__divider--hidden {
    display: none;
}

.prog-perf-role {
    width: 150px;
}

.ac-wrap {
    position: relative;
}

.ac-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
    margin-top: 2px;
}

.ac-dropdown__item {
    padding: .45rem .75rem;
    cursor: pointer;
    font-size: .875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
}

.ac-dropdown__item:hover,
.ac-dropdown__item--active {
    background: var(--color-bg);
}

.ac-dropdown__type {
    font-size: .75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.ac-dropdown__empty {
    padding: .5rem .75rem;
    font-size: .8125rem;
    color: var(--color-text-muted);
}

.ac-dropdown__create {
    border-top: 1px solid var(--color-border);
    color: var(--color-primary);
    font-size: .8125rem;
}

.prog-tab-hidden {
    display: none;
}

.entity-list-item--col {
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
}

.prog-perf-top {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.prog-perf-top .entity-list-item__info {
    flex: 1;
}

.prog-perf-instruments {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    padding: .1rem 0 .2rem;
}

.prog-instr-tag {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: var(--radius-sm);
    font-size: .775rem;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.prog-instr-tag:hover {
    border-color: var(--color-primary);
    /*color: var(--color-primary);*/
}

.prog-instr-tag--on {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.prog-item__premiere {
    margin-left: .4rem;
    vertical-align: middle;
    font-size: .7rem;
}

/* ============================================================
   Блок данных синхронизации (вкладка «Продажа»)
   ============================================================ */

.sync-info {
    padding: .75rem 1rem;
    font-size: .875rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.sync-info__row {
    display: flex;
    gap: .5rem;
}

.sync-info__label {
    min-width: 130px;
}

/* ============================================================
   Яндекс.Импорт — степпер и таблица
   ============================================================ */

.import-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.import-stepper__step {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .5rem;
    font-size: .875rem;
    color: var(--color-text-muted);
}

.import-stepper__step--active {
    color: var(--color-primary);
    font-weight: 600;
}

.import-stepper__step--done {
    color: var(--color-success);
    cursor: pointer;
}

.import-stepper__step--done:hover { text-decoration: underline; }

.import-stepper__num {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.import-stepper__sep {
    margin: 0 .25rem;
    color: var(--color-border);
    font-size: .875rem;
}

.import-table {
    width: 100%;
    border-collapse: collapse;
}

.import-table th {
    text-align: left;
    padding: .5rem .75rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}

.import-table td {
    padding: .5rem .75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
    font-size: .875rem;
}

.import-table tbody tr:last-child td { border-bottom: none; }

.import-table tbody tr:hover td { background: var(--color-bg-subtle); }

