/* TELEI shared scrollbar design. All screen surfaces use these tokens.
 * Local pages may change overflow/gutter geometry, never scrollbar styling.
 * Printing, native scrolling, keyboard and touch behavior are unchanged. */
@media screen {
  @layer telei-scrollbar-invariants {
    :root {
      --telei-scrollbar-size: 8px;
      --telei-scrollbar-track: #0b1b34;
      --telei-scrollbar-thumb: #5267a0;
      --telei-scrollbar-thumb-hover: #3ddacd;
      --telei-scrollbar-thumb-active: #4bafff;
    }

    :root, * {
      scrollbar-width: thin !important;
      scrollbar-color: var(--telei-scrollbar-thumb) var(--telei-scrollbar-track) !important;
    }

    /* Chromium's non-auto standard properties override WebKit decoration.
       Reset only scrollbar properties here, never the page's colour scheme. */
    @supports selector(::-webkit-scrollbar) {
      :root, * {
        scrollbar-width: auto !important;
        scrollbar-color: auto !important;
      }
      ::-webkit-scrollbar {
        inline-size: var(--telei-scrollbar-size) !important;
        block-size: var(--telei-scrollbar-size) !important;
        width: var(--telei-scrollbar-size) !important;
        height: var(--telei-scrollbar-size) !important;
      }
      ::-webkit-scrollbar-track,
      ::-webkit-scrollbar-corner {
        background: var(--telei-scrollbar-track) !important;
      }
      ::-webkit-scrollbar-thumb {
        min-block-size: 24px;
        background: var(--telei-scrollbar-thumb) !important;
        border: 2px solid var(--telei-scrollbar-track) !important;
        border-radius: 999px !important;
      }
      ::-webkit-scrollbar-thumb:hover {
        background: var(--telei-scrollbar-thumb-hover) !important;
      }
      ::-webkit-scrollbar-thumb:active {
        background: var(--telei-scrollbar-thumb-active) !important;
      }
      ::-webkit-scrollbar-button {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
      }
    }

    /* These existing controls deliberately use another scroll viewport.
       Keep their established hidden-bar behavior in this single component.
       New equivalent controls use the generic telei-scrollbar-hidden class. */
    .telei-scrollbar-hidden,
    .cc-fidelity .cc-kpi-amount,
    .ue-wb-table-wrap,
    .ue-sticky-header-scroll,
    .ue-ozon-grid.is-enhanced .ue-ozon-table-wrap {
      scrollbar-width: none !important;
    }
    .telei-scrollbar-hidden::-webkit-scrollbar,
    .cc-fidelity .cc-kpi-amount::-webkit-scrollbar,
    .ue-wb-table-wrap::-webkit-scrollbar,
    .ue-sticky-header-scroll::-webkit-scrollbar,
    .ue-ozon-grid.is-enhanced .ue-ozon-table-wrap::-webkit-scrollbar {
      display: none !important;
      width: 0 !important;
      height: 0 !important;
    }

    @media (forced-colors: active) {
      :root, * {
        scrollbar-color: auto !important;
        scrollbar-width: auto !important;
      }
      ::-webkit-scrollbar-track,
      ::-webkit-scrollbar-corner {
        forced-color-adjust: none !important;
        background: Canvas !important;
      }
      ::-webkit-scrollbar-thumb,
      ::-webkit-scrollbar-thumb:hover,
      ::-webkit-scrollbar-thumb:active {
        forced-color-adjust: none !important;
        background: ButtonText !important;
        border-color: Canvas !important;
      }
    }
  }
}
