.timesheet-grid {
    display: grid;
    grid-template-columns: [time-start delete-start] 100% [time-end delete-end];

    .timesheet-row {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
        row-gap: 0.5rem;
    }

    .time-section {
        grid-column: time-start / time-end;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(7.5rch, 1fr));
    }

    .timesheet-heading {
        font-size: 0.625rem;
        border: 1px solid black;
        background-color: #888;
        color: #FFFFFF;
        text-align: center;
        font-weight: bold;
        padding-top: 1px;
        padding-bottom: 1px;
        text-wrap-mode: nowrap;
    }

    .timesheet-cell {
        display: flex;
        flex-direction: column;
    }

    .timesheet-body {
        display: grid;
        grid-template-columns: subgrid;
        row-gap: 1rem;
        margin-bottom: 1rem;
    }

    .timesheet-foot {
        display: grid;
        grid-template-columns: subgrid;
        color: #FFFFFF;
        border-radius: 0.25rem;
        padding: 0.5rem;
        background-color: #444;
        margin-bottom: 1rem;
    }

    .row-buttons {
        margin-bottom: 1rem;
    }

    .timesheet-section {
        grid-column: 1 / -1;
    }


    /* Modifiers to timesheet pieces */
    .timesheet-body .timesheet-row {
        background-color: #FFFFFF;
        border-radius: 0.25rem;
        padding: 0.5rem;
    }

    .timesheet-cell.task-order, .timesheet-cell.pay-type, .timesheet-cell.delete-button {
        flex-shrink: 0;
    }

    .timesheet-cell.delete-button {
        grid-column: delete-start / delete-end;
    }

    .timesheet-cell.delete-button .timesheet-heading {
        display: none;
    }

    /* Hide deleted rows */
    .timesheet-row.deleted-row {
        display: none;
    }

    /* Add a title to the footer to make clear what it is */
    .timesheet-foot:before {
        content: "Totals";
        font-size: 1.5em;
        grid-column: 1 / -1;
    }

    /* Footer cells get border */
    .timesheet-foot .timesheet-cell {
        border: 1px white solid;
    }

    .timesheet-foot .timesheet-cell .timesheet-heading {
        border: 0;
    }

    /* Footer cells and time-section get dark background */
    .timesheet-foot .time-section,
    .timesheet-foot .timesheet-cell {
        background-color: #444;
    }

    /* Body cells and time-section get light background */
    .timesheet-body .timesheet-cell,
    .timesheet-body .time-section {
        background-color: #FFFFFF;
    }

    /* Hide all footer cells that are not time-columns */
    .timesheet-foot .timesheet-cell:not(.time-column) {
        display: none;
    }

    /* Cell contents */

    /* Padding for cell content */
    .timesheet-cell .timesheet-content {
        padding: 1px;
    }

    .timesheet-cell.delete-button .btn {
        display: block;
        width: 100%;
    }

    /* Trash icon in delete button is red */
    .timesheet-cell.delete-button .el-trash {
        color: #FF0000;
    }

    /* Timesheet history */
    .history-container {
        flex-direction: column;
        overflow-y: auto;
        max-height: calc((0.68rem * 1.5 * 2 + 2px) * 6 + 0.5rem * 2 + 2px);

        &.show {
            display: flex;
        }
    }

    .history-entry {
        font-size: 0.68rem;
        color: #a00;
        text-align: center;
        padding: 1px;
    }
}

/* Timesheet responsive media queries */

@media (min-width: 576px) {
    .timesheet-grid {
        grid-template-columns: [time-start delete-start] auto 1fr auto [time-end delete-end];
    }
}

@media (min-width: 768px) {
    .timesheet-grid {
        grid-template-columns: max-content minmax(17rch, 1fr) max-content [time-start] auto [time-end delete-start] max-content [delete-end];

        .timesheet-row.deleted-row {
            display: grid;
            visibility: hidden;
            height: 0;
            overflow: hidden;
        }

        .timesheet-foot .timesheet-cell:not(.time-column) .timesheet-heading {
            display: none;
        }

        .timesheet-body:not(:has(.timesheet-row:not(.deleted-row))) ~ .timesheet-foot .timesheet-cell .timesheet-heading {
            display: initial;
        }
       
        &.no-wrap {
            .timesheet-body .timesheet-row:not(:nth-child(1 of .timesheet-row:not(.deleted-row))) .timesheet-heading {
                display: none;
            }

            .timesheet-body:has(.timesheet-row:not(.deleted-row)) ~ .timesheet-foot .timesheet-heading {
                display: none;
            }
        }

        .timesheet-body {
            row-gap: 0;
            margin-bottom: 0;
        }

        .time-section {
            display: flex;
            flex-wrap: wrap;
        }

        .timesheet-body .timesheet-row {
            border-radius: 0;
            padding: 0;
        }

        .timesheet-cell.delete-button {
            width: auto;
        }

        .timesheet-cell.delete-button .timesheet-heading {
            display: initial;
        }

        .timesheet-cell.delete-button .timesheet-content {
            margin-top: auto;
            margin-bottom: auto;
        }

        .timesheet-cell.time-column {
            flex: 0 0 7.5rch;
        }

        .timesheet-foot {
            border-radius: 0;
            padding: 0;
        }

        .timesheet-foot:before {
            content: unset;
        }

        .timesheet-foot .timesheet-cell:not(.time-column) {
            display: flex;
        }

        .row-buttons {
            padding-top: 0.25rem;
        } 

        .timesheet-cell.wbs select:hover {
            position: relative;
            width: auto;
            min-width: 100%;
        }
    }
}