/* MediFlex v4.4-RC11 — collapsible Storybook repository filter sections */
body:not(.workspace-erd) #app > .nav {
  grid-template-rows: auto auto auto minmax(0, 1fr) !important;
}

.mf-repo-filter-section {
  min-width: 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 98%, var(--accent2));
}

.mf-repo-filter-section > summary {
  min-width: 0;
  min-height: 34px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) 18px;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 97%, var(--accent2));
  transition: background .16s ease, color .16s ease;
}

.mf-repo-filter-section > summary::-webkit-details-marker { display: none; }
.mf-repo-filter-section > summary::marker { content: ''; }
.mf-repo-filter-section > summary:hover {
  background: color-mix(in srgb, var(--panel2) 88%, var(--accent2));
}
.mf-repo-filter-section > summary:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: -2px;
}

.mf-repo-section-title {
  min-width: 0;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mf-repo-section-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.mf-repo-section-chevron {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 6px;
  background: var(--panel2);
}
.mf-repo-section-chevron::before {
  content: '›';
  display: block;
  font-size: 15px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .16s ease;
}
.mf-repo-filter-section[open] .mf-repo-section-chevron::before { transform: rotate(90deg); }
.mf-repo-filter-section[data-active-filter="true"] > summary {
  box-shadow: inset 3px 0 0 var(--accent);
}
.mf-repo-filter-section[data-active-filter="true"] .mf-repo-section-title { color: var(--accent); }

.mf-repo-section-body {
  min-width: 0;
  overflow: hidden;
  animation: mfRepoSectionReveal .14s ease-out;
}
@keyframes mfRepoSectionReveal {
  from { opacity: .35; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

.mf-repo-filter-section .filters {
  border: 0 !important;
  padding: 8px 10px 10px !important;
  background: transparent !important;
}

.mf-story-advanced-filters {
  display: block !important;
  padding: 0 !important;
  gap: 0 !important;
  border-bottom: 0 !important;
  background: var(--panel) !important;
}
.mf-story-advanced-filters .mf-repo-filter-section:last-child { border-bottom: 1px solid var(--line); }
.mf-story-advanced-filters .mf-advanced-scope,
.mf-story-advanced-filters .mf-repo-filter-grid,
.mf-story-advanced-filters .mf-advanced-filter-actions,
.mf-story-advanced-filters .mf-story-quick-jump,
.mf-story-advanced-filters .mf-advanced-count-detail {
  margin-left: 10px;
  margin-right: 10px;
}
.mf-story-advanced-filters .mf-advanced-scope { margin-top: 8px; margin-bottom: 9px; }
.mf-story-advanced-filters .mf-repo-filter-grid { padding: 8px 0 9px; }
.mf-story-advanced-filters .mf-repo-filter-grid:not(.mf-repo-navigation-grid) label:last-child { grid-column: auto; }
.mf-story-advanced-filters .mf-repo-navigation-grid { grid-template-columns: 1fr; padding-bottom: 6px; }
.mf-story-advanced-filters .mf-repo-navigation-grid label { grid-column: 1 / -1; }
.mf-story-advanced-filters .mf-advanced-filter-actions { margin-bottom: 7px; }
.mf-story-advanced-filters .mf-story-quick-jump { margin-bottom: 5px; }
.mf-story-advanced-filters .mf-advanced-count-detail { margin-top: 0; margin-bottom: 9px; }

body.mf-usability-ready #tree,
body.mf-usability-ready #tree[data-virtualized="true"] {
  min-height: 180px !important;
}

body.light .mf-repo-filter-section,
body.light .mf-repo-filter-section > summary {
  background: #f8fbff;
}
body.light .mf-repo-filter-section > summary:hover { background: #eef5fc; }

@media(max-width:800px) {
  body.mf-usability-ready #app > .nav {
    grid-template-rows: auto auto auto minmax(180px, 1fr) !important;
  }
  .mf-repo-section-summary { font-size: 8px; }
}

@media(prefers-reduced-motion:reduce) {
  .mf-repo-section-body { animation: none; }
  .mf-repo-section-chevron::before { transition: none; }
}
