/* READER-HEADERS-20261009: compact navigation owns its height in document flow.
   The document canvas exception never permits clipped surrounding actions. */
/* Keep the same reflow above the sidebar breakpoint: enlarged text can need
   another row even when the viewport itself is wide. */
@media (min-width: 0px) {
  .dashboard-main[data-stitch-reader-dashboard] {
    padding-top: 12px !important;
  }
  .dashboard-main[data-stitch-reader-dashboard] > .workspace-commandbar.stitch-topbar {
    position: static !important;
    left: auto !important;
    right: auto !important;
    width: auto !important;
    padding-inline: 0 !important;
    flex-wrap: wrap !important;
    height: auto !important;
    max-height: none !important;
    row-gap: 8px !important;
    column-gap: 12px !important;
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-topbar-title[data-reader-topbar-title] {
    flex: 1 1 calc(100% - 56px);
    flex-wrap: wrap;
    max-width: calc(100% - 56px);
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-topbar-title h1 {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.5 !important;
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-area-tabs {
    flex: 0 0 auto;
    max-width: 100%;
    margin-inline: 0;
    flex-wrap: wrap;
  }
  .dashboard-main[data-stitch-reader-dashboard] .author-global-utilities {
    flex-wrap: wrap;
    max-width: 100%;
  }
}

@media (min-width: 761px) {
  .target-document-shell.stitch-viewer-shell[data-processing-status="ready"] {
    height: auto;
    overflow: auto;
  }
  .target-document-shell[data-target-app-shell="document-viewer"][data-processing-status="ready"] > .review-header.stitch-topbar.viewer-topbar[data-stitch-viewer-chrome="single-row-toolbar"] {
    position: static !important;
    left: auto !important;
    right: auto !important;
    margin-left: var(--scriptsaver-workspace-sidebar, 0px) !important;
    width: calc(100% - var(--scriptsaver-workspace-sidebar, 0px)) !important;
    height: auto !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    row-gap: 8px !important;
    padding-block: 10px !important;
  }
  .target-document-shell[data-processing-status="ready"] > .review-header.viewer-topbar > .viewer-quick-actions[data-stitch-viewer-quick-actions] {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    min-width: 0 !important;
    max-width: 100%;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    /* Wrapped actions can cross the fixed feedback launcher's vertical lane. */
    padding-right: 60px !important;
  }
  /* The sidebar opener is hidden on desktop. Do not let auto-placement put
     the complete title into its now-empty 44px track. */
  .target-document-shell[data-processing-status="ready"] > .review-header.viewer-topbar > .viewer-document-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
  }
  .target-document-shell[data-processing-status="ready"] .viewer-document-kind {
    line-height: 1.5;
  }
  .target-document-shell[data-processing-status="ready"] > .review-header.viewer-topbar > .viewer-project-document-switcher {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    max-width: 100% !important;
  }
  .target-document-shell[data-processing-status="ready"] .document-workspace[data-stitch-viewer-layout="document-feedback"] {
    padding-top: 0 !important;
  }
  .target-document-shell[data-processing-status="ready"] .viewer-workbench-toolbar[data-stitch-viewer-workbench-toolbar="true"] {
    padding-right: 60px !important;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .dashboard-main[data-stitch-reader-dashboard] .reader-workbench[data-stitch-reader-workbench="shared-table"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-toolbar[data-stitch-reader-toolbar="true"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, .42fr) minmax(0, .5fr) auto auto;
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-toolbar label {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-toolbar :is(input, select) {
    min-width: 0;
  }
  .dashboard-main[data-stitch-reader-dashboard] .reader-shared-table {
    min-width: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-main[data-stitch-reader-dashboard] :is(.reader-shared-head, .reader-shared-row) {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, .55fr) 124px 132px;
  }
  .target-document-shell[data-target-app-shell="document-viewer"][data-processing-status="ready"] > .review-header.stitch-topbar.viewer-topbar[data-stitch-viewer-chrome="single-row-toolbar"] {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

@media (min-width: 761px) and (max-width: 1080px) {
  .target-document-shell[data-processing-status="ready"] .viewer-workbench-toolbar[data-stitch-viewer-workbench-toolbar="true"] {
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 8px !important;
  }
}

/* The header consumes its actual height, not an assumed 64px. Keep document
   scrolling in its owned panes so a native focus action cannot scroll chrome
   away underneath a viewport-fixed feedback launcher. */
@media (min-width: 1181px) {
  .target-document-shell.stitch-viewer-shell[data-processing-status="ready"] {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }
  .target-document-shell[data-processing-status="ready"] > .viewer-topbar {
    flex: 0 0 auto;
  }
  .target-document-shell[data-processing-status="ready"] > .document-workspace[data-stitch-viewer-layout="document-feedback"] {
    flex: 1 1 0;
    height: auto !important;
    min-height: 0 !important;
  }
}
