```python
"""Fictional campaign proposal planner."""

__all__ = ["plan"]


def plan(rows, budget_cents, excluded_channels=()):
    """Select proposals by descending priority within the given budget.

    Args:
        rows: Iterable of mappings with ``id`` and ``cost_cents``, and
            optionally ``archived``, ``channel``, and ``priority``. For
            each ``id``, only its first occurrence is considered.
        budget_cents: Nonnegative integer budget in cents.
        excluded_channels: A list or tuple of channel names to exclude.
            Channel matching is normalized with ``strip().casefold()``.

    Returns:
        A dictionary with exactly ``selected_ids``, ``spent_cents``,
        and ``remaining_cents``.

    Raises:
        ValueError: If ``budget_cents`` is negative, is not an integer,
            or is a boolean.
    """
    if isinstance(budget_cents, bool) or not isinstance(budget_cents, int):
        raise ValueError("budget_cents must be an integer")
    if budget_cents < 0:
        raise ValueError("budget_cents must be nonnegative")

    normalized_excluded_channels = {
        channel.strip().casefold() for channel in excluded_channels
    }

    seen_ids = set()
    candidates = []

    for row in rows:
        row_id = row["id"]
        if row_id in seen_ids:
            continue
        seen_ids.add(row_id)

        if row.get("archived", False):
            continue

        channel = row.get("channel", "")
        if channel.strip().casefold() in normalized_excluded_channels:
            continue

        candidates.append(
            (row_id, row["cost_cents"], row.get("priority", 0))
        )

    candidates.sort(key=lambda candidate: -candidate[2])

    selected_ids = []
    spent_cents = 0
    remaining_cents = budget_cents

    for row_id, cost_cents, _priority in candidates:
        if cost_cents <= remaining_cents:
            selected_ids.append(row_id)
            spent_cents += cost_cents
            remaining_cents -= cost_cents

    return {
        "selected_ids": selected_ids,
        "spent_cents": spent_cents,
        "remaining_cents": remaining_cents,
    }
```