/* Narrow tables scroll as a whole: fixed edge columns otherwise cover the data. */
.document-detail-page > div { min-width: 0; max-width: 100%; }
.document-detail-page h1 { overflow-wrap: anywhere; }
.document-bom-package .table-section-heading { flex-wrap: wrap; }
.document-bom-package .table-section-heading > div {
    flex: 1 1 18rem;
    min-width: 0;
    overflow-wrap: anywhere;
}
.document-bom-package .table-section-heading > a { flex: 0 0 auto; max-width: 100%; }
.compact-reader-nav, .reader-display-options { display: none; }
@media (min-width: 1181px) and (max-width: 1600px) {
    .preview-workspace, .preview-workspace.has-annotation-panel { grid-template-columns: 240px minmax(0, 1fr); }
    .preview-workspace.has-annotation-panel .annotation-panel { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 1180px) {
    .table-panel th:first-child, .table-panel td:first-child,
    .table-panel th:last-child, .table-panel td:last-child {
        position: static;
        left: auto;
        right: auto;
        z-index: auto;
        box-shadow: none;
    }
    .bom-prototype-table th:nth-child(4), .bom-prototype-table td:nth-child(4),
    .bom-prototype-table th:nth-child(6), .bom-prototype-table td:nth-child(6) { display: table-cell; }
}
@media (max-width: 1180px) {
    .drawing-reader-page .page { padding: 6px; min-width: 0; }
    .compact-reader-nav {
        display: flex;
        position: sticky;
        top: 58px;
        z-index: 10;
        gap: 4px;
        overflow-x: auto;
        padding: 4px 0 8px;
        background: var(--panel, #fff);
    }
    .compact-reader-nav button {
        flex: 1 0 auto;
        min-height: 44px;
        padding: 8px 12px;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        background: #fff;
        color: #334155;
        font: inherit;
        cursor: pointer;
    }
    .compact-reader-nav button[aria-pressed="true"] { background: #102a43; color: #fff; border-color: #102a43; }
    .drawing-reader-page [data-reader-section] { display: none; }
    .drawing-reader-page[data-reader-view="drawing"] [data-reader-section="drawing"],
    .drawing-reader-page[data-reader-view="directory"] [data-reader-section="directory"],
    .drawing-reader-page[data-reader-view="annotations"] [data-reader-section="annotations"],
    .drawing-reader-page[data-reader-view="review"] [data-reader-section="review"],
    .drawing-reader-page[data-reader-view="more"] [data-reader-section="more"] { display: block; }
    .drawing-reader-page .preview-workspace,
    .drawing-reader-page .bom-prototype-app {
        display: block;
        height: auto;
        min-height: 0;
        padding: 0;
        margin: 0;
    }
    .drawing-reader-page .bom-prototype-shell { margin: 0; }
    .drawing-reader-page .preview-document-column { min-width: 0; }
    .drawing-reader-page .preview-toolbar {
        gap: 4px;
        padding: 4px;
        margin-bottom: 4px;
    }
    .drawing-reader-page .preview-toolbar button,
    .drawing-reader-page .preview-toolbar select,
    .drawing-reader-page .preview-toolbar input { min-height: 40px; }
    .drawing-reader-page .preview-toolbar .preview-page-stepper-actions { display: none; }
    .drawing-reader-page .preview-toolbar label { gap: 4px; }
    .drawing-reader-page .preview-panel-pages {
        height: calc(100dvh - 185px);
        min-height: 160px;
        max-height: none;
        padding: 4px;
    }
    .drawing-reader-page .preview-page { margin: 0 auto; }
    .drawing-reader-page .drawing-directory,
    .drawing-reader-page .annotation-panel {
        position: static;
        height: auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }
    .drawing-reader-page .drawing-directory-list { max-height: 45dvh; overflow: auto; }
    .drawing-reader-page .drawing-page-info-stack { max-height: none; overflow: visible; }
    .drawing-reader-page .reader-display-options { display: block; }
    .reader-display-options summary { padding: 10px 8px; min-height: 40px; cursor: pointer; color: #334155; }
    .reader-display-options[open] { flex-basis: 100%; }
    .reader-display-options[open] > :not(summary) { margin: 4px; }
    .drawing-reader-page .bom-prototype-viewer {
        height: calc(100dvh - 130px);
        min-height: 260px;
    }
    .drawing-reader-page[data-reader-view="drawing"] .bom-prototype-viewer { display: flex; flex-direction: column; }
    .drawing-reader-page .bom-prototype-canvas { flex: 1; min-height: 0; padding: 6px; }
    .drawing-reader-page .bom-prototype-drawing img { max-height: none; }
    .drawing-reader-page .bom-prototype-viewer-head { flex-wrap: wrap; gap: 4px; padding: 6px; }
    .drawing-reader-page .bom-prototype-viewer-controls { flex-wrap: wrap; gap: 4px; }
    .drawing-reader-page .bom-prototype-icon { min-height: 40px; }
    .drawing-reader-page .bom-prototype-footer { flex-shrink: 0; }
    .drawing-reader-page .bom-prototype-catalog { height: calc(100dvh - 140px); }
    .drawing-reader-page .bom-prototype-review { min-height: 0; }
    .drawing-reader-page .bom-prototype-content { overflow: auto; max-height: 70dvh; }
    .drawing-reader-page .bom-prototype-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .drawing-reader-page .bom-prototype-tab { flex-shrink: 0; min-height: 44px; }
    .drawing-reader-page .bom-prototype-top { padding: 10px; }
    .drawing-reader-page .bom-prototype-file { display: block; white-space: nowrap; }
    .drawing-reader-page .bom-prototype-stats .bom-prototype-stat { display: inline; }
}
@media (max-width: 560px) {
    .drawing-reader-page .preview-panel-pages { height: calc(100dvh - 225px); }
}
