# Bella Mobile — email specification

How a Bella email is built, block by block: what the header does, how the title and
the customer's name are set, and what the footer and social row must contain.

This is the authority for anything Bella sends by email — customer mail and the admin
portal's staff mail alike. `DESIGN.md` governs the brand; this document governs how the
brand behaves inside an email client, where most modern CSS does not exist and every
style has to be inlined.

**The templates are generated.** Fourteen emails share one masthead, one footer and
one stylesheet, so they are built from a single declaration each rather than copied:

```sh
python3 tools/build_emails.py          # rebuild email/templates/
python3 tools/build_emails.py --check  # CI gate: fails if the committed output is stale
```

Edit copy in `email/src/content.py`. Edit layout in `tools/build_emails.py`. Never edit
a generated file — the next build overwrites it, and CI catches it first.

| Generated | What it's for |
|---|---|
| `email/templates/<slug>.html` | **What you send.** Keeps the Liquid tags OneSignal personalises |
| `email/templates/<slug>.txt` | The plain-text alternative. Every send needs one |
| `email/previews/<slug>.html` | Liquid resolved to its defaults, for looking at. Never sent |
| `js/email-manifest.js` | Drives the gallery on the brand site |

The build enforces what review otherwise misses: subject ≤ 45 characters, one primary
action per email, no unsubscribe on transactional mail, motion on lifecycle mail only,
and no animation start state in an inline `style`.

---

## 1. Anatomy

One white column. No header band, no card, no panel fills, no gradient, no shadow.
The hierarchy is made of three things: **scale, hairlines and air.**

```
    bella                          5 OCT 2026     logo left · context right
   ─────────────────────────────────────────      hairline

                                                  56px of air

    ● COMPLETED                                   eyebrow: status dot + 10/500 tracked

    $10.00                                        the one large thing: 48/600, -1.6px
    Airtime to +234 ••• ••• 5678                  supporting line, 16/400 grey

                                                  48px

    Your top-up is complete                       section heading, 20/600
    The airtime usually arrives within a          body, 16/1.7 grey
    minute. If it hasn't shown up after ten
    minutes, reply with your reference.

   ─────────────────────────────────────────      detail rows: hairline between,
    Recipient           +234 ••• ••• 5678         label left, value right
   ─────────────────────────────────────────
    Reference                   BM-7F3K92
   ─────────────────────────────────────────
    Total paid                     $10.00         the row that matters: 22/600
   ─────────────────────────────────────────

    ( View in the app )                           the only solid shape
    Top up again                                  underlined text link

   ─────────────────────────────────────────
    bella                                         footer
    Didn't make this top-up? Reply…
    ig  fb  in                                    bare glyphs, no circles
    Help centre / Privacy
    Bella Mobile · address
```

| | Value |
|---|---|
| Column | 600px, white, flush to a white canvas — no visible edge |
| Side margin | 48px, 24px at ≤620px |
| Hairline | 1px `border` `#D1D9E0` |
| Corners | None, anywhere, except the button's pill |
| Layout | `<table role="presentation">`, every style inlined |

**Why no card.** A white card on a grey canvas is a 2019 pattern, and it spends a
border, a radius and a shadow to say "this is an email" — which the reader already
knows. Removing it gives the type room to do the work, and it means nothing in the
design depends on a client honouring `border-radius` or `box-shadow`. Outlook
renders this layout identically to Apple Mail.

---

## 2. Masthead

The logo **is** the brand moment. There is no navy band.

| Element | Spec |
|---|---|
| **Logo** | `bella-logo-navy@2x.png`, 84×37, left. White version in dark mode. **PNG, never SVG** — Gmail and Outlook don't render SVG |
| **Context** | Optional, right. 10/500, +1.2px tracking, uppercase, grey. A date or a short fact — never a sentence |
| **Hairline** | 28px below, full column width |

`DESIGN.md` §3 reserves brand navy for one moment per piece. Here that moment is
the mark itself, at 84px. A filled navy band would spend the brand on decoration.

---

## 3. The one large thing

Every email has **exactly one** large statement, directly under the eyebrow.

### Eyebrow

`● COMPLETED` — 10/500, +1.6px tracking, uppercase, grey.

The dot is 14px, set in the status colour, and it is **the only colour in the
entire message**. That is `DESIGN.md` §1 kept honestly: colour means something, it
is never decoration. A status pill would be a filled shape saying what one dot and
a word already say.

| Status | Dot |
|---|---|
| Completed, verified, ready | `success` `#1A7F37` |
| Pending, warning, deactivated | `attention` `#9A6700` |
| Failed, declined | `danger` `#D1242F` |
| Promo, referral | `done` `#8250DF` |
| Informational | `link` `#0969DA` |

An email with no status uses a plain eyebrow and no dot — `SIGN IN`, `WELCOME`.

### Figure or headline — never both

| | Size | For |
|---|---|---|
| **Figure** | 48/600, −1.6px tracking, tabular | Anything with a number at its centre: receipts, rewards, shortfalls |
| **Headline** | 40/600, −1.1px tracking | Everything else |

On phones they drop to 40 and 32. Money leads with the figure and never with a
greeting: `$10.00` tells the reader more, faster, than "Hi Ada".

### Section heading

One size down, and by a lot: **20/600**, with 48px of air above it. It names what
the body is about. A number and a sentence don't compete, so a receipt carries both
the figure and this heading; an email led by a headline carries only the heading
beneath it.

---

## 4. Customer name

```
{{ first_name | default: 'there' }}
```

**The `default:` is mandatory.** A blank greeting reads as broken — "Hi ," is worse
than no greeting at all.

| Group | Where the name goes |
|---|---|
| **Lifecycle** | The supporting line under the headline: "Hi Ada — calls, airtime and eSIM data, all in one app." |
| **Account & access** | In the body, if at all |
| **Money** | **Never.** The figure is the opening |
| **Admin portal** | Depends on whether the account exists yet. `admin-invite` has no profile to draw on, so it names the **inviter** — "Ada Obi invited you…", which is what stops an invitation reading as phishing. `admin-password-reset` greets the holder by name in the supporting line |

`firstName` is derived on the client as the first whitespace token of `name`
(`bella-mobile-app/lib/core/user/user.dart`). It may be a single word that isn't a
first name, may be any case the person typed, and may be empty. So: **never put the
name in a subject line**, and never write a sentence that breaks if the name is
odd. "Hi Ada — …" survives anything; "Ada's October summary" does not.

Phone numbers are always masked: `+234 ••• ••• 5678`.

---

## 5. Detail rows

Facts are set as hairline-separated lines, not as a bordered box with a fill.

- Label left, 14/400 grey. Value right, 14/500 near-black.
- A 1px rule between rows, and one above the first.
- The row that matters — the total — is set at **16/500 label, 22/600 value**, so
  the number you actually care about carries the weight.
- Values are right-aligned in their own column, which is what makes the decimal
  points line up. `font-variant-numeric: tabular-nums` is declared, but Gmail and
  Outlook ignore it, so the alignment is structural rather than typographic.

Feature rows (icon, title, copy) use the same hairline rhythm: a 20px icon in its
own 28px column, no circle behind it.

---

## 6. Actions

**One solid shape in the whole email.** A near-black pill, 16/500, 16×34 padding.
Anything secondary is an underlined text link beneath it, never a second button.

One primary action per email — enforced by the build.

---

## 7. Footer

Hairline, then, in order:

1. **Wordmark**, 62×27, navy — white in dark mode.
2. **Help line** — one sentence, specific to this email.
3. **Social row** — see §8.
4. **Links** — `Help centre / Privacy`, and `Unsubscribe` on lifecycle only.
5. **Legal** — why this email arrived, and the postal address.

### The one variation: unsubscribe

| Kind | Links | Rule |
|---|---|---|
| **Transactional** | Help centre / Privacy | **No unsubscribe.** You can't opt out of a receipt or a sign-in link |
| **Lifecycle** | Help centre / Privacy / Unsubscribe | **Required** |

`[unsubscribe_url]` is a OneSignal macro and must stay unescaped. The build decides
this from the template's `kind`; it is not a per-email judgement call. A postal
address is legally required in marketing email, so it appears in every footer.

---

## 8. Social media links

**Instagram, Facebook, LinkedIn — in that order, always.** Generated from one list;
not a per-template choice.

| | Spec |
|---|---|
| Form | **Bare glyphs. No circle, no border, no fill** |
| Size | 18px, 14px apart, left-aligned under the help line |
| Colour | `icon` grey `#59636E`; `#9198A1` in dark mode, swapped via `.light-img` / `.dark-img` |
| Files | `assets/icons/png/<network>-{light,dark}@3x.png` — PNG, never SVG |
| `alt` | The network name. Never empty — images are off by default in many clients |

The bordered circles are gone for the same reason the card is: they are a container
drawn around something that didn't need one, and they forced a second set of colour
rules to stay visible in dark mode. Two tones of a bare glyph solve it outright.

---

## 9. Motion

> **The inline style attribute is always the final state. Animation only adds an intro.**

```css
@media (prefers-reduced-motion: no-preference) {
  .rise   { animation: rise .55s cubic-bezier(.22,.7,.3,1) both; }
  .rise-1 { animation: rise .55s cubic-bezier(.22,.7,.3,1) .06s both; }
  .rise-2 { animation: rise .55s cubic-bezier(.22,.7,.3,1) .12s both; }
}
```

- **One effect**: the eyebrow, the large statement and its supporting line rise and
  fade in, staggered 60ms apart. Nothing loops, nothing pulses.
- **Gated on `no-preference`**, not a `reduce` override — a client that doesn't
  support the media feature never matches, so it never animates.
- **`both` fill mode is mandatory.** Without it a client that parses `animation` but
  drops `@keyframes` can strand an element at `opacity: 0` forever.
- **No animation start state may appear in an inline `style`.** The build fails if
  one does. That single check is what guarantees the static version is always the
  finished composition.
- **Lifecycle only.** A sign-in link or a failed payment that animates reads as
  marketing. The build rejects `motion=True` on a transactional template.

---

## 10. Dark mode

Class-based overrides under `@media (prefers-color-scheme: dark)`: canvas and column
to `#0D1117`, headings to `#F0F6FC`, body to `#9198A1`, hairlines to `#3D444D`, the
button inverting to a light fill with dark text, and both logos and icons swapping
to their light variants.

Apple Mail and some Outlook versions honour it. Gmail applies its own inversion
regardless, which this design survives because there is no coloured band to fight
with — a white column inverts cleanly to a dark one.

---

## 11. Type

Host Grotesk with a Helvetica/Arial fallback — iOS Mail loads the webfont, Gmail
and Outlook substitute, and the layout is built to survive it.

| Role | Size / weight | Tracking | Line height |
|---|---|---|---|
| Figure | 48 / 600 (40 on phones) | −1.6px | 1.05 |
| Headline | 40 / 600 (32 on phones) | −1.1px | 1.1 |
| Section heading | 20 / 600 | −0.2px | 1.35 |
| Lede | 18 / 400 (17 on phones) | — | 1.55 |
| Body | 16 / 400 | — | **1.7** |
| Row value, total | 14 / 500, 22 / 600 | — | 1.4 |
| Eyebrow | 10 / 500 | +1.6px | 1.4 |
| Footer, legal | 12 / 400 | — | 1.7 |

Body leading is 1.7 rather than the app's 1.4. An email is read once, in a crowded
inbox, usually on a phone — it needs more air than a screen the reader can scroll
back through.

---

## 12. Icons

Exported from the app's own SVGs by `tools/render_email_icons.py` — PNG at 3×, in
two tones (`-light` `#59636E`, `-dark` `#9198A1`), transparent ground, used bare.

| Icon | Source |
|---|---|
| `call`, `airtime`, `esim` | `nav/call_outline.svg`, `shared/icons/wallet.svg`, `nav/esim_outline.svg` |
| `phone`, `delete`, `refer`, `people` | `account/icons/…`, `home/user_group.svg` |
| `instagram`, `facebook`, `linkedin` | this repo's `assets/social/` |

Adding one is a line in `ICONS` plus a re-run. **Pick a line icon, not a decorative
graphic** — the renderer rejects anything that comes out under 200/255 peak alpha,
because app illustrations often have opacity baked in and would ship as a smudge.

---

## 13. Content rules

- **Subject ≤ 45 characters**, saying what happened: "Your top-up is complete".
  Enforced by the build.
- **Preheader** adds the detail the subject couldn't carry — amount, masked number,
  expiry. It is hidden in the body and is what most clients show in the inbox list.
- **One headline per email.**
- **Money is exact**: amount, fee and total, currency symbol first, two decimals.
- **Mask phone numbers.** Never a full card number — last four digits only.
- **Errors say what went wrong and what to do.** Never a code, never a stack trace.
  "Payment didn't go through. Check your card details and try again."
- **No exclamation marks** in errors or money flows.
- Spelling: "eSIM", "top-up" (noun), "top up" (verb), "Bella Mobile".

---

## 14. The templates

Fourteen emails in four groups. **Readiness** records whether the thing that would send
the email actually exists — the design is ready in every case; the plumbing is not.

| Status | Meaning |
|---|---|
| **LIVE** | The trigger exists in the app today |
| **STUBBED** | The flow is built but the call is a `TODO` |
| **NET-NEW** | The data exists, but nothing detects the event |
| **PARTIAL** | The feature exists; the figures behind it are mock data |

### Account & access — sober, no motion, no unsubscribe

| Template | Subject | Trigger | Status |
|---|---|---|---|
| `magic-link` | Your Bella sign-in link | magic link requested | **STUBBED** |
| `phone-verified` | Your number is verified | `PUT /users/me/phone-numbers/{id}/verification` | LIVE |
| `new-device` | New sign-in to your account | unrecognised device fingerprint | **NET-NEW** |
| `account-deleted` | Your account has been deleted | deletion confirmed | **STUBBED** |
| `account-deactivated` | Your account is deactivated | deactivation confirmed | **STUBBED** |

### Money — lead with the figure, exact amounts, no motion

| Template | Subject | Trigger | Status |
|---|---|---|---|
| `topup-receipt` | Your top-up is complete | Stripe webhook on `POST /payments/{provider}` | LIVE |
| `payment-failed` | Your payment didn't go through | Stripe decline | LIVE |
| `insufficient-credit` | Not enough credit for that eSIM | `422` on `POST /esim/packages/{id}/orders` | LIVE |
| `call-receipt` | Your call summary | call settled | LIVE |

### Lifecycle — motion allowed, unsubscribe required

| Template | Subject | Trigger | Status |
|---|---|---|---|
| `welcome` | Welcome to Bella | registration completes | LIVE |
| `referral-reward` | You earned $10 credit | referred user's first top-up | **PARTIAL** |
| `win-back` | Your people are waiting | dormancy window elapsed | **NET-NEW** |

### Admin portal — staff mail, sober, no motion, no unsubscribe

| Template | Subject | Trigger | Status |
|---|---|---|---|
| `admin-invite` | You're invited to Bella Admin | an admin sends a portal invitation | LIVE |
| `admin-password-reset` | Reset your Bella Admin password | a portal user requests a password reset | LIVE |

Each template's full readiness note — the source file, the payload fields and what
exactly is missing — is in its `Readiness(...)` block in `email/src/content.py`.

**A note on scope.** The **customer product is passwordless**: authentication is
Google, Apple or magic link (`AuthenticationMethod`), so there is no password-reset
or password-change email for a customer, and there cannot be one — the magic link
email does that job. The **admin portal is a separate staff surface** and it does use
passwords, which is why it is its own group rather than a sixth Account & access
template: `admin-invite` and `admin-password-reset` are the only password emails in
the system, and neither is ever sent to a customer. There is likewise no refund flow in the product, so there is no
refund email.

---

## 15. Placeholders

Replace every one of these before sending. `tools/check_links.py` treats ALL-CAPS
tokens as placeholders and will not flag them as broken links.

| Placeholder | Value |
|---|---|
| `../../assets/...` | Image paths → **hosted URLs on your own domain or CDN.** Email clients will not load a relative path |
| `APP_URL` | Deep link or store link that opens the app |
| `MAGIC_LINK_URL` | The one-time sign-in link. Per-send, never cached |
| `SET_PASSWORD_URL` | The one-time set-password link in the admin invite. Per-send, never cached |
| `RESET_PASSWORD_URL` | The one-time password-reset link for an admin portal user. Per-send, never cached |
| `TOPUP_URL`, `ESIM_URL`, `RATES_URL`, `REFERRAL_URL`, `SECURITY_URL` | Destination pages |
| `VIEW_IN_BROWSER_URL` | Hosted web version of the email |
| `HELP_URL`, `PRIVACY_URL` | Help centre and privacy policy |
| `COMPANY_ADDRESS` | Postal address — legally required |
| `[unsubscribe_url]` | OneSignal macro. Must stay unescaped. Lifecycle only |

Liquid values (`{{ amount }}`, `{{ first_name }}`, …) come from the subscription's
properties or per-send `custom_data`. **Every one carries a `default:`.**

---

## 16. Sending

Templates go into OneSignal's **code** editor — not the drag-and-drop editor, which
rewrites the markup.

- Paste the `.html` into the code editor and the matching `.txt` into the plain-text
  body. Without a `text/plain` part, spam filters score the message worse.
- Subject and preheader are set on the OneSignal template, not in the HTML. The
  `<title>` and the hidden preheader `div` are there for local preview — keep the div,
  it is what the inbox list shows.
- Personalization is Liquid against subscription properties:
  `{{ first_name | default: 'there' }}`. Per-send values use
  `{{ message.custom_data.<field> }}` with `custom_data` set on the request.
- **Send from the backend, not the app** — `POST /notifications` with `template_id` and
  `include_aliases: {external_id: [...]}` — so the email still fires if the app is
  killed mid-flow.

### Before the first send

- **iOS Mail** — webfont loads, the rise animation runs, tracking looks right.
- **Gmail web and the Gmail app** — substitutes Arial, applies its own dark-mode
  inversion, strips the motion. Check the large figure is visible and not stranded
  at opacity 0, and that the hairlines survive.
- **Outlook desktop** — no radius on the button is the only visible difference;
  there is no band, card or gradient left for it to break.
- **Dark mode** in Apple Mail — logos and the social glyphs swap to their light
  variants, hairlines lighten.

Known and accepted: Outlook squares the button; Gmail ignores
`font-variant-numeric`, which is why column alignment is structural.

---

## 17. Related

- `DESIGN.md` — the brand system. §3 colour (including the email extension), §4 type,
  §9 voice, §10 channel rules.
- `email/README.md` — how to build and send, in short.
- `email/src/content.py` — the copy and data for all fourteen emails.
- `tools/build_emails.py` — the renderer, and the rules it enforces.
- `assets/README.md` — logo and icon files.

This repo is authoritative for the email system. A stale copy exists at
`bella-mobile-app/design-system/email/` from before this was split into its own
repository; do not edit that one.
