/* Document library and reader: compact controls, spacious document surfaces. */
.documents-view { --doc-border: var(--heirlo-border, #e2e7f0); --doc-ink: #253044; }
.documents-view .documents-header { border-bottom: 1px solid var(--doc-border); padding-bottom: 20px; align-items: center; }
.documents-view .documents-header h2 { font-size: 26px; }
.documents-view .documents-summary-strip { display: none; }
.documents-view .documents-header__actions { min-width: 0; }
.documents-view .documents-actions__controls { flex-wrap: wrap; gap: 10px; }
.documents-view .documents-actions__search input { min-width: 180px; width: 240px; }
.documents-view .documents-body { display: block; }
.documents-view .documents-content { display: grid; grid-template-columns: 170px minmax(0,1fr); gap: 24px; align-items: start; }
.documents-view .documents-tabs { display: flex; flex-direction: column; gap: 5px; padding: 0 16px 0 0; margin: 0; border: 0; border-right: 1px solid var(--doc-border); background: none; border-radius: 0; min-height: 440px; }
.documents-view .documents-tabs .tab { width: 100%; text-align: left; padding: 12px 14px; border: 0; border-radius: 6px; background: transparent; color: #526075; font-size: 14px; box-shadow: none; }
.documents-view .documents-tabs .tab.active { background: #f7edf0; color: #9e1d36; font-weight: 600; }
.documents-view .documents-tab-panels { min-width: 0; }
.documents-file-toolbar, .documents-file-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.documents-file-toolbar { justify-content: space-between; margin-bottom: 16px; }
.documents-file-toolbar strong { font-size: 16px; }
.documents-file-controls label { display: flex; align-items: center; gap: 8px; color: var(--heirlo-muted, #5d6b82); font-size: 12px; }
.documents-file-controls select, .documents-view .doc-toolbar-button { width: auto; padding: 8px 12px; border: 1px solid var(--heirlo-border-strong, #cbd3e1); border-radius: 6px; background: white; color: var(--doc-ink); font-size: 13px; margin: 0; min-height: 38px; }
.documents-view .doc-toolbar-button { color: var(--heirlo-primary, #a41f35); }
.documents-filter-disclosure { margin: 0 0 12px; font-size: 13px; color: #526075; }
.documents-filter-disclosure summary { cursor: pointer; width: fit-content; padding: 6px 0; }
.documents-filter-disclosure .documents-filters { margin-top: 12px; }
.documents-view .documents-dropzone { padding: 10px 14px; min-height: 0; margin-bottom: 16px; border: 1px dashed var(--heirlo-border-strong, #cbd3e1); background: var(--heirlo-canvas, #f5f7fb); border-radius: 6px; }
.documents-view .documents-dropzone__title { font-size: 12px; font-weight: 500; }
.documents-view .documents-dropzone__meta { font-size: 11px; }
.documents-table-scroll { overflow-x: auto; }
.documents-view .documents-grid.is-list { display: block; min-width: 860px; border: 1px solid var(--doc-border); border-radius: 6px; overflow: hidden; }
.documents-view .doc-row { display: grid; grid-template-columns: 24px 32px minmax(220px,1fr) 160px 100px 65px 138px; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--doc-border); border-radius: 0; box-shadow: none; background: white; font-size: 12px; min-height: 66px; color: var(--doc-ink); }
.documents-view .doc-row > * { min-width: 0; }
.documents-view .doc-row > :nth-child(4) { overflow-wrap: anywhere; white-space: normal; line-height: 1.5; }
.documents-view .doc-row .document-card__meta { overflow-wrap: anywhere; }
.documents-view .doc-row:last-child { border-bottom: 0; }
.documents-view .doc-row:hover { background: var(--heirlo-canvas, #f5f7fb); }
.documents-view .doc-row--header { min-height: 44px; padding-block: 10px; background: #f3f5f8; font-size: 12px; font-weight: 600; }
.documents-view .doc-row .doc-select { position: static; margin: 0; }
.documents-view .doc-row .doc-select input { width: 16px; height: 16px; margin: 0; accent-color: var(--heirlo-primary, #a41f35); }
.documents-view .doc-row .doc-icon { width: 30px; height: 36px; border-radius: 4px; font-size: 9px; }
.documents-view .document-name-button { display: block; width: 100%; margin: 0; padding: 0; text-align: left; background: none; border: 0; color: #253044; font-size: 14px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; box-shadow: none; }
.documents-view .document-name-button:hover { color: var(--heirlo-primary, #a41f35); text-decoration: underline; }
.documents-view .doc-row .document-card__meta { font-size: 11px; margin-top: 3px; color: #788397; }
.documents-view .doc-actions { display: flex; align-items: center; gap: 4px; }
.documents-view .doc-open-button { width: auto; background: #fff; color: var(--heirlo-text-secondary, #475569); border: 1px solid #d0d7e2; padding: 6px 10px; margin: 0; border-radius: 5px; min-height: 32px; font-size: 12px; }
.documents-view .doc-actions .doc-icon-button { width: 30px; min-width: 30px; height: 32px; margin: 0; padding: 6px; border-radius: 5px; }
.documents-result-count { font-size: 12px; color: var(--heirlo-muted, #5d6b82); margin: 14px 0; }
.documents-view .document-template-card { box-shadow: none; border-radius: 6px; }
#documentDetailModal .document-detail-modal { width: calc(100vw - 48px); max-width: 1500px; height: calc(100dvh - 48px); max-height: none; padding: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 10px; }
#documentDetailModal .modal__header { padding: 18px 24px; margin: 0; border-bottom: 1px solid var(--heirlo-border, #e2e7f0); flex-shrink: 0; gap: 20px; }
#documentDetailModal .modal__header > div:first-child { min-width: 0; }
#documentDetailTitle { font-size: 18px; overflow-wrap: anywhere; margin: 0; }
#documentDetailSubtitle { margin: 4px 0 0; font-size: 11px; }
.document-reader-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
#documentDetailModal .document-reader-actions button { width: auto; min-height: 36px; margin: 0; padding: 7px 12px; border: 1px solid var(--heirlo-border-strong, #cbd3e1); border-radius: 6px; color: var(--heirlo-text-secondary, #475569); background: white; font-size: 13px; }
#documentDetailModal .document-reader-actions .modal__close { width: 36px; font-size: 22px; padding: 0; }
#documentDetailModal .document-detail-body { display: grid; grid-template-columns: minmax(0,1fr) 310px; flex: 1; min-height: 0; gap: 0; overflow: hidden; }
#documentDetailModal .document-detail-preview { min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: #e9edf2; overflow: auto; }
#documentDetailModal .document-detail-preview iframe { width: 100%; height: 100%; border: 0; border-radius: 0; }
#documentDetailModal .document-detail-preview:has(> img) { position: relative; overflow: hidden; }
#documentDetailModal .document-detail-preview > img { position: absolute; inset: 0; margin: auto; width: auto; height: auto; max-height: calc(100% - 32px); max-width: calc(100% - 32px); object-fit: contain; border-radius: 0; }
#documentDetailModal .document-preview__placeholder { padding: 32px; text-align: center; line-height: 1.6; }
.document-detail-sidebar { overflow: auto; padding: 24px; border-left: 1px solid var(--heirlo-border, #e2e7f0); background: white; }
.document-detail-sidebar h4 { margin: 0 0 24px; padding-bottom: 14px; border-bottom: 2px solid var(--heirlo-primary, #a41f35); color: var(--heirlo-primary, #a41f35); font-size: 14px; }
#documentDetailModal .document-preview { grid-template-columns: 1fr; background: none; padding: 0; }
#documentDetailIcon { display: none; }
#documentDetailModal .document-preview__meta { grid-template-columns: 90px minmax(0,1fr); row-gap: 20px; margin-bottom: 20px; overflow-wrap: anywhere; }
#documentDetailModal .document-detail-info { padding: 0; border: 0; gap: 20px; }
#documentDetailModal .document-detail-row { display: grid; grid-template-columns: 90px minmax(0,1fr); align-items: start; overflow-wrap: anywhere; }
#documentDetailModal .document-versions { margin-top: 28px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--heirlo-border, #e2e7f0); border-radius: 0; }
#documentDetailModal .document-versions__header { flex-wrap: wrap; gap: 12px; }
#documentDetailModal .document-version { overflow-wrap: anywhere; }
#documentDetailModal .modal__actions { margin: 0; padding: 10px 24px; border-top: 1px solid var(--heirlo-border, #e2e7f0); }
#documentDetailModal .modal__actions button { margin: 0; min-height: 34px; padding: 6px 18px; }
.documents-view button:focus-visible, #documentDetailModal button:focus-visible { outline: 2px solid var(--heirlo-primary, #a41f35); outline-offset: 3px; }
@media (max-width: 850px) {
 .documents-view .documents-content { grid-template-columns: 1fr; gap: 16px; }
 .documents-view .documents-tabs { flex-direction: row; flex-wrap: wrap; min-height: 0; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--heirlo-border, #e2e7f0); }
 .documents-view .documents-tabs .tab { width: auto; }
 #documentDetailModal .document-detail-body { grid-template-columns: minmax(0,1fr) 250px; }
}
@media (max-width: 600px) {
 .documents-view .documents-header { align-items: flex-start; }
 .documents-view .documents-actions__search input { width: 100%; }
 .documents-view .documents-file-controls { width: 100%; justify-content: space-between; }
 #documentDetailModal .document-detail-modal { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
 #documentDetailModal .modal__header { flex-wrap: wrap; padding: 12px; gap: 10px; }
 #documentDetailModal .document-detail-body { display: block; overflow: auto; }
 #documentDetailModal .document-detail-preview { height: 60dvh; min-height: 300px; }
 .document-detail-sidebar { border-left: 0; border-top: 1px solid var(--heirlo-border, #e2e7f0); padding: 18px; }
 #documentDetailModal .document-reader-actions button { min-height: 44px; }
}
.documents-view { background: #fff; }
.documents-view .documents-tab-panel, .documents-view .documents-table-scroll { min-width: 0; max-width: 100%; }
.documents-view .documents-tab-panels { grid-template-columns: minmax(0, 1fr); }
.documents-view .doc-row { margin: 0; }
.documents-view .doc-row > span:nth-last-child(-n + 4) { display: block; }
.documents-view .doc-row > span.doc-actions { display: flex; }
#documentDetailModal .document-detail-modal { padding: 0 !important; border-radius: 10px !important; }
#documentDetailModal .document-reader-actions .modal__close { position: static; }
@media (max-width: 600px) {
 .documents-view .documents-tabs { width: 100%; }
 .documents-view .documents-tabs .tab { min-width: 0; padding: 10px; }
}
.documents-view .documents-bulk { flex-wrap: wrap; margin-bottom: 12px; }
.documents-view .documents-bulk select { max-width: 100%; }
#documentDetailModal .document-reader-actions .modal__close { position: static !important; transform: none !important; }
/* Client and estate profile document tabs share the library's file rows. */
.profile-document-workspace { min-width: 0; max-width: 100%; color: #253044; }
.profile-document-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-document-toolbar .profile-file-count { color: var(--heirlo-muted, #5d6b82); font-size: 13px; font-weight: 400; }
.profile-document-toolbar > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-document-toolbar input, .profile-document-toolbar select, .profile-document-toolbar button { width: auto; min-height: 38px; padding: 8px 12px; margin: 0; border: 1px solid var(--heirlo-border-strong, #cbd3e1); border-radius: 6px; background: white; color: var(--heirlo-text-secondary, #475569); font-size: 13px; }
.profile-document-toolbar [data-file-upload] { color: var(--heirlo-primary, #a41f35); }
.profile-document-workspace .document-upload-zone { padding: 12px; margin: 0 0 16px; min-height: 0; border: 1px dashed var(--heirlo-border-strong, #cbd3e1); border-radius: 6px; background: var(--heirlo-canvas, #f5f7fb); text-align: center; font-size: 12px; }
.profile-document-workspace .document-upload-zone small { display: block; font-size: 11px; color: var(--heirlo-muted, #5d6b82); margin-top: 4px; }
.profile-document-table-scroll { overflow-x: auto; border: 1px solid var(--heirlo-border, #e2e7f0); border-radius: 6px; }
.profile-document-table { border-collapse: collapse; width: 100%; min-width: 780px; text-align: left; }
.profile-document-table .tab-list { display: table-row-group; }
.profile-document-table th { background: #f3f5f8; font-size: 12px; color: #526075; font-weight: 600; }
.profile-document-table th, .profile-document-table td { padding: 14px 16px; border-bottom: 1px solid var(--heirlo-border, #e2e7f0); vertical-align: middle; }
.profile-document-table td { font-size: 12px; }
.profile-document-table tr:last-child td { border-bottom: 0; }
.profile-document-table td:first-child { width: 45%; min-width: 260px; }
.profile-document-table tr:hover td { background: var(--heirlo-canvas, #f5f7fb); }
.profile-file-name { display: flex; align-items: center; gap: 12px; }
.profile-file-name .doc-icon { flex: 0 0 32px; width: 32px; height: 36px; border-radius: 4px; font-size: 9px; }
.profile-document-workspace .document-name-button { padding: 0; margin: 0; border: 0; background: none; text-align: left; color: #253044; font-size: 14px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.profile-document-workspace .document-name-button:hover { text-decoration: underline; color: var(--heirlo-primary, #a41f35); }
.profile-file-actions { display: flex; align-items: center; gap: 6px; }
.profile-file-actions button, .profile-file-actions summary { width: auto; min-height: 32px; padding: 6px 10px; margin: 0; border: 1px solid var(--heirlo-border-strong, #cbd3e1); border-radius: 5px; background: white; color: var(--heirlo-text-secondary, #475569); font-size: 12px; white-space: nowrap; cursor: pointer; }
.profile-file-actions svg { width: 16px; height: 16px; vertical-align: middle; }
.profile-file-actions details > div { display: grid; gap: 6px; margin-top: 8px; }
.profile-file-actions [data-doc-action=delete] { color: var(--heirlo-primary, #a41f35); }
.profile-document-sharing { margin-top: 20px; font-size: 13px; color: var(--heirlo-muted, #5d6b82); }
.profile-document-sharing summary { cursor: pointer; }
.profile-document-sharing p { margin: 12px 0; }
.profile-document-workspace button:focus-visible, .profile-document-workspace summary:focus-visible { outline: 2px solid var(--heirlo-primary, #a41f35); outline-offset: 3px; }
@media(max-width:600px) {
 .profile-document-toolbar > div { width: 100%; }
 .profile-document-toolbar input { width: 100%; }
 .profile-document-toolbar button { min-height: 44px; }
}
/* Animate only the reader surface; a flat scrim avoids full-screen blur repaints. */
#documentDetailModal { overflow: hidden; backdrop-filter: none; -webkit-backdrop-filter: none; }
#documentDetailModal .document-detail-modal { transform: translate3d(0, 0, 0); backface-visibility: hidden; }
.profile-document-workspace .document-upload-zone.dragover { border-color: var(--heirlo-primary, #a41f35); background: #fbedf0; }
.profile-document-workspace .document-upload-zone:focus-visible { outline: 2px solid var(--heirlo-primary, #a41f35); outline-offset: 3px; }
.profile-document-workspace .document-upload-zone[aria-busy=true] { opacity: .6; cursor: progress; }
.profile-upload-status { color: #526075; font-size: 13px; overflow-wrap: anywhere; }
.profile-upload-status:empty { display: none; }

.profile-document-workspace [hidden] { display: none !important; }
