/* G4DMS navigation. Scoped to the main header so page grids and workspace frames keep their own styles. */
#appSystemMenu {
    --app-nav-ink: #17324d;
    --app-nav-muted: #71839b;
    --app-nav-blue: #1664d9;
    padding: 0;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%) !important;
    border-color: #e2eaf4 !important;
    box-shadow: 0 4px 18px rgb(26 57 94 / 5%);
}
#appSystemMenu > .container-fluid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) clamp(130px, 14vw, 210px) auto;
    grid-template-areas: "brand navigation search account";
    gap: 0 12px;
    align-items: center;
    padding: 0 14px !important;
    max-width: 100%;
    overflow: visible;
}
#appSystemMenu .app-brand {
    grid-area: brand;
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 10px;
    margin: 0;
    padding: 10px 0;
    color: var(--app-nav-ink);
    white-space: nowrap;
    word-break: normal;
    text-decoration: none;
}
#appSystemMenu .app-brand > img { border-radius: 10px; box-shadow: 0 3px 8px #17324d1a; }
#appSystemMenu .app-brand-copy { display: none; }
#appSystemMenu .app-brand-copy strong { font-size: 16px; font-weight: 750; letter-spacing: .5px; }
#appSystemMenu .app-brand-copy small { margin-top: 2px; color: var(--app-nav-muted); font-size: 11px; }
#appSystemMenu .navbar-collapse { grid-area: navigation; min-width: 0; border: 0; position: relative; }
#appSystemMenu .navbar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 3px;
    padding: 0;
    width: 100%;
    margin: 0;
    min-width: 0;
}
#appSystemMenu .navbar-nav > .nav-item { flex: 0 0 auto; }
#appSystemMenu .navbar-nav > .nav-item > .nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 9px;
    color: #42556e !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    transition: color .15s, background-color .15s;
}
#appSystemMenu .navbar-nav > .nav-item > .nav-link:hover,
#appSystemMenu .navbar-nav > .nav-item > .nav-link.show {
    color: var(--app-nav-blue) !important;
    background: #eaf2ff;
}
#appSystemMenu .navbar-nav > .nav-item > .nav-link img { width: 22px; height: 22px; object-fit: contain; margin: 0; }
#appSystemMenu .dropdown-toggle::after { margin-left: 4px; opacity: .55; }
#appSystemMenu .dropdown-menu {
    padding: 7px;
    margin-top: 5px;
    min-width: 250px;
    max-width: min(420px, calc(100vw - 24px));
    max-height: min(560px, calc(100dvh - 150px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #bdccdf transparent;
    border: 1px solid #e2eaf4;
    border-radius: 13px;
    box-shadow: 0 14px 40px rgb(22 47 80 / 15%);
    background: #fff;
    animation: none;
}
#appSystemMenu .dropdown-item {
    gap: 8px;
    padding: 10px 12px;
    min-height: 40px;
    border-radius: 7px;
    color: #364b65;
    font-size: 14px;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
}
#appSystemMenu .dropdown-item:hover,
#appSystemMenu .dropdown-item:focus { color: #165fc7; background: #eef5ff; }
#appSystemMenu .dropdown-divider { margin: 8px 6px; border: 0; border-top: 2px solid #b8c8dc; opacity: 1; }
#appSystemMenu .navbar-search-slot { grid-area: search; position: relative; width: 100%; min-width: 0; margin: 0; }
#appSystemMenu .navbar-search-slot > *:first-child { display: flex !important; align-items: center; width: 100%; min-width: 0; margin: 0 !important; }
#appSystemMenu .navbar-search-slot input[type="search"],
#appSystemMenu .navbar-search-slot input[type="text"] {
    width: 100% !important;
    min-width: 0;
    min-height: 38px;
    border-color: #dce5f0;
    background-color: #f5f8fc;
    border-radius: 10px;
    font-size: 13px;
}
#appSystemMenu .navbar-search-slot input:focus { background-color: #fff; border-color: #8eb7ee; box-shadow: 0 0 0 3px #1664d912; }
#appSystemMenu .navbar-search-slot kbd,
#appSystemMenu .navbar-search-slot [class*="shortcut"],
#appSystemMenu .navbar-search-slot [class*="hotkey"],
#appSystemMenu .navbar-search-slot [class*="keyboard"] { display: none !important; }
#appSystemMenu .navbar-search-slot #globalMenuSearchResults,
#appSystemMenu .navbar-search-slot [class*="menu-search-results"] {
    position: absolute !important;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 1000000;
    max-height: min(480px, calc(100dvh - 110px));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 12px;
    box-shadow: 0 14px 40px #17324d26;
}
#appSystemMenu .navbar-auth-slot { grid-area: account; justify-self: end; min-width: 0; max-width: 270px; }
#appSystemMenu .navbar-auth-slot .dropdown { min-width: 0; max-width: 100%; }
#appSystemMenu .navbar-auth-slot .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid #e0e7f1;
    border-radius: 10px;
    color: var(--app-nav-ink);
    font-size: 13px;
    background-color: #fff;
}
#appSystemMenu .navbar-auth-slot .btn:hover { background-color: #f2f7ff; border-color: #b9cfe9; }
#appSystemMenu .navbar-auth-slot img { margin-right: 0 !important; flex-shrink: 0; }
#appSystemMenu .app-account-name { display: none; }
#appSystemMenu .navbar-auth-slot .dropdown-toggle { width: 42px; height: 42px; padding: 4px; justify-content: center; border-radius: 50%; }
#appSystemMenu .navbar-auth-slot .dropdown-toggle::after { display: none; }
#appSystemMenu .app-account-label { padding: 8px 12px; font-size: 13px; font-weight: 600; color: #17324d; }
#appSystemMenu .navbar-toggler { grid-area: toggle; padding: 8px; border: 1px solid #dce5f0; border-radius: 9px; margin: 0; }
#appSystemMenu a:focus-visible,
#appSystemMenu button:focus-visible { outline: 3px solid #8bb8f7; outline-offset: 2px; }
@media (max-width: 991.98px) {
    #appSystemMenu > .container-fluid {
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas: "brand account toggle" "search search search" "navigation navigation navigation";
        gap: 0 10px;
        padding: 0 14px !important;
    }
    #appSystemMenu .navbar-auth-slot { max-width: min(240px, 40vw); }
    #appSystemMenu .navbar-search-slot { margin: 0 0 10px; }
    #appSystemMenu .navbar-collapse { max-height: calc(100dvh - 135px); overflow-y: auto; overscroll-behavior: contain; }
    #appSystemMenu .navbar-nav { flex-direction: column; align-items: stretch; gap: 3px; padding: 8px 0 12px; }
    #appSystemMenu .navbar-nav > .nav-item { width: 100%; }
    #appSystemMenu .navbar-nav > .nav-item > .nav-link { justify-content: flex-start; min-height: 44px; white-space: normal; }
    #appSystemMenu .navbar-nav .dropdown-toggle::after { margin-left: auto; }
    #appSystemMenu .navbar-nav .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        border: 0;
        border-left: 2px solid #dbe8f8;
        border-radius: 0;
        margin: 4px 0 8px;
        padding: 2px 0 2px 10px;
        background: #f8fbff;
    }
}
@media (max-width: 480px) {
    #appSystemMenu .app-brand-copy small { display: none; }
    #appSystemMenu .app-brand { gap: 7px; }
    #appSystemMenu .app-brand-copy strong { font-size: 14px; }
    #appSystemMenu .app-brand > img { width: 32px; height: 32px; }
    #appSystemMenu .navbar-auth-slot .app-account-name { max-width: 88px; }
    #appSystemMenu .navbar-auth-slot .btn { gap: 5px; padding: 5px 7px; }
}
@media (prefers-reduced-motion: reduce) {
    #appSystemMenu * { transition: none !important; animation: none !important; }
}
@media (max-width: 360px) {
    #appSystemMenu .app-brand-copy { display: none; }
}

/* Overflow groups keep the original permission-rendered links, without cloning them. */
#appSystemMenu .app-more-item { position: static; }
#appSystemMenu .app-more-button {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 11px;
    min-height: 38px; border: 1px solid #dce6f3; border-radius: 9px;
    background: #f4f8fe; color: #245c9f; font-size: 14px; white-space: nowrap;
}
#appSystemMenu .app-more-button[aria-expanded="true"] { background: #e6f0ff; border-color: #a9c7f0; }
#appSystemMenu .app-more-panel {
    position: absolute; top: calc(100% + 10px); right: 0; width: min(340px, calc(100vw - 24px));
    padding: 8px; max-height: calc(100dvh - 85px); overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border: 1px solid #e0e8f3; border-radius: 13px;
    box-shadow: 0 14px 40px rgb(22 47 80 / 16%); z-index: 1000000;
}
#appSystemMenu .app-more-item[hidden], #appSystemMenu .app-more-panel[hidden] { display: none !important; }
#appSystemMenu .app-more-list { list-style: none; padding: 0; margin: 0; }
#appSystemMenu .app-more-list > .nav-item { position: static !important; }
#appSystemMenu .app-more-list > .nav-item > .nav-link {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px;
    color: #42556e !important; font-size: 14px; white-space: normal;
}
#appSystemMenu .app-more-list > .nav-item > .nav-link:hover,
#appSystemMenu .app-more-list > .nav-item > .nav-link.show { background: #eef5ff; color: #1664d9 !important; }
#appSystemMenu .app-more-list > .nav-item > .nav-link img { width: 22px; height: 22px; object-fit: contain; }
#appSystemMenu .app-more-list > .nav-item > .dropdown-toggle::after { margin-left: auto; }
#appSystemMenu .app-more-list > .nav-item > .dropdown-menu {
    position: static !important; transform: none !important; translate: none !important;
    inset: auto !important; width: 100%; min-width: 0; max-width: 100%; max-height: none !important;
    overflow: visible; box-shadow: none; border: 0; border-left: 2px solid #dce9fa;
    border-radius: 0; margin: 4px 0 8px; background: #f8fbff;
}
@media (max-width: 991.98px) {
    #appSystemMenu > .container-fluid {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas: "brand search account toggle" "navigation navigation navigation navigation";
        gap: 0 8px;
    }
    #appSystemMenu .navbar-search-slot { margin: 0; }
    #appSystemMenu .navbar-collapse { border-top: 1px solid #edf1f7; max-height: calc(100dvh - 70px); }
    #appSystemMenu .app-more-item { display: none !important; }
    #appSystemMenu .navbar-toggler { padding: 5px; }
}
