@layer components {
/* Calendar/date-picker primitive for the widget redesign.
   Figma node 2131:9909. Availability is enabled vs disabled cells; no
   separate availability colors are baked into this primitive. */

.psw-calendar {
    --psw-calendar-cell-width: 49px;
    --psw-calendar-cell-height: 44px;
    --psw-calendar-selected-size: 44px;
    --psw-calendar-row-gap: var(--space-2); /* 8px */
    display: flex;
    flex-direction: column;
    gap: var(--psw-calendar-row-gap);
    width: 100%;
    color: var(--color-content-high);
    background: var(--color-white);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    overflow: hidden;
    box-sizing: border-box;
}
.psw-calendar--compact { --psw-calendar-cell-width: 49px; }
.psw-calendar--wide { --psw-calendar-cell-width: 91.143px; }

@media (max-width: 768px) {
    .psw-calendar {
        display: inline-flex;
        width: auto;
        --psw-calendar-cell-width: 49px;
    }
    .psw-calendar__weekdays,
    .psw-calendar__grid {
        grid-template-columns: repeat(7, var(--psw-calendar-cell-width));
    }
}

.psw-calendar__weekdays,
.psw-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(var(--psw-calendar-cell-width), 1fr));
}

.psw-calendar__weekday {
    display: grid;
    place-items: center;
    padding: 2px var(--space-2);
    font-size: var(--text-paragraph-sm);
    line-height: var(--text-paragraph-sm--line-height);
    font-weight: var(--font-weight-regular);
    color: var(--color-content-medium);
}

.psw-calendar__grid { row-gap: var(--psw-calendar-row-gap); }

.psw-date-cell {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 100%;
    height: var(--psw-calendar-cell-height);
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--color-content-high);
    background: var(--color-transparent);
    font-family: var(--font-sans);
    font-size: var(--text-label-md);
    line-height: var(--text-label-md--line-height);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: background-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}
.psw-date-cell__label {
    position: relative;
    z-index: 3;
}
.psw-date-cell:hover { background: var(--color-transparent); }
.psw-date-cell:not(:disabled):not(.psw-date-cell--disabled):not(.psw-date-cell--selected):not(.psw-date-cell--range-start):not(.psw-date-cell--range-end):not(.psw-date-cell--in-range):hover::before,
.psw-date-cell:not(:disabled):not(.psw-date-cell--disabled):not(.psw-date-cell--selected):not(.psw-date-cell--range-start):not(.psw-date-cell--range-end):not(.psw-date-cell--in-range):active::before,
.psw-date-cell--pressed:not(:disabled):not(.psw-date-cell--disabled):not(.psw-date-cell--selected):not(.psw-date-cell--range-start):not(.psw-date-cell--range-end):not(.psw-date-cell--in-range)::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    /* Defaults to the fixed circle; the date-picker's month/year grids override
       these to 100% so the fill becomes a full-cell pill (a 4-digit year or a
       month name doesn't fit the day-cell circle). */
    width: var(--psw-date-cell-fill-width, var(--psw-calendar-selected-size));
    height: var(--psw-date-cell-fill-height, var(--psw-calendar-selected-size));
    border-radius: var(--radius-max);
    background: color-mix(in srgb, var(--theme-primary, var(--theme-primary-default)) 12%, transparent);
    transform: translate(-50%, -50%);
    z-index: 1;
}
.psw-date-cell:not(:disabled):not(.psw-date-cell--disabled):not(.psw-date-cell--selected):not(.psw-date-cell--range-start):not(.psw-date-cell--range-end):not(.psw-date-cell--in-range):active::before,
.psw-date-cell--pressed:not(:disabled):not(.psw-date-cell--disabled):not(.psw-date-cell--selected):not(.psw-date-cell--range-start):not(.psw-date-cell--range-end):not(.psw-date-cell--in-range)::before {
    background: color-mix(in srgb, var(--theme-primary, var(--theme-primary-default)) 24%, transparent);
}
.psw-date-cell:focus-visible,
.psw-date-cell--focused {
    outline: none;
    box-shadow: inset 0 0 0 3px var(--theme-primary, var(--theme-primary-default));
    z-index: 4;
}
.psw-date-cell:active,
.psw-date-cell--pressed { background: var(--color-transparent); }

.psw-date-cell--selected,
.psw-date-cell--range-start,
.psw-date-cell--range-end {
    color: var(--color-content-inverse);
}
.psw-date-cell--selected::before,
.psw-date-cell--range-start::before,
.psw-date-cell--range-end::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    /* Defaults to the fixed circle; the date-picker's month/year grids override
       these to 100% so the fill becomes a full-cell pill (a 4-digit year or a
       month name doesn't fit the day-cell circle). */
    width: var(--psw-date-cell-fill-width, var(--psw-calendar-selected-size));
    height: var(--psw-date-cell-fill-height, var(--psw-calendar-selected-size));
    border-radius: var(--radius-max);
    background: var(--theme-primary, var(--theme-primary-default));
    transform: translate(-50%, -50%);
    z-index: 2;
}
.psw-date-cell--selected:hover { background: var(--color-transparent); }

.psw-date-cell--in-range,
.psw-date-cell--range-start,
.psw-date-cell--range-end { background: var(--color-transparent); }
.psw-date-cell--in-range::after,
.psw-date-cell--range-start::after,
.psw-date-cell--range-end::after {
    content: "";
    position: absolute;
    top: 50%;
    bottom: auto;
    left: 0;
    right: 0;
    height: var(--psw-calendar-selected-size);
    background: color-mix(in srgb, var(--theme-primary, var(--theme-primary-default)) 12%, transparent);
    transform: translateY(-50%);
    z-index: 1;
}
.psw-date-cell--range-start::after {
    left: 50%;
}
.psw-date-cell--range-end::after {
    right: 50%;
}
.psw-date-cell--range-row-start::after {
    left: 0;
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}
.psw-date-cell--range-row-end::after {
    right: 0;
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}
.psw-date-cell--range-start.psw-date-cell--range-row-start::after {
    left: 50%;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.psw-date-cell--range-end.psw-date-cell--range-row-end::after {
    right: 50%;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.psw-date-cell--in-range:hover,
.psw-date-cell--range-start:hover,
.psw-date-cell--range-end:hover { background: var(--color-transparent); }

.psw-date-cell:disabled,
.psw-date-cell--disabled {
    color: var(--color-gray-300);
    background: var(--color-transparent);
    cursor: not-allowed;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}
.psw-date-cell--outside {
    visibility: hidden;
}
.psw-date-cell:disabled:hover,
.psw-date-cell--disabled:hover { background: var(--color-transparent); }
}
