/* Global shell layout — must not rely on Blazor scoped CSS */

.erp-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.06), transparent 28%),
        var(--bg-page);
}

.erp-sidebar-backdrop {
    display: none;
}

.erp-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    border-right: 1px solid rgba(230, 226, 240, 0.95);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1040;
    transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.erp-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px var(--space-3);
    min-height: var(--topbar-height);
    border-bottom: 1px solid var(--border-soft);
}

.erp-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: -0.02em;
    min-width: 0;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.erp-brand-link:hover {
    opacity: 0.88;
    color: var(--text-main);
}

.erp-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--brand-600), #7C3AED);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.erp-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.erp-sidebar-footer {
    margin-top: auto;
    padding: var(--space-3);
    border-top: 1px solid var(--border-soft);
}

.erp-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.erp-topbar {
    min-height: 68px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(230, 226, 240, 0.95);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.erp-topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.erp-topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.erp-topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    min-width: 0;
    flex-wrap: wrap;
}

.erp-topbar-search {
    min-width: 220px;
    max-width: 300px;
}

.erp-topbar-title-wrap {
    min-width: 0;
}

.erp-topbar-kicker {
    font-size: 0.6875rem;
    color: var(--brand-600);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.erp-topbar-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--brand-50);
    border: 1px solid #DDD6FE;
    color: #4338CA;
    font-size: 0.8125rem;
    font-weight: 650;
    max-width: 220px;
}

.erp-context-pill span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-context-pill-wb {
    background: #F0FDF4;
    border-color: #BBF7D0;
    color: #166534;
}

.erp-content {
    padding: var(--space-5) var(--space-4) var(--space-7);
    width: 100%;
}

.erp-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.9);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    cursor: pointer;
    padding: 0;
}

.erp-icon-btn:hover {
    background: var(--brand-50);
    color: var(--brand-600);
    border-color: #C7D2FE;
    transform: translateY(-1px);
}

.erp-logout-btn:hover {
    color: #DC2626;
    background: #FEF2F2;
    border-color: #FECACA;
}

.erp-notify-btn {
    position: relative;
}

.erp-notify-dot {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #EF4444;
    border: 2px solid #fff;
}

.erp-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.92);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.erp-user-chip:hover {
    background: #fff;
    border-color: #C7D2FE;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.1);
}

.erp-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--brand-100), #DDD6FE);
    color: var(--brand-600);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.erp-user-meta {
    min-width: 0;
    text-align: left;
}

.erp-user-name {
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.erp-user-role {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.erp-user-chevron {
    color: var(--text-secondary);
}

.erp-shell.sidebar-collapsed .erp-sidebar {
    width: var(--sidebar-collapsed-width);
}

.erp-shell.sidebar-collapsed .erp-brand-text {
    display: none;
}

/* Navigation */
.app-nav-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) var(--space-2) var(--space-4);
}

.app-nav-section {
    margin-bottom: 8px;
}

.app-nav-section-settings {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-soft);
}

.app-nav-link,
.app-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    width: 100%;
    padding: 0 14px;
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    font-family: inherit;
}

.app-nav-group-toggle {
    justify-content: space-between;
}

.app-nav-group-left {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-nav-link:hover,
.app-nav-group-toggle:hover {
    background: var(--brand-50);
    color: var(--text-main);
    transform: translateX(2px);
}

.app-nav-link.active {
    background: linear-gradient(135deg, var(--brand-600), #6366F1);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.28);
}

.app-nav-link.active .app-icon {
    color: #fff;
}

.app-nav-sublink {
    min-height: 38px;
    padding-left: 42px;
    font-size: 0.8125rem;
    font-weight: 550;
}

.app-nav-sublink.active {
    background: var(--brand-100);
    color: var(--brand-600);
    font-weight: 700;
}

.app-nav-subitems {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    margin-bottom: 6px;
    padding-left: 4px;
}

.app-nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-nav-chevron {
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.app-nav-group-toggle.expanded .app-nav-chevron {
    transform: rotate(0deg);
}

.erp-shell.sidebar-collapsed .app-nav-label,
.erp-shell.sidebar-collapsed .app-nav-chevron,
.erp-shell.sidebar-collapsed .app-nav-subitems {
    display: none;
}

.erp-shell.sidebar-collapsed .app-nav-link,
.erp-shell.sidebar-collapsed .app-nav-group-toggle {
    justify-content: center;
    padding: 0;
    width: 46px;
    margin-inline: auto;
}

.erp-shell.sidebar-collapsed .app-nav-group-left {
    justify-content: center;
}

@media (max-width: 1023.98px) {
    .erp-topbar {
        grid-template-columns: 1fr;
    }

    .erp-topbar-center {
        display: none;
    }

    .erp-shell.nav-open {
        overflow: hidden;
        height: 100dvh;
    }

    .erp-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: var(--shadow-soft);
    }

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

    .erp-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(17, 24, 39, 0.35);
        backdrop-filter: blur(2px);
    }

    .erp-shell.nav-open .erp-sidebar-backdrop {
        display: block;
    }

    .erp-content {
        padding: var(--space-4) var(--space-3);
    }

    .erp-topbar {
        padding: var(--space-2) var(--space-3);
    }

    .erp-topbar-search {
        order: 3;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
}
