# Pro Tools, Pilot Car Invoicing, Expense Tracking & Plan Strategy — Task Document

Source: "HeavyHaul Agent Pro Tools, Pilot Car Invoicing, Expense Tracking, and Plan Strategy" (implementation article, received 2026-09-12).
Related: `PILOT-MANAGEMENT-TASKS-2026-09-12.md` (pilot companies / drivers / assignments — Phase 1 replica done, backend pending).

Scope: everything the article marks as MVP or as a rule. Sections the article itself defers ("Fleet does not need to be fully built at first", "Future statuses", Fleet "can later") are listed under **Out of scope / future** and are not tasked.

## Client answers (2026-09-12)

1. **Phase: replica, as close to the real thing as possible.** Build it now inside the pilot car previews; the real backend comes later. Nothing that needs an external API connection, email validation, or usernames/accounts. So: no email provider, no account creation; data lives in the browser (preview store) until the backend phase.
2. **Plans are the same for every user type.** The existing membership plans in Billing (Free / Starter / Pro / Fleet) apply to pilot drivers and pilot companies too; a higher plan simply unlocks more abilities. No separate pilot plan store.
3. **Financial summary / expense export = a basic report for now:** an expense summary per trip showing what kinds of expenses that trip had. More detail later.
4. **Where the tools live:**
   - **Pilot driver:** in the **My Pilot Car** pane of the pilot driver interface — Create Invoice, Expenses, for the driver's own assignment.
   - **Pilot dispatch:** in the trip workspace, **section 3 (trip info, right side) gets a "My Pilot" tab** with all the pilot tools — invite/add another driver, generate the invoice on behalf of the driver, expenses.
   - **Carrier dispatch:** the same "My Pilot" tab in the carrier's trip workspace, **active only when a pilot car is attached to the trip**, placed **between People and History**. Shows which pilots are involved and for which states (e.g. who is on Arizona after the carrier opened access to a pilot driver who then added his pilot dispatch), the pilot's car, phone and contact information, the pilot dispatch, and **the invoices that pilot car generated for this trip**.
   - **Broker:** also sees the tab, but only pilot name, phone, email and what state the pilot was hired for — transparency on where a pilot was used. No invoices.

## Phase 1 replica — task list (built per the answers above)

### Task R1 — Rename Pilot → Starter and update plan copy (Tasks A1–A3)
Real change in `src/lib/demo/credits.ts` and the billing plan section: names, per-plan "includes" lists, the two-group tools positioning, Pro upgrade wording.

### Task R2 — Plan-aware locking in the replica (Tasks B1–B4)
The replica reads the same plan the Billing page uses (`CURRENT_PLAN`, Free for everyone today) and adds an **admin-only preview switch** on the pilot screens ("Owner's plan: Free / Starter / Pro / Fleet") so the locked and unlocked states can be reviewed. Owner = pilot company when the company manages the assignment, the driver when independent. Locked state renders exactly the §24 copy and buttons.

### Task R3 — Invoice generator replica (Tasks C1–C10)
Builder pre-filled from the assignment (demo data); miles / rate, days / daily rate, overnights / fee, custom line items (description, amount, notes), expenses marked include-on-invoice; live calculation with both totals shown and the "greater is used" explanation; Save Draft, Preview, Generate/Download PDF, Send; statuses Draft / Sent / Paid / Cancelled; invoice history for the owner; trip expense summary by category. Stored in the per-browser preview store.

### Task R4 — Expense tracking replica (Tasks D1–D3)
Add Expense with all fields and categories; receipt attach (file name kept, bytes not stored); billable / include-on-invoice flags; private by default; expense summary report per trip.

### Task R5 — Sending replica (Tasks E1–E4)
Recipient editor with the default To/CC, optional broker / custom / admin; "Send" marks Sent, records recipients and a log entry, and shows the email subject/body that would go out. No email leaves the app.

### Task R6 — "My Pilot" tab in the pilot trip workspace preview (dispatch)
Tools: assigned driver / unit, add or invite another driver (inherits access), Create Invoice on behalf of the driver, Expenses, invoice history for this assignment.

### Task R7 — "My Pilot" tab in the real carrier/broker trip workspace
Between People and History; only rendered when the trip has a pilot participant. Carrier sees pilots involved, their access/states (from the invitation's pilot-access record in trip History), car, phone, email, pilot dispatch, and this trip's pilot invoices. Broker sees name, phone, email, state hired for. See "Still to confirm" below for where the invoices in this tab come from while the backend does not exist.

## Current state (verified in codebase)

| Area | Today | Gap |
|---|---|---|
| Plans | Demo list in `src/lib/demo/credits.ts`: Free $0 (1 route, $1 credits), **Pilot** $9 (9 / $5), Pro $29 (29 / $15), Fleet $99 (99 / $50). Rendered only by `src/app/billing/billing-preview.tsx`. `CURRENT_PLAN = Free` for everyone; "no card is charged in this pilot build". | Rename Pilot → Starter; add business-tool messaging |
| Plan page copy | Says "Every plan includes the full platform… Upgrade only when you need more Express Routes and more AI Credits" and "All plans include the full HeavyHaul Agent platform" | Conflicts with Pro-only business tools (article §4, §7) — copy must change |
| Subscription per user / company | None. No plan column on `profiles`, `companies`, or the (not yet built) pilot profiles. Payments not connected. | Entitlement model needed for the permission rules |
| Invoices | Billing page has a placeholder "Invoices" section (platform purchases, "No invoices yet"). Nothing for pilot-to-carrier invoices. | Build |
| Expenses | Nothing | Build |
| PDF generation | No PDF library in `package.json`; nothing generates PDFs | Build / choose |
| Email sending | No provider wired (`src/lib/email-templates.ts` header: "Actual SENDING is the email backend (later)") | Needed for Send Invoice |
| Pilot assignment data | Phase 1 demo only (`src/lib/demo/pilot.ts`). Carrier Info on the pilot driver screen already shows carrier, dispatcher, driver, truck/trailer (VIN, plate), commodity, dimensions — the inputs the invoice pre-fills from. | Real assignment records are Phase 2 of the pilot work |
| Pilot company logo | Broker/carrier `companies.logo_url` exists; pilot company profile (Phase 1 demo) has no logo | Add when pilot company profile becomes real |
| Activity log | `trip_events` + `logTripEvent` | Add invoice send events |

---

## Module A — Plan Naming and Plan Messaging

### Task A1 — Rename the $9 plan from "Pilot" to "Starter"
- Change `name: 'Pilot'` to `'Starter'` in `src/lib/demo/credits.ts`. That is the only place the plan name is defined; the billing preview renders it from `PLANS`.
- Reason (article §2): "Pilot" now collides with pilot car users, pilot drivers, pilot companies and pilot assignments.
- Keep the four-plan structure and prices: Free $0, Starter $9, Pro $29, Fleet $99. Keep the existing AI Credit and Express Route credit logic unchanged (§38 "Keep the same general AI Credit and Express Route credit logic").
- Do not use "Pilot" as a plan name anywhere in the product.

### Task A2 — Plan page copy per plan (article §26–§29)
Update the plan cards / plan section on the billing page so each plan reads as below. Keep the existing per-plan route and credit numbers.

- **Free — $0/month.** "For trying HeavyHaul Agent and receiving shared trip access." Includes: basic account, shared trip access, limited AI Credits, limited Express Route access, basic profile, document upload when required, view assigned permits and routes when shared.
- **Starter — $9/month.** "For light individual usage." Includes: 9 Express Routes per month, monthly AI Credits, core trip tools, shared permit access, basic route tools, basic profile and history. **No invoice or expense tools in the first version.**
- **Pro — $29/month.** "For working users who need business tools." Includes: 29 Express Routes per month, monthly AI Credits, Trip Invoice Generator, Expense Tracking, PDF invoice export, send invoice by email, trip financial summary, custom invoice line items, receipt uploads.
- **Fleet — $99/month.** "For companies managing teams, drivers, vehicles, assignments, and reporting." Includes: 99 Express Routes per month, monthly AI Credits, company-wide tools, team management, company invoice dashboard, company expense reporting, driver/vehicle management, advanced permissions, document expiration alerts, advanced assignment board. (Messaging only — Fleet tools themselves are future, §29.)

### Task A3 — Replace the "every plan includes the full platform" positioning
Article §4 and §7 split tools into two groups; the current page copy contradicts that.
- **Core operational tools, available on every plan:** trip workspace, permit upload, shared permit viewing, basic route viewing if shared or purchased, AI questions using available credits, basic dashboard, pilot assignment access, driver/pilot invite flow, basic profile, basic document upload, trip history, basic contact information.
- **Business management tools, Pro or Fleet:** invoice generator, expense tracking, PDF invoice download, invoice email sending, invoice history, trip financial summary, company-wide financial reports, expense reports, driver invoice management, advanced dispatch tools, document expiration reminders, advanced reporting.
- Plan differences are: more included Express Routes, more AI Credits, more advanced business tools, more company/team capability on higher plans (§4).
- Upgrade messaging for Pro should sell the tools, not tokens (§6): "Upgrade to Pro to create invoices, track expenses, generate PDF invoices, and send them directly from the trip."

---

## Module B — Subscription Entitlement Rules

### Task B1 — Plan per owner: driver plan vs company plan
Article §23: personal tools follow the pilot driver's own plan; company-level tools follow the pilot company's plan. The system must know a plan for each independent pilot driver and for each pilot company. (Today nothing stores a plan; see Open Question 1 on whether this phase is demo or real.)

### Task B2 — Assignment ownership rule (article §22)
Every pilot assignment has one invoice owner:
- Accepted and managed by a pilot company → the **pilot company** is the owner.
- Accepted directly by an independent pilot driver → the **pilot driver** is the owner.
- Possible creators of the assignment (independent pilot driver, pilot company, carrier-created, broker-created) do not change this rule; ownership follows who accepted/manages it.

### Task B3 — Who may use invoice and expense tools (article §20, §35)
Invoice **and** expense tools are available when the **owner of the assignment has Pro or Fleet**. Enforce in the backend, not only in the UI.
- Pro independent pilot driver → can generate invoices for his own assignments.
- Free independent pilot driver → cannot.
- Starter independent pilot driver → cannot (MVP).
- Pro pilot company → can generate invoices for company assignments, **even if the assigned pilot driver is on Free**.
- Fleet pilot company → can generate invoices company-wide.
- Carrier → can receive invoices, cannot edit pilot invoices.
- Broker → does not automatically receive or view pilot invoices (see Task E3).
- Internal admin → can view invoices for support/audit "if allowed".
- Worked examples (§22): John (independent, Pro) → can invoice. John (independent, Free) → locked. ABC Pilot Company (Pro) → can invoice even with a Free driver. ABC (Free) → locked until the company upgrades.

### Task B4 — Locked tool UI for Free / Starter (article §24)
The invoice feature is **visible but locked**, never hidden.
- Button label: `Create Invoice - Pro Feature`
- Subtext: "Upgrade to Pro to create trip invoices, calculate mileage vs daily rate, add overnight fees, track expenses, and send professional invoices by email."
- Buttons: `Upgrade to Pro` · `Not Now`
- Same treatment for Expenses: Free/Starter can view basic assignment information but cannot create or manage expenses (§25).

---

## Module C — Trip Invoice Generator (Pro)

### Task C1 — Entry point
- On a pilot assignment (pilot driver or pilot company), a `Create Invoice` action (§8, §30). The invoice is tied to that trip / pilot assignment.
- Flow (§30): open assignment → Create Invoice → system checks subscription permission (Task B3) → if allowed, the invoice builder opens pre-filled → user enters billing inputs → system calculates → preview → save draft or send → PDF generated → emailed → status Sent.
- Must work on mobile (§30).
- Exact placement (pilot trip workspace, dispatch assignment detail, driver Active Assignment) — see Open Question 4.

### Task C2 — Pre-filled information (article §8, §31)
Pulled automatically when available:
- **Invoice From:** pilot driver or pilot company (per owner, Task B2). If the pilot company has a logo, include it; if independent, use the pilot driver's name and profile information (§17).
- **Invoice To:** carrier company, carrier dispatcher, carrier billing contact.
- **Trip details:** Trip ID, Assignment ID, states covered, permits covered, pickup and delivery (if visible to the pilot), service dates, pilot role, truck/driver reference if available, pilot driver name, pilot company name, driver contact, vehicle/unit used.
- The user enters the financial details manually.

### Task C3 — Billing inputs (article §9, §31)
Miles · rate per mile · number of days · daily rate · number of overnights · overnight fee · expenses (from Module D) · custom line items (Task C6).

### Task C4 — Calculation rules (article §9)
```
Mileage Total  = Miles × Rate Per Mile
Daily Total    = Number of Days × Daily Rate
Base Charge    = greater of Mileage Total and Daily Total
Overnight Total = Number of Overnights × Overnight Fee
Expense Total  = sum of expenses marked "include on invoice"
Invoice Total  = Base Charge + Overnight Total + Expense Total + Custom Line Items
```
Rule: never charge both mileage and daily rate as the base; calculate both and select the greater.
Worked example (§10): 420 mi × $1.75 = $735; 2 days × $600 = $1,200 → base $1,200 (daily); + 1 overnight × $150 → $1,350 before expenses.
Record `selected_base_type` (mileage / daily) and `selected_base_total`.

### Task C5 — Invoice display (article §10, §11, §31)
The invoice (builder output, preview and PDF) shows: mileage calculation, daily rate calculation, selected billing method, an explanation that the higher amount was used (example text: "Daily rate was selected because it is greater than the mileage total."), overnight fee, expenses, custom line items, final total. Calculation output block: mileage total, daily total, selected base amount, overnight total, expense total, custom total, invoice total.

### Task C6 — Custom line items (article §12)
MVP fields per line: **Description, Amount, Notes** only. Examples the user may type (not a fixed dropdown in MVP): flat rate, minimum charge, deadhead, detention, high pole fee, weekend fee, night movement fee, emergency service fee, route survey fee, cancellation fee, special escort fee, fuel surcharge, other.

### Task C7 — Invoice actions (article §15, §31)
`Save Draft` · `Preview Invoice / Preview PDF` · `Generate PDF` · `Send Invoice` · `Download PDF`.

### Task C8 — Invoice PDF content (article §17)
Professional and simple. Includes: invoice number, invoice date, due date, pilot driver or pilot company name, pilot contact information, carrier company, carrier dispatcher or billing contact, trip reference, assignment reference, states covered, permits covered, service dates, pilot role, mileage calculation, daily rate calculation, selected base amount, overnight fee, expenses, custom line items, total amount due, payment instructions, notes. Pilot company logo when one exists.
No PDF library exists today — choice needed (Open Question 6). Invoice number format, due-date default and the source of "payment instructions" are not specified (Open Questions 7–8).

### Task C9 — Invoice status (article §18)
MVP statuses: **Draft, Sent, Paid, Cancelled**. Data model must allow the future statuses (Viewed, Partially Paid, Overdue, Void, Disputed) without a redesign — do not build them now.
Status becomes Sent when the send completes (§30). `sent_at` / `paid_at` stored (§34).

### Task C10 — Invoice history and trip financial summary
Both are listed as Pro features (§5, §26). Invoice history = the owner's list of invoices with status. "Trip financial summary" is named but never defined in the article — Open Question 3.

---

## Module D — Expense Tracking (Pro)

### Task D1 — Add Expense on an assignment (article §13, §32)
Inside each trip / pilot assignment: `Expenses` → `Add Expense`. Fields: expense date, expense category, description, amount, receipt upload, notes, **Billable to customer: yes/no**, **Include on invoice: yes/no**. Saved to the assignment; can later be added to an invoice.
Categories: Fuel, Tolls, Hotel, Food, Vehicle maintenance, Tire repair, Equipment, Flags, Signs, Lights, Parking, Communication, Other.

### Task D2 — Receipts and privacy (article §14)
Receipts or photos can be attached to an expense (fuel, hotel, toll, repair, flat-tire invoice, flag purchase, equipment). **Default: expenses and receipts are private unless the user chooses to include them on the invoice.**

### Task D3 — Pro expense capabilities (article §25)
Pro users can: add expenses, attach receipts, mark expenses billable, include expenses on invoice, track trip costs, **export expense summary** (format not specified — Open Question 3). Free/Starter: view basic assignment info only; cannot create or manage expenses (locked UI per Task B4).

---

## Module E — Sending, Recipients, Broker Visibility, Email

### Task E1 — Recipients (article §15)
On send, generate the PDF and email it to the selected recipients. The user can edit recipients before sending.
- Default To: carrier dispatcher or carrier billing contact.
- Default CC: pilot driver; pilot company dispatcher, if connected.
- Optional: broker (only if selected and allowed — Task E3), custom billing email, internal admin only if needed.

### Task E2 — Invoice email (article §33)
Subject: `Invoice for Pilot Assignment - [Trip ID] - [Pilot Company/Driver Name]`.
Body includes: invoice PDF attachment, trip reference, assignment states/permits, amount due, payment instructions, contact information. Clear, professional, simple.
Requires a real email sender (none exists) — Open Question 2 in the pilot task document still applies.

### Task E3 — Broker visibility rule (article §16)
Default: pilot invoices are between the pilot / pilot company and the carrier. The broker does not automatically receive or view them. A broker may receive or view a pilot invoice only if: the broker arranged the pilot service, the broker is responsible for payment, the carrier or pilot chooses to include the broker, or trip settings allow broker invoice visibility. (Where "trip settings allow broker invoice visibility" lives is not defined — Open Question 5.)

### Task E4 — Log every send (article §35)
"All invoice send actions must be logged" — record who sent which invoice to whom and when (trip activity log / invoice recipient `sent_status`, `sent_at`).

---

## Module F — Backend Data Model and Permissions

### Task F1 — Invoice object (article §34)
`invoice_id, assignment_id, trip_id, created_by_user_id, owner_type (pilot_driver | pilot_company), owner_id, bill_to_company_id, bill_to_contact_email, status, invoice_number, invoice_date, due_date, miles, rate_per_mile, mileage_total, days, daily_rate, daily_total, selected_base_type (mileage | daily), selected_base_total, overnight_count, overnight_rate, overnight_total, expense_total, custom_total, invoice_total, pdf_file_key, sent_at, paid_at, created_at, updated_at`.

### Task F2 — Invoice line item object
`line_item_id, invoice_id, type (mileage | daily | overnight | expense | custom | discount), description, quantity, rate, amount, included, created_at`.
Note: the `discount` type exists in the data model; the article does not describe a discount input in the builder — do not add UI for it unless asked.

### Task F3 — Expense object
`expense_id, assignment_id, trip_id, created_by_user_id, owner_type, owner_id, category, description, amount, expense_date, receipt_file_key, billable, include_on_invoice, status, created_at`.
Receipt files: private storage (pattern of the private `trip-documents` bucket), signed URLs on read.

### Task F4 — Invoice recipient object
`invoice_recipient_id, invoice_id, recipient_type (carrier_dispatch | pilot_driver | pilot_company | broker | custom), email, name, sent_status, sent_at`.

### Task F5 — Backend permission enforcement (article §35)
Implement Task B3 as server-side checks on every invoice/expense read and write: Free cannot generate; Starter cannot (MVP); Pro for owned assignments; Fleet company-wide; Pro pilot company covers Free drivers; independent driver must be Pro; carrier read-only; broker not by default; admin view for support/audit if allowed; all send actions logged.

---

## Out of scope / future (named as such in the article)
- Fleet tools (§5, §23, §25, §29): company-wide invoice management and expense reporting, multiple dispatch users, team permissions, company billing controls, advanced assignment board, filter expenses by driver/vehicle, approve expenses, expense reports, document expiration reminders, advanced reporting. Only the **plan messaging** (Task A2) and a data model that can grow (Task C9) are in scope.
- Future invoice statuses: Viewed, Partially Paid, Overdue, Void, Disputed.
- Starter gaining invoice tools ("unless this is changed later").
- A full accounting platform (§12 explicitly avoids it).

---

## Answers, round two (2026-09-12) and what was built

- **PDF:** generating an invoice creates a real PDF file (client-side, `pdf-lib`); the pilot can view it and share it by email. **Done.**
- **Send:** enter recipients, hit Send → the system generates a templated email with a link to the invoice. The template is admin-managed ("Pilot Assignment Invoice" under Email Templates). Emails are not functional yet. **Done** (send marks the invoice Sent, records recipients and a log entry, shows the exact email; nothing leaves the app).
- **Carrier "My Pilot" tab invoices:** show demo invoices for the design review; admin can jump between the pilot, carrier and broker views. **Done** — the real workspace shows them to admins with a "design preview" note; customers see an empty state until the backend.
- **Due date:** optional, chosen per invoice: ASAP, 1, 3, 7, 14, 30, 60 days. **Done.**
- **Preferred payment method / memo** for the recipient: free text per invoice. **Done.**
- **Payment instructions:** free text, pre-filled from the last invoice. **Done.**
- **Broker:** never sees pilot invoices, except when the broker invited the pilot or the pilot invited the broker. **Done** (rule in `brokerCanSeePilotInvoices`).
- **Separate broker vs carrier trip views:** the "My Pilot" tab is role-specific (carrier: pilots, states, car, contacts, dispatch, invoices; broker: name, phone, email, state hired for). The broader split of the shared trip workspace into separate broker and carrier components was not part of this build — see the open item below.
- **Pilot driver Agent pane** (feedback during the build): reuses the carrier driver's ChatPanel in an offline replica mode — voice, languages, share-my-questions choice, starter questions, state selector limited to the shared states ("Whole trip" only with full-trip access). **Done.**
- **Invoice number (answered 2026-09-12):** "pilot and then invoice and then the trip number and then the date" → `PILOT-INV-<trip ref>-<YYYYMMDD>`, with `-2`, `-3` only when a second invoice is issued for the same trip on the same day. **Done.**
- **Free driver (answered 2026-09-12):** "a free driver should not see any invoices. Only a pro driver can see those things." → the driver's own plan must be Pro or Fleet to see the invoice/expense tools at all (locked state otherwise); the assignment owner's plan still decides who creates. **Done** (`driverCanSeeInvoices`; the driver pane has its own "your plan (driver)" preview switch).

- **Default recipient (2026-09-12):** the invoice's bill-to email and the first Send recipient default to **the person who invited the pilot** to the trip — carrier dispatcher, carrier driver, or broker. Both email fields drop down the trip's contacts (dispatcher, driver, broker when allowed) on click so a second recipient is one tap away. **Done** (`inviterOf`, `tripContactsOf`, `ContactEmailInput`; demo assignment HH-2050 is invited by the carrier driver).

**Where it lives:** `src/lib/domain/invoicing.ts` (rules), `src/lib/demo/invoicing-store.ts` (records), `src/lib/demo/invoice-pdf.ts` (PDF), `src/components/app/pilot-tools/*` (builder, expenses, locked state, My Pilot tab), `pilot-trip-workspace.tsx` (My Pilot tab; `?as=carrier|broker` previews), `trip-workspace.tsx` (real My Pilot tab between People and History when a pilot is on the trip), `pilot-driver-view.tsx` (My Pilot Car → Invoices & expenses; Agent pane), billing page (Starter rename, plan copy, tool groups), `email-templates.ts` (`pilot_invoice`). Tests: `tests/invoicing.test.ts`, `tests/pilot-render.test.tsx`.

**Open item:** should the shared trip workspace be split into separate broker and carrier components now (a refactor of `trip-workspace.tsx`), or is the role-specific "My Pilot" tab enough for this phase?

## Still to confirm (2026-09-12, after the answers) — superseded by the round-two answers above; kept for the record

- **PDF in the replica.** Generating a real PDF file client-side needs a small library (e.g. `pdf-lib` or `jspdf`) — a dependency, not an API. Alternative with no dependency: a print-styled invoice page and the browser's "Save as PDF". Which one?
- **Invoices in the carrier/broker "My Pilot" tab.** The real workspace has real pilot participants, but invoices only exist in the replica store keyed by demo assignments. Show demo invoices there for the design review, or an empty "invoices appear here" state until the backend?
- **Invoice number and due date** (old Q7): propose `INV-<year>-<sequence per owner>` and due date = invoice date + 30 days, both editable. OK?
- **Payment instructions** (old Q8): propose a text field on the pilot company / pilot driver profile, pre-filled into each invoice and editable per invoice. OK?
- **Free driver under a Pro company** (old Q9): can that driver see the invoices/expenses the company created for his assignment?
- **Broker invoice visibility setting** (old Q5): with the broker tab showing no invoices, is any "broker may see the invoice" option needed in the replica at all?

## Original open questions (kept for the record)

1. **Phase.** The pilot car work is currently an admin-only front-end replica on demo data with no subscriptions or payments. Should the invoice generator and expense tracking be built the same way first (replica inside the pilot dispatch / pilot driver previews, with a demo "current plan" switch to show locked vs unlocked), or does this article start the real backend (tables, PDF, email)?
2. **Plan storage.** For the permission rules, where does a pilot driver's plan and a pilot company's plan live — on the account (`profiles`) and on the pilot company record? And who sets it while payments are not connected (admin console)?
3. **Two undefined items.** (a) "Trip financial summary" is listed as a Pro feature but never described — what should it show? (b) "Export expense summary" — CSV, PDF, or something else?
4. **Where the buttons live.** "User opens pilot assignment → Create Invoice / Expenses." Should these appear in the pilot trip workspace (dispatch and driver), in the dispatch dashboard's assignment detail, on the driver's Active Assignment pane, or all of them?
5. **"Trip settings allow broker invoice visibility."** Where is that setting — per trip in the carrier workspace, or a company setting? (Same open point as the carrier settings question in the pilot task document.)
6. **PDF generation.** No PDF library exists. Any preference (server-side HTML-to-PDF, a JS PDF library), or should I pick?
7. **Invoice number and due date.** Format for `invoice_number` (per owner sequence? prefix?) and the default due date (e.g., net 30) are not specified.
8. **Payment instructions.** The PDF and email include "payment instructions" — should these come from a new field on the pilot driver / pilot company profile, be typed per invoice, or both?
9. **Free driver under a Pro company.** Can the Free-plan driver see the invoices and expenses the company created for his assignment, or are they company-only?

Follow-up (2026-09-13): carrier dispatch pilot paperwork (Pro or higher, open to everyone for now) — see `CARRIER-PRO-PILOT-PAPERWORK-TASKS-2026-09-13.md`. Carrier invoices stay visible regardless of plan.

Revision (2026-09-13): the **Fleet plan ($99) is replaced by Pro Plus ($59)** on the plan pages — the higher plan above Pro, not a team/company package. No shared routes, shared AI Credits or multi-user logic; GPS items are listed as future Pro Plus features only (rules to come later; nothing built). `PlanName` is now `'Free' | 'Starter' | 'Pro' | 'Pro Plus'`; every "Pro or Fleet" rule reads "Pro or Pro Plus".

Revision (2026-09-13, voice note): the **Pro card names the role for each tool** — "Brokers and carrier dispatchers: view pilot paperwork fully on your trips · Pilot companies and pilot drivers: generate invoices for your trips · Pilot drivers: track expenses for the trip · Carrier truck drivers: track expenses for the trip". Copy only. Open: (1) paperwork is also on Starter (Starter-or-higher rule, 90-day free window) — is "fully" on Pro a different level or should Starter drop it? (2) a carrier truck driver expense tracker does not exist yet (expenses are a pilot tool today) — build it as a replica in the Carrier Driver App?

Revision (2026-09-13, voice note — answers):
1. Pilot paperwork is **Starter or above** for everyone — "the files, the alerts, everything". The Pro card no longer carries a paperwork line; it reads "Everything included in Starter". Rule unchanged (`pilotPaperworkAccess`).
2. **Carrier truck drivers track trip expenses** — built: a "Trip expenses" card on the Carrier Driver App's Active Trip pane (`TripExpensesCard` in `src/app/ct-dashboard/driver-view.tsx`), the same `ExpenseTracker` as the pilot tools with `ownerType: 'carrier_driver'` (no "Include on invoice" controls — a driver has no invoice tool; expenses are private to the driver). Plan-gated on the driver's plan (Pro or Pro Plus); Free/Starter see the locked card with `EXPENSES_LOCKED_COPY`. Internal admins get the plan preview switch on the card. New dev preview `/dev-preview/ct/trip`. Verified on a 375-px viewport: locked on Free → Pro → add "Diesel, Flying J exit 110" $212.40 → listed with the per-trip total.
