.archive-workspace{min-width:0;max-width:100%}.archive-filter-grid{display:grid;grid-template-columns:minmax(180px,2fr) repeat(3,minmax(135px,1fr)) auto auto;gap:12px;align-items:end;margin-block:16px}.archive-filter-grid label{display:grid;gap:6px;min-width:0}.archive-filter-grid input,.archive-filter-grid select{width:100%;min-width:0;box-sizing:border-box}.archive-filter-grid button,.archive-filter-grid select,.archive-filter-grid input,.archive-pages button,.archive-cast-matrix button{min-height:44px}.archive-pages{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}.archive-cast-matrix{min-width:0;margin-top:18px}.archive-cast-matrix h2{overflow-wrap:anywhere}.archive-cast-matrix .repertoire-matrix-scroll{max-height:min(70vh,760px);overflow:auto;overscroll-behavior:contain}.archive-cast-matrix td button{width:100%;font-size:14px;line-height:1.4}.archive-basis{display:block;font-size:12px;color:#665d50;margin-block:4px}.archive-detail-section{margin-block:20px}.archive-role-row{display:grid;grid-template-columns:minmax(120px,1fr) 2fr;gap:12px;padding:10px 0;border-bottom:1px solid #ddd;overflow-wrap:anywhere}
@media(max-width:1100px){.archive-filter-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.archive-filter-grid label:first-child{grid-column:span 2}}
@media(max-width:600px){.archive-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.archive-filter-grid label:first-child{grid-column:1/-1}.archive-filter-grid label:nth-child(2){grid-column:1/-1}.archive-pages{gap:8px}.archive-pages span{order:-1;flex-basis:100%}.archive-cast-matrix .repertoire-matrix-scroll{width:100%;max-width:100%}.archive-role-row{grid-template-columns:1fr;gap:4px}}
#detail:has([data-historical-detail]){box-sizing:border-box;width:min(760px,calc(100vw - 24px));max-width:calc(100vw - 24px);padding:16px}#detail:has([data-historical-detail]) .dialog-head{min-width:0;gap:12px}#detail:has([data-historical-detail]) .dialog-head>div{min-width:0;overflow-wrap:anywhere}#detail:has([data-historical-detail]) .dialog-head button{flex-shrink:0;min-height:44px;min-width:44px}
@media(max-width:600px){#detail:has([data-historical-detail]){height:auto;max-height:calc(100dvh - 24px);margin:12px auto;right:0}}

/* Archive list and saved documents; shared matrix geometry belongs to repertoire.css. */
.archive-event-list{display:grid;gap:12px;margin-top:16px}.archive-event-row[role=button],.messages-archive-entry[role=button]{cursor:pointer}.archive-event-row[role=button]:focus-visible,.messages-archive-entry[role=button]:focus-visible{outline:3px solid var(--accent);outline-offset:3px}.archive-event-row[role=button]:hover{border-color:var(--accent)}.archive-document-scroll{max-width:100%;overflow:auto}.archive-document-scroll table{width:100%;border-collapse:collapse}.archive-document-scroll th,.archive-document-scroll td{padding:10px;border:1px solid var(--line);vertical-align:top;overflow-wrap:anywhere}.archive-detail-section>a{display:inline-flex;align-items:center;min-height:44px}.archive-detail-section>button{margin:4px;min-height:44px}.archive-filter-grid:has([data-historical-filter=kind]){grid-template-columns:repeat(4,minmax(0,1fr))}.archive-filter-grid [data-historical-filter=search]{min-width:0}.archive-event-row button{min-height:44px}
@media(max-width:760px){body[data-viewer=staff] .staff-mobile-navigation{grid-template-columns:repeat(4,minmax(0,1fr))}.archive-filter-grid:has([data-historical-filter=kind]){grid-template-columns:repeat(2,minmax(0,1fr))}.archive-event-row>button{width:100%}.archive-document-scroll table{min-width:360px}}

/* Archive search layout only; existing filters/actions and loading stay in their owners. */
body .archive-filter-grid.archive-search-panel{display:block;min-width:0;margin-block:16px;padding:14px;border:1px solid var(--line,#ded7c9);border-radius:10px;background:var(--paper,#fffefa)}
.archive-search-primary{display:grid;grid-template-columns:minmax(180px,1fr) minmax(150px,200px) auto auto;gap:10px;align-items:end}
.archive-search-panel .archive-search-primary .archive-month-field{grid-column:auto}
.archive-search-panel label{display:grid;gap:6px;margin:0;min-width:0;font-size:13px}
.archive-search-panel input,.archive-search-panel select{display:block;box-sizing:border-box;width:100%;min-width:0;max-width:100%;margin:0;min-height:44px}
.archive-search-panel button{width:auto;min-width:0;min-height:44px;margin:0;white-space:normal}
.archive-search-panel details{min-width:0;margin-top:10px}
.archive-search-panel summary{min-height:44px;box-sizing:border-box;padding:12px 0;cursor:pointer;font-size:13px;font-weight:600}
.archive-search-refinements{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;align-items:end}
.archive-search-panel .archive-search-refinements label{grid-column:auto}
.archive-search-panel .archive-period-hint{margin:10px 0 0}
.archive-search-panel :is(input,select,button,summary):focus-visible{outline:3px solid var(--accent,#76643e);outline-offset:3px}
@media(max-width:1100px){.archive-search-primary{grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto}.archive-search-primary .archive-search-field{grid-column:1/-1}.archive-search-refinements{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){body .archive-filter-grid.archive-search-panel{padding:10px}.archive-search-primary{grid-template-columns:minmax(0,1fr) auto}.archive-search-primary [data-historical-clear]{grid-column:1/-1;justify-self:end}.archive-search-refinements{grid-template-columns:repeat(2,minmax(0,1fr))}.archive-search-panel .archive-search-refinements label:has(select){grid-column:1/-1}.archive-search-panel input,.archive-search-panel select{font-size:16px}.archive-search-panel summary{font-size:13px}}
@media(max-width:360px){.archive-search-panel .archive-search-primary .archive-month-field{grid-column:1/-1}.archive-search-primary [data-historical-clear]{grid-column:auto;justify-self:stretch}}

/* A saved call prints as its own paper, without the archive search or status. */
@media print{
 body:has(#detail[open] [data-historical-detail] .activity-document-familiar){height:auto!important;overflow:visible!important;background:#fff!important;color:#000!important;page:theatre-call}
 body:has(#detail[open] [data-historical-detail] .activity-document-familiar)>:not(#detail){display:none!important}
 #detail[open]:has([data-historical-detail] .activity-document-familiar)::backdrop{display:none!important}
 #detail[open]:has([data-historical-detail] .activity-document-familiar){page:theatre-call;display:block!important;position:static!important;inset:auto!important;width:auto!important;height:auto!important;max-width:none!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:#fff!important}
 #detail[open]:has([data-historical-detail] .activity-document-familiar) #detail-body{display:block!important;position:static!important;height:auto!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:0!important}
 #detail[open]:has([data-historical-detail] .activity-document-familiar) #detail-body>:not([data-historical-detail]),#detail[open] [data-historical-detail]:has(.activity-document-familiar)>:not(.activity-document-familiar){display:none!important}
 #detail[open] [data-historical-detail] .activity-document-familiar{display:block!important;margin:0!important;padding:0!important;border:0!important;box-shadow:none!important;overflow:visible!important}
}

/* Filled historical matrix: readable columns with a native scrolling date pane. */
@media screen and (max-width:680px) {
 body[data-viewer=staff] #main .archive-cast-matrix { --matrix-role-width:140px; --matrix-cast-width:200px; }
 body[data-viewer=staff] #main .archive-cast-matrix .repertoire-matrix-scroll { scroll-padding-left:0; }
 body[data-viewer=staff] #main .archive-cast-matrix table { width:max-content; min-width:100%; table-layout:auto; }
 body[data-viewer=staff] #main .archive-cast-matrix .repertoire-matrix-col-date { width:180px; }
 body[data-viewer=staff] #main .archive-cast-matrix :is(.repertoire-matrix-role,.repertoire-matrix-role-heading,.repertoire-matrix-cast,.repertoire-matrix-cast-heading) { position:static; }
 body[data-viewer=staff] #main .archive-cast-matrix td:not(.repertoire-matrix-cast) { min-width:180px; }
 body[data-viewer=staff] #main .archive-cast-matrix .repertoire-matrix-role strong { font-size:13px; line-height:1.4; overflow-wrap:normal; }
 body[data-viewer=staff] #main .archive-cast-matrix .repertoire-matrix-cast { font-size:14px; line-height:1.5; }
 body[data-viewer=staff] #main .archive-cast-matrix td button { font-size:14px; font-weight:500; line-height:1.45; }
 body[data-viewer=staff] #main .archive-cast-matrix .archive-basis { font-size:13px; }
}

@media screen {
 body[data-viewer=staff] #main .messages-general-archive .messages-archive-entry h2 { font:400 22px/1.3 var(--serif); margin:6px 0 8px; overflow-wrap:anywhere; }
 body[data-viewer=staff] #main .messages-general-archive .messages-archive-entry p { line-height:1.5; }
}
