/* Timesheet week card, timeline, and approval styles. */

.timesheet-settings-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.timesheet-settings-toggle-grid:has(> .timesheet-settings-toggle:only-child) {
    grid-template-columns: minmax(0, 1fr);
}

.timesheet-settings-toggle {
    min-width: 0;
}

.timesheet-day-columns {
    grid-template-columns: repeat(var(--timesheet-day-count), minmax(17.5rem, 1fr));
    min-width: min(88rem, calc(var(--timesheet-day-count) * 18.5rem));
}

.timesheet-day-panel {
    display: grid;
    grid-template-rows: auto 1fr;
    background: var(--app-surface-muted);
}

.timesheet-day-header {
    padding: 0.65rem;
    border-bottom: 1px solid var(--app-border);
    background: color-mix(in srgb, var(--app-surface) 88%, var(--app-accent) 12%);
}

.timesheet-day-add-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--app-success-action-border);
    border-radius: 0.6rem;
    background: linear-gradient(180deg, var(--app-success-action-start), var(--app-success-action-end));
    color: var(--app-success-action-text) !important;
    font-size: var(--text-base);
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    text-decoration: none;
    box-shadow: inset 0 1px 0 var(--app-white-alpha-08);
}

.timesheet-day-add-bar:hover {
    color: var(--app-text) !important;
    background: linear-gradient(180deg, var(--app-success-action-hover-start), var(--app-success-action-hover-end));
}

.timesheet-day-add-plus {
    font-size: 1.1em;
    line-height: 1;
}

.timesheet-day-add-label {
    min-width: 0;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timesheet-day-body {
    display: grid;
    gap: 0.6rem;
    align-content: start;
    padding: 0.65rem;
    background: var(--app-surface-muted);
    min-height: 16rem;
    height: 100%;
}

.timesheet-day-empty {
    min-height: 4rem;
    display: flex;
    align-items: center;
    padding: 0.15rem;
    font-size: var(--text-sm);
}

.timesheet-entry-list {
    display: grid;
    gap: 0.55rem;
    align-content: start;
}

.timesheet-entry-card {
    position: relative;
    align-self: start;
    border: 1px solid var(--app-border);
    border-radius: 0.65rem;
    background: linear-gradient(180deg, var(--app-timesheet-card-start), var(--app-timesheet-card-end));
    padding: 0.6rem;
    min-height: 8.35rem;
    overflow: hidden;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease;
}

.timesheet-entry-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.timesheet-entry-card:has(.timesheet-entry-card-link) {
    cursor: pointer;
}

.timesheet-entry-card:has(.timesheet-entry-card-link):hover,
.timesheet-entry-card:has(.timesheet-entry-card-link):focus-within {
    border-color: var(--app-accent-border-strong);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--app-timesheet-card-start) 86%, var(--app-accent) 14%),
        color-mix(in srgb, var(--app-timesheet-card-end) 88%, var(--app-accent) 12%)
    );
    box-shadow: 0 0 0 2px var(--app-accent-softer), 0 0.6rem 1.2rem var(--app-shadow-md-raw);
    transform: translateY(-1px);
}

.timesheet-entry-card:has(.timesheet-entry-card-link):focus-within {
    outline: 2px solid var(--app-accent);
    outline-offset: 2px;
}

.timesheet-entry-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "time actions"
        "identity actions";
    gap: 0.45rem 0.55rem;
    align-items: start;
}

.timesheet-entry-identity,
.timesheet-entry-time,
.timesheet-entry-actions {
    min-width: 0;
}

.timesheet-entry-shift-type {
    color: var(--app-timesheet-text);
    font-size: var(--text-xs);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timesheet-entry-staff-name {
    color: var(--app-timesheet-text-strong);
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timesheet-entry-time-range {
    color: var(--app-timesheet-text);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timesheet-entry-meta {
    color: var(--app-muted);
    font-size: var(--text-xs);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.timesheet-entry-break-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timesheet-entry-break-summary {
    white-space: nowrap;
}

.timesheet-entry-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.28rem;
    min-width: 4.9rem;
}

.timesheet-entry-identity {
    grid-area: identity;
}

.timesheet-entry-time {
    grid-area: time;
}

.timesheet-entry-actions {
    grid-area: actions;
    position: relative;
    z-index: 2;
}

.timesheet-entry-actions .btn,
.timesheet-entry-action-form {
    width: 100%;
}

.timesheet-entry-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.45rem;
    min-height: 1.85rem;
    line-height: 1.1;
    text-align: center;
}

.timesheet-approval-toggle {
    font-weight: 700;
}

.timesheet-entry-comments {
    display: grid;
    gap: 0.3rem;
    margin-top: 0.55rem;
    color: var(--app-timesheet-text);
    font-size: var(--text-xs);
    line-height: 1.25;
}

.timesheet-entry-comment {
    display: grid;
    gap: 0.1rem;
}

.timesheet-entry-comment-label {
    color: var(--app-muted);
    font-weight: 700;
}

.timesheet-entry-comment-text {
    white-space: pre-wrap;
}

.timesheet-shape {
    margin-top: 0.55rem;
}

.timesheet-shape-bar {
    position: relative;
    height: 0.7rem;
    border-radius: 999px;
}

.timesheet-shape-track {
    position: absolute;
    inset: 0;
    border: 1px solid var(--app-slate-alpha-22);
    border-radius: 999px;
    background: var(--app-timesheet-track-bg);
}

.timesheet-shape-marker-line {
    position: absolute;
    top: -0.12rem;
    bottom: -0.12rem;
    width: 1px;
    margin-left: -0.5px;
    background: var(--app-slate-alpha-45);
    border-radius: 999px;
    z-index: 2;
}

.timesheet-shape-marker-line.timesheet-shape-marker-midnight {
    width: 2px;
    margin-left: -1px;
    background: var(--app-white-alpha-42);
}

.timesheet-shape-labels {
    position: relative;
    height: 0.75rem;
    margin-top: 0.2rem;
    color: var(--app-muted);
    font-size: 0.64rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.timesheet-shape-marker-label {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    white-space: nowrap;
}

.timesheet-shape-marker-start {
    transform: none;
}

.timesheet-shape-marker-end {
    transform: translateX(-100%);
}

.timesheet-shape-segment {
    position: absolute;
    top: 0.11rem;
    height: 0.48rem;
    border-radius: 999px;
    z-index: 1;
}

.timesheet-shape-segment-shift {
    background: linear-gradient(180deg, var(--app-timesheet-shift-start), var(--app-timesheet-shift-end));
    box-shadow: 0 0 0 1px var(--app-timesheet-shift-ring);
}

.timesheet-shape-segment-break {
    background: linear-gradient(180deg, var(--app-timesheet-break-start), var(--app-timesheet-break-end));
    z-index: 3;
}

@media (max-width: 575.98px) {
    .timesheet-day-columns {
        grid-template-columns: repeat(var(--timesheet-day-count), minmax(16.5rem, 1fr));
        min-width: calc(var(--timesheet-day-count) * 16.5rem);
    }

    .timesheet-day-header,
    .timesheet-day-body {
        padding: 0.55rem;
    }

    .timesheet-entry-actions {
        min-width: 4.8rem;
    }
}
