/* One native scroll treatment for pages, menus, tables and form controls. */
:root {
  --scrollbar-size: 8px;
  --scrollbar-thumb: #b09078;
  --scrollbar-thumb-hover: #b96132;
}

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

nav,
.nav-panel,
.mobile-navigation,
.account-dropdown,
.sidebar {
  --scrollbar-size: 6px;
}

.sidebar {
  --scrollbar-thumb: #987c67;
  --scrollbar-thumb-hover: #edaa7d;
}

.mobile-navigation {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Keep the page behind the modal from showing a second scrollbar. */
html:has(.mobile-navigation[open]) {
  overflow: hidden;
}

@supports selector(::-webkit-scrollbar) {
  /* Standard scrollbar properties otherwise override the rounded thumb in Chromium. */
  * {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }

  /* Component-level thin scrollbars would bypass the rounded Chromium styling. */
  .record-tabs {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }

  *::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
    background: transparent;
  }

  *::-webkit-scrollbar-track {
    background: transparent;
    border: 0;
    box-shadow: none;
    margin: 4px;
  }

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

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

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

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

/* Let the operating system supply high-contrast scroll controls when requested. */
@media (forced-colors: active) {
  * {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }

  *::-webkit-scrollbar,
  *::-webkit-scrollbar-track,
  *::-webkit-scrollbar-thumb,
  *::-webkit-scrollbar-button,
  *::-webkit-scrollbar-corner {
    all: revert;
  }
}
