/* Library actions share the Forest & Paper tokens and preserve Compare. */
.library-view-heading h2 {
  margin:0 0 6px;
  font-size:22px;
  overflow-wrap:anywhere;
}

.library-view-heading p {
  margin:0 0 20px;
}

.library-sidebar .sidebar-link {
  margin-bottom:6px;
  background:transparent;
  color:var(--muted);
}

.library-sidebar .sidebar-link[aria-current=true],
.library-sidebar .sidebar-link[aria-current=page] {
  background:var(--selected);
  color:var(--accent);
}

.library-sidebar .sidebar-link:hover {
  background:var(--soft);
}

/* The select is visible at every width, never a hidden Tab stop. */
.library-sidebar>.collection-select {
  position:static;
  width:auto;
  height:auto;
  overflow:visible;
  clip:auto;
  clip-path:none;
}

.library-sidebar .collection-select select {
  width:100%;
  min-width:0;
}

.library-sidebar .collection-links:empty {
  display:none;
}

.library-content .results-toolbar {
  align-items:flex-end;
  flex-wrap:wrap;
  gap:12px;
}

.library-content .toolbar-actions {
  flex-wrap:wrap;
  align-items:flex-end;
}

#library-status-filter {
  display:grid;
  gap:4px;
  margin:0;
  font-size:12px;
  color:var(--muted);
}

#library-status-filter select {
  width:auto;
  min-width:135px;
}

#library-status,
#library-export-result {
  overflow-wrap:anywhere;
}

#library-export-result:empty {
  display:none;
}

.library-message {
  padding:16px 20px;
  margin:0 0 22px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--soft);
  overflow-wrap:anywhere;
}

.library-message h2,
.library-message h3 {
  margin:0 0 8px;
  font-size:18px;
}

.library-message p:last-child,
.library-message .detail-actions {
  margin-bottom:0;
}

.library-error {
  background:var(--warning-bg);
  color:var(--text);
  border-color:color-mix(in srgb,var(--warning),var(--border) 50%);
}

.collection-management {
  border-top:1px solid var(--border);
  margin-top:26px;
  padding-top:4px;
}

.collection-management>label {
  display:grid;
  gap:6px;
  margin-bottom:14px;
}

.reading-help {
  margin:0 0 24px;
  max-width:68ch;
}

.paper-more-actions {
  min-width:0;
}

.paper-more-actions[open] {
  flex-basis:100%;
}

.paper-more-actions>summary {
  margin:0;
  padding:8px;
  min-height:36px;
  border-radius:8px;
  font-size:11px;
  font-weight:700;
  color:var(--accent);
}

.paper-more-actions[open]>summary,
.paper-more-actions>summary:hover {
  background:var(--soft);
}

.paper-more-content {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  width:fit-content;
  max-width:100%;
  margin-top:4px;
  padding:6px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:8px;
}

.paper-more-content button {
  text-align:left;
  justify-content:flex-start;
  white-space:normal;
}

.paper-more-actions:not([open])>.paper-more-content {
  display:none;
}

.notice {
  overflow-wrap:anywhere;
}

.notice-actions {
  display:inline-flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  margin-left:12px;
}

.notice a,
.notice button {
  color:inherit;
}

.notice a {
  text-decoration:underline;
  text-underline-offset:3px;
}

.notice button {
  border:1px solid currentColor;
  background:transparent;
  min-height:36px;
  padding:5px 10px;
}

.notice button:hover {
  background:color-mix(in srgb,var(--bg),transparent 88%);
}

.dialog-feedback button,
.dialog-feedback a {
  margin-left:8px;
}

.library-content .article-card .organization-preview,
.paper-note-preview,
#paper-note-dialog textarea {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.paper-dialog-title {
  min-width:0;
  overflow-wrap:anywhere;
}

#paper-collections-dialog .dialog-header>button,
#paper-note-dialog .dialog-header>button,
#library-confirm .dialog-header>button {
  width:auto;
  min-width:44px;
  height:auto;
  min-height:44px;
}

#paper-collections-dialog .dialog-body,
#paper-note-dialog .dialog-body,
#library-confirm .dialog-body {
  display:grid;
  gap:14px;
}

#paper-collections-dialog .dialog-body>p,
#paper-note-dialog .dialog-body>p,
#library-confirm .dialog-body>p {
  margin:0;
}

#paper-collections-dialog .check-label {
  display:flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  overflow-wrap:anywhere;
}

#paper-collections-dialog .check-label input {
  flex:none;
}

#paper-note-dialog textarea {
  width:100%;
  min-height:140px;
}

#library-confirm .detail-actions {
  margin:8px 0 0;
}

@media(max-width:780px) {
  .library-sidebar .sidebar-link {
    margin-bottom:0;
  }

  .library-sidebar>.collection-select {
    flex-basis:100%;
    min-width:0;
    font-size:12px;
  }

  .library-content .toolbar-actions {
    width:100%;
  }

  #library-status-filter {
    flex:1 1 140px;
  }

  #library-status-filter select {
    width:100%;
  }

  #export-library {
    flex:1 1 170px;
  }

  .paper-more-actions>summary {
    min-height:40px;
    padding-block:10px;
  }

  .library-message {
    padding:14px;
  }

  .notice {
    width:max-content;
  }

  .notice-actions {
    margin:8px 0 0;
  }
}
