/* Каркас приложения: sidebar, topbar, bottom-tabs.
   Использует префикс .shell-* и понимает роль через атрибут [data-role] на body. */

/* ============== Sidebar ============== */
.shell-sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    background: var(--color-bg-soft);
    border-right: 1px solid var(--color-line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: var(--z-sidebar);
}

.shell-sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5) var(--space-4);
    text-decoration: none;
    color: var(--color-text);
}

.shell-sidebar__brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--accent-contrast);
    display: grid;
    place-items: center;
    font-weight: var(--fw-black);
    font-size: var(--fs-md);
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.shell-sidebar__brand-label {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}
.shell-sidebar__brand-name {
    font-weight: var(--fw-black);
    font-size: var(--fs-md);
    letter-spacing: -0.01em;
}
.shell-sidebar__brand-meta {
    font-size: var(--fs-xs);
    color: var(--color-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.shell-sidebar__nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.shell-sidebar__section-title {
    padding: var(--space-3) var(--space-3) var(--space-1);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-soft);
}

.shell-sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
}
.shell-sidebar__item:hover {
    background: var(--color-surface);
    color: var(--color-text);
}
.shell-sidebar__item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}
.shell-sidebar__item.is-active::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: var(--radius-pill);
    background: var(--accent);
}

.shell-sidebar__item-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-size: 16px;
    line-height: 1;
}
.shell-sidebar__item-label { flex: 1 1 auto; min-width: 0; }
.shell-sidebar__item-note {
    font-size: var(--fs-xs);
    color: var(--color-text-soft);
    font-weight: var(--fw-regular);
    text-transform: none;
    letter-spacing: 0;
    margin-top: 2px;
}
.shell-sidebar__item-lock { font-size: var(--fs-xs); color: var(--color-warning); }
/* Бейдж «новых заданий» у пункта навбара (админ). Скрыт, когда счётчик 0 (не рендерится). */
.shell-sidebar__item-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--color-danger, #e5484d);
    color: #fff;
    font-size: 11px;
    font-weight: var(--fw-bold, 700);
    line-height: 1;
}

.shell-sidebar__footer {
    padding: var(--space-3) var(--space-4) calc(var(--space-4) + var(--safe-bottom));
    border-top: 1px solid var(--color-line);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background: var(--color-bg-soft);
}

/* Скрим оверлея — по умолчанию скрыт на всех экранах,
   на mobile показывается через body.is-sidebar-open (см. ниже). */
.shell-sidebar__scrim { display: none; }

.shell-sidebar__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-md);
}
.shell-sidebar__user-info { min-width: 0; line-height: 1.2; }
.shell-sidebar__user-name { font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--color-text); }
.shell-sidebar__user-meta { font-size: var(--fs-xs); color: var(--color-text-soft); }

/* ============== Topbar ============== */
.shell-topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--topbar-height);
    padding: 0 var(--space-6);
    background: color-mix(in srgb, var(--color-bg) 85%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-line);
}

.shell-topbar__title { font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--color-text); min-width: 0; }
.shell-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }

.shell-topbar__role-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.shell-topbar__role-avatar { display: none; }
.shell-topbar__role-copy { min-width: 0; }

/* ===== Переключатель темы — компактная иконка в строке аккаунта ===== */
.shell-sidebar__theme-btn {
    margin-left: auto;
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
.shell-sidebar__theme-btn:hover { background: var(--color-surface-2); border-color: var(--color-line-strong); }
.shell-sidebar__theme-btn:active { transform: scale(0.92); }
.shell-sidebar__theme-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.shell-sidebar__theme-btn[hidden] { display: none; }
/* в свёрнутом сайдбаре (только аватар) компактную кнопку прячем */
body.ff-sidebar-collapsed .shell-sidebar__theme-btn,
body.aa-sidebar-collapsed .shell-sidebar__theme-btn,
body.ac-sidebar-collapsed .shell-sidebar__theme-btn { display: none; }

/* ===== Колокольчик уведомлений ===== */
.notif { position: relative; }
.notif__bell {
    position: relative; border: 0; background: transparent; cursor: pointer;
    font-size: 20px; line-height: 1; padding: 6px 8px; border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}
.notif__bell:hover { background: var(--color-surface-2); }
.notif__badge {
    position: absolute; top: 0; right: 0;
    min-width: 17px; height: 17px; padding: 0 4px;
    background: var(--color-danger); color: #fff;
    border-radius: var(--radius-pill);
    font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}
.notif__panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: min(380px, calc(100vw - 24px));
    background: var(--color-surface);
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9000;
    overflow: hidden;
    animation: notif-in 140ms ease-out;
}
@keyframes notif-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.notif__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid var(--color-line);
}
.notif__readall {
    border: 0; background: transparent; color: var(--accent);
    font-size: 12px; font-weight: 600; cursor: pointer;
}
.notif__list { max-height: 60vh; overflow-y: auto; }
.notif__empty { padding: 28px 16px; text-align: center; color: var(--color-text-muted); font-size: var(--fs-sm); }
.notif__item {
    display: flex; gap: 10px; padding: 11px 14px;
    text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--color-line);
    transition: background var(--transition-fast);
}
.notif__item:hover { background: var(--color-surface-2); }
.notif__item.is-unread { background: var(--accent-soft); }
.notif__item.is-unread:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent) 10%); }
.notif__item-icon { font-size: 18px; line-height: 1.3; flex-shrink: 0; }
.notif__item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif__item-title { font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.notif__item-text { font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif__item-time { font-size: 11px; color: var(--color-text-soft); }

.shell-topbar__menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-text);
    align-items: center;
    justify-content: center;
}

/* ============== Admin top navigation (desktop) ==============
   Верхний уровень — спокойная текстовая полоса для ежедневного маршрута.
   Склад и редкие инструменты раскрываются отдельными рабочими панелями. */
.admin-topnav,
.admin-topnav-brand,
.admin-topnav-theme { display: none; }
.shell-topbar__title--admin-mobile { display: none; }

@media (min-width: 981px) {
    .app-shell--topnav { grid-template-columns: minmax(0, 1fr); }
    .app-shell--topnav > .shell-sidebar,
    .app-shell--topnav > .shell-sidebar__scrim { display: none; }

    .shell-topbar--admin-nav {
        min-height: 64px;
        padding: 0 clamp(16px, 2vw, 32px);
        gap: clamp(12px, 1.25vw, 20px);
        background: color-mix(in srgb, var(--color-surface) 98%, transparent);
        border-bottom-color: color-mix(in srgb, var(--color-line-strong) 70%, transparent);
        box-shadow: 0 1px 0 rgba(20, 31, 50, .03), 0 8px 24px rgba(20, 31, 50, .035);
    }

    .admin-topnav-brand {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        color: var(--color-text);
        text-decoration: none;
        flex: 0 0 auto;
    }
    .admin-topnav-brand__mark {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        border-radius: 10px;
        background: linear-gradient(145deg, #2f6fe4 0%, #4f46c8 100%);
        color: #fff;
        font-size: 12px;
        font-weight: var(--fw-black);
        letter-spacing: -0.03em;
        box-shadow: 0 5px 13px rgba(55, 85, 190, .2);
    }
    .admin-topnav-brand__copy {
        display: flex;
        flex-direction: column;
        line-height: 1.05;
    }
    .admin-topnav-brand__copy strong { font-size: 14px; font-weight: var(--fw-black); letter-spacing: -.015em; }
    .admin-topnav-brand__copy small {
        margin-top: 4px;
        color: var(--color-text-soft);
        font-size: 8.5px;
        font-weight: var(--fw-bold);
        letter-spacing: .12em;
        text-transform: uppercase;
    }

    .admin-topnav {
        display: flex;
        align-self: center;
        align-items: center;
        gap: 2px;
        height: 46px;
        padding: 3px;
        min-width: 0;
        flex: 1 1 auto;
        border: 1px solid color-mix(in srgb, var(--color-line-strong) 72%, transparent);
        border-radius: 12px;
        background: color-mix(in srgb, var(--color-bg-soft) 88%, var(--color-surface));
        box-shadow: inset 0 1px 2px rgba(20, 31, 50, .025);
    }
    .admin-topnav__group {
        position: relative;
        display: flex;
        align-items: stretch;
        flex: 0 0 auto;
    }
    .admin-topnav__summary,
    .admin-topnav__direct {
        position: relative;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 clamp(8px, .72vw, 12px);
        border: 1px solid transparent;
        border-radius: 8px;
        background: transparent;
        color: var(--color-text-muted);
        font-size: 12.5px;
        font-weight: var(--fw-semibold);
        line-height: 1;
        text-decoration: none;
        white-space: nowrap;
        cursor: pointer;
        list-style: none;
        transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    }
    .admin-topnav__direct { flex: 0 0 auto; }
    .admin-topnav__summary::-webkit-details-marker { display: none; }
    .admin-topnav__summary:focus,
    .admin-topnav__direct:focus { outline: none; }
    .admin-topnav__summary:focus-visible,
    .admin-topnav__direct:focus-visible {
        box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
    }
    .admin-topnav__summary:hover,
    .admin-topnav__direct:hover,
    .admin-topnav__group[open] > .admin-topnav__summary {
        color: var(--color-text);
        background: color-mix(in srgb, var(--color-surface) 82%, transparent);
        border-color: color-mix(in srgb, var(--color-line) 76%, transparent);
    }
    .admin-topnav__group.is-active > .admin-topnav__summary,
    .admin-topnav__direct.is-active {
        color: var(--color-text);
        font-weight: var(--fw-bold);
        background: var(--color-surface);
        border-color: color-mix(in srgb, var(--color-line-strong) 82%, transparent);
        box-shadow: 0 1px 3px rgba(20, 31, 50, .1), inset 0 -2px var(--accent);
    }
    .admin-topnav__group.is-active > .admin-topnav__summary .admin-topnav__direct-icon,
    .admin-topnav__direct.is-active .admin-topnav__direct-icon { color: var(--accent); }
    .admin-topnav__direct-icon {
        width: 16px;
        height: 16px;
        display: inline-grid;
        place-items: center;
        flex: 0 0 auto;
        color: var(--color-text-soft);
        transition: color var(--transition-fast);
    }
    .admin-topnav__icon-svg { display: block; width: 16px; height: 16px; }
    .admin-topnav__direct-label { display: inline-block; }
    .admin-topnav__caret {
        width: 6px;
        height: 6px;
        margin: -3px 0 0 -1px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: rotate(45deg);
        transition: transform var(--transition-fast), margin var(--transition-fast);
    }
    .admin-topnav__group[open] .admin-topnav__caret {
        margin-top: 3px;
        transform: rotate(225deg);
    }
    .admin-topnav__divider {
        align-self: center;
        width: 1px;
        height: 22px;
        margin: 0 3px;
        background: color-mix(in srgb, var(--color-line-strong) 72%, transparent);
    }
    .admin-topnav__divider--secondary { margin-left: 5px; }
    .admin-topnav__badge {
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-pill);
        background: var(--color-danger);
        color: #fff;
        font-size: 9px;
        font-weight: 800;
        line-height: 1;
    }
    .admin-topnav__direct.is-disabled,
    .admin-topnav__item.is-disabled { opacity: .42; pointer-events: none; }

    .admin-topnav__summary--more { padding-left: 9px; padding-right: 9px; }

    .admin-topnav__panel {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        z-index: calc(var(--z-topbar) + 2);
        width: min(560px, calc(100vw - 32px));
        padding: 12px;
        border: 1px solid var(--color-line-strong);
        border-radius: 14px;
        background: var(--color-surface);
        box-shadow: 0 20px 48px rgba(19, 28, 45, .14), 0 2px 8px rgba(19, 28, 45, .05);
        animation: admin-topnav-in 150ms ease-out;
    }
    .admin-topnav__panel--storage,
    .admin-topnav__panel--more { left: auto; right: 0; }
    @keyframes admin-topnav-in {
        from { opacity: 0; transform: translateY(-4px) scale(.99); }
        to { opacity: 1; transform: translateY(0); }
    }
    .admin-topnav__panel-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        padding: 7px 8px 13px;
        border-bottom: 1px solid var(--color-line);
        margin-bottom: 8px;
    }
    .admin-topnav__panel-head > div {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .admin-topnav__panel-head strong {
        color: var(--color-text);
        font-size: 14px;
        font-weight: var(--fw-black);
    }
    .admin-topnav__panel-head small {
        color: var(--color-text-muted);
        font-size: 11px;
        line-height: 1.3;
    }
    .admin-topnav__panel-count {
        flex: 0 0 auto;
        padding: 4px 7px;
        border-radius: var(--radius-pill);
        background: var(--color-surface-2);
        color: var(--color-text-soft);
        font-size: 9px;
        font-weight: var(--fw-bold);
        text-transform: uppercase;
        letter-spacing: .04em;
    }
    .admin-topnav__panel-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }
    .admin-topnav__item {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        min-height: 62px;
        padding: 10px 11px;
        border: 1px solid transparent;
        border-radius: 9px;
        color: var(--color-text);
        text-decoration: none;
        transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    }
    .admin-topnav__item:hover {
        background: var(--color-surface-2);
        border-color: var(--color-line);
    }
    .admin-topnav__item.is-active {
        background: var(--accent-soft);
        color: var(--accent);
    }
    .admin-topnav__item-mark {
        width: 30px;
        height: 30px;
        flex: 0 0 auto;
        display: grid;
        place-items: center;
        border: 1px solid var(--color-line);
        border-radius: 8px;
        background: var(--color-bg-soft);
        font-size: 14px;
        filter: grayscale(.9);
        opacity: .82;
    }
    .admin-topnav__item.is-active .admin-topnav__item-mark { background: var(--color-surface); filter: none; opacity: 1; }
    .admin-topnav__item-copy { display: flex; flex: 1 1 auto; min-width: 0; flex-direction: column; gap: 3px; }
    .admin-topnav__item-copy strong { font-size: 12px; line-height: 1.2; }
    .admin-topnav__item-copy small {
        color: var(--color-text-muted);
        font-size: 10px;
        font-weight: var(--fw-regular);
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .admin-topnav-theme {
        width: 38px;
        height: 38px;
        flex: 0 0 auto;
        place-items: center;
        border: 1px solid var(--color-line);
        border-radius: 10px;
        background: var(--color-surface);
        color: var(--color-text-muted);
        cursor: pointer;
    }
    .admin-topnav-theme:hover { background: var(--color-surface-2); border-color: var(--color-line-strong); }
    .shell-topbar--admin-nav .shell-topbar__actions { flex: 0 0 auto; gap: 8px; }
    .shell-topbar--admin-nav .shell-topbar__role-pill {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 4px 9px 4px 4px;
        border: 1px solid var(--color-line);
        border-radius: 10px;
        background: var(--color-surface);
        color: var(--color-text);
        font-size: 12px;
        font-weight: var(--fw-semibold);
        text-transform: none;
        letter-spacing: 0;
        transition: background var(--transition-fast), border-color var(--transition-fast);
    }
    .shell-topbar--admin-nav .shell-topbar__role-pill:hover {
        background: var(--color-surface-2);
        border-color: var(--color-line-strong);
    }
    .shell-topbar--admin-nav .shell-topbar__role-avatar {
        width: 30px;
        height: 30px;
        display: grid;
        place-items: center;
        border-radius: 8px;
        background: #172033;
        color: #fff;
        font-size: 11px;
        font-weight: var(--fw-black);
    }
}

@media (min-width: 981px) and (max-width: 1480px) {
    .admin-topnav-brand__copy { display: none; }
    .shell-topbar--admin-nav { gap: 10px; padding-left: 14px; padding-right: 14px; }
}

@media (min-width: 981px) and (max-width: 1260px) {
    .shell-topbar--admin-nav { gap: 8px; padding-left: 12px; padding-right: 12px; }
    .admin-topnav__summary,
    .admin-topnav__direct { padding-left: 6px; padding-right: 6px; gap: 4px; font-size: 11px; }
    .admin-topnav__direct-icon { width: 14px; height: 14px; }
    .admin-topnav__icon-svg { width: 14px; height: 14px; }
    .admin-topnav__divider { margin-left: 2px; margin-right: 2px; }
    .shell-topbar--admin-nav .shell-topbar__role-copy { display: none; }
    .shell-topbar--admin-nav .shell-topbar__role-pill { padding-right: 5px; }
}

@media (max-width: 980px) {
    .shell-topbar__title--admin-mobile { display: block; }
    .app-shell--topnav > .shell-sidebar { display: flex; }
}

/* ============== Bottom tabs (mobile) ============== */
.shell-bottom-tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--z-bottom-tabs);
    display: none;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3) calc(var(--space-2) + var(--safe-bottom));
    border-top: 1px solid var(--color-line);
    background: color-mix(in srgb, var(--color-bg) 92%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow-x: auto;
    scrollbar-width: none;
}
.shell-bottom-tabs::-webkit-scrollbar { display: none; }

.shell-bottom-tabs__item {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 72px;
    min-height: 52px;
    padding: 6px var(--space-3);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 10px;
    font-weight: var(--fw-bold);
    line-height: 1.1;
    text-decoration: none;
    white-space: nowrap;
}
.shell-bottom-tabs__item-icon { font-size: 18px; line-height: 1; }
.shell-bottom-tabs__item.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
}

/* Клиент: фиксированный набор из 5 важных вкладок — раскладываем равномерно на всю
   ширину экрана (без горизонтального скролла, чтобы «Поручения» не уезжали за край).
   Админ/бухгалтер оставляем на прокрутке — у них пунктов больше. */
body[data-role="user"] .shell-bottom-tabs {
    gap: 6px;
    padding-left: var(--space-2);
    padding-right: var(--space-2);
    overflow-x: hidden;
}
body[data-role="user"] .shell-bottom-tabs__item {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 2px;
    padding-right: 2px;
    font-size: 9px;
    letter-spacing: -0.01em;
}
body[data-role="user"] .shell-bottom-tabs__item > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============== Auth shell ============== */
.shell-auth {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--space-5);
    background:
        radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 60%),
        radial-gradient(800px 400px at 110% 110%, color-mix(in srgb, var(--accent) 12%, transparent) 0%, transparent 50%),
        var(--color-bg);
}

.shell-auth__panel {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-xl);
    padding: var(--space-7) var(--space-6);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.shell-auth__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    text-align: center;
}
.shell-auth__brand-mark {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: var(--accent-contrast);
    display: grid;
    place-items: center;
    font-size: var(--fs-xl);
    font-weight: var(--fw-black);
    letter-spacing: -0.02em;
}
.shell-auth__title { font-size: var(--fs-2xl); font-weight: var(--fw-black); line-height: 1; color: var(--color-text); }
.shell-auth__subtitle { color: var(--color-text-muted); font-size: var(--fs-sm); }

.shell-auth__footer { color: var(--color-text-muted); text-align: center; font-size: var(--fs-sm); }

/* ============== Responsive ============== */
@media (max-width: 980px) {
    .shell-sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100dvh;
        width: min(86vw, 320px);
        transform: translateX(-100%);
        transition: transform var(--transition-md);
        box-shadow: var(--shadow-lg);
    }
    body.is-sidebar-open .shell-sidebar { transform: translateX(0); }

    .shell-sidebar__scrim {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: calc(var(--z-sidebar) - 1);
    }
    body.is-sidebar-open .shell-sidebar__scrim { display: block; }

    .shell-topbar { padding: 0 var(--space-3); }
    .shell-topbar__menu-btn { display: inline-flex; }

    .shell-bottom-tabs { display: flex; }
    body[data-role="auth"] .shell-bottom-tabs,
    body[data-role="public"] .shell-bottom-tabs { display: none; }

    .shell-auth__panel { padding: var(--space-5) var(--space-4); border-radius: var(--radius-lg); }
}

/* ============== Sidebar collapse toggle + compact mode (desktop) ============== */
.shell-sidebar__collapse {
    display: none;  /* hidden on mobile (sidebar is off-canvas there) */
    align-items: center; gap: 6px;
    width: 100%; padding: 8px 10px;
    margin: 6px 0;
    border: 1px solid var(--color-line); border-radius: var(--radius-sm);
    background: var(--color-surface); color: var(--color-text-muted);
    font-size: 12px; font-weight: var(--fw-semibold); cursor: pointer;
}
.shell-sidebar__collapse:hover { background: var(--color-bg-soft); color: var(--color-text); }
@media (min-width: 981px) {
    .shell-sidebar__collapse { display: inline-flex; }
}
/* ---- Compact mode: только иконки + brand mark; работает для любой роли (ff/aa/ac). ---- */
body.ff-sidebar-collapsed .shell-sidebar,
body.aa-sidebar-collapsed .shell-sidebar,
body.ac-sidebar-collapsed .shell-sidebar {
    width: var(--sidebar-collapsed-width, 72px);
    padding-left: 4px; padding-right: 4px;
}
body.ff-sidebar-collapsed .shell-sidebar__brand-label,
body.aa-sidebar-collapsed .shell-sidebar__brand-label,
body.ac-sidebar-collapsed .shell-sidebar__brand-label,
body.ff-sidebar-collapsed .shell-sidebar__item-label,
body.aa-sidebar-collapsed .shell-sidebar__item-label,
body.ac-sidebar-collapsed .shell-sidebar__item-label,
body.ff-sidebar-collapsed .shell-sidebar__section-title,
body.aa-sidebar-collapsed .shell-sidebar__section-title,
body.ac-sidebar-collapsed .shell-sidebar__section-title,
body.ff-sidebar-collapsed .shell-sidebar__user-info,
body.aa-sidebar-collapsed .shell-sidebar__user-info,
body.ac-sidebar-collapsed .shell-sidebar__user-info,
body.ff-sidebar-collapsed .shell-sidebar__collapse-label,
body.aa-sidebar-collapsed .shell-sidebar__collapse-label,
body.ac-sidebar-collapsed .shell-sidebar__collapse-label,
body.ff-sidebar-collapsed .shell-sidebar__item-note,
body.aa-sidebar-collapsed .shell-sidebar__item-note,
body.ac-sidebar-collapsed .shell-sidebar__item-note {
    display: none;
}
body.ff-sidebar-collapsed .shell-sidebar__item,
body.aa-sidebar-collapsed .shell-sidebar__item,
body.ac-sidebar-collapsed .shell-sidebar__item,
body.ff-sidebar-collapsed .shell-sidebar__brand,
body.aa-sidebar-collapsed .shell-sidebar__brand,
body.ac-sidebar-collapsed .shell-sidebar__brand,
body.ff-sidebar-collapsed .shell-sidebar__collapse,
body.aa-sidebar-collapsed .shell-sidebar__collapse,
body.ac-sidebar-collapsed .shell-sidebar__collapse,
body.ff-sidebar-collapsed .shell-sidebar__user,
body.aa-sidebar-collapsed .shell-sidebar__user,
body.ac-sidebar-collapsed .shell-sidebar__user {
    justify-content: center; gap: 0;
}
/* main content расширяется когда сайдбар свёрнут (если grid-template-columns у app-shell) */
body.ff-sidebar-collapsed .app-shell,
body.aa-sidebar-collapsed .app-shell,
body.ac-sidebar-collapsed .app-shell {
    grid-template-columns: var(--sidebar-collapsed-width, 72px) 1fr;
}

/* Подкрутка nav: иконки покрупнее (эмодзи читаются лучше), активный пункт
   получает мягкое выделение, секции — лёгкий разделитель сверху. */
.shell-sidebar__item { padding: 9px var(--space-3); }
.shell-sidebar__item-icon { font-size: 18px; line-height: 1; width: 22px; }
.shell-sidebar__item.is-active {
    background: linear-gradient(90deg, var(--accent-soft), transparent 120%);
    color: var(--accent);
    font-weight: var(--fw-bold);
}
.shell-sidebar__item.is-active .shell-sidebar__item-icon { transform: scale(1.08); }
.shell-sidebar__nav { gap: var(--space-3); }
.shell-sidebar__section-title { padding: var(--space-2) var(--space-3) 2px; }
.shell-sidebar__section-title + .stack { gap: 2px; }
.shell-sidebar__item-lock { margin-left: auto; }
/* Свёрнуть/развернуть — сделать сдержаннее (не «кнопка-кирпич»). */
.shell-sidebar__collapse {
    border: 0; background: transparent; padding: 6px 10px;
    margin: 0 var(--space-3) var(--space-2);
    color: var(--color-text-soft); font-size: 11px;
    border-top: 1px solid var(--color-line); border-radius: 0;
    padding-top: 10px; justify-content: flex-start;
}
.shell-sidebar__collapse:hover { background: transparent; color: var(--accent); }

/* ===== Переключатель разделов каталога (Остатки/Браки/Комплекты) — общий для
   /products и /products/kits, чтобы переход между разделами не «прыгал». ===== */
.cat-seg { display: inline-flex; background: var(--color-surface-2); border: 1px solid var(--color-line); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.cat-seg__btn { border: 0; background: transparent; color: var(--color-text-muted); font-family: inherit; font-size: var(--fs-sm);
    font-weight: var(--fw-semibold); padding: 7px 16px; border-radius: var(--radius-pill); cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; transition: var(--transition-fast); }
.cat-seg__btn.is-active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
