/* Desktop navigation, independent of each page's UI framework. */
:root { --sidebar-width: clamp(18rem, 20vw, 19rem); }
/* The content width changes once per toggle; animating it reflows large tables every frame. */
body.has-shared-sidebar { padding-left: var(--sidebar-width); box-sizing: border-box; }
.shared-sidebar.app-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 45;
    display: flex; flex-direction: column;
    width: var(--sidebar-width); height: 100vh; min-height: 0;
    overflow: hidden; box-sizing: border-box;
    border-right: 1px solid #c9daf0; background: #fff;
    color: #21324b; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    box-shadow: 4px 0 24px rgba(24, 73, 130, .04);
    transform: translate3d(0, 0, 0);
    will-change: transform;
    transition: transform 180ms cubic-bezier(.22, 1, .36, 1);
}
.sidebar-collapse-toggle {
    position: fixed; top: 104px; left: 0; z-index: 46;
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 56px; padding: 0;
    border: 1px solid #b8d3f0; border-left: 0; border-radius: 0 10px 10px 0;
    background: #fff; color: #2469bc; cursor: pointer;
    box-shadow: 3px 4px 14px rgba(25, 74, 126, .12);
    transform: translate3d(calc(var(--sidebar-width) - 1px), 0, 0);
    will-change: transform;
    transition: transform 180ms cubic-bezier(.22, 1, .36, 1), background-color 160ms ease, box-shadow 160ms ease;
}
.sidebar-collapse-toggle svg { width: 16px; height: 16px; transition: transform 180ms ease; }
.sidebar-collapse-toggle:hover { background: #eaf3ff; box-shadow: 3px 4px 18px rgba(25, 74, 126, .18); }
.sidebar-collapse-toggle:focus-visible { outline: 2px solid #2672d0; outline-offset: 2px; }
body.sidebar-collapsed .shared-sidebar.app-sidebar { transform: translate3d(-100%, 0, 0); pointer-events: none; }
body.sidebar-collapsed .sidebar-collapse-toggle { transform: translate3d(0, 0, 0); }
body.sidebar-collapsed .sidebar-collapse-toggle svg { transform: rotate(180deg); }
body.sidebar-collapsed.has-shared-sidebar,
body.sidebar-collapsed.has-shared-sidebar[data-sidebar-load-user] { padding-left: 0; }
body.sidebar-collapsed .app-main { margin-left: 0; }
.shared-sidebar *, .shared-sidebar *::before, .shared-sidebar *::after { box-sizing: border-box; }
.shared-sidebar [hidden] { display: none !important; }
.shared-sidebar ul { list-style: none; padding: 0; margin: 0; }
.shared-sidebar li { margin: 0; padding: 0; }
.shared-sidebar #nav-menu li { position: relative; }
.shared-sidebar p, .shared-sidebar h1 { margin: 0; }
.shared-sidebar svg { display: block; width: 20px; height: 20px; flex: 0 0 auto; }
.shared-sidebar > div { flex: 0 0 auto; }
.shared-sidebar > div:first-child { padding: 24px; border-bottom: 1px solid #dce8f5; background: #f8fbff; }
.shared-sidebar > div > div { display: flex; align-items: center; gap: 12px; }
.shared-sidebar > div > div > div:first-child { width: 40px; height: 40px; flex: 0 0 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: #e8f1ff; }
.shared-sidebar > div:first-child > div > div:first-child { background: white; border: 1px solid #c9daf0; }
.shared-sidebar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.shared-sidebar h1 { font-size: 18px; font-weight: 700; color: #14243d; }
.shared-sidebar p { font-size: 12px; color: #60748d; }
.shared-sidebar .sidebar-nav { flex: 1 1 0%; overflow-y: auto; overflow-x: hidden; min-height: 0; padding: 16px; scrollbar-gutter: stable; overscroll-behavior: contain; scrollbar-color: #c8d9ed transparent; }
.shared-sidebar .sidebar-nav::-webkit-scrollbar { width: 8px; }
.shared-sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: #c8d9ed; border: 2px solid #fff; border-radius: 8px; }
.shared-sidebar #nav-menu > li + li { margin-top: 4px; }
.shared-sidebar .nav-item, .shared-sidebar .nav-item-sub {
    display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0;
    margin: 0; border: 0; padding: 12px 16px; border-radius: 12px;
    background: transparent; color: #263950; font: inherit; text-align: left;
    text-decoration: none; cursor: pointer; box-shadow: none; position: relative;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.shared-sidebar .nav-item-sub { padding: 10px 16px; border-radius: 8px; color: #4b6079; }
.shared-sidebar #nav-menu li > .nav-item, .shared-sidebar #nav-menu li > .nav-item-sub { padding-right: 52px; }
.shared-sidebar .sidebar-pin-button {
    position: absolute; top: 7px; right: 8px;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 6px; border: 0; border-radius: 8px;
    background: transparent; color: #8296ad; opacity: .8; cursor: pointer;
}
.shared-sidebar li > .nav-item-sub ~ .sidebar-pin-button { top: 4px; }
.shared-sidebar .sidebar-pin-button svg { width: 17px; height: 17px; }
.shared-sidebar .sidebar-pin-button:hover, .shared-sidebar .sidebar-pin-button:focus-visible,
.shared-sidebar .sidebar-pinned > .sidebar-pin-button { background: #e8f1ff; color: #2563b8; opacity: 1; }
.shared-sidebar .sidebar-pin-button:focus-visible { outline: 2px solid #2563b8; outline-offset: 1px; }
.shared-sidebar .nav-item-sub svg { width: 16px; height: 16px; }
.shared-sidebar .nav-item > span, .shared-sidebar .nav-item-sub > span, .shared-sidebar .nav-dropdown-trigger > div > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.shared-sidebar .nav-dropdown-trigger { justify-content: space-between; }
.shared-sidebar .nav-dropdown-trigger > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.shared-sidebar .nav-dropdown-trigger > svg { width: 16px; height: 16px; }
/* Expanded folders indicate hierarchy; only the current page gets an accent. */
.shared-sidebar .nav-item:hover, .shared-sidebar .nav-item-sub:hover {
    background: #f0f6ff; color: #1250a0; transform: none;
}
.shared-sidebar .nav-item::before, .shared-sidebar .nav-item-sub::before { display: none; }
.shared-sidebar .nav-dropdown-trigger.nav-dropdown-active {
    background: #f8fbff; color: #21324b;
    box-shadow: inset 0 0 0 1px #d4e3f5;
}
.shared-sidebar .nav-dropdown-trigger.nav-dropdown-active:hover { background: #f0f6ff; }
.shared-sidebar .nav-dropdown-trigger > div > svg { color: #54718f; }
.shared-sidebar .nav-dropdown-trigger > svg { color: #3774b9; }
.shared-sidebar .nav-dropdown-trigger[aria-expanded="true"] > svg { color: #1f5ea9; }
.shared-sidebar .nav-item:not(.nav-dropdown-trigger).active, .shared-sidebar .nav-item-sub.active {
    background: #e8f2ff; color: #164a8c; font-weight: 700;
    box-shadow: inset 0 0 0 1px #b7d2f3;
}
.shared-sidebar .nav-item:not(.nav-dropdown-trigger).active:hover, .shared-sidebar .nav-item-sub.active:hover { background: #dfedff; }
.shared-sidebar .nav-item:not(.nav-dropdown-trigger).active > svg, .shared-sidebar .nav-item-sub.active > svg { color: #2168b8; }
.shared-sidebar .nav-item:not(.nav-dropdown-trigger).active::before, .shared-sidebar .nav-item-sub.active::before {
    content: ''; display: block; position: absolute; left: 0; top: 50%; bottom: auto;
    width: 3px; height: 18px; border-radius: 0 3px 3px 0;
    background: #2672d0; transform: translateY(-50%); transition: none;
}
.shared-sidebar .nav-item:focus-visible, .shared-sidebar .nav-item-sub:focus-visible, .shared-sidebar #logout-btn:focus-visible { outline: 2px solid #2672d0; outline-offset: -2px; }
.shared-sidebar .nav-submenu { display: none; margin: 8px 0 0 24px; max-height: none; opacity: 1; transform: none; }
.shared-sidebar .nav-submenu > li + li { margin-top: 4px; }
.shared-sidebar .nav-submenu.open { display: block; max-height: none; }
/* Nested feature folders stay unfilled so only the current page looks selected. */
.shared-sidebar #product-performance-submenu > .nav-feature-group { margin: 6px 0; }
.shared-sidebar #office-process-submenu > .nav-feature-group { margin: 6px 0; }
.shared-sidebar #data-process-submenu > .nav-feature-group { margin: 6px 0; }
.shared-sidebar #nav-menu .nav-feature-group > .nav-feature-trigger {
    min-height: 36px; padding: 5px 50px 5px 7px;
    border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: #34506d;
}
.shared-sidebar #nav-menu .nav-feature-group > .nav-feature-trigger.nav-dropdown-active {
    background: transparent; border-color: transparent; color: #34506d;
    box-shadow: none;
}
.shared-sidebar #nav-menu .nav-feature-group > .nav-feature-trigger:hover,
.shared-sidebar #nav-menu .nav-feature-group > .nav-feature-trigger.nav-dropdown-active:hover {
    background: #f0f6ff; border-color: transparent; color: #1250a0;
}
.shared-sidebar .nav-feature-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
.shared-sidebar .nav-feature-code {
    flex: 0 0 auto; padding: 2px 6px; border: 1px solid #a8c8ec; border-radius: 5px;
    background: #edf5ff; color: #2466ab; font-size: 11px; font-weight: 700; line-height: 1.3;
}
.shared-sidebar .nav-feature-trigger .nav-feature-title { min-width: 0; font-size: 12px; font-weight: 500; white-space: nowrap; }
.shared-sidebar #nav-menu .nav-feature-trigger > svg {
    width: 22px; height: 22px; padding: 2px;
    border: 1px solid #a8c8ec; border-radius: 6px;
    background: #edf5ff; color: #2466ab;
}
.shared-sidebar #nav-menu .nav-feature-trigger > svg path { stroke-width: 3; }
.shared-sidebar #nav-menu .nav-feature-trigger[aria-expanded="true"] > svg {
    border-color: #8cb8ea; background: #e2f0ff; color: #155aa5;
}
.shared-sidebar .nav-feature-group > .sidebar-pin-button { top: 2px; }
.shared-sidebar #nav-menu .nav-feature-menu {
    margin: 5px 0 9px; padding: 3px 0 2px 11px;
    border-left: 1px solid #bfd5ec;
}
.shared-sidebar #nav-menu .nav-feature-menu > li + li { margin-top: 2px; }
.shared-sidebar #nav-menu .nav-feature-menu > li::before {
    content: ''; position: absolute; top: 18px; left: -11px; width: 9px;
    border-top: 1px solid #bfd5ec;
}
.shared-sidebar #nav-menu .nav-feature-menu li > .nav-feature-link {
    min-height: 36px; gap: 7px; padding: 7px 41px 7px 8px;
    border-radius: 7px; font-size: 12px;
}
.shared-sidebar #nav-menu .nav-feature-menu .nav-feature-main > .nav-feature-link {
    background: transparent; color: #2b4866; font-weight: 600;
}
.shared-sidebar #nav-menu .nav-feature-menu .nav-feature-child > .nav-feature-link { padding-left: 13px; color: #526b85; }
.shared-sidebar .nav-feature-entry-code {
    flex: 0 0 35px; padding: 2px 1px; border-radius: 4px;
    background: #e6f1ff; color: #2565a8; font-size: 10px; font-weight: 700;
    line-height: 1.35; text-align: center;
}
.shared-sidebar .nav-feature-child .nav-feature-entry-code { background: #f0f6fd; color: #557496; font-weight: 500; }
.shared-sidebar .nav-feature-entry-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-sidebar #nav-menu .nav-feature-menu .nav-feature-link:hover { background: #f0f6ff; color: #1250a0; }
.shared-sidebar #nav-menu .nav-feature-menu .nav-feature-link.active {
    background: #e8f2ff; color: #164a8c; box-shadow: inset 0 0 0 1px #b7d2f3;
}
.shared-sidebar [aria-expanded="true"] > svg { transform: rotate(180deg); }
.shared-sidebar > div:last-child { padding: 16px; border-top: 1px solid #dce8f5; background: #f8fbff; }
.shared-sidebar > div:last-child > div > div:nth-child(2) { flex: 1; min-width: 0; }
.shared-sidebar #user-name { color: #14243d; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-sidebar #logout-btn { display: block; flex: 0 0 auto; padding: 8px; border: 0; background: transparent; color: #60748d; cursor: pointer; }
.shared-sidebar #logout-btn:hover { color: #f87171; }
.sidebar-login-link { position: fixed; top: 16px; left: 16px; z-index: 100; padding: 10px 16px; border: 1px solid #bfd5ec; border-radius: 10px; background: #fff; color: #164a8c; text-decoration: none; }

body.has-shared-sidebar[data-sidebar-load-user] { padding-left: calc(var(--sidebar-width) + 20px); }

@media (prefers-reduced-motion: reduce) {
    .shared-sidebar .nav-item, .shared-sidebar .nav-item-sub { transition: none; }
    .shared-sidebar.app-sidebar, .sidebar-collapse-toggle, .sidebar-collapse-toggle svg,
    body.has-shared-sidebar, .app-main { transition: none; }
}
