/* Shared by the app, Studio frames and Quick Quote shadow roots. */
:root, :host {
  --studio-scroll-thumb: #c2c2c2;
  --studio-scroll-track: #fafafa;
  --studio-scroll-edge: #e8e8e8;
  --studio-scroll-width: 14px;
}

/* Limit the app shell to Studio/Quick Quote; leave staff and classic pages alone. */
:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])),
:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *,
:host * {
  scrollbar-color: var(--studio-scroll-thumb) var(--studio-scroll-track) !important;
  scrollbar-width: thin !important;
}

/* Blink/WebKit support exact dimensions; standard colors otherwise override their pseudo-elements. */
@supports selector(::-webkit-scrollbar) {
  :is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])),
  :is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *,
  :host * {
    scrollbar-width: auto !important;
    scrollbar-color: auto !important;
  }
}

:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars]))::-webkit-scrollbar,
:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *::-webkit-scrollbar,
:host *::-webkit-scrollbar {
  display: block !important;
  width: calc(var(--studio-scroll-width) / var(--studio-scroll-scale, 1)) !important;
  height: calc(var(--studio-scroll-width) / var(--studio-scroll-scale, 1)) !important;
}

:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars]))::-webkit-scrollbar-track,
:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *::-webkit-scrollbar-track,
:host *::-webkit-scrollbar-track {
  background: var(--studio-scroll-track) !important;
  border: 0 !important;
  border-left: 1px solid var(--studio-scroll-edge) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars]))::-webkit-scrollbar-thumb,
:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *::-webkit-scrollbar-thumb,
:host *::-webkit-scrollbar-thumb {
  background: var(--studio-scroll-thumb) !important;
  background-clip: padding-box !important;
  border: calc(2px / var(--studio-scroll-scale, 1)) solid transparent !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  min-height: calc(32px / var(--studio-scroll-scale, 1)) !important;
}

:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars]))::-webkit-scrollbar-button,
:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *::-webkit-scrollbar-button,
:host *::-webkit-scrollbar-button {
  display: none !important;
}

:is(html.ps-mode, html.ps-lab-mode, html:has(iframe[src*="&ps=1"]), html:has([data-studio-scrollbars])) *::-webkit-scrollbar-corner,
:host *::-webkit-scrollbar-corner {
  background: var(--studio-scroll-track) !important;
}

.ps-lab-mode .add-product-overlay {
  --studio-scroll-scale: var(--ps-fit, 1);
}

/* Replace the miniature duplicated ink-picker bar with the same native scrollbar. */
.ps-lab-mode #swapPop .ui-sb { visibility: hidden; }