/* =============================================================================
   Sidebar FINAL — authoritative overrides (load last)
   Fixes: icon size/style, submenu primary hover, no layout shift
   ============================================================================= */

:root {
    --sb-primary: var(--primary);
    --sb-primary-hover: var(--primary-dark, var(--primary));
    --sb-icon: var(--primary);
}

/* Ensure sidebar subtree always inherits brand tokens */
#app-sidebar.side-bar {
    --sb-primary: var(--primary);
    --sb-primary-hover: var(--primary-dark, var(--primary));
    --sb-icon: var(--primary);
}

/* ── Top-level rows: small inset gap (hover + selected) ── */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li {
    padding: 3px 12px !important;
    border-bottom: 1px solid #e8edf2 !important;
    box-sizing: border-box !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a {
    margin: 0 !important;
    width: 100% !important;
    border-radius: 4px !important;
    border-bottom: 0 !important;
    box-sizing: border-box !important;
}

/* ── Kill legacy sidebar-admin icon chips & movement ── */
html[data-theme] #app-sidebar.side-bar .side-bar-manu > ul > li > a,
html[data-theme] #app-sidebar.side-bar .side-bar-manu > ul > li > a:hover,
html[data-theme] #app-sidebar.side-bar .side-bar-manu > ul > li.active > a,
html[data-theme] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown.active > a {
    transform: none !important;
    box-sizing: border-box !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu a,
html[data-theme] #app-sidebar.side-bar .side-bar-manu a:hover,
html[data-theme] #app-sidebar.side-bar .side-bar-manu a:active {
    transform: none !important;
}

/* ── Unified icon box (all menu levels) ── */
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon {
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    flex: 0 0 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: color 0.12s ease !important;
    overflow: visible !important;
    color: var(--sb-primary) !important;
    -webkit-text-fill-color: var(--sb-primary) !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon i,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon i.fas,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon i.fa-solid,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon i.fal,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon i.far,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon i::before,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-dropdown-arrow i,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-dropdown-arrow i::before,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .submenu-ico,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .submenu-ico::before {
    font-size: 16px !important;
    line-height: 1 !important;
    display: inline-block !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
    width: auto !important;
    height: auto !important;
    text-align: center !important;
    -webkit-font-smoothing: antialiased !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon svg,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon img {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    display: block !important;
    object-fit: contain !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon svg,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon svg * {
    fill: currentColor !important;
    stroke: currentColor !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu .sidebar-icon img {
    /* No hardcoded blue filter — keep monochrome; tint via parent color on FA icons */
    filter: none !important;
    opacity: 0.9 !important;
}

/* Top-level hover/active: white icons */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a:hover .sidebar-icon,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.active > a .sidebar-icon,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a.active .sidebar-icon,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown.active > a .sidebar-icon {
    color: #ffffff !important;
    background: transparent !important;
    transform: none !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a:hover .sidebar-icon img,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.active > a .sidebar-icon img,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown.active > a .sidebar-icon img {
    filter: brightness(0) invert(1) !important;
}

/* Submenu icons stay primary unless row is hovered */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul .sidebar-icon {
    color: var(--sb-primary) !important;
}

/* ── Top-level: primary background on hover & active ── */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.active > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a.active,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown.active > a {
    background: var(--sb-primary) !important;
    background-color: var(--sb-primary) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    border-bottom: 0 !important;
    border-radius: 4px !important;
}

/* ── Submenu rows: inset so blue bar has breathing room ── */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown > ul > li:not(.sidebar-group-label) {
    padding: 2px 14px !important;
    border-bottom: 0 !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav__section > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .sidebar-leaf-link {
    border-radius: 4px !important;
    border-bottom: 0 !important;
    padding: 0.5rem 0.875rem 0.5rem 1.15rem !important;
    box-sizing: border-box !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li.dropdown > ul > li > a {
    padding: 0.5rem 0.875rem 0.5rem 1.35rem !important;
}

/* ── Submenu hover: PRIMARY color (user request) ── */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown > ul > li > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li:not(.sidebar-group-label) > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav__section > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .sidebar-leaf-link:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .stock-items-nav > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .stock-items-nav__section > a:hover,
html[data-theme="light"] #app-sidebar.side-bar .sidebar-leaf-link:hover {
    background: var(--sb-primary) !important;
    background-color: var(--sb-primary) !important;
    color: #ffffff !important;
    transform: none !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover .sidebar-dropdown-arrow,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover .sidebar-dropdown-arrow i,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a:hover .sidebar-dropdown-arrow,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a:hover .sidebar-dropdown-arrow i,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav > a:hover .sidebar-dropdown-arrow,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav > a:hover .sidebar-section-chevron,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover .sidebar-icon,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover .submenu-ico {
    color: #ffffff !important;
}

/* Nested expanded / focused: primary bg + white text */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown > ul li.dropdown.active > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li.dropdown.active > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav.active > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav.is-open > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav__section.active > a,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav__section.is-open > a {
    background: var(--sb-primary) !important;
    background-color: var(--sb-primary) !important;
    color: #ffffff !important;
}

/* Active leaf page: primary fill + white text */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li:not(.sidebar-group-label) > a.active,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .sidebar-leaf-link.active,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul a.active {
    color: #ffffff !important;
    background: var(--sb-primary) !important;
    background-color: var(--sb-primary) !important;
    font-weight: 600 !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li:not(.sidebar-group-label) > a.active:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .sidebar-leaf-link.active:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul a.active:hover,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li.dropdown.active > a:hover {
    background: var(--sb-primary) !important;
    color: #ffffff !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown.active > a *,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul a.active * {
    color: #ffffff !important;
}

/* Submenu leaf icons */
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .submenu-ico {
    width: 14px !important;
    min-width: 14px !important;
    font-size: 13px !important;
    color: var(--sb-primary) !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    display: inline-block !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover .submenu-ico,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu .sidebar-leaf-link:hover .submenu-ico {
    color: #ffffff !important;
}

/* Carets — do not force transform:none (blocks RTL flip / open rotation) */
html[data-theme] #app-sidebar.side-bar .sidebar-dropdown-arrow,
html[data-theme] #app-sidebar.side-bar .sidebar-dropdown-arrow i,
html[data-theme] #app-sidebar.side-bar .sidebar-section-chevron {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--sb-primary) !important;
}

/* RTL uses fa-caret-left: closed ◀, open ▼ */
html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > a .sidebar-dropdown-arrow,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .stock-items-nav__section > a .sidebar-dropdown-arrow,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .sidebar-section-chevron {
    transform: translateY(-50%) !important;
}

html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown.active > a .sidebar-dropdown-arrow,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .stock-items-nav__section.is-open > a .sidebar-dropdown-arrow,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .sidebar-section-toggle.is-open .sidebar-section-chevron {
    transform: translateY(-50%) rotate(-90deg) !important;
}

html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a:hover .sidebar-dropdown-arrow,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li > a:hover .sidebar-dropdown-arrow i,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.active > a .sidebar-dropdown-arrow,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.active > a .sidebar-dropdown-arrow i,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown.active > a .sidebar-dropdown-arrow,
html[data-theme="light"] #app-sidebar.side-bar .side-bar-manu > ul > li.dropdown.active > a .sidebar-dropdown-arrow i {
    color: #ffffff !important;
}

/* Flat submenu panels — no nested boxes */
html[data-theme] #app-sidebar.side-bar .side-bar-manu ul,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .dropdown-menu,
html[data-theme] #app-sidebar.side-bar .stock-items-nav__panel,
html[data-theme] #app-sidebar.side-bar .sidebar-leaf-list,
html[data-theme] #app-sidebar.side-bar .stock-items-nav__section > ul,
html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul,
html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li.dropdown > ul {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* Dark mode submenu hover */
html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a:hover,
html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a:hover,
html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav > a:hover,
html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu .stock-items-nav__section > a:hover,
html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu .sidebar-leaf-link:hover {
    background: var(--sb-primary) !important;
    background-color: var(--sb-primary) !important;
    background-image: none !important;
    color: #ffffff !important;
}

html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu > ul > li {
    padding: 3px 12px !important;
}

html[data-theme="dark"] #app-sidebar.side-bar .side-bar-manu > ul > li > a {
    border-radius: 4px !important;
    border-bottom: 0 !important;
}

/* Dropdown alignment — reserve a dedicated caret column.
   Legacy rules positioned nested carets on the left where they collided with text. */
html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > a {
    display: flex !important;
    align-items: center !important;
    padding-right: 2.75rem !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > a > span:not(.sidebar-dropdown-arrow):not(.sidebar-icon) {
    min-width: 0;
    padding-right: 0.35rem;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > a .sidebar-dropdown-arrow,
html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a .sidebar-dropdown-arrow,
html[data-theme] #app-sidebar.side-bar .side-bar-manu li.stock-items-nav > a .sidebar-dropdown-arrow,
html[data-theme] #app-sidebar.side-bar .side-bar-manu .stock-items-nav__section > a .sidebar-dropdown-arrow {
    left: auto !important;
    right: 1rem !important;
    width: 1rem !important;
    height: 1rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 1rem !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
}

html[data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li + li {
    margin-top: 0.125rem !important;
}

html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu > ul > li {
    padding-right: 14px !important;
    padding-left: 10px !important;
}

html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > a {
    padding-right: 12px !important;
    padding-left: 2.75rem !important;
    text-align: right !important;
    overflow: visible !important;
}

html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu > ul > li > a .sidebar-icon {
    margin: 0 0 0 0.55rem !important;
    left: auto !important;
    right: auto !important;
    position: relative !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
}

html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > a .sidebar-dropdown-arrow,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a .sidebar-dropdown-arrow {
    right: auto !important;
    left: 0.75rem !important;
}

/* Nested submenu caret space on the left in RTL */
html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul li.dropdown > a {
    padding-right: 0.875rem !important;
    padding-left: 2.75rem !important;
}

html[dir="rtl"][data-theme] #app-sidebar.side-bar .side-bar-manu li.dropdown > ul > li > a,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .sidebar-leaf-link,
html[dir="rtl"][data-theme] #app-sidebar.side-bar .stock-items-nav__section > a {
    text-align: right !important;
    justify-content: flex-start !important;
    overflow: visible !important;
}
