/* Administration workspace only: the 1024 x 768 terminal layout. */
@media (min-width: 761px) and (max-width: 1024px) {
    /* Keep wide data readable: its own wrapper scrolls instead of the page. */
    .admin-shell .table-wrap {
        max-width: 100%;
        overflow: auto;
        overscroll-behavior: contain;
    }

    /* An inbox card's footer is too narrow for its pills, times and amount on one row: the times take a row of their own. */
    .online-order-card-bottom { grid-template-columns: minmax(0, 1fr) auto; }
    .online-order-card-bottom > small { grid-column: 1 / -1; grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* The products list fits the column: the kitchen name (shown in the product's editor) gives way to the actions. */
    .admin-content .product-management-table { min-width: 0; }
    .product-management-table :is(th, td):nth-child(2) { display: none; }
    .product-management-table th:nth-child(1) { width: 22%; }
    .product-management-table th:nth-child(8) { width: 10.5rem; }

    /* A history row's four report actions sit two by two instead of in a single column. */
    .admin-shell .report-history-table .table-action-buttons {
        display: grid;
        grid-template-columns: repeat(2, max-content);
        justify-content: end;
    }

    /* ...which leaves room only when the period wraps onto two lines. */
    .admin-shell .report-history-table td:nth-child(2) { white-space: normal; }
    .admin-shell .report-history-table .button { min-width: 0; }

    .admin-shell :is(.form-grid, .database-settings-layout, .database-transfer-grid,
        .brand-settings-layout, .integration-settings-grid, .restaurant-report-filters) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-shell :is(.form-grid, .database-settings-layout, .database-transfer-grid,
        .brand-settings-layout, .integration-settings-grid, .restaurant-report-filters) > * {
        min-width: 0;
    }

    .admin-shell .form-grid > .field-wide {
        grid-column: 1 / -1;
    }

    /* The report and audit filters keep their one-row proportions (they fit 1024); the restaurant report's four
       fields take two rows, its button keeping its own width. The mapping toolbar wraps as a row of natural-width
       controls. */
    .admin-shell .restaurant-report-filters > .button {
        justify-self: start;
    }

    .admin-shell .platform-mapping-toolbar {
        display: flex;
    }

    .admin-shell .platform-mapping-toolbar > .field {
        flex: 1 1 14rem;
    }

    .admin-shell :is(.overview-metrics, .report-metric-grid, .settings-general-grid,
        .transaction-reason-grid, .restaurant-setting-grid) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Catalogue and product options retain their table actions in local scrollers. */
    .admin-shell .catalogue-filter-bar,
    .admin-shell .catalogue-filter-bar.compact-filter-bar {
        grid-template-columns: minmax(0, 1fr) repeat(2, minmax(0, .7fr));
    }

    .admin-shell .catalogue-filter-bar .catalogue-search-field,
    .admin-shell .catalogue-filter-bar.compact-filter-bar .catalogue-search-field {
        grid-column: 1 / -1;
    }

    .admin-shell .catalogue-clear-filters {
        grid-column: auto;
    }

    .admin-shell .configured-option-groups {
        max-height: none;
    }

    .admin-shell .split-admin:has(.configured-option-groups) {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-shell .configured-option-group-list {
        max-height: 28rem;
        overflow-y: auto;
    }

    .admin-shell .display-settings-preview {
        --display-preview-scale: .2;
    }

    /* Orders and delivery keep the list and selected order visible side by side; the search box shares the
       toolbar's first row with Order Number and Open, and the filters wrap beneath them. */
    .admin-orders-page .order-search-toolbar > .admin-order-search-field {
        order: -2;
        flex-basis: calc(100% - 13.85rem);
    }

    .admin-orders-page .order-search-toolbar > .admin-order-jump {
        order: -1;
    }

    .admin-orders-page .admin-order-result .order-result-middle {
        grid-template-columns: minmax(6.5rem, .82fr) minmax(0, 1.18fr) auto;
    }

    .admin-orders-page .admin-order-workspace,
    .admin-orders-page .online-order-admin-workspace {
        grid-template-columns: minmax(18rem, 41%) minmax(0, 1fr);
    }

    /* Printing, restaurant and platform settings need room for their controls. */
    .admin-shell .printing-layout,
    .admin-shell .coupon-layout,
    .admin-shell .printing-rules-card,
    .admin-shell .online-order-connection-layout,
    .admin-shell .restaurant-definition-layout,
    .admin-shell .course-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-shell .kitchen-station-list {
        grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    }

    .admin-shell .kitchen-stations-sidebar .card-heading-actions,
    .admin-shell .kitchen-stations-sidebar .card-heading-actions > .button {
        width: auto;
    }

    .admin-shell .terminal-card-grid,
    .admin-shell .connection-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-shell .restaurant-operation-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
    }

    .admin-shell .restaurant-charges-section {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .admin-shell :is(.receipt-printer-picker, .emergency-terminal-picker,
        .queue-toolbar, .card-heading-row, .catalogue-pagination, .form-actions) {
        flex-wrap: wrap;
        gap: .5rem;
    }

    .admin-shell :is(.receipt-printer-picker, .emergency-terminal-picker) select {
        min-width: min(100%, 18rem);
    }

    /* Keep the preview beside its inspector; the library uses a compact row above both. */
    .admin-shell .print-design-page {
        height: auto;
        grid-template-rows: auto;
    }

    .admin-shell .print-designer-layout {
        grid-template-columns: minmax(0, 1fr) 18rem;
        grid-template-rows: auto minmax(30rem, auto);
        height: auto;
    }

    .admin-shell .template-library-panel {
        grid-column: 1 / -1;
        grid-row: 1;
        grid-template-columns: 13rem minmax(0, 1fr) auto;
        grid-template-rows: auto;
        align-items: center;
    }

    .admin-shell .print-properties-panel {
        grid-column: 2;
        grid-row: 2;
        max-height: 42rem;
        overflow: hidden;
    }

    .admin-shell .print-canvas-panel {
        grid-column: 1;
        grid-row: 2;
        min-height: 30rem;
    }

    .admin-shell .template-library-list {
        display: flex;
        overflow: auto;
    }

    .admin-shell .template-library-list > button {
        flex: 0 0 12rem;
    }

    .admin-shell .template-library-panel > footer {
        border-top: 0;
    }

    .admin-shell .print-preview-stage {
        min-height: 24rem;
        max-height: 34rem;
    }

    /* The eight template tabs stay on one row; precision closes its gaps so all eight fit without scrolling. */
    .admin-shell .print-design-page .admin-workspace-navigation {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .admin-shell .print-design-page .admin-workspace-navigation > button {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    html[data-interface-theme="precision"] .admin-shell .print-design-page .admin-workspace-navigation {
        gap: .1rem;
    }

    html[data-interface-theme="precision"] .admin-shell .print-design-page .admin-workspace-navigation > button {
        font-size: .78rem;
        padding-inline: .5rem;
    }

    .admin-shell .print-style-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-shell .pos-modal {
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
    }

    .sales-report-filter-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-report-filter-groups fieldset:last-child { grid-column: 1 / -1; }
}
