/* Shared scrollbars for the page, dropdowns, tables and panels. */
:root {
    --scrollbar-thumb: #A3ADBD;
    --scrollbar-thumb-hover: #718099;
    --scrollbar-thumb-active: #2B3952;
    --scrollbar-size: 10px;
    --scrollbar-inset: 2px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.shell-menu {
    --scrollbar-thumb: rgba(170, 192, 206, 0.3);
    --scrollbar-thumb-hover: rgba(170, 192, 206, 0.45);
    --scrollbar-thumb-active: rgba(170, 192, 206, 0.45);
    --scrollbar-size: 5px;
    --scrollbar-inset: 0px;
    overscroll-behavior-y: contain;
}

/* Reveal the sidebar scrollbar on pointer or keyboard interaction.
   Keep its width reserved and preserve visibility on touch/high-contrast devices. */
@media (hover: hover) and (pointer: fine) and (forced-colors: none) {
    .app-sidebar:not(:hover):not(:focus-within) .shell-menu {
        --scrollbar-thumb: transparent;
        --scrollbar-thumb-hover: transparent;
        --scrollbar-thumb-active: transparent;
    }
}

.items-select-popup {
    --scrollbar-size: 8px;
    --scrollbar-inset: 1px;
}

/* Use rounded thumbs in browsers with scrollbar pseudo-elements. */
@supports selector(::-webkit-scrollbar) {
    @media (forced-colors: none) {
        * { scrollbar-width: auto; scrollbar-color: auto; }
        *::-webkit-scrollbar { width: var(--scrollbar-size); height: var(--scrollbar-size); }
        *::-webkit-scrollbar-track { background: transparent; margin: 4px; }
        *::-webkit-scrollbar-thumb {
            min-height: 28px;
            min-width: 28px;
            border: var(--scrollbar-inset) solid transparent;
            border-radius: 999px;
            background: var(--scrollbar-thumb);
            background-clip: padding-box;
        }
        *::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover); }
        *::-webkit-scrollbar-thumb:active { background-color: var(--scrollbar-thumb-active); }
        *::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
        *::-webkit-scrollbar-corner { background: transparent; }
        .shell-menu::-webkit-scrollbar-track { margin: 0; }
        .shell-menu::-webkit-scrollbar-thumb { min-height: 32px; }
    }
}

@media (forced-colors: active) {
    * { scrollbar-width: auto; scrollbar-color: auto; }
}
