.upload-boundary{display:flex;flex-direction:column;background:light-dark(#fff7e2, var(--web-warning-surface));border:1px solid light-dark(#edd69b, var(--web-border));border-radius:9px;padding:11px 13px;margin:16px 0;font-size:.8rem;color:light-dark(#70571c, var(--web-warning))}
.drop-zone{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:175px;border:2px dashed light-dark(#b8c4d9, var(--web-border));border-radius:12px;background:light-dark(#fafbfe, var(--web-surface-subtle));cursor:pointer;text-align:center;padding:24px;color:light-dark(#5d687d, var(--web-muted))}
.drop-zone:hover,.drop-zone.dragging,.drop-zone:focus{border-color:#315bea;background:light-dark(#f2f5ff, var(--web-surface-subtle))}.drop-zone strong{color:light-dark(#28354d, var(--web-ink));margin:8px 0 3px}
.dialog-shell #document-label{width:100%;padding:11px;border:1px solid light-dark(#cbd2df, var(--web-border));border-radius:8px;background:light-dark(white, var(--web-surface))}.field-support{display:flex;justify-content:space-between;gap:12px;margin-top:5px;color:light-dark(#687188, var(--web-muted))}.field-support small:first-child{max-width:78%}
.upload-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:11px;background:light-dark(#e8edff, var(--web-selection-surface));color:light-dark(#3656bc, var(--web-link));font-size:1.4rem}
.selected-file[hidden],.upload-progress[hidden]{display:none}.selected-file{display:flex;align-items:center;gap:12px;border:1px solid light-dark(#dfe4ee, var(--web-border));border-radius:10px;padding:13px;margin:15px 0}.selected-file>span{display:grid;place-items:center;width:38px;height:42px;border-radius:8px;background:light-dark(#edf1ff, var(--web-surface-subtle));color:light-dark(#4964c3, var(--web-link))}.selected-file>div{display:flex;flex:1;min-width:0;flex-direction:column}.selected-file strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.selected-file small{color:light-dark(#69758b, var(--web-muted))}
.upload-progress{display:flex;align-items:center;gap:10px;color:light-dark(#536078, var(--web-muted));font-size:.8rem;margin-top:10px}.upload-progress i{width:10px;height:10px;border:2px solid light-dark(#cbd3e3, var(--web-border));border-radius:50%;animation:none}.upload-progress.upload-status-ready i{border-color:#3e9b70;background:light-dark(#e4f6ed, var(--web-surface-subtle))}.upload-progress.upload-status-loading i{width:18px;height:18px;border-color:light-dark(#cbd3e3, var(--web-border));border-top-color:#315bea;animation:spin .8s linear infinite}.upload-progress.upload-status-error i{border-color:#c46666;background:light-dark(#fff0f0, var(--web-surface-subtle))}@keyframes spin{to{rotate:360deg}}
.upload-progress>div{display:flex;flex-direction:column;gap:2px}.upload-progress strong{color:light-dark(#2d4071, var(--web-link))}.upload-progress span{color:light-dark(#687188, var(--web-muted))}.viewer-trust{display:flex;gap:10px;align-items:flex-start;margin:10px 0;padding:10px 12px;border:1px solid light-dark(#d8e0f5, var(--web-border));border-radius:8px;background:light-dark(#f8faff, var(--web-surface-subtle));color:light-dark(#536078, var(--web-muted));font-size:.76rem}.viewer-trust strong{color:light-dark(#2f4fae, var(--web-link));white-space:nowrap}.viewer-trust span{line-height:1.4}
.pdf-icon{font-size:.6rem;font-weight:800;color:light-dark(#b23838, var(--web-danger));background:light-dark(#fff0f0, var(--web-surface-subtle))}.viewer-dialog{width:min(1180px,calc(100vw - 16px));height:min(92vh,900px);height:min(calc(100dvh - 16px),900px);max-width:calc(100vw - 16px);max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);overflow:hidden}.viewer-shell{display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;padding:clamp(10px,1.4vw,16px)}.viewer-trust{display:flex;gap:8px;align-items:flex-start;margin:6px 0;padding:7px 10px;border:1px solid light-dark(#d8e0f5, var(--web-border));border-radius:8px;background:light-dark(#f8faff, var(--web-surface-subtle));color:light-dark(#536078, var(--web-muted));font-size:.74rem}.viewer-trust strong{color:light-dark(#2f4fae, var(--web-link));white-space:nowrap}.viewer-trust span{line-height:1.35}.viewer-page-region{display:flex;flex:1;flex-direction:column;gap:6px;min-width:0;min-height:0}.viewer-page-region[hidden]{display:none}.viewer-canvas-region{display:flex;align-items:center;justify-content:center;flex:1;min-width:0;min-height:0;overflow:auto;padding:6px;background:light-dark(#f4f6fa, var(--web-surface-subtle));border:1px solid light-dark(#e1e5ee, var(--web-border));border-radius:10px}.viewer-canvas-region[data-overflow-x="true"]{justify-content:flex-start}.viewer-canvas-region[data-overflow-y="true"]{align-items:flex-start}.viewer-canvas-region img{display:block;flex:0 0 auto;width:auto;height:auto;max-width:none;object-fit:contain;border:1px solid light-dark(#d1d8e5, var(--web-border));border-radius:5px;background:#fff;box-shadow:0 2px 8px #1f29371c}.viewer-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;flex-wrap:wrap;font-size:.8rem;color:light-dark(#536078, var(--web-muted))}.viewer-mode-controls,.viewer-navigation-controls{display:flex;align-items:center;justify-content:center;gap:6px;min-width:0;flex-wrap:wrap}.viewer-controls button{padding:8px 12px}.viewer-controls button:disabled{opacity:.5;cursor:not-allowed}.viewer-controls button[aria-pressed="true"]{border-color:#315bea;background:light-dark(#eef2ff, var(--web-surface-subtle));color:light-dark(#2847a8, var(--web-link))}.viewer-loading{display:grid;place-items:center;flex:1;color:light-dark(#687188, var(--web-muted))}.viewer-loading[hidden]{display:none}#pdf-viewer[hidden]{display:none}
@media(max-height:650px){.viewer-shell{padding:8px 12px}.viewer-shell .overline{margin-bottom:2px}.viewer-shell .dialog-heading h2{font-size:1.25rem}.viewer-shell .dialog-heading small{font-size:.7rem;line-height:1.2}.viewer-trust{margin:4px 0;padding:5px 8px}.viewer-page-region{gap:5px}.viewer-controls button{padding:7px 10px}}
@media(max-width:650px){.drop-zone{min-height:145px}.viewer-dialog{width:calc(100vw - 8px);height:calc(100vh - 8px);height:calc(100dvh - 8px);max-width:calc(100vw - 8px);max-height:calc(100vh - 8px);max-height:calc(100dvh - 8px)}.viewer-shell{padding:8px}.viewer-trust{font-size:.7rem}.viewer-trust strong{white-space:normal}.viewer-controls{align-items:stretch;flex-direction:column}.viewer-mode-controls{display:grid;width:100%;grid-template-columns:repeat(3,minmax(0,1fr))}.viewer-mode-controls button{min-width:0}.viewer-mode-controls #viewer-fit-page{grid-column:1}.viewer-mode-controls #viewer-fit-width{grid-column:2/4}.viewer-mode-controls #viewer-zoom-out{grid-column:1}.viewer-mode-controls #viewer-zoom-label{display:grid;grid-column:2;place-items:center}.viewer-mode-controls #viewer-zoom-in{grid-column:3}.viewer-navigation-controls{display:grid;width:100%;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}.viewer-navigation-controls button{min-width:0}.viewer-navigation-controls #viewer-download,.viewer-navigation-controls #viewer-print{grid-column:1/-1}.viewer-canvas-region{padding:4px}}
.protection-card{display:flex;gap:14px;align-items:flex-start;padding:17px 19px;margin-bottom:18px;border:1px solid light-dark(#dce4fa, var(--web-border));border-radius:12px;background:light-dark(#f6f8ff, var(--web-surface-subtle))}.protection-card>span{display:grid;place-items:center;flex:0 0 36px;height:36px;border-radius:9px;background:light-dark(#e2e9ff, var(--web-selection-surface));color:light-dark(#3152b4, var(--web-link));font-weight:800}.protection-card h2{font-size:.92rem;margin:1px 0 4px}.protection-card p{font-size:.82rem;color:light-dark(#4f5b70, var(--web-muted));margin:0}.protection-card small{display:block;margin-top:6px;color:light-dark(#747e91, var(--web-muted))}.restriction-label{display:inline-flex;align-items:center;padding:5px 7px;border-radius:6px;background:light-dark(#f0f2f6, var(--web-surface-subtle));color:light-dark(#667085, var(--web-muted));font-size:.7rem;font-weight:700}.viewer-shell .dialog-heading{align-items:flex-start}.viewer-shell .dialog-heading>div{min-width:0}.viewer-shell .dialog-heading .icon-button{flex:0 0 auto;line-height:1;padding:4px 8px}.viewer-shell .dialog-heading h2{overflow-wrap:anywhere}.viewer-shell .dialog-heading small{display:block;color:light-dark(#6b7588, var(--web-muted));margin-top:4px;max-width:780px}
.library-tools{display:flex;align-items:end;gap:10px;padding:0 20px 14px}.library-tools>label{position:absolute;width:1px;height:1px;overflow:hidden}.library-tools input{flex:1;min-width:160px;padding:10px 12px;border:1px solid light-dark(#d9dfeb, var(--web-border));border-radius:8px}.segmented{display:flex;padding:3px;background:light-dark(#f0f2f6, var(--web-surface-subtle));border-radius:8px}.segmented button{border:0;background:transparent;padding:7px 10px;border-radius:6px;color:light-dark(#657086, var(--web-muted));cursor:pointer}.segmented button.active{background:light-dark(#fff, var(--web-surface));color:light-dark(#26334c, var(--web-ink));box-shadow:0 1px 3px #cbd1dc}.relationship-label,.classification-label{display:inline-block;margin:4px 7px 2px 0;font-size:.7rem;font-weight:700}.relationship-label{color:light-dark(#61709a, var(--web-muted))}.classification-label{padding:2px 6px;border:1px solid light-dark(#d8deeb, var(--web-border));border-radius:999px;background:light-dark(#fff, var(--web-surface));color:light-dark(#566178, var(--web-muted))}.access-list-section{margin-top:20px;border-top:1px solid light-dark(#e3e7ef, var(--web-border));padding-top:15px}.access-list-section h3{font-size:.86rem}.access-list{display:grid;gap:8px}.access-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px;border:1px solid light-dark(#e3e7ef, var(--web-border));border-radius:8px}.access-row div{display:flex;flex-direction:column}.access-row small{color:light-dark(#717c90, var(--web-muted))}.share-summary{color:light-dark(#616d82, var(--web-muted));font-size:.82rem}.dialog-shell #create-grant{width:100%;margin-top:10px}.share-terms{border:1px solid light-dark(#e3e7ef, var(--web-border));border-radius:8px;padding:10px;display:grid;gap:8px}.share-terms legend{font-weight:700;padding:0 4px}.share-terms label{display:flex;gap:8px;align-items:center}.share-terms input[type='datetime-local'],.share-terms input[type='number']{width:100%;padding:8px;border:1px solid light-dark(#d9dfeb, var(--web-border));border-radius:6px}@media(max-width:600px){.library-tools{align-items:stretch;flex-direction:column}.segmented{overflow-x:auto}.access-row{align-items:flex-start;flex-direction:column}}
.details-title-editor{margin:0 0 14px;padding:14px;border:1px solid light-dark(#d8e0f5, var(--web-border));border-radius:10px;background:light-dark(#f8faff, var(--web-surface-subtle))}.details-title-editor label{display:block;font-size:.8rem;font-weight:700}.details-title-editor input{width:100%;margin:6px 0 4px;padding:10px;border:1px solid light-dark(#cbd2df, var(--web-border));border-radius:8px}.details-title-editor>small{display:block;color:light-dark(#69748a, var(--web-muted));font-size:.72rem}.details-title-editor>div{display:flex;justify-content:flex-end;gap:8px}.details-title-editor[hidden]{display:none}
.details-protection-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 14px;padding:12px;border:1px solid light-dark(#d8e0f5, var(--web-border));border-radius:10px;background:light-dark(#f8faff, var(--web-surface-subtle))}.details-protection-fields span{display:flex;flex-direction:column;gap:3px;color:light-dark(#26334c, var(--web-ink));font-size:.8rem}.details-protection-fields strong{color:light-dark(#778196, var(--web-muted));font-size:.68rem;text-transform:uppercase;letter-spacing:.05em}.details-protection-fields time{font-size:.8rem}@media(max-width:600px){.details-protection-fields{grid-template-columns:1fr}}
#details-dialog{width:min(720px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto}.details-shell{width:100%;min-width:0}.details-shell .dialog-heading>div,.details-hero div,.details-grid div{min-width:0}.details-shell .dialog-heading h2,.details-grid dd,.details-grid code{overflow-wrap:anywhere}.details-hero{display:flex;align-items:center;gap:12px;padding:14px;border-radius:10px;background:light-dark(#f2f5ff, var(--web-surface-subtle))}.details-hero>span{display:grid;place-items:center;flex:0 0 auto;width:46px;height:46px;border-radius:9px;background:#3857d6;color:#fff;font-size:.72rem;font-weight:800}.details-hero div{display:flex;flex-direction:column}.details-hero small{color:light-dark(#69748a, var(--web-muted))}.details-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin:18px 0;border:1px solid light-dark(#e1e5ee, var(--web-border));border-radius:10px;overflow:hidden}.details-grid div{padding:12px 14px;border-bottom:1px solid light-dark(#e8ebf1, var(--web-border))}.details-grid div:nth-child(odd){border-right:1px solid light-dark(#e8ebf1, var(--web-border))}.details-grid dt{color:light-dark(#778196, var(--web-muted));font-size:.7rem;text-transform:uppercase;letter-spacing:.05em}.details-grid dd{margin:4px 0 0;color:light-dark(#26334c, var(--web-ink));font-size:.85rem;font-weight:650}.policy-summary{padding:14px;border:1px solid light-dark(#d8e0f5, var(--web-border));border-radius:10px;background:light-dark(#f8faff, var(--web-surface-subtle))}.policy-summary h3{margin:0;font-size:.88rem}.policy-summary ul{margin:9px 0;padding-left:18px;color:light-dark(#455168, var(--web-muted));font-size:.8rem}.policy-summary small{color:light-dark(#69748a, var(--web-muted))}.shared-access-summary{display:flex;justify-content:space-between;gap:12px;margin-top:12px;padding:11px 13px;border-radius:8px;background:light-dark(#eff8f2, var(--web-surface-subtle));color:light-dark(#27633c, var(--web-success));font-size:.8rem}.shared-access-summary[hidden]{display:none}@media(max-width:600px){#details-dialog{width:calc(100vw - 16px);max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.details-grid{grid-template-columns:1fr}.details-grid div:nth-child(odd){border-right:0}.details-shell .dialog-actions{align-items:stretch;flex-direction:column-reverse}.details-shell .dialog-actions button{width:100%}}
.viewer-dialog{width:min(1180px,calc(100% - 16px));max-width:calc(100% - 16px)}
@media(max-width:650px){.viewer-dialog{width:calc(100% - 8px);max-width:calc(100% - 8px)}}
/* Browser printing of the protected viewer is always blank. The separate
   permission-controlled print page does not contain this open dialog.
   Deriving state from the dialog also covers loading, Escape, and removal. */
@media print {
  html:has(#viewer-dialog[open]),
  html:has(#viewer-dialog[open]) body {
    background: white !important;
    background-image: none !important;
  }

  html:has(#viewer-dialog[open]) body > *,
  html:has(#viewer-dialog[open])::before,
  html:has(#viewer-dialog[open])::after,
  html:has(#viewer-dialog[open]) body::before,
  html:has(#viewer-dialog[open]) body::after {
    display: none !important;
  }

  #viewer-dialog[open]::backdrop {
    background: transparent !important;
  }
}

/* Issue #43: concise protected-workspace disclosure after the primary task. */
.protection-card{display:block;padding:0;margin-bottom:18px;border-color:light-dark(#b8dfcb, var(--web-border));background:light-dark(#f4fbf7, var(--web-surface-subtle))}
.protection-card summary{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px 17px;cursor:pointer;list-style:none}
.protection-card summary::-webkit-details-marker{display:none}
.protection-card summary:focus-visible{outline:3px solid light-dark(#dfad37, var(--web-control-border));outline-offset:2px;border-radius:10px}
.protection-card .protection-mark{display:grid;place-items:center;width:36px;height:36px;border-radius:9px;background:light-dark(#dff6e7, var(--web-success-surface));color:light-dark(#1b8354, var(--web-success));font-weight:800}
.protection-card summary strong{display:block;font-size:.92rem;color:light-dark(#173d2d, var(--web-success))}
.protection-card summary small{display:block;margin:2px 0 0;color:light-dark(#4f6f60, var(--web-success))}
.protection-card .protection-action{color:light-dark(#1b8354, var(--web-success));font-size:.78rem;font-weight:700;white-space:nowrap}
.protection-card .protection-details{padding:0 17px 15px 65px;border-top:1px solid light-dark(#d4eadf, var(--web-border));color:light-dark(#4f5b70, var(--web-muted))}
.protection-card .protection-details>strong{display:block;margin-top:13px;font-size:.82rem;color:light-dark(#26394f, var(--web-ink))}
.protection-card .protection-details p{margin:4px 0 0;font-size:.82rem}
.protection-card .protection-details small{margin-top:6px}
@media(max-width:650px){.protection-card summary{grid-template-columns:auto minmax(0,1fr)}.protection-card .protection-action{grid-column:2;white-space:normal}.protection-card .protection-details{padding-inline:17px}}
