/* Keep accessibility controls on the left and the chat controls on the right. */
:root {
  --bv-tools-size: 56px;
  --bv-tools-edge: 24px;
  --bv-tools-gap: 16px;
  --bv-tools-bottom: calc(var(--bv-tools-edge) + env(safe-area-inset-bottom, 0px));
}
html body #bvchat-toggle {
  width: var(--bv-tools-size);
  height: var(--bv-tools-size);
  right: var(--bv-tools-edge);
  bottom: var(--bv-tools-bottom);
  z-index: 100010;
}
html body .uwy .userway_buttons_wrapper {
  right: auto !important;
  bottom: var(--bv-tools-bottom) !important;
  left: var(--bv-tools-edge) !important;
  top: auto !important;
  transform: none !important;
}
html body #userwayAccessibilityIcon,
html body #userwayAccessibilityIcon .uiiw,
html body #userwayAccessibilityIcon .ui_w,
html body #userwayAccessibilityIcon .ups,
html body #userwayAccessibilityIcon .si_w {
  width: var(--bv-tools-size) !important;
  height: var(--bv-tools-size) !important;
}
html body #userwayAccessibilityIcon .usr {
  width: calc(var(--bv-tools-size) + 20px) !important;
  height: calc(var(--bv-tools-size) + 20px) !important;
}
html body #bvchat-window { z-index: 2147483647; }
@media (min-width: 641px) {
  html body #bvchat-window {
    right: var(--bv-tools-edge);
    bottom: calc(var(--bv-tools-bottom) + var(--bv-tools-size) + var(--bv-tools-gap));
    max-height: calc(100dvh - var(--bv-tools-bottom) - var(--bv-tools-size) - var(--bv-tools-gap) - 16px);
  }
}
@media (max-width: 640px) {
  :root { --bv-tools-edge: 16px; }
}


/* Keep the Calculators flyout on the right, with room at desktop widths. */
@media (min-width: 1161px) {
  header.standard #main-nav .menu > li:has(> a[href$="/resources/"]) > .sub-menu {
    left: auto;
    right: clamp(0px, calc(1500px - 100vw), 180px);
  }
  header.standard #main-nav .menu > li > .sub-menu > li:has(> a[href$="/resources/calculators/"]) > .sub-menu {
    left: calc(100% - 1px);
    right: auto;
  }
}
