.calendar-overview-page {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0 0.85rem 0.85rem 0.85rem;
    background: #f7f8fc;
    overflow: visible;
}

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

.calendar-overview-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.8rem;
    position: relative;
    overflow: visible;
    z-index: 20;
}

.calendar-ribbon-card {
    padding: 0.8rem;
}

.calendar-toolbar-top {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.calendar-overview-toolbar .toolbar-left {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    position: relative;
    overflow: visible;
}

.calendar-overview-toolbar .toolbar-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.15rem 0;
}

.calendar-overview-toolbar .toolbar-title-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
}

.calendar-overview-toolbar .toolbar-title {
    font-weight: 700;
    color: #0f172a;
    font-size: 1rem;
}

.calendar-overview-toolbar .toolbar-title-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.calendar-overview-toolbar .toolbar-title-badge,
.calendar-overview-toolbar .toolbar-title-selected {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}

.calendar-overview-toolbar .toolbar-title-badge {
    background: #dbeafe;
    color: #1d4ed8;
}

.calendar-overview-toolbar .toolbar-title-selected {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.calendar-overview-toolbar .toolbar-ribbon-wrap {
    min-width: 0;
}

.calendar-ribbon-card .toolbar-ribbon-wrap .ribbon-control {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: none;
}

.calendar-date-search-trigger {
    position: relative;
    overflow: visible;
    z-index: 30;
}

.calendar-date-search-popup {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    z-index: 2000;
    width: fit-content;
    min-width: 320px;
    max-width: none;
    padding: 0.4rem;
    overflow: visible;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.calendar-date-search-popup .rz-datepicker-inline {
    border: none;
    width: max-content;
}

.calendar-overview-shell {
    padding: 0.45rem;
}

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

.calendar-header-row,
.calendar-row {
    display: flex;
    align-items: stretch;
}

.left-sticky {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #ffffff;
}

.header-left-cell,
.row-label-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.08rem;
    flex: 0 0 200px;
    min-width: 200px;
    max-width: 200px;
    padding: 0.5rem 0.65rem;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    align-self: stretch;
}

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

.header-sub,
.row-sub {
    font-size: 0.72rem;
    color: #64748b;
}

.day-header-cell,
.calendar-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    flex: 1 1 0;
    min-width: 0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.35rem;
    background: #ffffff;
    box-sizing: border-box;
}

.calendar-header-row > .day-header-cell,
.calendar-row > .calendar-cell {
    flex: 1 0 0%;
    width: auto;
    min-width: 0;
}

.day-header-cell {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f8fafc;
    cursor: pointer;
}

.day-header-cell .day-name {
    font-size: 0.74rem;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.02em;
}

.day-header-cell .day-date {
    font-size: 0.82rem;
    color: #0f172a;
    font-weight: 700;
}

.day-header-cell .day-summary {
    font-size: 0.69rem;
    color: #334155;
}

.day-header-cell.today,
.calendar-cell.today {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
}

.day-header-cell.weekend,
.calendar-cell.weekend {
    background: #f8fafc;
}

.day-header-cell.holiday,
.calendar-cell.holiday {
    box-shadow: inset 0 0 0 1px #f59e0b;
}

.day-header-cell.selected-day {
    box-shadow: inset 0 0 0 2px #2563eb;
}

.calendar-cell {
    min-height: 56px;
    align-items: flex-start;
    justify-content: flex-start;
    position: relative;
}

.calendar-cell.selected-row-cell {
    box-shadow: none;
}

.calendar-cell.selected-row-cell::after {
    content: "";
    position: absolute;
    inset: 2px;
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.18);
    border-radius: 8px;
    pointer-events: none;
    z-index: 3;
}

.entry-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.16rem 0.42rem;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    border: none;
    cursor: pointer;
    text-align: left;
}

.entry-chip-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.entry-chip-wrap .entry-chip {
    flex: 1 1 auto;
}

.entry-chip-calc {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border: 1px solid #fb923c;
    border-radius: 999px;
    background: #ffedd5;
    color: #c2410c;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

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

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

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

.chip-menu-card {
    background: #fef9c3;
    color: #854d0e;
}

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

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

.entry-muted {
    font-size: 0.74rem;
    color: #94a3b8;
}

.employee-cell {
    cursor: context-menu;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    gap: 0;
    align-self: stretch;
    flex: 1 0 0%;
    width: auto;
    max-width: none;
    overflow: hidden;
    position: relative;
}

.calendar-cell.employee-cell > *:not(.cell-plus) {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.calendar-row.employee-row .row-label-cell.employee-label {
    height: auto;
    min-height: 100%;
}

.calendar-row.employee-row .calendar-cell.employee-cell {
    height: auto;
    min-height: 100%;
}

.shift-entry-card {
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    align-self: stretch;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.12rem;
    padding: 0.35rem 0.4rem;
    border-radius: 0;
    border: none;
    background: color-mix(in srgb, var(--shift-color) 28%, #ffffff);
}

.calendar-row.employee-row .calendar-cell.employee-cell {
    padding: 0 !important;
}

.shift-role {
    font-size: 0.72rem;
    color: #0f172a;
    font-weight: 700;
}

.shift-time {
    font-size: 0.68rem;
    color: #334155;
}

.shift-trade-badge {
    margin-top: 0.1rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: #1d4ed8;
}

.shift-extra-count {
    margin-top: 0.08rem;
    font-size: 0.62rem;
    color: #475569;
}

.category-plus {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}

.cell-plus {
    border: 1px dashed #94a3b8;
    background: #f8fafc;
    border-radius: 999px;
    width: 24px;
    height: 24px;
    color: #475569;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
}

.employee-cell .cell-plus {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    align-self: auto;
    z-index: 4;
}

.calendar-day-detail {
    padding: 0.8rem;
}

.detail-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.65rem;
}

.detail-title {
    font-weight: 700;
    color: #0f172a;
}

.detail-sub {
    font-size: 0.78rem;
    color: #64748b;
}

.detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
}

.detail-block {
    flex: 1 1 220px;
    min-width: 220px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.55rem;
    background: #f8fafc;
}

.detail-block-title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.3rem;
    font-size: 0.84rem;
}

.detail-entry {
    font-size: 0.76rem;
    color: #334155;
    margin-bottom: 0.2rem;
}

.detail-empty {
    font-size: 0.75rem;
    color: #94a3b8;
}

.detail-shifts {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.55rem;
}

.detail-shift-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.76rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.detail-shift-row:last-child {
    border-bottom: none;
}

.detail-shift-user {
    color: #0f172a;
    font-weight: 700;
}

.detail-shift-role {
    color: #1d4ed8;
    font-weight: 700;
}

.detail-shift-time {
    color: #475569;
}

@media (min-width: 980px) {
    .calendar-overview-page {
        padding: 0 1rem 1rem 1rem;
    }

    .calendar-overview-toolbar {
        padding: 1rem;
    }

    .calendar-ribbon-card {
        padding: 1rem;
    }

    .calendar-toolbar-top {
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
    }

    .calendar-overview-toolbar .toolbar-title-wrap {
        flex: 1 1 auto;
        min-width: 240px;
    }
}

@media (max-width: 720px) {
    .header-left-cell,
    .row-label-cell {
        flex-basis: 160px;
        min-width: 160px;
        max-width: 160px;
    }

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

    .calendar-overview-toolbar .toolbar-left .rz-button {
        flex: 1 1 calc(50% - 0.45rem);
    }

    .calendar-overview-toolbar .toolbar-title-selected {
        width: 100%;
        justify-content: center;
    }

    .calendar-ribbon-card {
        padding: 0.75rem;
    }
}
