```
def _why_refused(cap, left: int, amount: int) -> str:
    if cap is None:
        return "unknown"
    if amount > cap[1]:
        return "single"
    return "cap" if amount > left else ""


def apply_charges(caps: dict, charges: list) -> dict:
    left = {name: cap[0] for name, cap in caps.items()}
    refused = []
    
    for charge_id, bucket, amount in charges:
        if amount <= 0 or not isinstance(amount, int):
            raise ValueError("Amount must be a positive whole number.")
        
        why_refused_reason = _why_refused(caps.get(bucket), left[bucket], amount)
        if why_refused_reason:
            refused.append((charge_id, why_refused_reason))
        else:
            left[bucket] -= amount
    
    return {"left": left, "refused": refused}
```