/*
 * Shared item/service lookup layout.
 * This file owns only the document-line lookup shell and intentionally loads
 * after the theme layer so legacy lookup geometry cannot reappear.
 */

html body .vario-document-line-lookup-bottom-search-modal,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal {
    z-index: 43000 !important;
    padding: 0 !important;
    background: var(--vario-window-overlay) !important;
    backdrop-filter: none !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-directory-lookup-dialog,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-directory-lookup-dialog {
    width: min(1380px, calc(100% - 44px), calc(100vw - 44px)) !important;
    max-width: min(1380px, calc(100% - 44px), calc(100vw - 44px)) !important;
    height: calc(100dvh - 76px) !important;
    max-height: calc(100dvh - 76px) !important;
    margin: 62px auto 14px !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout {
    --vario-directory-bottom-panel-height: var(--vario-size-line-lookup-search-height);
    --vario-directory-bottom-panel-min-height: var(--vario-size-line-lookup-search-min-height);
    --vario-directory-bottom-panel-reserved-height: 226px;
    display: grid !important;
    grid-template-rows: var(--vario-size-line-lookup-header-height) minmax(0, 1fr) var(--vario-size-line-lookup-footer-height) !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    border: 1px solid var(--vario-window-frame-border) !important;
    border-radius: 8px !important;
    background: var(--vario-modal-body-bg) !important;
    color: var(--vario-text) !important;
    box-shadow: var(--vario-shadow-popover) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout-with-selection,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout-with-selection {
    --vario-size-register-bottom-panel-height: var(--vario-size-line-lookup-lower-area-height);
    --vario-size-register-bottom-panel-min-height: var(--vario-size-line-lookup-lower-area-min-height);
    --vario-size-register-bottom-panel-max-height: var(--vario-size-line-lookup-lower-area-max-height);
    --vario-ratio-register-search-panel: var(--vario-ratio-line-lookup-search-panel);
    --vario-ratio-register-search-panel-min: var(--vario-ratio-line-lookup-search-panel-min);
    --vario-ratio-register-search-panel-max: var(--vario-ratio-line-lookup-search-panel-max);
    --vario-directory-bottom-panel-height: var(--vario-size-line-lookup-lower-area-height);
    --vario-directory-bottom-panel-min-height: var(--vario-size-line-lookup-lower-area-min-height);
    --vario-directory-bottom-panel-max-height: var(--vario-size-line-lookup-lower-area-max-height);
    --vario-directory-search-panel-percent: var(--vario-ratio-line-lookup-search-panel);
    --vario-size-register-panel-stacked-min-height: min(430px, 58dvh);
}

html body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-header,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    height: var(--vario-size-line-lookup-header-height) !important;
    min-height: var(--vario-size-line-lookup-header-height) !important;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 7px 7px 0 0 !important;
    background: var(--vario-window-header-bg) !important;
    color: var(--vario-color-text-on-primary) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-title,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-title {
    gap: 9px !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-icon,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-icon {
    width: 30px !important;
    height: 30px !important;
    border: 1px solid color-mix(in srgb, var(--vario-color-text-on-primary) 28%, transparent) !important;
    border-radius: 6px !important;
    background: color-mix(in srgb, var(--vario-color-text-on-primary) 8%, transparent) !important;
    color: var(--vario-color-text-on-primary) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-title h5,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-title h5 {
    color: var(--vario-color-text-on-primary) !important;
    font: 800 16px/19px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-title small,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-erp-document-card-title small {
    display: block !important;
    color: color-mix(in srgb, var(--vario-color-text-on-primary) 86%, transparent) !important;
    font: 600 10px/13px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-bottom-search-body,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-body {
    position: relative !important;
    display: grid !important;
    grid-template-rows: minmax(126px, 1fr) var(--vario-size-line-lookup-resizer-height) var(--vario-directory-bottom-panel-height) !important;
    gap: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: var(--vario-modal-body-bg) !important;
}

/* Single-choice directories reuse the same bottom-search shell without an
   artificial second grid. The catalog receives all remaining vertical space. */
html body .vario-document-line-lookup-bottom-search-body[data-vario-has-selection-preview="false"],
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-body[data-vario-has-selection-preview="false"] {
    grid-template-rows: minmax(126px, 1fr) var(--vario-size-line-lookup-resizer-height) var(--vario-directory-bottom-panel-height) !important;
}

html body .vario-document-line-lookup-bottom-search-body > .vario-erp-section,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-body > .vario-erp-section {
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--vario-grid-bg) !important;
    box-shadow: none !important;
}

html body .vario-document-line-lookup-catalog,
html[data-vario-theme] body .vario-document-line-lookup-catalog {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) var(--vario-size-grid-footer-height, 28px) !important;
    overflow: hidden !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-directory-lookup-grid-wrap,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-directory-lookup-grid-wrap {
    height: auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    border: 0 !important;
    background: var(--vario-grid-bg) !important;
    scrollbar-gutter: stable !important;
}

html body .vario-document-line-lookup-lower-grid,
html[data-vario-theme] body .vario-document-line-lookup-lower-grid {
    display: block !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 8px 8px 0 !important;
    overflow: hidden !important;
    background: var(--vario-modal-body-bg) !important;
}

html body .vario-document-line-lookup-selection-count,
html[data-vario-theme] body .vario-document-line-lookup-selection-count {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 20px !important;
    height: 19px !important;
    margin-left: auto !important;
    padding: 0 5px !important;
    border-radius: 5px !important;
    background: var(--vario-color-primary-500) !important;
    color: var(--vario-color-text-on-primary) !important;
    font: 700 10px/14px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-selection-content,
html[data-vario-theme] body .vario-document-line-lookup-selection-content {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-rows: 25px minmax(0, 1fr) var(--vario-size-grid-footer-height, 28px) !important;
    height: 100% !important;
    min-height: 0 !important;
    background: var(--vario-surface) !important;
}

html body .vario-document-line-lookup-selection-legend,
html[data-vario-theme] body .vario-document-line-lookup-selection-legend {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
    padding: 0 10px !important;
    border-bottom: 1px solid var(--vario-border-soft) !important;
    background: var(--vario-surface-muted) !important;
    color: var(--vario-text-muted) !important;
    font: 600 9px/13px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-selection-legend > span,
html[data-vario-theme] body .vario-document-line-lookup-selection-legend > span {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
}

html body .vario-document-line-lookup-selection-legend i,
html[data-vario-theme] body .vario-document-line-lookup-selection-legend i {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: var(--vario-text) !important;
}

html body .vario-document-line-lookup-selection-legend .pending i,
html[data-vario-theme] body .vario-document-line-lookup-selection-legend .pending i {
    background: var(--vario-color-primary-500) !important;
}

html body .vario-document-line-lookup-selection-list,
html[data-vario-theme] body .vario-document-line-lookup-selection-list {
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: auto !important;
    overscroll-behavior: contain !important;
    background: var(--vario-surface) !important;
    scrollbar-gutter: stable !important;
}

html body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry,
html[data-vario-theme] body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry {
    border-left: 3px solid transparent !important;
    color: var(--vario-text) !important;
}

html body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry > td,
html[data-vario-theme] body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry > td {
    color: inherit !important;
}

html body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry.is-pending,
html[data-vario-theme] body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry.is-pending {
    border-left-color: var(--vario-color-primary-500) !important;
    color: var(--vario-color-primary-600) !important;
}

html body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry.is-pending > td,
html[data-vario-theme] body .vario-document-line-lookup-selection-table tbody tr.vario-document-line-lookup-selection-entry.is-pending > td {
    background: color-mix(in srgb, var(--vario-surface-hover) 56%, var(--vario-grid-bg)) !important;
}

html body .vario-document-line-lookup-selection-name,
html[data-vario-theme] body .vario-document-line-lookup-selection-name {
    display: inline-block !important;
    max-width: calc(100% - 72px) !important;
    overflow: hidden !important;
    color: currentColor !important;
    font-weight: 700 !important;
    text-overflow: ellipsis !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

html body .vario-document-line-lookup-selection-state-label,
html[data-vario-theme] body .vario-document-line-lookup-selection-state-label {
    display: inline-flex !important;
    align-items: center !important;
    height: 16px !important;
    margin-left: 5px !important;
    padding: 0 4px !important;
    border: 1px solid var(--vario-border) !important;
    border-radius: 4px !important;
    background: var(--vario-surface-muted) !important;
    color: var(--vario-text-muted) !important;
    font: 700 8px/12px var(--vario-font-family-ui) !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

html body .is-pending .vario-document-line-lookup-selection-state-label,
html[data-vario-theme] body .is-pending .vario-document-line-lookup-selection-state-label {
    border-color: var(--vario-color-focus-ring) !important;
    background: var(--vario-surface-hover) !important;
    color: var(--vario-color-primary-600) !important;
}

html body .vario-document-line-lookup-selection-table .vario-document-selection-quantity-trigger,
html body .vario-document-line-lookup-selection-table .vario-document-line-lookup-selection-quantity,
html[data-vario-theme] body .vario-document-line-lookup-selection-table .vario-document-selection-quantity-trigger,
html[data-vario-theme] body .vario-document-line-lookup-selection-table .vario-document-line-lookup-selection-quantity {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 58px !important;
    height: 20px !important;
    min-height: 20px !important;
    padding: 0 6px !important;
    border: 1px solid var(--vario-border-strong) !important;
    border-radius: 5px !important;
    background: var(--vario-input-bg) !important;
    color: currentColor !important;
    font: 700 10.8px/18px var(--vario-font-family-ui) !important;
    font-variant-numeric: tabular-nums !important;
}

html body .vario-document-line-lookup-selection-remove,
html[data-vario-theme] body .vario-document-line-lookup-selection-remove {
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    padding: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: currentColor !important;
}

html body .vario-document-line-lookup-selection-remove:hover,
html[data-vario-theme] body .vario-document-line-lookup-selection-remove:hover {
    border-color: var(--vario-border) !important;
    background: var(--vario-surface-hover) !important;
    color: var(--vario-color-primary-600) !important;
}

html body .vario-document-line-lookup-selection-remove .nav-icon,
html[data-vario-theme] body .vario-document-line-lookup-selection-remove .nav-icon {
    width: 12px !important;
    height: 12px !important;
}

html body .vario-document-line-lookup-selection-action-column,
html[data-vario-theme] body .vario-document-line-lookup-selection-action-column {
    width: 36px !important;
    min-width: 36px !important;
    padding-right: 6px !important;
    padding-left: 6px !important;
    text-align: center !important;
}

html body .vario-document-line-lookup-selection-empty,
html[data-vario-theme] body .vario-document-line-lookup-selection-empty {
    display: grid !important;
    place-items: start !important;
    min-height: 100% !important;
    padding: 12px !important;
    color: var(--vario-text-muted) !important;
    font: 600 10px/15px var(--vario-font-family-ui) !important;
    text-align: left !important;
}

html body .vario-document-line-lookup-selection-content > .vario-grid-footer,
html[data-vario-theme] body .vario-document-line-lookup-selection-content > .vario-grid-footer {
    min-width: 0 !important;
}

html body .vario-document-line-lookup-selection-total,
html[data-vario-theme] body .vario-document-line-lookup-selection-total {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    min-width: 0 !important;
    color: var(--vario-text-muted) !important;
    font: 600 9px/13px var(--vario-font-family-ui) !important;
    white-space: nowrap !important;
}

html body .vario-document-line-lookup-selection-total strong,
html[data-vario-theme] body .vario-document-line-lookup-selection-total strong {
    color: var(--vario-text) !important;
    font-weight: 800 !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-data-grid,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-data-grid {
    width: max-content !important;
    min-width: 100% !important;
    margin: 0 !important;
    table-layout: fixed !important;
    color: var(--vario-text) !important;
    font: 600 11px/16px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-data-grid thead th,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-data-grid thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 3 !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 8px !important;
    border-color: var(--vario-border) !important;
    background: var(--vario-grid-header-bg) !important;
    color: var(--vario-text-strong) !important;
    font: 700 11px/24px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody tr,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody tr,
html body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody td,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody td {
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody td,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody td {
    padding: 0 8px !important;
    border-color: var(--vario-border-soft) !important;
    background: var(--vario-grid-bg) !important;
    color: var(--vario-text) !important;
    font: 600 11px/20px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-selection-quantity-trigger,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-selection-quantity-trigger {
    border-color: var(--vario-border-strong) !important;
    background: var(--vario-input-bg) !important;
    color: var(--vario-text) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-selection-quantity-trigger:hover,
html body .vario-document-line-lookup-bottom-search-modal .vario-document-selection-quantity-trigger:focus-visible,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-selection-quantity-trigger:hover,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-selection-quantity-trigger:focus-visible {
    border-color: var(--vario-color-primary-500) !important;
    background: var(--vario-surface-hover) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor,
html body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor::after,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor::after {
    border-color: var(--vario-border-strong) !important;
    background: var(--vario-menu-bg) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor {
    box-shadow: var(--vario-shadow-popover) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor button:not(.confirm),
html body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor input,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor button:not(.confirm),
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor input {
    border-color: var(--vario-border-strong) !important;
    background: var(--vario-input-bg) !important;
    color: var(--vario-text) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor button:not(.confirm):hover,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-lookup-quantity-editor button:not(.confirm):hover {
    border-color: var(--vario-color-primary-500) !important;
    background: var(--vario-surface-hover) !important;
}

html body .vario-document-line-lookup-search-resizer,
html[data-vario-theme] body .vario-document-line-lookup-search-resizer {
    position: relative !important;
    z-index: 6 !important;
    height: var(--vario-size-line-lookup-resizer-height) !important;
    min-height: var(--vario-size-line-lookup-resizer-height) !important;
    border-top: 1px solid var(--vario-border) !important;
    border-bottom: 1px solid var(--vario-border) !important;
    background: var(--vario-surface-muted) !important;
    cursor: ns-resize !important;
}

html body .vario-document-line-lookup-search-resizer::after,
html[data-vario-theme] body .vario-document-line-lookup-search-resizer::after {
    content: "" !important;
    position: absolute !important;
    top: 3px !important;
    left: calc(50% - 16px) !important;
    width: 32px !important;
    height: 2px !important;
    border-radius: 2px !important;
    background: var(--vario-border-strong) !important;
}

html body .vario-document-line-lookup-bottom-search-modal .vario-grid-footer,
html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-grid-footer {
    height: 28px !important;
    min-height: 28px !important;
    padding: 2px 7px !important;
    border-color: var(--vario-border) !important;
    background: var(--vario-surface-muted) !important;
    color: var(--vario-text-muted) !important;
}

html body .vario-document-line-lookup-modal .vario-document-line-lookup-footer,
html[data-vario-theme] body .vario-document-line-lookup-modal .vario-document-line-lookup-footer {
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    height: var(--vario-size-line-lookup-footer-height) !important;
    min-height: var(--vario-size-line-lookup-footer-height) !important;
    padding: 6px 10px !important;
    border-top: 1px solid var(--vario-border) !important;
    background: var(--vario-surface-muted) !important;
}

html body .vario-document-line-lookup-modal .vario-document-line-lookup-footer > .vario-document-directory-lookup-status,
html[data-vario-theme] body .vario-document-line-lookup-modal .vario-document-line-lookup-footer > .vario-document-directory-lookup-status {
    margin-left: auto !important;
    margin-right: 0 !important;
    color: var(--vario-text-muted) !important;
    font: 500 10px/14px var(--vario-font-family-ui) !important;
}

html body .vario-document-line-lookup-modal .vario-document-line-lookup-footer .vario-document-directory-lookup-footer-actions,
html[data-vario-theme] body .vario-document-line-lookup-modal .vario-document-line-lookup-footer .vario-document-directory-lookup-footer-actions {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
}

html body .vario-document-line-lookup-modal .vario-document-line-lookup-footer .btn,
html[data-vario-theme] body .vario-document-line-lookup-modal .vario-document-line-lookup-footer .btn {
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 12px !important;
    border-radius: 6px !important;
    font: 700 11px/24px var(--vario-font-family-ui) !important;
}

html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-data-grid tbody td {
    background: var(--vario-grid-bg) !important;
    color: var(--vario-text) !important;
}

@media (max-width: 760px) {
    html body .vario-document-line-lookup-bottom-search-modal .vario-document-directory-lookup-dialog,
    html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-directory-lookup-dialog {
        width: calc(100vw - 8px) !important;
        max-width: calc(100vw - 8px) !important;
        height: calc(100dvh - 8px) !important;
        max-height: calc(100dvh - 8px) !important;
        margin: 4px auto !important;
    }

    html body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout-single-catalog,
    html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout-single-catalog {
        --vario-directory-bottom-panel-height: min(254px, 42dvh);
    }

    html body .vario-document-line-lookup-bottom-search-body,
    html[data-vario-theme] body .vario-document-line-lookup-bottom-search-body,
    html body .vario-document-line-lookup-bottom-search-body[data-vario-has-selection-preview="false"],
    html[data-vario-theme] body .vario-document-line-lookup-bottom-search-body[data-vario-has-selection-preview="false"] {
        grid-template-rows: minmax(118px, 1fr) var(--vario-size-line-lookup-resizer-height) var(--vario-directory-bottom-panel-height) !important;
    }

    html body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout-with-selection,
    html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal .vario-document-line-lookup-layout-with-selection {
        --vario-directory-bottom-panel-min-height: min(430px, 58dvh);
    }

    /* Desktop preferences stay unchanged while the two panes stack on narrow
       screens and retain independently scrollable content. */
    html body .vario-document-line-lookup-with-selection,
    html[data-vario-theme] body .vario-document-line-lookup-with-selection {
        grid-template-rows: minmax(118px, 1fr) var(--vario-size-line-lookup-resizer-height) max(var(--vario-directory-bottom-panel-height), var(--vario-directory-bottom-panel-min-height)) !important;
    }

    html body .vario-document-line-lookup-footer .vario-erp-modal-footer-actions .vario-button-secondary,
    html[data-vario-theme] body .vario-document-line-lookup-footer .vario-erp-modal-footer-actions .vario-button-secondary {
        display: none !important;
    }
}

@media (max-width: 580px) {
    html body .vario-document-line-lookup-selection-table,
    html[data-vario-theme] body .vario-document-line-lookup-selection-table {
        min-width: 690px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html body .vario-document-line-lookup-bottom-search-modal *,
    html[data-vario-theme] body .vario-document-line-lookup-bottom-search-modal * {
        scroll-behavior: auto !important;
    }
}
