/* Modern, accessible scrollbars shared by the kiosk and admin UI. */
:root[data-theme="dark"] {
  --scroll-thumb: #465166;
  --scroll-thumb-hover: #65738d;
  --scroll-thumb-active: #4f8cff;
}

:root[data-theme="light"] {
  --scroll-thumb: #b6c0d0;
  --scroll-thumb-hover: #8795aa;
  --scroll-thumb-active: #2a6fe0;
}

html {
  /* Keep the page from shifting when its vertical scrollbar appears. */
  scrollbar-gutter: stable;
}

* {
  /* Firefox. */
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

/* Chrome, Edge and Safari. The transparent border creates a slim floating
   pill while keeping the pointer target comfortably large. */
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  min-width: 44px;
  min-height: 44px;
  border: 3px solid transparent;
  border-radius: 999px;
  background-color: var(--scroll-thumb);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scroll-thumb-hover);
}

*::-webkit-scrollbar-thumb:active {
  background-color: var(--scroll-thumb-active);
}

/* Remove the legacy arrow buttons still shown by some Chromium/WebView
   versions on Windows. */
*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

/* The sidebar remains fully scrollable with a wheel, touch or keyboard, but
   its permanent inner rail only adds visual noise beside the navigation. */
nav {
  -ms-overflow-style: none;
  scrollbar-width: none;
  scrollbar-gutter: auto;
}

nav::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Dedicated vertical scrollers should not jump when content grows. */
:is(.modal, .face-modal .modal-body, .chk, ul.log) {
  scrollbar-gutter: stable;
}

/* Data tables need a slightly quieter horizontal control. */
.tbl-wrap::-webkit-scrollbar {
  height: 10px;
}

.tbl-wrap::-webkit-scrollbar-thumb {
  min-width: 56px;
  border-width: 2px;
}

@media (pointer: coarse) {
  *::-webkit-scrollbar {
    width: 14px;
    height: 14px;
  }
}

/* Respect the user's system contrast palette instead of forcing brand colors. */
@media (forced-colors: active) {
  * {
    scrollbar-color: auto;
  }

  *::-webkit-scrollbar-thumb {
    background-color: CanvasText;
  }
}

@media print {
  * {
    scrollbar-width: none;
  }

  *::-webkit-scrollbar {
    display: none;
  }
}
