/**
 * Provider catalog — keep wide table inside panel; scroll horizontally inside the card.
 */

/* Flex/grid parents must allow shrinking or wide tables blow out the page layout. */
#provider-services-catalog-form,
#provider-services-catalog-form .fi-section,
#provider-services-catalog-form .fi-section-content-ctn,
#provider-services-catalog-form .fi-sc-component,
.fpc-catalog-table-section,
.fpc-catalog-table-section .fi-section-content-ctn,
.fpc-catalog-table-section .fi-sc-component,
.fpc-catalog-table-section .fi-fo-field-wrp {
    max-width: 100%;
    min-width: 0;
}

.fpc-catalog-table-section .fi-section-content {
    /* `clip` breaks hit-testing on horizontally scrolled action links in Chromium. */
    overflow-x: hidden;
    overflow-y: visible;
}

.fpc-catalog-scroll {
    display: block;
    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}

/* Catalog load overlay: must not block row actions when hidden (inline display toggled by JS). */
#fi-fetch-catalog-load-mode-overlay[style*='display: none'],
#fi-fetch-catalog-load-mode-overlay[style*='display:none'] {
    pointer-events: none !important;
    visibility: hidden !important;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater {
    display: block;
    width: max-content;
    min-width: 100%;
    max-width: none;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater table {
    min-width: 72rem;
    width: max-content;
    table-layout: auto;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(1),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(1) {
    min-width: 16rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(2),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(2) {
    min-width: 13rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(3),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(3) {
    min-width: 8.5rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(7),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(7) {
    min-width: 16rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(8),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(8) {
    min-width: 8rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(9),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(9) {
    min-width: 5.5rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:nth-child(10),
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:nth-child(10) {
    min-width: 5.5rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td {
    vertical-align: top;
}

.fetch-provider-catalog-repeater .fpc-catalog-cell-wrap,
.fetch-provider-catalog-repeater .fpc-catalog-cell-wrap > div,
.fetch-provider-catalog-repeater .fpc-catalog-cell-wrap .fi-fo-placeholder {
    min-width: 0;
    max-width: 100%;
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.fetch-provider-catalog-repeater .fpc-catalog-price-cell {
    font-variant-numeric: tabular-nums;
    white-space: nowrap !important;
    word-break: normal;
    overflow-wrap: normal;
}

/**
 * Provider catalog — row actions (colors via Filament: success = Active, primary = Edit).
 */
.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:last-child,
.fetch-provider-catalog-repeater.fi-fo-table-repeater thead th:last-child {
    position: relative;
    z-index: 2;
    min-width: 22rem;
    white-space: nowrap;
    vertical-align: middle;
    text-align: center !important;
    padding-inline: 0.75rem;
}

.fetch-provider-catalog-repeater.fi-fo-table-repeater tbody td:last-child .fi-fo-table-repeater-actions {
    display: flex !important;
    width: 100%;
    align-items: center;
    justify-content: center !important;
    flex-wrap: nowrap;
    gap: 1.25rem;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions > div {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions > div + div {
    margin: 0;
    padding: 0;
    border: none;
}

.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions,
.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions > div {
    pointer-events: auto;
}

/* Link layout — single line, no button chrome; colors from Filament fi-color-* */
.fetch-provider-catalog-repeater .fpc-catalog-action.fi-link,
.fetch-provider-catalog-repeater .fpc-catalog-action .fi-link,
.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions .fi-link.fpc-catalog-action,
.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions button.fpc-catalog-action {
    display: inline-flex !important;
    align-items: center;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    width: max-content;
    gap: 0.375rem;
    min-height: auto !important;
    padding: 0.125rem 0 !important;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    position: relative;
    z-index: 3;
    pointer-events: auto;
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000 !important;
    border-radius: 0;
    text-decoration: none;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.fetch-provider-catalog-repeater .fpc-catalog-action.fi-link > *,
.fetch-provider-catalog-repeater .fpc-catalog-action .fi-link > *,
.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions .fi-link.fpc-catalog-action > * {
    white-space: nowrap !important;
    flex-shrink: 0;
}

.fetch-provider-catalog-repeater .fpc-catalog-action .fi-icon,
.fetch-provider-catalog-repeater .fpc-catalog-action svg {
    flex-shrink: 0;
    width: 1.125rem !important;
    height: 1.125rem !important;
}

.fetch-provider-catalog-repeater .fpc-catalog-action.fi-link:hover,
.fetch-provider-catalog-repeater .fpc-catalog-action.fi-link:focus-visible,
.fetch-provider-catalog-repeater .fpc-catalog-action .fi-link:hover,
.fetch-provider-catalog-repeater .fpc-catalog-action .fi-link:focus-visible,
.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions .fi-link.fpc-catalog-action:hover,
.fetch-provider-catalog-repeater .fi-fo-table-repeater-actions .fi-link.fpc-catalog-action:focus-visible {
    background: transparent !important;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Fetch-services modal — same scroll containment when catalog is shown in a dialog. */
.fi-modal .fpc-catalog-scroll {
    max-width: min(100%, calc(100vw - 3rem));
}

.fi-modal .fpc-catalog-table-section,
.fi-modal .fpc-catalog-table-section .fi-section-content-ctn {
    max-width: 100%;
    min-width: 0;
}
