/* Custom Dashboard Layout */
@media (min-width: 1280px) {
    .fi-dashboard-page .fi-wi {
        display: grid !important;
        grid-template-columns: 350px 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 1.5rem !important;
    }

    /* Job Management - First widget (nth-child 1) - row 1, columns 1-2 */
    .fi-dashboard-page .fi-wi > div:nth-child(1) {
        grid-column: 1 / 3 !important;
        grid-row: 1 !important;
    }

    .fi-dashboard-page .fi-wi > div:nth-child(1) .fi-section-content {
        padding: 1rem !important;
    }

    /* Welcome Card - Second widget (nth-child 2) - row 2, column 1 */
    .fi-dashboard-page .fi-wi > div:nth-child(2) {
        grid-column: 1 !important;
        grid-row: 2 !important;
    }

    /* Job Categories - Third widget (nth-child 3) - row 2, column 2 */
    .fi-dashboard-page .fi-wi > div:nth-child(3) {
        grid-column: 2 !important;
        grid-row: 2 !important;
    }

    /* Global Vertical Stretch */
    .fi-dashboard-page .fi-wi > div,
    .fi-dashboard-page .fi-wi > div > div, 
    .fi-dashboard-page .fi-wi > div section,
    .fi-dashboard-page .fi-wi > div .fi-section-content-ctn,
    .fi-dashboard-page .fi-wi > div .fi-section-content {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        min-height: 0 !important;
    }

    /* Definitive Height Lock for Spanning Widget (4) - ABSOLUTE FILL TRICK */
    .fi-dashboard-page .fi-wi > div:nth-child(4) {
        grid-column: 3 !important;
        grid-row: 1 / 3 !important;
        position: relative !important; /* Set context */
        min-height: 400px !important; /* Safety minimum */
    }

    /* Remove the widget from the height calculation flow */
    .fi-dashboard-page .fi-wi > div:nth-child(4) > div,
    .fi-dashboard-page .fi-wi > div:nth-child(4) section {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }

    /* Internal Content Control */
    .fi-dashboard-page .fi-wi > div:nth-child(4) .fi-section-content-ctn,
    .fi-dashboard-page .fi-wi > div:nth-child(4) .fi-section-content {
        height: 100% !important;
        overflow: hidden !important;
    }

    /* Force the internal list containers to scroll */
    .employee-list-widget-container div[id*='list-'] {
        overflow-y: auto !important;
        flex: 1 !important;
        min-height: 0 !important;
    }

    /* Handle the grid itself */
    .fi-dashboard-page .fi-wi {
        grid-auto-rows: auto !important;
    }

    /* Scrollbar styling */
    .fi-dashboard-page .fi-wi > div:nth-child(4) div[id*='list-']::-webkit-scrollbar {
        width: 6px;
    }

    .fi-dashboard-page .fi-wi > div:nth-child(4) div[id*='list-']::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    .fi-dashboard-page .fi-wi > div:nth-child(4) div[id*='list-']::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }

    .fi-dashboard-page .fi-wi > div:nth-child(4) div[id*='list-']::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}
