/* Collection frame: content, navigation and controls share one edge. */
/* Width comes from the shared page frame (shell.css), so the header and body
   keep the same edges as Home and every other tab. Only vertical rhythm is set here. */
.collection-page { margin-inline: auto; padding: var(--shell-height) var(--space-page-x) 32px; --work-content-offset: 0px; }
.collection-page .page-shell-main, .collection-page .sites-following-page { margin: 32px 0 0; max-width: none; padding: 0; }
.collection-page .sites-following-page { width: 100%; outline: none; }
.collection-page .page-shell-commands:has(.action-lens-tabs), .collection-page #knowledge-toolbar { display: contents; }
.collection-page .collection-family { width: 100%; margin-bottom: 20px; }
.collection-page .collection-toolbar-controls { position: relative; display: grid; grid-template-columns: 164px minmax(160px, 1fr) 168px auto auto; align-items: center; gap: 12px; padding: 0; }
@media (min-width: 761px) and (max-width: 1000px) {
  .collection-page .collection-toolbar-controls { grid-template-columns: 144px minmax(120px, 1fr) 168px auto auto; gap: 8px; }
}
.collection-filter, .collection-select { min-width: 0; position: relative; }
.collection-page .collection-find { margin: 0; min-width: 0; width: auto; display: block; }
.collection-page .collection-find input { width: 100%; min-width: 0; height: var(--control-height); font-size: 14px; line-height: 20px; padding-inline: 12px; background: transparent; }
/* Kind and sort open the shared .ov-menu list from a button (collection-toolbar.js). */
.collection-select-button { display: block; width: 100%; height: var(--control-height); padding: 0 30px 0 12px; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); background: transparent; color: var(--color-text-primary); font: inherit; font-size: 14px; line-height: 20px; text-align: left; cursor: pointer; }
.collection-select-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-type-static { display: flex; align-items: center; height: var(--control-height); padding-inline: 12px; font-size: 14px; line-height: 20px; color: var(--color-text-secondary); }
.collection-select-chevron { position: absolute; right: 9px; top: 50%; margin-top: -8px; pointer-events: none; }
.collection-select-compact { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); pointer-events: none; font-size: 14px; line-height: 20px; color: var(--color-text-secondary); }
.collection-sort .collection-select-button { padding-left: 44px; }
.collection-page .collection-toolbar-primary { margin: 0; order: 0; }
.collection-page .collection-create { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height); min-height: var(--control-height); padding: 0 12px; line-height: 20px; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); background: transparent; color: var(--color-text-secondary); font-size: 14px; font-weight: 400; white-space: nowrap; }
.collection-page .collection-create:hover { color: var(--color-text-primary); background: var(--color-bg-sunken); }
.collection-page .collection-create { transition-property: color, background-color, border-color; }
.collection-primary-icon { display: block; width: 18px; height: 18px; flex-shrink: 0; }
.collection-view { position: relative; }
.collection-view > summary { display: flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height); padding: 0 12px; border: 1px solid var(--color-border-default); border-radius: var(--radius-md); list-style: none; cursor: pointer; font-size: 14px; line-height: 20px; background: transparent; }
.collection-view > summary::before, .collection-view > summary::-webkit-details-marker { display: none; }
.collection-options { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: 340px; max-height: 70dvh; overflow: auto; padding: 16px; border: 1px solid var(--color-border-default); border-radius: var(--radius-surface); background: var(--color-bg-surface); box-shadow: var(--shadow-md); }
.collection-options > strong { display: block; font-size: 13px; margin-bottom: 12px; }
.collection-options [data-collection-options] { display: grid; gap: 16px; }
.collection-options :is(.action-filter-toolbar, .output-view-options, .knowledge-arrange) { margin: 0; }
.collection-options .action-collection-total, .collection-options .action-filter-active { display: none; }
.collection-options .action-filter-toolbar { display: block; }
.collection-options .action-filter-menu { width: 100%; }
.collection-options .action-filter-popover { position: static; width: 100%; max-width: none; max-height: none; overflow: visible; margin: 0; padding: 0; box-shadow: none; border: 0; }
/* View shows the facets directly (one panel, one scroll area); its own heading names them. */
.collection-options .action-filter-menu > summary, .collection-options .action-filter-popover-head { display: none; }
.collection-options .artifact-library-controls { display: grid; gap: 12px; }
.collection-options .output-view-options { padding: 0; }
.collection-options .segmented-control { flex-wrap: wrap; }
.collection-page .collection-toolbar-chips:empty, .collection-page .collection-toolbar-chips:not(:has(.filter-chip)), .collection-page [data-query-chip]:empty { display: none; }
.collection-page .collection-toolbar-chips .filter-chip { color: var(--color-text-secondary); text-decoration: none; }
.collection-page :is(#action-view-scope, #knowledge-view-scope, #artifacts-view-scope):empty { display: none; }
/* A View with nothing in it is an inert control. On phone it still holds Filter. */
@media (min-width: 761px) { .collection-page .collection-view:has([data-collection-options]:empty) { display: none; } }
/* A row's title is content. Its metadata identifies the kind, role and state. */
.collection-page :is(.work-row, .knowledge-row, .person-artifact-row, .rooms-row) { min-height: 74px; border: 0; border-bottom: 1px solid var(--color-border-default); border-radius: 0; background: transparent; padding: 13px 12px; }
.collection-page :is(.work-list, .knowledge-rows, .artifact-library-list, .rooms-row-list, .sites-following-list) > :last-child { border-bottom: 0; }
.collection-page :is(.work-row .item-name, .knowledge-row-title, .person-artifact-primary .item-name, .artifact-gallery-body > .item-name, .rooms-row-title) { color: var(--color-text-primary); font-family: var(--type-family-body); font-size: 16px; font-weight: 600; line-height: 1.35; }
.collection-page :is(.work-row-meta, .knowledge-row-meta, .person-artifact-meta) { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; color: var(--color-text-secondary); font-size: 13px; margin-top: 6px; }
.collection-page .collection-kind { display: inline-flex; align-items: center; width: fit-content; padding: 2px 6px; border: 1px solid var(--color-border-subtle); border-radius: 4px; color: var(--color-text-secondary); font-size: 12px; line-height: 1.35; }
.collection-page .collection-meta-label { color: var(--color-text-secondary); font-size: 12px; font-weight: 400; }
.collection-page .work-row-meta .tag-tap { font-size: 13px; font-weight: 400; }
.collection-page :is(.work-row time, .knowledge-row-time, .person-artifact-meta .item-date, .rooms-row-timing) { color: var(--color-text-secondary); font-size: 13px; white-space: nowrap; font-family: var(--type-family-body); font-variant-numeric: tabular-nums; }
.collection-page .work-row { grid-template-columns: minmax(0, 1fr) 180px 116px var(--control-height); align-items: center; gap: 20px; }
.collection-page .knowledge-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px; gap: 20px; }
.collection-page .knowledge-row-time { text-align: right; }
.collection-page .knowledge-row > span:not(.knowledge-row-time) { font-size: 13px; color: var(--color-text-secondary); }
.collection-page .knowledge-row:has(> span:not(.knowledge-row-time)) { grid-template-columns: minmax(0, 1fr) 150px 116px; }
.collection-page .person-artifact-row { position: relative; padding-right: 48px; }
.collection-page .person-artifact-row-actions { position: absolute; right: 8px; top: 13px; }
.collection-page .person-artifact-row-actions .artifact-live-link { display: none; }
.collection-page .person-artifact-meta .item-date { margin-left: auto; }
.collection-page .person-artifact-primary { display: block; }
.collection-page .person-artifact-primary > .item-name { display: block; text-align: left; }
.collection-page .person-artifact-row .artifact-link::after, .collection-page .artifact-delivery-menu > summary::before { display: none; }
.collection-page .person-artifact-meta .badge { font-size: 13px; }
.collection-page .person-artifact-meta .collection-kind { font-size: 12px; padding: 2px 6px; border: 1px solid var(--color-border-subtle); border-radius: 4px; }
.collection-page .artifact-library-results { padding: 0; }
.collection-page .rooms-row { position: relative; padding-right: 48px; }
.collection-page .rooms-row-top { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px; align-items: start; gap: 6px 20px; padding: 0; }
.collection-page .rooms-row-title { grid-column: 1; }
.collection-page .rooms-row-timing { margin: 0; text-align: right; }
.collection-page .rooms-row-about { max-width: calc(100% - 340px); margin-top: 7px; color: var(--color-text-secondary); font-size: 13px; }
.collection-page .rooms-row-actions { right: 8px; top: 13px; }
.collection-page .rooms-row-list { margin: 0; }
.collection-page .source-text button { color: var(--color-text-link); background: transparent; border: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.collection-page .rooms-context-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.collection-page .rooms-context-filter a { color: var(--color-text-link); }
.collection-page .collection-scope-label { font-family: var(--type-family-body); font-size: 13px; font-weight: 600; margin: 0; }
@media (max-width: 760px) {
  .collection-page .page-shell-main { margin-top: 24px; }
  .collection-page .collection-toolbar-controls { --control-height: 44px; grid-template-columns: minmax(100px, 1fr) 60px 44px 44px; gap: 8px; }
  .collection-page .collection-select-button { font-size: 14px; padding-left: 8px; }
  .collection-select-chevron { right: 6px; }
  .collection-select-compact { left: 7px; font-size: 14px; }
  .collection-sort .collection-select-value { color: transparent; }
  .collection-options .collection-find { display: block; margin: 0; }
  .collection-options .collection-find input { font-size: 16px; }
  .collection-view-label { display: none; }
  .collection-view > summary { width: 44px; height: 44px; padding: 0; }
  .collection-page .collection-create { width: 44px; height: 44px; padding: 0; border-color: transparent; border-radius: var(--radius-md); }
  .collection-primary-label { display: none; }
  .collection-options { position: fixed; inset: auto 16px 18px; width: auto; max-height: 75dvh; box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--color-text-primary) 18%, transparent); }
  .collection-page :is(.work-row, .knowledge-row, .person-artifact-row, .rooms-row) { min-height: 96px; padding: 14px 0; gap: 7px 8px; }
  .collection-page .work-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .collection-page .work-row > div { grid-column: 1; }
  .collection-page .work-row > .work-row-state { grid-column: 1; grid-row: 2; }
  .collection-page .work-row > time { display: block; grid-column: 1; grid-row: 3; text-align: left; }
  .collection-page .work-row > .movement-trigger { grid-column: 2; grid-row: 1; min-width: 44px; min-height: 44px; }
  .collection-page .knowledge-row, .collection-page .knowledge-row:has(> span:not(.knowledge-row-time)) { grid-template-columns: minmax(0, 1fr); }
  .collection-page .knowledge-row > div { flex-basis: auto; }
  .collection-page .knowledge-row-time { margin: 0; text-align: left; }
  .collection-page .person-artifact-row { padding-right: 44px; }
  .collection-page .person-artifact-row-actions { right: 0; }
  .collection-page .person-artifact-meta .item-date { margin-left: 0; flex-basis: 100%; }
  .collection-page .artifact-delivery-menu > summary, .collection-page .rooms-row-actions summary { min-width: 44px; min-height: 44px; justify-content: center; }
  .collection-page .rooms-row { padding-right: 44px; }
  .collection-page .rooms-row-top { grid-template-columns: minmax(0, 1fr); }
  .collection-page .rooms-status-badge { grid-column: 1; grid-row: 2; }
  .collection-page .rooms-row-timing { grid-column: 1; grid-row: 3; text-align: left; }
  .collection-page .rooms-row-about { max-width: none; }
  .collection-page .rooms-row-actions { right: 0; }
}
@media (max-width: 350px) { .collection-page .collection-toolbar-controls { gap: 6px; } }

.collection-options .knowledge-document-views { display: grid; gap: 8px; font-size: 13px; }
.knowledge-document-views a { color: var(--color-text-secondary); text-decoration: none; }
.knowledge-document-views a[aria-current="page"] { color: var(--color-text-primary); font-weight: 600; }
.collection-page .knowledge-history-heading { margin-bottom: 20px; }
.collection-page .knowledge-history-heading h2 { font: 600 16px var(--type-family-body); margin: 0 0 6px; }
.collection-page .knowledge-retained-note { margin: 0; font-size: 13px; color: var(--color-text-secondary); }

.collection-page .knowledge-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 20px; }
.collection-page .knowledge-pagination p { flex: 1 1 280px; margin: 0; font-size: 13px; line-height: 1.5; }
.collection-page .knowledge-page-actions { display: flex; align-items: center; gap: 8px; }
.collection-page .knowledge-page-actions :is(button, .btn) { height: var(--control-height); min-height: var(--control-height); padding: 0 12px; border-radius: var(--radius-md); font-family: var(--type-family-body); font-size: 14px; line-height: 20px; }
.collection-page .knowledge-refresh { border: 1px solid transparent; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.collection-page .knowledge-refresh:hover { background: var(--color-bg-sunken); color: var(--color-text-primary); }
@media (max-width: 760px) { .collection-page .knowledge-page-actions { --control-height: 44px; } }

.collection-page .collection-toolbar-chips .filter-chip { display: inline-flex; max-width: 100%; padding: 3px 8px; border: 1px solid var(--color-border-default); border-radius: 4px; background: transparent; font-size: 12px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
/* Collections without a type/state choice (Relationships) keep the same order:
   Filter this list → Sort → View → quiet creation. A View with nothing in it is not shown. */
.collection-page .collection-toolbar-controls:not(:has(> .collection-type)) { grid-template-columns: minmax(160px, 1fr) 168px auto auto; }
/* Empty, or holding only a filter toolbar with no usable facet (and no other view choice). */
.collection-view:not(:has(.action-filter-menu)):not(:has([data-collection-options] > :not(.action-filter-toolbar))) { display: none; }
@media (max-width: 760px) {
  /* Filter this list moves into View on phone; Sort/View/creation keep their columns. */
  .collection-page .collection-toolbar-controls:not(:has(> .collection-type)) { grid-template-columns: minmax(0, 1fr) 60px 44px 44px; }
  .collection-page .collection-toolbar-controls:not(:has(> .collection-type)) > .collection-sort { grid-column: 2; }
}
/* View → Scope (dec_bc5d8f7f): one group inside View; a changed scope shows as a token. */
.collection-options .view-scope-control { display: grid; gap: 4px; margin: 0; padding: 0; border: 0; min-width: 0; }
.collection-options .view-scope-control legend { padding: 0; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.view-scope-option { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.view-scope-option input { margin-top: 3px; flex: none; }
.view-scope-option > span { display: grid; gap: 2px; min-width: 0; }
.view-scope-option .panel-desc { margin: 0; font-size: 12px; }
.collection-scope-count { margin: 4px 0 12px; }
