## ADDED Requirements ### Requirement: Portal includes an Analytics page The portal SHALL include a new page at `/analytics` accessible to authenticated tenant admins. The page SHALL render: a line chart (token issuance trend, last 30 days), an activity heatmap (agent activity by day/hour), and a per-agent usage table for the current month. All chart components SHALL be lazy-loaded via `next/dynamic`. #### Scenario: Analytics page is accessible to tenant admins - **WHEN** an authenticated tenant admin navigates to `/analytics` - **THEN** the page SHALL render without error and display the token trend chart #### Scenario: Analytics page redirects unauthenticated users - **WHEN** an unauthenticated user navigates to `/analytics` - **THEN** the portal SHALL redirect to the login page ### Requirement: Portal includes a Tier & Billing page The portal SHALL include a new page at `/settings/tier` accessible to authenticated tenant admins showing: current tier name, daily limits (agents, API calls, token issuances), current usage vs. limit, and an "Upgrade" button that initiates a Stripe checkout session for tenants not on the `enterprise` tier. #### Scenario: Free tier tenant sees upgrade prompt - **WHEN** a `free` tier tenant admin navigates to `/settings/tier` - **THEN** the page SHALL display current limits, current usage, and an enabled "Upgrade to Pro" button #### Scenario: Enterprise tier tenant sees no upgrade prompt - **WHEN** an `enterprise` tier tenant admin navigates to `/settings/tier` - **THEN** the page SHALL display "Enterprise — Unlimited" and SHALL NOT display an upgrade button #### Scenario: Upgrade button initiates Stripe checkout - **WHEN** a tenant admin clicks "Upgrade to Pro" on the tier page - **THEN** the portal SHALL call `POST /api/tiers/upgrade` and redirect to the returned Stripe checkout URL