```python
def tier_cost(units: int, allowance: int, first_rate: int, later_rate: int) -> int:
    """Calculate the cost of a number of units in whole pence.

    Units are charged at a first rate up to an included allowance and
    at a second rate for everything beyond it.

    Args:
        units: The number of units to charge.
        allowance: The number of units charged at the first rate.
        first_rate: The cost in pence per unit for the first tier.
        later_rate: The cost in pence per unit for the second tier.

    Returns:
        The total cost in whole pence.

    Raises:
        ValueError: If units is negative.
    """
    if units < 0:
        raise ValueError("units must be non-negative")

    if allowance < 0:
        allowance = 0

    if units <= allowance:
        return units * first_rate

    return allowance * first_rate + (units - allowance) * later_rate
```

This implementation:
- Validates that `units` is non-negative (raises `ValueError` otherwise)
- Treats a negative `allowance` as 0 (no allowance applied)
- Uses a guard clause for the negative units check
- Uses a single-line formula for the cost calculation
- Handles all edge cases: empty input (0 units → 0 cost), single element, zero allowance, zero units, and boundary indices