/* One selected employee: the whole month, not a one-row staff matrix. */
.schedule-month-layout {
  align-self: start;
  height: auto;
  max-height: 100%;
  container-type: inline-size;
  border: 1px solid var(--line);
  overscroll-behavior: contain;
}

.schedule-month-weekdays,
.schedule-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.schedule-month-weekdays {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-block: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  text-align: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.schedule-month-grid {
  /* Width-based squares, not viewport-height fractions. Content such as a
     break can make its week taller rather than spill onto the next date. */
  grid-auto-rows: minmax(76px, auto);
  grid-auto-rows: minmax(max(76px, calc(100cqw / 7)), auto);
}

.schedule-month-grid > :nth-child(7n) { border-right: 0; }

.schedule-month-padding {
  background: var(--surface-muted, #f8fafc);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-month-grid .schedule-month-day {
  position: relative;
  align-content: start;
  min-width: 0;
  min-height: 76px;
  gap: 0;
  padding: 8px 2px;
  font-variant-numeric: tabular-nums;
}

.schedule-month-grid .schedule-month-day.is-working { background: var(--primary-soft); }
.schedule-month-grid .schedule-month-day.is-off { background: #fff; }
.schedule-month-grid .schedule-month-day.is-current-day { border-top: 0; box-shadow: none; }
.schedule-month-grid .schedule-month-day.is-selected { box-shadow: inset 0 0 0 2px var(--primary); }

.schedule-month-grid .schedule-month-number {
  display: grid;
  width: 26px;
  min-height: 26px;
  place-items: center;
  margin: 0 0 5px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  line-height: 1;
}

.schedule-month-grid .is-today .schedule-month-number {
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
}

.schedule-month-grid .schedule-month-day em {
  max-width: 100%;
  padding: 2px;
  font-size: 9px;
  overflow-wrap: anywhere;
}

@media (hover: hover) {
  .schedule-month-grid .schedule-month-day:hover { background: #edfafa; }
}

@media (max-width: 760px) {
  .schedule-month-layout { border-radius: 0; border-inline: 0; }
  .schedule-month-grid {
    grid-auto-rows: minmax(64px, auto);
    grid-auto-rows: minmax(max(64px, calc(100cqw / 7)), auto);
  }
  .schedule-month-grid .schedule-month-day { min-height: 64px; padding: 4px 1px; }
  .schedule-month-grid .schedule-month-day strong,
  .schedule-month-grid .schedule-month-day > span:not(.schedule-month-number) { font-size: 11px; line-height: 1.2; }
  .schedule-month-grid .schedule-month-number { width: 20px; min-height: 20px; margin-bottom: 2px; }
}
