/* R3I — right-side drawers float BELOW the always-visible login/session header.
   Layer order: content < rail (43) < backdrop (44) < drawer (45) < header (70).
   This is an additive geometry-only correction to R3H; no auth or JS changes. */

html { scrollbar-gutter: stable; }

.admin .topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  isolation: isolate;
}

.jdw-quick-rail {
  right: 11px;
  top: 108px;
  width: 46px;
  border: 1px solid #d6e4ec;
  border-radius: 12px;
  box-shadow: 0 10px 24px #173b5820;
}

.jdw-drawer-backdrop {
  top: 52px;
  right: 0;
  bottom: 0;
  left: 0;
  background: #17374d50;
}

.jdw-right-drawer {
  top: 65px;
  right: 12px;
  bottom: 12px;
  width: min(410px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100dvh - 77px);
  border: 1px solid #cadde8;
  border-radius: 15px;
  box-shadow: -8px 16px 48px #0c2b4245;
  transform: translateX(calc(100% + 26px));
  transition: transform .22s cubic-bezier(.2,.7,.24,1);
}

.jdw-right-drawer.is-open { transform: translateX(0); }
.jdw-drawer-header { border-radius: 14px 14px 0 0; }
.jdw-drawer-close { flex: none; }
.jdw-right-drawer:focus-within { outline-offset: -2px; }

/* The viewport remains stable; sliding never widens or shifts the content. */
.workspace-main, .admin .footer { min-width: 0; }
.admin .topbar .top-actions { min-width: 0; }

@media (max-width: 760px) {
  .jdw-quick-rail { right: 8px; width: 42px; top: 102px; }
  .jdw-quick-rail button { min-height: 46px; }
  .jdw-right-drawer { right: 9px; top: 62px; bottom: 9px; max-height: calc(100dvh - 71px); width: min(410px, calc(100vw - 18px)); }
}

@media (max-width: 580px) {
  .jdw-quick-rail { top: auto; bottom: 82px; right: 8px; width: 42px; }
  .jdw-drawer-backdrop { top: 54px; }
  .jdw-right-drawer { top: 62px; right: 7px; bottom: 8px; width: calc(100vw - 14px); max-height: calc(100dvh - 70px); padding: 0 14px 18px; }
  .jdw-drawer-header { flex-wrap: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .jdw-right-drawer { transition: none; }
}
