/* ===========================================================================
   ShiftPlan — Operations Scheduler UI
   =========================================================================== */
:root {
    --sp-bg: #f3f4f6;
    --sp-surface: #ffffff;
    --sp-sidebar: #0f172a;
    --sp-sidebar-muted: #94a3b8;
    --sp-sidebar-hover: #1e293b;
    --sp-border: #e5e7eb;
    --sp-text: #111827;
    --sp-text-muted: #6b7280;
    --sp-primary: #2563eb;
    --sp-primary-soft: #eff6ff;

    /* Shift theme colours */
    --sp-day-bg: #fefce8;
    --sp-day-border: #fde047;
    --sp-day-text: #a16207;
    --sp-day-dot: #eab308;

    --sp-evening-bg: #eef2ff;
    --sp-evening-border: #c7d2fe;
    --sp-evening-text: #4f46e5;
    --sp-evening-dot: #6366f1;

    --sp-night-bg: #f8fafc;
    --sp-night-border: #e2e8f0;
    --sp-night-text: #334155;
    --sp-night-dot: #475569;

    --sp-weekend-bg: #ecfdf5;
    --sp-weekend-border: #a7f3d0;
    --sp-weekend-text: #059669;
    --sp-weekend-dot: #10b981;

    --sp-overdue: #dc2626;
    --sp-pending: #d97706;
    --sp-done: #059669;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--sp-bg);
    color: var(--sp-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ----- App shell ---------------------------------------------------------- */
.sp-app {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar ------------------------------------------------------------ */
.sp-sidebar {
    width: 230px;
    flex: 0 0 230px;
    background: var(--sp-sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
}

.sp-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
}

.sp-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--sp-primary);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 18px;
    flex: 0 0 auto;
}

.sp-brand-title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.1;
    color: #fff;
}

.sp-brand-sub {
    font-size: 12px;
    color: var(--sp-sidebar-muted);
}

.sp-nav-label {
    padding: 8px 20px;
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--sp-sidebar-muted);
    text-transform: uppercase;
}

.sp-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
}

.sp-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}

    .sp-nav-item:hover {
        background: var(--sp-sidebar-hover);
        color: #fff;
    }

    .sp-nav-item.active {
        background: var(--sp-primary);
        color: #fff;
    }

.sp-nav-icon {
    width: 18px;
    text-align: center;
    font-size: 16px;
}

.sp-nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--sp-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.sp-sidebar-spacer {
    flex: 1 1 auto;
}

.sp-alert-box {
    display: block;
    margin: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(220, 38, 38, .12);
    border: 1px solid rgba(220, 38, 38, .35);
    color: #fca5a5;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

.sp-alert-box:hover {
    background: rgba(220, 38, 38, .2);
    border-color: rgba(220, 38, 38, .55);
}

.sp-alert-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #fecaca;
}

.sp-alert-sub {
    font-size: 12px;
    margin-top: 2px;
    color: #f87171;
}

/* ----- Main column -------------------------------------------------------- */
.sp-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sp-topbar {
    background: var(--sp-surface);
    border-bottom: 1px solid var(--sp-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.sp-topbar-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.sp-topbar-sub {
    color: var(--sp-text-muted);
    font-size: 13px;
}

.sp-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 84px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .05s;
}

.sp-stat:hover {
    border-color: var(--sp-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.sp-stat:active {
    transform: translateY(1px);
}

.sp-stat-icon {
    font-size: 15px;
    color: var(--sp-text-muted);
}

.sp-stat-num {
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
}

.sp-stat-label {
    font-size: 11px;
    color: var(--sp-text-muted);
}

.sp-stat.is-pending .sp-stat-icon { color: var(--sp-pending); }
.sp-stat.is-done .sp-stat-icon { color: var(--sp-done); }
.sp-stat.is-overdue {
    border-color: #fecaca;
    background: #fef2f2;
}
.sp-stat.is-overdue .sp-stat-icon,
.sp-stat.is-overdue .sp-stat-num { color: var(--sp-overdue); }

.sp-stat.is-understaffed {
    border-color: #fecaca;
    background: #fef2f2;
}
.sp-stat.is-understaffed .sp-stat-icon,
.sp-stat.is-understaffed .sp-stat-num,
.sp-stat.is-understaffed .sp-stat-label { color: var(--sp-overdue); }

.sp-content {
    padding: 24px;
    flex: 1 1 auto;
}

/* ----- Period header ------------------------------------------------------ */
.sp-period {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.sp-period-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.sp-period-sub {
    color: var(--sp-text-muted);
    font-size: 13px;
}

.sp-period-nav {
    display: flex;
    gap: 8px;
}

/* Shifts / Tasks view toggle on the Non-Operations calendar header */
.sp-view-toggle {
    display: inline-flex;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.sp-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

    .sp-toggle-btn:hover {
        color: var(--sp-text);
    }

    .sp-toggle-btn.active {
        background: var(--sp-primary);
        color: #fff;
    }

.sp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-text);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

    .sp-btn:hover {
        background: #f9fafb;
        border-color: #d1d5db;
    }

    .sp-btn.primary {
        background: var(--sp-primary);
        border-color: var(--sp-primary);
        color: #fff;
    }

        .sp-btn.primary:hover {
            background: #1d4ed8;
        }

    .sp-btn.success {
        background: #16a34a;
        border-color: #16a34a;
        color: #fff;
    }

        .sp-btn.success:hover {
            background: #15803d;
            border-color: #15803d;
        }

    .sp-btn.warn {
        background: #b45309;
        border-color: #b45309;
        color: #fff;
    }

        .sp-btn.warn:hover {
            background: #92400e;
            border-color: #92400e;
        }

    .sp-btn.danger {
        background: var(--sp-surface);
        border-color: var(--sp-overdue);
        color: var(--sp-overdue);
    }

        .sp-btn.danger:hover {
            background: #fef2f2;
            border-color: var(--sp-overdue);
        }

/* ----- Finalized schedule banner & time-off policy note ------------------- */
.sp-finalized-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 4px;
    padding: 12px 16px;
    border: 1px solid #fcd34d;
    border-left: 4px solid #d97706;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
}

    .sp-finalized-banner .bi {
        font-size: 20px;
        color: #d97706;
    }

    .sp-finalized-banner strong {
        display: block;
        font-size: 14px;
    }

    .sp-finalized-banner span {
        font-size: 13px;
        color: #b45309;
    }

.sp-policy-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    background: var(--sp-primary-soft);
    color: var(--sp-text-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

    .sp-policy-note .bi {
        color: var(--sp-primary);
        margin-top: 1px;
    }

/* ----- Calendar tabs (Job / Office) --------------------------------------- */
.sp-calendar-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--sp-border);
    margin-bottom: 16px;
}

.sp-caltab {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sp-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s ease, border-color .15s ease;
}

    .sp-caltab:hover {
        color: var(--sp-text);
    }

    .sp-caltab.active {
        color: var(--sp-primary);
        border-bottom-color: var(--sp-primary);
    }

.sp-period-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--sp-text-muted);
    margin-bottom: 2px;
}

/* ----- Job calendar cell -------------------------------------------------- */
.sp-jobcell {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sp-jobcell-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--sp-text-muted);
}

    .sp-jobcell-line i {
        color: var(--sp-text-muted);
        font-size: 12px;
    }

.sp-jobcell-num {
    font-weight: 700;
    color: var(--sp-text);
}

.sp-jobcell.is-empty .sp-jobcell-line {
    opacity: .55;
}

.sp-jobcell-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.sp-jobcell-bar {
    flex: 1;
    height: 6px;
    background: var(--sp-border);
    border-radius: 999px;
    overflow: hidden;
}

    .sp-jobcell-bar > span {
        display: block;
        height: 100%;
        background: var(--sp-primary);
        border-radius: 999px;
        transition: width .2s ease;
    }

.sp-jobcell-pct {
    font-size: 11px;
    font-weight: 700;
    color: var(--sp-text-muted);
    min-width: 32px;
    text-align: right;
}

/* Add link in a drawer section title */
.sp-drawer-section-add {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

    .sp-drawer-section-add:hover {
        text-decoration: underline;
    }

/* ----- Calendar ----------------------------------------------------------- */
.sp-weekrow-label {
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--sp-text-muted);
    font-weight: 600;
    margin: 14px 0 8px;
    text-transform: uppercase;
}

.sp-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    padding: 0 2px 6px;
}

.sp-dow span {
    text-align: center;
    color: var(--sp-text-muted);
    font-size: 12px;
    font-weight: 600;
}

.sp-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 6px;
}

.sp-day {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 12px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .sp-day.is-empty {
        background: #fafafa;
    }

    /* Blue highlight only appears on hover or while the day's drawer is open. */
    .sp-day:hover,
    .sp-day.is-selected {
        border-color: var(--sp-primary);
        box-shadow: 0 0 0 2px rgba(37, 99, 235, .25);
    }

    /* "Today" stays subtly marked without a permanent blue ring. */
    .sp-day.is-today .sp-day-num {
        text-decoration: underline;
        text-decoration-color: var(--sp-text-muted);
        text-underline-offset: 3px;
    }

.sp-day-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.sp-day-dow {
    font-size: 12px;
    color: var(--sp-text-muted);
}

.sp-day-num {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.sp-day-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.sp-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

    .sp-badge.due {
        background: #fff7ed;
        color: var(--sp-pending);
    }

    .sp-badge.assigned {
        background: var(--sp-primary-soft);
        color: var(--sp-primary);
    }

/* Shift chip inside a day */
.sp-shift {
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.3;
}

.sp-shift-name {
    font-weight: 700;
}

.sp-shift-time {
    font-weight: 500;
    opacity: .8;
    margin-left: 4px;
}

.sp-shift-staff {
    margin-top: 2px;
    color: var(--sp-text-muted);
    font-size: 11px;
}

.sp-shift-staff.unassigned {
    font-style: italic;
}

.sp-shift.theme-day {
    background: var(--sp-day-bg);
    border-color: var(--sp-day-border);
}
.sp-shift.theme-day .sp-shift-name { color: var(--sp-day-text); }

.sp-shift.theme-evening {
    background: var(--sp-evening-bg);
    border-color: var(--sp-evening-border);
}
.sp-shift.theme-evening .sp-shift-name { color: var(--sp-evening-text); }

.sp-shift.theme-night {
    background: var(--sp-night-bg);
    border-color: var(--sp-night-border);
}
.sp-shift.theme-night .sp-shift-name { color: var(--sp-night-text); }

.sp-shift.theme-weekend {
    background: var(--sp-weekend-bg);
    border-color: var(--sp-weekend-border);
}
.sp-shift.theme-weekend .sp-shift-name { color: var(--sp-weekend-text); }

/* Legend */
.sp-legend {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--sp-border);
    color: var(--sp-text-muted);
    font-size: 13px;
}

.sp-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.sp-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.sp-dot.theme-day { background: var(--sp-day-dot); }
.sp-dot.theme-evening { background: var(--sp-evening-dot); }
.sp-dot.theme-night { background: var(--sp-night-dot); }
.sp-dot.theme-weekend { background: var(--sp-weekend-dot); }

/* ----- Generic cards / tables (other pages) ------------------------------- */
.sp-card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 18px;
}

.sp-grid {
    display: grid;
    gap: 16px;
}

.sp-grid.cols-3 {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.sp-grid.cols-2 {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.sp-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    overflow: hidden;
}

.sp-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sp-text-muted);
    background: #f9fafb;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sp-border);
}

.sp-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--sp-border);
    vertical-align: middle;
}

.sp-table tr:last-child td {
    border-bottom: none;
}

.sp-table tbody tr:hover {
    background: #f9fafb;
}

/* The employees table must not clip the row "Actions" dropdown, so it overrides
   the default overflow:hidden. Corner rounding is reapplied to the edge cells so
   the rounded-card look is preserved. */
.sp-employees-table {
    overflow: visible;
}

    .sp-employees-table th:first-child {
        border-top-left-radius: 12px;
    }

    .sp-employees-table th:last-child {
        border-top-right-radius: 12px;
    }

    .sp-employees-table tr:last-child td:first-child {
        border-bottom-left-radius: 12px;
    }

    .sp-employees-table tr:last-child td:last-child {
        border-bottom-right-radius: 12px;
    }

/* Avatars */
.sp-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    flex: 0 0 auto;
}

.sp-avatar.c0 { background: #6366f1; }
.sp-avatar.c1 { background: #0ea5e9; }
.sp-avatar.c2 { background: #10b981; }
.sp-avatar.c3 { background: #f59e0b; }
.sp-avatar.c4 { background: #ec4899; }
.sp-avatar.c5 { background: #8b5cf6; }

.sp-person {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sp-person-name {
    font-weight: 600;
}

.sp-person-role {
    color: var(--sp-text-muted);
    font-size: 12px;
}

/* Pills / status */
.sp-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}

.sp-pill.green { background: #ecfdf5; color: var(--sp-done); }
.sp-pill.amber { background: #fffbeb; color: var(--sp-pending); }
.sp-pill.red { background: #fef2f2; color: var(--sp-overdue); }
.sp-pill.gray { background: #f3f4f6; color: var(--sp-text-muted); }
.sp-pill.blue { background: var(--sp-primary-soft); color: var(--sp-primary); }

.sp-section-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
}

.sp-section-sub {
    color: var(--sp-text-muted);
    font-size: 13px;
    margin: 0 0 16px;
}

.sp-shift-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.sp-shift-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
}

.sp-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sp-text-muted);
    font-size: 13px;
    margin-top: 6px;
}

.sp-empty {
    color: var(--sp-text-muted);
    font-style: italic;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .sp-week, .sp-dow {
        grid-template-columns: repeat(2, 1fr);
    }

    .sp-dow {
        display: none;
    }
}

@media (max-width: 720px) {
    .sp-sidebar {
        display: none;
    }

    .sp-week, .sp-dow {
        grid-template-columns: 1fr;
    }
}

/* ----- User box (sidebar footer) ----------------------------------------- */
.sp-user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 12px 14px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(148, 163, 184, .12);
}

.sp-user-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.sp-user-name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-user-role {
    color: var(--sp-sidebar-muted);
    font-size: 12px;
}

.sp-user-signout {
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    flex: 0 0 auto;
}

    .sp-user-signout:hover {
        background: var(--sp-sidebar-hover);
        color: #fff;
    }

/* ----- Toolbar / flash --------------------------------------------------- */
.sp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sp-toolbar-info {
    color: var(--sp-text-muted);
    font-size: 13px;
    font-weight: 600;
}

.sp-filter-clear {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-primary);
    text-decoration: none;
}

.sp-filter-clear:hover {
    text-decoration: underline;
}

.sp-flash {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

    .sp-flash.success {
        background: #ecfdf5;
        color: var(--sp-done);
        border: 1px solid #a7f3d0;
    }

    .sp-flash.error {
        background: #fef2f2;
        color: var(--sp-overdue);
        border: 1px solid #fecaca;
    }

.sp-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: var(--sp-text-muted);
    padding: 48px 24px;
}

    .sp-empty-state i {
        font-size: 32px;
        opacity: .5;
    }

/* ----- Inline status selector (VA task list) ----------------------------- */
.sp-status-form {
    margin: 0;
}

.sp-status-select {
    width: auto;
    min-width: 120px;
    padding: 4px 8px;
    font-size: .82rem;
}

/* ----- Dropdown (3-dots) menu -------------------------------------------- */
.sp-menu {
    position: relative;
    display: inline-block;
}

.sp-menu-trigger {
    border: none;
    background: transparent;
    color: var(--sp-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: grid;
    place-items: center;
}

    .sp-menu-trigger:hover {
        background: #f3f4f6;
        color: var(--sp-text);
    }

.sp-menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 190px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    padding: 6px;
    z-index: 40;
    display: none;
}

.sp-menu.open .sp-menu-pop {
    display: block;
}

.sp-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 9px 10px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--sp-text);
    cursor: pointer;
}

    .sp-menu-item:hover {
        background: #f3f4f6;
    }

    .sp-menu-item:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

    .sp-menu-item.danger {
        color: var(--sp-overdue);
    }

        .sp-menu-item.danger:hover {
            background: #fef2f2;
        }

.sp-menu-pop form {
    margin: 0;
}

/* ----- Modal ------------------------------------------------------------- */
.sp-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    z-index: 100;
    overflow-y: auto;
}

    .sp-modal.open {
        display: flex;
    }

/* Assign-staff modal opened from within an open day drawer (z-index 1100)
   must stack above it, otherwise the picker renders behind the drawer scrim. */
.sp-modal.sp-modal-over-drawer {
    z-index: 1200;
}

body.sp-modal-open {
    overflow: hidden;
}

.sp-modal-card {
    background: var(--sp-surface);
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    padding: 22px;
}

.sp-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

    .sp-modal-head h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
    }

.sp-modal-close {
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--sp-text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

    .sp-modal-close:hover {
        background: #f3f4f6;
        color: var(--sp-text);
    }

.sp-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.sp-modal-card-lg {
    max-width: 860px;
}

.sp-field-group {
    margin-top: 16px;
}

.sp-field-group > .sp-field-label {
    display: block;
    margin-bottom: 8px;
}

.sp-modal-actions-split {
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.sp-modal-actions-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.sp-check-inline {
    margin: 0;
}

/* ----- Forms ------------------------------------------------------------- */
.sp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.sp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.sp-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-text-muted);
}

.sp-input {
    width: 100%;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    color: var(--sp-text);
    background: #fff;
}

    .sp-input:focus {
        outline: none;
        border-color: var(--sp-primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
    }

textarea.sp-input {
    resize: vertical;
}

.sp-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--sp-text);
    margin: 4px 0 2px;
}

/* ----- Calendar task chips ----------------------------------------------- */
.sp-day-tasks {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px dashed var(--sp-border);
}

.sp-task-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 7px;
    border-radius: 6px;
    line-height: 1.2;
}

.sp-task-chip-title {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-task-chip-who {
    flex: 0 0 auto;
    opacity: .75;
    font-weight: 500;
}

.sp-task-chip.green { background: #ecfdf5; color: var(--sp-done); }
.sp-task-chip.amber { background: #fffbeb; color: var(--sp-pending); }
.sp-task-chip.red { background: #fef2f2; color: var(--sp-overdue); }

.sp-task-chip-check {
    flex: 0 0 auto;
    font-weight: 600;
    opacity: .85;
}

.sp-task-urgent {
    color: var(--sp-overdue);
}

/* ----- Task metadata, filters & checklist -------------------------------- */
.sp-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.sp-field-inline {
    min-width: 160px;
}

.sp-inline-filter {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.sp-task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.sp-checklist {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-checklist-item {
    font-size: 12px;
    color: var(--sp-text);
}

.sp-checklist-item.done {
    color: var(--sp-text-muted);
    text-decoration: line-through;
}

.sp-checklist-form {
    margin: 0;
}

.sp-checklist-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 2px 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.sp-checklist-toggle:hover {
    color: var(--sp-primary);
}

.sp-drawer-checklist {
    margin-top: 6px;
}

/* ----- Login ------------------------------------------------------------- */
.sp-login-bg {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #2563eb 140%);
}

.sp-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--sp-surface);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    padding: 30px 28px;
}

.sp-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.sp-login-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
}

.sp-login-sub {
    color: var(--sp-text-muted);
    font-size: 13px;
    margin: 0 0 20px;
}

.sp-login-submit {
    width: 100%;
    justify-content: center;
    margin-top: 6px;
}

.sp-login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    color: var(--sp-overdue);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

.sp-login-hint {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--sp-border);
    color: var(--sp-text-muted);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 560px) {
    .sp-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ----- Profile + Availability ------------------------------------------- */
.sp-profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.sp-availability-wrap {
    overflow-x: auto;
}

table.sp-availability {
    min-width: 640px;
}

    table.sp-availability th.center,
    table.sp-availability td.center {
        text-align: center;
    }

    table.sp-availability td {
        vertical-align: middle;
    }

.sp-avail-day {
    font-weight: 700;
    color: var(--sp-text);
    white-space: nowrap;
}

/* Time input with trailing clock icon */
.sp-time-input {
    position: relative;
    max-width: 170px;
}

    .sp-time-input .sp-input {
        padding-right: 34px;
    }

    .sp-time-input i {
        position: absolute;
        right: 11px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--sp-text-muted);
        pointer-events: none;
        font-size: 15px;
    }

/* Pill toggle that reads Yes / No / Off (image-style) */
.sp-switch {
    display: inline-flex;
    cursor: pointer;
    user-select: none;
}

.sp-switch-cb {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sp-switch-pill {
    position: relative;
    width: 58px;
    height: 28px;
    border-radius: 999px;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    transition: background .15s ease, border-color .15s ease;
    display: inline-block;
}

    /* knob */
    .sp-switch-pill::before {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
        transition: transform .15s ease;
    }

    /* label text (defaults to the OFF text) */
    .sp-switch-pill::after {
        content: attr(data-off);
        position: absolute;
        top: 0;
        right: 8px;
        line-height: 26px;
        font-size: 11px;
        font-weight: 700;
        color: var(--sp-text-muted);
    }

/* checked state */
.sp-switch-cb:checked ~ .sp-switch-pill {
    background: #dbeafe;
    border-color: var(--sp-primary);
}

    .sp-switch-cb:checked ~ .sp-switch-pill::before {
        transform: translateX(30px);
    }

    .sp-switch-cb:checked ~ .sp-switch-pill::after {
        content: attr(data-on);
        right: auto;
        left: 9px;
        color: var(--sp-primary);
    }

/* "Active" column uses green when on */
.sp-switch-cb:checked ~ .sp-switch-pill.is-active {
    background: #dcfce7;
    border-color: var(--sp-done);
}

    .sp-switch-cb:checked ~ .sp-switch-pill.is-active::after {
        color: var(--sp-done);
    }

.sp-switch-cb:focus-visible ~ .sp-switch-pill {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

/* Block-out list */
.sp-blockout-list {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--sp-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sp-blockout-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sp-blockout-reason {
    color: var(--sp-text-muted);
    font-size: 13px;
}

.sp-blockout-remove {
    margin: 0 0 0 auto;
}

/* ---- Manager time-off review queue ---- */
.sp-request-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.sp-request-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    background: var(--sp-surface);
}

.sp-request-who {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 260px;
}

.sp-request-name {
    font-weight: 600;
    color: var(--sp-text);
}

.sp-request-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.sp-request-days {
    color: var(--sp-text-muted);
    font-size: 12px;
}

.sp-request-reason {
    color: var(--sp-text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.sp-request-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sp-note-input {
    max-width: 200px;
}

.sp-icon-btn {
    border: none;
    background: transparent;
    color: var(--sp-text-muted);
    width: 30px;
    height: 30px;
    border-radius: 7px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

    .sp-icon-btn:hover {
        background: #f3f4f6;
        color: var(--sp-text);
    }

    .sp-icon-btn.danger:hover {
        background: #fef2f2;
        color: var(--sp-overdue);
    }

/* ===========================================================================
   Role-filter tabs (Employees)
   =========================================================================== */
.sp-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}

.sp-tab {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--sp-border);
    background: var(--sp-surface);
    color: var(--sp-text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all .15s ease;
}

    .sp-tab:hover {
        border-color: var(--sp-primary);
        color: var(--sp-primary);
    }

    .sp-tab.active {
        background: var(--sp-sidebar);
        border-color: var(--sp-sidebar);
        color: #fff;
    }

/* ===========================================================================
   Role badges (Employees)
   =========================================================================== */
.sp-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.sp-role-badge.role-admin       { background: #fef2f2; color: #b91c1c; }
.sp-role-badge.role-manager     { background: #f5f3ff; color: #7c3aed; }
.sp-role-badge.role-supervisor  { background: #eff6ff; color: #2563eb; }
.sp-role-badge.role-technician  { background: #ecfeff; color: #0891b2; }
.sp-role-badge.role-operator    { background: #ecfdf5; color: #059669; }
.sp-role-badge.role-maintenance { background: #fff7ed; color: #ea580c; }
.sp-role-badge.role-security    { background: #fef2f2; color: #dc2626; }
.sp-role-badge.role-va          { background: #f0f9ff; color: #0369a1; }
.sp-role-badge.role-default     { background: #f3f4f6; color: var(--sp-text-muted); }

/* ===========================================================================
   Shift day pills / picker (Shift Definitions)
   =========================================================================== */
.sp-shift-days {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 10px 0;
}

.sp-day-chip {
    min-width: 30px;
    text-align: center;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--sp-border);
    font-size: 11px;
    font-weight: 600;
    color: var(--sp-text-muted);
    background: var(--sp-surface);
}

    .sp-day-chip.on {
        background: var(--sp-primary-soft);
        border-color: var(--sp-primary);
        color: var(--sp-primary);
    }

.sp-shift-day-crews {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

    .sp-shift-day-crews[hidden] {
        display: none;
    }

.sp-shift-crew-collapse {
    margin-top: 8px;
}

.sp-shift-crew-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    background: var(--sp-surface);
    color: var(--sp-text);
    font: inherit;
    cursor: pointer;
    text-align: left;
    transition: background .12s ease, border-color .12s ease;
}

    .sp-shift-crew-toggle:hover {
        border-color: var(--sp-primary);
    }

.sp-shift-crew-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-text-muted);
}

.sp-shift-crew-days {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sp-shift-crew-day-pill {
    display: inline-flex;
    align-items: center;
    min-width: 26px;
    justify-content: center;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--sp-primary-soft, rgba(37, 99, 235, 0.12));
    color: var(--sp-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

    .sp-shift-crew-day-pill.empty {
        background: var(--sp-surface-alt, rgba(148, 163, 184, 0.16));
        color: var(--sp-text-muted);
    }

.sp-shift-crew-chevron {
    transition: transform .15s ease;
    color: var(--sp-text-muted);
}

.sp-shift-crew-toggle.collapsed .sp-shift-crew-chevron {
    transform: rotate(-90deg);
}

.sp-shift-day-crew {
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 10px;
    background: var(--sp-surface);
}

    .sp-shift-day-crew.is-clickable {
        cursor: pointer;
        transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
    }

        .sp-shift-day-crew.is-clickable:hover,
        .sp-shift-day-crew.is-clickable:focus-visible {
            border-color: var(--sp-primary);
            box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
            outline: none;
        }

.sp-shift-day-edit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--sp-primary);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .1);
}

.sp-shift-day-crew-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sp-shift-day-name {
    font-weight: 700;
    font-size: 12px;
    color: var(--sp-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sp-shift-day-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-text-muted);
}

    .sp-shift-day-count.under {
        color: var(--sp-overdue);
    }

.sp-day-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sp-day-toggle {
    position: relative;
    cursor: pointer;
}

    .sp-day-toggle input {
        position: absolute;
        opacity: 0;
        inset: 0;
        cursor: pointer;
    }

    .sp-day-toggle span {
        display: inline-block;
        min-width: 42px;
        text-align: center;
        padding: 7px 10px;
        border-radius: 8px;
        border: 1px solid var(--sp-border);
        font-size: 13px;
        font-weight: 600;
        color: var(--sp-text-muted);
        background: var(--sp-surface);
        transition: all .12s ease;
    }

    .sp-day-toggle input:checked + span {
        background: var(--sp-primary);
        border-color: var(--sp-primary);
        color: #fff;
    }

/* ===========================================================================
   Staff chips + assignment rows (Shifts & calendar drawer)
   =========================================================================== */
.sp-avatar.xs {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.sp-shift-staff-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 10px;
}

.sp-staff-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 3px;
    border-radius: 999px;
    border: 1px solid var(--sp-border);
    background: var(--sp-surface);
    font-size: 12px;
}

.sp-staff-chip-name {
    font-weight: 600;
    color: var(--sp-text);
}

.sp-staff-chip-role {
    color: var(--sp-text-muted);
    font-size: 11px;
}

.sp-staff-chip-x {
    display: inline-flex;
    margin: 0;
}

    .sp-staff-chip-x button {
        border: 0;
        background: transparent;
        color: var(--sp-text-muted);
        cursor: pointer;
        padding: 0 2px;
        line-height: 1;
        display: inline-grid;
        place-items: center;
    }

    .sp-staff-chip-x button:hover {
        color: var(--sp-overdue);
    }

.sp-assign-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

    .sp-assign-row .sp-input {
        flex: 1 1 auto;
    }

/* Availability-gated "Assign staff" control on shift cards */
.sp-shift-assign-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

/* Drawer shift: "Assign staff" + "Assign hours" share one row */
.sp-drawer-shift-actions {
    display: flex;
    gap: 8px;
}

    .sp-drawer-shift-actions .sp-shift-assign-btn {
        flex: 1 1 0;
        min-width: 0;
    }

.sp-assign-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--sp-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.sp-assign-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 300px;
    overflow-y: auto;
    margin: 4px 0 6px;
}

    .sp-assign-list .sp-assign-row {
        margin-top: 0;
        padding: 6px 8px;
        border-radius: 8px;
        cursor: pointer;
        transition: background .12s ease;
    }

        .sp-assign-list .sp-assign-row:hover {
            background: var(--sp-surface-alt, rgba(127, 127, 127, .08));
        }

.sp-assign-name {
    flex: 1 1 auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-text);
}

/* Assign staff: selected chips */
.sp-assign-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 8px;
}

.sp-assign-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 4px;
    border-radius: 999px;
    border: 1px solid var(--sp-border);
    background: var(--sp-surface);
    font-size: 12px;
}

.sp-assign-chip-name {
    font-weight: 600;
    color: var(--sp-text);
    padding-left: 2px;
}

.sp-assign-chip-hours {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-left: 4px;
}

    .sp-assign-chip-hours .sp-input {
        min-width: 78px;
    }

.sp-assign-none {
    margin: 4px 0 8px;
}

/* Assign staff: search box + results */
.sp-assign-search {
    position: relative;
    display: flex;
    align-items: center;
}

    .sp-assign-search .bi-search {
        position: absolute;
        left: 10px;
        color: var(--sp-text-muted);
        font-size: 13px;
        pointer-events: none;
    }

    .sp-assign-search .sp-input {
        width: 100%;
        padding-left: 30px;
    }

.sp-assign-results {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 240px;
    overflow-y: auto;
    margin: 6px 0;
}

.sp-assign-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
}

    .sp-assign-option:hover {
        background: var(--sp-surface-alt, rgba(127, 127, 127, .08));
    }

.sp-assign-add-icon {
    color: var(--sp-text-muted);
    font-size: 14px;
}

.sp-btn.sm {
    padding: 6px 12px;
    font-size: 13px;
}

.sp-inline-form {
    display: inline;
    margin: 0;
}

/* Worked-hours chip + per-day inline assign (Shifts) */
.sp-staff-chip-hours {
    color: var(--sp-text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.sp-chip-x-form {
    display: inline-flex;
    margin: 0;
}

.sp-chip-x {
    border: 0;
    background: transparent;
    color: var(--sp-text-muted);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    display: inline-grid;
    place-items: center;
}

    .sp-chip-x:hover {
        color: var(--sp-overdue);
    }

/* Inline "set specific hours" button on a crew chip */
.sp-chip-edit {
    border: 0;
    background: transparent;
    color: var(--sp-text-muted);
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    display: inline-grid;
    place-items: center;
}

    .sp-chip-edit:hover {
        color: var(--sp-primary);
    }

/* From / To selects in the per-day hours picker */
.sp-hours-row {
    display: flex;
    gap: 12px;
    margin: 8px 0 4px;
}

    .sp-hours-row .sp-field {
        flex: 1;
    }

/* Right-aligned count + "assign hours" control in the Staff-by-day header */
.sp-shift-day-crew-head-right {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Per-day "assign hours" popup: one row per staff member with a From–To range */
.sp-dayhours-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 4px;
    max-height: 320px;
    overflow-y: auto;
}

.sp-dayhours-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-dayhours-range {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .sp-dayhours-range .sp-input {
        min-width: 92px;
    }

.sp-dayhours-dash {
    color: var(--sp-text-muted);
}

.sp-dayhours-avail {
    font-size: 11px;
    color: var(--sp-text-muted);
    white-space: nowrap;
}

.sp-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #fffbeb;
    color: var(--sp-pending);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.sp-assign-inline {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 0;
}

    .sp-assign-inline .sp-input {
        flex: 1 1 auto;
    }

.sp-input.sm {
    padding: 6px 9px;
    font-size: 13px;
}

.sp-empty.sm {
    font-size: 12px;
}

/* Checkbox row (Shifts modal: visible on schedule) */
.sp-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--sp-text);
    margin: 4px 0 14px;
    cursor: pointer;
}

    .sp-check-row input {
        width: 16px;
        height: 16px;
    }

/* Staffing-minimums modal */
.sp-modal-hint {
    font-size: 13px;
    color: var(--sp-text-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

.sp-staffing-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.sp-staffing-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .sp-staffing-row .sp-input {
        flex: 1 1 auto;
    }

.sp-staffing-dash {
    color: var(--sp-text-muted);
    flex: 0 0 12px;
    width: 12px;
    text-align: center;
}

.sp-staffing-min {
    flex: 0 0 70px;
    width: 70px;
}

.sp-staffing-day {
    flex: 0 0 84px;
    width: 84px;
}

.sp-staffing-row .sp-staffing-dept {
    flex: 0 0 140px;
    width: 140px;
}

.sp-staffing-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    padding: 0 2px;
}

    .sp-staffing-head span {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--sp-text-muted);
    }

    .sp-staffing-head .sp-staffing-dept {
        flex: 0 0 140px;
        width: 140px;
    }

    .sp-staffing-head .sp-staffing-col {
        flex: 1 1 auto;
    }

    .sp-staffing-head .sp-staffing-spacer {
        flex: 0 0 24px;
        width: 24px;
    }

.sp-link-btn {
    border: 0;
    background: transparent;
    color: var(--sp-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 4px;
}

    .sp-link-btn.danger {
        color: var(--sp-overdue);
    }

    .sp-link-btn:hover {
        text-decoration: underline;
    }

/* ===========================================================================
   Day detail drawer (Schedule Calendar)
   =========================================================================== */
.sp-drawer {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    z-index: 1100;
}

    .sp-drawer.open {
        display: block;
    }

/* Slide-in editor drawer used by the Tasks board and Office Calendar.
   The scrim is the full-screen backdrop; the inner .sp-drawer is the panel
   that slides in from the right. Scoped with the child combinator so the
   standalone .sp-drawer used by the schedule day drawers is untouched. */
.sp-drawer-scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    justify-content: flex-end;
    z-index: 1100;
}

    .sp-drawer-scrim.open {
        display: flex;
    }

    .sp-drawer-scrim > .sp-drawer {
        position: relative;
        inset: auto;
        background: var(--sp-surface);
        height: 100%;
        width: min(460px, 100%);
        box-shadow: -8px 0 24px rgba(15, 23, 42, .18);
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        padding: 20px 22px 28px;
        animation: sp-drawer-in .18s ease;
    }

.sp-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(440px, 100%);
    background: var(--sp-surface);
    box-shadow: -8px 0 24px rgba(15, 23, 42, .18);
    display: flex;
    flex-direction: column;
    animation: sp-drawer-in .18s ease;
}

@keyframes sp-drawer-in {
    from { transform: translateX(24px); opacity: .6; }
    to   { transform: translateX(0); opacity: 1; }
}

.sp-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--sp-border);
}

.sp-drawer-title {
    margin: 0;
    font-size: 17px;
    color: var(--sp-text);
}

.sp-drawer-sub {
    font-size: 13px;
    color: var(--sp-text-muted);
    margin-top: 2px;
}

.sp-drawer-body {
    padding: 16px 20px 24px;
    overflow-y: auto;
}

.sp-drawer-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--sp-text-muted);
    margin: 18px 0 10px;
}

    .sp-drawer-section-title:first-child {
        margin-top: 0;
    }

.sp-drawer-shift {
    border: 1px solid var(--sp-border);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.sp-drawer-shift.theme-day     { border-left-color: var(--sp-day-dot);     background: var(--sp-day-bg); }
.sp-drawer-shift.theme-evening { border-left-color: var(--sp-evening-dot); background: var(--sp-evening-bg); }
.sp-drawer-shift.theme-night   { border-left-color: var(--sp-night-dot);   background: var(--sp-night-bg); }
.sp-drawer-shift.theme-weekend { border-left-color: var(--sp-weekend-dot); background: var(--sp-weekend-bg); }

.sp-drawer-shift-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

    .sp-drawer-shift-head .sp-shift-name {
        font-weight: 700;
        font-size: 13px;
    }

    .sp-drawer-shift-head .sp-shift-time {
        font-size: 12px;
        color: var(--sp-text-muted);
    }

.sp-drawer-shift-staffing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-text-muted);
    margin-bottom: 8px;
}

    .sp-drawer-shift-staffing.under {
        color: var(--sp-overdue);
    }

.sp-drawer-staff {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sp-understaff-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.sp-understaff-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--sp-overdue);
    border-radius: 8px;
    background: rgba(220, 38, 38, .06);
    font-size: 12px;
}

.sp-understaff-time {
    font-weight: 600;
    color: var(--sp-text);
    font-variant-numeric: tabular-nums;
}

.sp-understaff-dept {
    font-weight: 700;
    color: var(--sp-text);
    margin-right: auto;
}

.sp-understaff-count {
    font-weight: 700;
    color: var(--sp-overdue);
    font-variant-numeric: tabular-nums;
}

.sp-drawer-task {
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.sp-drawer-task-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--sp-text);
}

.sp-drawer-task-desc {
    font-size: 12px;
    color: var(--sp-text-muted);
    margin-top: 2px;
}

.sp-drawer-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.sp-drawer-task-assignee {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===========================================================================
   Employee edit/add drawer (Personal & Work Info / Job Description / Availability)
   =========================================================================== */
.sp-emp-drawer-panel {
    width: min(560px, 100%);
    padding: 0;
}

.sp-emp-drawer-head {
    background: var(--sp-sidebar);
    color: #fff;
    border-bottom: 0;
}

    .sp-emp-drawer-head .sp-drawer-title {
        color: #fff;
    }

    .sp-emp-drawer-head .sp-drawer-sub {
        color: #cbd5e1;
    }

    .sp-emp-drawer-head .sp-modal-close {
        color: #cbd5e1;
    }

        .sp-emp-drawer-head .sp-modal-close:hover {
            background: rgba(255, 255, 255, .12);
            color: #fff;
        }

.sp-emp-tabs {
    display: flex;
    gap: 4px;
    padding: 0 20px;
    border-bottom: 1px solid var(--sp-border);
    background: var(--sp-surface);
}

.sp-emp-tab {
    border: 0;
    background: transparent;
    padding: 14px 6px;
    margin-right: 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sp-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

    .sp-emp-tab:hover {
        color: var(--sp-text);
    }

    .sp-emp-tab.active {
        color: var(--sp-primary);
        border-bottom-color: var(--sp-primary);
    }

.sp-emp-drawer-body {
    flex: 1 1 auto;
}

.sp-emp-pane {
    display: none;
}

    .sp-emp-pane.active {
        display: block;
    }

.sp-emp-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sp-text-muted);
    margin: 4px 0 14px;
}

    .sp-emp-pane .sp-emp-section-title:not(:first-child) {
        margin-top: 22px;
    }

.sp-emp-hint {
    font-size: 13px;
    color: var(--sp-text-muted);
    margin: -6px 0 16px;
}

.sp-emp-drawer-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--sp-border);
    background: var(--sp-surface);
}

/* ----- Employee mini-dashboard ------------------------------------------ */
.sp-mini-dash {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.sp-mini-dash-head {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
}

.sp-mini-id {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

    .sp-mini-id .sp-avatar {
        width: 46px;
        height: 46px;
        font-size: 16px;
        flex: 0 0 auto;
    }

.sp-mini-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--sp-text);
}

.sp-mini-username {
    font-size: 13px;
    color: var(--sp-text-muted);
}

.sp-mini-id-text .sp-role-badge {
    margin-top: 4px;
}

.sp-mini-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 18px;
}

.sp-mini-fact {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--sp-text);
}

    .sp-mini-fact i {
        color: var(--sp-text-muted);
        width: 16px;
        text-align: center;
    }

.sp-mini-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.sp-mini-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    background: var(--sp-bg);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .05s;
}

    .sp-mini-stat:hover {
        border-color: var(--sp-primary);
        box-shadow: 0 1px 3px rgba(37, 99, 235, .15);
    }

    .sp-mini-stat:active {
        transform: translateY(1px);
    }

.sp-mini-stat-num {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    color: var(--sp-text);
}

.sp-mini-stat-label {
    font-size: 12px;
    color: var(--sp-text-muted);
}

.sp-mini-stat.is-pending .sp-mini-stat-num {
    color: var(--sp-pending);
}

.sp-mini-stat.is-done .sp-mini-stat-num {
    color: var(--sp-done);
}

.sp-mini-stat.is-overdue.has-overdue {
    border-color: var(--sp-overdue);
    background: rgba(220, 38, 38, .06);
}

    .sp-mini-stat.is-overdue.has-overdue .sp-mini-stat-num {
        color: var(--sp-overdue);
    }

.sp-mini-foot {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    border-top: 1px solid var(--sp-border);
    padding-top: 12px;
}

.sp-mini-block-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--sp-text-muted);
    margin-bottom: 6px;
}

.sp-mini-avail {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.sp-mini-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    background: var(--sp-bg);
    color: var(--sp-text-muted);
}

    .sp-mini-day.is-on {
        background: var(--sp-primary-soft);
        border-color: #bfdbfe;
        color: var(--sp-primary);
    }

.sp-mini-day-name {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.sp-mini-day-hrs {
    font-size: 10px;
    white-space: nowrap;
}

.sp-mini-shifts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.sp-mini-empty {
    font-size: 13px;
    color: var(--sp-text-muted);
    font-style: italic;
}

.sp-emp-row {
    cursor: pointer;
}

    .sp-emp-row.is-selected {
        background: var(--sp-primary-soft);
        box-shadow: inset 3px 0 0 var(--sp-primary);
    }

@media (max-width: 720px) {
    .sp-mini-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sp-mini-foot {
        grid-template-columns: 1fr;
    }
}

/* ----- Alert center (Notifications page) -------------------------------- */
.sp-alert-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sp-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--sp-border);
}

    .sp-alert-item:last-child {
        border-bottom: none;
    }

    .sp-alert-item.unread {
        background: rgba(37, 99, 235, .05);
        border-radius: 8px;
        padding-left: 12px;
        padding-right: 12px;
    }

.sp-alert-ico {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sp-surface-alt, #eef2ff);
    color: var(--sp-primary);
    font-size: 16px;
}

.sp-alert-item.unread .sp-alert-ico {
    background: var(--sp-primary);
    color: #fff;
}

.sp-alert-body {
    flex: 1 1 auto;
    min-width: 0;
}

.sp-alert-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.sp-alert-heading {
    font-weight: 600;
    color: var(--sp-text, #0f172a);
}

.sp-alert-age {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--sp-text-muted, #64748b);
}

.sp-alert-text {
    color: var(--sp-text-muted, #475569);
    font-size: 14px;
    margin-top: 2px;
}

.sp-alert-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sp-primary);
    text-decoration: none;
}

    .sp-alert-link:hover {
        text-decoration: underline;
    }

.sp-alert-actions {
    flex: 0 0 auto;
}

.sp-alert-approve {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

    .sp-alert-approve form {
        margin: 0;
    }

/* ----- Communication preferences matrix --------------------------------- */
.sp-pref-table th.center,
.sp-pref-table td.center {
    text-align: center;
    width: 90px;
}

.sp-pref-name {
    font-weight: 600;
    color: var(--sp-text, #0f172a);
}

.sp-pref-desc {
    font-size: 12px;
    color: var(--sp-text-muted, #64748b);
    margin-top: 2px;
}

/* ----- Audit log -------------------------------------------------------- */
.sp-audit-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

    .sp-audit-filters .sp-input {
        min-width: 160px;
    }

.sp-audit-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sp-audit-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--sp-border);
}

    .sp-audit-item:last-child {
        border-bottom: none;
    }

.sp-audit-ico {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sp-surface-alt, #eef2ff);
    color: var(--sp-primary);
    font-size: 15px;
}

    .sp-audit-ico.cat-auth {
        background: #e0f2fe;
        color: #0369a1;
    }

    .sp-audit-ico.cat-task {
        background: #dcfce7;
        color: #15803d;
    }

    .sp-audit-ico.cat-shift {
        background: #fef3c7;
        color: #b45309;
    }

    .sp-audit-ico.cat-employee {
        background: #ede9fe;
        color: #6d28d9;
    }

    .sp-audit-ico.cat-device {
        background: #cffafe;
        color: #0e7490;
    }

    .sp-audit-ico.cat-billing {
        background: #fce7f3;
        color: #be185d;
    }

    .sp-audit-ico.cat-system {
        background: #e2e8f0;
        color: #334155;
    }

.sp-audit-body {
    flex: 1 1 auto;
    min-width: 0;
}

.sp-audit-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.sp-audit-pill {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--sp-surface-alt, #eef2ff);
    color: var(--sp-primary);
}

    .sp-audit-pill.cat-auth {
        background: #e0f2fe;
        color: #0369a1;
    }

    .sp-audit-pill.cat-task {
        background: #dcfce7;
        color: #15803d;
    }

    .sp-audit-pill.cat-shift {
        background: #fef3c7;
        color: #b45309;
    }

    .sp-audit-pill.cat-employee {
        background: #ede9fe;
        color: #6d28d9;
    }

    .sp-audit-pill.cat-device {
        background: #cffafe;
        color: #0e7490;
    }

    .sp-audit-pill.cat-billing {
        background: #fce7f3;
        color: #be185d;
    }

    .sp-audit-pill.cat-system {
        background: #e2e8f0;
        color: #334155;
    }

.sp-audit-summary {
    color: var(--sp-text, #0f172a);
    font-size: 14px;
}

.sp-audit-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--sp-text-muted, #64748b);
    flex-wrap: wrap;
}

.sp-audit-actor {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--sp-text, #334155);
}

.sp-audit-role {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--sp-surface-alt, #eef2ff);
    font-weight: 600;
}

/* ----- Print: Daily Schedule roster ------------------------------------- */
/* The roster is rendered in the page but only shown when printing. */
.sp-print-roster {
    display: none;
}

@media print {
    /* Hide every on-screen element; only the roster prints. */
    .sp-sidebar,
    .sp-topbar,
    .sp-period,
    .sp-calendar-tabs,
    .sp-finalized-banner,
    .sp-flash,
    .sp-dow,
    .sp-weekrow-label,
    .sp-week,
    .sp-legend,
    .sp-drawer,
    .sp-alert-box {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .sp-app {
        display: block;
    }

    .sp-main {
        width: 100%;
    }

    .sp-content {
        padding: 0;
    }

    /* ---- The printable roster ---- */
    .sp-print-roster {
        display: block;
        color: #000;
        font-size: 9px;
    }

    .sp-roster-page {
        page-break-after: always;
    }

    .sp-roster-page:last-child {
        page-break-after: auto;
    }

    .sp-roster-head {
        background: #1818d8;
        color: #fff;
        padding: 12px 16px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sp-roster-head h2 {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: .5px;
    }

    .sp-roster-weekof {
        margin-top: 4px;
        font-size: 8px;
        display: flex;
        gap: 6px;
        align-items: baseline;
    }

    .sp-roster-weekof-label {
        font-weight: 700;
    }

    table.sp-roster {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        margin-top: 10px;
    }

    table.sp-roster th,
    table.sp-roster td {
        border: 1px solid #c9c9c9;
        padding: 3px 4px;
        vertical-align: top;
        text-align: left;
        overflow: hidden;
        word-wrap: break-word;
    }

    table.sp-roster thead th {
        border: none;
        text-align: center;
        padding-bottom: 6px;
    }

    .sp-roster-date {
        font-size: 11px;
        font-weight: 700;
    }

    .sp-roster-day {
        font-size: 9px;
        font-weight: 700;
        letter-spacing: .3px;
    }

    /* The leftmost label column (department name / blank spacer). */
    .sp-roster-deptcol {
        width: 16%;
        border: none !important;
        text-align: right !important;
        font-weight: 700;
        font-size: 10px;
        padding-right: 10px !important;
    }

    /* Grey department band that spans the day columns. */
    tr.sp-roster-band td {
        background: #efefef;
        border: none;
        height: 14px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* The department label cell itself stays white. */
    tr.sp-roster-band td.sp-roster-deptcol {
        background: #fff;
    }

    .sp-roster-name {
        display: block;
        font-weight: 600;
        color: #1818d8;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sp-roster-hours {
        display: block;
        color: #000;
    }

    .sp-roster-off {
        display: block;
        font-style: italic;
        font-weight: 600;
        color: #b91c1c;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sp-roster-empty {
        text-align: center !important;
        font-style: italic;
        color: #666;
    }

    @page {
        size: landscape;
        margin: 10mm;
    }
}

/* ===========================================================================
   Tasks board (kanban), stat cards, search & office agenda
   =========================================================================== */

/* ----- Tasks page header -------------------------------------------------- */
.sp-tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* ----- Stat cards --------------------------------------------------------- */
.sp-statcards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.sp-statcard {
    display: block;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 16px 18px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

a.sp-statcard:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
}

.sp-statcard.is-alert {
    border-color: #fecaca;
    background: #fef2f2;
}

.sp-statcard-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.sp-statcard-value {
    margin-top: 6px;
    font-size: 28px;
    font-weight: 700;
    color: var(--sp-text);
}

.sp-statcard.is-alert .sp-statcard-value {
    color: var(--sp-overdue);
}

/* ----- List / board view toggle ------------------------------------------ */
.sp-filter-spacer {
    flex: 1 1 auto;
}

.sp-view-toggle {
    display: inline-flex;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--sp-surface);
}

.sp-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 34px;
    color: var(--sp-text-muted);
    cursor: pointer;
}

    .sp-view-btn:hover {
        background: #f9fafb;
        color: var(--sp-text);
    }

    .sp-view-btn.active {
        background: var(--sp-primary-soft);
        color: var(--sp-primary);
    }

    .sp-view-btn + .sp-view-btn {
        border-left: 1px solid var(--sp-border);
    }

/* ----- Search box --------------------------------------------------------- */
.sp-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    padding: 0 12px;
    height: 36px;
    color: var(--sp-text-muted);
}

.sp-search-input {
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--sp-text);
    min-width: 180px;
}

/* ----- Kanban board ------------------------------------------------------- */
.sp-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.sp-board-col {
    background: #f9fafb;
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.sp-board-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 13px;
    border-bottom: 2px solid var(--sp-border);
    border-radius: 12px 12px 0 0;
}

    .sp-board-col-head.not-started {
        color: var(--sp-text-muted);
        border-bottom-color: #cbd5e1;
    }

    .sp-board-col-head.in-progress {
        color: var(--sp-primary);
        border-bottom-color: #93c5fd;
    }

    .sp-board-col-head.completed {
        color: var(--sp-done);
        border-bottom-color: #6ee7b7;
    }

.sp-board-count {
    min-width: 22px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    color: var(--sp-text-muted);
    font-size: 12px;
    text-align: center;
}

.sp-board-col-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.sp-board-empty {
    text-align: center;
    color: var(--sp-text-muted);
    font-size: 12px;
    font-style: italic;
    padding: 16px 8px;
}

/* ----- Task card ---------------------------------------------------------- */
.sp-task-card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

.sp-task-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.sp-task-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--sp-text);
}

.sp-task-card-desc {
    margin-top: 4px;
    font-size: 12px;
    color: var(--sp-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sp-task-card-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--sp-text-muted);
}

.sp-task-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--sp-border);
}

.sp-task-due {
    font-size: 12px;
    font-weight: 600;
    color: var(--sp-text-muted);
}

.sp-task-card .sp-status-form {
    margin-top: 10px;
}

    .sp-task-card .sp-status-select {
        width: 100%;
    }

/* ----- Office calendar agenda -------------------------------------------- */
.sp-agenda-time {
    font-weight: 700;
    color: var(--sp-text);
}

.sp-agenda-time.sp-overdue {
    color: var(--sp-overdue);
}

.sp-status-select.status-amber { color: var(--sp-pending); }
.sp-status-select.status-green { color: var(--sp-done); }
.sp-status-select.status-blue { color: var(--sp-primary); }
.sp-status-select.status-red { color: var(--sp-overdue); }
.sp-status-select.status-gray { color: var(--sp-text-muted); }

/* ----- Office calendar: month grid -------------------------------------- */
.sp-cal-monthnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-cal-monthrow {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .sp-cal-monthrow .sp-period-title {
        margin: 0;
    }

.sp-cal-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--sp-border);
    color: var(--sp-text-muted);
    background: var(--sp-surface);
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}

    .sp-cal-arrow:hover {
        border-color: var(--sp-primary);
        color: var(--sp-primary);
    }

.sp-cal-dow {
    margin-top: 8px;
}

.sp-cal-week {
    gap: 0;
    margin-bottom: 0;
}

    /* Collapse borders between adjacent cells into a single grid outline. */
    .sp-cal-week + .sp-cal-week .sp-cal-cell {
        border-top: none;
    }

    .sp-cal-week .sp-cal-cell + .sp-cal-cell {
        border-left: none;
    }

.sp-cal-cell {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    min-height: 132px;
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: box-shadow .15s ease, background .15s ease;
}

    .sp-cal-cell.is-out {
        background: #fafafa;
        color: var(--sp-text-muted);
    }

    .sp-cal-cell.is-empty {
        cursor: default;
    }

    .sp-cal-cell:hover:not(.is-empty),
    .sp-cal-cell.is-selected {
        box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .25);
        background: var(--sp-primary-soft);
    }

.sp-cal-cell-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.sp-cal-daynum {
    font-size: 15px;
    font-weight: 700;
    color: var(--sp-text);
    line-height: 1;
}

    .sp-cal-cell.is-out .sp-cal-daynum {
        color: var(--sp-text-muted);
        font-weight: 600;
    }

    .sp-cal-daynum.is-today {
        background: var(--sp-primary);
        color: #fff;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
    }

.sp-cal-monthtag {
    font-size: 11px;
    font-weight: 700;
    color: var(--sp-primary);
    letter-spacing: .03em;
}

.sp-cal-dow-label {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--sp-text-muted);
}

.sp-cal-events {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.sp-cal-event {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.25;
    color: var(--sp-text);
    min-width: 0;
}

    .sp-cal-event .sp-dot {
        flex: 0 0 auto;
    }

.sp-cal-event-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-cal-event-time {
    font-weight: 600;
    margin-right: 3px;
}

/* Status dots on chips and drawer task cards. */
.sp-dot.cal-gray  { background: #9ca3af; }
.sp-dot.cal-blue  { background: var(--sp-primary); }
.sp-dot.cal-green { background: var(--sp-done); }
.sp-dot.cal-red   { background: var(--sp-overdue); }

/* ----- Office calendar: day drawer task cards --------------------------- */
.sp-cal-task-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

    .sp-cal-task-head .sp-dot {
        margin-top: 6px;
        flex: 0 0 auto;
    }

.sp-cal-task-titles {
    min-width: 0;
}

.sp-cal-task-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--sp-border);
}

    .sp-cal-task-actions .sp-status-form {
        margin: 0;
    }

    .sp-cal-task-actions .sp-status-select {
        min-width: 130px;
    }

/* Keep the month grid readable as it narrows; restore per-cell borders once
   the shared .sp-week collapse (below) removes the unified grid outline. */
@media (max-width: 1100px) {
    .sp-cal-week .sp-cal-cell,
    .sp-cal-week + .sp-cal-week .sp-cal-cell {
        border: 1px solid var(--sp-border);
    }
}

/* ----- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
    .sp-board {
        grid-template-columns: 1fr;
    }
}

