/* Shared closing and recovery controls, loaded after both CSS bundles. */
.mley-panel-controls[hidden], [data-panel-restore][hidden], #mley-nav-sidebar-toggle[hidden],
#mley-law-guide-sources[hidden], #mleyV2Inspector[hidden] { display: none !important; }
.mley-panel-controls {
  display: flex; gap: .4rem; overflow-x: auto; align-items: center;
  padding: .25rem max(.5rem, env(safe-area-inset-right)) .35rem max(.5rem, env(safe-area-inset-left));
  scrollbar-width: thin; max-width: 100%; min-width: 0;
}
.mley-panel-controls > button { flex: 0 0 auto; min-height: 44px; white-space: nowrap; font-size: .8rem; }
.mley-panel-controls :focus-visible, [data-panel-close]:focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }
.mley-page-offset { padding-top: max(4.75rem, calc(var(--mley-header-height, 60px) + 1rem)); }
@media (max-width:79.999em) {
  .fixed-header .mley-navbar__panel {
    top: calc(var(--mley-header-height, 60px) + .25rem);
    max-height: calc(100dvh - var(--mley-header-height, 60px) - 1rem);
  }
}
.sidebar-wrapper .sidebar-brand {
  position: sticky; top: 0; z-index: 2; flex-shrink: 0;
  background: var(--bg-surface); display: flex; align-items: center; justify-content: space-between;
}
#sidebar.sidebar-wrapper .sidebar-brand #mley-sidebar-close, [data-panel-close] {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; min-width: 44px; height: 44px; padding: 0;
  color: var(--text-color); background: var(--bg-surface-2);
  border: 1px solid var(--border-color); border-radius: .5rem; cursor: pointer; font-size: 1.25rem;
}
.sidebar-wrapper .sidebar-brand #mley-sidebar-title { color: var(--text-color); }
#mley-nav-sidebar-toggle:not([hidden]) { display: inline-flex; }
.mley-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; position: sticky; top: 0; z-index: 2; background: var(--bg-surface); }
.mley-sources-hidden { grid-template-columns: minmax(0, 1fr); }
.mley-v2-topbar > .mley-panel-controls { grid-column: 1 / -1; }
body[data-page-kind="home-v2"].mley-inspector-hidden .mley-v2-workspace { grid-template-columns: minmax(0, 1fr); }
body[data-page-kind="home-v2"] .mley-v2-inspector__head { position: sticky; top: 0; z-index: 2; background: var(--v2-shell); }
body[data-page-kind="home-v2"] #mleyV2Inspector .mley-v2-inspector__close { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
.article-graph-details > .mley-panel-heading { margin-bottom: .5rem; }
@media (min-width:1081px) {
  body.mley-sidebar-collapsed #menu { display: none !important; }
  body.mley-sidebar-collapsed #panel { margin-left: 0 !important; }
  #sidebar.sidebar-wrapper { top: var(--mley-header-height, 60px); height: calc(100dvh - var(--mley-header-height, 60px)); max-height: calc(100dvh - var(--mley-header-height, 60px)); }
  body.mley-sidebar-collapsed #panel :is(.home-content-shell, #contain_id.ley-content-shell) { width: 100% !important; max-width: 100% !important; padding-inline: 1rem !important; }
}
@media print { .mley-panel-controls, [data-panel-close] { display: none !important; } }

@media (min-width:1081px) {
  body.mley-oaj-page.mley-sidebar-collapsed:not(.mley-reader-open):not(.mley-cjf-document-open) #panel { margin-left: 0 !important; width: 100%; }
  body.mley-oaj-page .mley-oaj-navbar #mley-nav-sidebar-toggle:not([hidden]) { display: inline-flex !important; }
}

/* Keep the home heading and tabs outside the independently scrolling panes. */
#sidebar.mley-home-sidebar {
  top: var(--mley-header-height, 60px);
  height: calc(100dvh - var(--mley-header-height, 60px));
  max-height: calc(100dvh - var(--mley-header-height, 60px));
  overflow: hidden;
}
#sidebar.mley-home-sidebar .sidebar-content {
  padding: .35rem .75rem .75rem;
}
#sidebar.mley-home-sidebar .sidebar-content:has(> .mley-saved-tabs) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#sidebar.mley-home-sidebar .sidebar-brand {
  position: static;
  flex: 0 0 auto;
  min-height: 52px;
  padding: .2rem 0 .4rem;
  border-bottom: 1px solid var(--border-color);
}
#sidebar.mley-home-sidebar #mley-sidebar-title {
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.4;
}
#sidebar.mley-home-sidebar .mley-saved-tabs {
  flex: 0 0 auto;
  margin: .6rem 0;
}
#sidebar.mley-home-sidebar :is(.mley-sidebar-index-panel, .mley-saved-panel) {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
