/* Retain one document scroller and keep the workspace controls above its rows. */
body .page-shell [data-list-header] {
  position: sticky;
  top: var(--list-header-top);
  z-index: var(--list-header-layer);
  background: var(--app-canvas);
  background-attachment: fixed;
}
body .page-shell [data-list-header]::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: calc(-1 * var(--list-header-top)) 0 100%;
  /* Match the viewport canvas while still masking rows behind pinned controls. */
  background: var(--app-canvas);
  background-attachment: fixed;
  pointer-events: none;
}
body .page-shell :is(.tasks-list-titlebar, .family-list-titlebar, .family-list-titlebar__controls)[data-list-header] {
  background: var(--app-surface);
}

/* Repaint the whole panel cap, including its corners, when the panel itself
   scrolls away beneath its fixed controls. */
body .page-shell :is(.tasks-list-titlebar, .family-list-titlebar, .family-list-titlebar__controls)[data-list-header] {
  --list-panel-inline-inset: 1.125rem;
  --list-panel-radius: 8px;
}
body .page-shell :is(.tasks-list-titlebar, .family-list-titlebar, .family-list-titlebar__controls)[data-list-header]::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(-1 * var(--list-header-surface-inset, 1.125rem) - 1px);
  bottom: 0;
  left: calc(-1 * var(--list-panel-inline-inset) - 1px);
  right: calc(-1 * var(--list-panel-inline-inset) - 1px);
  border: 1px solid var(--app-line);
  border-bottom: 0;
  border-radius: var(--list-panel-radius) var(--list-panel-radius) 0 0;
  background: var(--app-surface);
  pointer-events: none;
}
body .page-shell :is(.tasks-list-titlebar, .family-list-titlebar, .family-list-titlebar__controls)[data-list-header]::before {
  z-index: -2;
  bottom: 0;
  left: calc(-1 * var(--list-panel-inline-inset) - 1px);
  right: calc(-1 * var(--list-panel-inline-inset) - 1px);
}
/* Editor backdrops can establish a different scrolling containing block. Their
   list is inert, so keep its normal geometry rather than pinning it twice. */
body .page-shell:has([data-canonical-editor-panel]) [data-list-header] {
  position: static;
}

@media (max-width: 760px) {
  [data-list-header] { --list-header-surface-inset: .9rem; }
  body .page-shell :is(.tasks-list-titlebar, .family-list-titlebar, .family-list-titlebar__controls)[data-list-header] {
    --list-panel-inline-inset: .82rem;
    --list-panel-radius: 1.22rem;
  }
  body .page-shell .tasks-list-panel .tasks-list-titlebar[data-list-header] {
    --list-panel-radius: 0;
  }
}
