/* Adapt to the actual workspace width, including sidebar and iframe layouts. */
.library-workspace {
  container: library / inline-size;
  min-width: 0;
  padding: clamp(22px, 4vh, 40px) clamp(16px, 4vw, 48px) 40px;
}
.library-shell { max-width: 1200px; min-width: 0; }
.library-title { min-width: 0; }
.library-head h2 { overflow-wrap: anywhere; line-height: 1.2; }
.library-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
.library-search { min-width: 0; }
.library-search input { width: 100%; box-shadow: none; }
.library-search input:focus { outline: none !important; box-shadow: none !important; border-color: transparent !important; }
.library-table { min-width: 0; }
.library-table th, .library-table td { padding: 14px 10px; overflow-wrap: anywhere; }
.library-table th:first-child { width: 27%; }
.library-table th:nth-child(2), .library-table td:nth-child(2) { width: 12%; white-space: normal; }
.library-table th:nth-child(3), .library-table td:nth-child(3) { width: 14%; white-space: normal; }
.library-table th:nth-child(4), .library-table td:nth-child(4) { width: 14%; }
.library-table th:nth-child(5), .library-table td:nth-child(5) { width: 17%; white-space: normal; }
.library-table th:nth-child(6), .library-table td:nth-child(6) { width: 16%; white-space: normal; }
.library-source { max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; padding: 3px 8px; }
.library-actions-cell { align-items: flex-start; }
.library-pagination { flex-wrap: wrap; }
.library-page-controls { max-width: 100%; }

@container library (max-width: 850px) {
  .library-head { flex-wrap: wrap; }
  .library-toolbar { grid-template-columns: minmax(0, 1fr); margin-top: 24px; gap: 12px; }
  .library-summary { justify-content: flex-start; }
  .library-table-wrap { overflow: visible; }
  .library-table, .library-table tbody { display: block; width: 100%; }
  .library-table thead {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .library-table tr { display: block; padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 12px; }
  .library-table tr > td:nth-child(n) {
    display: block; width: auto; border: 0; padding: 6px 0;
    white-space: normal; min-width: 0; overflow-wrap: anywhere;
  }
  .library-table tr > td:first-child { padding: 0 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
  .library-table tr > td[data-column-label] { display: grid; grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr); gap: 12px; align-items: start; }
  .library-table td[data-column-label]::before { content: attr(data-column-label); color: var(--text-muted); font-size: 12px; line-height: 1.5; }
  .library-source { justify-self: start; }
  .library-actions-cell { gap: 8px; }
  .library-action-btn { min-height: 36px; }
  .library-pagination { align-items: flex-start; gap: 12px; }
}
@container library (max-width: 380px) {
  .library-head h2 { font-size: 25px; }
  .library-mark { width: 32px; height: 32px; }
  .library-table tr > td[data-column-label] { grid-template-columns: minmax(0, 5.5rem) minmax(0, 1fr); gap: 8px; }
  .library-page-controls { gap: 6px; }
  .library-page-label { min-width: 42px; }
}
