/**
 * Operational sidebar — uses :root from custom-colors.css (--primary-color, etc.)
 */

:root {
    --erp-sidebar-width: 268px;
    --erp-sidebar-border: rgba(var(--primary-rgb), 0.12);
    --erp-sidebar-active-bg: rgba(var(--primary-rgb), 0.08);
}

.top-layout-page > .app-shell-body {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
}

.erp-sidebar {
    flex: 0 0 var(--erp-sidebar-width);
    width: var(--erp-sidebar-width);
    max-width: 100%;
    background: var(--surface, #fff);
    border-right: 1px solid var(--erp-sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 1030;
}

.erp-sidebar-inner {
    position: sticky;
    top: calc(var(--header-total-height, 134px));
    max-height: calc(100vh - var(--header-total-height, 134px));
    overflow-y: auto;
}

.erp-sidebar-group-toggle {
    width: 100%;
    text-align: start;
    border: 0;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.erp-sidebar-group-toggle:hover {
    background: var(--erp-sidebar-active-bg);
}

.erp-sidebar-group-toggle[aria-expanded="true"] .erp-sidebar-chevron {
    transform: rotate(180deg);
}

.erp-sidebar-chevron {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    opacity: 0.7;
}

.erp-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 1rem 0.4rem 1.15rem;
    font-size: 0.9rem;
    color: var(--brand-dark, #07152F);
    text-decoration: none;
    border-inline-start: 3px solid transparent;
}

.erp-sidebar-link:hover {
    background: rgba(var(--primary-rgb), 0.05);
    color: var(--primary-color);
}

.erp-action-bar {
    width: 100%;
}

.erp-sidebar-link.is-active {
    background: var(--brand-teal-light, #B8F2E6);
    border-inline-start-color: var(--brand-primary);
    color: var(--brand-teal-dark, #007A63);
    font-weight: 600;
}

[data-theme-mode="dark"] .erp-sidebar {
    background: var(--brand-dark, #07152F);
}

[data-theme-mode="dark"] .erp-sidebar-link {
    color: #fff;
}

[data-theme-mode="dark"] .erp-sidebar-link.is-active {
    background: rgba(var(--primary-rgb), 0.16);
    color: var(--brand-primary);
    box-shadow: inset 0 0 12px rgba(var(--primary-rgb), 0.12);
}

[data-theme-mode="dark"] .erp-sidebar-group-toggle {
    color: var(--brand-teal-light, #B8F2E6);
}

@media (max-width: 991.98px) {
    .erp-sidebar {
        position: fixed;
        left: 0;
        top: var(--header-total-height, 134px);
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    }

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

    .erp-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: var(--header-total-height, 134px) 0 0 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1025;
    }

    .erp-sidebar-backdrop.is-visible {
        display: block;
    }
}

.erp-workflow-timeline__item:last-child {
    padding-bottom: 0 !important;
}

.erp-toast-area {
    max-width: min(22rem, 100vw - 2rem);
}
