# Billing Contact Management

## Objective

Send invoices to the people who pay, without giving them account access.

A list of billing recipients per account who receive invoices and payment notices but hold no login or permissions.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Model a billing contact as an email address on the account, not as a user. Adding one must never create a login, a seat, or any read access to the product.
2. Allow several recipients and let each be added or removed by an account admin, with a record of who changed the list.
3. Send invoices, receipts and payment-failure notices to every billing contact. Keep owner-critical notices — cancellation, ownership change, security events — going to the account owner regardless of this list.
4. Verify a new address before relying on it as the only recipient. Token mechanics are owned by Email Verification; reuse that flow rather than writing a second one.
5. Do NOT let this list be emptied. An account with no billing recipient silently stops receiving invoices, and the first anyone hears of it is a failed payment.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- A billing contact who is also a member must not have their product notification preferences changed by being added here.
- Marketing and product email opt-outs must not suppress invoices. Those preferences are owned by the Email Preference Center; transactional billing mail sits outside them.
- A bouncing billing address must be surfaced to an admin rather than retried forever. Bounce detection itself is owned by Notification Delivery Failures; consume its signal.
- Removing a contact stops future delivery only. Invoices already sent stay sent, and past invoices remain visible to admins.
- The same address may be a billing contact on several accounts. Verification and removal must be scoped per account, not globally.
- A departing employee's address often lingers as the only billing contact. Prompt for a replacement when the matching member is removed from the account.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] Adding a billing contact grants no login, seat, or data access.
- [ ] An account supports multiple billing contacts and records who added or removed each one.
- [ ] Invoices and payment notices reach every verified billing contact.
- [ ] Owner-critical notices still reach the account owner independently of this list.
- [ ] Marketing opt-out does not suppress billing mail.
- [ ] The system prevents an account from being left with no billing recipient, and flags bouncing addresses to an admin.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
