Open-source document signature platform. Not affiliated with DocuSign.
TypeScript
Redesign the app in the Soft Studio style, with real page thumbnails
Claude1d6ccfe7ef25
diff --git a/e2e/signing-flow.spec.ts b/e2e/signing-flow.spec.tsindex c07d4a9..0ab8826 100644--- a/e2e/signing-flow.spec.ts+++ b/e2e/signing-flow.spec.ts@@ -368,6 +368,39 @@ test("a new install is set up, a sender sends a PDF and a recipient signs it", a}});+ await test.step("the dashboard shows the first page as a thumbnail", async () => {+ const thumbnailPath = `/api/envelopes/${envelopeId}/thumbnail`;++ await page.goto("/dashboard");++ const thumbnail = page.getByRole("img", {+ name: `First page of ${ENVELOPE_TITLE}`,+ });++ await expect(thumbnail).toBeVisible();+ await expect+ .poll(() =>+ thumbnail.evaluate((image: HTMLImageElement) => image.naturalWidth),+ )+ .toBeGreaterThan(0);++ // The picture is stored beside the PDF, as a JPEG, and only the account+ // that sent the document can read it.+ await expect+ .poll(async () => (await page.request.get(thumbnailPath)).status())+ .toBe(200);+ expect(+ (await page.request.get(thumbnailPath)).headers()["content-type"],+ ).toBe("image/jpeg");++ const anonymousContext = await browser.newContext();++ expect((await anonymousContext.request.get(thumbnailPath)).status()).toBe(+ 401,+ );+ await anonymousContext.close();+ });+// An install from before there were administrators has accounts but// nobody in charge. One of its users takes charge with the setup token.await test.step("an install with no administrator is claimed with the setup token", async () => {diff --git a/src/app/(app)/error.tsx b/src/app/(app)/error.tsxindex a43bb26..234e998 100644--- a/src/app/(app)/error.tsx+++ b/src/app/(app)/error.tsx@@ -10,11 +10,10 @@ export default function AppError({}) {return (<StatusPanel- description="The shared sender shell is mounted, but this page failed to load. Try the route again."- eyebrow="App shell"+ description="Something went wrong while loading this page. Please try again."footer={<button- className="inline-flex min-h-11 items-center justify-center rounded-full border border-(--border) px-5 text-sm font-semibold text-(--fg) transition hover:bg-(--surface)"+ className="btn-quiet min-h-11 px-5"onClick={reset}type="button">diff --git a/src/app/(app)/loading.tsx b/src/app/(app)/loading.tsxindex da96fc8..0ee0f9f 100644--- a/src/app/(app)/loading.tsx+++ b/src/app/(app)/loading.tsx@@ -1,34 +1,32 @@export default function AppLoading() {return (- <div aria-label="Loading page" className="space-y-6">- <section className="rounded-[28px] border border-(--border) bg-white px-6 py-6 shadow-(--shadow-card) sm:px-8">- <div className="space-y-4">- <div className="h-3 w-24 animate-pulse rounded-full bg-(--surface)" />- <div className="h-9 w-56 animate-pulse rounded-full bg-(--surface)" />- <div className="h-4 w-full max-w-xl animate-pulse rounded-full bg-(--surface)" />+ <div aria-label="Loading page" className="space-y-5">+ <section className="panel px-6 py-7 sm:px-8">+ <div className="space-y-3">+ <div className="h-9 w-56 animate-pulse rounded-full bg-[#eeeff4]" />+ <div className="h-4 w-full max-w-md animate-pulse rounded-full bg-[#eeeff4]" /></div></section>- <section className="rounded-[28px] border border-(--border) bg-white p-6 shadow-(--shadow-card) sm:p-8">- <div className="space-y-4">- <div className="h-12 w-full animate-pulse rounded-2xl bg-(--surface)" />- <div className="flex flex-wrap gap-2">- {Array.from({ length: 6 }).map((_, index) => (- <div- className="h-10 w-24 animate-pulse rounded-full bg-(--surface)"- key={index}- />- ))}+ <div className="flex flex-wrap gap-2">+ {Array.from({ length: 5 }).map((_, index) => (+ <div+ className="h-10 w-20 animate-pulse rounded-xl bg-(--surface-strong)"+ key={index}+ />+ ))}+ </div>+ <div className="grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-4">+ {Array.from({ length: 4 }).map((_, index) => (+ <div+ className="panel space-y-3.5 rounded-[1.25rem] p-3.5"+ key={index}+ >+ <div className="h-52 animate-pulse rounded-2xl bg-(--surface)" />+ <div className="h-4 w-3/4 animate-pulse rounded-full bg-[#eeeff4]" />+ <div className="h-3 w-1/2 animate-pulse rounded-full bg-[#eeeff4]" /></div>- <div className="mt-6 space-y-3">- {Array.from({ length: 4 }).map((_, index) => (- <div- className="h-20 animate-pulse rounded-[22px] bg-(--surface)"- key={index}- />- ))}- </div>- </div>- </section>+ ))}+ </div></div>);}diff --git a/src/app/(auth)/error.tsx b/src/app/(auth)/error.tsxindex 444979c..2630fd5 100644--- a/src/app/(auth)/error.tsx+++ b/src/app/(auth)/error.tsx@@ -11,11 +11,10 @@ export default function AuthError({return (<div className="w-full max-w-[520px]"><StatusPanel- description="The public route-group shell is ready, but this page hit an unexpected error."- eyebrow="Auth shell"+ description="This page hit an unexpected error. Please try again."footer={<button- className="inline-flex min-h-11 items-center justify-center rounded-full border border-(--border) px-5 text-sm font-semibold text-(--fg) transition hover:bg-(--surface)"+ className="btn-quiet min-h-11 px-5"onClick={reset}type="button">diff --git a/src/app/(auth)/loading.tsx b/src/app/(auth)/loading.tsxindex 15c34ce..19fa034 100644--- a/src/app/(auth)/loading.tsx+++ b/src/app/(auth)/loading.tsx@@ -2,17 +2,16 @@ export default function AuthLoading() {return (<sectionaria-label="Loading authentication page"- className="w-full max-w-[440px] rounded-[32px] border border-(--border) bg-white p-8 shadow-(--shadow-soft)"+ className="panel w-full max-w-[440px] p-8 sm:p-10">- <div className="space-y-4">- <div className="h-3 w-24 animate-pulse rounded-full bg-(--surface)" />- <div className="h-8 w-48 animate-pulse rounded-full bg-(--surface)" />- <div className="h-4 w-full animate-pulse rounded-full bg-(--surface)" />+ <div className="space-y-3">+ <div className="h-3 w-24 animate-pulse rounded-full bg-[#eeeff4]" />+ <div className="h-8 w-48 animate-pulse rounded-full bg-[#eeeff4]" /></div><div className="mt-8 space-y-5">- <div className="h-20 animate-pulse rounded-[24px] bg-(--surface)" />- <div className="h-20 animate-pulse rounded-[24px] bg-(--surface)" />- <div className="h-12 animate-pulse rounded-full bg-(--surface)" />+ <div className="h-[4.5rem] animate-pulse rounded-2xl bg-(--surface)" />+ <div className="h-[4.5rem] animate-pulse rounded-2xl bg-(--surface)" />+ <div className="h-12 animate-pulse rounded-[0.875rem] bg-[#eeeff4]" /></div></section>);diff --git a/src/app/(canvas)/error.tsx b/src/app/(canvas)/error.tsxindex 6a0d416..c264da3 100644--- a/src/app/(canvas)/error.tsx+++ b/src/app/(canvas)/error.tsx@@ -11,11 +11,10 @@ export default function CanvasError({return (<div className="p-4 sm:p-6 lg:p-8"><StatusPanel- description="The full-screen document shell is mounted, but the canvas payload could not render."- eyebrow="Canvas shell"+ description="Something went wrong while opening this document. Please try again."footer={<button- className="inline-flex min-h-11 items-center justify-center rounded-full border border-(--border) px-5 text-sm font-semibold text-(--fg) transition hover:bg-(--surface)"+ className="btn-quiet min-h-11 px-5"onClick={reset}type="button">diff --git a/src/app/(canvas)/loading.tsx b/src/app/(canvas)/loading.tsxindex 28a6c75..8a970c5 100644--- a/src/app/(canvas)/loading.tsx+++ b/src/app/(canvas)/loading.tsx@@ -1,20 +1,20 @@export default function CanvasLoading() {return (- <div className="grid min-h-[calc(100vh-73px)] lg:grid-cols-[260px_minmax(0,1fr)]">- <aside className="hidden border-r border-(--border) bg-white p-5 lg:block">- <div className="space-y-4">- <div className="h-4 w-20 animate-pulse rounded-full bg-(--surface)" />+ <div className="grid min-h-[calc(100vh-73px)] lg:grid-cols-[272px_minmax(0,1fr)]">+ <aside className="hidden py-5 pl-5 lg:block">+ <div className="panel space-y-2 rounded-[1.25rem] p-4">+ <div className="h-4 w-20 animate-pulse rounded-full bg-[#eeeff4]" />{Array.from({ length: 5 }).map((_, index) => (<div- className="h-12 animate-pulse rounded-2xl bg-(--surface)"+ className="h-12 animate-pulse rounded-[0.875rem] bg-(--surface)"key={index}/>))}</div></aside>- <section className="p-4 sm:p-6 lg:p-8">- <div className="rounded-[32px] border border-(--border) bg-white p-5 shadow-(--shadow-soft) sm:p-6">- <div className="mx-auto h-[560px] max-w-[720px] animate-pulse rounded-[28px] bg-(--surface)" />+ <section className="p-4 sm:p-5">+ <div className="panel rounded-[1.25rem] p-5 sm:p-6">+ <div className="mx-auto h-[560px] max-w-[720px] animate-pulse rounded-2xl bg-(--surface)" /></div></section></div>diff --git a/src/app/accessibility/page.tsx b/src/app/accessibility/page.tsxindex a9443f2..b4033d4 100644--- a/src/app/accessibility/page.tsx+++ b/src/app/accessibility/page.tsx@@ -23,7 +23,7 @@ export default async function AccessibilityPage() {title="Accessibility Statement"><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">Commitment</h2><p>@@ -41,7 +41,7 @@ export default async function AccessibilityPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">What currently works best</h2><ul className="list-disc space-y-2 pl-6">@@ -63,7 +63,7 @@ export default async function AccessibilityPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">Known limitations</h2><ul className="list-disc space-y-2 pl-6">@@ -86,14 +86,14 @@ export default async function AccessibilityPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">Alternative assistance</h2><p>If you need help creating, sending, reviewing, or signing a document,email{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={`mailto:${supportAddress}`}>{supportAddress}@@ -110,7 +110,7 @@ export default async function AccessibilityPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">Standards and ongoing work</h2><p>@@ -127,21 +127,21 @@ export default async function AccessibilityPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">Feedback</h2><p>Accessibility feedback helps us prioritize the right fixes. If youfind a barrier, email{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={`mailto:${supportAddress}`}>{supportAddress}</Link>{" "}or use the{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href="/contact">Contactdiff --git a/src/app/api/envelopes/[id]/thumbnail/route.ts b/src/app/api/envelopes/[id]/thumbnail/route.tsnew file mode 100644index 0000000..7e5de29--- /dev/null+++ b/src/app/api/envelopes/[id]/thumbnail/route.ts@@ -0,0 +1,208 @@+import { NextResponse } from "next/server";++import { requireVerifiedSenderSession } from "@/lib/auth/route-session";+import { getDb } from "@/lib/db/connection";+import {+ EnvelopeDocumentAccessError,+ getEnvelopeThumbnailForUser,+ saveEnvelopeThumbnailForUser,+} from "@/lib/envelopes";+import { logRouteError } from "@/lib/security/logging";+import {+ applyRateLimit,+ buildRateLimitKey,+} from "@/lib/security/route-controls";+import { getClientIpAddress, getRequestPathname } from "@/lib/security/request";+import {+ THUMBNAIL_CONTENT_TYPE,+ THUMBNAIL_MAX_BYTES,+ ThumbnailValidationError,+} from "@/lib/services/thumbnails";++type EnvelopeThumbnailRouteContext = {+ params: Promise<{+ id: string;+ }>;+};++const privateNoStore = { "cache-control": "private, no-store" };++// The picture of a document's first page that the dashboard shows. Only the+// account that owns the envelope can read or write it.+export async function GET(+ request: Request,+ context: EnvelopeThumbnailRouteContext,+) {+ const sessionResult = await requireVerifiedSenderSession(request);++ if (sessionResult instanceof Response) {+ return sessionResult;+ }++ const session = sessionResult;+ const { id } = await context.params;++ try {+ const thumbnail = await getEnvelopeThumbnailForUser(session.user.id, id, {+ database: getDb(),+ });+ const headers = new Headers({+ // The original PDF of an envelope never changes, so neither does this.+ // An hour keeps the dashboard quick without holding a deleted draft's+ // picture in the browser for long.+ "cache-control": "private, max-age=3600",+ "content-disposition": "inline",+ // Stored as a JPEG whatever the upload claimed to be, and served as+ // nothing else.+ "content-security-policy": "default-src 'none'; sandbox",+ "content-type": THUMBNAIL_CONTENT_TYPE,+ "x-content-type-options": "nosniff",+ });++ if (typeof thumbnail.contentLength === "number") {+ headers.set("content-length", String(thumbnail.contentLength));+ }++ return new Response(thumbnail.stream, { headers, status: 200 });+ } catch (error) {+ if (error instanceof EnvelopeDocumentAccessError) {+ return NextResponse.json(+ { error: error.message },+ { headers: privateNoStore, status: error.statusCode },+ );+ }++ logRouteError(error, {+ category: "envelope_thumbnail_read_failure",+ ipAddress: getClientIpAddress(request.headers),+ message: "Unexpected failure while loading a document thumbnail.",+ path: getRequestPathname(request),+ userId: session.user.id,+ });++ return NextResponse.json(+ { error: "Unable to load this thumbnail." },+ { headers: privateNoStore, status: 500 },+ );+ }+}++// The sender's browser draws the first page and sends it here: once when the+// PDF is uploaded, or later from the dashboard for an envelope that has none.+export async function PUT(+ request: Request,+ context: EnvelopeThumbnailRouteContext,+) {+ const sessionResult = await requireVerifiedSenderSession(request);++ if (sessionResult instanceof Response) {+ return sessionResult;+ }++ const session = sessionResult;+ const rateLimitResponse = await applyRateLimit({+ category: "envelope_thumbnail_write",+ key: buildRateLimitKey(["envelope-thumbnail", session.user.id]),+ limit: 120,+ request,+ userId: session.user.id,+ windowMs: 10 * 60 * 1000,+ });++ if (rateLimitResponse) {+ return rateLimitResponse;+ }++ const declaredLength = Number(request.headers.get("content-length") ?? "0");++ if (Number.isFinite(declaredLength) && declaredLength > THUMBNAIL_MAX_BYTES) {+ return NextResponse.json(+ { error: "The thumbnail is too large." },+ { status: 413 },+ );+ }++ const { id } = await context.params;++ try {+ const body = await readLimitedBody(request, THUMBNAIL_MAX_BYTES);++ if (!body) {+ return NextResponse.json(+ { error: "The thumbnail is too large." },+ { status: 413 },+ );+ }++ await saveEnvelopeThumbnailForUser(session.user.id, id, body, {+ database: getDb(),+ });++ return new Response(null, { headers: privateNoStore, status: 204 });+ } catch (error) {+ if (error instanceof ThumbnailValidationError) {+ return NextResponse.json({ error: error.message }, { status: 400 });+ }++ if (error instanceof EnvelopeDocumentAccessError) {+ return NextResponse.json(+ { error: error.message },+ { status: error.statusCode },+ );+ }++ logRouteError(error, {+ category: "envelope_thumbnail_write_failure",+ ipAddress: getClientIpAddress(request.headers),+ message: "Unexpected failure while saving a document thumbnail.",+ path: getRequestPathname(request),+ userId: session.user.id,+ });++ return NextResponse.json(+ { error: "Unable to save this thumbnail." },+ { status: 500 },+ );+ }+}++/** Reads the body, giving up as soon as it is larger than the limit. */+async function readLimitedBody(+ request: Request,+ maxBytes: number,+): Promise<Uint8Array | null> {+ if (!request.body) {+ return new Uint8Array();+ }++ const reader = request.body.getReader();+ const chunks: Uint8Array[] = [];+ let total = 0;++ for (;;) {+ const { done, value } = await reader.read();++ if (done) {+ break;+ }++ total += value.byteLength;++ if (total > maxBytes) {+ await reader.cancel().catch(() => undefined);+ return null;+ }++ chunks.push(value);+ }++ const body = new Uint8Array(total);+ let offset = 0;++ for (const chunk of chunks) {+ body.set(chunk, offset);+ offset += chunk.byteLength;+ }++ return body;+}diff --git a/src/app/globals.css b/src/app/globals.cssindex 6ee1ac5..76f784b 100644--- a/src/app/globals.css+++ b/src/app/globals.css@@ -19,135 +19,145 @@--color-muted-foreground: var(--secondary);--color-accent: var(--surface-strong);--color-accent-foreground: var(--fg);- --color-destructive: var(--accent);+ --color-destructive: var(--danger);--color-destructive-foreground: #ffffff;--color-border: var(--border);--color-input: var(--border);- --color-ring: rgba(180, 35, 53, 0.24);+ --color-ring: rgba(83, 64, 214, 0.32);--color-chart-1: var(--signer-1);--color-chart-2: var(--signer-2);--color-chart-3: var(--signer-3);--color-chart-4: var(--signer-4);--color-chart-5: var(--accent);- --color-sidebar: var(--shell-surface);- --color-sidebar-foreground: var(--fg);- --color-sidebar-primary: var(--accent);- --color-sidebar-primary-foreground: #ffffff;- --color-sidebar-accent: rgba(255, 255, 255, 0.82);- --color-sidebar-accent-foreground: var(--fg);- --color-sidebar-border: var(--border);- --color-sidebar-ring: rgba(180, 35, 53, 0.24);- --radius-sm: calc(var(--radius) * 0.7);- --radius-md: calc(var(--radius) * 0.9);+ --radius-sm: calc(var(--radius) * 0.6);+ --radius-md: calc(var(--radius) * 0.8);--radius-lg: var(--radius);- --radius-xl: calc(var(--radius) * 1.2);+ --radius-xl: calc(var(--radius) * 1.25);--radius-2xl: calc(var(--radius) * 1.5);- --radius-3xl: calc(var(--radius) * 1.8);- --radius-4xl: calc(var(--radius) * 2.2);- --shadow-xs: 0 1px 2px rgba(18, 16, 12, 0.04);- --shadow-sm: 0 14px 30px rgba(18, 16, 12, 0.055);- --shadow: 0 18px 44px rgba(18, 16, 12, 0.08);- --shadow-md: 0 28px 60px rgba(18, 16, 12, 0.1);- --shadow-lg: 0 42px 90px rgba(18, 16, 12, 0.14);+ --radius-3xl: calc(var(--radius) * 1.75);+ --radius-4xl: calc(var(--radius) * 2.25);+ --shadow-xs: 0 1px 2px rgba(28, 29, 43, 0.05);+ --shadow-sm: 0 1px 3px rgba(28, 29, 43, 0.08);+ --shadow: 0 2px 6px rgba(28, 29, 43, 0.05);+ --shadow-md: 0 10px 30px rgba(28, 29, 43, 0.08);+ --shadow-lg: 0 18px 40px rgba(28, 29, 43, 0.12);}+/*+ * Soft Studio. A pale blue-grey page, white rounded cards that sit on it+ * without borders, one violet for anything the person can act on, and+ * status shown as tinted pills. Red is kept for errors and for actions that+ * cannot be undone.+ */:root {- --page: #ffffff;- --bg: #ffffff;+ --page: #f3f4f8;+ --bg: #f3f4f8;--paper: #ffffff;--paper-raised: #ffffff;- --fg: #000000;- --secondary: #55555c;- --tertiary: #7b7b84;- --placeholder: #9b9ba3;- --accent: #e50000;- --accent-hover: #c00000;- --surface: #f7f7f8;- --surface-strong: #efeff1;+ --fg: #1c1d2b;+ --secondary: #575a6e;+ --tertiary: #6e7183;+ --placeholder: #8b8ea0;+ --accent: #5340d6;+ --accent-hover: #4433b8;+ --accent-soft: #ece9fd;+ --accent-softer: #f4f2ff;+ --accent-ink: #4433b8;+ --danger: #b42318;+ --danger-hover: #912018;+ --danger-soft: #fdebea;+ --success: #16704a;+ --success-soft: #e3f6ec;+ --warning: #8a5300;+ --warning-soft: #fdf1d8;+ --surface: #f6f6fa;+ --surface-strong: #e6e7ee;--shell-surface: #ffffff;- --border: #d4d4d4;- --border-strong: #afafb6;- --hover: rgba(0, 0, 0, 0.04);- --shell-wash: #ffffff;- --canvas-wash: #f7f7f8;- --shadow-soft: 0 18px 36px rgba(0, 0, 0, 0.06);- --shadow-card: 0 10px 22px rgba(0, 0, 0, 0.04);+ --border: #e6e7ee;+ --border-strong: #cfd0dc;+ --border-hover: #b4b6c6;+ --hover: rgba(28, 29, 43, 0.05);+ --shell-wash: #f3f4f8;+ --canvas-wash: #e9eaf1;+ --shadow-soft: 0 18px 40px rgba(28, 29, 43, 0.12);+ --shadow-card: 0 2px 6px rgba(28, 29, 43, 0.04);+ --shadow-lift: 0 10px 30px rgba(28, 29, 43, 0.08);--signer-1: #2563eb;--signer-1-tint: rgba(37, 99, 235, 0.12);--signer-2: #9333ea;--signer-2-tint: rgba(147, 51, 234, 0.12);- --signer-3: #d97706;+ --signer-3: #b45309;--signer-3-tint: rgba(217, 119, 6, 0.14);- --signer-4: #059669;+ --signer-4: #047857;--signer-4-tint: rgba(5, 150, 105, 0.12);- --radius: 0.9rem;+ --radius: 0.75rem;}-* {- box-sizing: border-box;- border-color: var(--border);-}--html {- background: #ffffff;- color: var(--fg);-}+/*+ * Element defaults live in the base layer and the shared classes in the+ * components layer, so a utility class on an element always wins over them.+ */+@layer base {+ * {+ box-sizing: border-box;+ border-color: var(--border);+ }-body {- margin: 0;- min-height: 100vh;- background: var(--page);- color: var(--fg);- font-family: var(--font-ui), "Helvetica Neue", ui-sans-serif, system-ui,- sans-serif;- letter-spacing: -0.01em;- text-rendering: optimizeLegibility;-}+ html {+ background: var(--page);+ color: var(--fg);+ }-a {- color: inherit;- text-decoration: none;-}+ body {+ margin: 0;+ min-height: 100vh;+ background: var(--page);+ color: var(--fg);+ font-family:+ var(--font-ui), "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;+ letter-spacing: -0.005em;+ text-rendering: optimizeLegibility;+ }-button,-input,-textarea {- font: inherit;-}+ a {+ color: inherit;+ text-decoration: none;+ }-button {- cursor: pointer;-}+ button,+ input,+ select,+ textarea {+ font: inherit;+ }-input::placeholder,-textarea::placeholder {- color: var(--placeholder);-}+ button {+ cursor: pointer;+ }-::selection {- background: rgba(180, 35, 53, 0.16);-}+ input::placeholder,+ textarea::placeholder {+ color: var(--placeholder);+ }-:focus-visible {- outline: 2px solid rgba(180, 35, 53, 0.4);- outline-offset: 2px;-}+ ::selection {+ background: rgba(83, 64, 214, 0.18);+ }-[data-paper-grid] {- background-image:- linear-gradient(rgba(212, 212, 212, 0.62) 1px, transparent 1px),- linear-gradient(90deg, rgba(212, 212, 212, 0.62) 1px, transparent 1px);- background-position: center center;- background-size: 28px 28px;-}+ :focus-visible {+ outline: 2px solid rgba(83, 64, 214, 0.55);+ outline-offset: 2px;+ }-h1,-h2,-h3,-h4,-h5,-h6 {- letter-spacing: -0.04em;+ h1,+ h2,+ h3,+ h4,+ h5,+ h6 {+ letter-spacing: -0.025em;+ text-wrap: balance;+ }}@media (prefers-reduced-motion: no-preference) {@@ -176,56 +186,233 @@ h6 {}}-.app-surface {- border: 1px solid var(--border);- border-radius: 1.25rem;- background: #ffffff;- box-shadow: none;-}+@layer components {+ /* A white card on the page. The main container on every screen. */+ .panel {+ position: relative;+ border-radius: 1.5rem;+ background: var(--paper);+ }-.app-surface-strong {- border: 1px solid var(--border);- border-radius: 1.25rem;- background: #ffffff;- box-shadow: none;-}+ /* A tinted well inside a card: a signer row, a summary, an empty state. */+ .well {+ border-radius: 1rem;+ background: var(--surface);+ }-.muted-surface {- border: 1px solid var(--border);- border-radius: 1rem;- background: var(--surface);-}+ /* A card that floats above the page: a signing sheet, a popover. */+ .panel-raised {+ border-radius: 1.25rem;+ background: var(--paper);+ box-shadow: var(--shadow-soft);+ }-.section-eyebrow {- font-family: var(--font-mono), ui-monospace, monospace;- font-size: 0.7rem;- font-weight: 700;- letter-spacing: 0.24em;- text-transform: uppercase;- color: var(--tertiary);-}+ /* The small label above a title or a group. */+ .section-eyebrow {+ font-size: 0.8125rem;+ font-weight: 600;+ line-height: 1.3;+ color: var(--tertiary);+ }-.editorial-shell {- width: min(1200px, calc(100% - 3rem));- margin-inline: auto;-}+ .page-width {+ width: min(1180px, calc(100% - 2rem));+ margin-inline: auto;+ }-.editorial-meta {- font-family: var(--font-mono), ui-monospace, monospace;- font-size: 0.72rem;- font-weight: 700;- letter-spacing: 0.2em;- text-transform: uppercase;- color: var(--tertiary);-}+ /* Status pills. The color says the state; the text says it too. */+ .pill {+ display: inline-flex;+ min-height: 1.625rem;+ align-items: center;+ gap: 0.375rem;+ border-radius: 999px;+ padding: 0.125rem 0.625rem;+ font-size: 0.75rem;+ font-weight: 600;+ line-height: 1.2;+ white-space: nowrap;+ }-.editorial-panel {- position: relative;- border: 1px solid var(--border);- background: #ffffff;-}+ .pill-accent {+ background: var(--accent-soft);+ color: var(--accent-ink);+ }++ .pill-success {+ background: var(--success-soft);+ color: var(--success);+ }++ .pill-danger {+ background: var(--danger-soft);+ color: var(--danger);+ }++ .pill-warning {+ background: var(--warning-soft);+ color: var(--warning);+ }++ .pill-neutral {+ background: #eeeff4;+ color: var(--secondary);+ }++ /* A row of choices where one is selected: filters, draw or type. */+ .segmented {+ display: inline-flex;+ max-width: 100%;+ flex-wrap: wrap;+ gap: 0.125rem;+ border-radius: 0.75rem;+ background: var(--surface-strong);+ padding: 0.25rem;+ }++ .segmented-item {+ display: inline-flex;+ min-height: 2.125rem;+ align-items: center;+ justify-content: center;+ border: 0;+ border-radius: 0.5625rem;+ background: transparent;+ padding: 0 0.875rem;+ font-size: 0.8125rem;+ font-weight: 600;+ color: var(--secondary);+ transition:+ background-color 120ms ease,+ color 120ms ease,+ box-shadow 120ms ease;+ }++ .segmented-item:hover {+ color: var(--fg);+ }++ .segmented-item[aria-pressed="true"],+ .segmented-item[aria-selected="true"],+ .segmented-item[data-active="true"] {+ background: var(--paper);+ color: var(--fg);+ box-shadow: 0 1px 3px rgba(28, 29, 43, 0.12);+ }++ /* A text field drawn without the Input component. */+ .field-input {+ min-height: 3rem;+ width: 100%;+ min-width: 0;+ border: 1.5px solid var(--border-strong);+ border-radius: 0.75rem;+ background: var(--paper);+ padding: 0.625rem 1rem;+ font-size: 0.875rem;+ color: var(--fg);+ outline: none;+ transition:+ border-color 120ms ease,+ box-shadow 120ms ease;+ }++ .field-input:hover {+ border-color: var(--border-hover);+ }++ .field-input:focus-visible {+ border-color: var(--accent);+ box-shadow: 0 0 0 3px rgba(83, 64, 214, 0.16);+ }++ .field-input:disabled {+ cursor: not-allowed;+ background: var(--surface);+ color: var(--secondary);+ }++ .field-input[aria-invalid="true"] {+ border-color: var(--danger);+ box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);+ }++ /* A small secondary button: move, remove, copy, zoom. */+ .btn-quiet {+ display: inline-flex;+ min-height: 2.5rem;+ align-items: center;+ justify-content: center;+ gap: 0.375rem;+ border: 1.5px solid var(--border-strong);+ border-radius: 0.75rem;+ background: var(--paper);+ padding: 0 0.875rem;+ font-size: 0.8125rem;+ font-weight: 700;+ color: var(--fg);+ white-space: nowrap;+ transition:+ background-color 120ms ease,+ border-color 120ms ease,+ color 120ms ease;+ }++ .btn-quiet:hover:not(:disabled) {+ border-color: var(--accent);+ background: var(--accent-softer);+ color: var(--accent-ink);+ }++ .btn-quiet:disabled,+ .btn-quiet[aria-disabled="true"] {+ cursor: not-allowed;+ opacity: 0.45;+ }++ .btn-quiet-danger:hover:not(:disabled) {+ border-color: var(--danger);+ background: var(--danger-soft);+ color: var(--danger);+ }++ /* A message in a tinted box: something failed, or needs attention. */+ .notice {+ border-radius: 1rem;+ padding: 0.875rem 1.25rem;+ font-size: 0.875rem;+ font-weight: 600;+ line-height: 1.5;+ }++ .notice-danger {+ background: var(--danger-soft);+ color: var(--danger);+ }++ .notice-warning {+ background: var(--warning-soft);+ color: var(--warning);+ }-.editorial-panel-soft {- border: 1px solid var(--border);- background: var(--surface);+ .notice-success {+ background: var(--success-soft);+ color: var(--success);+ }++ .notice-accent {+ background: var(--accent-softer);+ color: var(--accent-ink);+ }++ /* The desk a document page sits on in the editor and the signing view. */+ [data-paper-grid] {+ background-color: var(--canvas-wash);+ background-image: radial-gradient(+ rgba(28, 29, 43, 0.07) 1px,+ transparent 1px+ );+ background-position: center center;+ background-size: 22px 22px;+ }}diff --git a/src/app/icon.svg b/src/app/icon.svgindex 8ff8858..c2f2797 100644--- a/src/app/icon.svg+++ b/src/app/icon.svg@@ -3,19 +3,12 @@viewBox="0 0 64 64"fill="none">- <rect width="64" height="64" rx="12" fill="#0A0A0A" />+ <rect width="64" height="64" rx="18" fill="#5340D6" /><path- d="M20 16H37L44 23V48H20V16Z"- fill="#FFFFFF"+ d="M13 42C22 42 24.5 21 32.5 21C40.5 21 38 40 46 40C50.5 40 51 33.5 55 33.5"stroke="#FFFFFF"- stroke-linejoin="round"- stroke-width="2.5"- />- <path d="M37 16V23H44" stroke="#0A0A0A" stroke-width="2.5" />- <path- d="M24 38C27.2 34.6 29.8 33.6 31.2 34.5C32.8 35.5 32.1 39.3 34 40C35.8 40.7 38.4 38.7 42 34"- stroke="#E11D48"stroke-linecap="round"- stroke-width="3.5"+ stroke-linejoin="round"+ stroke-width="6"/></svg>diff --git a/src/app/layout.tsx b/src/app/layout.tsxindex e3bf88e..77069c6 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -1,22 +1,15 @@import type { Metadata } from "next";-import { Archivo, IBM_Plex_Mono } from "next/font/google";+import { Plus_Jakarta_Sans } from "next/font/google";import { TooltipProvider } from "@/components/ui/tooltip";import "./globals.css";-const archivo = Archivo({+const plusJakartaSans = Plus_Jakarta_Sans({display: "swap",subsets: ["latin"],variable: "--font-ui",- weight: ["400", "500", "600", "700", "800", "900"],-});--const ibmPlexMono = IBM_Plex_Mono({- display: "swap",- subsets: ["latin"],- variable: "--font-mono",- weight: ["400", "500", "600", "700"],+ weight: ["400", "500", "600", "700", "800"],});export const metadata: Metadata = {@@ -35,9 +28,7 @@ export default function RootLayout({}>) {return (<html lang="en">- <body- className={`${archivo.variable} ${ibmPlexMono.variable} antialiased`}- >+ <body className={`${plusJakartaSans.variable} antialiased`}><TooltipProvider>{children}</TooltipProvider></body></html>diff --git a/src/app/privacy/page.tsx b/src/app/privacy/page.tsxindex 5705cc0..44bb4bd 100644--- a/src/app/privacy/page.tsx+++ b/src/app/privacy/page.tsx@@ -23,7 +23,7 @@ export default async function PrivacyPage() {title="Privacy Policy"><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">1. Scope and service design</h2><p>@@ -41,7 +41,7 @@ export default async function PrivacyPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">2. Information we collect</h2><p>We may collect the following categories of information:</p>@@ -81,7 +81,7 @@ export default async function PrivacyPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">3. Where the information comes from</h2><p>We collect information directly from you when you:</p>@@ -100,7 +100,7 @@ export default async function PrivacyPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">4. How we use information</h2><p>We may use information to:</p>@@ -122,7 +122,7 @@ export default async function PrivacyPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">5. How we share information</h2><p>@@ -145,7 +145,7 @@ export default async function PrivacyPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">6. Retention</h2><p>@@ -169,7 +169,7 @@ export default async function PrivacyPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">7. Security</h2><p>@@ -182,7 +182,7 @@ export default async function PrivacyPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">8. Your privacy rights</h2><p>@@ -213,13 +213,13 @@ export default async function PrivacyPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">9. How to exercise your rights</h2><p>To request access, correction, deletion, or account closure, email{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={`mailto:${privacyAddress}`}>{privacyAddress}@@ -242,7 +242,7 @@ export default async function PrivacyPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">10. Cookies and local storage</h2><p>@@ -257,7 +257,7 @@ export default async function PrivacyPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">11. Children and international use</h2><p>@@ -275,7 +275,7 @@ export default async function PrivacyPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">12. Changes and contact</h2><p>@@ -286,14 +286,14 @@ export default async function PrivacyPage() {<p>Privacy questions, requests, and complaints may be sent to{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={`mailto:${privacyAddress}`}>{privacyAddress}</Link>{" "}or through the{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href="/contact">Contactdiff --git a/src/app/terms/page.tsx b/src/app/terms/page.tsxindex 514697d..22c7e07 100644--- a/src/app/terms/page.tsx+++ b/src/app/terms/page.tsx@@ -23,7 +23,7 @@ export default async function TermsPage() {title="Terms of Service"><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">1. Overview</h2><p>@@ -46,7 +46,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">2. Eligibility and authority</h2><p>@@ -64,7 +64,7 @@ export default async function TermsPage() {</section><section className="space-y-4">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">3. Permitted use and excluded documents</h2><p>@@ -121,7 +121,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">4. Sender responsibilities</h2><p>@@ -140,7 +140,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">5. Electronic signatures and records</h2><p>@@ -160,7 +160,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">6. Account security and acceptable use</h2><p>@@ -179,7 +179,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">7. Service changes, availability, and records</h2><p>@@ -198,7 +198,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">8. Intellectual property and your content</h2><p>@@ -216,7 +216,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">9. Suspension, termination, and account closure</h2><p>@@ -229,7 +229,7 @@ export default async function TermsPage() {Account-closure requests may be submitted through the settings page orby contacting{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={`mailto:${supportAddress}`}>{supportAddress}@@ -243,7 +243,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">10. Disclaimers</h2><p>@@ -265,7 +265,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">11. Limitation of liability</h2><p>@@ -285,7 +285,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">12. Indemnification</h2><p>@@ -299,7 +299,7 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">13. Governing law and changes</h2><p>@@ -318,20 +318,20 @@ export default async function TermsPage() {</section><section className="space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">14. Contact</h2><p>Questions about these Terms may be sent to{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={`mailto:${supportAddress}`}>{supportAddress}</Link>{" "}or through the{" "}<Link- className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.24)] underline-offset-4"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href="/contact">Contactdiff --git a/src/components/auth/login-shell.tsx b/src/components/auth/login-shell.tsxindex ef3d261..118f670 100644--- a/src/components/auth/login-shell.tsx+++ b/src/components/auth/login-shell.tsx@@ -340,20 +340,17 @@ function LiveLoginShell({return (<>- <section className="editorial-panel w-full max-w-[460px] p-8 sm:p-10">+ <section className="panel w-full max-w-[460px] p-8 sm:p-10"><div className="space-y-7"><div className="space-y-2"><p className="section-eyebrow">Log in</p>- <h1 className="text-[clamp(2.2rem,5vw,3rem)] font-extrabold leading-[1.02] tracking-[-0.045em] text-black">+ <h1 className="text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">Welcome back</h1></div>{bannerMessage ? (- <p- className="rounded-[22px] border border-[rgba(180,35,53,0.16)] bg-[rgba(180,35,53,0.06)] px-4 py-3 text-sm font-medium text-(--accent)"- role="alert"- >+ <p className="notice notice-danger" role="alert">{bannerMessage}</p>) : null}@@ -406,9 +403,9 @@ function LiveLoginShell({) : null}</form>- <div className="flex flex-col gap-3 border-t border-(--border) pt-5 text-sm text-muted-foreground">+ <div className="flex flex-col gap-3 border-t border-(--border) pt-5 text-sm text-(--secondary)"><button- className="w-fit p-0 text-left font-medium text-(--fg) transition hover:text-(--accent)"+ className="w-fit p-0 text-left font-bold text-(--accent-ink) underline-offset-4 hover:underline"onClick={openForgotPasswordModal}type="button">@@ -418,7 +415,7 @@ function LiveLoginShell({<p>Don't have an account?{" "}<Link- className="font-semibold text-(--fg) transition hover:text-(--accent)"+ className="font-bold text-(--accent-ink) underline-offset-4 hover:underline"href="/signup">Sign up@@ -476,10 +473,7 @@ function ForgotPasswordDialog({}}}>- <DialogContent- className="max-w-[560px] rounded-none border-(--border) sm:p-8"- showCloseButton={false}- >+ <DialogContent className="max-w-[560px] sm:p-8" showCloseButton={false}><div className="space-y-6"><DialogHeader className="space-y-3"><DialogTitle>Reset your password</DialogTitle>@@ -490,19 +484,13 @@ function ForgotPasswordDialog({</DialogHeader>{bannerMessage ? (- <p- className="rounded-[22px] border border-[rgba(180,35,53,0.16)] bg-[rgba(180,35,53,0.06)] px-4 py-3 text-sm font-medium text-(--accent)"- role="alert"- >+ <p className="notice notice-danger" role="alert">{bannerMessage}</p>) : null}{successMessage ? (- <p- className="rounded-[22px] border border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.08)] px-4 py-3 text-sm font-medium text-(--fg)"- role="status"- >+ <p className="notice notice-success" role="status">{successMessage}</p>) : null}@@ -604,29 +592,23 @@ function ResetPasswordCard({ resetToken }: { resetToken: string }) {const formLocked = isSubmitting;return (- <section className="editorial-panel w-full max-w-[440px] p-8 sm:p-10">+ <section className="panel w-full max-w-[440px] p-8 sm:p-10"><div className="space-y-8"><div className="space-y-2"><p className="section-eyebrow">Reset password</p>- <h1 className="text-[clamp(2.1rem,5vw,2.8rem)] font-extrabold leading-[1.02] tracking-[-0.045em] text-black">+ <h1 className="text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">Create a new password</h1></div>{error ? (- <p- className="rounded-[22px] border border-[rgba(255,0,51,0.16)] bg-[rgba(255,0,51,0.06)] px-4 py-3 text-sm font-medium text-(--accent)"- role="alert"- >+ <p className="notice notice-danger" role="alert">{error}</p>) : null}{successMessage ? (- <p- className="rounded-[22px] border border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.08)] px-4 py-3 text-sm font-medium text-(--fg)"- role="status"- >+ <p className="notice notice-success" role="status">{successMessage}</p>) : null}diff --git a/src/components/auth/signup-shell.tsx b/src/components/auth/signup-shell.tsxindex 5baafc1..cf55d26 100644--- a/src/components/auth/signup-shell.tsx+++ b/src/components/auth/signup-shell.tsx@@ -98,11 +98,11 @@ function SignupFormCard({values,}: SignupFormCardProps) {return (- <section className="editorial-panel w-full max-w-[460px] p-8 sm:p-10">+ <section className="panel w-full max-w-[460px] p-8 sm:p-10"><div className="space-y-7"><div className="space-y-2"><p className="section-eyebrow">Create account</p>- <h1 className="text-[clamp(2.2rem,5vw,3rem)] font-extrabold leading-[1.02] tracking-[-0.045em] text-black">+ <h1 className="text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">Create your account</h1>{signupRule ? (@@ -113,10 +113,7 @@ function SignupFormCard({</div>{bannerMessage ? (- <p- className="rounded-[22px] border border-[rgba(180,35,53,0.16)] bg-[rgba(180,35,53,0.06)] px-4 py-3 text-sm font-medium text-(--accent)"- role="alert"- >+ <p className="notice notice-danger" role="alert">{bannerMessage}</p>) : null}@@ -124,9 +121,9 @@ function SignupFormCard({{showSuccess ? (<divaria-live="polite"- className="rounded-[24px] border border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.08)] px-5 py-4"+ className="notice notice-success">- <p className="text-sm font-semibold text-(--fg)">+ <p>{successMessage ?? defaultSuccessMessage}</p></div>@@ -203,10 +200,10 @@ function SignupFormCard({)}</form>- <div className="border-t border-(--border) pt-5 text-sm text-muted-foreground">+ <div className="border-t border-(--border) pt-5 text-sm text-(--secondary)">Already have an account?{" "}<Link- className="font-semibold text-(--fg) transition hover:text-(--accent)"+ className="font-bold text-(--accent-ink) underline-offset-4 hover:underline"href="/login">Log in@@ -230,11 +227,11 @@ export function SignupShell({function SignupClosedCard() {return (- <section className="editorial-panel w-full max-w-[460px] p-8 sm:p-10">+ <section className="panel w-full max-w-[460px] p-8 sm:p-10"><div className="space-y-7"><div className="space-y-2"><p className="section-eyebrow">Create account</p>- <h1 className="text-[clamp(2.2rem,5vw,3rem)] font-extrabold leading-[1.02] tracking-[-0.045em] text-black">+ <h1 className="text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">Sign-up is closed</h1><p className="pt-1 text-sm leading-6 text-muted-foreground">diff --git a/src/components/contact/contact-form.tsx b/src/components/contact/contact-form.tsxindex 5e89125..105f9d6 100644--- a/src/components/contact/contact-form.tsx+++ b/src/components/contact/contact-form.tsx@@ -165,7 +165,7 @@ export function ContactForm() {}return (- <section className="border border-(--border) bg-white p-6 sm:p-8">+ <section className="well p-5 sm:p-7"><form className="space-y-5" onSubmit={handleSubmit}><divaria-hidden="true"@@ -183,13 +183,13 @@ export function ContactForm() {</div>{successMessage ? (- <div className="rounded-[24px] border border-[rgba(36,109,78,0.2)] bg-[rgba(36,109,78,0.08)] px-4 py-3 text-sm text-[rgb(36,109,78)]">+ <div className="notice notice-success">{successMessage}</div>) : null}{submitError ? (- <div className="rounded-[24px] border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.08)] px-4 py-3 text-sm text-(--accent)">+ <div className="notice notice-danger">{submitError}</div>) : null}@@ -222,7 +222,7 @@ export function ContactForm() {<Field className="gap-2 text-sm"><FieldLabel- className="text-[0.84rem] font-semibold tracking-[-0.02em] text-(--fg)"+ className="text-[0.8125rem] font-semibold text-(--secondary)"htmlFor="contact-message">Message@@ -230,7 +230,7 @@ export function ContactForm() {<Textareaaria-describedby="contact-message-description"aria-invalid={errors.message ? true : undefined}- className={errors.message ? "border-[rgba(180,35,53,0.36)]" : ""}+ className={errors.message ? "border-(--danger)" : ""}disabled={isSubmitting}id="contact-message"name="contact-message"@@ -240,7 +240,7 @@ export function ContactForm() {/>{errors.message ? (<FieldError- className="text-xs font-semibold text-(--accent)"+ className="text-xs font-semibold text-(--danger)"id="contact-message-description">{errors.message}@@ -248,7 +248,7 @@ export function ContactForm() {) : null}</Field>- <div className="flex border-t border-(--border) pt-5 sm:justify-end">+ <div className="flex pt-1 sm:justify-end"><ShellButton loading={isSubmitting} type="submit">{isSubmitting ? "Sending..." : "Send message"}</ShellButton>diff --git a/src/components/dashboard/dashboard-documents-surface.tsx b/src/components/dashboard/dashboard-documents-surface.tsxindex 0617c27..55ace2c 100644--- a/src/components/dashboard/dashboard-documents-surface.tsx+++ b/src/components/dashboard/dashboard-documents-surface.tsx@@ -1,20 +1,20 @@+import { PlusIcon, SearchIcon } from "lucide-react";import Link from "next/link";import type { ChangeEventHandler } from "react";import { cn } from "@/lib/cn";import type { DashboardEnvelopeListItem } from "@/lib/envelopes";+import {+ DocumentThumbnail,+ SampleDocumentPage,+} from "@/components/shared/document-thumbnail";import { ShellButton, StaticShellButton } from "@/components/shared/form-shell";import { PageHeader } from "@/components/shared/page-header";export type DashboardShellState = "default" | "empty" | "error";export type DashboardFilter =- | "All"- | "Draft"- | "Sent"- | "Completed"- | "Declined"- | "Voided";+ "All" | "Draft" | "Sent" | "Completed" | "Declined" | "Voided";type EnvelopeStatus = "draft" | "sent" | "completed" | "declined" | "voided";@@ -49,12 +49,12 @@ const statusLabelMap: Record<EnvelopeStatus, string> = {voided: "Voided",};-const statusBadgeClasses: Record<EnvelopeStatus, string> = {- completed: "bg-[rgba(5,150,105,0.12)] text-chart-4",- declined: "bg-[rgba(255,0,51,0.1)] text-(--accent)",- draft: "bg-[rgba(17,17,17,0.06)] text-muted-foreground",- sent: "bg-[rgba(37,99,235,0.12)] text-chart-1",- voided: "bg-[rgba(17,17,17,0.06)] text-(--tertiary)",+const statusPillClasses: Record<EnvelopeStatus, string> = {+ completed: "pill-success",+ declined: "pill-danger",+ draft: "pill-neutral",+ sent: "pill-accent",+ voided: "pill-neutral",};type DashboardDocumentsHeaderProps = {@@ -74,7 +74,7 @@ type DashboardDocumentsPanelProps = {selectedFilter: DashboardFilter;};-type EnvelopeListProps = {+type EnvelopeGridProps = {envelopes: readonly DashboardEnvelopeListItem[];interactive: boolean;};@@ -92,17 +92,27 @@ type ErrorBannerProps = {export function DashboardDocumentsHeader({interactive = true,}: DashboardDocumentsHeaderProps) {+ const label = (+ <>+ <PlusIcon+ aria-hidden="true"+ className="size-[1.125rem]"+ strokeWidth={2.4}+ />+ New envelope+ </>+ );+return (<PageHeaderaction={interactive ? (- <ShellButton href="/envelopes/new">New envelope</ShellButton>+ <ShellButton href="/envelopes/new">{label}</ShellButton>) : (- <StaticShellButton>New envelope</StaticShellButton>+ <StaticShellButton>{label}</StaticShellButton>)}description={documentsDescription}- eyebrow="Sender workspace"title="Documents"/>);@@ -123,31 +133,47 @@ export function DashboardDocumentsPanel({const hasSeededEnvelopes = envelopes.length > 0;return (- <section- className="editorial-panel overflow-hidden p-4 sm:p-6"- data-animate="enter"- data-animate-delay="1"- >- <div className="space-y-6">- <div className="flex flex-col gap-4 border-b border-(--border) pb-5">- <div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between">- <div>- <p className="section-eyebrow">Filter documents</p>- <p className="mt-2 text-sm leading-6 text-muted-foreground">- Search by title or signer email, then narrow by status.- </p>- </div>- {!isError && hasSeededEnvelopes ? (- <p className="text-sm text-muted-foreground">- Showing {filteredEnvelopes.length} of {envelopes.length}{" "}- envelopes- </p>- ) : null}- </div>+ <section className="space-y-4" data-animate="enter" data-animate-delay="1">+ <div className="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between">+ <div+ aria-label="Filter documents"+ className="segmented self-start"+ role="group"+ >+ {filterOptions.map((filter) => {+ const isActive = filter === selectedFilter;+ if (!interactive) {+ return (+ <span+ className="segmented-item"+ data-active={isActive}+ key={filter}+ >+ {filter}+ </span>+ );+ }++ return (+ <button+ aria-pressed={isActive}+ className="segmented-item"+ key={filter}+ onClick={() => onFilterChange?.(filter)}+ type="button"+ >+ {filter}+ </button>+ );+ })}+ </div>++ <label className="flex min-h-[2.625rem] w-full items-center gap-2.5 rounded-xl bg-white px-3.5 text-(--tertiary) transition focus-within:ring-3 focus-within:ring-ring/50 lg:w-[19rem]">+ <SearchIcon aria-hidden="true" className="size-4 shrink-0" /><inputaria-label="Search by title or email..."- className="min-h-12 w-full rounded-none border border-(--border) bg-white px-4 text-sm text-(--fg) outline-none placeholder:text-(--placeholder)"+ className="min-w-0 flex-1 bg-transparent py-2 text-sm text-(--fg) outline-none placeholder:text-(--placeholder)"onChange={interactive ? onSearchChange : undefined}placeholder="Search by title or email..."readOnly={!interactive}@@ -155,57 +181,24 @@ export function DashboardDocumentsPanel({type="search"value={searchValue}/>+ </label>+ </div>- <div className="flex flex-wrap gap-2">- {filterOptions.map((filter) => {- const isActive = filter === selectedFilter;- const filterClassName = cn(- "inline-flex min-h-10 items-center rounded-none border px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] transition",- isActive- ? "border-(--accent) bg-(--accent) text-white"- : "border-(--border) bg-white text-muted-foreground hover:border-black hover:bg-white hover:text-(--fg)",- );-- if (!interactive) {- return (- <span- aria-pressed={isActive}- className={filterClassName}- key={filter}- >- {filter}- </span>- );- }+ {isError ? (+ <ErrorBanner interactive={interactive} onRetry={onRetry} />+ ) : null}- return (- <button- aria-pressed={isActive}- className={filterClassName}- key={filter}- onClick={() => onFilterChange?.(filter)}- type="button"- >- {filter}- </button>- );- })}- </div>- </div>+ {filteredEnvelopes.length > 0 ? (+ <EnvelopeGrid envelopes={filteredEnvelopes} interactive={interactive} />+ ) : hasSeededEnvelopes ? (+ <NoResultsState interactive={interactive} onReset={onReset} />+ ) : null}- {isError ? (- <ErrorBanner interactive={interactive} onRetry={onRetry} />- ) : null}-- {filteredEnvelopes.length > 0 ? (- <EnvelopeList- envelopes={filteredEnvelopes}- interactive={interactive}- />- ) : hasSeededEnvelopes ? (- <NoResultsState interactive={interactive} onReset={onReset} />- ) : null}- </div>+ {!isError && hasSeededEnvelopes ? (+ <p className="px-1 text-[0.8125rem] text-(--tertiary)">+ Showing {filteredEnvelopes.length} of {envelopes.length} envelopes+ </p>+ ) : null}</section>);}@@ -213,10 +206,10 @@ export function DashboardDocumentsPanel({function ErrorBanner({ interactive, onRetry }: ErrorBannerProps) {return (<div- className="flex flex-col gap-4 border border-[rgba(229,0,0,0.2)] bg-[#fff8f8] px-5 py-4 sm:flex-row sm:items-center sm:justify-between"+ className="flex flex-col gap-4 rounded-2xl bg-(--danger-soft) px-5 py-4 sm:flex-row sm:items-center sm:justify-between"role="alert">- <p className="text-sm font-medium text-(--fg)">+ <p className="text-sm font-semibold text-(--danger)">We couldn't load your documents. Please try again.</p>{interactive ? (@@ -230,22 +223,22 @@ function ErrorBanner({ interactive, onRetry }: ErrorBannerProps) {);}-function EnvelopeList({ envelopes, interactive }: EnvelopeListProps) {+function EnvelopeGrid({ envelopes, interactive }: EnvelopeGridProps) {return (- <ul className="overflow-hidden border border-(--border) bg-white">+ <ul className="grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-4">{envelopes.map((envelope) => (- <li- className="border-b border-(--border) last:border-b-0"- key={envelope.id}- >- <EnvelopeRow envelope={envelope} interactive={interactive} />+ <li className="min-w-0" key={envelope.id}>+ <EnvelopeCard envelope={envelope} interactive={interactive} /></li>))}+ <li className="min-w-0">+ <UploadCard interactive={interactive} />+ </li></ul>);}-function EnvelopeRow({+function EnvelopeCard({envelope,interactive,}: {@@ -254,46 +247,57 @@ function EnvelopeRow({}) {const content = (<>- <div className="space-y-2">- <div className="flex flex-wrap items-start gap-3">- <h2- className={`text-lg font-semibold tracking-[-0.03em] ${- envelope.status === "voided"- ? "text-muted-foreground line-through"- : "text-(--fg)"- }`}- >- {envelope.title}- </h2>- </div>- <p className="text-sm leading-6 text-muted-foreground">+ <span className="flex h-52 items-center justify-center rounded-2xl bg-(--surface) p-3.5 transition group-hover:bg-[#f0f0f6]">+ {interactive ? (+ <DocumentThumbnail envelopeId={envelope.id} title={envelope.title} />+ ) : (+ <SampleDocumentPage seed={envelope.id} />+ )}+ </span>++ <span className="block min-w-0 space-y-1 px-1">+ <span+ className={cn(+ "block truncate text-[0.9375rem] font-bold leading-snug",+ envelope.status === "voided" ? "text-(--tertiary)" : "text-(--fg)",+ )}+ role="heading"+ aria-level={2}+ >+ {envelope.title}+ </span>+ <span className="block truncate text-[0.8125rem] text-(--tertiary)">{envelope.contextLine}- </p>- <p className="text-sm text-(--tertiary)">- Created {envelope.createdAtLabel}- </p>- </div>+ </span>+ </span>- <span- aria-label={`Status: ${statusLabelMap[envelope.status]}`}- className={`inline-flex min-h-10 items-center justify-center rounded-none px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] ${statusBadgeClasses[envelope.status]}`}- >- {statusLabelMap[envelope.status]}+ <span className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 px-1 pb-0.5">+ <span+ aria-label={`Status: ${statusLabelMap[envelope.status]}`}+ className={cn("pill", statusPillClasses[envelope.status])}+ >+ {envelope.statusLabel}+ </span>+ <span className="text-xs text-(--tertiary)">+ <span className="sr-only">Created </span>+ {envelope.createdAtLabel}+ </span></span></>);+ const className =+ "group panel flex h-full flex-col gap-3.5 rounded-[1.25rem] p-3.5";if (!interactive) {- return (- <div className="grid gap-4 px-5 py-5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start sm:px-6">- {content}- </div>- );+ return <div className={className}>{content}</div>;}return (<Link- className="grid gap-4 px-5 py-5 transition hover:bg-[#f7f7f8] sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start sm:px-6"+ className={cn(+ className,+ "transition hover:-translate-y-0.5 hover:shadow-(--shadow-lift)",+ )}href={`/envelopes/${envelope.id}`}>{content}@@ -301,17 +305,47 @@ function EnvelopeRow({);}+/** The last tile in the grid: the way to add the next document. */+function UploadCard({ interactive }: { interactive: boolean }) {+ const content = (+ <>+ <span className="inline-flex size-11 items-center justify-center rounded-[0.875rem] bg-(--accent-soft) text-(--accent)">+ <PlusIcon aria-hidden="true" className="size-5" strokeWidth={2.4} />+ </span>+ Upload a PDF+ </>+ );+ const className =+ "flex h-full min-h-[17.5rem] flex-col items-center justify-center gap-2.5 rounded-[1.25rem] border-2 border-dashed border-(--border-strong) text-sm font-bold text-(--secondary)";++ if (!interactive) {+ return <div className={className}>{content}</div>;+ }++ return (+ <Link+ className={cn(+ className,+ "transition hover:border-(--accent) hover:bg-(--accent-softer) hover:text-(--accent-ink)",+ )}+ href="/envelopes/new"+ >+ {content}+ </Link>+ );+}+function NoResultsState({ interactive, onReset }: NoResultsStateProps) {return (- <div className="border border-dashed border-(--border) bg-(--surface) px-6 py-10 text-center">+ <div className="panel px-6 py-12 text-center"><div className="mx-auto max-w-md space-y-3">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">No documents match your search</h2>- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-sm leading-6 text-(--secondary)">Try a different title, signer email, or status filter.</p>- <div className="flex justify-center">+ <div className="flex justify-center pt-2">{interactive ? (<ShellButton onClick={onReset} variant="secondary">Reset filtersdiff --git a/src/components/dashboard/dashboard-shell.tsx b/src/components/dashboard/dashboard-shell.tsxindex 03d548d..3ecaf9f 100644--- a/src/components/dashboard/dashboard-shell.tsx+++ b/src/components/dashboard/dashboard-shell.tsx@@ -1,5 +1,6 @@"use client";+import { PlusIcon } from "lucide-react";import { useState, type ChangeEvent } from "react";import type { DashboardEnvelopeListItem } from "@/lib/envelopes";@@ -10,6 +11,7 @@ import {type DashboardFilter,type DashboardShellState,} from "@/components/dashboard/dashboard-documents-surface";+import { DocumentThumbnail } from "@/components/shared/document-thumbnail";import { ShellButton } from "@/components/shared/form-shell";type DashboardShellProps = {@@ -63,7 +65,7 @@ export function DashboardShell({}return (- <div className="space-y-8">+ <div className="space-y-5"><DashboardDocumentsHeader />{initialState === "empty" ? (@@ -88,23 +90,30 @@ export function DashboardShell({function EmptyDashboardState() {return (<section- className="editorial-panel p-6 sm:p-8"+ className="panel px-6 py-14 sm:py-20"data-animate="enter"data-animate-delay="1">- <div className="mx-auto flex max-w-md flex-col items-center gap-5 border border-dashed border-(--border) bg-(--surface) px-8 py-12 text-center">- <span className="inline-flex h-16 min-w-16 items-center justify-center border border-(--accent) bg-[#fff8f8] px-4 text-xs font-semibold uppercase tracking-[0.28em] text-(--accent)">+ <div className="mx-auto flex max-w-md flex-col items-center gap-5 text-center">+ <span className="flex h-28 items-center justify-center">+ <DocumentThumbnail title="" /></span><div className="space-y-2">- <h2 className="text-2xl font-semibold tracking-[-0.04em] text-(--fg)">+ <h2 className="text-2xl font-extrabold tracking-[-0.03em] text-(--fg)">No documents yet</h2>- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-[0.9375rem] leading-6 text-(--secondary)">Upload a PDF and send it for signatures in minutes.</p></div>- <ShellButton href="/envelopes/new">+ New envelope</ShellButton>+ <ShellButton href="/envelopes/new">+ <PlusIcon+ aria-hidden="true"+ className="size-[1.125rem]"+ strokeWidth={2.4}+ />+ New envelope+ </ShellButton></div></section>);diff --git a/src/components/envelopes/envelope-detail-shell.tsx b/src/components/envelopes/envelope-detail-shell.tsxindex e94eca3..d40ecaf 100644--- a/src/components/envelopes/envelope-detail-shell.tsx+++ b/src/components/envelopes/envelope-detail-shell.tsx@@ -1,8 +1,17 @@"use client";+import {+ CheckIcon,+ ClockIcon,+ DownloadIcon,+ MinusIcon,+ XIcon,+ type LucideIcon,+} from "lucide-react";import Link from "next/link";import { useState } from "react";+import { DocumentThumbnail } from "@/components/shared/document-thumbnail";import { ShellButton } from "@/components/shared/form-shell";import { StatusPanel } from "@/components/shared/status-panel";import {@@ -53,12 +62,12 @@ type EnvelopeDetailRecord = {type ModalState = "delete-draft" | "void-envelope" | null;-const statusBadgeClasses: Record<EnvelopeStatus, string> = {- completed: "bg-[rgba(5,150,105,0.12)] text-chart-4",- declined: "bg-[rgba(255,0,51,0.1)] text-(--accent)",- draft: "bg-[rgba(17,17,17,0.06)] text-muted-foreground",- sent: "bg-[rgba(37,99,235,0.12)] text-chart-1",- voided: "bg-[rgba(17,17,17,0.08)] text-(--tertiary)",+const statusPillClasses: Record<EnvelopeStatus, string> = {+ completed: "pill-success",+ declined: "pill-danger",+ draft: "pill-neutral",+ sent: "pill-accent",+ voided: "pill-neutral",};const statusLabelMap: Record<EnvelopeStatus, string> = {@@ -69,25 +78,32 @@ const statusLabelMap: Record<EnvelopeStatus, string> = {voided: "Voided",};-const signerStatusBadgeClasses: Record<SignerStatus, string> = {- declined: "bg-[rgba(255,0,51,0.1)] text-(--accent)",- pending: "bg-[rgba(17,17,17,0.06)] text-muted-foreground",- signed: "bg-[rgba(5,150,105,0.12)] text-chart-4",- waiting: "bg-[rgba(37,99,235,0.12)] text-chart-1",+const signerStatusPillClasses: Record<SignerStatus, string> = {+ declined: "pill-danger",+ pending: "pill-neutral",+ signed: "pill-success",+ waiting: "pill-accent",};const signerStatusLabelMap: Record<SignerStatus, string> = {- declined: "✗ Declined",- pending: "— Pending",- signed: "✓ Signed",- waiting: "◷ Waiting",+ declined: "Declined",+ pending: "Pending",+ signed: "Signed",+ waiting: "Waiting",+};++const signerStatusIcons: Record<SignerStatus, LucideIcon> = {+ declined: XIcon,+ pending: MinusIcon,+ signed: CheckIcon,+ waiting: ClockIcon,};const timelineToneClasses: Record<TimelineTone, string> = {accent: "bg-(--accent)",- danger: "bg-[rgba(255,0,51,0.7)]",- neutral: "bg-(--border)",- success: "bg-(--signer-4)",+ danger: "bg-(--danger)",+ neutral: "bg-(--border-strong)",+ success: "bg-(--success)",};export function EnvelopeDetailShell({@@ -265,74 +281,150 @@ export function EnvelopeDetailShell({}return (- <div className="space-y-8">- <section className="editorial-panel p-6 sm:p-8" data-animate="enter">+ <div className="space-y-5">+ <section className="panel p-5 sm:p-8" data-animate="enter"><Link- className="inline-flex items-center text-sm font-semibold text-muted-foreground transition hover:text-(--fg)"+ className="inline-flex items-center text-sm font-semibold text-(--secondary) transition hover:text-(--accent-ink)"href="/dashboard">← Documents</Link>- <div className="mt-5 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">- <div className="space-y-2">- <h1- className={`text-[28px] font-semibold tracking-[-0.04em] ${- activeRecord.status === "voided"- ? "text-muted-foreground"- : "text-(--fg)"- }`}- >- {activeRecord.title}- </h1>- <p className="text-sm text-muted-foreground">- Created {activeRecord.createdAtLabel}- </p>+ <div className="mt-5 flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between">+ <div className="flex min-w-0 items-center gap-5">+ <span className="hidden h-28 shrink-0 items-center justify-center rounded-2xl bg-(--surface) px-4 py-3 sm:flex">+ <DocumentThumbnail+ envelopeId={envelopeId}+ title={activeRecord.title}+ />+ </span>+ <div className="min-w-0 space-y-2.5">+ <h1+ className={`text-[clamp(1.5rem,3vw,1.875rem)] font-extrabold leading-tight tracking-[-0.03em] ${+ activeRecord.status === "voided"+ ? "text-(--tertiary)"+ : "text-(--fg)"+ }`}+ >+ {activeRecord.title}+ </h1>+ <div className="flex flex-wrap items-center gap-x-3 gap-y-2">+ <span+ className={`pill ${statusPillClasses[activeRecord.status]}`}+ >+ {statusLabelMap[activeRecord.status]}+ </span>+ <p className="text-sm text-(--secondary)">+ Created {activeRecord.createdAtLabel}+ </p>+ </div>+ </div>+ </div>++ <div className="flex shrink-0 flex-col gap-3 sm:flex-row sm:flex-wrap lg:justify-end">+ {activeRecord.status === "draft" ? (+ <>+ <ShellButton+ onClick={() => setActiveModal("delete-draft")}+ variant="secondary"+ >+ Delete draft+ </ShellButton>+ <ShellButton href={`/envelopes/${envelopeId}/prepare`}>+ Continue editing+ </ShellButton>+ </>+ ) : null}++ {activeRecord.status === "sent" ? (+ <>+ <ShellButton+ onClick={() => setActiveModal("void-envelope")}+ variant="secondary"+ >+ Void envelope+ </ShellButton>+ <ShellButton+ disabled={!activeSigner || reminderLimited}+ loading={isSendingReminder}+ onClick={handleSendReminder}+ >+ Send reminder+ </ShellButton>+ </>+ ) : null}++ {activeRecord.status === "completed" ? (+ <>+ <ShellButton+ onClick={() => handleDownload("evidence")}+ variant="secondary"+ >+ Download certificate+ </ShellButton>+ <ShellButton onClick={() => handleDownload("signed")}>+ <DownloadIcon+ aria-hidden="true"+ className="size-[1.125rem]"+ strokeWidth={2.2}+ />+ Download signed PDF+ </ShellButton>+ </>+ ) : null}++ {activeRecord.status === "declined" ||+ activeRecord.status === "voided" ? (+ <ShellButton+ onClick={() => handleDownload("evidence")}+ variant="secondary"+ >+ Download certificate+ </ShellButton>+ ) : null}</div>- <span- className={`inline-flex w-fit rounded-full px-4 py-2 text-sm font-semibold ${statusBadgeClasses[activeRecord.status]}`}- >- {statusLabelMap[activeRecord.status]}- </span></div>+ {reminderHelperText ? (+ <p className="mt-4 text-sm leading-6 text-(--secondary) lg:text-right">+ {reminderHelperText}+ </p>+ ) : null}+{actionError ? (- <div- className="mt-5 border border-[rgba(180,35,53,0.2)] bg-[rgba(180,35,53,0.05)] px-4 py-3 text-sm font-medium text-(--fg)"- role="alert"- >+ <div className="notice notice-danger mt-5" role="alert">{actionError}</div>) : null}</section>- <section className="grid gap-6 lg:grid-cols-[minmax(0,0.92fr)_minmax(0,1.08fr)]">- <article className="editorial-panel p-6 sm:p-8">+ <section+ className="grid gap-5 lg:grid-cols-[minmax(0,1.08fr)_minmax(0,0.92fr)]"+ data-animate="enter"+ data-animate-delay="1"+ >+ <article className="panel p-5 sm:p-7"><div className="flex items-center justify-between gap-3">- <h2 className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">- Signers- </h2>- <span className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">+ <h2 className="text-lg font-extrabold text-(--fg)">Signers</h2>+ <span className="pill pill-neutral">{activeRecord.signers.length} total</span></div>- <ol className="mt-5 space-y-4">+ <ol className="mt-4 space-y-3">{activeRecord.signers.map((signer, index) => {const palette =signer.color && signer.tint? { color: signer.color, tint: signer.tint }: getSignerPalette(index);+ const StatusIcon = signerStatusIcons[signer.status];return (- <li- className="border border-(--border) bg-(--surface) p-4"- key={signer.id}- >- <div className="flex items-start gap-4">+ <li className="well p-4" key={signer.id}>+ <div className="flex items-start gap-3.5"><spanaria-hidden="true"- className="inline-flex size-11 shrink-0 items-center justify-center rounded-full text-sm font-semibold"+ className="inline-flex size-10 shrink-0 items-center justify-center rounded-full text-sm font-bold"style={{backgroundColor: palette.tint,color: palette.color,@@ -342,20 +434,25 @@ export function EnvelopeDetailShell({</span><div className="min-w-0 flex-1">- <div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">+ <div className="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between"><div className="min-w-0">- <p className="truncate text-base font-semibold text-(--fg)">+ <p className="truncate text-[0.9375rem] font-bold text-(--fg)">{signer.name}</p>- <p className="truncate text-sm text-muted-foreground">+ <p className="truncate text-sm text-(--secondary)">{signer.email}</p></div>- <div className="space-y-2 sm:text-right">+ <div className="flex items-center gap-2 sm:flex-col sm:items-end sm:gap-1.5"><span- className={`inline-flex rounded-none px-3 py-1 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] ${signerStatusBadgeClasses[signer.status]}`}+ className={`pill ${signerStatusPillClasses[signer.status]}`}>+ <StatusIcon+ aria-hidden="true"+ className="size-3.5"+ strokeWidth={2.6}+ />{signerStatusLabelMap[signer.status]}</span>{signer.statusDateLabel ? (@@ -366,7 +463,7 @@ export function EnvelopeDetailShell({</div></div>- <p className="mt-3 text-sm leading-6 text-muted-foreground">+ <p className="mt-2 text-sm leading-6 text-(--secondary)">{signer.metaLabel}</p></div>@@ -377,33 +474,31 @@ export function EnvelopeDetailShell({</ol></article>- <article className="editorial-panel p-6 sm:p-8">+ <article className="panel p-5 sm:p-7"><div className="flex items-center justify-between gap-3">- <h2 className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">- Timeline- </h2>- <span className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">+ <h2 className="text-lg font-extrabold text-(--fg)">Timeline</h2>+ <span className="pill pill-neutral">{activeRecord.timeline.length} events</span></div><ol className="mt-5 space-y-5">{activeRecord.timeline.map((event, index) => (- <li className="relative pl-6" key={event.id}>+ <li className="relative pl-7" key={event.id}><spanaria-hidden="true"- className={`absolute left-0 top-2.5 size-2.5 rounded-full ${timelineToneClasses[event.tone]}`}+ className={`absolute left-0 top-1.5 size-3 rounded-full ring-4 ring-white ${timelineToneClasses[event.tone]}`}/>{index < activeRecord.timeline.length - 1 ? (<spanaria-hidden="true"- className="absolute left-[4.5px] top-5 h-[calc(100%+0.875rem)] w-px bg-(--border)"+ className="absolute left-[5.5px] top-5 h-[calc(100%+0.5rem)] w-px bg-(--border)"/>) : null}- <p className="text-sm font-semibold text-(--fg)">+ <p className="text-[0.8125rem] font-semibold text-(--tertiary)">{event.timestamp}</p>- <p className="mt-1 text-sm leading-6 text-muted-foreground">+ <p className="mt-0.5 text-sm leading-6 text-(--fg)">{event.description}</p></li>@@ -412,73 +507,6 @@ export function EnvelopeDetailShell({</article></section>- <section className="editorial-panel p-6 sm:p-8">- <h2 className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">- Actions- </h2>-- <div className="mt-5 flex flex-wrap gap-3">- {activeRecord.status === "draft" ? (- <>- <ShellButton href={`/envelopes/${envelopeId}/prepare`}>- Continue editing- </ShellButton>- <ShellButton- onClick={() => setActiveModal("delete-draft")}- variant="secondary"- >- Delete draft- </ShellButton>- </>- ) : null}-- {activeRecord.status === "sent" ? (- <>- <ShellButton- disabled={!activeSigner || reminderLimited}- loading={isSendingReminder}- onClick={handleSendReminder}- >- Send reminder- </ShellButton>- <ShellButton- onClick={() => setActiveModal("void-envelope")}- variant="secondary"- >- Void envelope- </ShellButton>- </>- ) : null}-- {activeRecord.status === "completed" ? (- <>- <ShellButton onClick={() => handleDownload("signed")}>- Download signed PDF- </ShellButton>- <ShellButton- onClick={() => handleDownload("evidence")}- variant="secondary"- >- Download certificate- </ShellButton>- </>- ) : null}-- {activeRecord.status === "declined" ||- activeRecord.status === "voided" ? (- <ShellButton onClick={() => handleDownload("evidence")}>- Download certificate- </ShellButton>- ) : null}- </div>-- {reminderHelperText ? (- <p className="mt-4 text-sm leading-6 text-muted-foreground">- {reminderHelperText}- </p>- ) : null}- </section>-{activeModal === "delete-draft" ? (<ConfirmationDialogconfirmLabel="Delete draft"@@ -541,17 +569,12 @@ function ConfirmationDialog({}}}>- <DialogContent- className="max-w-md rounded-none border-(--border) sm:p-8"- showCloseButton={false}- >+ <DialogContent className="max-w-md sm:p-8" showCloseButton={false}><div className="space-y-4"><DialogHeader className="space-y-3">- <DialogTitle className="text-xl tracking-[-0.03em]">- {title}- </DialogTitle>+ <DialogTitle>{title}</DialogTitle><DialogDescription asChild>- <div className="space-y-3 text-sm leading-6 text-muted-foreground">+ <div className="space-y-2 text-sm leading-6 text-(--secondary)">{description.map((line) => (<p key={line}>{line}</p>))}@@ -560,17 +583,12 @@ function ConfirmationDialog({</DialogHeader>{errorMessage ? (- <div- className="border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-4 py-3"- role="alert"- >- <p className="text-sm font-semibold text-(--accent)">- {errorMessage}- </p>+ <div className="notice notice-danger" role="alert">+ <p>{errorMessage}</p></div>) : null}- <div className="flex flex-wrap justify-end gap-3 pt-2">+ <div className="flex flex-col-reverse gap-3 pt-2 sm:flex-row sm:justify-end"><ShellButtondisabled={processing}onClick={onCancel}@@ -578,7 +596,11 @@ function ConfirmationDialog({>Cancel</ShellButton>- <ShellButton loading={processing} onClick={onConfirm}>+ <ShellButton+ loading={processing}+ onClick={onConfirm}+ variant="danger"+ >{processing ? `${confirmLabel}...` : confirmLabel}</ShellButton></div>diff --git a/src/components/envelopes/interactive-placed-field.tsx b/src/components/envelopes/interactive-placed-field.tsxindex 1cc54b2..2ef9e21 100644--- a/src/components/envelopes/interactive-placed-field.tsx+++ b/src/components/envelopes/interactive-placed-field.tsx@@ -207,9 +207,9 @@ export function InteractivePlacedField({aria-pressed={isSelected}className={`absolute z-2 flex touch-none select-none items-center justify-center overflow-visible border-2 text-center text-[11px] font-semibold shadow-(--shadow-card) transition ${isSelected- ? "ring-2 ring-[rgba(17,17,17,0.12)]"- : "hover:ring-1 hover:ring-[rgba(17,17,17,0.08)]"- } cursor-grab ${isCheckbox ? "rounded-none p-0" : "rounded-none px-2 py-1"}`}+ ? "ring-4 ring-[rgba(28,29,43,0.10)]"+ : "hover:ring-2 hover:ring-[rgba(28,29,43,0.08)]"+ } cursor-grab ${isCheckbox ? "rounded-[0.25rem] p-0" : "rounded-[0.375rem] px-2 py-1"}`}onKeyDown={handleKeyboardSelect}onPointerCancel={endGesture}onPointerDown={(event) => beginGesture(event, "move")}@@ -238,7 +238,7 @@ export function InteractivePlacedField({? resizeHandles.map((handle) => (<buttonaria-label={`Resize ${label} field from ${handle.corner}`}- className={`absolute ${handle.positionClassName} ${handle.cursorClassName} z-1 size-4 rounded-full bg-white shadow-[0_4px_10px_rgba(17,17,17,0.18)]`}+ className={`absolute ${handle.positionClassName} ${handle.cursorClassName} z-1 size-4 rounded-full bg-white shadow-[0_4px_10px_rgba(28,29,43,0.18)]`}key={handle.corner}onPointerCancel={endGesture}onPointerDown={(event) => beginGesture(event, "resize", handle.corner)}diff --git a/src/components/envelopes/pdf-page-canvas.tsx b/src/components/envelopes/pdf-page-canvas.tsxindex 2252580..7da7024 100644--- a/src/components/envelopes/pdf-page-canvas.tsx+++ b/src/components/envelopes/pdf-page-canvas.tsx@@ -245,14 +245,14 @@ export function PdfPageCanvas({ref={canvasRef}/>{renderState !== "ready" ? (- <div className="absolute inset-0 z-1 flex items-center justify-center rounded-[28px] bg-white/92 px-6 text-center">- <div className="max-w-[320px] rounded-[24px] border border-(--border) bg-(--surface) px-5 py-4 shadow-(--shadow-card)">- <p className="text-sm font-semibold text-(--fg)">+ <div className="absolute inset-0 z-1 flex items-center justify-center bg-white/92 px-6 text-center">+ <div className="well max-w-[320px] px-5 py-4">+ <p className="text-sm font-bold text-(--fg)">{renderState === "error"? "We couldn't render this PDF page.": "Rendering document page..."}</p>- <p className="mt-2 text-sm leading-6 text-muted-foreground">+ <p className="mt-1.5 text-sm leading-6 text-(--secondary)">{renderState === "error"? "Reload the page or try this draft again in a moment.": "Preparing the source PDF so placed fields stay aligned with the stored page size."}diff --git a/src/components/envelopes/prepare-live-shell.tsx b/src/components/envelopes/prepare-live-shell.tsxindex 0089d0b..42397bc 100644--- a/src/components/envelopes/prepare-live-shell.tsx+++ b/src/components/envelopes/prepare-live-shell.tsx@@ -1,5 +1,13 @@"use client";+import {+ CalendarIcon,+ CaseSensitiveIcon,+ SignatureIcon,+ SquareCheckIcon,+ TypeIcon,+ type LucideIcon,+} from "lucide-react";import {useEffect,useRef,@@ -17,6 +25,7 @@ import {type ReplaceFieldsResponse,} from "@/lib/schemas/field";import { CanvasShell } from "@/components/layout/canvas-shell";+import { Button } from "@/components/ui/button";import {ChevronLeftIcon,ChevronRightIcon,@@ -308,23 +317,23 @@ function PrepareLiveShellError({ envelopeId }: { envelopeId: string }) {title='"Document"'><div className="flex min-h-[calc(100vh-73px)] items-center justify-center p-4 sm:p-6 lg:p-8">- <section className="app-surface-strong w-full max-w-[520px] p-8 text-center sm:p-10">- <div className="mx-auto inline-flex size-16 items-center justify-center rounded-full bg-[rgba(180,35,53,0.1)] text-lg font-semibold text-(--accent)">+ <section className="panel w-full max-w-[520px] p-8 text-center sm:p-10">+ <div className="mx-auto inline-flex size-14 items-center justify-center rounded-2xl bg-(--danger-soft) text-lg font-extrabold text-(--danger)">!</div>- <h1 className="mt-6 text-[28px] font-semibold tracking-[-0.04em] text-(--fg)">+ <h1 className="mt-5 text-2xl font-extrabold tracking-[-0.03em] text-(--fg)">Couldn't load this document</h1>- <p className="mt-3 text-sm leading-6 text-muted-foreground">+ <p className="mt-2 text-sm leading-6 text-(--secondary)">Something went wrong. Please try again.</p>- <button- className="mt-8 inline-flex min-h-11 items-center justify-center rounded-full bg-(--accent) px-5 text-sm font-semibold text-white shadow-[0_14px_28px_rgba(180,35,53,0.22)] transition hover:bg-(--accent-hover)"+ <Button+ className="mt-7"onClick={() => window.location.reload()}type="button">Retry- </button>+ </Button></section></div></CanvasShell>@@ -633,14 +642,12 @@ function PrepareLiveShellContent({stepLabel="Step 3 of 4"title={`"${record.title}"`}>- <div className="grid min-h-[calc(100vh-73px)] lg:grid-cols-[280px_minmax(0,1fr)_320px]">- <aside className="hidden border-r border-(--border) bg-[rgba(251,248,242,0.88)] lg:block">- <div className="flex h-full flex-col gap-8 p-5">- <section className="space-y-4">- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Fields- </p>- <div className="grid gap-3">+ <div className="grid min-h-[calc(100vh-73px)] lg:grid-cols-[272px_minmax(0,1fr)_304px]">+ <aside className="hidden lg:block">+ <div className="sticky top-[4.5rem] flex max-h-[calc(100vh-4.5rem)] flex-col gap-4 overflow-y-auto py-5 pl-5">+ <section className="panel space-y-3 rounded-[1.25rem] p-4">+ <p className="section-eyebrow px-1">Fields</p>+ <div className="grid gap-2">{fieldTools.map((tool) => (<FieldToolButtonisActive={armedTool === tool.type}@@ -659,16 +666,16 @@ function PrepareLiveShellContent({</div></section>- <section className="space-y-4 border-t border-(--border) pt-6">- <div className="flex items-center justify-between">- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Signers- </p>+ <section className="panel space-y-3 rounded-[1.25rem] p-4">+ <div className="flex items-center justify-between px-1">+ <p className="section-eyebrow">Signers</p><span className="text-xs font-medium text-(--tertiary)">- {fields.length} fields placed+ {fields.length === 1+ ? "1 field placed"+ : `${String(fields.length)} fields placed`}</span></div>- <div className="space-y-3">+ <div className="space-y-2">{signers.map((signer) => {const signerFields = fields.filter((field) => field.signerId === signer.id,@@ -692,8 +699,8 @@ function PrepareLiveShellContent({</div></aside>- <section className="flex min-w-0 flex-col gap-4 p-4 sm:p-6 lg:p-8">- <div className="editorial-panel px-4 py-3 sm:px-5">+ <section className="flex min-w-0 flex-col gap-4 p-4 sm:p-5">+ <div className="panel rounded-[1.25rem] px-4 py-3"><div className="flex flex-col gap-3 lg:grid lg:grid-cols-[1fr_auto_1fr] lg:items-center"><div className="flex justify-center lg:justify-start"><DocumentZoomControls@@ -719,7 +726,7 @@ function PrepareLiveShellContent({<div className="flex items-center justify-center gap-3"><buttonaria-label="Previous page"- className="inline-flex size-11 items-center justify-center rounded-none border border-(--border) bg-white text-muted-foreground transition hover:border-black hover:bg-white disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet size-10 px-0"disabled={activePage === 1}onClick={() =>changePage(@@ -734,17 +741,15 @@ function PrepareLiveShellContent({><ChevronLeftIcon className="size-4" /></button>- <div className="min-w-[132px] text-center">- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">- Document page- </p>- <p className="mt-1 text-sm font-semibold text-(--fg)">+ <div className="min-w-[7.5rem] text-center">+ <p className="sr-only">Document page</p>+ <p className="text-sm font-bold text-(--fg)">{`Page ${activePage} of ${pageCount}`}</p></div><buttonaria-label="Next page"- className="inline-flex size-11 items-center justify-center rounded-none border border-(--border) bg-white text-muted-foreground transition hover:border-black hover:bg-white disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet size-10 px-0"disabled={activePage === pageCount}onClick={() =>changePage(@@ -771,15 +776,15 @@ function PrepareLiveShellContent({</div></div>- <div className="editorial-panel p-4 lg:hidden">- <div className="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">- <label className="grid gap-2 text-sm">- <span className="font-semibold text-(--fg)">+ <div className="panel rounded-[1.25rem] p-4 lg:hidden">+ <div className="flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between">+ <label className="grid flex-1 gap-1.5">+ <span className="text-[0.8125rem] font-semibold text-(--secondary)">Selected signer</span><selectaria-label="Selected signer"- className="min-h-12 rounded-none border border-(--border) bg-popover px-4 text-(--fg)"+ className="field-input"onChange={(event) => setSelectedSignerId(event.target.value)}value={selectedSignerId}>@@ -790,19 +795,20 @@ function PrepareLiveShellContent({))}</select></label>- <button- className="inline-flex min-h-11 items-center justify-center rounded-none border border-(--border) bg-(--surface) px-5 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-(--fg) transition hover:border-black hover:bg-white"+ <Button+ className="min-h-12"onClick={() => setIsMobileToolsOpen(true)}type="button"+ variant="secondary">Open field tools- </button>+ </Button></div></div>- <div className="editorial-panel p-3 sm:p-4">+ <div className="panel overflow-hidden rounded-[1.25rem]"><div- className={`relative overflow-auto border border-(--border) bg-(--surface) p-3 sm:p-5 ${+ className={`relative overflow-auto p-3 sm:p-6 ${zoomLevel > DEFAULT_DOCUMENT_ZOOM_LEVEL && !armedTool? isDocumentPanning? "cursor-grabbing"@@ -820,7 +826,7 @@ function PrepareLiveShellContent({className={`mx-auto ${zoomLevel > DEFAULT_DOCUMENT_ZOOM_LEVEL ? "w-full" : "flex justify-center"}`}><div- className="relative border border-[rgba(17,17,17,0.08)] bg-white"+ className="relative overflow-hidden rounded-md bg-white shadow-[0_1px_2px_rgba(28,29,43,0.08),0_12px_32px_rgba(28,29,43,0.12)]"style={{width: `${zoomLevel * 100}%`,}}@@ -847,7 +853,7 @@ function PrepareLiveShellContent({{armedTool ? (<buttonaria-label={`Place ${getFieldTool(armedTool).label} on page ${activePage}`}- className="absolute inset-0 z-10 cursor-copy rounded-[28px] bg-transparent"+ className="absolute inset-0 z-10 cursor-copy bg-transparent"onClick={(event) =>placeField(event,@@ -871,11 +877,11 @@ function PrepareLiveShellContent({{fields.length === 0 ? (<div className="absolute inset-0 z-1 flex items-center justify-center px-6">- <div className="max-w-[300px] border border-dashed border-[rgba(17,17,17,0.12)] bg-white/92 px-6 py-8 text-center">- <p className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">+ <div className="max-w-[300px] rounded-[1.25rem] border-2 border-dashed border-(--border-strong) bg-white/92 px-6 py-7 text-center">+ <p className="text-lg font-extrabold tracking-[-0.02em] text-(--fg)">No fields placed yet</p>- <p className="mt-3 text-sm leading-6 text-muted-foreground">+ <p className="mt-2 text-sm leading-6 text-(--secondary)">Pick a field, then click the page to place it forthe selected signer.</p>@@ -919,11 +925,11 @@ function PrepareLiveShellContent({})}{armedTool ? (- <div className="pointer-events-none absolute inset-x-4 bottom-4 z-11 border border-[rgba(180,35,53,0.12)] bg-white/94 px-4 py-3 sm:inset-x-6 sm:bottom-6">- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--accent)">+ <div className="pointer-events-none absolute inset-x-4 bottom-4 z-11 rounded-2xl bg-white/95 px-4 py-3 shadow-(--shadow-lift) ring-1 ring-[rgba(83,64,214,0.18)] sm:inset-x-6 sm:bottom-6">+ <p className="text-[0.8125rem] font-bold text-(--accent-ink)">Ready to place</p>- <p className="mt-2 text-sm text-muted-foreground">+ <p className="mt-1 text-sm text-(--secondary)">Click the page to place{" "}<span className="font-semibold text-(--fg)">{getFieldTool(armedTool).label}@@ -943,7 +949,7 @@ function PrepareLiveShellContent({</div>{selectedField ? (- <div className="editorial-panel p-4 lg:hidden">+ <div className="panel rounded-[1.25rem] p-4 lg:hidden"><FieldEditorfield={selectedField}onDelete={() =>@@ -969,13 +975,11 @@ function PrepareLiveShellContent({</div></section>- <aside className="hidden border-l border-(--border) bg-white/92 lg:block">- <div className="flex h-full flex-col gap-6 p-5">- <section className="space-y-4">- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Inspector- </p>- <div className="border border-(--border) bg-(--surface) p-4">+ <aside className="hidden lg:block">+ <div className="sticky top-[4.5rem] flex max-h-[calc(100vh-4.5rem)] flex-col gap-4 overflow-y-auto py-5 pr-5">+ <section className="panel space-y-3 rounded-[1.25rem] p-4">+ <p className="section-eyebrow px-1">Inspector</p>+ <div>{selectedField ? (<FieldEditorfield={selectedField}@@ -1016,30 +1020,28 @@ function PrepareLiveShellContent({<div className="fixed inset-0 z-40 lg:hidden"><buttonaria-label="Close field tools"- className="absolute inset-0 bg-[rgba(17,17,17,0.36)]"+ className="absolute inset-0 bg-[rgba(28,29,43,0.32)]"onClick={() => setIsMobileToolsOpen(false)}type="button"/><divaria-label="Field tools"- className="absolute inset-x-0 bottom-0 rounded-t-[32px] border border-(--border) bg-[rgba(255,255,255,0.94)] px-4 py-5 shadow-[0_-24px_60px_rgba(17,17,17,0.18)]"+ className="absolute inset-x-0 bottom-0 rounded-t-[1.75rem] bg-white px-4 py-5 shadow-[0_-24px_60px_rgba(28,29,43,0.18)]"role="dialog">- <div className="mx-auto mb-4 h-1.5 w-14 rounded-full bg-(--border)" />+ <div className="mx-auto mb-4 h-1.5 w-12 rounded-full bg-(--surface-strong)" /><div className="space-y-4"><div className="flex items-center justify-between">- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Fields- </p>+ <p className="section-eyebrow">Fields</p><button- className="text-sm font-semibold text-muted-foreground"+ className="text-sm font-bold text-(--accent-ink)"onClick={() => setIsMobileToolsOpen(false)}type="button">Done</button></div>- <div className="grid gap-3 sm:grid-cols-2">+ <div className="grid gap-2 sm:grid-cols-2">{fieldTools.map((tool) => (<FieldToolButtonisActive={armedTool === tool.type}@@ -1064,22 +1066,44 @@ function PrepareLiveShellContent({);}+const fieldToolIcons: Record<PrepareFieldType, LucideIcon> = {+ checkbox: SquareCheckIcon,+ date: CalendarIcon,+ initials: CaseSensitiveIcon,+ signature: SignatureIcon,+ text: TypeIcon,+};+function FieldToolButton({ isActive, onSelect, tool }: FieldToolButtonProps) {+ const Icon = fieldToolIcons[tool.type];+return (<buttonaria-label={tool.label}aria-pressed={isActive}- className={`flex min-h-12 items-center justify-between rounded-none border px-4 text-left text-sm font-semibold transition ${+ className={`flex min-h-12 items-center gap-3 rounded-[0.875rem] px-2.5 text-left text-sm font-bold transition ${isActive- ? "border-[rgba(180,35,53,0.28)] bg-[rgba(180,35,53,0.08)] text-(--fg)"- : "border-(--border) bg-(--surface) text-(--fg) hover:border-[rgba(17,17,17,0.16)] hover:bg-white"+ ? "bg-(--accent) text-white shadow-(--shadow-sm)"+ : "bg-(--surface) text-(--fg) hover:bg-(--accent-softer) hover:text-(--accent-ink)"}`}onClick={onSelect}type="button">- <span>{tool.label}</span>- <span className="text-xs uppercase tracking-[0.16em] text-(--tertiary)">- Place+ <span+ aria-hidden="true"+ className={`inline-flex size-8 shrink-0 items-center justify-center rounded-[0.625rem] ${+ isActive ? "bg-white/20 text-white" : "bg-white text-(--accent)"+ }`}+ >+ <Icon className="size-4" strokeWidth={2.2} />+ </span>+ <span className="flex-1">{tool.label}</span>+ <span+ className={`pr-1.5 text-xs font-semibold ${+ isActive ? "text-white/85" : "text-(--tertiary)"+ }`}+ >+ {isActive ? "Placing" : "Place"}</span></button>);@@ -1095,17 +1119,17 @@ function SignerCard({return (<buttonaria-pressed={isActive}- className={`w-full border px-4 py-4 text-left transition ${+ className={`w-full rounded-[0.875rem] px-3 py-3 text-left transition ${isActive- ? "border-black bg-white"- : "border-(--border) bg-white hover:border-[rgba(17,17,17,0.16)]"+ ? "bg-(--accent-softer) ring-2 ring-(--accent)"+ : "bg-(--surface) hover:bg-(--accent-softer)"}`}onClick={onSelect}type="button"><div className="flex items-start gap-3"><span- className="mt-0.5 inline-flex size-10 items-center justify-center rounded-full text-sm font-semibold"+ className="mt-0.5 inline-flex size-9 shrink-0 items-center justify-center rounded-full text-[0.8125rem] font-bold"style={{backgroundColor: signer.tint,color: signer.color,@@ -1117,15 +1141,14 @@ function SignerCard({.join("")}</span><div className="min-w-0">- <p className="text-sm font-semibold text-(--fg)">{signer.name}</p>- <p className="mt-1 text-xs text-muted-foreground">+ <p className="truncate text-sm font-bold text-(--fg)">{signer.name}</p>+ <p className="mt-0.5 text-xs text-(--secondary)">{fieldCount} field{fieldCount === 1 ? "" : "s"} placed</p><p- className="mt-2 text-xs font-semibold uppercase tracking-[0.18em]"- style={{- color: hasSignatureField ? signer.color : "var(--accent)",- }}+ className={`mt-1.5 text-xs font-bold ${+ hasSignatureField ? "text-(--success)" : "text-(--danger)"+ }`}>{hasSignatureField ? "Signature ready" : "Signature needed"}</p>@@ -1145,11 +1168,11 @@ function EmptyFieldInspector({const activeTool = armedTool ? getFieldTool(armedTool) : null;return (- <div className="border border-dashed border-(--border) bg-[rgba(247,247,248,0.92)] px-4 py-5">- <p className="text-sm font-semibold text-(--fg)">+ <div className="well px-4 py-4">+ <p className="text-sm font-bold text-(--fg)">{activeTool ? `${activeTool.label} ready to place` : "No field selected"}</p>- <p className="mt-3 text-sm leading-6 text-muted-foreground">+ <p className="mt-1.5 text-sm leading-6 text-(--secondary)">{activeTool? `Click the document to place ${activeTool.label.toLowerCase()} for ${selectedSigner.name}.`: "Select a field on the page to edit its settings, or choose a field tool on the left to place a new one."}@@ -1168,13 +1191,11 @@ function SelectedSignerPanel({const activeTool = armedTool ? getFieldTool(armedTool) : null;return (- <section className="space-y-4 border border-(--border) bg-(--surface) p-4">- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Selected signer- </p>- <div className="flex items-center gap-3">+ <section className="panel space-y-3 rounded-[1.25rem] p-4">+ <p className="section-eyebrow px-1">Selected signer</p>+ <div className="flex items-center gap-3 px-1"><span- className="inline-flex size-10 items-center justify-center rounded-full text-sm font-semibold"+ className="inline-flex size-10 shrink-0 items-center justify-center rounded-full text-sm font-bold"style={{backgroundColor: selectedSigner.tint,color: selectedSigner.color,@@ -1186,10 +1207,10 @@ function SelectedSignerPanel({.join("")}</span><div className="min-w-0">- <p className="text-sm font-semibold text-(--fg)">+ <p className="truncate text-sm font-bold text-(--fg)">{selectedSigner.name}</p>- <p className="mt-1 text-sm text-muted-foreground">+ <p className="mt-0.5 text-[0.8125rem] text-(--secondary)">{activeTool? `Placing ${activeTool.label.toLowerCase()}`: "New fields will be assigned here"}@@ -1215,10 +1236,8 @@ function SaveStatusIndicator({return (<divaria-live="polite"- className={`inline-flex min-h-11 items-center gap-3 border px-3 py-2 text-sm ${- isError- ? "border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.06)]"- : "border-(--border) bg-white"+ className={`inline-flex min-h-10 items-center gap-2.5 rounded-full px-3.5 py-1.5 text-[0.8125rem] ${+ isError ? "bg-(--danger-soft)" : "bg-(--surface)"}`}role={isError ? "alert" : "status"}>@@ -1226,16 +1245,16 @@ function SaveStatusIndicator({aria-hidden="true"className={`inline-flex size-5 items-center justify-center rounded-full ${isError- ? "bg-[rgba(180,35,53,0.12)] text-(--accent)"+ ? "bg-white text-(--danger)": isSaving- ? "bg-[rgba(17,17,17,0.04)] text-(--fg)"- : "bg-[rgba(24,132,74,0.12)] text-[rgb(24,132,74)]"+ ? "text-(--secondary)"+ : "bg-(--success-soft) text-(--success)"}`}>{isError ? (- <span className="text-[13px] font-semibold leading-none">!</span>+ <span className="text-[13px] font-bold leading-none">!</span>) : isSaving ? (- <span className="size-3.5 animate-spin rounded-full border-2 border-[rgba(17,17,17,0.18)] border-t-(--fg)" />+ <span className="size-3.5 animate-spin rounded-full border-2 border-(--border-strong) border-t-(--accent)" />) : (<svgaria-hidden="true"@@ -1254,16 +1273,16 @@ function SaveStatusIndicator({)}</span><div className="min-w-0">- <p className="font-semibold text-(--fg)">+ <p className="font-bold text-(--fg)">{isError ? "Save failed" : isSaving ? "Saving..." : "Saved"}</p>{saveError ? (- <p className="truncate text-xs text-(--accent)">{saveError}</p>+ <p className="truncate text-xs text-(--danger)">{saveError}</p>) : null}</div>{isError ? (<button- className="inline-flex min-h-9 items-center justify-center border border-[rgba(180,35,53,0.14)] bg-white px-3 [font-family:var(--font-mono)] text-[0.68rem] font-semibold uppercase tracking-[0.16em] text-(--accent)"+ className="btn-quiet btn-quiet-danger min-h-8 px-3 text-xs"onClick={onRetrySave}type="button">@@ -1286,78 +1305,84 @@ function FieldEditor({return (<section aria-label="Field settings" role="region">- <div>- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">- Field settings+ <div className="px-1">+ <p className="section-eyebrow">Field settings</p>+ <p className="mt-1 text-base font-extrabold text-(--fg)">+ {tool.label}</p>- <p className="mt-2 text-sm font-semibold text-(--fg)">{tool.label}</p></div><div className="mt-4 space-y-4"><div>- <p className="text-xs font-semibold uppercase tracking-[0.2em] text-(--tertiary)">+ <p className="px-1 text-[0.8125rem] font-semibold text-(--secondary)">Assigned to</p>- <div className="mt-3 grid gap-2 sm:grid-cols-2">- {signers.map((signer) => (- <button- className={`min-h-11 rounded-none border px-3 text-sm font-semibold transition ${- field.signerId === signer.id- ? "border-transparent bg-(--fg) text-white"- : "border-(--border) bg-(--surface) text-(--fg) hover:bg-white"- }`}- key={signer.id}- onClick={() => onSignerChange(signer.id)}- type="button"- >- {signer.name}- </button>- ))}+ <div className="mt-2 grid gap-2">+ {signers.map((signer) => {+ const isAssigned = field.signerId === signer.id;++ return (+ <button+ aria-pressed={isAssigned}+ className={`flex min-h-11 items-center gap-2.5 rounded-xl px-3 text-left text-sm font-bold transition ${+ isAssigned+ ? "bg-(--accent-softer) text-(--fg) ring-2 ring-(--accent)"+ : "bg-(--surface) text-(--fg) hover:bg-(--accent-softer)"+ }`}+ key={signer.id}+ onClick={() => onSignerChange(signer.id)}+ type="button"+ >+ <span+ aria-hidden="true"+ className="size-2.5 shrink-0 rounded-full"+ style={{ backgroundColor: signer.color }}+ />+ <span className="truncate">{signer.name}</span>+ </button>+ );+ })}</div></div>{isOptionalField ? (<div>- <div className="border border-(--border) bg-(--surface) px-4 py-3">- <p className="text-xs font-semibold uppercase tracking-[0.2em] text-(--tertiary)">- Required- </p>- <div className="mt-3 grid gap-2 sm:grid-cols-2">- {[- {- label: "Required",- value: true,- },- {- label: "Optional",- value: false,- },- ].map((option) => (- <button- className={`min-h-11 rounded-none border px-3 text-sm font-semibold transition ${- field.required === option.value- ? "border-transparent bg-(--fg) text-white"- : "border-(--border) bg-(--surface) text-(--fg) hover:bg-white"- }`}- key={option.label}- onClick={() => onSetRequired(option.value)}- type="button"- >- {option.label}- </button>- ))}- </div>+ <p className="px-1 text-[0.8125rem] font-semibold text-(--secondary)">+ Required+ </p>+ <div className="segmented mt-2 flex w-full">+ {[+ {+ label: "Required",+ value: true,+ },+ {+ label: "Optional",+ value: false,+ },+ ].map((option) => (+ <button+ aria-pressed={field.required === option.value}+ className="segmented-item flex-1"+ key={option.label}+ onClick={() => onSetRequired(option.value)}+ type="button"+ >+ {option.label}+ </button>+ ))}</div></div>) : null}- <button- className="inline-flex min-h-11 w-full items-center justify-center rounded-none border border-[rgba(180,35,53,0.16)] bg-[rgba(180,35,53,0.08)] px-5 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-(--accent) transition hover:bg-[rgba(180,35,53,0.14)]"+ <Button+ className="w-full bg-(--danger-soft) text-(--danger) hover:bg-[#fbd9d6]"onClick={onDelete}type="button"+ variant="ghost">Delete- </button>+ </Button></div></section>);diff --git a/src/components/envelopes/review-shell.tsx b/src/components/envelopes/review-shell.tsxindex 75b3f4f..5411333 100644--- a/src/components/envelopes/review-shell.tsx+++ b/src/components/envelopes/review-shell.tsx@@ -3,6 +3,7 @@import { useEffect, useRef, useState } from "react";import { useBranding } from "@/components/layout/branding-provider";+import { DocumentThumbnail } from "@/components/shared/document-thumbnail";import { ShellButton } from "@/components/shared/form-shell";import { PageHeader } from "@/components/shared/page-header";import { StatusPanel } from "@/components/shared/status-panel";@@ -147,7 +148,7 @@ export function ReviewShell({if (initialState === "error") {return (- <div className="space-y-6">+ <div className="space-y-5"><PageHeaderdescription="Step 4 of 4 - Review and send"title="New envelope"@@ -172,7 +173,7 @@ export function ReviewShell({if (!record || record.isEmpty) {return (- <div className="space-y-6">+ <div className="space-y-5"><PageHeaderdescription="Step 4 of 4 - Review and send"title="New envelope"@@ -203,60 +204,60 @@ export function ReviewShell({const firstSigner = activeRecord.signers[0];return (- <div className="space-y-8">+ <div className="space-y-5"><PageHeaderdescription="Step 4 of 4 - Review and send"- eyebrow="Envelope workflow"title="New envelope"/><StepIndicator current={4} steps={envelopeSteps} />{notice ? (- <section- className="border border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.05)] px-5 py-4"- role="status"- >- <p className="text-sm font-semibold text-chart-4">{notice}</p>- <p className="mt-1 text-sm leading-6 text-muted-foreground">+ <section className="notice notice-success" role="status">+ <p>{notice}</p>+ <p className="mt-0.5 font-medium text-(--secondary)">Opening the envelope detail view...</p></section>) : null}<section- className="editorial-panel p-6 sm:p-8"+ className="panel p-5 sm:p-8"data-animate="enter"data-animate-delay="2">- <div className="grid gap-6 xl:grid-cols-[minmax(0,0.42fr)_minmax(0,0.58fr)]">- <article className="border border-(--border) bg-(--surface) p-5 sm:p-6">- <div className="space-y-3">- <p className="section-eyebrow">Document</p>- <div className="space-y-2">- <h2 className="text-[24px] font-semibold tracking-[-0.04em] text-(--fg)">- {activeRecord.title}- </h2>- <p className="text-sm leading-6 text-muted-foreground">- {activeRecord.filename} - {activeRecord.pageCount} pages -{" "}- {activeRecord.sizeLabel}- </p>- </div>+ <div className="grid gap-5 lg:grid-cols-[minmax(0,0.4fr)_minmax(0,0.6fr)]">+ <article className="well flex flex-col gap-5 p-5 sm:p-6">+ <p className="section-eyebrow">Document</p>+ <div className="flex h-56 items-center justify-center">+ <DocumentThumbnail+ envelopeId={envelopeId}+ title={activeRecord.title}+ />+ </div>+ <div className="space-y-1.5">+ <h2 className="text-[1.375rem] font-extrabold leading-tight text-(--fg)">+ {activeRecord.title}+ </h2>+ <p className="text-sm leading-6 text-(--secondary)">+ {activeRecord.filename} - {activeRecord.pageCount} pages -{" "}+ {activeRecord.sizeLabel}+ </p></div></article>- <article className="border border-(--border) bg-white p-5 sm:p-6">- <div className="flex items-center justify-between gap-3">- <h2 className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">+ <article className="min-w-0">+ <div className="flex items-center justify-between gap-3 px-1">+ <h2 className="text-lg font-extrabold text-(--fg)">Signing order</h2>- <span className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">+ <span className="pill pill-neutral">{activeRecord.signers.length}{" "}{activeRecord.signers.length === 1 ? "signer" : "signers"}</span></div>- <ol className="mt-5 space-y-4">+ <ol className="mt-4 space-y-3">{activeRecord.signers.map((signer, index) => {const palette =signer.color && signer.tint@@ -264,13 +265,10 @@ export function ReviewShell({: getSignerPalette(index);return (- <li- className="border border-(--border) bg-(--surface) p-4"- key={signer.id}- >- <div className="flex items-start gap-4">+ <li className="well p-4" key={signer.id}>+ <div className="flex items-start gap-3.5"><span- className="inline-flex size-11 shrink-0 items-center justify-center rounded-full text-sm font-semibold"+ className="inline-flex size-10 shrink-0 items-center justify-center rounded-full text-sm font-bold"style={{backgroundColor: palette.tint,color: palette.color,@@ -282,15 +280,15 @@ export function ReviewShell({<div className="min-w-0 flex-1"><div className="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between"><div className="min-w-0">- <p className="truncate text-base font-semibold text-(--fg)">+ <p className="truncate text-[0.9375rem] font-bold text-(--fg)">{signer.name}</p>- <p className="truncate text-sm text-muted-foreground">+ <p className="truncate text-sm text-(--secondary)">{signer.email}</p></div><span- className="inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-semibold uppercase tracking-[0.18em]"+ className="pill w-fit"style={{backgroundColor: palette.tint,color: palette.color,@@ -306,10 +304,10 @@ export function ReviewShell({</div><p- className={`mt-3 text-sm leading-6 ${+ className={`mt-2 text-sm leading-6 ${signer.fieldSummaries.includes("Signature")- ? "text-muted-foreground"- : "font-semibold text-(--accent)"+ ? "text-(--tertiary)"+ : "font-semibold text-(--danger)"}`}>{formatSignerFieldSummary(signer.fieldSummaries)}@@ -320,25 +318,18 @@ export function ReviewShell({);})}</ol>- </article>- </div>- <div className="mt-6 border border-(--border) bg-white px-5 py-5 sm:px-6">- <p className="text-sm leading-7 text-muted-foreground">- After you send, Signer 1 will receive an email with a link to sign.- Each signer is notified in order after the previous signer- completes.- </p>+ <p className="notice notice-accent mt-4 font-medium">+ After you send, Signer 1 will receive an email with a link to+ sign. Each signer is notified in order after the previous signer+ completes.+ </p>+ </article></div>{disabledReason ? (- <div- className="mt-6 border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-5 py-4"- role="alert"- >- <p className="text-sm font-semibold text-(--accent)">- {disabledReason}- </p>+ <div className="notice notice-danger mt-5" role="alert">+ <p>{disabledReason}</p></div>) : null}@@ -402,16 +393,16 @@ function SendConfirmationDialog({}}><DialogContent- className="max-w-md rounded-none border-(--border) sm:p-8"+ className="max-w-md sm:p-8"showCloseButton={false}><div className="space-y-4"><DialogHeader className="space-y-3">- <DialogTitle className="text-xl tracking-[-0.03em]">+ <DialogTitle>Send this envelope?</DialogTitle><DialogDescription asChild>- <div className="space-y-3 text-sm leading-6 text-muted-foreground">+ <div className="space-y-3 text-sm leading-6 text-(--secondary)"><p>"{title}" will be sent to {signerCount}{" "}{signerCount === 1 ? "signer" : "signers"}.{" "}@@ -423,7 +414,7 @@ function SendConfirmationDialog({</DialogDescription></DialogHeader>- <label className="block border border-(--border) bg-(--surface) px-4 py-4">+ <label className="well block px-4 py-4"><span className="flex items-start gap-3"><CheckboxautoFocus@@ -434,7 +425,7 @@ function SendConfirmationDialog({setIsPermittedUseConfirmed(checked === true)}/>- <span className="text-sm leading-6 text-muted-foreground">+ <span className="text-sm leading-6 text-(--secondary)">By sending, you confirm this document is an ordinary businessagreement and not a will, court order, legally required consumerdisclosure, or other@@ -443,15 +434,9 @@ function SendConfirmationDialog({{" "}excluded document type described in the{" "}<a- className="font-semibold text-(--fg)"+ className="font-semibold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4"href={termsUrl}rel="noreferrer"- style={{- textDecorationColor: "rgba(17,17,17,0.35)",- textDecorationLine: "underline",- textDecorationThickness: "1px",- textUnderlineOffset: "4px",- }}target="_blank">Terms of Service@@ -466,17 +451,12 @@ function SendConfirmationDialog({</label>{errorMessage ? (- <div- className="border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-4 py-3"- role="alert"- >- <p className="text-sm font-semibold text-(--accent)">- {errorMessage}- </p>+ <div className="notice notice-danger" role="alert">+ <p>{errorMessage}</p></div>) : null}- <div className="flex flex-wrap justify-end gap-3 pt-2">+ <div className="flex flex-col-reverse gap-3 pt-2 sm:flex-row sm:justify-end"><ShellButtondisabled={isSending}onClick={onCancel}diff --git a/src/components/envelopes/signers-shell.tsx b/src/components/envelopes/signers-shell.tsxindex 094f03f..5baa735 100644--- a/src/components/envelopes/signers-shell.tsx+++ b/src/components/envelopes/signers-shell.tsx@@ -228,12 +228,12 @@ function SignerCard({: `Receives the document after Signer ${order - 1} finishes.`;return (- <li className="border border-(--border) bg-white p-5 sm:p-6">+ <li className="well p-4 sm:p-5"><div className="flex flex-col gap-4">- <div className="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">- <div className="space-y-3">+ <div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">+ <div className="space-y-1.5"><span- className="inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-semibold uppercase tracking-[0.22em]"+ className="pill"style={{backgroundColor: palette.tint,color: palette.color,@@ -246,7 +246,7 @@ function SignerCard({/>Signer {order}</span>- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-[0.8125rem] leading-5 text-(--secondary)">{routeLabel}</p></div>@@ -254,27 +254,27 @@ function SignerCard({<div className="flex flex-wrap items-center gap-2"><buttonaria-label={`Move signer ${order} earlier`}- className="inline-flex min-h-11 items-center justify-center rounded-none border border-(--border) bg-white px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-muted-foreground transition hover:border-black hover:text-(--fg) disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet"disabled={disabled || !canMoveEarlier}onClick={() => onMove("earlier")}type="button">- <ChevronLeftIcon className="mr-1 size-4" />+ <ChevronLeftIcon aria-hidden="true" className="-ml-1 size-4" />Earlier</button><buttonaria-label={`Move signer ${order} later`}- className="inline-flex min-h-11 items-center justify-center rounded-none border border-(--border) bg-white px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-muted-foreground transition hover:border-black hover:text-(--fg) disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet"disabled={disabled || !canMoveLater}onClick={() => onMove("later")}type="button">Later- <ChevronRightIcon className="ml-1 size-4" />+ <ChevronRightIcon aria-hidden="true" className="-mr-1 size-4" /></button><buttonaria-label={`Remove signer ${order}`}- className="inline-flex min-h-11 items-center justify-center rounded-none border border-(--border) bg-white px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-muted-foreground transition hover:border-black hover:text-(--fg) disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet btn-quiet-danger"disabled={disabled || !canRemove}onClick={onRemove}type="button"@@ -284,17 +284,15 @@ function SignerCard({</div></div>- <div className="grid gap-4 md:grid-cols-2">- <label className="grid auto-rows-min gap-2 text-sm">- <span className="font-semibold text-(--fg)">Name</span>+ <div className="grid gap-x-4 gap-y-1 md:grid-cols-2">+ <label className="grid auto-rows-min gap-1.5">+ <span className="text-[0.8125rem] font-semibold text-(--secondary)">+ Name+ </span><inputaria-invalid={nameError ? true : undefined}aria-label={`Signer ${order} name`}- className={`min-h-12 rounded-none border bg-popover px-4 text-(--fg) outline-none placeholder:text-(--placeholder) disabled:cursor-not-allowed disabled:bg-[rgba(247,247,248,0.92)] ${- nameError- ? "border-[rgba(180,35,53,0.36)]"- : "border-(--border)"- }`}+ className="field-input"disabled={disabled}onChange={(event: ChangeEvent<HTMLInputElement>) =>onChange("name", event.target.value)@@ -306,7 +304,7 @@ function SignerCard({/><spanaria-live="polite"- className={`min-h-4 text-xs font-semibold text-(--accent) ${+ className={`min-h-4 text-xs font-semibold text-(--danger) ${nameError ? "" : "invisible"}`}role={nameError ? "alert" : undefined}@@ -315,16 +313,14 @@ function SignerCard({</span></label>- <label className="grid auto-rows-min gap-2 text-sm">- <span className="font-semibold text-(--fg)">Email</span>+ <label className="grid auto-rows-min gap-1.5">+ <span className="text-[0.8125rem] font-semibold text-(--secondary)">+ </span><inputaria-invalid={emailError ? true : undefined}aria-label={`Signer ${order} email`}- className={`min-h-12 rounded-none border bg-popover px-4 text-(--fg) outline-none placeholder:text-(--placeholder) disabled:cursor-not-allowed disabled:bg-[rgba(247,247,248,0.92)] ${- emailError- ? "border-[rgba(180,35,53,0.36)]"- : "border-(--border)"- }`}+ className="field-input"disabled={disabled}onChange={(event: ChangeEvent<HTMLInputElement>) =>onChange("email", event.target.value)@@ -336,7 +332,7 @@ function SignerCard({/><spanaria-live="polite"- className={`min-h-4 text-xs font-semibold text-(--accent) ${+ className={`min-h-4 text-xs font-semibold text-(--danger) ${emailError ? "" : "invisible"}`}role={emailError ? "alert" : undefined}@@ -487,7 +483,7 @@ export function SignersShell({if (initialState === "error") {return (- <div className="space-y-6">+ <div className="space-y-5"><PageHeaderdescription="Step 2 of 4 - Add signers"title="New envelope"@@ -507,42 +503,36 @@ export function SignersShell({}return (- <div className="space-y-8">+ <div className="space-y-5"><PageHeaderdescription="Step 2 of 4 - Add signers"- eyebrow="Envelope workflow"title="New envelope"/><StepIndicator current={2} steps={envelopeSteps} /><section- className="editorial-panel p-6 sm:p-8"+ className="panel p-5 sm:p-8"data-animate="enter"data-animate-delay="2">- <div className="space-y-6">- <div className="space-y-2 border-b border-(--border) pb-5">- <p className="text-base font-semibold text-(--fg)">+ <div className="space-y-5">+ <div className="space-y-1">+ <h2 className="text-lg font-extrabold text-(--fg)">Signers will receive the document in this order.- </p>- <p className="text-sm leading-6 text-muted-foreground">+ </h2>+ <p className="text-sm leading-6 text-(--secondary)">Up to 10 signers per document.</p></div>{submissionError ? (- <div- className="rounded-[24px] border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-5 py-4"- role="alert"- >- <p className="text-sm font-semibold text-(--accent)">- {submissionError}- </p>+ <div className="notice notice-danger" role="alert">+ <p>{submissionError}</p></div>) : null}- <ol className="space-y-4">+ <ol className="space-y-3">{signers.map((signer, index) => {const signerErrors = errorsBySignerId[signer.localId] ?? {};const nameError =@@ -578,9 +568,9 @@ export function SignersShell({})}</ol>- <div className="space-y-2">+ <div className="flex flex-wrap items-center gap-3"><button- className="inline-flex min-h-11 items-center justify-center rounded-none border border-(--border) bg-(--surface) px-5 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-(--fg) transition hover:border-black hover:bg-white disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="inline-flex min-h-11 items-center justify-center rounded-[0.875rem] bg-(--accent-soft) px-4.5 text-sm font-bold text-(--accent-ink) transition hover:bg-[#e0dbfb] disabled:cursor-not-allowed disabled:opacity-50"disabled={!canAddSigner || isSubmitting}onClick={handleAddSigner}type="button"@@ -588,13 +578,13 @@ export function SignersShell({+ Add another signer</button>{!canAddSigner ? (- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">+ <p className="text-[0.8125rem] font-semibold text-(--tertiary)">Maximum reached</p>) : null}</div>- <div className="flex flex-col gap-3 pt-2 sm:flex-row sm:justify-end">+ <div className="flex flex-col-reverse gap-3 pt-2 sm:flex-row sm:justify-end"><ShellButton href="/envelopes/new" variant="secondary">← Back</ShellButton>diff --git a/src/components/envelopes/upload-shell.tsx b/src/components/envelopes/upload-shell.tsxindex 01ac876..725b7f4 100644--- a/src/components/envelopes/upload-shell.tsx+++ b/src/components/envelopes/upload-shell.tsx@@ -1,8 +1,10 @@"use client";+import { FileTextIcon, UploadIcon } from "lucide-react";import { useRouter } from "next/navigation";import {startTransition,+ useEffect,useRef,useState,type ChangeEvent,@@ -13,7 +15,13 @@ import {import { FieldShell, ShellButton } from "@/components/shared/form-shell";import { PageHeader } from "@/components/shared/page-header";import { StepIndicator } from "@/components/shared/step-indicator";+import { Button } from "@/components/ui/button";+import { cn } from "@/lib/cn";import { cacheDraftPdfBlob } from "@/lib/draft-pdf-cache";+import {+ renderPdfThumbnail,+ uploadEnvelopeThumbnail,+} from "@/lib/pdf-thumbnail";import { assertPdfPreviewRenderable } from "@/lib/pdfjs-client";import { type CreateEnvelopeResponse } from "@/lib/schemas/envelope";@@ -91,6 +99,7 @@ function UploadShellLayout({onRemoveFile,onTitleChange,onContinue,+ previewUrl,summary,title,}: {@@ -104,29 +113,29 @@ function UploadShellLayout({onOpenFilePicker: () => void;onRemoveFile: () => void;onTitleChange: (event: ChangeEvent<HTMLInputElement>) => void;+ previewUrl: string | null;summary: UploadSummary | null;title: string;}) {const dropzoneClasses = isBusy- ? "border-[rgba(37,99,235,0.35)] bg-[rgba(37,99,235,0.04)]"+ ? "border-(--accent) bg-(--accent-softer)": errorMessage- ? "border-[rgba(180,35,53,0.28)] bg-[rgba(180,35,53,0.03)]"+ ? "border-[rgba(180,35,24,0.4)] bg-(--danger-soft)": isDragActive- ? "border-[rgba(180,35,53,0.36)] bg-[rgba(180,35,53,0.03)]"- : "border-(--border) bg-(--surface)";+ ? "border-(--accent) bg-(--accent-softer)"+ : "border-(--border-strong) bg-(--surface) hover:border-(--accent) hover:bg-(--accent-softer)";return (- <div className="space-y-8">+ <div className="space-y-5"><PageHeaderdescription="Step 1 of 4 - Upload document"- eyebrow="Envelope workflow"title="New envelope"/><StepIndicator current={1} steps={envelopeSteps} /><section- className="editorial-panel p-6 sm:p-8"+ className="panel p-5 sm:p-8"data-animate="enter"data-animate-delay="2">@@ -142,7 +151,10 @@ function UploadShellLayout({<divaria-busy={isBusy}aria-label="Document upload dropzone"- className={`cursor-pointer border border-dashed px-6 py-10 text-center transition sm:px-10 sm:py-14 ${dropzoneClasses}`}+ className={cn(+ "cursor-pointer rounded-[1.25rem] border-2 border-dashed px-6 py-10 text-center transition sm:px-10 sm:py-12",+ dropzoneClasses,+ )}onClick={onOpenFilePicker}onDragLeave={isBusy ? undefined : () => undefined}onDragOver={undefined}@@ -156,34 +168,41 @@ function UploadShellLayout({<><divaria-label="Upload progress"- className="h-3 w-full overflow-hidden rounded-full bg-white"+ className="h-2 w-full max-w-sm overflow-hidden rounded-full bg-white"role="progressbar">- <div className="h-full w-2/3 animate-pulse rounded-full bg-chart-1" />+ <div className="h-full w-2/3 animate-pulse rounded-full bg-(--accent)" /></div>- <div className="space-y-2">- <p className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">+ <div className="space-y-1.5">+ <p className="text-lg font-bold tracking-[-0.02em] text-(--fg)">Uploading...</p>- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-sm leading-6 text-(--secondary)">Validating the PDF before you continue to signer setup.</p></div></>) : (<>- <div className="space-y-2">- <p className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">+ <span className="inline-flex size-12 items-center justify-center rounded-2xl bg-(--accent-soft) text-(--accent)">+ <UploadIcon+ aria-hidden="true"+ className="size-5"+ strokeWidth={2.2}+ />+ </span>+ <div className="space-y-1.5">+ <p className="text-lg font-bold tracking-[-0.02em] text-(--fg)">Drag and drop your PDF here</p>- <p className="text-sm text-muted-foreground">+ <p className="text-sm text-(--secondary)">or{" "}- <span className="font-semibold text-(--fg) underline decoration-[rgba(17,17,17,0.3)] underline-offset-4">+ <span className="font-bold text-(--accent-ink) underline decoration-[rgba(83,64,214,0.35)] underline-offset-4">click to browse</span></p></div>- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">+ <p className="text-[0.8125rem] font-medium text-(--tertiary)">PDF only - 20 MB max</p></>@@ -193,34 +212,48 @@ function UploadShellLayout({{errorMessage ? (<div- className="rounded-[24px] border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-5 py-4"+ className="rounded-2xl bg-(--danger-soft) px-5 py-4"role="alert">- <p className="text-sm font-semibold text-(--accent)">+ <p className="text-sm font-semibold text-(--danger)">{errorMessage}</p></div>) : null}{summary ? (- <section className="border border-(--border) bg-(--surface) px-5 py-4">- <div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">- <div className="space-y-1">- <p className="text-sm font-semibold text-(--fg)">- {summary.fileName}- </p>- <p className="text-sm text-muted-foreground">- {summary.sizeLabel}- </p>- </div>- <button- className="inline-flex min-h-11 items-center justify-center rounded-none border border-(--border) bg-white px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-muted-foreground transition hover:border-black hover:text-(--fg)"- onClick={onRemoveFile}- type="button"- >- Remove- </button>+ <section className="well flex items-center gap-4 p-3.5 pr-4">+ <span className="flex h-[4.5rem] w-14 shrink-0 items-center justify-center">+ {previewUrl ? (+ // A blob: URL drawn in this browser from the chosen file.+ // eslint-disable-next-line @next/next/no-img-element+ <img+ alt=""+ className="max-h-full max-w-full rounded-[0.375rem] bg-white shadow-[0_1px_2px_rgba(28,29,43,0.08),0_4px_10px_rgba(28,29,43,0.10)] ring-1 ring-[rgba(28,29,43,0.06)]"+ src={previewUrl}+ />+ ) : (+ <span className="inline-flex size-11 items-center justify-center rounded-xl bg-white text-(--accent)">+ <FileTextIcon aria-hidden="true" className="size-5" />+ </span>+ )}+ </span>+ <div className="min-w-0 flex-1 space-y-0.5">+ <p className="truncate text-sm font-bold text-(--fg)">+ {summary.fileName}+ </p>+ <p className="text-[0.8125rem] text-(--tertiary)">+ {summary.sizeLabel}+ </p></div>+ <Button+ onClick={onRemoveFile}+ size="sm"+ type="button"+ variant="outline"+ >+ Remove+ </Button></section>) : null}@@ -294,9 +327,44 @@ export function UploadShell({ directUploadPrefix = null }: UploadShellProps) {const [isCreatingDraft, setIsCreatingDraft] = useState(false);const [autoFilledTitle, setAutoFilledTitle] = useState<string | null>(null);const [isDragActive, setIsDragActive] = useState(false);+ const [previewUrl, setPreviewUrl] = useState<string | null>(null);const fileInputRef = useRef<HTMLInputElement | null>(null);+ // The first page of the chosen file as a small picture: shown beside the+ // file name here, then saved as the envelope's dashboard thumbnail.+ const thumbnailRef = useRef<Promise<Blob | null> | null>(null);++ useEffect(() => {+ return () => {+ if (previewUrl) {+ URL.revokeObjectURL(previewUrl);+ }+ };+ }, [previewUrl]);++ function startThumbnail(file: File | null) {+ setPreviewUrl(null);++ if (!file) {+ thumbnailRef.current = null;+ return;+ }++ const thumbnail = file+ .arrayBuffer()+ .then((buffer) => renderPdfThumbnail(new Uint8Array(buffer)))+ .catch(() => null);++ thumbnailRef.current = thumbnail;++ void thumbnail.then((blob) => {+ if (blob && thumbnailRef.current === thumbnail) {+ setPreviewUrl(URL.createObjectURL(blob));+ }+ });+ }function resetSelection(clearTitle: boolean) {+ startThumbnail(null);setSummary(null);setErrorMessage(null);setIsCreatingDraft(false);@@ -336,15 +404,19 @@ export function UploadShell({ directUploadPrefix = null }: UploadShellProps) {if (!isClientVisiblePdf(file)) {setErrorMessage(errorMessageMap["invalid-type"]);setSummary(null);+ startThumbnail(null);return;}if (file.size > MAX_FILE_SIZE_BYTES) {setErrorMessage(errorMessageMap["too-large"]);setSummary(null);+ startThumbnail(null);return;}+ startThumbnail(file);+const titleSuggestion = getTitleSuggestion(file.name);setSummary({@@ -441,6 +513,7 @@ export function UploadShell({ directUploadPrefix = null }: UploadShellProps) {if (response.status === 400) {setSummary(null);+ startThumbnail(null);}setIsCreatingDraft(false);@@ -456,6 +529,15 @@ export function UploadShell({ directUploadPrefix = null }: UploadShellProps) {);}+ // Not waited for: the dashboard draws one later if this is lost.+ const createdEnvelopeId = payload.data.envelopeId;++ void thumbnailRef.current?.then((thumbnail) =>+ thumbnail+ ? uploadEnvelopeThumbnail(createdEnvelopeId, thumbnail)+ : false,+ );+const redirectPath = payload.data.redirectPath;startTransition(() => {@@ -508,6 +590,7 @@ export function UploadShell({ directUploadPrefix = null }: UploadShellProps) {onOpenFilePicker={openFilePicker}onRemoveFile={handleRemoveFile}onTitleChange={handleTitleChange}+ previewUrl={previewUrl}summary={summary}title={title}/>diff --git a/src/components/landing/dashboard-preview.tsx b/src/components/landing/dashboard-preview.tsxindex b13adba..c6d075d 100644--- a/src/components/landing/dashboard-preview.tsx+++ b/src/components/landing/dashboard-preview.tsx@@ -1,5 +1,3 @@-import { PanelLeftIcon, type LucideIcon } from "lucide-react";-import {DashboardDocumentsHeader,DashboardDocumentsPanel,@@ -11,8 +9,7 @@ import { cn } from "@/lib/cn";import type { DashboardEnvelopeListItem } from "@/lib/envelopes";const previewUser = {- email: "[email protected]",- name: "Alex Rowan",+ initials: "AR",} as const;const previewFilter: DashboardFilter = "All";@@ -24,6 +21,7 @@ const previewEnvelopes: readonly DashboardEnvelopeListItem[] = [id: "preview-draft",searchableEmails: ["[email protected]", "[email protected]"],status: "draft",+ statusLabel: "Draft",title: "Master Services Agreement",},{@@ -32,6 +30,7 @@ const previewEnvelopes: readonly DashboardEnvelopeListItem[] = [id: "preview-completed",searchableEmails: ["[email protected]", "[email protected]"],status: "completed",+ statusLabel: "Completed",title: "Independent Contractor Agreement",},{@@ -40,6 +39,7 @@ const previewEnvelopes: readonly DashboardEnvelopeListItem[] = [id: "preview-sent",searchableEmails: ["[email protected]"],status: "sent",+ statusLabel: "1 of 2 signed",title: "NDA - Product Demo",},{@@ -48,6 +48,7 @@ const previewEnvelopes: readonly DashboardEnvelopeListItem[] = [id: "preview-voided",searchableEmails: ["[email protected]"],status: "voided",+ statusLabel: "Voided",title: "Supplier Terms - Atlas",},{@@ -56,6 +57,7 @@ const previewEnvelopes: readonly DashboardEnvelopeListItem[] = [id: "preview-declined",searchableEmails: ["[email protected]"],status: "declined",+ statusLabel: "Declined",title: "Offer Letter - A. Rivera",},] as const;@@ -64,81 +66,34 @@ export function LandingDashboardPreview() {return (<divaria-hidden="true"- className="overflow-hidden border border-[#d4d4d4] bg-white"+ className="overflow-hidden rounded-[1.75rem] bg-(--page) shadow-(--shadow-soft) ring-1 ring-[rgba(28,29,43,0.06)]">- <div className="hidden md:block">- <div className="h-[980px] overflow-hidden lg:h-[1040px]">- <div className="grid h-full grid-cols-[336px_minmax(0,1fr)]">- <aside className="flex h-full flex-col border-r border-(--border) bg-white">- <div className="flex items-center justify-between gap-3 border-b border-(--border) bg-white px-4 py-5">- <Brand href="/" />- <StaticSidebarTrigger />- </div>-- <div className="flex-1 bg-white px-2 py-5">- <div className="px-2">- <p className="section-eyebrow px-2 text-(--tertiary)">- Workspace- </p>-- <div className="mt-4 space-y-1">- {primaryNavItems.map((item) => (- <StaticNavItem- active={item.href === "/dashboard"}- key={item.href}- label={item.label}- Icon={item.icon}- />- ))}- </div>- </div>- </div>-- <div className="border-t border-(--border) bg-white px-3 py-4">- <StaticUserCard- email={previewUser.email}- name={previewUser.name}- />- </div>- </aside>-- <div className="bg-transparent">- <PreviewDocumentsWorkspace />+ <div className="max-h-[46rem] overflow-hidden px-4 pb-6 sm:px-7">+ <div className="flex items-center justify-between gap-4 py-4">+ <div className="flex min-w-0 items-center gap-7">+ <Brand href="/" />+ <div className="hidden items-center gap-1 md:flex">+ {primaryNavItems.map((item) => (+ <span+ className={cn(+ "inline-flex min-h-9 items-center rounded-[0.625rem] px-3.5 text-sm",+ item.href === "/dashboard"+ ? "bg-white font-bold text-(--fg) shadow-(--shadow-xs)"+ : "font-semibold text-(--secondary)",+ )}+ key={item.href}+ >+ {item.label}+ </span>+ ))}</div></div>+ <span className="inline-flex size-10 shrink-0 items-center justify-center rounded-full bg-[#ffd9c2] text-[0.8125rem] font-bold text-[#7a3412]">+ {previewUser.initials}+ </span></div>- </div>- <div className="md:hidden">- <div className="h-[1240px] overflow-hidden bg-white">- <header className="border-b border-(--border) bg-white">- <div className="flex items-center justify-between gap-3 px-4 py-4">- <div className="flex items-center gap-3">- <Brand href="/" />- <div>- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Sender app- </p>- <p className="text-sm font-semibold text-(--fg)">Documents</p>- </div>- </div>-- <StaticSidebarTrigger mobile />- </div>- </header>-- <PreviewDocumentsWorkspace />- </div>- </div>- </div>- );-}--function PreviewDocumentsWorkspace() {- return (- <main className="flex-1 px-4 py-5 sm:px-6 sm:py-7 lg:px-8 xl:px-10">- <div className="mx-auto w-full max-w-[1080px]">- <div className="space-y-8">+ <div className="space-y-5"><DashboardDocumentsHeader interactive={false} /><DashboardDocumentsPanelenvelopes={previewEnvelopes}@@ -149,81 +104,6 @@ function PreviewDocumentsWorkspace() {/></div></div>- </main>- );-}--function StaticSidebarTrigger({ mobile = false }: { mobile?: boolean }) {- return (- <div- className={cn(- "inline-flex items-center justify-center rounded-none border border-(--border) bg-white",- mobile ? "size-11 text-(--fg)" : "size-10 text-muted-foreground",- )}- >- <PanelLeftIcon className="size-5" />- </div>- );-}--function StaticNavItem({- active,- Icon,- label,-}: {- active: boolean;- Icon: LucideIcon;- label: string;-}) {- return (- <div- className={cn(- "flex min-h-12 items-center gap-3 rounded-none border px-3.5 py-2 text-[0.95rem] font-medium",- active- ? "border-(--border) bg-[#f7f7f8] text-(--fg)"- : "border-transparent text-muted-foreground",- )}- >- <span- className={cn(- "inline-flex size-9 shrink-0 items-center justify-center rounded-none",- active- ? "bg-[#fff8f8] text-(--accent)"- : "bg-[#f7f7f8] text-muted-foreground",- )}- >- <Icon className="size-4" />- </span>- <span className="truncate">{label}</span>- </div>- );-}--function StaticUserCard({ email, name }: { email: string; name: string }) {- return (- <div className="flex items-center gap-3 rounded-none border border-(--border) bg-white px-3 py-3 text-left text-(--fg)">- <div className="inline-flex size-10 items-center justify-center rounded-none bg-[#fff8f8] text-sm font-semibold text-(--accent)">- {getInitials(name)}- </div>-- <div className="min-w-0">- <p className="truncate text-sm font-semibold text-(--fg)">{name}</p>- <p className="truncate text-xs text-(--tertiary)">{email}</p>- </div></div>);}--function getInitials(name: string) {- const segments = name- .split(/\s+/)- .map((segment) => segment.trim())- .filter(Boolean)- .slice(0, 2);-- if (segments.length === 0) {- return "SU";- }-- return segments.map((segment) => segment[0]?.toUpperCase() ?? "").join("");-}diff --git a/src/components/landing/landing-session-actions.tsx b/src/components/landing/landing-session-actions.tsxindex 1a26d2c..8d3c696 100644--- a/src/components/landing/landing-session-actions.tsx+++ b/src/components/landing/landing-session-actions.tsx@@ -2,31 +2,36 @@import Link from "next/link";+import { buttonVariants } from "@/components/ui/button";import { authClient } from "@/lib/auth/client";import { cn } from "@/lib/cn";type LandingSessionActionProps = {className?: string;- monoClassName: string;+ /** "inverse" is for a button that sits on the violet closing panel. */+ tone?: "default" | "inverse";};export function LandingSessionPrimaryAction({className,- monoClassName,+ tone = "default",}: LandingSessionActionProps) {const { data: session } = authClient.useSession();const authenticated = !!session;return (<Link- className={landingActionLinkClassName({+ className={cn(+ tone === "inverse"+ ? cn(+ buttonVariants({ size: "lg", variant: "outline" }),+ "border-transparent bg-white text-(--accent-ink) hover:border-transparent hover:bg-(--accent-soft)",+ )+ : buttonVariants({ size: "lg" }),className,- monoClassName,- variant: "primary",- })}+ )}href={authenticated ? "/dashboard" : "/signup"}prefetch- style={{ color: "#fff" }}>{authenticated ? "Go to dashboard" : "Start free"}</Link>@@ -35,7 +40,7 @@ export function LandingSessionPrimaryAction({export function LandingSessionLoginAction({className,- monoClassName,+ tone = "default",}: LandingSessionActionProps) {const { data: session } = authClient.useSession();@@ -45,11 +50,12 @@ export function LandingSessionLoginAction({return (<Link- className={landingActionLinkClassName({+ className={cn(+ buttonVariants({ size: "lg", variant: "outline" }),+ tone === "inverse" &&+ "border-white/45 bg-transparent text-white hover:border-white hover:bg-white/10",className,- monoClassName,- variant: "secondary",- })}+ )}href="/login"prefetch>@@ -57,21 +63,3 @@ export function LandingSessionLoginAction({</Link>);}--function landingActionLinkClassName({- className,- monoClassName,- variant,-}: {- className?: string;- monoClassName: string;- variant: "primary" | "secondary";-}) {- return cn(- `${monoClassName} inline-flex items-center justify-center border-2 px-5 py-3 text-sm font-bold uppercase tracking-[0.16em] transition-colors`,- variant === "primary"- ? "border-[#e50000] bg-[#e50000] text-white hover:border-[#c00000] hover:bg-[#c00000]"- : "border-[#d4d4d4] bg-transparent text-black hover:border-black",- className,- );-}diff --git a/src/components/landing/landing-shell.tsx b/src/components/landing/landing-shell.tsxindex 57d6692..f1e030a 100644--- a/src/components/landing/landing-shell.tsx+++ b/src/components/landing/landing-shell.tsx@@ -1,16 +1,15 @@import type { LucideIcon } from "lucide-react";-import type { ReactNode } from "react";import Link from "next/link";-import { Archivo, IBM_Plex_Mono } from "next/font/google";import {+ CheckIcon,ClipboardCheck,Globe,Link2,- Menu,ShieldCheck,- X,+ XIcon,} from "lucide-react";+import { Brand, BrandMark } from "@/components/layout/brand";import { PublicSessionMenu } from "@/components/layout/public-session-menu";import { PublicLegalFooter } from "@/components/layout/public-legal-links";import { LandingDashboardPreview } from "@/components/landing/dashboard-preview";@@ -18,31 +17,9 @@ import {LandingSessionLoginAction,LandingSessionPrimaryAction,} from "@/components/landing/landing-session-actions";-import { Badge } from "@/components/ui/badge";-import { Button } from "@/components/ui/button";-import { Separator } from "@/components/ui/separator";-import {- Sheet,- SheetClose,- SheetContent,- SheetHeader,- SheetTitle,- SheetTrigger,-} from "@/components/ui/sheet";+import { buttonVariants } from "@/components/ui/button";import { cn } from "@/lib/cn";-const archivo = Archivo({- display: "swap",- subsets: ["latin"],- weight: ["400", "500", "600", "700", "800", "900"],-});--const ibmPlexMono = IBM_Plex_Mono({- display: "swap",- subsets: ["latin"],- weight: ["400", "500", "600", "700"],-});-type WorkflowStep = {body: string;title: string;@@ -121,7 +98,7 @@ type SecurityPillar = {const securityPillars: readonly SecurityPillar[] = [{title: "Encrypted at rest and in transit",- body: "Documents are stored with encryption on Cloudflare's infrastructure. All connections use HTTPS with HSTS enforcement.",+ body: "Documents are kept in private, encrypted storage. All connections use HTTPS with HSTS enforcement.",icon: ShieldCheck,},{@@ -141,162 +118,131 @@ const securityPillars: readonly SecurityPillar[] = [},];-export function LandingShell() {- const monoClassName = ibmPlexMono.className;- const secondaryLabel = "See how it works";+const sectionHeadingClassName =+ "text-[clamp(1.875rem,4vw,2.75rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)";+const sectionLeadClassName =+ "mx-auto mt-4 max-w-xl text-[1.0625rem] leading-relaxed text-(--secondary)";+export function LandingShell() {return (- <div- className={`${archivo.className} min-h-screen bg-white text-[#000000]`}- >- <div- aria-hidden="true"- className="pointer-events-none fixed inset-0 z-0 opacity-35"- style={{- backgroundImage:- "radial-gradient(circle, #d4d4d4 0.8px, transparent 0.8px)",- backgroundSize: "48px 48px",- }}- />-- <header className="relative z-10 border-b border-[#d4d4d4] bg-white/90 backdrop-blur">- <div className="mx-auto flex max-w-[1200px] flex-wrap items-center justify-between gap-4 px-6 py-5 sm:px-8 lg:px-10">- <LandingWordmark />-- <PublicSessionMenu- buttonClassName="hidden rounded-none border-[#d4d4d4] bg-white text-black hover:border-black hover:bg-white hover:text-black sm:inline-flex"- contentClassName="rounded-none border-[#d4d4d4] bg-white text-black"- >- <nav className="hidden flex-wrap items-center gap-3 sm:flex">+ <div className="flex min-h-screen flex-col text-(--fg)">+ <header className="sticky top-0 z-30 bg-[rgba(243,244,248,0.86)] backdrop-blur-md">+ <div className="page-width flex items-center justify-between gap-3 py-3 sm:py-4">+ <Brand href="/" />++ <PublicSessionMenu>+ <nav+ aria-label="Public navigation"+ className="flex items-center gap-1 sm:gap-2"+ ><Link- className={`${monoClassName} text-sm font-medium text-[#71717a] transition-colors hover:text-black`}+ className={cn(+ buttonVariants({ size: "sm", variant: "ghost" }),+ "px-3 sm:px-4",+ )}href="/login"prefetch>Log in</Link>- <ActionLink+ <Link+ className={buttonVariants({ size: "sm" })}href="/signup"- monoClassName={monoClassName}prefetch- variant="primary">Start free- </ActionLink>+ </Link></nav></PublicSessionMenu>-- <PublicSessionMenu- buttonClassName="rounded-none border-[#d4d4d4] bg-white text-black hover:border-black hover:bg-white hover:text-black sm:hidden"- contentClassName="rounded-none border-[#d4d4d4] bg-white text-black"- >- <MobileNavigationMenu monoClassName={monoClassName} />- </PublicSessionMenu></div></header>- <main className="relative z-10">- <section className="overflow-hidden border-b border-[#d4d4d4]">- <div className="mx-auto max-w-[1200px] px-6 pb-20 pt-16 sm:px-8 sm:pt-20 lg:px-10 lg:pb-24 lg:pt-24">- <div className="relative">- <CropMarks- className="hidden lg:block"- color="#e50000"- offset={26}- size={28}- />- <div className="px-0 py-4 sm:py-6 lg:px-4 lg:py-8">- <div- className="mx-auto max-w-216 text-center"- data-animate="enter"- >- <SectionMarker center monoClassName={monoClassName}>- Free e-signature software- </SectionMarker>+ <main className="flex-1">+ <section className="page-width pb-14 pt-12 sm:pt-16 lg:pb-20 lg:pt-20">+ <div+ className="mx-auto max-w-[52rem] text-center"+ data-animate="enter"+ >+ <SectionMarker>Free e-signature software</SectionMarker>- <h1- className="mx-auto max-w-[22ch] text-[clamp(2.2rem,4.5vw,4.2rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-black sm:max-w-[23ch] lg:max-w-[24ch] lg:leading-[1.1] lg:tracking-[-0.03em]"- style={{ textWrap: "balance" }}- >- Sign PDFs Online for Free. No catch.- </h1>+ <h1 className="mx-auto max-w-[18ch] text-[clamp(2.375rem,6vw,4.25rem)] font-extrabold leading-[1.04] tracking-[-0.045em] text-(--fg)">+ Sign PDFs Online for Free.{" "}+ <span className="text-(--accent)">No catch.</span>+ </h1>- <p className="mx-auto mt-6 max-w-2xl text-lg leading-relaxed text-[#71717a] sm:text-[1.15rem]">- Upload a PDF, drop in signature fields, and send.- That's it.- </p>+ <p className="mx-auto mt-5 max-w-xl text-lg leading-relaxed text-(--secondary) sm:text-[1.1875rem]">+ Upload a PDF, drop in signature fields, and send. That's it.+ </p>- <div className="mt-10 flex flex-wrap items-center justify-center gap-4">- <LandingSessionPrimaryAction monoClassName={monoClassName} />- <ActionLink- href="#workflow"- monoClassName={monoClassName}- variant="secondary"- >- {secondaryLabel}- </ActionLink>- </div>- </div>- </div>+ <div className="mt-8 flex flex-wrap items-center justify-center gap-3">+ <LandingSessionPrimaryAction />+ <Link+ className={buttonVariants({ size: "lg", variant: "outline" })}+ href="#workflow"+ >+ See how it works+ </Link></div></div>++ <div+ className="mt-12 sm:mt-16"+ data-animate="enter"+ data-animate-delay="1"+ >+ <LandingDashboardPreview />+ </div></section>- <section- className="border-b border-[#d4d4d4] bg-[#f7f7f8]"- data-animate="enter"- data-animate-delay="1"- id="workflow"- >- <div className="mx-auto max-w-[1200px] px-6 py-20 sm:px-8 lg:px-10 lg:py-24">- <div className="mx-auto max-w-160 text-center">- <SectionMarker center monoClassName={monoClassName}>- How it works- </SectionMarker>- <h2 className="text-[clamp(2rem,4vw,3.1rem)] font-extrabold leading-[1.06] tracking-[-0.03em] text-black">+ <section className="scroll-mt-20 py-14 lg:py-20" id="workflow">+ <div className="page-width">+ <div className="mx-auto max-w-[40rem] text-center">+ <SectionMarker>How it works</SectionMarker>+ <h2 className={sectionHeadingClassName}>Four steps. One signed document.</h2>- <p className="mx-auto mt-5 max-w-xl text-lg leading-relaxed text-[#71717a]">+ <p className={sectionLeadClassName}>Upload a PDF, set the signing order, place fields, and hit send.Your signers don't even need an account.</p></div>- <div className="mt-12">- <LandingDashboardPreview />- </div>-- <div className="mt-14 grid gap-10 sm:grid-cols-2 lg:grid-cols-4 lg:gap-8">+ <ol className="mt-10 grid gap-4 sm:grid-cols-2 lg:grid-cols-4">{workflowSteps.map((step, index) => (- <WorkflowStepInline- body={step.body}- index={index + 1}- key={step.title}- monoClassName={monoClassName}- title={step.title}- />+ <li className="panel p-6" key={step.title}>+ <span+ aria-hidden="true"+ className="inline-flex size-10 items-center justify-center rounded-xl bg-(--accent-soft) text-[0.9375rem] font-extrabold text-(--accent-ink)"+ >+ {index + 1}+ </span>+ <h3 className="mt-4 text-lg font-extrabold leading-tight tracking-[-0.02em] text-(--fg)">+ {step.title}+ </h3>+ <p className="mt-2 text-[0.9375rem] leading-relaxed text-(--secondary)">+ {step.body}+ </p>+ </li>))}- </div>+ </ol></div></section>- <section className="border-b border-[#d4d4d4]" data-animate="enter">- <div className="mx-auto max-w-[1200px] px-6 py-20 sm:px-8 lg:px-10 lg:py-24">- <div className="mx-auto max-w-160 text-center">- <SectionMarker center monoClassName={monoClassName}>- Security- </SectionMarker>- <h2 className="text-[clamp(2rem,4vw,3.1rem)] font-extrabold leading-[1.06] tracking-[-0.03em] text-black">+ <section className="py-14 lg:py-20">+ <div className="page-width">+ <div className="mx-auto max-w-[40rem] text-center">+ <SectionMarker>Security</SectionMarker>+ <h2 className={sectionHeadingClassName}>Your documents stay safe.</h2>- <p className="mx-auto mt-5 max-w-xl text-lg leading-relaxed text-[#71717a]">+ <p className={sectionLeadClassName}>Every PDF is encrypted, every action is logged, and everysigning link is cryptographically secured. The code is opensource so you can verify it yourself.</p></div>- <div className="mx-auto mt-14 grid max-w-[880px] gap-4 sm:grid-cols-2">+ <div className="mx-auto mt-10 grid max-w-[60rem] gap-4 sm:grid-cols-2">{securityPillars.map((pillar) => (<SecurityPillarCardbody={pillar.body}@@ -309,83 +255,75 @@ export function LandingShell() {</div></section>- <section className="border-b border-[#d4d4d4]" data-animate="enter">- <div className="mx-auto max-w-[1200px] px-6 py-20 sm:px-8 lg:px-10 lg:py-24">- <div className="mx-auto max-w-160 text-center">- <SectionMarker center monoClassName={monoClassName}>- Pricing- </SectionMarker>- <h2 className="text-[clamp(2rem,4vw,3.1rem)] font-extrabold leading-[1.06] tracking-[-0.03em] text-black">+ <section className="py-14 lg:py-20">+ <div className="page-width">+ <div className="mx-auto max-w-[40rem] text-center">+ <SectionMarker>Pricing</SectionMarker>+ <h2 className={sectionHeadingClassName}>Free beats $120 a year.</h2>- <p className="mx-auto mt-5 max-w-xl text-lg leading-relaxed text-[#71717a]">+ <p className={sectionLeadClassName}>Everything below is included. Forever. For $0. See how thatstacks up against DocuSign.</p></div>- <div className="mt-14">- <ComparisonTable monoClassName={monoClassName} />+ <div className="mx-auto mt-10 max-w-[60rem]">+ <ComparisonTable /></div>- <div className="mt-10 flex flex-col items-center gap-4 text-center">- <LandingSessionPrimaryAction monoClassName={monoClassName} />- <p- className={`${monoClassName} text-[11px] uppercase tracking-[0.18em] text-[#71717a]`}- >+ <div className="mt-8 flex flex-col items-center gap-3 text-center">+ <LandingSessionPrimaryAction />+ <p className="text-sm text-(--tertiary)">Your signers never need to create an account.</p></div>+ </div>+ </section>- <div className="mt-20 lg:mt-24">- <div className="mx-auto max-w-[780px]">- <div className="text-center">- <SectionMarker center monoClassName={monoClassName}>- FAQ- </SectionMarker>- <h3 className="text-[clamp(1.9rem,3.5vw,2.85rem)] font-extrabold leading-[1.06] tracking-[-0.03em] text-black">- Quick answers.- </h3>- </div>- <div className="mt-8 border-t border-[#d4d4d4]">- {faqItems.map((item) => (- <FaqRow- answer={item.answer}- key={item.question}- question={item.question}- />- ))}- </div>+ <section className="py-14 lg:py-20">+ <div className="page-width">+ <div className="mx-auto max-w-[48rem]">+ <div className="text-center">+ <SectionMarker>FAQ</SectionMarker>+ <h2 className={sectionHeadingClassName}>Quick answers.</h2>+ </div>+ <div className="mt-8 space-y-3">+ {faqItems.map((item) => (+ <article+ className="panel px-6 py-5 sm:px-7"+ key={item.question}+ >+ <h3 className="text-lg font-extrabold leading-snug tracking-[-0.02em] text-(--fg)">+ {item.question}+ </h3>+ <p className="mt-2 text-[0.9375rem] leading-relaxed text-(--secondary)">+ {item.answer}+ </p>+ </article>+ ))}</div></div></div></section>- <section- className="border-b border-[#d4d4d4] bg-[#f7f7f8]"- data-animate="enter"- data-animate-delay="1"- >- <div className="mx-auto max-w-[1200px] px-6 py-20 text-center sm:px-8 lg:px-10 lg:py-24">- <div className="mx-auto max-w-[780px]">- <SectionMarker center monoClassName={monoClassName}>- Start free- </SectionMarker>- <h2 className="text-[clamp(2.1rem,4.5vw,3.6rem)] font-extrabold leading-[1.04] tracking-[-0.04em] text-black">+ <section className="page-width pb-10 pt-6 lg:pb-14">+ <div className="rounded-[2rem] bg-(--accent) px-6 py-14 text-center sm:px-10 lg:py-20">+ <div className="mx-auto max-w-[44rem]">+ <p className="text-sm font-semibold text-white/80">Start free</p>+ <h2 className="mt-3 text-[clamp(2rem,4.5vw,3.25rem)] font-extrabold leading-[1.06] tracking-[-0.04em] text-white">Send your next agreement. On us.</h2>- <p className="mx-auto mt-6 max-w-2xl text-lg leading-relaxed text-[#71717a]">+ <p className="mx-auto mt-4 max-w-xl text-[1.0625rem] leading-relaxed text-white/85">No credit card. No per-envelope fees. Just upload and send.</p>- <div className="mt-10 flex flex-wrap justify-center gap-4">- <LandingSessionPrimaryAction monoClassName={monoClassName} />- <LandingSessionLoginAction monoClassName={monoClassName} />+ <div className="mt-8 flex flex-wrap justify-center gap-3">+ <LandingSessionPrimaryAction tone="inverse" />+ <LandingSessionLoginAction tone="inverse" /></div>- <p- className={`${monoClassName} mt-8 text-[11px] uppercase tracking-[0.18em] text-[#71717a]`}- >+ <p className="mt-7 text-sm text-white/75">Free • no signer account required • up to 10 signers perdocument</p>@@ -399,312 +337,76 @@ export function LandingShell() {);}-function LandingWordmark({ asLink = true }: { asLink?: boolean }) {- const wordmark = (- <span className="text-[24px] font-extrabold tracking-[-0.035em] text-black sm:text-[27px]">- Signu<span className="text-[#e50000]">Doc</span>- </span>- );-- if (!asLink) {- return (- <div aria-label="SignuDoc" className="flex items-center">- {wordmark}- </div>- );- }-- return (- <Link aria-label="SignuDoc" className="flex items-center" href="/">- {wordmark}- </Link>- );-}--function ActionLink({- children,- href,- monoClassName,- prefetch,- variant,-}: {- children: ReactNode;- href: string;- monoClassName: string;- prefetch?: boolean;- variant: "primary" | "secondary";-}) {- return (- <Link- className={actionLinkClassName({ monoClassName, variant })}- href={href}- prefetch={prefetch}- style={variant === "primary" ? { color: "#fff" } : undefined}- >- {children}- </Link>- );-}--function actionLinkClassName({- className,- monoClassName,- variant,-}: {- className?: string;- monoClassName: string;- variant: "primary" | "secondary";-}) {- return cn(- `${monoClassName} inline-flex items-center justify-center border-2 px-5 py-3 text-sm font-bold uppercase tracking-[0.16em] transition-colors`,- variant === "primary"- ? "border-[#e50000] bg-[#e50000] text-white hover:border-[#c00000] hover:bg-[#c00000]"- : "border-[#d4d4d4] bg-transparent text-black hover:border-black",- className,- );-}--function MobileNavigationMenu({ monoClassName }: { monoClassName: string }) {- return (- <Sheet>- <SheetTrigger asChild>- <Button- aria-label="Open navigation menu"- className="rounded-none border-0 bg-transparent text-black shadow-none hover:bg-transparent hover:text-black focus-visible:border-transparent sm:hidden"- size="icon-sm"- variant="ghost"- >- <Menu className="size-5" />- </Button>- </SheetTrigger>- <SheetContent- className="border-l-2 border-[#d4d4d4] bg-white p-0 text-black"- side="right"- showCloseButton={false}- >- <SheetHeader className="relative border-b border-[#d4d4d4] px-5 py-4 pr-18 text-left">- <SheetTitle className="sr-only">SignuDoc</SheetTitle>- <LandingWordmark asLink={false} />- <SheetClose- aria-label="Close"- className="absolute right-4 top-4 inline-flex h-10 w-10 items-center justify-center border-0 bg-transparent text-[#71717a] transition-colors hover:bg-transparent hover:text-black"- >- <X className="size-6" />- </SheetClose>- </SheetHeader>-- <nav className="flex flex-col gap-3 px-5 py-5">- <SheetClose asChild>- <Link- className={actionLinkClassName({- className: "w-full",- monoClassName,- variant: "primary",- })}- href="/signup"- prefetch- style={{ color: "#fff" }}- >- Start free- </Link>- </SheetClose>-- <SheetClose asChild>- <Link- className={actionLinkClassName({- className: "w-full",- monoClassName,- variant: "secondary",- })}- href="/login"- prefetch- >- Log in- </Link>- </SheetClose>- </nav>- </SheetContent>- </Sheet>- );-}--function SectionMarker({- center = false,- children,- monoClassName,-}: {- center?: boolean;- children: string;- monoClassName: string;-}) {+function SectionMarker({ children }: { children: string }) {return (- <div- className={`mb-6 flex items-center gap-3 ${center ? "justify-center" : ""}`}- >- <GridDot />- <span- className={`${monoClassName} text-xs font-medium uppercase tracking-[0.2em] text-[#71717a]`}- >+ <p className="mb-5 flex justify-center">+ <span className="pill pill-accent px-3.5 py-1 text-[0.8125rem]">{children}</span>- </div>- );-}--function CropMarks({- className = "",- color = "#e50000",- offset = 0,- size = 20,-}: {- className?: string;- color?: string;- offset?: number;- size?: number;-}) {- return (- <div- className={`pointer-events-none absolute ${className}`}- style={{ inset: offset }}- >- <span- className="absolute left-0 top-0"- style={{- borderLeft: `2px solid ${color}`,- borderTop: `2px solid ${color}`,- height: size,- width: size,- }}- />- <span- className="absolute right-0 top-0"- style={{- borderRight: `2px solid ${color}`,- borderTop: `2px solid ${color}`,- height: size,- width: size,- }}- />- <span- className="absolute bottom-0 left-0"- style={{- borderBottom: `2px solid ${color}`,- borderLeft: `2px solid ${color}`,- height: size,- width: size,- }}- />- <span- className="absolute bottom-0 right-0"- style={{- borderBottom: `2px solid ${color}`,- borderRight: `2px solid ${color}`,- height: size,- width: size,- }}- />- </div>- );-}--function GridDot() {- return (- <span className="inline-block h-[6px] w-[6px] rounded-full bg-[#e50000]" />- );-}--function WorkflowStepInline({- body,- index,- monoClassName,- title,-}: WorkflowStep & {- index: number;- monoClassName: string;-}) {- return (- <div className="text-center lg:text-left">- <div className="flex justify-center lg:justify-start">- <div className="flex h-12 w-12 items-center justify-center rounded-full bg-[#e50000]">- <span- className={`${monoClassName} text-base font-bold leading-none text-white`}- >- {String(index).padStart(2, "0")}- </span>- </div>- </div>- <h3 className="mt-4 text-lg font-bold leading-tight tracking-[-0.02em] text-black">- {title}- </h3>- <p className="mt-2 text-[15px] leading-relaxed text-[#71717a]">{body}</p>- </div>+ </p>);}function SecurityPillarCard({ body, icon: Icon, title }: SecurityPillar) {return (- <div className="border-2 border-[#d4d4d4] bg-white px-6 py-7 text-center">- <div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center border border-[rgba(229,0,0,0.14)] bg-[#fff8f8]">- <Icon className="h-[22px] w-[22px]" color="#e50000" strokeWidth={1.8} />+ <div className="panel flex gap-4 p-6">+ <span+ aria-hidden="true"+ className="inline-flex size-11 shrink-0 items-center justify-center rounded-xl bg-(--accent-soft) text-(--accent)"+ >+ <Icon className="size-5" strokeWidth={2} />+ </span>+ <div>+ <h3 className="text-[1.0625rem] font-extrabold leading-tight tracking-[-0.02em] text-(--fg)">+ {title}+ </h3>+ <p className="mt-1.5 text-[0.9375rem] leading-relaxed text-(--secondary)">+ {body}+ </p></div>- <h3 className="text-base font-bold leading-tight tracking-[-0.02em] text-black">- {title}- </h3>- <p className="mt-2 text-[15px] leading-relaxed text-[#71717a]">{body}</p></div>);}-function FaqRow({ answer, question }: FaqItem) {- return (- <article className="border-b border-[#d4d4d4] py-6 last:border-b-0">- <h3 className="text-xl font-bold leading-tight tracking-[-0.03em] text-black">- {question}- </h3>- <p className="mt-3 text-[15px] leading-relaxed text-[#71717a]">- {answer}- </p>- </article>- );-}--function ComparisonTable({ monoClassName }: { monoClassName: string }) {+function ComparisonTable() {return (- <div className="relative border-2 border-[#d4d4d4] bg-white">- <CropMarks color="#e50000" size={14} />-+ <div className="panel overflow-hidden">{/* Desktop table */}- <div className="hidden lg:block">+ <div className="hidden p-3 sm:block"><table className="w-full border-separate border-spacing-0 text-left"><thead><tr>- <th- className={`${monoClassName} w-[35%] border-b-2 border-[#d4d4d4] px-6 py-5 text-[10px] font-semibold uppercase tracking-[0.2em] text-[#71717a]`}- >+ <th className="w-[36%] px-5 py-4 text-[0.8125rem] font-semibold text-(--tertiary)">Feature</th>- <th className="w-[32.5%] border-b-2 border-l border-[#d4d4d4] bg-[#fff8f8] px-6 py-5 text-center">- <span className="text-[17px] font-bold tracking-tight text-black">- Signu<span className="text-[#e50000]">Doc</span>+ <th className="w-[32%] rounded-t-2xl bg-(--accent-softer) px-5 py-4 text-center">+ <span className="inline-flex items-center gap-2 text-[1.0625rem] font-extrabold tracking-[-0.02em] text-(--fg)">+ <BrandMark className="size-6 rounded-[0.5rem]" />+ SignuDoc</span></th>- <th className="w-[32.5%] border-b-2 border-l border-[#d4d4d4] px-6 py-5 text-center">- <span className="text-[17px] font-bold tracking-tight text-[#71717a]">+ <th className="w-[32%] px-5 py-4 text-center">+ <span className="text-[1.0625rem] font-bold tracking-[-0.02em] text-(--tertiary)">DocuSign</span></th></tr></thead><tbody>- {comparisonRows.map((row) => (+ {comparisonRows.map((row, index) => (<tr key={row.feature}>- <td className="border-t border-[#d4d4d4] px-6 py-4 text-[15px] font-medium text-black">+ <td className="border-t border-(--border) px-5 py-4 text-[0.9375rem] font-semibold text-(--fg)">{row.feature}</td>- <td className="border-t border-l border-[#d4d4d4] bg-[#fff8f8] px-6 py-4 text-center">+ <td+ className={cn(+ "border-t border-[rgba(83,64,214,0.12)] bg-(--accent-softer) px-5 py-4 text-center",+ index === comparisonRows.length - 1 && "rounded-b-2xl",+ )}+ ><ComparisonValue advantage value={row.signudoc} /></td>- <td className="border-t border-l border-[#d4d4d4] px-6 py-4 text-center text-[#71717a]">+ <td className="border-t border-(--border) px-5 py-4 text-center text-(--secondary)"><ComparisonValue value={row.docusign} /></td></tr>@@ -714,33 +416,18 @@ function ComparisonTable({ monoClassName }: { monoClassName: string }) {</div>{/* Mobile stacked layout */}- <div className="space-y-4 p-4 lg:hidden sm:p-5">+ <div className="space-y-3 p-4 sm:hidden">{comparisonRows.map((row) => (- <div- className="border border-[#d4d4d4] bg-[#fcfcfc]"- key={row.feature}- >- <div className="border-b border-[#d4d4d4] px-4 py-3">- <p- className={`${monoClassName} text-[10px] font-semibold uppercase tracking-[0.2em] text-[#71717a]`}- >- {row.feature}- </p>- </div>- <div className="bg-[#fff8f8]">- <ComparisonMobileRow- advantage- label="SignuDoc"- monoClassName={monoClassName}- value={row.signudoc}- />- </div>- <Separator className="bg-[#d4d4d4]" />+ <div className="well overflow-hidden" key={row.feature}>+ <p className="px-4 pb-2 pt-3.5 text-[0.8125rem] font-semibold text-(--tertiary)">+ {row.feature}+ </p><ComparisonMobileRow- label="DocuSign"- monoClassName={monoClassName}- value={row.docusign}+ advantage+ label="SignuDoc"+ value={row.signudoc}/>+ <ComparisonMobileRow label="DocuSign" value={row.docusign} /></div>))}</div>@@ -751,38 +438,30 @@ function ComparisonTable({ monoClassName }: { monoClassName: string }) {function ComparisonMobileRow({advantage = false,label,- monoClassName,value,}: {advantage?: boolean;label: string;- monoClassName: string;value: string | boolean;}) {return (- <div className="flex items-center justify-between gap-4 px-4 py-3">- <Badge+ <div+ className={cn(+ "flex items-center justify-between gap-4 px-4 py-3",+ advantage ? "bg-(--accent-softer)" : "text-(--secondary)",+ )}+ >+ <spanclassName={cn(- `${monoClassName} w-[5.5rem] justify-center rounded-none border px-2.5 py-1 text-[10px] font-semibold normal-case tracking-tight shadow-none`,- advantage- ? "border-[#e50000]/20 bg-[#fff8f8] text-black"- : "border-[#d4d4d4] bg-white text-[#71717a]",- )}- variant="outline"- >- {advantage ? (- <span>- Signu<span className="text-[#e50000]">Doc</span>- </span>- ) : (- label+ "text-sm",+ advantage ? "font-extrabold text-(--fg)" : "font-semibold",)}- </Badge>- <div- className={cn("max-w-[58%] text-right", !advantage && "text-[#71717a]")}>+ {label}+ </span>+ <span className="max-w-[58%] text-right"><ComparisonValue advantage={advantage} value={value} />- </div>+ </span></div>);}@@ -795,54 +474,27 @@ function ComparisonValue({value: string | boolean;}) {if (typeof value === "boolean") {- return value ? <CheckIcon /> : <XIcon />;+ return value ? (+ <span className="inline-flex size-7 items-center justify-center rounded-full bg-(--success-soft) text-(--success)">+ <CheckIcon aria-hidden="true" className="size-4" strokeWidth={3} />+ <span className="sr-only">Included</span>+ </span>+ ) : (+ <span className="inline-flex size-7 items-center justify-center rounded-full bg-(--danger-soft) text-(--danger)">+ <XIcon aria-hidden="true" className="size-4" strokeWidth={3} />+ <span className="sr-only">Not included</span>+ </span>+ );}- const isStrong =- advantage &&- (value === "Free forever" || value === "Unlimited" || value === "Included");-return (<span- className={- isStrong- ? "text-[15px] font-bold text-black"- : "text-[15px] leading-relaxed"- }+ className={cn(+ "text-[0.9375rem] leading-relaxed",+ advantage && "font-extrabold text-(--accent-ink)",+ )}>{value}</span>);}--function CheckIcon() {- return (- <svg- className="inline-block h-5 w-5 text-[#16a34a]"- fill="currentColor"- viewBox="0 0 20 20"- >- <path- clipRule="evenodd"- d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"- fillRule="evenodd"- />- </svg>- );-}--function XIcon() {- return (- <svg- className="inline-block h-5 w-5 text-[#e50000]"- fill="currentColor"- viewBox="0 0 20 20"- >- <path- clipRule="evenodd"- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"- fillRule="evenodd"- />- </svg>- );-}diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsxindex 85808fd..9433a9f 100644--- a/src/components/layout/app-shell.tsx+++ b/src/components/layout/app-shell.tsx@@ -2,20 +2,13 @@import Link from "next/link";import { usePathname, useRouter } from "next/navigation";-import {- useState,- type ComponentProps,- type CSSProperties,- type ReactNode,-} from "react";+import { useState, type ComponentProps, type ReactNode } from "react";import { Brand } from "@/components/layout/brand";import {primaryNavItems,type ShellNavItem,} from "@/components/layout/nav-items";-import { Avatar, AvatarFallback } from "@/components/ui/avatar";-import { Button } from "@/components/ui/button";import {DropdownMenu,DropdownMenuContent,@@ -24,23 +17,8 @@ import {DropdownMenuSeparator,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import {- Sidebar,- SidebarContent,- SidebarFooter,- SidebarGroup,- SidebarGroupContent,- SidebarGroupLabel,- SidebarHeader,- SidebarInset,- SidebarMenu,- SidebarMenuButton,- SidebarMenuItem,- SidebarProvider,- SidebarRail,- SidebarTrigger,-} from "@/components/ui/sidebar";import { authClient } from "@/lib/auth/client";+import { cn } from "@/lib/cn";type AppShellProps = {children: ReactNode;@@ -54,13 +32,6 @@ type AppShellProps = {type ShellSection = "documents" | "new-envelope" | "settings" | "workspace";-const sectionLabelMap: Record<ShellSection, string> = {- documents: "Documents",- "new-envelope": "New Envelope",- settings: "Settings",- workspace: "Workspace",-};-export function AppShell({children,showEmailSetupNotice = false,@@ -93,91 +64,49 @@ export function AppShell({}return (- <SidebarProvider- defaultOpen- style={- {- "--sidebar-width": "15.5rem",- "--sidebar-width-icon": "4.5rem",- "--sidebar-width-mobile": "19rem",- } as CSSProperties- }- >- <Sidebar className="border-r-0" collapsible="icon" variant="sidebar">- <SidebarHeader className="gap-4 border-b border-(--border) bg-white px-4 py-5 transition-all group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:px-3">- <div className="flex items-center justify-between gap-3 group-data-[collapsible=icon]:justify-center">- <Brand- className="transition-all group-data-[collapsible=icon]:hidden"- href="/"- />- <div className="hidden md:block">- <SidebarTrigger className="rounded-none border border-(--border) bg-white text-muted-foreground hover:border-black hover:bg-white hover:text-(--fg)" />- </div>+ <div className="flex min-h-screen flex-col">+ <header className="sticky top-0 z-30 bg-[rgba(243,244,248,0.86)] backdrop-blur-md">+ <div className="page-width flex flex-wrap items-center justify-between gap-x-6 gap-y-2 py-3 sm:py-4">+ <div className="flex min-w-0 items-center gap-7">+ <Brand href="/" />+ <nav+ aria-label="Workspace"+ className="hidden items-center gap-1 md:flex"+ >+ {primaryNavItems.map((item) => (+ <AppNavLink+ currentSection={currentSection}+ item={item}+ key={item.href}+ />+ ))}+ </nav></div>- </SidebarHeader>- <SidebarContent className="gap-5 bg-white px-2 py-5 group-data-[collapsible=icon]:px-3">- <SidebarGroup className="px-2 group-data-[collapsible=icon]:px-0">- <SidebarGroupLabel className="section-eyebrow px-2 text-(--tertiary) group-data-[collapsible=icon]:hidden">- Workspace- </SidebarGroupLabel>- <SidebarGroupContent>- <SidebarMenu>- {primaryNavItems.map((item) => (- <AppSidebarItem- currentSection={currentSection}- item={item}- key={item.href}- />- ))}- </SidebarMenu>- </SidebarGroupContent>- </SidebarGroup>- </SidebarContent>-- <SidebarFooter className="border-t border-(--border) bg-white px-3 py-4 group-data-[collapsible=icon]:px-3"><DropdownMenu><DropdownMenuTrigger asChild>- <Button- className="h-auto w-full justify-start gap-3 rounded-none border border-(--border) bg-white px-3 py-3 text-left text-(--fg) shadow-none hover:border-black hover:bg-white group-data-[collapsible=icon]:h-10 group-data-[collapsible=icon]:min-h-10! group-data-[collapsible=icon]:w-10 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:rounded-none group-data-[collapsible=icon]:p-0"- variant="outline"+ <button+ aria-label={`Account menu for ${user.name}`}+ className="inline-flex size-10 shrink-0 items-center justify-center rounded-full bg-[#ffd9c2] text-[0.8125rem] font-bold text-[#7a3412] transition hover:ring-4 hover:ring-[rgba(28,29,43,0.06)]"+ type="button">- <Avatar className="size-10 rounded-none bg-[#fff8f8] text-(--accent) group-data-[collapsible=icon]:size-8">- <AvatarFallback className="bg-[#fff8f8] text-sm font-semibold text-(--accent)">- {initials}- </AvatarFallback>- </Avatar>- <div className="min-w-0 group-data-[collapsible=icon]:hidden">- <p className="truncate text-sm font-semibold text-(--fg)">- {user.name}- </p>- <p className="truncate text-xs text-(--tertiary)">- {user.email}- </p>- </div>- </Button>+ {initials}+ </button></DropdownMenuTrigger>- <DropdownMenuContent- align="end"- className="w-64 rounded-none border border-(--border) bg-white p-2 shadow-none"- >+ <DropdownMenuContent align="end" className="w-64"><DropdownMenuLabel className="px-3 py-2">- <p className="text-sm font-semibold text-(--fg)">{user.name}</p>- <p className="mt-1 text-xs font-normal text-(--tertiary)">+ <p className="truncate text-sm font-bold text-(--fg)">+ {user.name}+ </p>+ <p className="mt-0.5 truncate text-xs font-normal text-(--tertiary)">{user.email}</p></DropdownMenuLabel><DropdownMenuSeparator /><DropdownMenuItem asChild>- <Link- className="rounded-xl px-3 py-2 text-sm font-medium text-(--fg)"- href="/settings"- >- Settings- </Link>+ <Link href="/settings">Settings</Link></DropdownMenuItem><DropdownMenuItem- className="rounded-xl px-3 py-2 text-sm font-medium text-(--accent)"disabled={isSigningOut}onSelect={(event: ComponentProps<@@ -195,97 +124,71 @@ export function AppShell({</DropdownMenuItem></DropdownMenuContent></DropdownMenu>- </SidebarFooter>-- <SidebarRail />- </Sidebar>- <SidebarInset className="min-h-screen bg-transparent">- <header className="sticky top-0 z-20 border-b border-(--border) bg-white md:hidden">- <div className="flex items-center justify-between gap-3 px-4 py-4">- <div className="flex items-center gap-3">- <Brand href="/" />- <div>- <p className="text-xs font-semibold uppercase tracking-[0.24em] text-(--tertiary)">- Sender app- </p>- <p className="text-sm font-semibold text-(--fg)">- {getSectionLabel(currentSection)}- </p>- </div>- </div>- <SidebarTrigger className="size-11 rounded-none border border-(--border) bg-white text-(--fg)" />- </div>- </header>-- <main className="flex-1 px-4 py-5 sm:px-6 sm:py-7 lg:px-8 xl:px-10">- <div className="mx-auto w-full max-w-[1080px]">- {showEmailSetupNotice && currentSection !== "settings" ? (- <div- className="mb-6 flex flex-col gap-3 border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-5 py-4 sm:flex-row sm:items-center sm:justify-between"- role="status"+ <nav+ aria-label="Workspace"+ className="-mx-1 flex w-full items-center gap-1 overflow-x-auto px-1 pb-1 md:hidden"+ >+ {primaryNavItems.map((item) => (+ <AppNavLink+ currentSection={currentSection}+ item={item}+ key={item.href}+ />+ ))}+ </nav>+ </div>+ </header>++ <main className="flex-1 pb-14 pt-2 sm:pt-4">+ <div className="page-width">+ {showEmailSetupNotice && currentSection !== "settings" ? (+ <div+ className="mb-5 flex flex-col gap-3 rounded-2xl bg-(--warning-soft) px-5 py-4 sm:flex-row sm:items-center sm:justify-between"+ role="status"+ >+ <p className="text-sm leading-6 text-(--fg)">+ <span className="font-bold">Email is not set up yet.</span>{" "}+ Until it is, signers and new users will not receive messages+ from this site.+ </p>+ <Link+ className="shrink-0 text-sm font-bold text-(--warning) underline underline-offset-4"+ href="/settings#organization">- <p className="text-sm leading-6 text-(--fg)">- <span className="font-semibold">- Email is not set up yet.- </span>{" "}- Until it is, signers and new users will not receive- messages from this site.- </p>- <Link- className="shrink-0 text-sm font-semibold text-(--accent) underline underline-offset-4"- href="/settings#organization"- >- Finish email setup- </Link>- </div>- ) : null}- {children}- </div>- </main>- </SidebarInset>- </SidebarProvider>+ Finish email setup+ </Link>+ </div>+ ) : null}+ {children}+ </div>+ </main>+ </div>);}-function AppSidebarItem({+function AppNavLink({currentSection,item,}: {currentSection: ShellSection;item: ShellNavItem;}) {- const isActive = isItemActive(currentSection, item.href);- const Icon = item.icon;+ const isActive = currentSection === resolveSection(item.href);return (- <SidebarMenuItem>- <SidebarMenuButton- asChild- className="min-h-12 rounded-none border border-transparent px-3.5 py-2 text-[0.95rem] font-medium text-muted-foreground data-[active=true]:border-(--border) data-[active=true]:bg-[#f7f7f8] data-[active=true]:text-(--fg) hover:border-(--border) hover:bg-[#f7f7f8] hover:text-(--fg) group-data-[collapsible=icon]:h-10! group-data-[collapsible=icon]:min-h-10! group-data-[collapsible=icon]:w-10! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:rounded-none group-data-[collapsible=icon]:p-0!"- isActive={isActive}- tooltip={item.label}- >- <Link- aria-current={isActive ? "page" : undefined}- className="flex w-full items-center gap-3 group-data-[collapsible=icon]:justify-center"- href={item.href}- >- <span- className={`inline-flex size-9 shrink-0 items-center justify-center rounded-none transition group-data-[collapsible=icon]:size-4 group-data-[collapsible=icon]:rounded-none group-data-[collapsible=icon]:bg-transparent ${- isActive- ? "bg-[#fff8f8] text-(--accent)"- : "bg-[#f7f7f8] text-muted-foreground"- }`}- >- <Icon className="size-4" />- </span>- <span className="truncate group-data-[collapsible=icon]:hidden">- {item.label}- </span>- </Link>- </SidebarMenuButton>- </SidebarMenuItem>+ <Link+ aria-current={isActive ? "page" : undefined}+ className={cn(+ "inline-flex min-h-9 shrink-0 items-center rounded-[0.625rem] px-3.5 text-sm transition",+ isActive+ ? "bg-white font-bold text-(--fg) shadow-(--shadow-xs)"+ : "font-semibold text-(--secondary) hover:bg-[rgba(255,255,255,0.6)] hover:text-(--fg)",+ )}+ href={item.href}+ >+ {item.label}+ </Link>);}@@ -309,14 +212,6 @@ function resolveSection(pathname: string): ShellSection {return "workspace";}-function isItemActive(currentSection: ShellSection, href: string) {- return currentSection === resolveSection(href);-}--function getSectionLabel(section: ShellSection) {- return sectionLabelMap[section];-}-function getInitials(name: string) {const segments = name.split(/\s+/)diff --git a/src/components/layout/auth-shell.tsx b/src/components/layout/auth-shell.tsxindex 5d9a4d0..d5fce2f 100644--- a/src/components/layout/auth-shell.tsx+++ b/src/components/layout/auth-shell.tsx@@ -40,9 +40,9 @@ export function AuthShell({ children }: AuthShellProps) {const showNavAction = navAction.href !== "/signup" || signupAvailable;return (- <div className="flex min-h-screen flex-col bg-white">- <header className="border-b border-(--border) bg-white">- <div className="editorial-shell flex items-center justify-between gap-4 px-0 py-5">+ <div className="flex min-h-screen flex-col">+ <header>+ <div className="page-width flex items-center justify-between gap-4 py-4"><Brand href="/" /><navaria-label="Public navigation"@@ -51,7 +51,7 @@ export function AuthShell({ children }: AuthShellProps) {<PublicSessionMenu>{showNavAction ? (<Link- className="editorial-meta transition-colors hover:text-(--fg)"+ className="btn-quiet min-h-10 px-4 text-sm"href={navAction.href}prefetch>@@ -63,7 +63,7 @@ export function AuthShell({ children }: AuthShellProps) {</div></header>- <main className="editorial-shell flex flex-1 items-start justify-center px-0 py-12 sm:py-16">+ <main className="page-width flex flex-1 items-start justify-center py-8 sm:py-14"><div className="flex w-full justify-center" data-animate="enter">{children}</div>diff --git a/src/components/layout/brand.tsx b/src/components/layout/brand.tsxindex 0044350..8a2868f 100644--- a/src/components/layout/brand.tsx+++ b/src/components/layout/brand.tsx@@ -3,7 +3,7 @@import Link from "next/link";import { useBranding } from "@/components/layout/branding-provider";-import { SIGNUDOC_NAME } from "@/lib/branding";+import { cn } from "@/lib/cn";type BrandProps = {className?: string;@@ -23,22 +23,49 @@ export function Brand({return (<Linkaria-label={productName}- className={`inline-flex min-w-0 items-center text-(--fg) ${className}`}+ className={cn(+ "inline-flex min-w-0 items-center gap-2.5 text-(--fg)",+ className,+ )}href={href}>+ <BrandMark />{!compact ? (<span- className={`max-w-[60vw] truncate text-[1.28rem] font-extrabold tracking-[-0.035em] sm:max-w-[22rem] sm:text-[1.45rem] ${labelClassName}`}- >- {productName === SIGNUDOC_NAME ? (- <>- Signu<span className="text-(--accent)">Doc</span>- </>- ) : (- productName+ className={cn(+ "max-w-[52vw] truncate text-[1.125rem] font-extrabold tracking-[-0.02em] sm:max-w-[22rem] sm:text-[1.1875rem]",+ labelClassName,)}+ >+ {productName}</span>) : null}</Link>);}++/** The signature stroke on a violet tile. Decorative: the link carries the name. */+export function BrandMark({ className = "" }: { className?: string }) {+ return (+ <span+ aria-hidden="true"+ className={cn(+ "inline-flex size-7 shrink-0 items-center justify-center rounded-[0.5625rem] bg-(--accent)",+ className,+ )}+ >+ <svg+ fill="none"+ height="16"+ stroke="#fff"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="2.4"+ viewBox="0 0 24 24"+ width="16"+ >+ <path d="M4 16c3 0 4-8 7-8s2 7 5 7 2-3 4-3" />+ </svg>+ </span>+ );+}diff --git a/src/components/layout/canvas-shell.tsx b/src/components/layout/canvas-shell.tsxindex de5aef1..bf4ff58 100644--- a/src/components/layout/canvas-shell.tsx+++ b/src/components/layout/canvas-shell.tsx@@ -32,23 +32,18 @@ export function CanvasShell({const nextButtonLabel = nextLoading ? "Loading..." : (nextLabel ?? "Next");return (- <div className="min-h-screen bg-(--canvas-wash)">- <header className="sticky top-0 z-20 border-b border-(--border) bg-white">- <div className="flex min-h-18 items-center justify-between gap-3 px-4 py-3 sm:px-6 lg:px-8">- <Link- className="inline-flex min-h-11 items-center gap-2 rounded-none border border-(--border) bg-white px-4 [font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.18em] text-(--fg) transition hover:border-black"- href={backHref}- >- <ChevronLeftIcon className="size-4" />+ <div className="min-h-screen bg-(--page)">+ <header className="sticky top-0 z-20 bg-[rgba(255,255,255,0.92)] shadow-[0_1px_0_rgba(28,29,43,0.06)] backdrop-blur-md">+ <div className="flex min-h-[4.5rem] items-center justify-between gap-3 px-4 py-3 sm:px-6">+ <Link className="btn-quiet min-h-11 px-3.5" href={backHref}>+ <ChevronLeftIcon aria-hidden="true" className="-ml-1 size-4" />{backLabel}</Link><div className="min-w-0 text-center">- <p className="truncate text-base font-bold tracking-[-0.03em] text-(--fg) sm:text-lg">+ <p className="truncate text-base font-extrabold tracking-[-0.02em] text-(--fg) sm:text-lg">{title}</p>- <p className="mt-1 section-eyebrow">- {stepLabel}- </p>+ <p className="section-eyebrow mt-0.5">{stepLabel}</p></div>{nextHref && !nextDisabled && !nextLoading ? (<Button asChild>diff --git a/src/components/layout/nav-items.tsx b/src/components/layout/nav-items.tsxindex 48739dc..5e72a8d 100644--- a/src/components/layout/nav-items.tsx+++ b/src/components/layout/nav-items.tsx@@ -1,31 +1,16 @@-import type { LucideIcon } from "lucide-react";-import {- ChevronLeft,- ChevronRight,- FileText,- Menu,- PanelLeftClose,- PanelLeftOpen,- SquarePen,-} from "lucide-react";+import { ChevronLeft, ChevronRight } from "lucide-react";export type ShellNavItem = {href: string;label: string;- icon: LucideIcon;};export const primaryNavItems: ShellNavItem[] = [- { href: "/dashboard", label: "Documents", icon: FileText },- { href: "/envelopes/new", label: "New Envelope", icon: SquarePen },+ { href: "/dashboard", label: "Documents" },+ { href: "/envelopes/new", label: "New envelope" },+ { href: "/settings", label: "Settings" },];-export const MenuIcon = Menu;--export const CollapseIcon = PanelLeftClose;--export const ExpandIcon = PanelLeftOpen;-export const ChevronLeftIcon = ChevronLeft;export const ChevronRightIcon = ChevronRight;diff --git a/src/components/layout/public-document-shell.tsx b/src/components/layout/public-document-shell.tsxindex c07eb4c..0c4453b 100644--- a/src/components/layout/public-document-shell.tsx+++ b/src/components/layout/public-document-shell.tsx@@ -18,31 +18,31 @@ export function PublicDocumentShell({title,}: PublicDocumentShellProps) {return (- <div className="flex min-h-screen flex-col bg-white text-(--fg)">- <header className="border-b border-(--border) bg-white">- <div className="editorial-shell flex items-center justify-between gap-4 px-0 py-5">+ <div className="flex min-h-screen flex-col text-(--fg)">+ <header>+ <div className="page-width flex items-center justify-between gap-4 py-4"><Brand href="/" /><PublicSessionMenu /></div></header>- <main className="flex-1 py-10 sm:py-12 lg:py-14">- <div className="editorial-shell">+ <main className="flex-1 pb-10 pt-2 sm:pt-4">+ <div className="page-width"><article- className="editorial-panel overflow-hidden"+ className="panel mx-auto max-w-[880px] overflow-hidden"data-animate="enter">- <div className="border-b border-(--border) px-6 py-8 sm:px-10 sm:py-10">- <p className="editorial-meta">Last updated {lastUpdated}</p>- <h1 className="mt-4 max-w-[18ch] text-[clamp(2.3rem,5vw,4rem)] font-extrabold leading-[1.02] tracking-[-0.045em] text-black">+ <div className="px-6 pb-2 pt-9 sm:px-12 sm:pt-12">+ <p className="section-eyebrow">Last updated {lastUpdated}</p>+ <h1 className="mt-3 max-w-[20ch] text-[clamp(2rem,4.5vw,3rem)] font-extrabold leading-[1.06] tracking-[-0.035em] text-(--fg)">{title}</h1>- <p className="mt-5 max-w-[760px] text-base leading-7 text-muted-foreground sm:text-[1.02rem]">+ <p className="mt-4 max-w-[680px] text-base leading-7 text-(--secondary) sm:text-[1.0625rem]">{description}</p></div>- <div className="space-y-10 px-6 py-8 text-sm leading-7 text-muted-foreground sm:px-10 sm:py-10 sm:text-[15px]">+ <div className="space-y-9 px-6 py-8 text-[0.9375rem] leading-7 text-(--secondary) sm:px-12 sm:pb-12 sm:pt-9">{children}</div></article>diff --git a/src/components/layout/public-legal-links.tsx b/src/components/layout/public-legal-links.tsxindex 8228c6e..a7f7d10 100644--- a/src/components/layout/public-legal-links.tsx+++ b/src/components/layout/public-legal-links.tsx@@ -1,19 +1,12 @@"use client";import Link from "next/link";-import { IBM_Plex_Mono } from "next/font/google";import { useBranding } from "@/components/layout/branding-provider";import { SIGNUDOC_NAME, SIGNUDOC_URL } from "@/lib/branding";import { PUBLIC_COPYRIGHT_YEAR, publicFooterLinks } from "@/lib/legal";import { cn } from "@/lib/cn";-const ibmPlexMono = IBM_Plex_Mono({- display: "swap",- subsets: ["latin"],- weight: ["400", "500", "600", "700"],-});-type PublicLegalFooterProps = {className?: string;contentClassName?: string;@@ -34,10 +27,9 @@ export function PublicLegalFooter({linkClassName,}: PublicLegalFooterProps) {const branding = useBranding();- const monoClassName = ibmPlexMono.className;const resolvedLinkClassName =linkClassName ??- `${monoClassName} text-xs text-[#71717a] transition-colors hover:text-black`;+ "text-[0.8125rem] font-medium text-(--tertiary) transition-colors hover:text-(--accent-ink)";// The hosted service links to its own pages. Any other install links to// whatever terms and privacy policy its organization has published.const links: FooterLink[] = branding.hosted@@ -68,27 +60,17 @@ export function PublicLegalFooter({];return (- <footer- className={cn(- "relative z-10 border-t border-[#d4d4d4] bg-white",- className,- )}- >- <div- className={cn(- "mx-auto max-w-[1200px] px-6 py-8 sm:px-8 lg:px-10",- contentClassName,- )}- >+ <footer className={cn("relative z-10", className)}>+ <div className={cn("page-width py-7", contentClassName)}><div className="flex flex-col items-center justify-between gap-4 sm:flex-row">- <p className={`${monoClassName} text-xs text-[#71717a]`}>+ <p className="text-[0.8125rem] text-(--tertiary)">© {PUBLIC_COPYRIGHT_YEAR} {branding.productName}</p>{links.length > 0 ? (<navaria-label="Footer"- className="flex flex-wrap items-center justify-center gap-6"+ className="flex flex-wrap items-center justify-center gap-x-6 gap-y-2">{links.map((link) =>link.external ? (@@ -114,14 +96,9 @@ export function PublicLegalFooter({</nav>) : null}- {branding.hosted ? (- <div className="hidden items-center gap-2 sm:flex">- <span className="h-[2px] w-8 bg-[#e50000]" />- <span className="inline-block h-[6px] w-[6px] rounded-full bg-[#e50000]" />- </div>- ) : (+ {branding.hosted ? null : (<a- className={`${monoClassName} text-xs text-[#71717a] transition-colors hover:text-black`}+ className={resolvedLinkClassName}href={SIGNUDOC_URL}rel="noreferrer"target="_blank"diff --git a/src/components/layout/public-session-menu.tsx b/src/components/layout/public-session-menu.tsxindex 19cdec8..31939f2 100644--- a/src/components/layout/public-session-menu.tsx+++ b/src/components/layout/public-session-menu.tsx@@ -2,14 +2,8 @@import Link from "next/link";import { useState, type ReactNode } from "react";-import {- CircleUserRound,- LayoutDashboard,- LogOut,-} from "lucide-react";+import { CircleUserRound, LayoutDashboard, LogOut } from "lucide-react";-import { Avatar, AvatarFallback } from "@/components/ui/avatar";-import { Button } from "@/components/ui/button";import {DropdownMenu,DropdownMenuContent,@@ -60,54 +54,37 @@ export function PublicSessionMenu({return (<DropdownMenu><DropdownMenuTrigger asChild>- <Button+ <buttonaria-label="Open account menu"className={cn(- "rounded-none border border-(--border) bg-white text-(--fg) shadow-none hover:border-black hover:bg-white hover:text-(--fg)",+ "inline-flex size-10 shrink-0 items-center justify-center rounded-full bg-[#ffd9c2] text-[0.8125rem] font-bold text-[#7a3412] transition hover:ring-4 hover:ring-[rgba(28,29,43,0.06)]",buttonClassName,)}- size="icon-sm"- variant="outline"+ type="button">- <Avatar className="size-8 rounded-none bg-[#fff8f8] text-(--accent)">- <AvatarFallback className="bg-[#fff8f8] text-sm font-semibold text-(--accent)">- {initials ? (- initials- ) : (- <CircleUserRound className="size-4 text-(--accent)" />- )}- </AvatarFallback>- </Avatar>- </Button>+ {initials ? initials : <CircleUserRound className="size-4" />}+ </button></DropdownMenuTrigger><DropdownMenuContentalign={align}- className={cn(- "w-56 rounded-none border border-(--border) bg-white p-2 shadow-none",- contentClassName,- )}+ className={cn("w-60", contentClassName)}><DropdownMenuLabel className="px-3 py-2">- <p className="truncate text-sm font-semibold text-(--fg)">+ <p className="truncate text-sm font-bold text-(--fg)">{session.user.name}</p>- <p className="mt-1 truncate text-xs font-normal text-(--tertiary)">+ <p className="mt-0.5 truncate text-xs font-normal text-(--tertiary)">{session.user.email}</p></DropdownMenuLabel><DropdownMenuSeparator /><DropdownMenuItem asChild>- <Link- className="rounded-xl px-3 py-2 text-sm font-medium text-(--fg)"- href="/dashboard"- prefetch- >+ <Link href="/dashboard" prefetch><LayoutDashboard className="size-4" />Dashboard</Link></DropdownMenuItem><DropdownMenuItem- className="rounded-xl px-3 py-2 text-sm font-medium text-(--accent)"disabled={isSigningOut}onSelect={(event) => {event.preventDefault();diff --git a/src/components/not-found/not-found-shell.tsx b/src/components/not-found/not-found-shell.tsxindex b233510..b01caa3 100644--- a/src/components/not-found/not-found-shell.tsx+++ b/src/components/not-found/not-found-shell.tsx@@ -26,27 +26,27 @@ export function NotFoundShell({const ctaLabel = authenticated ? "Go to Dashboard" : "Go to Home";return (- <main className="min-h-screen bg-white px-4 py-6 sm:px-6 sm:py-8 lg:px-8">- <div className="mx-auto flex min-h-[calc(100vh-3rem)] max-w-[1080px] items-center justify-center sm:min-h-[calc(100vh-4rem)]">- <section className="relative w-full max-w-[620px] overflow-hidden border border-(--border) bg-white px-6 py-16 text-center sm:px-10 sm:py-20">- <div className="relative">- <p className="section-eyebrow">Unavailable</p>- <h1 className="mt-4 text-[clamp(2.4rem,6vw,4rem)] font-extrabold leading-[1.02] tracking-[-0.05em] text-(--fg)">- Page not found- </h1>- <p className="mx-auto mt-4 max-w-md text-sm leading-7 text-muted-foreground sm:text-base">- The page you're looking for doesn't exist or has been- moved.- </p>-- <div className="mt-8 flex justify-center">- <ShellButton className="px-6" href={ctaHref}>- {ctaLabel}- </ShellButton>- </div>- </div>- </section>- </div>+ <main className="flex min-h-screen items-center justify-center px-4 py-10">+ <section+ className="panel w-full max-w-[560px] px-6 py-14 text-center sm:px-12 sm:py-16"+ data-animate="enter"+ >+ <p className="text-[4.5rem] font-extrabold leading-none tracking-[-0.05em] text-(--accent)">+ 404+ </p>+ <h1 className="mt-4 text-[clamp(1.875rem,5vw,2.5rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">+ Page not found+ </h1>+ <p className="mx-auto mt-3 max-w-md text-base leading-7 text-(--secondary)">+ The page you're looking for doesn't exist or has been moved.+ </p>++ <div className="mt-8 flex justify-center">+ <ShellButton className="px-6" href={ctaHref}>+ {ctaLabel}+ </ShellButton>+ </div>+ </section></main>);}diff --git a/src/components/settings/organization-settings.tsx b/src/components/settings/organization-settings.tsxindex 5b3e515..9d1cdc0 100644--- a/src/components/settings/organization-settings.tsx+++ b/src/components/settings/organization-settings.tsx@@ -145,7 +145,7 @@ export function OrganizationSettings({return (<section- className="editorial-panel scroll-mt-6 p-6 sm:p-8"+ className="panel scroll-mt-6 p-6 sm:p-8"data-animate="enter"data-animate-delay="2"id="organization"@@ -153,10 +153,10 @@ export function OrganizationSettings({<div className="space-y-8"><div className="space-y-2"><p className="section-eyebrow">Administrator</p>- <h2 className="text-2xl font-bold tracking-[-0.035em] text-(--fg)">+ <h2 className="text-2xl font-extrabold tracking-[-0.03em] text-(--fg)">Organization</h2>- <p className="max-w-2xl text-sm leading-6 text-muted-foreground">+ <p className="max-w-2xl text-sm leading-6 text-(--secondary)">These settings apply to everyone who uses this site. Only you, theadministrator, can see and change them.</p>@@ -164,10 +164,8 @@ export function OrganizationSettings({{feedback ? (<p- className={`border px-5 py-4 text-sm font-semibold ${- feedback.tone === "success"- ? "border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.05)] text-chart-4"- : "border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] text-(--accent)"+ className={`notice ${+ feedback.tone === "success" ? "notice-success" : "notice-danger"}`}role={feedback.tone === "error" ? "alert" : "status"}>@@ -190,22 +188,22 @@ export function OrganizationSettings({</div><fieldset className="space-y-4 border-t border-(--border) pt-8">- <legend className="float-left mb-4 w-full text-xl font-bold tracking-[-0.03em] text-(--fg)">+ <legend className="float-left mb-4 w-full text-lg font-extrabold tracking-[-0.02em] text-(--fg)">Who can create an account</legend>- <p className="clear-both max-w-2xl text-sm leading-6 text-muted-foreground">+ <p className="clear-both max-w-2xl text-sm leading-6 text-(--secondary)">This is about people who send documents. People who are sent adocument to sign never need an account.</p><div className="space-y-3">{signupModeOptions.map((option) => (<label- className="flex cursor-pointer items-start gap-3 border border-(--border) bg-white px-4 py-3 has-[:checked]:border-black"+ className="flex cursor-pointer items-start gap-3 rounded-2xl bg-(--surface) px-4 py-3.5 ring-2 ring-transparent transition has-[:checked]:bg-(--accent-softer) has-[:checked]:ring-(--accent)"key={option.value}><inputchecked={values.signupMode === option.value}- className="mt-1 accent-black"+ className="mt-1 size-4 accent-(--accent)"disabled={isSaving}name="signup-mode"onChange={() => handleSignupModeChange(option.value)}@@ -213,10 +211,10 @@ export function OrganizationSettings({value={option.value}/><span className="space-y-1">- <span className="block text-sm font-semibold text-(--fg)">+ <span className="block text-sm font-bold text-(--fg)">{option.label}</span>- <span className="block text-sm leading-6 text-muted-foreground">+ <span className="block text-sm leading-6 text-(--secondary)">{option.description}</span></span>@@ -241,7 +239,7 @@ export function OrganizationSettings({</fieldset><div className="space-y-5 border-t border-(--border) pt-8">- <h3 className="text-xl font-bold tracking-[-0.03em] text-(--fg)">+ <h3 className="text-lg font-extrabold tracking-[-0.02em] text-(--fg)">Email addresses</h3><div className="grid gap-4 sm:grid-cols-2">@@ -283,10 +281,10 @@ export function OrganizationSettings({{!values.hosted ? (<div className="space-y-5 border-t border-(--border) pt-8"><div className="space-y-2">- <h3 className="text-xl font-bold tracking-[-0.03em] text-(--fg)">+ <h3 className="text-lg font-extrabold tracking-[-0.02em] text-(--fg)">Your terms and privacy policy</h3>- <p className="max-w-2xl text-sm leading-6 text-muted-foreground">+ <p className="max-w-2xl text-sm leading-6 text-(--secondary)">Optional. Links to pages on your own website, shown in thefooter of this site and of its emails.</p>@@ -418,35 +416,30 @@ function EmailSetupPanel() {return (<div className="space-y-5 border-t border-(--border) pt-8" id="email-setup">- <h3 className="text-xl font-bold tracking-[-0.03em] text-(--fg)">+ <h3 className="text-lg font-extrabold tracking-[-0.02em] text-(--fg)">Email setup</h3>{loadError ? (- <p- className="border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] px-5 py-4 text-sm font-semibold text-(--accent)"- role="alert"- >+ <p className="notice notice-danger" role="alert">{loadError}</p>) : null}{!summary ? (loadError ? null : (- <p className="text-sm text-muted-foreground">Checking email…</p>+ <p className="text-sm text-(--secondary)">Checking email…</p>)) : (<div- className={`space-y-3 border px-5 py-4 ${- summary.ready- ? "border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.05)]"- : "border-(--border) bg-(--surface)"+ className={`space-y-2 rounded-2xl px-5 py-4 ${+ summary.ready ? "bg-(--success-soft)" : "bg-(--surface)"}`}data-email-state={status?.state}>- <p className="text-sm font-semibold text-(--fg)">{summary.title}</p>+ <p className="text-sm font-bold text-(--fg)">{summary.title}</p>{summary.lines.map((line) => (- <p className="text-sm leading-6 text-muted-foreground" key={line}>+ <p className="text-sm leading-6 text-(--secondary)" key={line}>{line}</p>))}@@ -501,10 +494,8 @@ function EmailSetupPanel() {{testResult ? (<p- className={`border px-5 py-4 text-sm font-semibold ${- testResult.tone === "success"- ? "border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.05)] text-chart-4"- : "border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] text-(--accent)"+ className={`notice ${+ testResult.tone === "success" ? "notice-success" : "notice-danger"}`}role={testResult.tone === "error" ? "alert" : "status"}>@@ -605,18 +596,18 @@ function DnsRecordsTable({}) {if (records.length === 0) {return (- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-sm leading-6 text-(--secondary)">Resend did not list any records for {domain}. Open Resend to see them.</p>);}return (- <div className="overflow-x-auto border border-(--border)">+ <div className="overflow-x-auto rounded-2xl border border-(--border)"><table className="w-full min-w-[640px] border-collapse text-left text-sm"><caption className="sr-only">DNS records to add for {domain}</caption><thead>- <tr className="border-b border-(--border) bg-(--surface) text-xs uppercase tracking-[0.14em] text-(--tertiary)">+ <tr className="border-b border-(--border) bg-(--surface) text-xs text-(--tertiary)"><th className="px-4 py-3 font-semibold" scope="col">Type</th>@@ -645,13 +636,13 @@ function DnsRecordsTable({</span>) : null}</td>- <td className="px-4 py-3 [font-family:var(--font-mono)] text-[0.8rem] break-all text-(--fg)">+ <td className="px-4 py-3 font-mono text-[0.8rem] break-all text-(--fg)">{record.name}</td>- <td className="px-4 py-3 [font-family:var(--font-mono)] text-[0.8rem] break-all text-(--fg)">+ <td className="px-4 py-3 font-mono text-[0.8rem] break-all text-(--fg)">{record.value}</td>- <td className="px-4 py-3 text-muted-foreground">+ <td className="px-4 py-3 text-(--secondary)">{record.status === "verified" ? "Found" : "Not found yet"}</td></tr>diff --git a/src/components/settings/settings-shell.tsx b/src/components/settings/settings-shell.tsxindex 401c139..ceaf21d 100644--- a/src/components/settings/settings-shell.tsx+++ b/src/components/settings/settings-shell.tsx@@ -550,22 +550,17 @@ export function SettingsShell({}return (- <div className="space-y-8">+ <div className="space-y-5"><PageHeaderdescription="Manage your sender profile, password, and account lifecycle."- eyebrow="Account"title="Settings"/>{feedback ? <SettingsFeedback feedback={feedback} /> : null}- <section- className="editorial-panel p-6 sm:p-8"- data-animate="enter"- data-animate-delay="1"- >- <div className="space-y-8">- <div className="space-y-5">+ <section data-animate="enter" data-animate-delay="1">+ <div className="space-y-5">+ <div className="panel space-y-5 p-6 sm:p-8"><SectionHeading title="Profile" /><form className="space-y-5" onSubmit={handleProfileSubmit}>@@ -590,7 +585,7 @@ export function SettingsShell({value={profileValues.email}/></div>- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-sm leading-6 text-(--secondary)">Email changes are verified through your current inbox first,then the new inbox.</p>@@ -605,7 +600,7 @@ export function SettingsShell({</form></div>- <div className="border-t border-(--border) pt-8">+ <div className="panel p-6 sm:p-8"><div className="space-y-5"><SectionHeading title="Password" />@@ -661,17 +656,17 @@ export function SettingsShell({</div></div>- <div className="border-t border-(--border) pt-8">+ <div className="panel p-6 sm:p-8"><div className="space-y-5"><SectionHeading title="Danger zone" />- <p className="max-w-2xl text-sm leading-6 text-muted-foreground">+ <p className="max-w-2xl text-sm leading-6 text-(--secondary)">Before closing your account, download any documents you want tokeep. After closure, {productName} may provide a 30-day export windowand then delete stored document files and related enveloperecords.</p><ShellButton- className="w-fit"+ className="w-fit border-[rgba(180,35,24,0.35)] text-(--danger) hover:border-(--danger) hover:bg-(--danger-soft) hover:text-(--danger)"disabled={isBusy}onClick={openClosureDialog}variant="secondary"@@ -699,7 +694,7 @@ export function SettingsShell({function SectionHeading({ title }: Readonly<{ title: string }>) {return (- <h2 className="text-xl font-bold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">{title}</h2>);@@ -710,17 +705,14 @@ function SettingsFeedback({}: Readonly<{feedback: Exclude<FeedbackMessage, null>;}>) {- const toneClasses =- feedback.tone === "success"- ? "border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.05)] text-chart-4"- : "border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.04)] text-(--accent)";-return (<section- className={`border px-5 py-4 ${toneClasses}`}+ className={`notice ${+ feedback.tone === "success" ? "notice-success" : "notice-danger"+ }`}role={feedback.tone === "error" ? "alert" : "status"}>- <p className="text-sm font-semibold">{feedback.message}</p>+ <p>{feedback.message}</p></section>);}@@ -753,16 +745,11 @@ function AccountClosureDialog({}}}>- <DialogContent- className="max-w-lg rounded-none border-(--border) sm:p-8"- showCloseButton={false}- >+ <DialogContent className="max-w-lg sm:p-8" showCloseButton={false}><div className="space-y-5"><DialogHeader className="space-y-3">- <DialogTitle className="text-xl tracking-[-0.03em]">- Request account closure?- </DialogTitle>- <DialogDescription className="text-sm leading-6 text-muted-foreground">+ <DialogTitle>Request account closure?</DialogTitle>+ <DialogDescription className="text-sm leading-6 text-(--secondary)">Before closing your account, download any documents you want tokeep. After closure, {productName} may provide a 30-day export windowand then delete stored document files and related envelope@@ -772,7 +759,7 @@ function AccountClosureDialog({<Field className="gap-2 text-sm"><FieldLabel- className="font-semibold text-(--fg)"+ className="text-[0.8125rem] font-semibold text-(--secondary)"htmlFor="close-account-confirmation">Type "close my account" to confirm:@@ -799,6 +786,7 @@ function AccountClosureDialog({disabled={!isReady}loading={isSubmitting}onClick={onConfirm}+ variant="danger">{isSubmitting ? "Requesting..." : "Request closure"}</ShellButton>diff --git a/src/components/setup/setup-shell.tsx b/src/components/setup/setup-shell.tsxindex 75e7b00..938cb4b 100644--- a/src/components/setup/setup-shell.tsx+++ b/src/components/setup/setup-shell.tsx@@ -48,17 +48,17 @@ const emptyValues: SetupValues = {export function SetupShell({ hosted, onVercel, view }: SetupShellProps) {return (- <div className="flex min-h-screen flex-col bg-white">- <header className="border-b border-(--border) bg-white">- <div className="editorial-shell flex items-center justify-between gap-4 px-0 py-5">+ <div className="flex min-h-screen flex-col">+ <header>+ <div className="page-width flex items-center justify-between gap-4 py-4"><Brand href="/setup" />- <p className="editorial-meta">Setup</p>+ <span className="pill pill-accent">Setup</span></div></header>- <main className="editorial-shell flex flex-1 items-start justify-center px-0 py-12 sm:py-16">+ <main className="page-width flex flex-1 items-start justify-center py-8 sm:py-14"><div className="flex w-full justify-center" data-animate="enter">- <section className="editorial-panel w-full max-w-[520px] p-8 sm:p-10">+ <section className="panel w-full max-w-[520px] p-8 sm:p-10"><SetupContent hosted={hosted} onVercel={onVercel} view={view} /></section></div>@@ -166,12 +166,11 @@ function SetupNotice({return (<div className="space-y-5"><div className="space-y-2">- <p className="section-eyebrow">Setup</p>- <h1 className="text-[clamp(2rem,4.6vw,2.7rem)] font-extrabold leading-[1.04] tracking-[-0.045em] text-black">+ <h1 className="text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">{title}</h1></div>- <div className="space-y-4 text-sm leading-6 text-muted-foreground [&_code]:[font-family:var(--font-mono)] [&_code]:text-[0.82rem] [&_code]:text-(--fg)">+ <div className="space-y-4 text-sm leading-6 text-muted-foreground [&_code]:rounded-md [&_code]:bg-(--surface) [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.8125rem] [&_code]:text-(--fg)">{children}</div></div>@@ -291,8 +290,7 @@ function SetupForm({return (<div className="space-y-7"><div className="space-y-2">- <p className="section-eyebrow">Setup</p>- <h1 className="text-[clamp(2rem,4.6vw,2.7rem)] font-extrabold leading-[1.04] tracking-[-0.045em] text-black">+ <h1 className="text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold leading-[1.08] tracking-[-0.035em] text-(--fg)">{isCreate ? "Set up your site" : "Choose an administrator"}</h1><p className="pt-1 text-sm leading-6 text-muted-foreground">@@ -303,10 +301,7 @@ function SetupForm({</div>{bannerMessage ? (- <p- className="rounded-[22px] border border-[rgba(180,35,53,0.16)] bg-[rgba(180,35,53,0.06)] px-4 py-3 text-sm font-medium text-(--accent)"- role="alert"- >+ <p className="notice notice-danger" role="alert">{bannerMessage}</p>) : null}@@ -414,10 +409,10 @@ function SetupForm({</form>{!isCreate ? (- <p className="border-t border-(--border) pt-5 text-sm text-muted-foreground">+ <p className="border-t border-(--border) pt-5 text-sm text-(--secondary)">Not the right account?{" "}<button- className="cursor-pointer font-semibold text-(--fg) transition hover:text-(--accent) disabled:cursor-default disabled:opacity-60"+ className="cursor-pointer font-bold text-(--accent-ink) underline-offset-4 hover:underline disabled:cursor-default disabled:opacity-60"disabled={isSwitchingAccount}onClick={handleSwitchAccount}type="button"diff --git a/src/components/shared/document-thumbnail.tsx b/src/components/shared/document-thumbnail.tsxnew file mode 100644index 0000000..729d6c8--- /dev/null+++ b/src/components/shared/document-thumbnail.tsx@@ -0,0 +1,363 @@+"use client";++import { useEffect, useRef, useState } from "react";++import { cn } from "@/lib/cn";+import {+ backfillEnvelopeThumbnail,+ buildEnvelopeThumbnailUrl,+} from "@/lib/pdf-thumbnail";++type DocumentThumbnailProps = {+ className?: string;+ /** Leave out for a plain stand-in page. */+ envelopeId?: string;+ title: string;+};++type ThumbnailState = "drawn" | "loading" | "missing" | "stored";++/**+ * A mini version of a document's first page, with rounded corners.+ *+ * The stored picture is tried first. An envelope from before thumbnails+ * existed has none, so its first page is drawn here from the PDF and saved+ * for next time. If that cannot be done either, a stand-in page is shown.+ */+export function DocumentThumbnail({+ className,+ envelopeId,+ title,+}: DocumentThumbnailProps) {+ const [state, setState] = useState<ThumbnailState>(+ envelopeId ? "loading" : "missing",+ );+ const [drawnUrl, setDrawnUrl] = useState<string | null>(null);+ const imageRef = useRef<HTMLImageElement | null>(null);+ const isMountedRef = useRef(true);++ useEffect(() => {+ isMountedRef.current = true;++ return () => {+ isMountedRef.current = false;+ };+ }, []);++ useEffect(() => {+ return () => {+ if (drawnUrl) {+ URL.revokeObjectURL(drawnUrl);+ }+ };+ }, [drawnUrl]);++ // An image that finished loading, or failing, before React attached its+ // handlers never fires them.+ useEffect(() => {+ const image = imageRef.current;++ if (!image || !image.complete || state !== "loading") {+ return;+ }++ if (image.naturalWidth > 0) {+ setState("stored");+ } else {+ handleStoredThumbnailMissing();+ }+ // Only on mount: later changes come through the image's own events.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);++ function handleStoredThumbnailMissing() {+ if (!envelopeId || state !== "loading" || drawnUrl) {+ return;+ }++ backfillEnvelopeThumbnail(envelopeId)+ .then((thumbnail) => {+ if (!isMountedRef.current) {+ return;+ }++ setDrawnUrl(URL.createObjectURL(thumbnail));+ setState("drawn");+ })+ .catch(() => {+ if (isMountedRef.current) {+ setState("missing");+ }+ });+ }++ const frameClassName = cn(+ "block h-full w-auto max-w-full rounded-[0.5rem] bg-white object-contain shadow-[0_1px_2px_rgba(28,29,43,0.08),0_6px_16px_rgba(28,29,43,0.10)] ring-1 ring-[rgba(28,29,43,0.06)]",+ className,+ );++ if (state === "missing" || !envelopeId) {+ return <PagePlaceholder className={className} title={title} />;+ }++ if (state === "drawn" && drawnUrl) {+ return (+ // A blob: URL made in this browser: next/image has nothing to optimize.+ // eslint-disable-next-line @next/next/no-img-element+ <img+ alt={`First page of ${title}`}+ className={frameClassName}+ decoding="async"+ src={drawnUrl}+ />+ );+ }++ return (+ <span className="relative flex h-full max-w-full items-center justify-center">+ {state === "loading" ? (+ <PagePlaceholder+ className={cn("animate-pulse", className)}+ title={title}+ />+ ) : null}+ {/* A private, per-account image behind a session cookie: next/image+ would fetch it from the server without that cookie. */}+ {/* eslint-disable-next-line @next/next/no-img-element */}+ <img+ alt={`First page of ${title}`}+ className={+ state === "loading"+ ? "pointer-events-none absolute left-1/2 top-1/2 size-px opacity-0"+ : frameClassName+ }+ decoding="async"+ loading="lazy"+ onError={handleStoredThumbnailMissing}+ onLoad={() => setState("stored")}+ ref={imageRef}+ src={buildEnvelopeThumbnailUrl(envelopeId)}+ />+ </span>+ );+}++const placeholderLayouts = [+ { centered: true, lines: ["w-full", "w-11/12", "w-4/5", "w-full", "w-2/3"] },+ { centered: false, lines: ["w-11/12", "w-full", "w-3/4", "w-5/6", "w-1/2"] },+ { centered: true, lines: ["w-5/6", "w-full", "w-full", "w-3/5", "w-4/5"] },+] as const;++/**+ * A blank page with a few grey lines, for when there is no picture. The+ * title picks one of a few layouts so a row of them does not look stamped.+ */+function PagePlaceholder({+ className,+ title = "",+}: {+ className?: string;+ title?: string;+}) {+ const layout =+ placeholderLayouts[title.length % placeholderLayouts.length] ??+ placeholderLayouts[0];++ return (+ <span+ aria-hidden="true"+ className={cn(+ "flex aspect-[17/22] h-full flex-col gap-[7%] rounded-[0.5rem] bg-white px-[12%] py-[14%] shadow-[0_1px_2px_rgba(28,29,43,0.08),0_6px_16px_rgba(28,29,43,0.10)] ring-1 ring-[rgba(28,29,43,0.06)]",+ className,+ )}+ >+ <span+ className={cn(+ "h-[4%] w-3/5 rounded-full bg-[#cfd0dc]",+ layout.centered && "self-center",+ )}+ />+ {layout.lines.map((width, index) => (+ <span+ className={cn("h-[3%] rounded-full bg-[#e3e4ec]", width)}+ key={index}+ />+ ))}+ <span className="mt-auto h-[9%] w-2/5 rounded-[0.25rem] bg-(--accent-soft)" />+ </span>+ );+}++type SampleMark = {+ height: number;+ tone: "accent" | "body" | "heading" | "rule" | "title";+ width: number;+ x: number;+ y: number;+};++type SamplePage = {+ accent: boolean;+ centered: boolean;+ /** One entry per clause: the width of each of its lines, as a fraction. */+ clauses: readonly (readonly number[])[];+ signers: number;+};++const samplePages: readonly SamplePage[] = [+ {+ accent: false,+ centered: true,+ clauses: [+ [0.96, 0.9],+ [1, 0.72],+ [0.94, 1, 0.5],+ [1, 0.82],+ [0.97, 0.6],+ ],+ signers: 2,+ },+ {+ accent: true,+ centered: false,+ clauses: [+ [1, 0.95, 0.4],+ [0.92, 0.7],+ [1, 0.85],+ [0.96, 0.55],+ ],+ signers: 1,+ },+ {+ accent: false,+ centered: true,+ clauses: [+ [1, 0.8],+ [0.95, 1, 0.66],+ [1, 0.74],+ [0.9, 0.5],+ [1, 0.88],+ [0.97, 0.45],+ ],+ signers: 2,+ },+];++const SAMPLE_PAGE_WIDTH = 170;+const SAMPLE_PAGE_HEIGHT = 220;++const sampleMarkFills: Record<SampleMark["tone"], string> = {+ accent: "var(--accent)",+ body: "#cdcfda",+ heading: "#7d8094",+ rule: "#e1e2ea",+ title: "#3b3d4f",+};++function layoutSamplePage(sample: SamplePage): SampleMark[] {+ const left = 24;+ const textWidth = SAMPLE_PAGE_WIDTH - left * 2;+ const marks: SampleMark[] = [];+ const titleWidth = sample.centered ? 84 : 70;+ const subtitleWidth = 52;+ let y = 28;++ if (sample.accent) {+ marks.push({ height: 2.5, tone: "accent", width: 14, x: left, y: y - 8 });+ }++ marks.push({+ height: sample.centered ? 4.5 : 6,+ tone: "title",+ width: titleWidth,+ x: sample.centered ? (SAMPLE_PAGE_WIDTH - titleWidth) / 2 : left,+ y,+ });+ y += sample.centered ? 9 : 11;+ marks.push({+ height: 2.5,+ tone: "body",+ width: subtitleWidth,+ x: sample.centered ? (SAMPLE_PAGE_WIDTH - subtitleWidth) / 2 : left,+ y,+ });+ y += 7;+ marks.push({ height: 0.6, tone: "rule", width: textWidth, x: left, y });+ y += 9;++ for (const clause of sample.clauses) {+ marks.push({+ height: 2.6,+ tone: "heading",+ width: 30 + clause.length * 6,+ x: left,+ y,+ });+ y += 5.5;++ for (const fraction of clause) {+ marks.push({+ height: 2,+ tone: "body",+ width: textWidth * fraction,+ x: left,+ y,+ });+ y += 4.6;+ }++ y += 4.5;+ }++ for (let signer = 0; signer < sample.signers; signer += 1) {+ const x = left + signer * 68;++ marks.push({ height: 0.7, tone: "title", width: 52, x, y: 186 });+ marks.push({ height: 2.4, tone: "heading", width: 30, x, y: 190 });+ marks.push({ height: 1.8, tone: "body", width: 18, x, y: 195 });+ }++ marks.push({ height: 1.6, tone: "body", width: 22, x: 74, y: 206 });++ return marks;+}++const sampleLayouts = samplePages.map(layoutSamplePage);++/**+ * A drawing of a first page for places that show sample documents rather+ * than real ones, such as the dashboard preview on the landing page. The+ * seed picks one of a few layouts.+ */+export function SampleDocumentPage({+ className,+ seed = "",+}: {+ className?: string;+ seed?: string;+}) {+ const marks = sampleLayouts[seed.length % sampleLayouts.length] ?? [];++ return (+ <svg+ aria-hidden="true"+ className={cn(+ "block h-full w-auto max-w-full rounded-[0.5rem] bg-white shadow-[0_1px_2px_rgba(28,29,43,0.08),0_6px_16px_rgba(28,29,43,0.10)] ring-1 ring-[rgba(28,29,43,0.06)]",+ className,+ )}+ viewBox={`0 0 ${String(SAMPLE_PAGE_WIDTH)} ${String(SAMPLE_PAGE_HEIGHT)}`}+ >+ {marks.map((mark, index) => (+ <rect+ fill={sampleMarkFills[mark.tone]}+ height={mark.height}+ key={index}+ rx={Math.min(mark.height / 2, 1.2)}+ width={mark.width}+ x={mark.x}+ y={mark.y}+ />+ ))}+ </svg>+ );+}diff --git a/src/components/shared/document-viewport.tsx b/src/components/shared/document-viewport.tsxindex 6d771c8..b4bcc45 100644--- a/src/components/shared/document-viewport.tsx+++ b/src/components/shared/document-viewport.tsx@@ -161,22 +161,22 @@ export function DocumentZoomControls({const zoomPercentage = Math.round(zoomLevel * 100);return (- <div className="inline-flex min-h-11 items-center border border-(--border) bg-white">+ <div className="inline-flex min-h-11 items-center gap-0.5 rounded-xl bg-(--surface) p-1"><buttonaria-label="Zoom out"- className="inline-flex size-11 items-center justify-center border-r border-(--border) text-lg leading-none text-(--fg) transition hover:bg-[rgba(17,17,17,0.04)] disabled:text-(--placeholder)"+ className="inline-flex size-9 items-center justify-center rounded-[0.5625rem] text-lg leading-none text-(--fg) transition hover:bg-white disabled:text-(--placeholder) disabled:hover:bg-transparent"disabled={zoomLevel <= MIN_DOCUMENT_ZOOM_LEVEL}onClick={onDecrease}type="button">-</button>- <div className="flex min-w-[76px] items-center justify-center px-3 text-sm font-semibold text-(--fg)">+ <div className="flex min-w-[58px] items-center justify-center px-1 text-sm font-semibold tabular-nums text-(--fg)">{zoomPercentage}%</div><buttonaria-label="Zoom in"- className="inline-flex size-11 items-center justify-center border-l border-(--border) text-lg leading-none text-(--fg) transition hover:bg-[rgba(17,17,17,0.04)] disabled:text-(--placeholder)"+ className="inline-flex size-9 items-center justify-center rounded-[0.5625rem] text-lg leading-none text-(--fg) transition hover:bg-white disabled:text-(--placeholder) disabled:hover:bg-transparent"disabled={zoomLevel >= MAX_DOCUMENT_ZOOM_LEVEL}onClick={onIncrease}type="button"@@ -184,7 +184,7 @@ export function DocumentZoomControls({+</button><button- className="inline-flex min-h-11 items-center justify-center border-l border-(--border) px-4 [font-family:var(--font-mono)] text-[0.68rem] font-semibold uppercase tracking-[0.16em] text-(--fg) transition hover:bg-[rgba(17,17,17,0.04)]"+ className="inline-flex min-h-9 items-center justify-center rounded-[0.5625rem] px-3 text-[0.8125rem] font-semibold text-(--secondary) transition hover:bg-white hover:text-(--fg)"onClick={onReset}type="button">diff --git a/src/components/shared/form-shell.tsx b/src/components/shared/form-shell.tsxindex ac5e7c2..1f458ec 100644--- a/src/components/shared/form-shell.tsx+++ b/src/components/shared/form-shell.tsx@@ -33,13 +33,14 @@ type ShellButtonProps = {loading?: boolean;onClick?: () => void;type?: "button" | "submit";- variant?: "ghost" | "primary" | "secondary";+ variant?: "danger" | "ghost" | "primary" | "secondary";};const variantMap: Record<NonNullable<ShellButtonProps["variant"]>,NonNullable<React.ComponentProps<typeof Button>["variant"]>> = {+ danger: "destructive",primary: "default",secondary: "outline",ghost: "ghost",@@ -64,7 +65,7 @@ export function FieldShell({return (<Field className="gap-2 text-sm"><FieldLabel- className="text-[0.84rem] font-semibold tracking-[-0.02em] text-(--fg)"+ className="text-[0.8125rem] font-semibold text-(--secondary)"htmlFor={inputId}>{label}@@ -75,7 +76,7 @@ export function FieldShell({autoComplete={autoComplete}className={cn("read-only:text-muted-foreground",- error ? "border-[rgba(180,35,53,0.36)]" : "border-(--border)",+ error ? "border-(--danger)" : "",)}disabled={disabled}id={inputId}@@ -88,7 +89,7 @@ export function FieldShell({/>{error ? (<FieldError- className="text-xs font-semibold text-(--accent)"+ className="text-xs font-semibold text-(--danger)"id={name ? `${name}-description` : undefined}>{error}@@ -117,7 +118,7 @@ export function ShellButton({}: ShellButtonProps) {const buttonVariant = variantMap[variant];const shellButtonClassName = cn(- "rounded-none [font-family:var(--font-mono)] text-[0.74rem] font-bold uppercase tracking-[0.18em] shadow-none",+ "min-h-12 px-5.5 text-[0.9375rem]",className,);const content = (@@ -168,7 +169,7 @@ export function StaticShellButton({<spanclassName={cn(buttonVariants({ variant: variantMap[variant] }),- "rounded-none [font-family:var(--font-mono)] text-[0.74rem] font-bold uppercase tracking-[0.18em] shadow-none",+ "min-h-12 px-5.5 text-[0.9375rem]",className,)}>diff --git a/src/components/shared/page-header.tsx b/src/components/shared/page-header.tsxindex 387cddf..b396bf3 100644--- a/src/components/shared/page-header.tsx+++ b/src/components/shared/page-header.tsx@@ -3,33 +3,25 @@ import type { ReactNode } from "react";type PageHeaderProps = {action?: ReactNode;description?: string;- eyebrow?: string;title: string;};-export function PageHeader({- action,- description,- eyebrow = "Workspace",- title,-}: PageHeaderProps) {+/** The white card that opens a page: its title, one line about it, one action. */+export function PageHeader({ action, description, title }: PageHeaderProps) {return (<div- className="flex flex-col gap-5 border-b border-(--border) pb-6 sm:flex-row sm:items-end sm:justify-between"+ className="panel flex flex-col gap-5 px-6 py-6 sm:flex-row sm:items-center sm:justify-between sm:px-8 sm:py-7"data-animate="enter">- <div className="space-y-3">- <div className="space-y-2">- <p className="section-eyebrow">{eyebrow}</p>- <h1 className="text-[clamp(2.4rem,4.8vw,4rem)] font-extrabold leading-[1.02] tracking-[-0.045em] text-black">- {title}- </h1>- {description ? (- <p className="max-w-2xl text-sm leading-6 text-muted-foreground sm:text-base">- {description}- </p>- ) : null}- </div>+ <div className="min-w-0 space-y-1.5">+ <h1 className="text-[clamp(1.625rem,3vw,2rem)] font-extrabold leading-[1.15] tracking-[-0.03em] text-(--fg)">+ {title}+ </h1>+ {description ? (+ <p className="max-w-2xl text-[0.9375rem] leading-6 text-(--secondary)">+ {description}+ </p>+ ) : null}</div>{action ? <div className="shrink-0">{action}</div> : null}</div>diff --git a/src/components/shared/status-panel.tsx b/src/components/shared/status-panel.tsxindex 6f032f9..88cde5d 100644--- a/src/components/shared/status-panel.tsx+++ b/src/components/shared/status-panel.tsx@@ -1,7 +1,6 @@import Link from "next/link";import type { ReactNode } from "react";-import { Badge } from "@/components/ui/badge";import { Button } from "@/components/ui/button";import { Skeleton } from "@/components/ui/skeleton";@@ -18,9 +17,9 @@ type StatusPanelProps = {};const badgeStyles: Record<NonNullable<StatusPanelProps["tone"]>, string> = {- neutral: "bg-[rgba(17,17,17,0.06)] text-muted-foreground",- loading: "bg-[rgba(37,99,235,0.12)] text-chart-1",- error: "bg-[rgba(255,0,51,0.1)] text-(--accent)",+ neutral: "pill-neutral",+ loading: "pill-accent",+ error: "pill-danger",};export function StatusPanel({@@ -32,20 +31,17 @@ export function StatusPanel({tone = "neutral",}: StatusPanelProps) {return (- <section className="editorial-panel space-y-4 p-6 sm:p-8">- <Badge- variant="secondary"- className={`inline-flex rounded-none px-3 py-1 [font-family:var(--font-mono)] uppercase tracking-[0.18em] ${badgeStyles[tone]}`}- >+ <section className="panel space-y-4 p-6 sm:p-8">+ <span className={`pill ${badgeStyles[tone]}`}>{eyebrow ??(tone === "error"? "Error": tone === "loading"? "Loading": "Ready")}- </Badge>+ </span><div className="space-y-2">- <h2 className="text-xl font-semibold tracking-[-0.03em] text-(--fg)">+ <h2 className="text-xl font-extrabold tracking-[-0.02em] text-(--fg)">{title}</h2><p className="max-w-2xl text-sm leading-6 text-muted-foreground">@@ -54,9 +50,9 @@ export function StatusPanel({</div>{tone === "loading" ? (<div className="space-y-3" aria-hidden="true">- <Skeleton className="h-3 w-full max-w-xl rounded-none bg-(--surface)" />- <Skeleton className="h-3 w-4/5 rounded-none bg-(--surface)" />- <Skeleton className="h-3 w-2/3 rounded-none bg-(--surface)" />+ <Skeleton className="h-3 w-full max-w-xl rounded-full bg-(--surface-strong)" />+ <Skeleton className="h-3 w-4/5 rounded-full bg-(--surface-strong)" />+ <Skeleton className="h-3 w-2/3 rounded-full bg-(--surface-strong)" /></div>) : null}<div className="flex flex-wrap items-center gap-3">diff --git a/src/components/shared/step-indicator.tsx b/src/components/shared/step-indicator.tsxindex ad8683b..c7807b0 100644--- a/src/components/shared/step-indicator.tsx+++ b/src/components/shared/step-indicator.tsx@@ -1,3 +1,5 @@+import { CheckIcon } from "lucide-react";+type StepIndicatorProps = {current: number;steps: string[];@@ -5,37 +7,47 @@ type StepIndicatorProps = {export function StepIndicator({ current, steps }: StepIndicatorProps) {return (- <section- className="editorial-panel px-4 py-4 sm:px-5"+ <nav+ aria-label="Progress"+ className="panel px-3 py-3 sm:px-4"data-animate="enter"data-animate-delay="1">- <ol className="grid gap-3 sm:grid-cols-4">+ <ol className="grid grid-cols-2 gap-1.5 sm:grid-cols-4">{steps.map((step, index) => {const isComplete = index < current - 1;const isCurrent = index === current - 1;return (<li- className={`flex items-center gap-3 border px-3 py-2 ${- isCurrent ? "border-(--accent) bg-[#fff8f8]" : "border-(--border) bg-white"+ aria-current={isCurrent ? "step" : undefined}+ className={`flex items-center gap-3 rounded-2xl px-3 py-2.5 ${+ isCurrent ? "bg-(--accent-softer)" : ""}`}key={step}><span- className={`inline-flex size-8 shrink-0 items-center justify-center border text-xs font-bold ${+ className={`inline-flex size-7 shrink-0 items-center justify-center rounded-full text-xs font-bold ${isCurrent- ? "border-(--accent) bg-(--accent) text-white"+ ? "bg-(--accent) text-white": isComplete- ? "border-black bg-black text-white"- : "border-(--border) bg-white text-(--tertiary)"+ ? "bg-(--accent-soft) text-(--accent-ink)"+ : "bg-(--surface-strong) text-(--secondary)"}`}>- {index + 1}+ {isComplete ? (+ <CheckIcon aria-hidden="true" className="size-3.5" />+ ) : (+ index + 1+ )}</span><span- className={`[font-family:var(--font-mono)] text-[0.72rem] font-semibold uppercase tracking-[0.22em] ${- isCurrent || isComplete ? "text-(--fg)" : "text-(--tertiary)"+ className={`text-sm ${+ isCurrent+ ? "font-bold text-(--accent-ink)"+ : isComplete+ ? "font-semibold text-(--fg)"+ : "font-semibold text-(--tertiary)"}`}>{step}@@ -44,6 +56,6 @@ export function StepIndicator({ current, steps }: StepIndicatorProps) {);})}</ol>- </section>+ </nav>);}diff --git a/src/components/signing/signing-done-shell.tsx b/src/components/signing/signing-done-shell.tsxindex 90c9ef7..7672eb3 100644--- a/src/components/signing/signing-done-shell.tsx+++ b/src/components/signing/signing-done-shell.tsx@@ -14,21 +14,24 @@ export function SigningDoneShell({ envelopeTitle }: SigningDoneShellProps) {: fallbackEnvelopeTitle;return (- <div className="flex min-h-screen flex-col bg-white">- <header className="border-b border-(--border) bg-white">- <div className="mx-auto flex max-w-[1360px] items-center px-4 py-5 sm:px-6 lg:px-8">+ <div className="flex min-h-screen flex-col">+ <header>+ <div className="page-width flex items-center py-4"><Brand href="/" /></div></header>- <main className="mx-auto flex w-full max-w-[1360px] flex-1 items-center justify-center px-4 py-12 sm:px-6 lg:px-8">- <section className="editorial-panel w-full max-w-[820px] px-6 py-12 text-center sm:px-10 sm:py-16">+ <main className="page-width flex flex-1 items-center justify-center py-10">+ <section+ className="panel w-full max-w-[640px] px-6 py-12 text-center sm:px-12 sm:py-16"+ data-animate="enter"+ ><divaria-hidden="true"- className="mx-auto inline-flex size-20 items-center justify-center border border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.1)]"+ className="mx-auto inline-flex size-[4.5rem] items-center justify-center rounded-full bg-(--success-soft)"><svg- className="size-9 text-chart-4"+ className="size-9 text-(--success)"fill="none"viewBox="0 0 36 36"xmlns="http://www.w3.org/2000/svg"@@ -43,21 +46,21 @@ export function SigningDoneShell({ envelopeTitle }: SigningDoneShellProps) {</svg></div>- <h1 className="mt-8 text-[32px] font-extrabold tracking-[-0.05em] text-(--fg) sm:text-[38px]">+ <h1 className="mt-7 text-[clamp(1.875rem,4.5vw,2.375rem)] font-extrabold tracking-[-0.035em] text-(--fg)">You're all done.</h1>- <p className="mx-auto mt-5 max-w-[560px] text-base leading-7 text-muted-foreground sm:text-[15px]">+ <p className="mx-auto mt-4 max-w-[480px] text-base leading-7 text-(--secondary)">Your signature has been recorded for{" "}- <span className="font-semibold text-(--fg)">+ <span className="font-bold text-(--fg)">"{resolvedEnvelopeTitle}"</span>.</p>- <p className="mx-auto mt-4 max-w-[560px] text-base leading-7 text-muted-foreground sm:text-[15px]">+ <p className="mx-auto mt-3 max-w-[480px] text-base leading-7 text-(--secondary)">You'll receive an email with the signed document once allparties have signed.</p>- <p className="mt-8 text-sm font-semibold uppercase tracking-[0.2em] text-(--tertiary)">+ <p className="mt-8 inline-flex rounded-full bg-(--surface) px-4 py-2 text-sm font-semibold text-(--secondary)">You can close this tab.</p></section>diff --git a/src/components/signing/signing-live-shell.tsx b/src/components/signing/signing-live-shell.tsxindex 88ef69b..dcbd0ea 100644--- a/src/components/signing/signing-live-shell.tsx+++ b/src/components/signing/signing-live-shell.tsx@@ -410,6 +410,15 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {}),).length;const canFinish = remainingFields === 0;+ const requiredFieldCount = record.currentSignerFields.filter(+ (field) => field.required,+ ).length;+ const completionPercent =+ requiredFieldCount === 0+ ? 100+ : Math.round(+ ((requiredFieldCount - remainingFields) / requiredFieldCount) * 100,+ );const isDocumentReady = pdfRenderState === "ready";function applyZoomLevel(nextZoomLevel: number) {@@ -574,16 +583,16 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {}return (- <div className="flex min-h-screen flex-col bg-white">- <header className="sticky top-0 z-20 border-b border-(--border) bg-white/95 backdrop-blur">- <div className="mx-auto flex w-full max-w-[1440px] items-center justify-between gap-4 px-4 py-4 sm:px-6 lg:px-8">+ <div className="flex min-h-screen flex-col">+ <header className="sticky top-0 z-20 bg-[rgba(243,244,248,0.88)] backdrop-blur-md">+ <div className="mx-auto flex w-full max-w-[1320px] items-center justify-between gap-4 px-4 py-3 sm:px-6 sm:py-4"><div className="flex min-w-0 items-center gap-5"><Brand href="/" />- <div className="hidden min-w-0 border-l border-(--border) pl-5 sm:block">- <p className="truncate text-sm font-semibold text-(--fg)">+ <div className="hidden min-w-0 border-l border-(--border-strong) pl-5 sm:block">+ <p className="truncate text-sm font-bold text-(--fg)">{record.envelopeTitle}</p>- <p className="mt-1 text-xs uppercase tracking-[0.18em] text-(--tertiary)">+ <p className="mt-0.5 truncate text-[0.8125rem] text-(--tertiary)">From {record.senderName}</p></div>@@ -602,10 +611,10 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {</div></header>- <main className="mx-auto flex w-full max-w-[1440px] flex-1 flex-col gap-6 px-4 py-5 sm:px-6 lg:px-8 lg:py-8">- <section className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_320px]">+ <main className="mx-auto flex w-full max-w-[1320px] flex-1 flex-col gap-5 px-4 pb-8 pt-1 sm:px-6">+ <section className="grid gap-5 xl:grid-cols-[minmax(0,1fr)_340px]"><div className="flex min-w-0 flex-col gap-4">- <div className="editorial-panel px-4 py-3 sm:px-5">+ <div className="panel rounded-[1.25rem] px-4 py-3"><div className="flex flex-col gap-3 xl:grid xl:grid-cols-[1fr_auto_1fr] xl:items-center"><div className="flex justify-center xl:justify-start"><DocumentZoomControls@@ -627,7 +636,7 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {<div className="flex items-center justify-center gap-3"><buttonaria-label="Previous page"- className="inline-flex size-11 items-center justify-center rounded-none border border-(--border) bg-white text-muted-foreground transition hover:border-black hover:bg-white disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet size-10 px-0"disabled={activePage === 1}onClick={() =>setActivePage((page) => Math.max(1, page - 1))@@ -636,17 +645,15 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {><ChevronLeftIcon className="size-4" /></button>- <div className="min-w-[132px] text-center">- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">- Document page- </p>- <p className="mt-1 text-sm font-semibold text-(--fg)">+ <div className="min-w-[7.5rem] text-center">+ <p className="sr-only">Document page</p>+ <p className="text-sm font-bold text-(--fg)">{`Page ${activePage} of ${record.pageCount}`}</p></div><buttonaria-label="Next page"- className="inline-flex size-11 items-center justify-center rounded-none border border-(--border) bg-white text-muted-foreground transition hover:border-black hover:bg-white disabled:cursor-not-allowed disabled:text-(--placeholder)"+ className="btn-quiet size-10 px-0"disabled={activePage === record.pageCount}onClick={() =>setActivePage((page) =>@@ -668,9 +675,9 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {</div></div>- <div className="editorial-panel p-3 sm:p-4">+ <div className="panel overflow-hidden rounded-[1.25rem]"><div- className={`relative overflow-auto border border-(--border) bg-(--surface) p-3 sm:p-5 ${+ className={`relative overflow-auto p-3 sm:p-6 ${zoomLevel > DEFAULT_DOCUMENT_ZOOM_LEVEL? isDocumentPanning? "cursor-grabbing"@@ -692,7 +699,7 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {}`}><div- className="relative border border-[rgba(17,17,17,0.08)] bg-white"+ className="relative overflow-hidden rounded-md bg-white shadow-[0_1px_2px_rgba(28,29,43,0.08),0_12px_32px_rgba(28,29,43,0.12)]"style={{width: `${zoomLevel * 100}%`,}}@@ -750,11 +757,11 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {pageCurrentFields.length === 0 &&pageVisibleFields.length === 0 ? (<div className="absolute inset-0 z-1 flex items-center justify-center px-6">- <div className="max-w-[320px] border border-dashed border-[rgba(17,17,17,0.12)] bg-white/92 px-6 py-8 text-center">- <p className="text-lg font-semibold tracking-[-0.03em] text-(--fg)">+ <div className="max-w-[320px] rounded-[1.25rem] border-2 border-dashed border-(--border-strong) bg-white/92 px-6 py-7 text-center">+ <p className="text-lg font-extrabold tracking-[-0.02em] text-(--fg)">No signer fields on this page</p>- <p className="mt-3 text-sm leading-6 text-muted-foreground">+ <p className="mt-2 text-sm leading-6 text-(--secondary)">Move between pages to review your assigned fieldsand any completed values from earlier signers.</p>@@ -768,63 +775,69 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {</div></div>- <aside className="space-y-4 xl:sticky xl:top-24 xl:self-start">- <section className="editorial-panel p-5 sm:p-6">- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">- Current signer- </p>- <div className="mt-4 flex items-center gap-3">- <span className="inline-flex size-11 items-center justify-center rounded-full bg-(--signer-1-tint) text-base font-semibold text-chart-1">+ <aside className="space-y-4 xl:sticky xl:top-[5.25rem] xl:self-start">+ <section className="panel rounded-[1.25rem] p-5">+ <p className="section-eyebrow">Current signer</p>+ <div className="mt-3 flex items-center gap-3">+ <span className="inline-flex size-11 shrink-0 items-center justify-center rounded-full bg-(--accent-soft) text-[0.9375rem] font-bold text-(--accent-ink)">{getInitials(record.signer.name)}</span><div className="min-w-0">- <p className="truncate text-sm font-semibold text-(--fg)">+ <p className="truncate text-[0.9375rem] font-bold text-(--fg)">{record.signer.name}</p>- <p className="truncate text-sm text-muted-foreground">+ <p className="truncate text-sm text-(--secondary)">{record.signer.email}</p></div></div>- <div className="mt-6 border-t border-(--border) pt-5">- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">- Ready to finish- </p>- <p className="mt-3 text-sm font-semibold text-(--fg)">+ <div className="well mt-5 p-4">+ <p className="section-eyebrow">Ready to finish</p>+ <p className="mt-1.5 text-[0.9375rem] font-bold text-(--fg)">{remainingFields === 0? "All required fields complete": `${remainingFields} required field${remainingFields === 1 ? "" : "s"} remaining`}</p>- <p className="mt-2 text-sm leading-6 text-muted-foreground">+ <div+ aria-hidden="true"+ className="mt-3 h-2 overflow-hidden rounded-full bg-(--surface-strong)"+ >+ <div+ className={`h-full rounded-full transition-[width] duration-300 ${+ remainingFields === 0 ? "bg-(--success)" : "bg-(--accent)"+ }`}+ style={{ width: `${completionPercent}%` }}+ />+ </div>+ <p className="mt-3 text-[0.8125rem] leading-5 text-(--secondary)">Previous signer values stay visible but locked. Only yourassigned fields are interactive.</p>- <div className="mt-5">- <ShellButton- className="w-full"- disabled={!canFinish || isDeclining || isSubmitting}- onClick={() => {- setSubmitError(null);- setIsFinishDialogOpen(true);- }}- >- Finish- </ShellButton>- </div>+ </div>++ <div className="mt-4">+ <ShellButton+ className="w-full"+ disabled={!canFinish || isDeclining || isSubmitting}+ onClick={() => {+ setSubmitError(null);+ setIsFinishDialogOpen(true);+ }}+ >+ Finish+ </ShellButton></div></section>- <section className="editorial-panel p-5 sm:p-6">+ <section className="panel rounded-[1.25rem] p-5"><div className="flex items-center justify-between gap-3">- <p className="text-xs font-semibold uppercase tracking-[0.22em] text-(--tertiary)">- Assigned fields- </p>- <span className="text-xs font-semibold uppercase tracking-[0.18em] text-(--tertiary)">+ <p className="section-eyebrow">Assigned fields</p>+ <span className="pill pill-neutral">{actionSummaryFields.length}</span></div>- <div className="mt-4 divide-y divide-(--border) border-y border-(--border)">+ <div className="mt-3 space-y-2">{actionSummaryFields.map((field) => (<FieldStatusRowisComplete={isFieldComplete(field, {@@ -844,7 +857,6 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {))}</div></section>-</aside></section></main>@@ -904,12 +916,12 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {setSubmitError(null);}}>- <p className="text-sm leading-6 text-muted-foreground">+ <p className="text-sm leading-6 text-(--secondary)">By clicking Finish, you confirm that your electronic signature isintended to be binding for this document.</p>{submitError ? (- <div className="border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.08)] px-4 py-3 text-sm text-(--accent)">+ <div className="notice notice-danger" role="alert">{submitError}</div>) : null}@@ -944,11 +956,13 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {setIsDeclineDialogOpen(false);}}>- <label className="grid gap-2 text-sm">- <span className="font-semibold text-(--fg)">Reason (optional)</span>+ <label className="grid gap-1.5">+ <span className="text-[0.8125rem] font-semibold text-(--secondary)">+ Reason (optional)+ </span><TextareaautoFocus- className="min-h-28 rounded-none border-(--border) bg-white"+ className="min-h-28"id="signing-decline-reason"name="signing-decline-reason"onChange={(event) => setDeclineReason(event.target.value)}@@ -957,7 +971,7 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {/></label>{declineError ? (- <div className="border border-[rgba(180,35,53,0.18)] bg-[rgba(180,35,53,0.08)] px-4 py-3 text-sm text-(--accent)">+ <div className="notice notice-danger" role="alert">{declineError}</div>) : null}@@ -972,7 +986,11 @@ export function SigningLiveShell({ record }: { record: SigningPayload }) {>Cancel</ShellButton>- <ShellButton loading={isDeclining} onClick={handleDeclineSigning}>+ <ShellButton+ loading={isDeclining}+ onClick={handleDeclineSigning}+ variant="danger"+ >{isDeclining ? "Declining..." : "Decline to sign"}</ShellButton></div>@@ -990,13 +1008,13 @@ function SigningToolbarStatus({remainingFields: number;}) {return (- <div className="inline-flex min-h-11 items-center gap-3 border border-(--border) bg-white px-3 py-2">+ <div className="inline-flex min-h-10 items-center gap-2.5 rounded-full bg-(--surface) py-1.5 pl-2.5 pr-4"><spanaria-hidden="true"- className={`inline-flex size-5 items-center justify-center rounded-full ${+ className={`inline-flex size-6 items-center justify-center rounded-full ${remainingFields === 0- ? "bg-[rgba(24,132,74,0.12)] text-[rgb(24,132,74)]"- : "bg-(--signer-1-tint) text-chart-1"+ ? "bg-(--success-soft) text-(--success)"+ : "bg-(--accent) text-white"}`}>{remainingFields === 0 ? (@@ -1015,18 +1033,18 @@ function SigningToolbarStatus({/></svg>) : (- <span className="text-[11px] font-semibold leading-none">+ <span className="text-[11px] font-bold leading-none">{remainingFields}</span>)}</span><div className="min-w-0">- <p className="text-sm font-semibold text-(--fg)">+ <p className="text-[0.8125rem] font-bold leading-tight text-(--fg)">{remainingFields === 0? "Ready to finish": `${remainingFields} required remaining`}</p>- <p className="text-xs text-muted-foreground">+ <p className="text-xs leading-tight text-(--tertiary)">{hasLockedFields ? "Locked values visible" : "Current signer view"}</p></div>@@ -1061,17 +1079,14 @@ function CurrentSignerField({return (<buttonaria-label={getSummaryLabel(field)}- className={`absolute z-2 overflow-hidden border-2 text-chart-1 transition ${+ className={`absolute z-2 overflow-hidden rounded-[0.375rem] border-2 border-(--accent) text-(--accent-ink) transition ${signatureEntry?.value- ? "bg-(--signer-1-tint) text-chart-1"- : "bg-[rgba(37,99,235,0.06)] hover:bg-[rgba(37,99,235,0.12)]"+ ? "bg-[rgba(83,64,214,0.10)]"+ : "bg-[rgba(83,64,214,0.07)] hover:bg-[rgba(83,64,214,0.16)]"}`}data-signing-field="true"onClick={onSignatureClick}- style={{- borderColor: "var(--signer-1)",- ...frame,- }}+ style={frame}type="button"><span className="pointer-events-none flex h-full w-full items-center justify-center overflow-hidden px-1 text-center">@@ -1100,7 +1115,7 @@ function CurrentSignerField({{signatureEntry.value}</span>) : showInlineLabel ? (- <span className="block max-w-full truncate px-1 text-[11px] font-semibold uppercase tracking-[0.18em]">+ <span className="block max-w-full truncate px-1 text-xs font-bold">{getCanvasFieldLabel(field)}</span>) : null}@@ -1112,7 +1127,7 @@ function CurrentSignerField({if (field.type === "date") {return (<div- className="absolute z-2 overflow-hidden border border-[rgba(17,17,17,0.12)] bg-white/92 text-sm text-(--fg)"+ className="absolute z-2 overflow-hidden rounded-[0.375rem] border border-(--border-strong) bg-white/92 text-sm text-(--fg)"data-signing-field="true"style={frame}>@@ -1128,7 +1143,7 @@ function CurrentSignerField({if (field.type === "text") {return (<div- className="absolute z-2 overflow-hidden border-2 border-chart-1 bg-[rgba(37,99,235,0.06)]"+ className="absolute z-2 overflow-hidden rounded-[0.375rem] border-2 border-(--accent) bg-[rgba(83,64,214,0.07)] focus-within:bg-white"data-signing-field="true"style={frame}>@@ -1149,10 +1164,10 @@ function CurrentSignerField({<buttonaria-label={getFieldLabel(field)}aria-pressed={checkboxValue}- className={`absolute z-2 flex items-center justify-center border-2 transition ${+ className={`absolute z-2 flex items-center justify-center rounded-[0.25rem] border-2 border-(--accent) text-(--accent-ink) transition ${checkboxValue- ? "bg-(--signer-1-tint) text-chart-1"- : "bg-white text-chart-1 hover:bg-[rgba(37,99,235,0.08)]"+ ? "bg-[rgba(83,64,214,0.14)]"+ : "bg-white hover:bg-[rgba(83,64,214,0.10)]"}`}data-signing-field="true"onClick={() => onCheckboxChange(!checkboxValue)}@@ -1187,14 +1202,14 @@ function VisibleFieldStamp({ field }: { field: SigningVisibleField }) {if (field.type === "checkbox") {return (<div- className="pointer-events-none absolute z-1 flex items-center justify-center border border-[rgba(17,17,17,0.12)] bg-[rgba(17,17,17,0.03)]"+ className="pointer-events-none absolute z-1 flex items-center justify-center rounded-[0.25rem] border border-(--border-strong) bg-[rgba(28,29,43,0.03)]"data-signing-field="true"style={frame}>{field.checked ? (<svgaria-hidden="true"- className="h-[68%] w-[68%] max-h-4 max-w-4 text-[rgba(17,17,17,0.76)]"+ className="h-[68%] w-[68%] max-h-4 max-w-4 text-(--secondary)"fill="none"viewBox="0 0 16 16">@@ -1217,7 +1232,7 @@ function VisibleFieldStamp({ field }: { field: SigningVisibleField }) {) {return (<div- className="pointer-events-none absolute z-1 overflow-hidden border border-[rgba(17,17,17,0.12)] bg-[rgba(17,17,17,0.03)]"+ className="pointer-events-none absolute z-1 overflow-hidden rounded-[0.375rem] border border-(--border-strong) bg-[rgba(28,29,43,0.03)]"data-signing-field="true"style={frame}>@@ -1234,7 +1249,7 @@ function VisibleFieldStamp({ field }: { field: SigningVisibleField }) {return (<div- className="pointer-events-none absolute z-1 overflow-hidden border border-[rgba(17,17,17,0.12)] bg-[rgba(17,17,17,0.03)] text-muted-foreground"+ className="pointer-events-none absolute z-1 overflow-hidden rounded-[0.375rem] border border-(--border-strong) bg-[rgba(28,29,43,0.03)] text-(--secondary)"data-signing-field="true"style={frame}>@@ -1260,7 +1275,7 @@ function VisibleFieldStamp({ field }: { field: SigningVisibleField }) {{getVisibleFieldValue(field)}</p>) : showInlineLabel ? (- <p className="w-full truncate text-center text-[10px] font-semibold uppercase tracking-[0.16em] text-(--tertiary)">+ <p className="w-full truncate text-center text-[11px] font-semibold text-(--tertiary)">{getCanvasFieldLabel(field)}</p>) : null}@@ -1338,15 +1353,15 @@ function SignatureModal({onValueChange={(value) => onModeChange(value as "typed" | "drawn")}value={signatureMode}>- <TabsList className="flex w-full gap-2 rounded-none border-0 bg-transparent p-0 shadow-none">+ <TabsList className="segmented flex h-auto w-full p-1 group-data-horizontal/tabs:h-auto"><TabsTrigger- className="min-h-11 flex-1 rounded-none border border-(--border) bg-(--surface) px-4 text-sm font-semibold text-muted-foreground data-active:border-(--border) data-active:bg-white data-active:text-(--fg) after:hidden"+ className="segmented-item h-auto min-h-10 flex-1 data-active:bg-white data-active:text-(--fg) data-active:shadow-[0_1px_3px_rgba(28,29,43,0.12)] after:hidden"value="typed">Type</TabsTrigger><TabsTrigger- className="min-h-11 flex-1 rounded-none border border-(--border) bg-(--surface) px-4 text-sm font-semibold text-muted-foreground data-active:border-(--border) data-active:bg-white data-active:text-(--fg) after:hidden"+ className="segmented-item h-auto min-h-10 flex-1 data-active:bg-white data-active:text-(--fg) data-active:shadow-[0_1px_3px_rgba(28,29,43,0.12)] after:hidden"value="drawn">Draw@@ -1355,14 +1370,14 @@ function SignatureModal({</Tabs>{signatureMode === "typed" ? (- <div className="space-y-4 border border-(--border) bg-(--surface) p-5 sm:p-6">- <label className="grid gap-2 text-sm">- <span className="font-semibold text-(--fg)">+ <div className="space-y-4">+ <label className="grid gap-1.5">+ <span className="text-[0.8125rem] font-semibold text-(--secondary)">{fieldType === "initials" ? "Type initials" : "Type signature"}</span><inputautoFocus- className="min-h-12 w-full rounded-none border border-(--border) bg-white px-4 text-sm text-(--fg) outline-none placeholder:text-(--placeholder)"+ className="field-input"id={`signature-modal-${fieldType}`}maxLength={fieldType === "initials" ? 4 : 80}name={`signature-modal-${fieldType}`}@@ -1374,7 +1389,7 @@ function SignatureModal({/></label>- <div className="border border-(--border) bg-white px-6 py-7 text-center">+ <div className="well px-6 py-8 text-center"><pclassName={`text-[40px] leading-none sm:text-[52px] ${normalizedTypedSignatureValue@@ -1385,13 +1400,13 @@ function SignatureModal({>{normalizedTypedSignatureValue || typedPlaceholder}</p>- <p className="mt-4 text-xs uppercase tracking-[0.2em] text-(--tertiary)">+ <p className="mt-4 text-xs font-medium text-(--tertiary)">Rendered in signature style</p></div></div>) : (- <div className="border border-(--border) bg-(--surface) p-4">+ <div className="well p-3"><SignatureDrawCanvasemptyMessage={drawPreviewMessage}initialDataUrl={@@ -1403,8 +1418,9 @@ function SignatureModal({key={drawnSignatureVersion}onChange={setDrawnSignatureDataUrl}/>- <div className="mt-3 flex justify-end">+ <div className="mt-2 flex justify-end"><ShellButton+ className="min-h-10 px-4 text-sm"onClick={() => {setDrawnSignatureDataUrl(null);onClearDrawnSignature();@@ -1616,7 +1632,7 @@ function SignatureDrawCanvas({}return (- <div className="relative border border-dashed border-[rgba(17,17,17,0.16)] bg-white">+ <div className="relative overflow-hidden rounded-xl border-2 border-dashed border-(--border-strong) bg-white"><canvasaria-label="Draw signature canvas"className="h-[220px] w-full touch-none"@@ -1628,7 +1644,7 @@ function SignatureDrawCanvas({ref={canvasRef}/>{!hasSignature ? (- <div className="pointer-events-none absolute inset-0 flex items-center justify-center px-6 text-center text-sm text-muted-foreground">+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center px-6 text-center text-sm text-(--tertiary)">{emptyMessage}</div>) : null}@@ -1650,15 +1666,17 @@ function DialogFrame({return (<Dialog open onOpenChange={(open) => !open && onClose()}><DialogContent- className="max-w-[680px] rounded-none border-(--border) bg-white p-0 shadow-[0_24px_72px_rgba(0,0,0,0.14)]"+ className="max-w-[600px] p-0"showCloseButton={false}><div>- <DialogHeader className="space-y-3 border-b border-(--border) px-6 py-5 sm:px-8 sm:py-6">+ <DialogHeader className="space-y-2 px-6 pt-6 sm:px-8 sm:pt-8"><DialogTitle>{title}</DialogTitle><DialogDescription>{description}</DialogDescription></DialogHeader>- <div className="space-y-5 px-6 py-5 sm:px-8 sm:py-6">{children}</div>+ <div className="space-y-5 px-6 pb-6 pt-5 sm:px-8 sm:pb-8">+ {children}+ </div></div></DialogContent></Dialog>@@ -1675,19 +1693,15 @@ function FieldStatusRow({value: string;}) {return (- <div className="flex items-center justify-between gap-4 px-4 py-3.5">+ <div className="well flex items-center justify-between gap-3 rounded-xl px-3.5 py-3"><div className="min-w-0">- <p className="text-xs font-semibold uppercase tracking-[0.18em] text-(--tertiary)">- {label}+ <p className="text-xs font-semibold text-(--tertiary)">{label}</p>+ <p className="mt-0.5 truncate text-sm font-semibold text-(--fg)">+ {value}</p>- <p className="mt-1 truncate text-sm font-medium text-(--fg)">{value}</p></div><span- className={`inline-flex min-h-8 shrink-0 items-center border px-3 text-[11px] font-semibold uppercase tracking-[0.18em] ${- isComplete- ? "border-[rgba(5,150,105,0.18)] bg-[rgba(5,150,105,0.08)] text-chart-4"- : "border-[rgba(37,99,235,0.18)] bg-[rgba(37,99,235,0.08)] text-chart-1"- }`}+ className={`pill shrink-0 ${isComplete ? "pill-success" : "pill-accent"}`}>{isComplete ? "Complete" : "Required"}</span>diff --git a/src/components/signing/signing-shell.tsx b/src/components/signing/signing-shell.tsxindex 457d190..15fb445 100644--- a/src/components/signing/signing-shell.tsx+++ b/src/components/signing/signing-shell.tsx@@ -1,16 +1,14 @@"use client";+import { FileTextIcon } from "lucide-react";+import { Brand } from "@/components/layout/brand";import { PublicLegalFooter } from "@/components/layout/public-legal-links";import type { SigningPayload } from "@/lib/schemas/signing";import { SigningLiveShell } from "./signing-live-shell";type SigningUnavailableState =- | "already-signed"- | "declined"- | "error"- | "expired"- | "voided";+ "already-signed" | "declined" | "error" | "expired" | "voided";type SigningShellProps = {initialState?: SigningUnavailableState;@@ -69,21 +67,27 @@ function StandaloneStateScreen({title: string;}) {return (- <div className="flex min-h-screen flex-col bg-white">- <header className="border-b border-(--border) bg-white">- <div className="mx-auto flex max-w-[1360px] items-center px-4 py-5 sm:px-6 lg:px-8">+ <div className="flex min-h-screen flex-col">+ <header>+ <div className="page-width flex items-center py-4"><Brand href="/" /></div></header>- <main className="mx-auto flex w-full max-w-[1360px] flex-1 items-center justify-center px-4 py-12 sm:px-6 lg:px-8">- <section className="editorial-panel w-full max-w-[760px] px-6 py-10 text-center sm:px-10 sm:py-12">- <span className="inline-flex border border-(--accent) bg-[#fff8f8] px-4 py-2 text-[11px] font-semibold uppercase tracking-[0.24em] text-(--accent)">- Signing state+ <main className="page-width flex flex-1 items-center justify-center py-10">+ <section+ className="panel w-full max-w-[640px] px-6 py-12 text-center sm:px-12 sm:py-14"+ data-animate="enter"+ >+ <span+ aria-hidden="true"+ className="mx-auto inline-flex size-14 items-center justify-center rounded-2xl bg-(--accent-soft) text-(--accent)"+ >+ <FileTextIcon className="size-6" strokeWidth={2.2} /></span>- <h1 className="mt-6 text-[32px] font-extrabold tracking-[-0.05em] text-(--fg) sm:text-[38px]">+ <h1 className="mt-6 text-[clamp(1.625rem,4vw,2.125rem)] font-extrabold leading-tight tracking-[-0.03em] text-(--fg)">{title}</h1>- <p className="mx-auto mt-4 max-w-[520px] text-base leading-7 text-muted-foreground">+ <p className="mx-auto mt-3 max-w-[460px] text-base leading-7 text-(--secondary)">{description}</p></section>diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsxdeleted file mode 100644index 523f98d..0000000--- a/src/components/ui/avatar.tsx+++ /dev/null@@ -1,112 +0,0 @@-"use client";--import * as React from "react";-import { Avatar as AvatarPrimitive } from "radix-ui";--import { cn } from "@/lib/cn";--function Avatar({- className,- size = "default",- ...props-}: React.ComponentProps<typeof AvatarPrimitive.Root> & {- size?: "default" | "sm" | "lg";-}) {- return (- <AvatarPrimitive.Root- data-slot="avatar"- data-size={size}- className={cn(- "group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",- className,- )}- {...props}- />- );-}--function AvatarImage({- className,- ...props-}: React.ComponentProps<typeof AvatarPrimitive.Image>) {- return (- <AvatarPrimitive.Image- data-slot="avatar-image"- className={cn(- "aspect-square size-full rounded-full object-cover",- className,- )}- {...props}- />- );-}--function AvatarFallback({- className,- ...props-}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {- return (- <AvatarPrimitive.Fallback- data-slot="avatar-fallback"- className={cn(- "flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",- className,- )}- {...props}- />- );-}--function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {- return (- <span- data-slot="avatar-badge"- className={cn(- "absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",- "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden",- "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",- "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",- className,- )}- {...props}- />- );-}--function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="avatar-group"- className={cn(- "group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",- className,- )}- {...props}- />- );-}--function AvatarGroupCount({- className,- ...props-}: React.ComponentProps<"div">) {- return (- <div- data-slot="avatar-group-count"- className={cn(- "relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",- className,- )}- {...props}- />- );-}--export {- Avatar,- AvatarImage,- AvatarFallback,- AvatarGroup,- AvatarGroupCount,- AvatarBadge,-};diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsxdeleted file mode 100644index 209f42e..0000000--- a/src/components/ui/badge.tsx+++ /dev/null@@ -1,49 +0,0 @@-import * as React from "react";-import { cva, type VariantProps } from "class-variance-authority";-import { Slot } from "radix-ui";--import { cn } from "@/lib/cn";--const badgeVariants = cva(- "group/badge inline-flex h-6 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2.5 py-0.5 text-[11px] font-semibold tracking-[0.08em] whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",- {- variants: {- variant: {- default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",- secondary:- "bg-[rgba(239,229,217,0.86)] text-secondary-foreground [a]:hover:bg-[var(--surface-strong)]",- destructive:- "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",- outline:- "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",- ghost:- "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",- link: "text-primary underline-offset-4 hover:underline",- },- },- defaultVariants: {- variant: "default",- },- },-);--function Badge({- className,- variant = "default",- asChild = false,- ...props-}: React.ComponentProps<"span"> &- VariantProps<typeof badgeVariants> & { asChild?: boolean }) {- const Comp = asChild ? Slot.Root : "span";-- return (- <Comp- data-slot="badge"- data-variant={variant}- className={cn(badgeVariants({ variant }), className)}- {...props}- />- );-}--export { Badge, badgeVariants };diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsxindex d77280d..30a1291 100644--- a/src/components/ui/button.tsx+++ b/src/components/ui/button.tsx@@ -5,31 +5,33 @@ import { Slot } from "radix-ui";import { cn } from "@/lib/cn";const buttonVariants = cva(- "group/button inline-flex shrink-0 items-center justify-center rounded-[0.9rem] border border-transparent bg-clip-padding text-sm font-semibold whitespace-nowrap tracking-[-0.02em] transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ "group/button inline-flex shrink-0 items-center justify-center rounded-[0.875rem] border border-transparent bg-clip-padding text-sm font-bold whitespace-nowrap transition-[background-color,border-color,color,box-shadow,transform] outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants: {variant: {default:- "border-primary bg-primary text-white [color:#fff] shadow-none hover:border-[var(--accent-hover)] hover:bg-[var(--accent-hover)] hover:text-white hover:[color:#fff]",+ "bg-primary text-white [color:#fff] hover:bg-[var(--accent-hover)] hover:text-white hover:[color:#fff]",outline:- "border-[var(--border)] bg-[rgba(255,255,255,0.92)] text-card-foreground shadow-none hover:border-[var(--fg)] hover:bg-[var(--paper-raised)]",+ "border-[var(--border-strong)] bg-[var(--paper)] text-card-foreground hover:border-[var(--secondary)] hover:bg-[var(--surface)]",secondary:- "border-[var(--border)] bg-secondary text-secondary-foreground hover:bg-[var(--surface-strong)]",+ "bg-[var(--accent-soft)] text-[var(--accent-ink)] hover:bg-[#ddd8fb]",ghost:- "bg-transparent text-[var(--secondary)] shadow-none hover:bg-[var(--hover)] hover:text-[var(--fg)]",- destructive: "bg-destructive text-white hover:bg-destructive/90",+ "bg-transparent text-[var(--secondary)] hover:bg-[var(--hover)] hover:text-[var(--fg)]",+ destructive:+ "bg-destructive text-white [color:#fff] hover:bg-[var(--danger-hover)]",link: "text-primary underline-offset-4 hover:underline",},size: {default:"min-h-11 gap-2 px-5 has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4",- xs: "min-h-8 gap-1 rounded-full px-3 text-xs [&_svg:not([class*='size-'])]:size-3",- sm: "min-h-10 gap-1.5 rounded-full px-4 text-sm [&_svg:not([class*='size-'])]:size-3.5",- lg: "min-h-12 gap-2 px-6 text-base",+ xs: "min-h-8 gap-1 rounded-[0.625rem] px-3 text-xs [&_svg:not([class*='size-'])]:size-3",+ sm: "min-h-10 gap-1.5 rounded-xl px-4 text-sm [&_svg:not([class*='size-'])]:size-3.5",+ lg: "min-h-12 gap-2 px-6 text-[0.9375rem]",icon: "size-11",- "icon-xs": "size-8 rounded-full [&_svg:not([class*='size-'])]:size-3",- "icon-sm": "size-10 rounded-full [&_svg:not([class*='size-'])]:size-4",- "icon-lg": "size-12 rounded-full",+ "icon-xs":+ "size-8 rounded-[0.625rem] [&_svg:not([class*='size-'])]:size-3",+ "icon-sm": "size-10 rounded-xl [&_svg:not([class*='size-'])]:size-4",+ "icon-lg": "size-12",},},defaultVariants: {@@ -52,7 +54,7 @@ function Button({}) {const Comp = asChild ? Slot.Root : "button";const resolvedStyle =- variant === "default"+ variant === "default" || variant === "destructive"? {...style,color: "#fff",diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsxindex 1d8c7a2..0eae0ce 100644--- a/src/components/ui/card.tsx+++ b/src/components/ui/card.tsx@@ -12,7 +12,7 @@ function Card({data-slot="card"data-size={size}className={cn(- "group/card flex flex-col gap-4 overflow-hidden rounded-[26px] border border-[var(--border)] bg-[var(--paper-raised)] py-0 text-sm text-card-foreground shadow-[var(--shadow-sm)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-[26px] *:[img:last-child]:rounded-b-[26px]",+ "group/card flex flex-col gap-4 overflow-hidden rounded-3xl bg-[var(--paper-raised)] py-0 text-sm text-card-foreground has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-3xl *:[img:last-child]:rounded-b-3xl",className,)}{...props}@@ -25,7 +25,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {<divdata-slot="card-header"className={cn(- "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-[26px] px-6 pt-6 group-data-[size=sm]/card:px-4 group-data-[size=sm]/card:pt-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-3xl px-6 pt-6 group-data-[size=sm]/card:px-4 group-data-[size=sm]/card:pt-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",className,)}{...props}@@ -38,7 +38,7 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {<divdata-slot="card-title"className={cn(- "text-base leading-snug font-semibold tracking-[-0.03em] group-data-[size=sm]/card:text-sm",+ "text-base leading-snug font-bold tracking-[-0.01em] group-data-[size=sm]/card:text-sm",className,)}{...props}@@ -87,7 +87,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {<divdata-slot="card-footer"className={cn(- "flex items-center rounded-b-[26px] border-t bg-[rgba(239,229,217,0.42)] p-6 group-data-[size=sm]/card:p-4",+ "flex items-center rounded-b-3xl border-t bg-[var(--surface)] p-6 group-data-[size=sm]/card:p-4",className,)}{...props}diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsxindex 84c2dcd..b227d51 100644--- a/src/components/ui/checkbox.tsx+++ b/src/components/ui/checkbox.tsx@@ -14,7 +14,7 @@ function Checkbox({<CheckboxPrimitive.Rootdata-slot="checkbox"className={cn(- "peer relative flex size-5 shrink-0 items-center justify-center rounded-md border border-input bg-card transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground",+ "peer relative flex size-5 shrink-0 items-center justify-center rounded-md border-[1.5px] border-[var(--border-strong)] bg-card transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground",className,)}{...props}diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsxindex cbabea9..ff1ed32 100644--- a/src/components/ui/dialog.tsx+++ b/src/components/ui/dialog.tsx@@ -39,7 +39,7 @@ function DialogOverlay({<DialogPrimitive.Overlaydata-slot="dialog-overlay"className={cn(- "fixed inset-0 isolate z-50 bg-[rgba(23,20,17,0.22)] duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",+ "fixed inset-0 isolate z-50 bg-[rgba(28,29,43,0.32)] duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",className,)}{...props}@@ -61,7 +61,7 @@ function DialogContent({<DialogPrimitive.Contentdata-slot="dialog-content"className={cn(- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-5 rounded-[30px] border border-[var(--border)] bg-[var(--paper-raised)] p-6 text-sm shadow-[0_32px_80px_rgba(18,16,12,0.18)] duration-100 outline-none sm:max-w-md sm:p-8 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-5 rounded-3xl bg-[var(--paper-raised)] p-6 text-sm shadow-[0_32px_80px_rgba(28,29,43,0.22)] duration-100 outline-none sm:max-w-md sm:p-8 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className,)}{...props}@@ -106,7 +106,7 @@ function DialogFooter({<divdata-slot="dialog-footer"className={cn(- "-mx-6 -mb-6 flex flex-col-reverse gap-3 rounded-b-[30px] border-t bg-[rgba(239,229,217,0.4)] px-6 py-5 sm:mx-[-2rem] sm:mb-[-2rem] sm:px-8 sm:py-6 sm:flex-row sm:justify-end",+ "flex flex-col-reverse gap-3 pt-1 sm:flex-row sm:justify-end",className,)}{...props}@@ -129,7 +129,7 @@ function DialogTitle({<DialogPrimitive.Titledata-slot="dialog-title"className={cn(- "text-[28px] leading-none font-semibold tracking-[-0.04em] text-[var(--fg)]",+ "pr-8 text-[1.375rem] leading-tight font-extrabold tracking-[-0.02em] text-[var(--fg)]",className,)}{...props}diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsxindex 7c4bbb4..d082bb0 100644--- a/src/components/ui/dropdown-menu.tsx+++ b/src/components/ui/dropdown-menu.tsx@@ -44,7 +44,7 @@ function DropdownMenuContent({sideOffset={sideOffset}align={align}className={cn(- "z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",+ "z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-2xl bg-popover p-1.5 text-popover-foreground shadow-[var(--shadow-soft)] ring-1 ring-[rgba(28,29,43,0.06)] duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",className,)}{...props}@@ -76,7 +76,7 @@ function DropdownMenuItem({data-inset={inset}data-variant={variant}className={cn(- "group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",+ "group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-[0.625rem] px-3 py-2 text-sm font-medium outline-hidden select-none focus:bg-[var(--surface)] focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",className,)}{...props}@@ -171,7 +171,7 @@ function DropdownMenuLabel({data-slot="dropdown-menu-label"data-inset={inset}className={cn(- "px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",+ "px-3 py-2 text-xs font-medium text-muted-foreground data-inset:pl-7",className,)}{...props}diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsxindex 7ab9f69..590aa75 100644--- a/src/components/ui/input.tsx+++ b/src/components/ui/input.tsx@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {type={type}data-slot="input"className={cn(- "min-h-12 w-full min-w-0 rounded-none border border-input bg-[var(--paper-raised)] px-4 py-3 text-sm text-[var(--fg)] transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-[var(--placeholder)] focus-visible:border-[var(--fg)] focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-[rgba(247,247,248,0.92)] disabled:text-[var(--secondary)] aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20",+ "min-h-12 w-full min-w-0 rounded-xl border-[1.5px] border-[var(--border-strong)] bg-[var(--paper)] px-4 py-3 text-sm text-[var(--fg)] transition-[border-color,box-shadow] outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-[var(--placeholder)] hover:border-[var(--border-hover)] focus-visible:border-[var(--accent)] focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-[var(--surface)] disabled:text-[var(--secondary)] aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20",className,)}{...props}diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsxdeleted file mode 100644index 91a726a..0000000--- a/src/components/ui/sheet.tsx+++ /dev/null@@ -1,143 +0,0 @@-"use client";--import * as React from "react";-import { Dialog as SheetPrimitive } from "radix-ui";--import { cn } from "@/lib/cn";-import { Button } from "@/components/ui/button";-import { XIcon } from "lucide-react";--function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {- return <SheetPrimitive.Root data-slot="sheet" {...props} />;-}--function SheetTrigger({- ...props-}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;-}--function SheetClose({- ...props-}: React.ComponentProps<typeof SheetPrimitive.Close>) {- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;-}--function SheetPortal({- ...props-}: React.ComponentProps<typeof SheetPrimitive.Portal>) {- return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;-}--function SheetOverlay({- className,- ...props-}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {- return (- <SheetPrimitive.Overlay- data-slot="sheet-overlay"- className={cn(- "fixed inset-0 z-50 bg-[rgba(23,20,17,0.18)] duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",- className,- )}- {...props}- />- );-}--function SheetContent({- className,- children,- side = "right",- showCloseButton = true,- ...props-}: React.ComponentProps<typeof SheetPrimitive.Content> & {- side?: "top" | "right" | "bottom" | "left";- showCloseButton?: boolean;-}) {- return (- <SheetPortal>- <SheetOverlay />- <SheetPrimitive.Content- data-slot="sheet-content"- data-side={side}- className={cn(- "fixed z-50 flex flex-col gap-4 bg-[var(--paper-raised)] bg-clip-padding text-sm shadow-[0_32px_70px_rgba(18,16,12,0.18)] transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10",- className,- )}- {...props}- >- {children}- {showCloseButton && (- <SheetPrimitive.Close data-slot="sheet-close" asChild>- <Button- variant="ghost"- className="absolute top-3 right-3"- size="icon-sm"- >- <XIcon />- <span className="sr-only">Close</span>- </Button>- </SheetPrimitive.Close>- )}- </SheetPrimitive.Content>- </SheetPortal>- );-}--function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="sheet-header"- className={cn("flex flex-col gap-0.5 p-4", className)}- {...props}- />- );-}--function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="sheet-footer"- className={cn("mt-auto flex flex-col gap-2 p-4", className)}- {...props}- />- );-}--function SheetTitle({- className,- ...props-}: React.ComponentProps<typeof SheetPrimitive.Title>) {- return (- <SheetPrimitive.Title- data-slot="sheet-title"- className={cn("text-base font-medium text-foreground", className)}- {...props}- />- );-}--function SheetDescription({- className,- ...props-}: React.ComponentProps<typeof SheetPrimitive.Description>) {- return (- <SheetPrimitive.Description- data-slot="sheet-description"- className={cn("text-sm text-muted-foreground", className)}- {...props}- />- );-}--export {- Sheet,- SheetTrigger,- SheetClose,- SheetContent,- SheetHeader,- SheetFooter,- SheetTitle,- SheetDescription,-};diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsxdeleted file mode 100644index 06d294e..0000000--- a/src/components/ui/sidebar.tsx+++ /dev/null@@ -1,702 +0,0 @@-"use client";--import * as React from "react";-import { cva, type VariantProps } from "class-variance-authority";-import { Slot } from "radix-ui";--import { useIsMobile } from "@/lib/hooks/use-mobile";-import { cn } from "@/lib/cn";-import { Button } from "@/components/ui/button";-import { Input } from "@/components/ui/input";-import { Separator } from "@/components/ui/separator";-import {- Sheet,- SheetContent,- SheetDescription,- SheetHeader,- SheetTitle,-} from "@/components/ui/sheet";-import { Skeleton } from "@/components/ui/skeleton";-import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from "@/components/ui/tooltip";-import { PanelLeftIcon } from "lucide-react";--const SIDEBAR_COOKIE_NAME = "sidebar_state";-const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;-const SIDEBAR_WIDTH = "16rem";-const SIDEBAR_WIDTH_MOBILE = "18rem";-const SIDEBAR_WIDTH_ICON = "3rem";-const SIDEBAR_KEYBOARD_SHORTCUT = "b";--type SidebarContextProps = {- state: "expanded" | "collapsed";- open: boolean;- setOpen: (open: boolean) => void;- openMobile: boolean;- setOpenMobile: (open: boolean) => void;- isMobile: boolean;- toggleSidebar: () => void;-};--const SidebarContext = React.createContext<SidebarContextProps | null>(null);--function useSidebar() {- const context = React.useContext(SidebarContext);- if (!context) {- throw new Error("useSidebar must be used within a SidebarProvider.");- }-- return context;-}--function SidebarProvider({- defaultOpen = true,- open: openProp,- onOpenChange: setOpenProp,- className,- style,- children,- ...props-}: React.ComponentProps<"div"> & {- defaultOpen?: boolean;- open?: boolean;- onOpenChange?: (open: boolean) => void;-}) {- const isMobile = useIsMobile();- const [openMobile, setOpenMobile] = React.useState(false);-- // This is the internal state of the sidebar.- // We use openProp and setOpenProp for control from outside the component.- const [_open, _setOpen] = React.useState(defaultOpen);- const open = openProp ?? _open;- const setOpen = React.useCallback(- (value: boolean | ((value: boolean) => boolean)) => {- const openState = typeof value === "function" ? value(open) : value;- if (setOpenProp) {- setOpenProp(openState);- } else {- _setOpen(openState);- }-- // This sets the cookie to keep the sidebar state.- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;- },- [setOpenProp, open],- );-- // Helper to toggle the sidebar.- const toggleSidebar = React.useCallback(() => {- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);- }, [isMobile, setOpen, setOpenMobile]);-- // Adds a keyboard shortcut to toggle the sidebar.- React.useEffect(() => {- const handleKeyDown = (event: KeyboardEvent) => {- if (- event.key === SIDEBAR_KEYBOARD_SHORTCUT &&- (event.metaKey || event.ctrlKey)- ) {- event.preventDefault();- toggleSidebar();- }- };-- window.addEventListener("keydown", handleKeyDown);- return () => window.removeEventListener("keydown", handleKeyDown);- }, [toggleSidebar]);-- // We add a state so that we can do data-state="expanded" or "collapsed".- // This makes it easier to style the sidebar with Tailwind classes.- const state = open ? "expanded" : "collapsed";-- const contextValue = React.useMemo<SidebarContextProps>(- () => ({- state,- open,- setOpen,- isMobile,- openMobile,- setOpenMobile,- toggleSidebar,- }),- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],- );-- return (- <SidebarContext.Provider value={contextValue}>- <div- data-slot="sidebar-wrapper"- style={- {- "--sidebar-width": SIDEBAR_WIDTH,- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,- ...style,- } as React.CSSProperties- }- className={cn(- "group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",- className,- )}- {...props}- >- {children}- </div>- </SidebarContext.Provider>- );-}--function Sidebar({- side = "left",- variant = "sidebar",- collapsible = "offcanvas",- className,- children,- dir,- ...props-}: React.ComponentProps<"div"> & {- side?: "left" | "right";- variant?: "sidebar" | "floating" | "inset";- collapsible?: "offcanvas" | "icon" | "none";-}) {- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();-- if (collapsible === "none") {- return (- <div- data-slot="sidebar"- className={cn(- "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",- className,- )}- {...props}- >- {children}- </div>- );- }-- if (isMobile) {- return (- <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>- <SheetContent- dir={dir}- data-sidebar="sidebar"- data-slot="sidebar"- data-mobile="true"- className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"- style={- {- "--sidebar-width": SIDEBAR_WIDTH_MOBILE,- } as React.CSSProperties- }- side={side}- >- <SheetHeader className="sr-only">- <SheetTitle>Sidebar</SheetTitle>- <SheetDescription>Displays the mobile sidebar.</SheetDescription>- </SheetHeader>- <div className="flex h-full w-full flex-col">{children}</div>- </SheetContent>- </Sheet>- );- }-- return (- <div- className="group peer hidden text-sidebar-foreground md:block"- data-state={state}- data-collapsible={state === "collapsed" ? collapsible : ""}- data-variant={variant}- data-side={side}- data-slot="sidebar"- >- {/* This is what handles the sidebar gap on desktop */}- <div- data-slot="sidebar-gap"- className={cn(- "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",- "group-data-[collapsible=offcanvas]:w-0",- "group-data-[side=right]:rotate-180",- variant === "floating" || variant === "inset"- ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",- )}- />- <div- data-slot="sidebar-container"- data-side={side}- className={cn(- "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",- // Adjust the padding for floating and inset variants.- variant === "floating" || variant === "inset"- ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",- className,- )}- {...props}- >- <div- data-sidebar="sidebar"- data-slot="sidebar-inner"- className="flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"- >- {children}- </div>- </div>- </div>- );-}--function SidebarTrigger({- className,- onClick,- ...props-}: React.ComponentProps<typeof Button>) {- const { toggleSidebar } = useSidebar();-- return (- <Button- data-sidebar="trigger"- data-slot="sidebar-trigger"- variant="ghost"- size="icon-sm"- className={cn(className)}- onClick={(event) => {- onClick?.(event);- toggleSidebar();- }}- {...props}- >- <PanelLeftIcon />- <span className="sr-only">Toggle Sidebar</span>- </Button>- );-}--function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {- const { toggleSidebar } = useSidebar();-- return (- <button- data-sidebar="rail"- data-slot="sidebar-rail"- aria-label="Toggle Sidebar"- tabIndex={-1}- onClick={toggleSidebar}- title="Toggle Sidebar"- className={cn(- "absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",- "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",- "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",- className,- )}- {...props}- />- );-}--function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {- return (- <main- data-slot="sidebar-inset"- className={cn(- "relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",- className,- )}- {...props}- />- );-}--function SidebarInput({- className,- ...props-}: React.ComponentProps<typeof Input>) {- return (- <Input- data-slot="sidebar-input"- data-sidebar="input"- className={cn("h-8 w-full bg-background shadow-none", className)}- {...props}- />- );-}--function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="sidebar-header"- data-sidebar="header"- className={cn("flex flex-col gap-2 p-2", className)}- {...props}- />- );-}--function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="sidebar-footer"- data-sidebar="footer"- className={cn("flex flex-col gap-2 p-2", className)}- {...props}- />- );-}--function SidebarSeparator({- className,- ...props-}: React.ComponentProps<typeof Separator>) {- return (- <Separator- data-slot="sidebar-separator"- data-sidebar="separator"- className={cn("mx-2 w-auto bg-sidebar-border", className)}- {...props}- />- );-}--function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="sidebar-content"- data-sidebar="content"- className={cn(- "no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",- className,- )}- {...props}- />- );-}--function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {- return (- <div- data-slot="sidebar-group"- data-sidebar="group"- className={cn("relative flex w-full min-w-0 flex-col p-2", className)}- {...props}- />- );-}--function SidebarGroupLabel({- className,- asChild = false,- ...props-}: React.ComponentProps<"div"> & { asChild?: boolean }) {- const Comp = asChild ? Slot.Root : "div";-- return (- <Comp- data-slot="sidebar-group-label"- data-sidebar="group-label"- className={cn(- "flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",- className,- )}- {...props}- />- );-}--function SidebarGroupAction({- className,- asChild = false,- ...props-}: React.ComponentProps<"button"> & { asChild?: boolean }) {- const Comp = asChild ? Slot.Root : "button";-- return (- <Comp- data-slot="sidebar-group-action"- data-sidebar="group-action"- className={cn(- "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",- className,- )}- {...props}- />- );-}--function SidebarGroupContent({- className,- ...props-}: React.ComponentProps<"div">) {- return (- <div- data-slot="sidebar-group-content"- data-sidebar="group-content"- className={cn("w-full text-sm", className)}- {...props}- />- );-}--function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {- return (- <ul- data-slot="sidebar-menu"- data-sidebar="menu"- className={cn("flex w-full min-w-0 flex-col gap-0", className)}- {...props}- />- );-}--function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {- return (- <li- data-slot="sidebar-menu-item"- data-sidebar="menu-item"- className={cn("group/menu-item relative", className)}- {...props}- />- );-}--const sidebarMenuButtonVariants = cva(- "peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",- {- variants: {- variant: {- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",- outline:- "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",- },- size: {- default: "h-8 text-sm",- sm: "h-7 text-xs",- lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",- },- },- defaultVariants: {- variant: "default",- size: "default",- },- },-);--function SidebarMenuButton({- asChild = false,- isActive = false,- variant = "default",- size = "default",- tooltip,- className,- ...props-}: React.ComponentProps<"button"> & {- asChild?: boolean;- isActive?: boolean;- tooltip?: string | React.ComponentProps<typeof TooltipContent>;-} & VariantProps<typeof sidebarMenuButtonVariants>) {- const Comp = asChild ? Slot.Root : "button";- const { isMobile, state } = useSidebar();-- const button = (- <Comp- data-slot="sidebar-menu-button"- data-sidebar="menu-button"- data-size={size}- data-active={isActive}- className={cn(sidebarMenuButtonVariants({ variant, size }), className)}- {...props}- />- );-- if (!tooltip) {- return button;- }-- if (typeof tooltip === "string") {- tooltip = {- children: tooltip,- };- }-- return (- <Tooltip>- <TooltipTrigger asChild>{button}</TooltipTrigger>- <TooltipContent- side="right"- align="center"- hidden={state !== "collapsed" || isMobile}- {...tooltip}- />- </Tooltip>- );-}--function SidebarMenuAction({- className,- asChild = false,- showOnHover = false,- ...props-}: React.ComponentProps<"button"> & {- asChild?: boolean;- showOnHover?: boolean;-}) {- const Comp = asChild ? Slot.Root : "button";-- return (- <Comp- data-slot="sidebar-menu-action"- data-sidebar="menu-action"- className={cn(- "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",- showOnHover &&- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",- className,- )}- {...props}- />- );-}--function SidebarMenuBadge({- className,- ...props-}: React.ComponentProps<"div">) {- return (- <div- data-slot="sidebar-menu-badge"- data-sidebar="menu-badge"- className={cn(- "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",- className,- )}- {...props}- />- );-}--function SidebarMenuSkeleton({- className,- showIcon = false,- ...props-}: React.ComponentProps<"div"> & {- showIcon?: boolean;-}) {- // Random width between 50 to 90%.- const [width] = React.useState(() => {- return `${Math.floor(Math.random() * 40) + 50}%`;- });-- return (- <div- data-slot="sidebar-menu-skeleton"- data-sidebar="menu-skeleton"- className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}- {...props}- >- {showIcon && (- <Skeleton- className="size-4 rounded-md"- data-sidebar="menu-skeleton-icon"- />- )}- <Skeleton- className="h-4 max-w-(--skeleton-width) flex-1"- data-sidebar="menu-skeleton-text"- style={- {- "--skeleton-width": width,- } as React.CSSProperties- }- />- </div>- );-}--function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {- return (- <ul- data-slot="sidebar-menu-sub"- data-sidebar="menu-sub"- className={cn(- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",- className,- )}- {...props}- />- );-}--function SidebarMenuSubItem({- className,- ...props-}: React.ComponentProps<"li">) {- return (- <li- data-slot="sidebar-menu-sub-item"- data-sidebar="menu-sub-item"- className={cn("group/menu-sub-item relative", className)}- {...props}- />- );-}--function SidebarMenuSubButton({- asChild = false,- size = "md",- isActive = false,- className,- ...props-}: React.ComponentProps<"a"> & {- asChild?: boolean;- size?: "sm" | "md";- isActive?: boolean;-}) {- const Comp = asChild ? Slot.Root : "a";-- return (- <Comp- data-slot="sidebar-menu-sub-button"- data-sidebar="menu-sub-button"- data-size={size}- data-active={isActive}- className={cn(- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",- className,- )}- {...props}- />- );-}--export {- Sidebar,- SidebarContent,- SidebarFooter,- SidebarGroup,- SidebarGroupAction,- SidebarGroupContent,- SidebarGroupLabel,- SidebarHeader,- SidebarInput,- SidebarInset,- SidebarMenu,- SidebarMenuAction,- SidebarMenuBadge,- SidebarMenuButton,- SidebarMenuItem,- SidebarMenuSkeleton,- SidebarMenuSub,- SidebarMenuSubButton,- SidebarMenuSubItem,- SidebarProvider,- SidebarRail,- SidebarSeparator,- SidebarTrigger,- useSidebar,-};diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsxindex 768fb85..ca26d8a 100644--- a/src/components/ui/textarea.tsx+++ b/src/components/ui/textarea.tsx@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {<textareadata-slot="textarea"className={cn(- "flex field-sizing-content min-h-28 w-full rounded-[1.35rem] border border-input bg-[var(--paper-raised)] px-4 py-3 text-sm text-[var(--fg)] transition-colors outline-none placeholder:text-[var(--placeholder)] focus-visible:border-[var(--border-strong)] focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-[rgba(248,244,238,0.9)] disabled:text-[var(--secondary)] aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20",+ "flex field-sizing-content min-h-28 w-full rounded-xl border-[1.5px] border-[var(--border-strong)] bg-[var(--paper)] px-4 py-3 text-sm text-[var(--fg)] transition-[border-color,box-shadow] outline-none placeholder:text-[var(--placeholder)] hover:border-[var(--border-hover)] focus-visible:border-[var(--accent)] focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-[var(--surface)] disabled:text-[var(--secondary)] aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20",className,)}{...props}diff --git a/src/lib/envelopes.ts b/src/lib/envelopes.tsindex c1afa76..8ff723b 100644--- a/src/lib/envelopes.ts+++ b/src/lib/envelopes.ts@@ -56,8 +56,17 @@ import { issueSigningLink } from "./services/signing-links.ts";import {buildEnvelopeCertificateKey,buildEnvelopeOriginalPdfKey,+ buildEnvelopeThumbnailKey,} from "./services/storage-keys.ts";-import { createStorageService } from "./services/storage.ts";+import {+ createStorageService,+ StorageObjectNotFoundError,+ type StorageObjectStream,+} from "./services/storage.ts";+import {+ assertThumbnailImage,+ THUMBNAIL_CONTENT_TYPE,+} from "./services/thumbnails.ts";import {formatReminderAvailableAt,getManualNudgeAvailableAt,@@ -204,6 +213,8 @@ export type DashboardEnvelopeListItem = {id: string;searchableEmails: readonly string[];status: EnvelopeRecord["status"];+ /** What the status pill says: the status, or how far signing has got. */+ statusLabel: string;title: string;};@@ -821,6 +832,30 @@ function buildDashboardContextLine(return `${pluralize(signers.length, "signer")} · ${pluralize(fields.length, "field")} placed`;}+const dashboardStatusLabels: Record<EnvelopeRecord["status"], string> = {+ completed: "Completed",+ declined: "Declined",+ draft: "Draft",+ sent: "Sent",+ voided: "Voided",+};++function buildDashboardStatusLabel(+ envelope: EnvelopeRecord,+ signers: readonly PersistedSignerRecord[],+): string {+ // With one signer "Sent" says it all. With several, say how many are done.+ if (envelope.status === "sent" && signers.length > 1) {+ const signedCount = signers.filter(+ (signer) => signer.status === "signed",+ ).length;++ return `${String(signedCount)} of ${String(signers.length)} signed`;+ }++ return dashboardStatusLabels[envelope.status];+}+function buildFieldsBySigner(fields: readonly FieldRecord[],): Map<string, FieldRecord[]> {@@ -1076,6 +1111,7 @@ export async function listEnvelopesForUser(id: envelope.id,searchableEmails: signers.map((signer) => signer.email),status: envelope.status,+ statusLabel: buildDashboardStatusLabel(envelope, signers),title: envelope.title,};});@@ -1227,8 +1263,9 @@ export async function getDraftEnvelopeDocumentForUser(};} catch (error) {if (- error instanceof Error &&- (error.name === "NoSuchKey" || error.name === "NotFound")+ error instanceof StorageObjectNotFoundError ||+ (error instanceof Error &&+ (error.name === "NoSuchKey" || error.name === "NotFound"))) {throw new EnvelopeDocumentAccessError("Source PDF is unavailable.", 404);}@@ -1237,6 +1274,67 @@ export async function getDraftEnvelopeDocumentForUser(}}+/**+ * Keeps the picture of the first page that the sender's browser drew. The+ * bytes are checked before they are stored: see services/thumbnails.ts.+ */+export async function saveEnvelopeThumbnailForUser(+ userId: string,+ envelopeId: string,+ body: Uint8Array,+ {+ database = getDb(),+ }: {+ database?: DbExecutor;+ } = {},+): Promise<void> {+ assertThumbnailImage(body);++ const envelope = await getEnvelopeByIdForUser(userId, envelopeId, database);++ if (!envelope) {+ throw new EnvelopeDocumentAccessError("Envelope not found.", 404);+ }++ await createStorageService().putObject({+ body,+ contentType: THUMBNAIL_CONTENT_TYPE,+ key: buildEnvelopeThumbnailKey({ envelopeId: envelope.id, userId }),+ });+}++/** Streams the stored first-page picture, or says there is none (404). */+export async function getEnvelopeThumbnailForUser(+ userId: string,+ envelopeId: string,+ {+ database = getDb(),+ }: {+ database?: DbExecutor;+ } = {},+): Promise<StorageObjectStream> {+ const envelope = await getEnvelopeByIdForUser(userId, envelopeId, database);++ if (!envelope) {+ throw new EnvelopeDocumentAccessError("Envelope not found.", 404);+ }++ try {+ return await createStorageService().getObjectStream(+ buildEnvelopeThumbnailKey({ envelopeId: envelope.id, userId }),+ );+ } catch (error) {+ if (error instanceof StorageObjectNotFoundError) {+ throw new EnvelopeDocumentAccessError(+ "This document has no thumbnail yet.",+ 404,+ );+ }++ throw error;+ }+}+export async function getPrepareEnvelopeDataForUser(userId: string,envelopeId: string,@@ -2144,6 +2242,14 @@ export async function deleteDraftEnvelope(error,);});+ await storageService+ .deleteObject(buildEnvelopeThumbnailKey({ envelopeId, userId }))+ .catch((error) => {+ console.error(+ `Failed to delete the thumbnail for draft envelope ${envelopeId}:`,+ error,+ );+ });return envelope;}diff --git a/src/lib/pdf-thumbnail.ts b/src/lib/pdf-thumbnail.tsnew file mode 100644index 0000000..9fe3de8--- /dev/null+++ b/src/lib/pdf-thumbnail.ts@@ -0,0 +1,118 @@+import { loadPdfJsModule, PDF_JS_STANDARD_FONT_DATA_URL } from "./pdfjs-client";++// Draws the first page of a PDF as a small JPEG, in the browser. The server+// never renders PDFs, so this is where a document's dashboard thumbnail+// comes from: once at upload, or later for an envelope that has none.++const THUMBNAIL_WIDTH = 480;+const THUMBNAIL_MAX_HEIGHT = 960;+const THUMBNAIL_QUALITY = 0.82;++export function buildEnvelopeThumbnailUrl(envelopeId: string): string {+ return `/api/envelopes/${encodeURIComponent(envelopeId)}/thumbnail`;+}++export async function renderPdfThumbnail(+ source: Uint8Array | { url: string },+): Promise<Blob> {+ const pdfjs = await loadPdfJsModule();+ const loadingTask = pdfjs.getDocument(+ source instanceof Uint8Array+ ? {+ // pdf.js takes ownership of the buffer it is given.+ data: source.slice(),+ standardFontDataUrl: PDF_JS_STANDARD_FONT_DATA_URL,+ }+ : {+ standardFontDataUrl: PDF_JS_STANDARD_FONT_DATA_URL,+ url: source.url,+ },+ );++ try {+ const documentProxy = await loadingTask.promise;+ const page = await documentProxy.getPage(1);+ const baseViewport = page.getViewport({ scale: 1 });+ const scale = Math.min(+ THUMBNAIL_WIDTH / baseViewport.width,+ THUMBNAIL_MAX_HEIGHT / baseViewport.height,+ );+ const viewport = page.getViewport({ scale });+ const canvas = document.createElement("canvas");++ canvas.width = Math.max(1, Math.round(viewport.width));+ canvas.height = Math.max(1, Math.round(viewport.height));++ const context = canvas.getContext("2d");++ if (!context) {+ throw new Error("Unable to create a thumbnail canvas.");+ }++ // A JPEG has no transparency: without this a page with no background+ // of its own would come out black.+ context.fillStyle = "#ffffff";+ context.fillRect(0, 0, canvas.width, canvas.height);++ await page.render({ canvas, canvasContext: context, viewport }).promise;+ page.cleanup();++ return await new Promise<Blob>((resolve, reject) => {+ canvas.toBlob(+ (blob) => {+ if (blob) {+ resolve(blob);+ } else {+ reject(new Error("Unable to encode the thumbnail."));+ }+ },+ "image/jpeg",+ THUMBNAIL_QUALITY,+ );+ });+ } finally {+ await loadingTask.destroy();+ }+}++/** Stores a thumbnail for an envelope. Resolves to whether it was kept. */+export async function uploadEnvelopeThumbnail(+ envelopeId: string,+ thumbnail: Blob,+): Promise<boolean> {+ try {+ const response = await fetch(buildEnvelopeThumbnailUrl(envelopeId), {+ body: thumbnail,+ headers: { "content-type": "image/jpeg" },+ method: "PUT",+ });++ return response.ok;+ } catch {+ return false;+ }+}++// A dashboard full of envelopes without thumbnails would otherwise download+// and draw every PDF at once.+let backfillQueue: Promise<unknown> = Promise.resolve();++/**+ * Makes the thumbnail for an envelope that has none, from its stored PDF,+ * and saves it for next time. One document at a time.+ */+export function backfillEnvelopeThumbnail(envelopeId: string): Promise<Blob> {+ const result = backfillQueue.then(async () => {+ const thumbnail = await renderPdfThumbnail({+ url: `/api/envelopes/${encodeURIComponent(envelopeId)}/document`,+ });++ void uploadEnvelopeThumbnail(envelopeId, thumbnail);++ return thumbnail;+ });++ backfillQueue = result.catch(() => undefined);++ return result;+}diff --git a/src/lib/retention.ts b/src/lib/retention.tsindex 66e09a2..af325c5 100644--- a/src/lib/retention.ts+++ b/src/lib/retention.ts@@ -4,7 +4,10 @@ import {queryMany,queryOne,} from "./db/connection.ts";-import { getRecipientCertificateKey } from "./services/storage-keys.ts";+import {+ buildEnvelopeThumbnailKey,+ getRecipientCertificateKey,+} from "./services/storage-keys.ts";import {createStorageService,type StorageService,@@ -191,6 +194,13 @@ function buildEnvelopeStorageKeys(const keys = new Set<string>(fieldImageKeys);keys.add(envelope.sourcePdfKey);+ // A picture of the first page is as private as the document itself.+ keys.add(+ buildEnvelopeThumbnailKey({+ envelopeId: envelope.id,+ userId: envelope.userId,+ }),+ );if (envelope.signedPdfKey) {keys.add(envelope.signedPdfKey);diff --git a/src/lib/services/storage-keys.ts b/src/lib/services/storage-keys.tsindex 49bfb9e..5b8d143 100644--- a/src/lib/services/storage-keys.ts+++ b/src/lib/services/storage-keys.ts@@ -56,6 +56,17 @@ export function buildEnvelopeOriginalPdfKey(return path.posix.join(buildEnvelopePrefix(input), "original.pdf");}+/**+ * The picture of the first page shown on the dashboard. It sits beside the+ * original so that whatever removes an envelope's files can find it without+ * a database column: it may or may not exist.+ */+export function buildEnvelopeThumbnailKey(+ input: EnvelopeStorageIdentity,+): string {+ return path.posix.join(buildEnvelopePrefix(input), "thumbnail.jpg");+}+export function buildEnvelopeSignedPdfKey(input: EnvelopeStorageIdentity,): string {diff --git a/src/lib/services/thumbnails.test.ts b/src/lib/services/thumbnails.test.tsnew file mode 100644index 0000000..6c84917--- /dev/null+++ b/src/lib/services/thumbnails.test.ts@@ -0,0 +1,164 @@+import assert from "node:assert/strict";+import { test } from "node:test";++import {+ assertThumbnailImage,+ readJpegDimensions,+ THUMBNAIL_MAX_BYTES,+ THUMBNAIL_MAX_DIMENSION,+ ThumbnailValidationError,+} from "./thumbnails.ts";++const START_OF_IMAGE = [0xff, 0xd8];+const END_OF_IMAGE = [0xff, 0xd9];++function segment(marker: number, payload: number[]): number[] {+ const length = payload.length + 2;++ return [0xff, marker, length >> 8, length & 0xff, ...payload];+}++function frameHeader(marker: number, width: number, height: number): number[] {+ return segment(marker, [+ 8, // bits per sample+ height >> 8,+ height & 0xff,+ width >> 8,+ width & 0xff,+ 3, // components+ 1,+ 0x22,+ 0,+ 2,+ 0x11,+ 1,+ 3,+ 0x11,+ 1,+ ]);+}++// Only the headers of a JPEG: enough to say what it is and how large,+// which is all the thumbnail check reads.+function buildJpeg({+ frameMarker = 0xc0,+ height = 621,+ leading = [],+ width = 480,+}: {+ frameMarker?: number;+ height?: number;+ leading?: number[];+ width?: number;+} = {}): Uint8Array {+ return Uint8Array.from([+ ...START_OF_IMAGE,+ ...segment(0xe0, [0x4a, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0]),+ ...leading,+ ...frameHeader(frameMarker, width, height),+ ...END_OF_IMAGE,+ ]);+}++test("reads the size of a baseline JPEG", () => {+ assert.deepEqual(readJpegDimensions(buildJpeg()), {+ height: 621,+ width: 480,+ });+});++test("reads the size of a progressive JPEG", () => {+ assert.deepEqual(+ readJpegDimensions(+ buildJpeg({ frameMarker: 0xc2, height: 300, width: 200 }),+ ),+ { height: 300, width: 200 },+ );+});++test("skips tables and padding that come before the frame header", () => {+ const huffmanTable = segment(0xc4, new Array<number>(20).fill(0));+ const quantizationTable = segment(0xdb, new Array<number>(65).fill(1));++ assert.deepEqual(+ readJpegDimensions(+ buildJpeg({ leading: [...quantizationTable, 0xff, ...huffmanTable] }),+ ),+ { height: 621, width: 480 },+ );+});++test("does not accept other kinds of file", () => {+ const png = Uint8Array.from([+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0, 0, 0, 0x0d,+ ]);+ const pdf = new TextEncoder().encode("%PDF-1.7\n1 0 obj\n<<>>\nendobj\n");+ const html = new TextEncoder().encode("<html><script>alert(1)</script>");++ assert.equal(readJpegDimensions(png), null);+ assert.equal(readJpegDimensions(pdf), null);+ assert.equal(readJpegDimensions(html), null);+ assert.equal(readJpegDimensions(new Uint8Array()), null);+});++test("does not accept a JPEG that never says how large it is", () => {+ const headerOnly = Uint8Array.from([...START_OF_IMAGE, ...END_OF_IMAGE]);+ const truncatedFrame = buildJpeg().slice(0, 26);+ const imageDataFirst = Uint8Array.from([+ ...START_OF_IMAGE,+ ...segment(0xda, [0, 0, 0, 0]),+ ...frameHeader(0xc0, 480, 621),+ ]);++ assert.equal(readJpegDimensions(headerOnly), null);+ assert.equal(readJpegDimensions(truncatedFrame), null);+ assert.equal(readJpegDimensions(imageDataFirst), null);+});++test("accepts a thumbnail of a usable size", () => {+ assert.deepEqual(assertThumbnailImage(buildJpeg()), {+ height: 621,+ width: 480,+ });+ assert.doesNotThrow(() =>+ assertThumbnailImage(+ buildJpeg({+ height: THUMBNAIL_MAX_DIMENSION,+ width: THUMBNAIL_MAX_DIMENSION,+ }),+ ),+ );+});++test("refuses a thumbnail that is empty, too heavy, or not a JPEG", () => {+ const tooHeavy = new Uint8Array(THUMBNAIL_MAX_BYTES + 1);++ tooHeavy.set(buildJpeg());++ assert.throws(+ () => assertThumbnailImage(new Uint8Array()),+ ThumbnailValidationError,+ );+ assert.throws(() => assertThumbnailImage(tooHeavy), ThumbnailValidationError);+ assert.throws(+ () => assertThumbnailImage(new TextEncoder().encode("%PDF-1.7")),+ ThumbnailValidationError,+ );+});++test("refuses a thumbnail whose picture is too large or too small", () => {+ assert.throws(+ () =>+ assertThumbnailImage(buildJpeg({ width: THUMBNAIL_MAX_DIMENSION + 1 })),+ ThumbnailValidationError,+ );+ assert.throws(+ () =>+ assertThumbnailImage(buildJpeg({ height: THUMBNAIL_MAX_DIMENSION + 1 })),+ ThumbnailValidationError,+ );+ assert.throws(+ () => assertThumbnailImage(buildJpeg({ height: 4, width: 4 })),+ ThumbnailValidationError,+ );+});diff --git a/src/lib/services/thumbnails.ts b/src/lib/services/thumbnails.tsnew file mode 100644index 0000000..2ac432d--- /dev/null+++ b/src/lib/services/thumbnails.ts@@ -0,0 +1,122 @@+// A small picture of a document's first page, shown on the dashboard.+//+// The server never renders PDFs, so the sender's browser draws the first+// page and sends the result. That makes the picture untrusted input: it is+// only ever shown back to the account that sent it, and it is stored and+// served only if it really is a small JPEG.++export const THUMBNAIL_CONTENT_TYPE = "image/jpeg";+export const THUMBNAIL_MAX_BYTES = 256 * 1024;+export const THUMBNAIL_MAX_DIMENSION = 1200;+const THUMBNAIL_MIN_DIMENSION = 16;++export class ThumbnailValidationError extends Error {+ constructor(message: string) {+ super(message);+ this.name = "ThumbnailValidationError";+ }+}++type JpegDimensions = {+ height: number;+ width: number;+};++function isStartOfFrameMarker(marker: number): boolean {+ // SOF0 to SOF15, leaving out the three in that range that are not frames:+ // the Huffman table (C4), the JPEG extension (C8) and arithmetic+ // conditioning (CC).+ return (+ marker >= 0xc0 &&+ marker <= 0xcf &&+ marker !== 0xc4 &&+ marker !== 0xc8 &&+ marker !== 0xcc+ );+}++/**+ * Reads the size of a JPEG from its frame header, or returns null when the+ * bytes are not a JPEG that says how large it is.+ */+export function readJpegDimensions(bytes: Uint8Array): JpegDimensions | null {+ if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8) {+ return null;+ }++ let offset = 2;++ while (offset + 3 < bytes.length) {+ if (bytes[offset] !== 0xff) {+ return null;+ }++ const marker = bytes[offset + 1];++ // Padding before a marker.+ if (marker === 0xff) {+ offset += 1;+ continue;+ }++ // Markers that stand alone, with no length after them.+ if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7)) {+ offset += 2;+ continue;+ }++ // Image data or the end of the image before any frame header.+ if (marker === 0xda || marker === 0xd9) {+ return null;+ }++ const segmentLength = (bytes[offset + 2] << 8) | bytes[offset + 3];++ if (segmentLength < 2) {+ return null;+ }++ if (isStartOfFrameMarker(marker)) {+ if (segmentLength < 7 || offset + 8 >= bytes.length) {+ return null;+ }++ return {+ height: (bytes[offset + 5] << 8) | bytes[offset + 6],+ width: (bytes[offset + 7] << 8) | bytes[offset + 8],+ };+ }++ offset += 2 + segmentLength;+ }++ return null;+}++/** Throws unless the bytes are a JPEG small enough to keep as a thumbnail. */+export function assertThumbnailImage(bytes: Uint8Array): JpegDimensions {+ if (bytes.length === 0) {+ throw new ThumbnailValidationError("The thumbnail is empty.");+ }++ if (bytes.length > THUMBNAIL_MAX_BYTES) {+ throw new ThumbnailValidationError("The thumbnail is too large.");+ }++ const dimensions = readJpegDimensions(bytes);++ if (!dimensions) {+ throw new ThumbnailValidationError("The thumbnail must be a JPEG image.");+ }++ if (+ dimensions.width < THUMBNAIL_MIN_DIMENSION ||+ dimensions.height < THUMBNAIL_MIN_DIMENSION ||+ dimensions.width > THUMBNAIL_MAX_DIMENSION ||+ dimensions.height > THUMBNAIL_MAX_DIMENSION+ ) {+ throw new ThumbnailValidationError("The thumbnail is not a usable size.");+ }++ return dimensions;+}