.shift-assignment-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: #f7f8fc;
}

.card {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.08);
}

.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    align-items: center;
}

.title-area {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    justify-content: center;
}

.eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2563eb;
}

.title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
}

.month-row {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 36px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.toggle-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.month-row .title,
.month-row div {
    font-size: 1rem;
    font-weight: 700;
}

.month-row .rz-button {
    border-radius: 8px;
    background: #eef2ff;
    color: #1f2937;
}

.week-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    border-radius: 12px;
    background: #eef2ff;
    min-height: 36px;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-actions .rz-button {
    border-radius: 8px;
    background: #eef2ff;
    color: #1f2937;
}

.auto-plan-result {
    padding: 1rem;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.result-title {
    font-weight: 700;
    font-size: 1rem;
}

.result-sub {
    color: #475569;
    font-size: 0.9rem;
}

.plan-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.shift-grid {
    padding: 0.5rem;
    border-radius: 16px;
}

.grid-scroll {
    overflow-x: auto;
}

.shift-grid .jans-table {
    min-width: 0;
    color: #0f172a;
}

.shift-grid .jans-table-row {
    align-items: stretch;
}

.shift-grid .jans-table-cell {
    border-radius: 0;
    padding: 0.35rem 0.25rem;
    min-height: 2.2rem;
}

.shift-grid .jans-table-header .jans-table-cell {
    position: sticky;
    top: 0;
    background: #f8fafc;
    backdrop-filter: blur(4px);
    z-index: 2;
    font-weight: 700;
    text-transform: none;
}

.shift-grid[data-mode="week"] .day-col {
    display: none;
}

.week-calendar-wrap {
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

.week-calendar-header,
.week-calendar-row {
    display: flex;
    min-width: 980px;
}

.week-left-sticky {
    position: sticky;
    left: 0;
    z-index: 5;
}

.week-label-cell,
.week-row-label {
    flex: 0 0 220px;
    min-width: 220px;
    max-width: 220px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.65rem 0.75rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
}

.week-label-title,
.row-title {
    color: #0f172a;
    font-weight: 700;
    font-size: 0.9rem;
}

.week-label-sub,
.row-sub {
    color: #64748b;
    font-size: 0.76rem;
}

.week-day-header,
.week-cell {
    flex: 1 1 0;
    min-width: 108px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    background: #ffffff;
}

.week-day-header {
    padding: 0.55rem;
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f8fafc;
}

.day-header-top {
    color: #0f172a;
    font-weight: 700;
    font-size: 0.8rem;
}

.day-header-sub {
    color: #475569;
    font-size: 0.72rem;
}

.week-cell {
    min-height: 56px;
    padding: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.employee-cell {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.week-cell-muted {
    color: #94a3b8;
    font-size: 0.8rem;
}

.week-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.holiday-chip {
    background: #fef3c7;
    color: #92400e;
}

.event-chip {
    background: #dbeafe;
    color: #1d4ed8;
}

.recipe-chip {
    background: #dcfce7;
    color: #166534;
}

.open-shift-chip {
    background: #fee2e2;
    color: #b91c1c;
}

.done-chip {
    background: #d1fae5;
    color: #065f46;
}

.week-entry-card {
    width: 100%;
    border-radius: 10px;
    padding: 0.35rem 0.45rem;
    background: color-mix(in srgb, var(--entry-color) 22%, #ffffff);
    border-left: 4px solid var(--entry-color);
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.week-entry-role {
    color: #0f172a;
    font-size: 0.74rem;
    font-weight: 700;
}

.week-entry-time {
    color: #334155;
    font-size: 0.7rem;
    font-weight: 600;
}

.week-add-button {
    border: 1px dashed #94a3b8;
    background: #f8fafc;
    color: #475569;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
}

.week-add-button:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.shift-assignment-page .assignment-legend {
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1rem;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.shift-assignment-page .assignment-legend .legend-item {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem;
    color: #1f2937;
    font-size: 0.9rem;
    white-space: nowrap !important;
    flex: 0 0 auto;
}

.legend-swatch {
    width: 16px;
    height: 12px;
    border-radius: 4px;
    display: inline-flex;
    border: 1px solid #e5e7eb;
}

.today-swatch {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
    border-color: #cbd5f5;
}

.selection-swatch {
    background: #dbeafe;
    border-color: #2563eb;
}

.weekend-swatch {
    background: #f8fafc;
    border-color: #e5e7eb;
}

.holiday-swatch {
    background: #fde68a;
    border-color: #f59e0b;
}

.closed-swatch {
    background: #0f172a;
    border-color: #0f172a;
}

.shift-grid[data-mode="week"][data-week="0"] .week-0,
.shift-grid[data-mode="week"][data-week="1"] .week-1,
.shift-grid[data-mode="week"][data-week="2"] .week-2,
.shift-grid[data-mode="week"][data-week="3"] .week-3,
.shift-grid[data-mode="week"][data-week="4"] .week-4,
.shift-grid[data-mode="week"][data-week="5"] .week-5,
.shift-grid[data-mode="week"][data-week="6"] .week-6 {
    display: flex;
}

.employee-col {
    flex: 0 0 140px;
    min-width: 120px;
    background: #f8fafc;
    font-weight: 600;
    color: #0f172a;
}

.day-col {
    cursor: default;
    min-width: 0;
    flex: 1 1 0;
}

.day-col.hovered-day {
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px #93c5fd;
}

.day-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

.day-number {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.day-name {
    font-size: 0.75rem;
    color: #475569;
}

.day-month {
    display: none;
}

.day-col.weekend {
    background: #f8fafc;
    color: #1f2937;
}

.day-col.today {
    outline: 1px solid #cbd5f5;
    outline-offset: -1px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.02));
}

.day-col.holiday {
    background: #fffbeb;
    color: #92400e;
}

.day-col.closed-day {
    background: #0f172a;
    color: #e2e8f0;
}

.shift-assignment-table .jans-table-header-cell {
    padding: 0.4rem 0.5rem;
    text-transform: none;
    letter-spacing: 0;
    cursor: default;
}

.shift-assignment-table .jans-table-cell {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.shift-assignment-table .jans-table-row .day-col {
    padding: 0;
}

.shift-cell {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 1.6rem;
    align-items: center;
    justify-content: center;
    font-family: "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.shift-fill {
    width: 100%;
    height: 100%;
    min-height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.shift-initial {
    font-weight: 800;
}

.shift-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.35rem;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
    width: auto;
    color: #ffffff;
}

.shift-pill .pill-label {
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    font-family: "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.selected-cell {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}


.closed-slot {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.employee-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-plan-badge {
    margin-right: 0.5rem;
}

.auto-plan-badge:last-child {
    margin-right: 0;
}

.auto-plan-badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.auto-plan-status {
    background: #e0f2fe;
    color: #0369a1;
}

@media (max-width: 1200px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 1080px) {
    .employee-col {
        position: sticky;
        left: 0;
        z-index: 3;
    }

    .week-label-cell,
    .week-row-label {
        flex-basis: 170px;
        min-width: 170px;
        max-width: 170px;
    }

    .month-row {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    .month-row .title {
        width: 100%;
        text-align: center;
        font-size: 1.1rem;
    }
}

@media (max-width: 720px) {
    .shift-assignment-page {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .title {
        font-size: 1.2rem;
    }

    .action-buttons {
        width: 100%;
    }

    .week-day-header,
    .week-cell {
        min-width: 88px;
        padding: 0.25rem;
    }

    .week-calendar-header,
    .week-calendar-row {
        min-width: 820px;
    }
}
