/* Sidebar presentation only: module > section > screen. Preserve native details and NavLink behavior. */
@media screen {
    html body.erp-formal-theme .premium-light-sidebar .nav-tree { padding-inline:10px; }

    /* A module is a distinct heading, not another screen link. */
    html body.erp-formal-theme .premium-light-sidebar .system-group { margin-block:8px; }
    html body.erp-formal-theme .premium-light-sidebar .system-group > summary {
        min-height:46px; margin:0; padding:9px 10px; gap:8px;
        color:#f2f7fb; background:#29475d; border:1px solid #466176;
        border-radius:9px; font-size:.88rem; font-weight:700; line-height:1.6;
        box-shadow:none!important;
    }
    html body.erp-formal-theme .premium-light-sidebar .system-group > summary > i {
        color:#d7ebf6!important; background:#ffffff0c; border-color:#ffffff14;
        flex:0 0 27px; width:27px; height:27px; border-radius:7px;
    }
    html body.erp-formal-theme .premium-light-sidebar .system-group > summary:hover { background:#34566e; color:#fff; }
    html body.erp-formal-theme .premium-light-sidebar .system-group[open] > summary { border-color:#7895a8; }
    html body.erp-formal-theme .premium-light-sidebar .system-group:has(.nav-link.active) > summary {
        background:#29475d; color:#fff; border-color:#86b9bf; box-shadow:none!important;
    }

    /* Logical insets keep the same tree structure in Arabic and English. */
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items {
        margin:5px 0 8px; margin-inline-start:12px;
        padding:0; padding-inline-start:10px;
        border:0; border-inline-start:1px solid #58768a;
    }
    html body.erp-formal-theme .premium-light-sidebar .system-group > .nav-group-items { margin-inline-start:13px; }
    html body.erp-formal-theme .premium-light-sidebar [data-nav-key="systems"] > .nav-group-items {
        margin-inline:0; padding-inline:0; border:0;
    }
    html body.erp-formal-theme .premium-light-sidebar [data-nav-key="systems"] > summary {
        min-height:32px; padding:4px 8px; color:#adc4d3; background:transparent;
        font-size:.73rem; font-weight:500; box-shadow:none;
    }

    /* Subsections retain a folder/chevron, but use a flatter, smaller heading. */
    html body.erp-formal-theme .premium-light-sidebar .nested-group:not(.system-group) > summary {
        min-height:36px; margin:6px 0 3px; padding:6px 8px; gap:7px;
        color:#d8e7f0; background:#ffffff09; border:1px solid #ffffff12;
        border-radius:6px; font-size:.8rem; font-weight:650; line-height:1.65; box-shadow:none;
    }
    html body.erp-formal-theme .premium-light-sidebar .nested-group:not(.system-group) > summary > i {
        flex:0 0 18px; width:18px; color:#a8c1d2!important; font-size:.95rem;
    }
    html body.erp-formal-theme .premium-light-sidebar .nested-group:not(.system-group):has(.nav-link.active) > summary {
        color:#e4f7f4; background:#ffffff0d; border-inline-start:2px solid #8fc8c1;
    }

    /* Leaf screens stay light. Branch strokes make parentage visible without extra colors. */
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link {
        min-height:36px; padding:6px 8px; margin:2px 0; gap:7px;
        font-size:.8rem; font-weight:400; line-height:1.65;
        color:#c4d5e1; background:transparent; border:1px solid transparent;
        border-radius:6px; transform:none; box-shadow:none; overflow-wrap:anywhere;
    }
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link > i {
        flex:0 0 18px; width:18px; margin-inline:0; font-size:.9rem; color:#96b3c5!important;
    }
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link::before {
        display:block; content:""; position:absolute; right:auto; left:auto;
        inset-inline-start:-11px; top:50%; width:9px; height:1px;
        background:#58768a; pointer-events:none;
    }
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link:hover { color:#fff; background:#ffffff0c; }
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link.active {
        color:#fff; background:#14777c; border-color:#54a9a8; border-inline-start:3px solid #9bede0;
        font-weight:650; box-shadow:none!important;
    }
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link.active > i { color:#e0fff8!important; }
    html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link.active::before { background:#9bede0; }

    /* CSS chevrons remain visible even if the external icon font is unavailable. */
    html body.erp-formal-theme .premium-light-sidebar .nav-group > summary::after {
        content:""; width:7px; height:7px; flex:0 0 7px;
        margin-inline-start:auto; margin-inline-end:2px; border-right:1.5px solid currentColor;
        border-bottom:1.5px solid currentColor; color:inherit; background:none;
        transform:rotate(135deg); transition:transform .15s ease;
    }
    html[dir="ltr"] body.erp-formal-theme .premium-light-sidebar .nav-group > summary::after { transform:rotate(-45deg); }
    html body.erp-formal-theme .premium-light-sidebar .nav-group[open] > summary::after { transform:rotate(45deg); }
    html body.erp-formal-theme .premium-light-sidebar :is(summary,.nav-link):focus-visible {
        outline:2px solid #bce9ed; outline-offset:2px;
    }
    @media (max-width:767.98px), (pointer:coarse) {
        html body.erp-formal-theme .premium-light-sidebar .nested-group:not(.system-group) > summary,
        html body.erp-formal-theme .premium-light-sidebar .nav-group-items .nav-item > .nav-link { min-height:44px; }
    }
    @media (prefers-reduced-motion:reduce) {
        html body.erp-formal-theme .premium-light-sidebar .nav-group > summary::after { transition:none; }
    }
}
