/* Private documents are drawn in a bounded canvas, never used as print assets. */
.document-preview-card { display: grid; grid-template-columns: 24px 52px minmax(0, 1fr); align-items: center; gap: .5rem; width: 100%; }
.document-preview-card p { margin: .4rem 0 0; }
.document-thumbnail, .selected-thumbnail { display: block; padding: .25rem; border: 1px solid var(--border); border-radius: .5rem; background: #e8edf4; cursor: pointer; overflow: hidden; }
.document-thumbnail { width: 52px; min-width: 52px; padding: 1px; }
.document-thumbnail img { display: block; width: 48px; height: 64px; object-fit: contain; background: white; }
.document-overview:not(:has(.document-thumbnail)) { grid-template-columns: 24px minmax(0, 1fr); }
.file-overview-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: .5rem; min-width: 0; }
.file-name { grid-column: 1 / -1; font-size: .9375rem; line-height: 1.3; overflow-wrap: anywhere; }
.file-page-count { font-size: .8125rem; color: var(--muted); }
.preview-text-button { min-height: 44px; padding: .2rem 0; border: 0; background: transparent; color: var(--brand-dark); font-size: .8125rem; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.file-overview-meta .preview-caption { grid-column: 1 / -1; }
.file-overview-meta .file-options-summary { grid-column: 1 / -1; margin: .15rem 0 0; }
.print-configure-button { white-space: nowrap; font-weight: 650; }
.print-preview-button { grid-column: 1 / -1; justify-self: start; }
.print-layout-ready [data-file-settings], .print-layout-ready [data-original-text-preview] { display: none; }
.preview-caption, .preview-selection-note { color: var(--muted); font-size: .875rem; }
.selected-document { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: .4rem .75rem; padding: .75rem; border: 1px solid var(--border); border-radius: .75rem; background: white; }
.selected-document > strong { grid-column: 2; grid-row: 1; overflow-wrap: anywhere; font-size: .9375rem; }
.selected-document > [data-selected-label] { grid-column: 2; grid-row: 2; font-size: .75rem; }
.selected-document > [data-selected-status] { grid-column: 1 / -1; font-size: .875rem; }
.selected-progress { grid-column: 1 / -1; width: 100%; height: .4rem; border: 0; border-radius: .25rem; overflow: hidden; accent-color: var(--brand); }
.selected-progress-detail { grid-column: 1 / -1; min-width: 0; color: var(--muted); font-size: .75rem; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.selected-document:not(:has(.selected-thumbnail:not([hidden]))) > strong, .selected-document:not(:has(.selected-thumbnail:not([hidden]))) > [data-selected-label] { grid-column: 1 / -1; }
.selected-document p { margin: 0; }
.selected-thumbnail { grid-column: 1; grid-row: 1 / 3; width: 60px; min-width: 60px; height: 80px; padding: 1px; align-self: start; display: flex; align-items: center; justify-content: center; }
.selected-thumbnail canvas, .selected-thumbnail img { display: block; max-width: 56px; max-height: 76px; width: auto !important; height: auto !important; object-fit: contain; background: white; }
.selected-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .35rem .6rem; }
.selected-actions button { min-height: 44px; font-size: .875rem; padding: .5rem .65rem; }
.selected-actions [data-selected-add], .selected-actions [data-selected-prepare] { flex: 1 1 100%; order: 1; }
.selected-actions [data-selected-retry] { flex: 1 1 auto; }
.selected-actions [data-selected-view] { flex: 1 1 100%; order: 0; padding: .15rem; background: transparent; border-color: transparent; text-decoration: underline; }
.selected-actions [data-selected-other], .selected-actions [data-selected-cancel] { width: auto; flex: 1 1 0; order: 2; padding: .3rem; font-size: .8125rem; background: transparent; border-color: transparent; }
[data-preview-ready]:has([data-selected-document]:not([hidden])) > .file-picker-row { display: none; }
[data-preview-ready] > button[type=submit], [data-preview-ready] > [data-upload-progress] { display: none; }
.document-viewer { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; color: #f8fafc; background: #172033; overscroll-behavior: none; }
.document-viewer[open] { display: flex; flex-direction: column; }
.viewer-workspace { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }
.viewer-content { position: relative; display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; }
.document-viewer::backdrop { background: #172033; }
.viewer-header { display: flex; flex: 0 0 auto; gap: .5rem; align-items: center; padding: calc(.35rem + var(--safe-top)) max(.6rem, env(safe-area-inset-right, 0px)) .35rem max(.75rem, env(safe-area-inset-left, 0px)); background: #fff; color: #172033; }
.viewer-heading { flex: 1 1 auto; min-width: 0; }
.viewer-heading h2 { font-size: .9375rem; line-height: 1.3; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-heading p { margin: .15rem 0 0; font-size: .6875rem; line-height: 1.25; color: #526078; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-close { flex: 0 0 44px; width: 44px; height: 44px; padding: .5rem; border: 0; border-radius: .4rem; background: #fff; color: #172033; font-size: 1.2rem; cursor: pointer; }
.viewer-page-group { display: flex; flex: 0 0 auto; align-items: center; min-height: 44px; }
.viewer-counter { min-height: 44px; padding: .3rem .2rem; border: 0; border-radius: .3rem; background: transparent; color: #172033; font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.viewer-counter:disabled { cursor: default; color: #526078; }
.viewer-page-group input { width: 4.5ch; min-width: 44px; height: 44px; padding: .25rem; border: 1px solid #94a3b8; border-radius: .3rem; color: #172033; background: #fff; text-align: center; font-size: 1rem; appearance: textfield; -moz-appearance: textfield; }
.viewer-page-group input::-webkit-inner-spin-button, .viewer-page-group input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.viewer-viewport { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: none; padding: 12px max(12px, env(safe-area-inset-right, 0px)) max(12px, var(--safe-bottom)) max(12px, env(safe-area-inset-left, 0px)); background: #475569; }
.viewer-paper { width: max-content; min-width: 100%; min-height: 100%; display: flex; justify-content: center; align-items: center; }
.viewer-paper canvas { display: block; flex: 0 0 auto; background: #fff; box-shadow: 0 2px 10px #17203380; }
.viewer-paper canvas.preview-monochrome { filter: grayscale(1); }
.viewer-feedback { position: absolute; z-index: 2; left: max(1rem, env(safe-area-inset-left, 0px)); right: max(1rem, env(safe-area-inset-right, 0px)); bottom: max(1rem, var(--safe-bottom)); display: flex; flex-direction: column; align-items: stretch; gap: .6rem; width: fit-content; max-width: 38rem; max-height: calc(100% - 2rem); margin: 0 auto; padding: .7rem .85rem; overflow-y: auto; border-radius: .5rem; font-size: .875rem; background: #172033f5; color: #f8fafc; }
.viewer-status { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }
.viewer-progress { width: 100%; min-width: 10rem; height: .45rem; accent-color: #a9c7ff; }
.viewer-retry { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 44px; padding: .5rem; border: 1px solid #dbe6f3; border-radius: .5rem; background: #172033; color: #fff; font-size: .875rem; cursor: pointer; }
.viewer-retry > span:first-child { font-size: 1.5rem; line-height: 1; }
.document-viewer :focus-visible { outline-color: #fbbf24; box-shadow: 0 0 0 3px #172033; }
.document-preview-card [hidden], .selected-document [hidden], .document-viewer [hidden], [data-selected-document][hidden], [data-preview-selection-note][hidden] { display: none !important; }
.print-editor { flex: 0 0 320px; min-width: 0; overflow-y: auto; overscroll-behavior: contain; color: #172033; background: #fff; border-left: 1px solid #d5deeb; }
.print-editor-inner { display: grid; gap: .65rem; padding: 1rem; }
.print-editor-title { margin: 0; font-size: .9375rem; line-height: 1.3; }
.print-layout-form { display: grid; grid-template-columns: 1fr; gap: .65rem; margin: 0; }
.print-layout-form label { display: grid; gap: .2rem; min-width: 0; font-size: .8125rem; font-weight: 600; }
.print-layout-form select, .print-layout-form input { width: 100%; min-width: 0; min-height: 44px; padding: .35rem .45rem; font-size: 1rem; border: 1px solid #b8c8d9; border-radius: .4rem; background: #fff; color: #172033; }
.print-layout-mode { grid-column: 1 / -1; min-width: 0; margin: 0; padding: 0; border: 0; }
.print-layout-mode legend { padding: 0 0 .2rem; font-size: .8125rem; font-weight: 600; }
.print-layout-mode-buttons { display: grid; grid-template-columns: minmax(0, 3fr) minmax(64px, 1fr); gap: .35rem; }
.print-layout-mode-buttons button { width: 100%; min-width: 0; min-height: 44px; padding: .4rem; border: 1px solid #b8c8d9; border-radius: .4rem; background: #fff; color: #172033; font-size: .875rem; font-weight: 600; cursor: pointer; }
.print-layout-mode-buttons button[aria-pressed="true"] { border-color: var(--brand-dark); background: #e8f1fd; color: var(--brand-dark); box-shadow: inset 0 0 0 1px var(--brand-dark); }
.print-layout-actions { display: grid; grid-template-columns: minmax(64px, 1fr) minmax(0, 3fr); gap: .5rem; }
.print-layout-actions button { width: 100%; min-height: 44px; padding: .5rem .25rem; font-size: .875rem; }
.print-layout-notice, .print-layout-warning, .print-layout-explanation { margin: 0; line-height: 1.35; font-size: .8125rem; }
.print-layout-notice { color: #526078; }
.print-layout-warning { color: #8e4111; background: #fff3dc; border-radius: .4rem; padding: .5rem; }
.print-layout-explanation { color: #526078; font-size: .75rem; }
.print-layout-remove, .print-layout-retry { width: auto; justify-self: start; min-height: 44px; border: 0; padding: .3rem 0; background: transparent; color: #9c2525; text-decoration: underline; cursor: pointer; font-size: .8125rem; }
.print-layout-retry { color: var(--brand-dark); }
.print-layout-ready > .print-layout-warning { margin-top: .5rem; }
@media (max-width: 700px) {
  .print-layout-viewer .viewer-workspace { flex-direction: column; }
  .print-layout-viewer .viewer-content { flex-basis: 0; min-height: 150px; }
  .print-layout-viewer .viewer-viewport { padding: .5rem; }
  .print-editor { flex: 0 1 auto; max-height: 52%; border-left: 0; border-top: 1px solid #d5deeb; }
  .print-editor-inner { gap: .4rem; padding: .6rem max(.65rem, env(safe-area-inset-right, 0px)) max(.6rem, var(--safe-bottom)) max(.65rem, env(safe-area-inset-left, 0px)); }
  .print-layout-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .5rem; }
  .print-layout-form label, .print-layout-mode legend { font-size: .75rem; }
  .print-layout-notice, .print-layout-warning { font-size: .75rem; }
  .print-layout-explanation { font-size: .6875rem; }
  .print-layout-remove { min-height: 28px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .print-layout-viewer .viewer-workspace { flex-direction: row; }
  .print-editor { flex: 0 0 42%; max-height: none; border-top: 0; border-left: 1px solid #d5deeb; }
}
.document-overview [data-original-text-preview] { display: none; }
.print-layout-fit-percent { white-space: nowrap; font-variant-numeric: tabular-nums; }
.print-layout-measurements { color: #526078; font-size: .75rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.print-layout-measurements p { margin: 0; }
@media (max-width: 700px) {
  .print-layout-mode-buttons button { font-size: .75rem; }
  .print-layout-measurements { font-size: .6875rem; }
}
.print-layout-viewer .viewer-workspace[data-split-orientation="portrait"] { flex-direction: column; }
.print-layout-viewer .viewer-workspace[data-split-orientation="landscape"] { flex-direction: row; }
.print-layout-viewer .viewer-content { flex: 0 0 var(--preview-pane-size); min-height: 0; min-width: 0; overflow: hidden; }
.print-layout-viewer .print-editor { flex: 0 0 var(--settings-pane-size); min-height: 0; min-width: 0; max-height: none; border: 0; }
.viewer-split { display: flex; flex: 0 0 44px; align-items: center; justify-content: center; gap: .35rem; min-height: 0; min-width: 0; padding: 0 .5rem; background: #e8edf4; color: #172033; border: 1px solid #c4cfdd; }
.viewer-split > span { flex: 0 0 auto; text-align: center; font-size: .6875rem; line-height: 1.2; }
.viewer-split output { display: block; font-size: .6875rem; font-variant-numeric: tabular-nums; color: #526078; }
.viewer-split input[type="range"] { flex: 1 1 auto; min-width: 44px; width: 100%; height: 44px; margin: 0; padding: 0; border: 0; accent-color: var(--brand-dark); cursor: ew-resize; touch-action: none; }
[data-split-orientation="landscape"] > .viewer-split { flex-basis: 64px; flex-direction: column; gap: .4rem; padding: .5rem 0; }
[data-split-orientation="landscape"] > .viewer-split input[type="range"] { width: 44px; height: 100%; min-height: 44px; writing-mode: vertical-lr; direction: rtl; cursor: ns-resize; }
