/* The shared sidebar shell owns layout for every public module. */
#sidebar.mley-app-sidebar {
  position: fixed; inset: var(--mley-header-height, 61px) auto 0 0;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 0;
  width: 220px; max-width: 320px; height: calc(100dvh - var(--mley-header-height, 61px));
  max-height: calc(100dvh - var(--mley-header-height, 61px)); min-height: 0;
  margin: 0; padding: 0; overflow: hidden; box-sizing: border-box;
  background: var(--bg-surface, #fff); color: var(--text-color, #25323e);
  border-right: 1px solid var(--border-color, #dce2e8); font-family: inherit;
}
#sidebar.mley-app-sidebar *, #sidebar.mley-app-sidebar *::before, #sidebar.mley-app-sidebar *::after { box-sizing: border-box; }
#sidebar.mley-app-sidebar [hidden] { display: none !important; }
#sidebar.mley-app-sidebar .sidebar-content {
  display: flex; flex-direction: column; flex: 1 1 0; min-height: 0;
  padding: .35rem .75rem 0; overflow: hidden; height: auto;
}
#sidebar.mley-app-sidebar .sidebar-brand {
  position: static; display: flex; align-items: center; justify-content: space-between;
  flex: 0 0 auto; min-height: 52px; padding: .2rem 0 .4rem;
  border-bottom: 1px solid var(--border-color); background: var(--bg-surface);
}
#sidebar.mley-app-sidebar #mley-sidebar-title { color: var(--text-color); font-size: .85rem; font-weight: 700; line-height: 1.4; }
#sidebar.mley-app-sidebar #mley-sidebar-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; min-width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--border-color); border-radius: .5rem; cursor: pointer;
  color: var(--text-color); background: var(--bg-surface-2); font: inherit; font-size: 1.5rem;
}
#sidebar.mley-app-sidebar ul { list-style: none; padding: 0; }
#sidebar.mley-app-sidebar a { text-decoration: none; }
#sidebar.mley-app-sidebar .mley-site-navigation {
  flex: 0 1 auto; min-height: 44px; max-height: 34dvh; margin: .4rem 0 0;
  padding: 0 0 .4rem; overflow-y: auto; overscroll-behavior: contain;
  border-bottom: 1px solid var(--border-color); scrollbar-width: thin;
}
#sidebar.mley-app-sidebar .mley-site-navigation li { margin: 0; }
#sidebar.mley-app-sidebar .mley-site-navigation a {
  display: flex; align-items: center; min-height: 44px; gap: .6rem;
  padding: .45rem .5rem; border-left: 2px solid transparent; border-radius: 8px;
  line-height: 1.35; color: var(--text-color); font-size: .8rem;
}
#sidebar.mley-app-sidebar .mley-site-navigation a:hover { background: var(--bg-surface-2); }
#sidebar.mley-app-sidebar .mley-site-navigation a[aria-current] { border-left-color: var(--navigation-icon-accent, var(--accent-color)); background: var(--bg-surface-2); font-weight: 700; }
.mley-site-navigation .mley-navigation-icon { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mley-site-navigation a span { min-width: 0; }
#sidebar.mley-app-sidebar :is(a, button, input, summary):focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }
#sidebar.mley-app-sidebar .mley-saved-tabs { flex: 0 0 auto; margin: .6rem 0; }
#sidebar.mley-app-sidebar :is(.mley-sidebar-index-panel, .mley-saved-panel),
#sidebar.mley-app-sidebar .sidebar-content > .mley-sidebar-context {
  flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-gutter: stable;
}
#sidebar.mley-app-sidebar .mley-saved-panel { padding-inline: 0; }
#sidebar.mley-app-sidebar .mley-app-sidebar-footer {
  position: static; display: flex; flex: 0 0 auto; justify-content: space-around;
  width: 100%; padding: 0 .5rem; border-top: 1px solid var(--border-color);
  background: var(--bg-surface); box-shadow: none; font-size: .74rem;
}
#sidebar.mley-app-sidebar .mley-app-sidebar-footer a { display: inline-flex; align-items: center; min-height: 44px; padding: .35rem; color: var(--text-muted); }
#sidebar.mley-app-sidebar .mley-home-sidebar-recents { margin-top: .45rem; }
#sidebar.mley-app-sidebar .mley-home-sidebar-hint { margin-bottom: .5rem; }
#sidebar.mley-app-sidebar .mley-sidebar-recents-disclosure > summary { min-height: 44px; padding: .65rem .4rem; font-size: .78rem; cursor: pointer; }
#sidebar.mley-app-sidebar .mley-law-sidebar__identity { padding: .35rem .25rem .5rem; }
#sidebar.mley-app-sidebar .mley-law-sidebar__search { margin-inline: 0; }
#sidebar.mley-app-sidebar .mley-law-sidebar__index { padding-inline: 0; }
#sidebar.mley-app-sidebar .mley-law-sidebar__tools summary { padding-inline: .4rem; }
#sidebar.mley-app-sidebar .mley-law-sidebar__tools > div { padding-inline: .4rem; }
@media (min-width: 1081px) {
  #menu:has(.mley-app-sidebar) { display: block; }
  body.mley-sidebar-collapsed #menu:has(.mley-app-sidebar) { display: none !important; }
  body:has(.mley-app-sidebar):not(.mley-sidebar-collapsed) #panel { margin-left: 220px; }
  body.mley-sidebar-collapsed #panel { margin-left: 0 !important; }
  body[data-page-kind="home-v2"]:not(.mley-sidebar-collapsed) #panel { width: calc(100% - 220px); }
  body[data-page-kind="not-found"] #panel { margin-right: 0; }
  body.mley-sidebar-collapsed .mley-oaj-navbar #mley-nav-sidebar-toggle:not([hidden]) { display: inline-flex !important; }
}
@media (max-width: 1080px) {
  html.mley-sidebar-open, body.mley-sidebar-open { overflow: hidden; }
  #sidebar.mley-app-sidebar {
    top: 0; bottom: 0; width: min(86vw, 320px); height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }
  #sidebar.mley-app-sidebar .mley-saved-tabs button { min-height: 44px; }
}
@media (max-height: 620px) {
  #sidebar.mley-app-sidebar .sidebar-content { padding-block: 0; }
  #sidebar.mley-app-sidebar .mley-site-navigation { max-height: 26dvh; }
  #sidebar.mley-app-sidebar .sidebar-brand { min-height: 44px; padding-block: 0; }
  #sidebar.mley-app-sidebar .mley-saved-tabs { margin-block: .25rem; }
  #sidebar.mley-app-sidebar :is(.mley-sidebar-index-panel, .mley-saved-panel) { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { #sidebar.mley-app-sidebar { transition: none; } }
@media print { #menu:has(.mley-app-sidebar), #mley-nav-sidebar-toggle { display: none !important; } body:has(.mley-app-sidebar) #panel { margin-left: 0 !important; } }

.mley-home-sidebar-recents h2 {
  margin: 0;
  padding-inline: 0.4rem;
  color: var(--text-color);
  font-size: 0.78rem;
  font-weight: 700;
}

.mley-home-sidebar-hint {
  margin: 0.25rem 0 0.35rem;
  padding-inline: 0.4rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.mley-home-recent-item {
  display: grid;
  gap: 0.15rem;
  min-height: 44px;
  padding: 0.45rem 0.4rem;
  color: var(--text-color);
  font-size: 0.76rem;
  line-height: 1.4;
}

.mley-home-recent-key {
  color: var(--brand-color);
  font-size: 0.7rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mley-home-recent-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.mley-home-recents-toggle {
  min-height: 44px;
  padding: 0.45rem 0.4rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-color);
  font-size: 0.76rem;
  cursor: pointer;
}

.mley-home-recent-empty {
  margin: 0;
  padding: 0.4rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.mley-home-sidebar-tools {
  margin-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

.mley-home-sidebar-tools summary {
  min-height: 44px;
  padding: 0.85rem 0.4rem 0.5rem;
  color: var(--text-color);
  font-size: 0.76rem;
  cursor: pointer;
}

.mley-home-sidebar-tools a {
  justify-content: space-between;
  font-size: 0.76rem;
}


.mley-site-menu-button { gap: .4rem; width: auto !important; padding-inline: .7rem !important; }
.mley-site-menu-button span { font-size: .8rem; }
@media (max-width: 480px) {
  /* The accessible names remain explicit; short labels fit the compact toolbar. */
  .fixed-header [data-collapse-label="herramientas"] > span { display: none; }
  .fixed-header [data-collapse-label="herramientas"]::after { content: "Más"; font-size: .8rem; }
}
