/*
 * Clinic panel modal contract.
 *
 * Modal bars must own an opaque surface. Internal section and table headers
 * may be transparent, but modal headers and footers cannot allow scrolling
 * content to bleed through them.
 */
.fi-modal-window {
    background: var(--om-app-surface, var(--om-surface, #fff)) !important;
}

.fi-modal-header,
.fi-modal-content,
.fi-modal-footer {
    border-color: var(--om-app-border, var(--om-border, rgba(0, 0, 0, .12))) !important;
    background: var(--om-app-surface, var(--om-surface, #fff)) !important;
}

.fi-modal-header,
.fi-modal-footer {
    background: var(--om-app-surface-strong, var(--om-surface-raised, #fff)) !important;
}

.fi-modal-slide-over > .fi-modal-window-ctn > .fi-modal-window {
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.fi-modal-slide-over > .fi-modal-window-ctn > .fi-modal-window > .fi-modal-header {
    position: sticky;
    z-index: 40;
    top: 0;
    border-bottom: 1px solid var(--om-app-border, var(--om-border, rgba(0, 0, 0, .12)));
}

.fi-modal-slide-over > .fi-modal-window-ctn > .fi-modal-window > .fi-modal-footer {
    position: sticky;
    z-index: 40;
    bottom: 0;
    border-top: 1px solid var(--om-app-border, var(--om-border, rgba(0, 0, 0, .12)));
    box-shadow: 0 -12px 28px color-mix(in srgb, var(--om-app-canvas-deep, #000) 16%, transparent);
}

/* Dashboard horizontal clipping belongs to the dashboard root, never to the
 * Filament shell. Fixed action layers therefore keep their normal shell
 * behavior while the page prevents horizontal bleed locally. */
.om-dashboard {
    overflow-x: clip;
}

/*
 * Diagnostics uses the Filament table pagination as its visual footer. The
 * header remains the slide-over header, the rows are the only scrollable
 * region, and pagination stays anchored below them.
 */
.fi-modal-window:has(.om-diagnostics-table-shell) {
    overflow: hidden !important;
}

.fi-modal-window:has(.om-diagnostics-table-shell) > .fi-modal-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden !important;
}

.fi-modal-window:has(.om-diagnostics-table-shell) > .fi-modal-footer {
    display: none !important;
}

.om-diagnostics-table-shell {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.om-diagnostics-table-shell .fi-ta,
.om-diagnostics-table-shell .fi-ta-ctn,
.om-diagnostics-table-shell .fi-ta-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.om-diagnostics-table-shell .fi-ta-header-ctn {
    flex: 0 0 auto;
}

.om-diagnostics-table-shell .fi-ta-content-ctn {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.om-diagnostics-table-shell .fi-pagination {
    position: relative;
    z-index: 30;
    flex: 0 0 auto;
    border-top: 1px solid var(--om-app-border, var(--om-border, rgba(0, 0, 0, .12))) !important;
    background: var(--om-app-surface-strong, var(--om-surface-raised, #fff)) !important;
    box-shadow: 0 -10px 26px color-mix(in srgb, var(--om-app-canvas-deep, #000) 18%, transparent);
}

@media (max-width: 768px) {
    .fi-modal-window:has(.om-diagnostics-table-shell) > .fi-modal-content {
        min-height: 0;
    }

    .om-diagnostics-table-shell {
        min-height: 0;
    }
}
