/* Law reader navigation: identity and tools remain outside the scrolling index. */
.mley-law-sidebar { color: var(--text-color); background: var(--bg-surface); }
.mley-law-sidebar [hidden] { display: none !important; }
.mley-law-sidebar .sidebar-content { display: flex; flex-direction: column; overflow: hidden; }
.mley-law-sidebar .sidebar-brand { padding: .35rem .85rem; min-height: 36px; flex-shrink: 0; }
.mley-law-sidebar .sidebar-brand > span { font-size: .7rem; color: var(--text-muted); }
.mley-law-sidebar__identity { padding: 0 .85rem .5rem; flex-shrink: 0; }
.mley-law-sidebar__identity a { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-color); font-size: .85rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.mley-law-sidebar__identity span { display: block; font-size: .7rem; color: var(--text-muted); margin-top: .25rem; overflow-wrap: anywhere; }
.mley-law-sidebar__search { display: flex; margin: 0 .75rem .55rem; border: 1px solid var(--border-color); border-radius: .45rem; flex-shrink: 0; background: var(--bg-surface-2); }
.mley-law-sidebar__search input { width: 0; min-width: 0; flex: 1; border: 0; background: transparent; color: var(--text-color); padding: .55rem; font: inherit; font-size: .8rem; }
.mley-law-sidebar__search button { border: 0; border-radius: .4rem; min-width: 40px; background: transparent; color: var(--accent-color); cursor: pointer; }
.mley-law-sidebar .mley-saved-tabs { flex-shrink: 0; margin: 0 .75rem .35rem; }
.mley-law-sidebar .mley-sidebar-index-panel, .mley-law-sidebar .mley-saved-panel { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.mley-law-sidebar__index { padding: 0 .5rem .6rem; }
.mley-law-sidebar .sidebar-content > .mley-law-sidebar__index { overflow-y: auto; }
.mley-law-sidebar__locate { display: block; margin: .2rem .25rem .4rem; padding: .45rem; color: var(--accent-color); background: transparent; border: 0; font: inherit; font-size: .75rem; text-align: left; cursor: pointer; }
.mley-law-sidebar__status { font-size: .75rem; padding: .4rem; color: var(--text-muted); }
.mley-law-sidebar .mley-law-tree ul { margin: 0 0 .15rem .5rem; padding-left: .4rem; border-left: 1px solid var(--border-color); }
.mley-law-tree li { min-width: 0; }
.mley-law-tree a, .mley-law-tree button { display: block; width: 100%; box-sizing: border-box; min-height: 36px; padding: .5rem .55rem; color: var(--text-color); border: 0; border-radius: .3rem; background: transparent; font: inherit; font-size: .78rem; line-height: 1.35; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.mley-law-tree button { position: relative; padding-right: 1.2rem; font-weight: 600; }
.mley-law-tree button::after { content: ''; position: absolute; top: .85rem; right: .4rem; width: 6px; height: 6px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: rotate(-45deg); }
.mley-law-tree button[aria-expanded=true]::after { transform: rotate(45deg); }
.mley-law-tree small { display: block; font-size: .68rem; font-weight: 400; color: var(--text-muted); margin-top: .15rem; }
.mley-law-tree a:hover, .mley-law-tree button:hover { background: var(--bg-surface-2); }
.mley-law-tree a[aria-current] { color: var(--accent-color); background: var(--accent-color-soft); font-weight: 700; box-shadow: inset 3px 0 var(--accent-color); }
.mley-law-sidebar :is(a,button,input,summary):focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }
.mley-law-sidebar__bottom { border-top: 1px solid var(--border-color); flex-shrink: 0; background: var(--bg-surface); }
.mley-law-sidebar__tools summary { font-size: .78rem; font-weight: 600; padding: .65rem .85rem; cursor: pointer; }
.mley-law-sidebar__tools > div { max-height: 35vh; overflow-y: auto; padding: 0 .85rem .5rem; }
.mley-law-sidebar__tools a { display: block; padding: .5rem 0; font-size: .76rem; line-height: 1.4; color: var(--text-color); overflow-wrap: anywhere; }
.mley-law-sidebar__tools .mley-sidebar-official-links { margin: .35rem 0 0; padding: .35rem 0 0; }
.mley-law-sidebar__footer { display: flex; flex-wrap: wrap; gap: .2rem .85rem; padding: .2rem .85rem .55rem; }
.mley-law-sidebar__footer a { color: var(--text-muted); font-size: .7rem; padding: .35rem 0; }
.mley-law-sidebar .mley-saved-card { border: 0; border-radius: 0; border-bottom: 1px solid var(--border-color); background: transparent; }
.mley-saved-scope { display: flex; gap: .3rem; margin-bottom: .6rem; }
.mley-saved-scope button { flex: 1; padding: .45rem .4rem; min-height: 36px; background: transparent; border: 1px solid var(--border-color); border-radius: .4rem; color: var(--text-color); font: inherit; font-size: .75rem; cursor: pointer; }
.mley-saved-scope button[aria-pressed=true] { background: var(--accent-color-soft); color: var(--accent-color); border-color: var(--accent-color); }
@media (max-width:1080px) {
 .mley-law-sidebar :is(.mley-law-tree a,.mley-law-tree button,.mley-law-sidebar__search button,.mley-law-sidebar__locate,.mley-saved-tabs button,.mley-saved-remove,.mley-saved-scope button,.mley-sidebar-close) { min-height: 44px; }
 .mley-law-sidebar .mley-saved-remove, .mley-law-sidebar__search button { min-width: 44px; }
 .mley-law-sidebar__search input { font-size: 16px; }
 .mley-law-sidebar__tools summary { min-height: 44px; box-sizing: border-box; }
 .mley-law-sidebar__footer a { padding-block: .7rem; }
}

@media (min-width:1081px) {
 #sidebar.mley-law-sidebar { top: var(--law-header-height,61px); height: calc(100dvh - var(--law-header-height,61px)); max-height: calc(100dvh - var(--law-header-height,61px)); }
}

.mley-law-sidebar__locate { position: sticky; top: 0; z-index: 1; width: 100%; margin-inline: 0; background: var(--bg-surface); box-shadow: 0 1px 0 var(--border-color); }
/* Keep the index reachable on the legacy header until its responsive layout is deployed. */
@media (max-width:600px) {
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) { gap: 4px; padding-inline: 8px; }
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) .mley-navbar__primary { flex: 0 0 auto; gap: 4px; }
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) :is(#mley-nav-back,#mley-nav-forward) { display: none !important; }
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) > :is(button,.mley-navbar__theme-mobile),
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) .mley-navbar__primary > *,
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) .mley-navbar__theme-mobile > button { flex: 0 0 44px; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; gap: 2px; }
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) #mley-pdf-toggle [data-pdf-toggle-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
 body:has(.mley-law-sidebar) .mley-navbar-shell:not(:has(.mley-navbar__utilities)) #mley-pdf-toggle::after { content: 'PDF'; font-size: .7rem; }
}
