Skip to content

Design system: warning-semantic variants for .cf-card / .cf-inset / .btn (unlayered background/border always beats a --color-warning utility) #2208

Open

Description

@AwsomeFox

Split from #2161 / #1533, found during PR #2203's review.

Context

--color-warning: #d97706 was defined in #1533. #2161's PR (#2203) migrated 16 raw amber-* Tailwind call sites onto it. Review (Codex, then confirmed and extended by measurement) found that 4 of those 16 sites are cascade no-ops: the source correctly writes border-[var(--color-warning)]/N / bg-[var(--color-warning)]/N, but the browser never paints it, because apps/web/src/index.css and apps/web/src/nocturne.css are imported unlayered, while Tailwind utilities — including arbitrary-value ones — live inside @layer utilities. An unlayered background/border shorthand always wins over a layered declaration regardless of specificity or source order (the same mechanism that made .hr look dead and nocturne's .btn padding look alive elsewhere in this backlog).

All four sites were reverted to raw amber in #2203 rather than shipped as source that claims --color-warning while painting something else. This issue tracks the actual fix.

Measured evidence (real Chromium getComputedStyle against the compiled theme, not source inspection)

Site Computed border Computed background Root cause
apps/web/src/features/admin/CampaignAuditPage.tsx:294 rgba(233,233,237,.16) = --color-divider rgb(35,37,50) = --cf-card Renders through <Card> (apps/web/src/components/ui.tsx), whose cf-card class carries an unlayered background: var(--cf-card); border: 1px solid var(--color-divider); (index.css:1254-1257)
apps/web/src/features/admin/MembersPage.tsx:483 rgba(233,233,237,.16) = --color-divider n/a (no bg utility) Carries cf-inset, unlayered background: var(--cf-surface); border: 1px solid var(--color-divider); (index.css:1289-1292)
apps/web/src/features/notes/InboxPage.tsx:700 rgba(233,233,237,.16) = --color-divider n/a (no bg utility) Same cf-inset rule
apps/web/src/features/encounters/SpellbookPanel.tsx:484 (untouched, accent-colored — not part of this) rgba(0,0,0,0) fully transparent Carries .btn, unlayered background: 0 0; border: 1px solid #0000; (nocturne.css) resets it before .btn-primary applies anything; :hover/:active paint an unrelated accent-tinted color-mix() overlay instead, both before and after any warning-token change

For each site, rendering the bare utility class alone (no Card/cf-inset/.btn wrapper) against the same backdrop confirmed it does resolve to --color-warning — the bug is the unlayered wrapper rule, not the utility class.

Note also: amber-600 (the value SpellbookPanel.tsx:484 used before) is not byte-identical to --color-warning — Tailwind v4 ships its palette as oklch(), and amber-600 resolves to rgb(225,113,0) vs. --color-warning's rgb(217,119,6). Small, but worth knowing before assuming a straight swap is a no-op visually.

What this needs

A deliberate design decision — not an !important escape (an existing but narrow precedent already exists at MembersPage.tsx:1617's cf-inset !border-amber-500/20; spreading it further is exactly the kind of design-system bypass #1533 exists to stop) and not a unilateral new class added as a rider on a color migration. Candidates to evaluate:

  • An unlayered semantic modifier mirroring the existing .btn-danger pattern (nocturne.css:209-250) — e.g. .cf-card--warning, .cf-inset--warning, a .btn-warning. .btn-danger has hover/active/focus states from --color-danger-solid-hover/-active/-focus; --color-warning is currently a single flat value with no such family, so this also needs those decided (see Design system: migrate raw amber/slate/rose Tailwind colors used for semantic warning state onto --color-warning #2161's own note about --color-warning lacking --color-danger's multi-role family).
  • Something else — the option space above is a starting point, not a mandate.

Sites to re-migrate once a fix pattern exists

  • CampaignAuditPage.tsx:294 — border-amber-500/30 bg-amber-500/5 (audit retention disclosure card)
  • MembersPage.tsx:483 — border-amber-600/40 (invites-suspended banner)
  • InboxPage.tsx:700 — border-amber-600/40 (AI-DM sweep disabled banner)
  • SpellbookPanel.tsx:484 — bg-amber-600 hover:bg-amber-500 (concentration-warning confirm button)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions