/* Shared, fixed-height navigation. Reading controls belong to the reader. */
.mley-site-header,
.mley-header-search-dialog,
.mley-reading-controls {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-color);
}
.fixed-header.mley-site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: none;
}
.mley-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 60px;
  padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
}
.mley-header-control,
.mley-header-brand,
.mley-header-context,
.mley-reading-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-color);
  font: inherit;
  font-size: 14px;
  line-height: 1.25;
  text-decoration: none;
  box-sizing: border-box;
}
.mley-header-control { cursor: pointer; }
.mley-header-row .mley-header-control { height: 44px; }
.mley-header-control:hover,
.mley-header-brand:hover,
.mley-header-context[href]:hover,
.mley-reading-controls button:not(:disabled):hover {
  color: var(--text-color);
  background: var(--bg-surface-2);
  text-decoration: none;
}
.mley-header-control[aria-expanded="true"] { background: var(--surface-accent); color: var(--accent-color); }
.mley-site-header :is(a, button):focus-visible,
.mley-header-search-dialog :is(button, input, select):focus-visible,
.mley-reading-controls button:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
.mley-header-brand { padding: 6px 12px 6px 4px; font-weight: 750; letter-spacing: -.03em; font-size: 17px; }
.mley-header-brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--surface-accent);
  color: var(--accent-color);
  font-size: 17px;
  letter-spacing: -.06em;
}
.mley-header-context {
  flex: 0 1 auto;
  justify-content: flex-start;
  min-width: 0;
  max-width: 240px;
  font-weight: 600;
  border-radius: 4px;
}
.mley-header-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mley-header-context i { flex: 0 0 auto; font-size: 10px; }
.mley-header-row .mley-header-search-trigger {
  flex: 1 1 280px;
  justify-content: flex-start;
  min-width: 130px;
  max-width: 720px;
  margin-left: auto;
  padding-inline: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.mley-header-search-trigger__scope { margin-left: auto; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mley-header-row .mley-saved-toggle { min-width: 44px; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-color); }
.mley-header-row .mley-saved-toggle:hover { background: var(--bg-surface-2); }
.mley-header-row .mley-pdf-toggle { min-width: 44px; max-width: 44px; padding: 0; font-size: 12px; font-weight: 700; }
.mley-header-control[hidden], .mley-header-search-dialog[hidden], .mley-header-search-backdrop[hidden] { display: none; }
.mley-header-search-backdrop { position: fixed; inset: 0; z-index: 1100; background: rgb(0 0 0 / .28); }
.mley-header-search-dialog {
  position: fixed;
  top: max(76px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1101;
  width: min(620px, calc(100% - 32px));
  max-height: calc(100dvh - 100px);
  overflow: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 20px 24px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
.mley-header-search-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.mley-header-search-heading h2 { margin: 0; font: inherit; font-size: 20px; font-weight: 700; }
#mley-header-search-form label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
#mley-header-search-form :is(input[type="search"], select) {
  min-height: 48px;
  min-width: 0;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface-2);
  color: var(--text-color);
  font: inherit;
  font-size: 16px;
}
.mley-header-query-row { display: flex; gap: 8px; }
.mley-header-search-submit { flex: 0 0 auto; min-height: 48px; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--accent-color); color: var(--bg-surface); font: inherit; font-weight: 650; cursor: pointer; }
.mley-header-search-submit:hover { filter: brightness(.92); }
.mley-header-search-hint { margin: 12px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.mley-reading-controls { display: flex; justify-content: space-between; gap: 8px; margin: 12px 0; }
.mley-reading-controls button { font-size: 13px; cursor: pointer; }
.mley-reading-controls button:disabled { opacity: .5; cursor: default; }
#sidebar .mley-sidebar-site-menu { flex: 0 1 auto; overflow: auto; max-height: 48dvh; border-bottom: 1px solid var(--border-color); }
#sidebar .mley-sidebar-site-menu summary { min-height: 44px; padding: 12px 4px; box-sizing: border-box; font-size: 13px; font-weight: 600; cursor: pointer; }
#sidebar .mley-sidebar-site-menu .mley-site-navigation { max-height: none; margin: 0; overflow: visible; border: 0; }
#sidebar .mley-sidebar-site-menu .mley-theme-toggle { min-height: 44px; width: 100%; padding: 8px 4px; border: 0; border-radius: 6px; justify-content: flex-start; color: var(--text-color); background: var(--bg-surface-2); font: inherit; font-size: 12px; }
@media (max-width: 1080px) { .mley-header-saved-label { display: none; } }
@media (max-width: 767px) {
  .mley-header-row { gap: 4px; padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  .mley-header-brand { width: 44px; padding: 0; }
  .mley-header-brand__name { display: none; }
  .mley-header-context { flex: 1 1 0; max-width: none; gap: 4px; padding-inline: 2px; font-size: 13px; }
  .mley-header-row .mley-header-search-trigger { flex: 0 0 44px; min-width: 44px; width: 44px; padding: 0; justify-content: center; border: 0; background: transparent; color: var(--text-color); }
  .mley-header-search-trigger__text, .mley-header-search-trigger__scope { display: none; }
  .mley-header-search-dialog { padding: 12px 16px 20px; border-radius: 12px; }
}
@media print { .mley-site-header, .mley-header-search-dialog, .mley-header-search-backdrop, .mley-reading-controls { display: none !important; } }

#sidebar.mley-app-sidebar { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.mley-law-index-filter label { display: block; margin: 8px 0 6px; font-size: 12px; font-weight: 600; }
.mley-law-index-filter input { box-sizing: border-box; width: 100%; min-height: 44px; padding: 8px; font: inherit; font-size: 16px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-surface-2); color: var(--text-color); }
.mley-law-index-filter__status { margin: 6px 0; font-size: 12px; color: var(--text-muted); }
#mley-index-filter-results :is(a, button) { display: block; min-height: 44px; width: 100%; padding: 10px 4px; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--border-color); background: transparent; text-align: left; font: inherit; font-size: 13px; color: var(--accent-color); }
