.ag-cell.text-center .ag-cell-value {
    width: 100%;
}
.portal-grid-wrapper .ag-cell {
    display: flex;
    align-items: center;
}

    .portal-grid-wrapper .ag-cell .ag-cell-wrapper,
    .portal-grid-wrapper .ag-cell .ag-cell-value {
        width: 100%;
        min-height: 100%;
        display: flex;
        align-items: center;
    }

    .portal-grid-wrapper .ag-cell.text-center .ag-cell-wrapper,
    .portal-grid-wrapper .ag-cell.text-center .ag-cell-value {
        justify-content: center;
        text-align: center;
    }

    .portal-grid-wrapper .ag-cell.text-center .ag-cell-value {
        width: 100%;
    }

.portal-grid-wrapper .ag-cell-value {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
}
    .portal-grid-theme.ag-theme-quartz {
    --ag-background-color: #ffffff;
    --ag-foreground-color: #111827;
    --ag-header-background-color: #14532d;
    --ag-header-foreground-color: #ffffff;
    --ag-header-column-separator-color: #0f3d22;
    --ag-header-column-separator-display: block;
    --ag-row-border-color: #cbd5e1;
    --ag-selected-row-background-color: #dbeafe;
    --ag-border-color: #94a3b8;
    --ag-font-size: 14px;
    --ag-font-family: Inter, Segoe UI, Arial, sans-serif;
    --ag-icon-color: #ffffff;
}

.portal-grid-theme .ag-root-wrapper {
    border: 1px solid #94a3b8;
    border-radius: .75rem;
    display: flex;
    flex-direction: column;
}

/*Default pagination panel styles (bottom of grid on search page) */
.portal-grid-theme .ag-paging-panel {
    border-top: 1px solid #cbd5e1;
    background: rgb(248 250 252 / var(--tw-bg-opacity, 1)) !important; /*#f8fafc;*/
    color: #0f172a;
    min-height: 48px;
    padding: 0 .75rem;
}

    .portal-grid-theme .ag-paging-button .ag-icon,
    .portal-grid-theme .ag-paging-panel .ag-icon {
        color: #14532d !important;
    }

.portal-grid-theme .ag-paging-button[disabled] .ag-icon {
    color: #94a3b8 !important;
}

.portal-grid-top-paging > .ag-paging-panel {
    border-radius: .55rem;
}

.portal-grid-top-paging .ag-paging-panel {
    order: 0;
    border: 1px solid #d1d5db;
    background: rgb(248 250 252 / var(--tw-bg-opacity, 1)) !important;
    color: #1f2937;
    min-height: 56px;
    height: auto !important;
    padding: .35rem .9rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .65rem;
    font-size: .98rem;
    font-weight: 600;
    overflow: visible !important;
}

.portal-grid-top-paging .ag-paging-page-size {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

    .portal-grid-top-paging .ag-paging-page-size .ag-wrapper,
    .portal-grid-top-paging .ag-paging-page-size .ag-select,
    .portal-grid-top-paging .ag-paging-page-size select {
        font-size: .95rem;
    }

.portal-grid-top-paging .ag-paging-row-summary-panel {
    justify-self: center;
    text-align: center;
    font-weight: 700;
    color: #14532d;
}
.portal-grid-top-paging .ag-paging-page-summary-panel {
    justify-self: end;
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-weight: 600;
    color: #1f2937;
}

.portal-grid-top-paging .ag-paging-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: .45rem;
    border: 1px solid #9fb4a8;
    background: #ffffff;
    min-width: 32px;
    min-height: 32px;
    margin: 0px;
}

    .portal-grid-top-paging .ag-paging-button .ag-icon,
    .portal-grid-top-paging .ag-paging-panel .ag-icon {
        color: #256043 !important;
        line-height: 1;
    }

    .portal-grid-top-paging .ag-paging-button:hover:not([disabled]):not(.ag-disabled) {
        background: #15803d;
        border-color: #15803d;
    }

        .portal-grid-top-paging .ag-paging-button:hover:not([disabled]):not(.ag-disabled) .ag-icon,
        .portal-grid-top-paging .ag-paging-button:hover:not([disabled]):not(.ag-disabled) .ag-icon::before {
            color: #ffffff !important;
        }

    .portal-grid-top-paging .ag-paging-button[disabled],
    .portal-grid-top-paging .ag-paging-button.ag-disabled,
    .portal-grid-top-paging .ag-paging-button[aria-disabled='true'] {
        cursor: not-allowed !important;
        /* pointer-events: none;*/
        opacity: .55;
        border-color: #d1d5db;
        background: #f3f4f6;
    }

        .portal-grid-top-paging .ag-paging-button[disabled] .ag-icon,
        .portal-grid-top-paging .ag-paging-button.ag-disabled .ag-icon,
        .portal-grid-top-paging .ag-paging-button[aria-disabled='true'] .ag-icon {
            color: #9ca3af !important;
        }

.portal-grid-top-paging .ag-paging-description,
.portal-grid-top-paging .ag-paging-number {
    color: #111827;
    font-weight: 600;
}

.portal-grid-theme .ag-header,
.portal-grid-theme .ag-header-viewport,
.portal-grid-theme .ag-header-container {
    background: #14532d;
}

.portal-grid-theme .ag-header-cell,
.portal-grid-theme .ag-header-group-cell {
    border-right: 1px solid rgba(255, 255, 255, .28);
}

.portal-grid-theme .ag-header-cell-text,
.portal-grid-theme .ag-header-cell-label,
.portal-grid-theme .ag-header-icon,
.portal-grid-theme .ag-sort-indicator-icon,
.portal-grid-theme .ag-icon {
    color: #ffffff;
}

.portal-grid-theme .ag-header-cell-text {
    font-weight: 700;
    letter-spacing: .03em;
}

.portal-grid-theme .ag-header-cell-resize {
    z-index: 2;
}

    .portal-grid-theme .ag-header-cell-resize::after {
        background-color: #bbf7d0;
        width: 2px;
    }

.portal-grid-theme .ag-row-odd .ag-cell {
    background: #ffffff;
}

.portal-grid-theme .ag-row-hover .ag-cell, .portal-grid-theme .ag-row:hover .ag-cell {
    background: rgb(236 253 245 / var(--tw-bg-opacity, 1)) !important;
}
/* Keep vertical centering globally */
.portal-grid-theme .ag-cell {
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding-top: .45rem;
    padding-bottom: .45rem;
    line-height: 1.4;
}

    .portal-grid-theme .ag-cell .ag-cell-wrapper,
    .portal-grid-theme .ag-cell .ag-cell-value {
        width: 100%;
        display: block;
    }

.portal-grid-theme .ag-header-cell.ag-center-header .ag-header-cell-label {
    justify-content: center;
    width: 100%;
}

.portal-grid-theme .ag-cell.ag-center-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

    .portal-grid-theme .ag-cell.ag-center-cell .ag-cell-wrapper,
    .portal-grid-theme .ag-cell.ag-center-cell .ag-cell-value {
        justify-content: center;
        text-align: center;
    }

    .portal-grid-theme .ag-cell.ag-center-cell .btn-custom-link {
        margin-left: auto;
        margin-right: auto;
    }

    .portal-grid-theme .ag-cell.portal-grid-middle-cell {
    display: flex;
    align-items: center;
}

    .portal-grid-theme .ag-cell.portal-grid-middle-cell .ag-cell-wrapper,
    .portal-grid-theme .ag-cell.portal-grid-middle-cell .ag-cell-value {
        display: flex;
        align-items: center;
        width: 100%;
    }

    .portal-grid-theme .ag-cell.portal-grid-middle-cell .ag-cell-value {
        justify-content: flex-start;
        text-align: left;
    }

.portal-grid-theme.ag-theme-quartz .ag-layout-auto-height .ag-center-cols-viewport,
.portal-grid-theme.ag-theme-quartz .ag-layout-auto-height .ag-center-cols-container {
    min-height: 2.75rem !important;
}

.portal-grid-theme.ag-theme-quartz .ag-layout-auto-height .ag-body-viewport {
    min-height: 2.75rem !important;
}

.portal-grid-theme.ag-theme-quartz .ag-overlay-no-rows-wrapper,
.portal-grid-theme.ag-theme-quartz .ag-overlay-loading-wrapper {
    min-height: 2.75rem;
}

.claimant-grid-ellipsis-cell .ag-cell-wrapper,
.claimant-grid-ellipsis-cell .ag-cell-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.claimant-grid-wrap-cell .ag-cell-wrapper,
.claimant-grid-wrap-cell .ag-cell-value {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
    text-align: center;
    line-height: 1.4;
}

.portal-grid-theme .ag-tooltip {
    background-color: #111827;
    color: #f9fafb;
    border: 1px solid #1f2937;
    border-radius: .5rem;
    padding: .5rem .75rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.25rem;
    max-width: 28rem;
    white-space: normal;
    word-break: break-word;
}

.portal-grid-theme .ag-cell.portal-grid-middle-cell .ag-cell-value {
    justify-content: flex-start;
    text-align: left;
}

/*.portal-grid-top-paging {
    border: 1px solid #d1d5db;
    border-radius: .55rem;
}*/

.portal-grid-top-paging .ag-paging-page-summary-panel {
    justify-content: flex-end;
}


.portal-grid-top-page-size-select {
    min-width: 80px;
    height: 32px;
    border: 1px solid #94a3b8;
    border-radius: .35rem;
    background-color: #ffffff;
    color: #1f2937;
    font-size: .95rem;
    font-weight: 500;
    padding: 0 1.75rem 0 .5rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23256043'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.51a.75.75 0 01-1.08 0l-4.25-4.51a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .5rem center;
    background-size: 14px 14px;
}
.ag-center-header .ag-header-cell-text {
    text-align: center;
}
.portal-grid-theme .ag-header-cell.text-center .ag-header-cell-label {
    justify-content: center;
    text-align: center;
}

.portal-grid-theme .ag-cell.text-center {
    justify-content: center;
    text-align: center;
}
.portal-grid-theme .ag-cell.ag-center-cell.portal-grid-middle-cell .ag-cell-wrapper,
.portal-grid-theme .ag-cell.ag-center-cell.portal-grid-middle-cell .ag-cell-value {
    justify-content: center;
    text-align: center;
}

.portal-grid-theme .ag-cell.text-center .ag-cell-wrapper,
.portal-grid-theme .ag-cell.text-center .ag-cell-value {
    justify-content: center;
    text-align: center;
    width: 100%;
}
/* ─────────────────────────────────────────────────────────────────────────────
   Bottom Pagination Panel - Responsive Fixes
   Ensures First, Previous, Next, Last buttons don't overlap on smaller screens
   ───────────────────────────────────────────────────────────────────────────── */

/* Default bottom panel layout improvements */
.portal-grid-theme .ag-paging-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .75rem;
    /* AG Grid sets a fixed --ag-pagination-panel-height which clips stacked mobile controls */
    height: auto !important;
    min-height: var(--ag-pagination-panel-height, 48px);
    overflow: visible !important;
}

.portal-grid-theme .ag-paging-row-summary-panel {
    flex: 0 1 auto;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: .875rem;
    font-weight: 600;
    color: #14532d;
}

.portal-grid-theme .ag-paging-page-summary-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    flex: 0 1 auto;
    flex-shrink: 0;
}

.portal-grid-theme .ag-paging-page-size {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex: 0 1 auto;
    flex-shrink: 0;
}

/* Ensure navigation buttons have minimum touch target size */
.portal-grid-theme .ag-paging-button {
    min-width: 32px;
    min-height: 32px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1;
}

/* Medium devices (tablets) */
@media (max-width: 991.98px) {
    .portal-grid-theme .ag-paging-panel {
        padding: .5rem;
        gap: .4rem;
    }
    
    .portal-grid-theme .ag-paging-row-summary-panel {
        font-size: .8125rem;
        order: 1;
        flex-basis: 100%;
        text-align: center;
    }
    
    .portal-grid-theme .ag-paging-page-size {
        order: 2;
    }
    
    .portal-grid-theme .ag-paging-page-summary-panel {
        order: 3;
        margin-left: auto;
    }
}

/* Mobile responsiveness for search grids */
@media (max-width: 767.98px) {
    /* Top paging panel */
    .portal-grid-top-paging .ag-paging-panel {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        gap: .4rem .6rem;
        min-height: auto;
        height: auto !important;
        padding: .5rem .6rem;
        overflow: visible !important;
        grid-template-columns: none;
    }

    .portal-grid-top-paging .ag-paging-page-size,
    .portal-grid-top-paging .ag-paging-row-summary-panel,
    .portal-grid-top-paging .ag-paging-page-summary-panel {
        width: 100%;
        justify-self: stretch;
    }

    .portal-grid-top-paging .ag-paging-page-size {
        justify-content: flex-start;
    }

    .portal-grid-top-paging .ag-paging-row-summary-panel {
        text-align: left;
    }

    .portal-grid-top-paging .ag-paging-page-summary-panel {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: .35rem;
    }

    .portal-grid-top-paging .ag-paging-page-size .ag-wrapper,
    .portal-grid-top-paging .ag-paging-page-size .ag-select,
    .portal-grid-top-paging .ag-paging-page-size select {
        min-width: 72px;
    }

    .portal-grid-theme .ag-header-cell-text {
        font-size: .85rem;
        line-height: 1.15;
    }
    
    /* Bottom paging panel - stack vertically on mobile */
    .portal-grid-theme .ag-paging-panel {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
        padding: .6rem;
        height: auto !important;
        overflow: visible !important;
    }
    
    .portal-grid-theme .ag-paging-row-summary-panel {
        order: 1;
        text-align: center;
        flex-basis: auto;
        padding: .25rem 0;
        display: flex !important;
        visibility: visible !important;
        white-space: normal;
    }
    
    .portal-grid-theme .ag-paging-page-size {
        order: 2;
        justify-content: center;
        display: flex !important;
        visibility: visible !important;
    }
    
    .portal-grid-theme .ag-paging-page-summary-panel {
        order: 3;
        justify-content: center;
        flex-wrap: wrap;
        margin-left: 0;
        display: flex !important;
        visibility: visible !important;
    }
    
    /* Ensure buttons don't get too small / hidden */
    .portal-grid-theme .ag-paging-button {
        min-width: 36px;
        min-height: 36px;
        display: inline-flex !important;
        visibility: visible !important;
    }
}

/* Extra small devices */
@media (max-width: 479.98px) {
    .portal-grid-theme .ag-paging-row-summary-panel {
        font-size: .75rem;
    }
    
    .portal-grid-theme .ag-paging-page-summary-panel {
        font-size: .8125rem;
    }
    
    .portal-grid-theme .ag-paging-description {
        font-size: .75rem;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive paging host (claimant search / see-all)
   Keep bottom page-size + nav + row summary visible on small screens.
   AG Grid's fixed pagination panel height must be overridden or stacked
   First/Prev/Next/Last and "Showing X to Y of Z" get clipped.
   ───────────────────────────────────────────────────────────────────────────── */

.portal-grid-responsive-paging {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.portal-grid-responsive-paging .ag-root-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.portal-grid-responsive-paging .ag-root-wrapper-body,
.portal-grid-responsive-paging .ag-root,
.portal-grid-responsive-paging .ag-body-viewport,
.portal-grid-responsive-paging .ag-center-cols-viewport {
    min-width: 0;
}

.portal-grid-responsive-paging .ag-paging-panel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: auto !important;
    min-height: var(--ag-pagination-panel-height, 48px);
    overflow: visible !important;
}

/* Compact / mobile stacking — also applied via .portal-grid-compact-paging for tests */
.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-panel,
.portal-grid-responsive-paging.portal-grid-compact-paging.portal-grid-top-paging .ag-paging-panel {
    display: flex !important;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: .5rem;
    grid-template-columns: none;
    min-height: auto;
    height: auto !important;
    padding: .6rem .7rem;
    overflow: visible !important;
}

.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-size,
.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-row-summary-panel,
.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-summary-panel {
    display: flex !important;
    visibility: visible !important;
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
    margin-left: 0;
    flex-shrink: 0;
    opacity: 1;
}

.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-size {
    order: 1;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-row-summary-panel {
    order: 2;
    text-align: left;
    white-space: normal;
}

.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-summary-panel {
    order: 3;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: .35rem;
}

.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-button {
    display: inline-flex !important;
    visibility: visible !important;
    min-width: 36px;
    min-height: 36px;
}

.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-size .ag-wrapper,
.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-size .ag-select,
.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-size select,
.portal-grid-responsive-paging.portal-grid-compact-paging .ag-paging-page-size .ag-picker-field-wrapper {
    min-width: 4.5rem;
    max-width: 100%;
}

@media (max-width: 767.98px) {
    .portal-grid-responsive-paging .ag-paging-panel,
    .portal-grid-responsive-paging.portal-grid-top-paging .ag-paging-panel {
        display: flex !important;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        gap: .5rem;
        grid-template-columns: none;
        min-height: auto;
        height: auto !important;
        padding: .6rem .7rem;
        overflow: visible !important;
    }

    .portal-grid-responsive-paging .ag-paging-page-size,
    .portal-grid-responsive-paging .ag-paging-row-summary-panel,
    .portal-grid-responsive-paging .ag-paging-page-summary-panel {
        display: flex !important;
        visibility: visible !important;
        width: 100%;
        max-width: 100%;
        justify-self: stretch;
        margin-left: 0;
        flex-shrink: 0;
        opacity: 1;
    }

    .portal-grid-responsive-paging .ag-paging-page-size {
        order: 1;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .portal-grid-responsive-paging .ag-paging-row-summary-panel {
        order: 2;
        text-align: left;
        white-space: normal;
    }

    .portal-grid-responsive-paging .ag-paging-page-summary-panel {
        order: 3;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: .35rem;
    }

    .portal-grid-responsive-paging .ag-paging-button {
        display: inline-flex !important;
        visibility: visible !important;
        min-width: 36px;
        min-height: 36px;
    }

    .portal-grid-responsive-paging .ag-paging-page-size .ag-wrapper,
    .portal-grid-responsive-paging .ag-paging-page-size .ag-select,
    .portal-grid-responsive-paging .ag-paging-page-size select,
    .portal-grid-responsive-paging .ag-paging-page-size .ag-picker-field-wrapper {
        min-width: 4.5rem;
        max-width: 100%;
    }
}
