/* Workforce solution summary: same container treatment as .diet-solution-summary
   (pages/diet.css). The per-worker bars split regular pay (--color-brand-content, same as
   Diet's bars) from the overtime premium (--color-admonition-title--danger,
   same red already used for tight nutrient bounds on the Diet page) — both are
   existing theme variables, so no new custom properties are needed here. */
[role="main"] .workforce-solution-summary {
    padding: 1.2em 1.3em;
    border-radius: 0.6em;
    background: #eef1f5;
    border: 1px solid var(--color-sidebar-background-border);
}

body[data-theme="dark"] [role="main"] .workforce-solution-summary {
    background: #15171a;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) [role="main"] .workforce-solution-summary {
        background: #15171a;
    }
}

/* Workforce schedule grid: workers x shifts. Explicit grid-row/grid-column
   placement (set inline per cell in the .rst) rather than one div per column
   lets a worker's consecutive assigned shifts merge into a single bar
   spanning multiple columns instead of one swatch per shift — the same grid
   still needs a placeholder per unassigned (available/unavailable) shift, so
   every row fills all 14 shift columns either way.
   Each worker gets their own hue rather than one shared "assigned" color,
   using 7 of the 8 default categorical slots (skipping green) — validated
   with the *adjacent*-pairs check, not all-pairs: identity here is carried
   jointly by hue AND the row label ("Dan", "Ed", …), so bars only ever need
   to be distinguished from their immediate row/column neighbors, not from
   every other worker at a glance. That is a materially easier bar than the
   all-pairs floor other pages hold themselves to for color-only identity. */
[role="main"] .workforce-solution-summary {
    --workforce-worker-1: #2a78d6;
    --workforce-worker-2: #eb6834;
    --workforce-worker-3: #1baf7a;
    --workforce-worker-4: #eda100;
    --workforce-worker-5: #e87ba4;
    --workforce-worker-6: #008300;
    --workforce-worker-7: #4a3aa7;
}

body[data-theme="dark"] [role="main"] .workforce-solution-summary {
    --workforce-worker-1: #3987e5;
    --workforce-worker-2: #d95926;
    --workforce-worker-3: #199e70;
    --workforce-worker-4: #c98500;
    --workforce-worker-5: #d55181;
    --workforce-worker-6: #008300;
    --workforce-worker-7: #9085e9;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) [role="main"] .workforce-solution-summary {
        --workforce-worker-1: #3987e5;
        --workforce-worker-2: #d95926;
        --workforce-worker-3: #199e70;
        --workforce-worker-4: #c98500;
        --workforce-worker-5: #d55181;
        --workforce-worker-6: #008300;
        --workforce-worker-7: #9085e9;
    }
}

[role="main"] .workforce-schedule-wrap {
    overflow-x: auto;
    margin-bottom: 0.4rem;
}

[role="main"] .workforce-schedule-grid {
    display: grid;
    grid-template-columns: 46px repeat(14, minmax(30px, 1fr)) 64px;
    grid-template-rows: 30px repeat(7, 26px) 24px;
    gap: 3px;
    min-width: 620px;
    align-items: center;
}

[role="main"] .workforce-schedule-corner {
    height: 30px;
}

[role="main"] .workforce-schedule-head {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-foreground-primary);
}

/* A visible seam between week 1 (shifts 1-7) and week 2 (shifts 8-14), so the
   14-column strip still reads as two weeks rather than one long run. */
[role="main"] .workforce-schedule-head.wk2,
[role="main"] .workforce-cell.wk2 {
    border-left: 2px solid var(--color-background-border);
    padding-left: 2px;
}

[role="main"] .workforce-schedule-cost-head {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-foreground-secondary);
    text-align: right;
    padding-right: 2px;
}

[role="main"] .workforce-schedule-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-foreground-primary);
    white-space: nowrap;
}

[role="main"] .workforce-cell,
[role="main"] .workforce-bar {
    height: 22px;
    border-radius: 3px;
}

[role="main"] .workforce-bar {
    align-self: stretch;
}

[role="main"] .workforce-bar.worker-1 { background: var(--workforce-worker-1); }

[role="main"] .workforce-bar.worker-2 { background: var(--workforce-worker-2); }

[role="main"] .workforce-bar.worker-3 { background: var(--workforce-worker-3); }

[role="main"] .workforce-bar.worker-4 { background: var(--workforce-worker-4); }

[role="main"] .workforce-bar.worker-5 { background: var(--workforce-worker-5); }

[role="main"] .workforce-bar.worker-6 { background: var(--workforce-worker-6); }

[role="main"] .workforce-bar.worker-7 { background: var(--workforce-worker-7); }

[role="main"] .workforce-cell.available {
    background: var(--color-background-secondary);
    border: 1px solid var(--color-background-border);
}

[role="main"] .workforce-cell.unavailable {
    background: none;
    border: 1px dashed var(--color-background-border);
}

[role="main"] .workforce-schedule-cost {
    font-size: 11px;
    color: var(--color-foreground-secondary);
    text-align: right;
    white-space: nowrap;
}

/* Total row: shift-by-shift headcount actually on duty, directly under the
   per-shift requirement in the header — same number, so it doubles as a
   visual check that the schedule satisfies the staffing constraint. */
[role="main"] .workforce-schedule-total-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-foreground-primary);
    padding-top: 4px;
    border-top: 1px solid var(--color-background-border);
}

[role="main"] .workforce-schedule-total-cell,
[role="main"] .workforce-schedule-total-cell-head {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-foreground-primary);
    text-align: center;
    padding-top: 4px;
    border-top: 1px solid var(--color-background-border);
}

[role="main"] .workforce-schedule-total-cell-head {
    text-align: right;
    padding-right: 2px;
}

.workforce-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.workforce-legend-swatch.workforce-legend-available {
    background: var(--color-background-secondary);
    border: 1px solid var(--color-background-border);
}

.workforce-legend-swatch.workforce-legend-unavailable {
    background: none;
    border: 1px dashed var(--color-background-border);
}
