/* Library sub-navigation: Songs | Collections | Sets. A slim row of plain links directly under the "Library" title,
   sitting on the coral page rule. The current tab is a teal outline with a pastel fill (the selection treatment). */
.library-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin: 0.5rem 0 0;
}

.library-tabs__tab {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 1rem;
  border: 1.5px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.library-tabs__tab:hover { background: var(--row-hover); }

.library-tabs__tab--current,
.library-tabs__tab--current:hover {
  border-color: var(--selected-line);
  color: var(--selected-ink);
  background: var(--selected-fill);
}

.library-tabs__tab:focus-visible { outline: 2.5px solid var(--selected-line); outline-offset: -2.5px; }

@media (max-width: 24rem) {
  .library-tabs__tab { padding: 0 0.75rem; }
}

/* The tabs sit on the heading's coral rule: no space under them, the current tab covers the rule. */
@media screen {
  .member-shell:not(.member-shell--chart) .library-heading.library-heading--tabs {
    padding-bottom: 0;
    border-bottom-width: 2px;
  }

  .library-heading--tabs .library-tabs { margin-bottom: -2px; }
  .library-tabs__tab--current { border-bottom: 2px solid var(--selected-line); }
}

.library-heading--tabs > div { min-width: 0; }

/* Collections and Sets share the Songs column. */
.collections-page,
.setlists-page {
  width: min(56rem, calc(100% - 1.5rem));
  margin-inline: auto;
}

.library-subtoolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: -1rem;
}

.library-subtoolbar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.library-subtoolbar__quiet { color: var(--muted); font-size: 0.9rem; text-decoration: underline; text-underline-offset: 0.2em; }

/* Songs toolbar: chips, then the count and a quiet Select button pushed to the right. */
.library-finder__chips .library__count { margin: 0 0 0 auto; white-space: nowrap; font-size: 0.9rem; }
.library-heading--tabs.library-finder__heading { display: block; }
.library-heading--tabs h1 { margin: 0; }

/* Select: a quiet outline pill, the same size as the chips beside it. */
.library-finder__chips .library-finder__select-toggle {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--hairline);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
}
.library-finder__chips .library-finder__select-toggle:hover { background: var(--row-hover); }

@media (max-width: 30rem) {
  .library-finder__chips { flex-wrap: nowrap; }
  .library-finder__chips .library__count {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .library-finder__chips .library-finder__select-toggle { margin-left: auto; }
}

.library-empty-import__header { margin-bottom: 1.25rem; }
.library-empty-import__title { margin: 0 0 0.5rem; }

/* Collection switcher (Songs tab): a compact "All songs ▾" control that opens a list of collections. Kept-apart
   collections sit under a hairline, muted. */
.shelf-switcher { position: relative; flex: none; margin-right: 4px; }
.shelf-switcher__button {
  display: inline-flex; min-height: 36px; max-width: 14rem; align-items: center; gap: 0.4rem; padding: 0 14px;
  border: 1.5px solid var(--hairline); border-radius: 999px; color: var(--ink); background: transparent;
  font-size: 15px; font-weight: 600; line-height: 20px; list-style: none; cursor: pointer;
}
.shelf-switcher__button::-webkit-details-marker { display: none; }
.shelf-switcher__button:hover { background: var(--row-hover); }
.shelf-switcher__button:focus-visible { outline: 2.5px solid var(--selected-line); outline-offset: 2px; }
.shelf-switcher[open] .shelf-switcher__button { border-color: var(--selected-line); }
.shelf-switcher__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-switcher__chevron { flex: none; font-size: 0.8em; }
.shelf-switcher__panel {
  position: absolute; z-index: 5; top: calc(100% + 0.4rem); left: 0; display: grid; width: min(20rem, calc(100vw - 2rem));
  max-height: 60vh; margin: 0; padding: 0.4rem; overflow-y: auto; border: 1px solid var(--hairline); border-radius: 12px;
  background: var(--surface); list-style: none; box-shadow: var(--shadow-floating);
}
.shelf-switcher__option {
  display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 0.75rem;
  border: 1.5px solid transparent; border-radius: 8px; color: var(--ink); font-size: 15px; text-decoration: none;
}
.shelf-switcher__option:hover { background: var(--row-hover); }
.shelf-switcher__option[aria-current="true"] { border-color: var(--selected-line); color: var(--selected-ink); background: var(--selected-fill); font-weight: 700; }
.shelf-switcher__option--apart { color: var(--muted); }
.shelf-switcher__count { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.shelf-switcher__rule { height: 0; margin: 0.35rem 0.5rem; border-top: 1px solid var(--rule); }

/* The quiet line under the All songs list, and the tag on a search result from a tucked-away collection. */
.library-finder__tucked { margin: 1.25rem 0 0; color: var(--muted); font-size: 0.9rem; }
.library-finder__tucked a { color: var(--selected-ink); text-underline-offset: 3px; }
.library-finder .chart-card__shelf-tag { grid-column: 1; justify-self: start; margin-top: 2px; font-size: 0.75rem; line-height: 1.3; }

/* Collections tab: each card is a link plus a switch row. */
.collection-card--shelf { display: grid; align-items: stretch; gap: 0.75rem; }
.collection-card__link { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; color: inherit; text-decoration: none; }
.shelf-switch__form { margin: 0; }
.shelf-switch {
  display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0 0;
  border: 0; border-top: 1px solid var(--rule); color: var(--ink); background: transparent; font: inherit; text-align: left; cursor: pointer;
}
.shelf-switch__text b { display: block; font-weight: 600; font-size: 0.9rem; }
.shelf-switch__text small { display: block; color: var(--muted); font-size: 0.8rem; }
.shelf-switch:focus-visible { outline: 2.5px solid var(--selected-line); outline-offset: 2px; }
.shelf-switch__track { position: relative; flex: none; width: 2.6rem; height: 1.5rem; border: 1.5px solid var(--hairline); border-radius: 999px; }
.shelf-switch__track::after { content: ""; color: transparent; position: absolute; top: 2px; left: 2px; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--hairline); }
.shelf-switch__track--on { border-color: var(--selected-line); background: var(--selected-fill); }
.shelf-switch__track--on::after { color: transparent; left: calc(100% - 1.1rem - 2px); background: var(--selected-line); }
.collection-form__keep-apart { display: grid; grid-template-columns: auto 1fr; column-gap: 0.6rem; align-items: start; }
.collection-form__keep-apart .field-hint { grid-column: 1 / -1; margin: 0.25rem 0 0; }
@media (max-width: 40rem) {
  .library-finder__chips { flex-wrap: wrap; }
  .collection-card--shelf { flex-direction: initial; }
  .collection-card__link { flex-direction: column; }
}
