inboxer 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ui/routes.js CHANGED
@@ -35,21 +35,32 @@ export function registerUi(app, mail, access, cfg) {
35
35
  to: m.to.filter(a => !own.has(bareAddress(a))),
36
36
  cc: m.cc.filter(a => !own.has(bareAddress(a))),
37
37
  });
38
- const page = async (c, title, body, current, status = 200) => {
38
+ /** Mailboxes a session can send from: every one in its scope but the catch-all. */
39
+ const senders = (session) => mail.listMailboxes(session.scope).filter(m => m.id !== CATCHALL);
40
+ const domainsOf = (session) => [...new Set(senders(session).map(m => domainOf(m.address)))];
41
+ const page = async (c, title, body, current, status = 200, fullScreen = false) => {
39
42
  const session = c.get("session");
40
- const draftCount = session ? (await mail.listDrafts(undefined, session.scope)).length : 0;
41
- const domains = session
42
- ? [...new Set(mail.listMailboxes(session.scope).filter(m => m.id !== CATCHALL).map(m => domainOf(m.address)))]
43
- : [];
44
- return c.html(V.layout(title, body, { theme: theme(c), page: current, draftCount, signedIn: !!session, domains }), status);
43
+ const shell = session
44
+ ? { draftCount: (await mail.listDrafts(undefined, session.scope)).length, domains: domainsOf(session), senders: senders(session) }
45
+ : {};
46
+ return c.html(V.layout(title, body, { theme: theme(c), page: current, signedIn: !!session, fullScreen, ...shell }), status);
45
47
  };
46
48
  // Sign-in: GET only shows a button, so link previews and scanners do not burn the link.
49
+ // A used or expired link on a browser that is already signed in just opens the app.
50
+ const signedInSession = async (c) => {
51
+ const value = await getSignedCookie(c, secret, SESSION_COOKIE);
52
+ return value ? access.authenticate(value) : null;
53
+ };
47
54
  app.get("/auth/:token", async (c) => {
48
55
  const valid = await access.isLinkValid(c.req.param("token"));
56
+ if (!valid && (await signedInSession(c)))
57
+ return c.redirect("/", 303);
49
58
  return page(c, S.signInTitle, V.signIn(c.req.param("token"), valid), null, valid ? 200 : 404);
50
59
  });
51
60
  app.post("/auth/:token", async (c) => {
52
61
  const signedIn = await access.consumeLoginLink(c.req.param("token"), clientInfo(c));
62
+ if (!signedIn && (await signedInSession(c)))
63
+ return c.redirect("/", 303);
53
64
  if (!signedIn)
54
65
  return page(c, S.signInTitle, V.signIn("", false), null, 404);
55
66
  await setSignedCookie(c, SESSION_COOKIE, signedIn.secret, secret, cookieOptions);
@@ -64,7 +75,7 @@ export function registerUi(app, mail, access, cfg) {
64
75
  const path = back && new URL(back).origin === new URL(c.req.url).origin ? new URL(back).pathname + new URL(back).search : "/";
65
76
  return c.redirect(path, 303);
66
77
  });
67
- const ui = ["/", "/inbox", "/threads/*", "/drafts/*", "/attachments/*", "/devices", "/devices/*", "/logout"];
78
+ const ui = ["/", "/inbox", "/threads/*", "/drafts/*", "/attachments/*", "/compose", "/devices", "/devices/*", "/settings", "/logout"];
68
79
  for (const path of ui) {
69
80
  app.use(path, async (c, next) => {
70
81
  const value = await getSignedCookie(c, secret, SESSION_COOKIE);
@@ -175,27 +186,81 @@ export function registerUi(app, mail, access, cfg) {
175
186
  return c.html(await draftView(c, id));
176
187
  });
177
188
  }
178
- app.get("/inbox", async (c) => {
179
- const mailbox = c.req.query("mailbox") ?? "";
189
+ /** The inbox filter from the query, carried along when a thread opens beside the list. */
190
+ const inboxFilter = (c) => {
180
191
  const requested = c.req.query("status");
181
192
  const status = requested === "all" || requested === "archived" ? requested : "unanswered";
182
- const scope = c.get("session").scope;
183
- const threads = await mail.listThreads({ mailbox: mailbox || undefined, status, limit: 200 }, scope);
184
- const mailboxes = mail.listMailboxes(scope);
185
- const own = new Set(mailboxes.map(m => bareAddress(m.address)));
186
- return page(c, S.navInbox, V.inboxPage(threads, mailboxes.map(m => m.id), { mailbox, status }, own), "inbox");
187
- });
193
+ return { mailbox: c.req.query("mailbox") ?? "", status };
194
+ };
195
+ const threadList = async (c, current) => {
196
+ const session = c.get("session");
197
+ const filter = inboxFilter(c);
198
+ const threads = await mail.listThreads({ mailbox: filter.mailbox || undefined, status: filter.status, limit: 200 }, session.scope);
199
+ const mailboxes = mail.listMailboxes(session.scope).map(m => m.id);
200
+ return V.threadList(threads, { mailboxes, domains: domainsOf(session), filter, own, current });
201
+ };
202
+ app.get("/inbox", async (c) => page(c, S.navInbox, V.inboxPage(await threadList(c, null), null), "inbox"));
188
203
  app.get("/threads/:id", async (c) => {
189
204
  const id = c.req.param("id");
190
- const scope = c.get("session").scope;
191
- let thread = await mail.requireThread(id, scope);
205
+ const session = c.get("session");
206
+ let thread = await mail.requireThread(id, session.scope);
192
207
  if (thread.unread) {
193
- await mail.mark([id], { read: true }, uiActor(c.get("session")));
194
- thread = await mail.requireThread(id, scope);
208
+ await mail.mark([id], { read: true }, uiActor(session));
209
+ thread = await mail.requireThread(id, session.scope);
210
+ }
211
+ const { messages, context, contacts } = await mail.getThread(id, session.scope);
212
+ const people = thread.participants.filter(p => !own.has(p));
213
+ const entries = await Promise.all(messages.map(async (m) => ({
214
+ at: m.date,
215
+ view: m.status === "draft" ? V.draftCard(await mail.store.requireMessage(m.id), [], null) : V.messageBubble(shown(m), people.length > 1),
216
+ })));
217
+ const reply = { allowed: senders(session).some(m => m.id === thread.mailbox), replyAll: people.length > 1 };
218
+ const view = V.threadView(thread, entries, { context, contacts }, { filter: inboxFilter(c), own, reply });
219
+ return page(c, thread.subject || S.navInbox, V.inboxPage(await threadList(c, id), view), "inbox", 200, true);
220
+ });
221
+ /** Replies to the latest message; a reply sent from here gets the same undo window as a draft. */
222
+ app.post("/threads/:id/reply", async (c) => {
223
+ const id = c.req.param("id");
224
+ const actor = uiActor(c.get("session"));
225
+ const body = await c.req.parseBody();
226
+ const text = String(body.text ?? "");
227
+ const { messages } = await mail.getThread(id, actor.scope);
228
+ const latest = messages.filter(m => m.status !== "draft").at(-1);
229
+ const back = `/threads/${id}?${V.inboxQuery(inboxFilter(c))}`;
230
+ if (!latest || !text.trim())
231
+ return c.redirect(back, 303);
232
+ try {
233
+ const draft = await mail.createDraft({ replyToId: latest.id, replyAll: body.reply_all === "1", text }, actor);
234
+ if (body.action === "send")
235
+ await mail.schedule(draft.id, "send", actor);
236
+ }
237
+ catch (err) {
238
+ if (err instanceof InvalidRequestError)
239
+ return page(c, S.reply, V.message([err.message]), "inbox", 400);
240
+ throw err;
241
+ }
242
+ return c.redirect(back, 303);
243
+ });
244
+ app.post("/compose", async (c) => {
245
+ const actor = uiActor(c.get("session"));
246
+ const body = await c.req.parseBody();
247
+ try {
248
+ const draft = await mail.createDraft({
249
+ mailbox: String(body.mailbox ?? ""),
250
+ to: splitAddresses(String(body.to ?? "")),
251
+ cc: splitAddresses(String(body.cc ?? "")),
252
+ subject: String(body.subject ?? ""),
253
+ text: String(body.text ?? ""),
254
+ }, actor);
255
+ if (body.action === "send")
256
+ await mail.schedule(draft.id, "send", actor);
257
+ return c.redirect(`/threads/${draft.thread_id}?status=all`, 303);
258
+ }
259
+ catch (err) {
260
+ if (err instanceof InvalidRequestError)
261
+ return page(c, S.newMail, V.message([err.message]), null, 400);
262
+ throw err;
195
263
  }
196
- const { messages, context, contacts } = await mail.getThread(id, scope);
197
- const items = await Promise.all([...messages].reverse().map(async (m) => m.status === "draft" ? V.draftCard(await mail.store.requireMessage(m.id), [], null) : V.messageCard(shown(m))));
198
- return page(c, thread.subject || S.navInbox, V.threadPage(thread, items, { context, contacts }), "inbox");
199
264
  });
200
265
  app.post("/threads/:id/archive", async (c) => {
201
266
  const id = c.req.param("id");
@@ -219,6 +284,7 @@ export function registerUi(app, mail, access, cfg) {
219
284
  const session = c.get("session");
220
285
  return page(c, S.navDevices, V.devicesPage(await access.listSessions(session.scope), session.id), "devices");
221
286
  });
287
+ app.get("/settings", async (c) => page(c, S.navSettings, V.settingsPage(theme(c)), "settings"));
222
288
  app.post("/devices/:id/revoke", async (c) => {
223
289
  await access.revokeSession(c.req.param("id"), uiActor(c.get("session")));
224
290
  return c.body(null, 200);
@@ -1,3 +1,30 @@
1
+ // New mail opens as a modal sheet; a click on its backdrop or a [data-close] button closes it.
2
+ document.addEventListener("click", event => {
3
+ const target = event.target instanceof Element ? event.target : null;
4
+ if (!target) return;
5
+ if (target.closest("[data-compose]")) {
6
+ const dialog = document.getElementById("compose");
7
+ dialog.showModal();
8
+ dialog.querySelector("#compose-to").focus();
9
+ } else if (target.closest("[data-close]")) {
10
+ target.closest("dialog").close();
11
+ } else if (target instanceof HTMLDialogElement && target.open) {
12
+ target.close();
13
+ } else if (target.closest("[data-context-toggle]")) {
14
+ document.body.classList.toggle("context-open");
15
+ }
16
+ });
17
+
18
+ document.addEventListener("keydown", event => {
19
+ if (event.key === "Escape") document.body.classList.remove("context-open");
20
+ });
21
+
22
+ // A thread opens at its latest message.
23
+ document.addEventListener("DOMContentLoaded", () => {
24
+ const messages = document.querySelector("[data-scroll-end]");
25
+ if (messages) messages.scrollTop = messages.scrollHeight;
26
+ });
27
+
1
28
  // Files dropped on a [data-drop] zone go to its file input, which uploads them through htmx.
2
29
  const zoneOf = event => event.target instanceof Element ? event.target.closest("[data-drop]") : null;
3
30
  const hasFiles = event => [...(event.dataTransfer?.types ?? [])].includes("Files");
@@ -1,17 +1,23 @@
1
1
  :root {
2
2
  color-scheme: light dark;
3
- --bg: light-dark(#fbfbfa, #0c0b0a);
4
- --fg: light-dark(#0a0a0a, #f2f2f0);
5
- --muted: light-dark(#8a8a86, #6e6e6a);
6
- --line: light-dark(#e6e6e3, #24201d);
7
- --soft: light-dark(#f1f1ef, #141414);
3
+ --bg: light-dark(#fbfbfa, #262624);
4
+ --fg: light-dark(#0a0a0a, #ececea);
5
+ --muted: light-dark(#6b6b67, #a3a39e);
6
+ --line: light-dark(#e6e6e3, #3a3a37);
7
+ --soft: light-dark(#f1f1ef, #1f1f1e);
8
+ --chip: light-dark(#e9e9e6, #333331);
9
+ --surface: light-dark(#ffffff, #2e2e2c);
10
+ --mine: light-dark(#ffe6d6, #4a2e20);
11
+ --mine-line: light-dark(#ffd2b8, #5e3a28);
8
12
  --accent: light-dark(#ff4d00, #ff7a3d);
9
- --focus: light-dark(#0a0a0a, #c2552a);
10
- --primary-bg: light-dark(#0a0a0a, #2e1a10);
11
- --primary-fg: light-dark(#fbfbfa, #ffd9c4);
12
- --primary-border: light-dark(#0a0a0a, #5a2e17);
13
+ --accent-text: light-dark(#c43d00, #ff8f5c);
14
+ --focus: light-dark(#0a0a0a, #a3a39e);
15
+ --primary-bg: light-dark(#0a0a0a, #ececea);
16
+ --primary-fg: light-dark(#fbfbfa, #1f1f1e);
13
17
  --danger: light-dark(#d92d20, #ff6b5e);
18
+ --backdrop: light-dark(rgb(10 10 10 / .42), rgb(0 0 0 / .5));
14
19
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
20
+ --tabbar: 64px;
15
21
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
16
22
  font-size: 15px;
17
23
  line-height: 1.5;
@@ -24,24 +30,242 @@
24
30
  [hidden] { display: none !important; }
25
31
  body { margin: 0; background: var(--bg); color: var(--fg); }
26
32
  a { color: inherit; text-decoration: none; }
27
- main { max-width: 720px; margin: 0 auto; padding: 32px 16px 96px; }
28
- h1 { font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.04em; font-weight: 700; margin: 0 0 24px; }
33
+ h1 { font-size: 2rem; line-height: 1.1; letter-spacing: -0.04em; font-weight: 700; margin: 0 0 24px; }
29
34
  ::selection { background: var(--accent); color: #fff; }
35
+ .icon { flex: none; }
30
36
 
31
- /* Header */
32
- header {
33
- position: sticky; top: 0; z-index: 1;
34
- display: flex; align-items: center; gap: 12px;
35
- padding: 12px 16px;
36
- background: color-mix(in srgb, var(--bg) 85%, transparent);
37
- backdrop-filter: blur(12px);
38
- border-bottom: 1px solid var(--line);
39
- }
40
- header nav { display: flex; gap: 16px; flex: 1; min-width: 0; overflow-x: auto; }
41
- header nav a { color: var(--muted); font-weight: 500; white-space: nowrap; transition: color .15s; }
42
- header nav a:hover, header nav a[aria-current="page"] { color: var(--fg); }
43
- header form { margin: 0; }
44
- .count { color: var(--accent); font-family: var(--mono); font-size: .75rem; vertical-align: super; }
37
+ /* Shell: a tab bar on a phone, a sidebar on a wide screen */
38
+ .sidebar { display: none; }
39
+ body.app { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
40
+ body.app.full { padding-bottom: 0; }
41
+ .page { max-width: 760px; margin: 0 auto; padding: 24px 16px 32px; }
42
+
43
+ .tabbar {
44
+ position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
45
+ display: flex; align-items: center;
46
+ padding: 4px 8px env(safe-area-inset-bottom);
47
+ background: var(--bg); border-top: 1px solid var(--line);
48
+ }
49
+ body.full .tabbar { display: none; }
50
+ .tabbar a {
51
+ position: relative; flex: 1; height: 56px;
52
+ display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
53
+ font-size: 11px; font-weight: 500; color: var(--muted);
54
+ }
55
+ .tabbar a[aria-current="page"] { color: var(--fg); }
56
+ .tabbar .count {
57
+ position: absolute; top: 4px; left: 52%;
58
+ min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
59
+ display: flex; align-items: center; justify-content: center;
60
+ background: var(--accent); color: #1f1f1e; font-family: var(--mono); font-size: 10px;
61
+ }
62
+ .tab-compose { flex: 1; height: 56px; padding: 0; border: none; background: none; display: flex; align-items: center; justify-content: center; }
63
+ .tab-compose span {
64
+ width: 52px; height: 40px; border-radius: 14px;
65
+ display: flex; align-items: center; justify-content: center;
66
+ background: var(--primary-bg); color: var(--primary-fg);
67
+ }
68
+ .tab-compose:hover { border: none; }
69
+
70
+ @media (min-width: 900px) {
71
+ body.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); padding-bottom: 0; }
72
+ .tabbar { display: none; }
73
+ .sidebar {
74
+ position: sticky; top: 0; height: 100dvh;
75
+ display: flex; flex-direction: column; gap: 4px;
76
+ padding: 20px 14px; border-right: 1px solid var(--line);
77
+ }
78
+ .brand { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; padding: 0 12px; }
79
+ .brand span { color: var(--accent); }
80
+ .sidebar .domain { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 2px 12px 0; overflow-wrap: anywhere; }
81
+ .new-mail { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 12px; margin: 16px 0 14px; }
82
+ .side-nav { display: flex; flex-direction: column; gap: 2px; }
83
+ .side-nav a {
84
+ display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px;
85
+ color: var(--muted); font-size: 14px; font-weight: 500;
86
+ }
87
+ .side-nav a:hover { color: var(--fg); }
88
+ .side-nav a[aria-current="page"] { background: var(--chip); color: var(--fg); }
89
+ .side-nav .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--accent-text); }
90
+ .side-end { margin-top: auto; }
91
+ .page { padding-top: 40px; }
92
+ }
93
+
94
+ /* Inbox: the list, and the open thread beside it on a wide screen */
95
+ .split .pane { display: none; }
96
+ .split.has-thread .list { display: none; }
97
+ .split.has-thread .pane { display: block; }
98
+ @media (min-width: 900px) {
99
+ .split { display: flex; height: 100dvh; }
100
+ .split .list { display: block; width: 380px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); }
101
+ .split .pane { display: block; flex: 1; min-width: 0; background: var(--soft); }
102
+ body.context-open .split .list { display: none; }
103
+ }
104
+
105
+ .list-head { padding: 18px 16px 12px; }
106
+ .list-head h1 { font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
107
+ .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
108
+ .chips { display: flex; gap: 8px; }
109
+ .chip {
110
+ display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
111
+ border: 1px solid var(--line); font-size: 13px; font-weight: 500; white-space: nowrap;
112
+ }
113
+ .chip:hover { border-color: var(--focus); }
114
+ .chip[aria-current="page"] { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
115
+
116
+ .row { display: flex; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
117
+ .row:hover { background: var(--soft); }
118
+ .row[aria-current="page"] { background: var(--soft); box-shadow: inset 3px 0 0 var(--accent); }
119
+ .avatar {
120
+ width: 44px; height: 44px; border-radius: 999px; flex: none;
121
+ display: flex; align-items: center; justify-content: center;
122
+ background: var(--chip); font-size: 14px; font-weight: 600;
123
+ }
124
+ .row-main { flex: 1; min-width: 0; }
125
+ .row-top { display: flex; align-items: baseline; gap: 8px; }
126
+ .row .who { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
127
+ .row time { flex: none; font-family: var(--mono); font-size: 11px; color: var(--muted); }
128
+ .row-subject { display: block; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
129
+ .row.unread .who { font-weight: 600; }
130
+ .row.unread .row-subject { color: var(--fg); font-weight: 500; }
131
+ .row.unread time { color: var(--accent-text); }
132
+ .row-tags { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
133
+ .list .empty { border-top: 1px solid var(--line); }
134
+
135
+ /* Thread */
136
+ .thread {
137
+ position: relative; height: 100dvh;
138
+ display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
139
+ background: var(--soft);
140
+ }
141
+ .thread > :not(.context-panel, .context-backdrop) { grid-column: 1; }
142
+ .thread-head {
143
+ display: flex; align-items: center; gap: 4px; padding: 8px 6px;
144
+ background: var(--bg); border-bottom: 1px solid var(--line);
145
+ }
146
+ .icon-btn {
147
+ width: 44px; height: 44px; padding: 0; flex: none; border: none; border-radius: 999px;
148
+ display: inline-flex; align-items: center; justify-content: center; background: none; color: var(--fg);
149
+ }
150
+ .icon-btn:hover { background: var(--soft); border: none; }
151
+ .thread-head form { margin: 0; }
152
+ .thread-title {
153
+ flex: 1; min-width: 0; height: auto; padding: 4px 6px; border: none; border-radius: 12px;
154
+ display: flex; flex-direction: column; align-items: flex-start; text-align: left; background: none; font: inherit; color: inherit;
155
+ }
156
+ button.thread-title:hover { background: var(--soft); border: none; }
157
+ .thread-subject {
158
+ font-size: 15px; font-weight: 600; line-height: 1.25;
159
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
160
+ }
161
+ .thread-meta { max-width: 100%; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
162
+ .context-btn { display: none; }
163
+
164
+ .messages { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px 20px; }
165
+ .day {
166
+ align-self: center; padding: 4px 10px; border-radius: 999px; background: var(--chip);
167
+ font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
168
+ }
169
+ .msg { max-width: 86%; padding: 12px 14px 8px; border-radius: 18px; font-size: 14.5px; }
170
+ .msg.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
171
+ .msg.mine { align-self: flex-end; background: var(--mine); border: 1px solid var(--mine-line); border-bottom-right-radius: 6px; }
172
+ .msg .body { margin: 0; }
173
+ .msg > .meta { margin-bottom: 6px; }
174
+ .msg-from { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
175
+ .msg-time { display: block; text-align: right; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
176
+
177
+ /* A draft in a thread sits on our side as a dashed bubble */
178
+ .messages .card {
179
+ align-self: flex-end; max-width: 86%; padding: 12px 14px;
180
+ background: var(--surface); border: 1.5px dashed var(--accent); border-radius: 18px; border-bottom-right-radius: 6px;
181
+ }
182
+ .messages .card.editing { width: 100%; max-width: 100%; }
183
+ .messages .card.pending, .messages .card.notice { border-style: solid; border-color: var(--line); }
184
+ .messages .card .mailbox, .messages .draft-head .subject { display: none; }
185
+ .messages .card .body { margin-top: 10px; }
186
+ .messages .card .actions { justify-content: flex-end; margin-top: 12px; }
187
+
188
+ .composer {
189
+ display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px;
190
+ padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
191
+ background: var(--bg); border-top: 1px solid var(--line);
192
+ }
193
+ .composer textarea {
194
+ flex: 1; min-width: 0; min-height: 44px; max-height: 40dvh; margin: 0; padding: 11px 16px;
195
+ field-sizing: content; resize: none; border: 1px solid var(--line); border-radius: 22px; background: var(--surface);
196
+ }
197
+ .composer textarea:focus { border-color: var(--focus); }
198
+ .composer .send { width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
199
+ .reply-all { flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 2px 8px; font-family: var(--mono); font-size: .72rem; color: var(--muted); cursor: pointer; }
200
+ .reply-all input { accent-color: var(--accent); }
201
+
202
+ /* Context: a side panel on a wide screen, a bottom sheet on a phone */
203
+ .context-panel { display: none; background: var(--bg); }
204
+ .context-head { display: flex; align-items: center; height: 60px; padding: 0 8px 0 16px; }
205
+ .context-head h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; }
206
+ .context-body { overflow-y: auto; padding: 0 16px 16px; }
207
+ .context-body section { padding: 14px 0; border-top: 1px solid var(--line); }
208
+ .context-backdrop { display: none; }
209
+ body.context-open .context-panel { display: flex; flex-direction: column; }
210
+ @media (max-width: 899px) {
211
+ body.context-open .context-backdrop { display: block; position: fixed; inset: 0; z-index: 20; background: var(--backdrop); }
212
+ body.context-open .context-panel {
213
+ position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; height: 70dvh;
214
+ border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
215
+ padding-bottom: env(safe-area-inset-bottom); animation: rise .2s ease-out;
216
+ }
217
+ .context-panel::before {
218
+ content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
219
+ border-radius: 999px; background: var(--line);
220
+ }
221
+ }
222
+ @media (min-width: 900px) {
223
+ .thread { height: 100dvh; }
224
+ .msg, .messages .card { max-width: 68%; }
225
+ .messages { padding: 20px 32px 28px; }
226
+ .thread-head { padding: 12px 20px 12px 12px; gap: 8px; }
227
+ .context-btn { display: inline-flex; align-items: center; }
228
+ body.context-open .context-btn { background: var(--chip); }
229
+ body.context-open .thread { grid-template-columns: minmax(0, 1fr) 360px; }
230
+ body.context-open .context-panel { grid-column: 2; grid-row: 1 / -1; border-left: 1px solid var(--line); min-height: 0; }
231
+ .composer { padding: 0 24px 20px; background: none; border: none; }
232
+ }
233
+ @keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
234
+
235
+ /* Context rows, shared by the panel and the folded block on a draft */
236
+ .context .who, .context-body .who { font-family: var(--mono); font-size: .75rem; color: var(--fg); overflow-wrap: anywhere; }
237
+ .context dl, .context-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0 0; font-family: var(--mono); font-size: .75rem; }
238
+ .context dt, .context-body dt { color: var(--muted); }
239
+ .context dd, .context-body dd { margin: 0; overflow-wrap: anywhere; }
240
+ .context p, .context-body p { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--soft); white-space: pre-wrap; font-size: .8125rem; color: var(--muted); }
241
+ .context summary { margin-top: 14px; }
242
+ .context section { margin-top: 12px; padding-left: 14px; border-left: 1px solid var(--line); }
243
+
244
+ /* Sheets: New mail rises from the bottom on a phone and centers on a wide screen */
245
+ dialog.sheet {
246
+ margin: auto 0 0; width: 100%; max-width: 100%; height: 70dvh; max-height: 70dvh; padding: 0;
247
+ border: none; border-radius: 22px 22px 0 0; background: var(--bg); color: var(--fg);
248
+ box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
249
+ }
250
+ dialog.sheet[open] { animation: rise .2s ease-out; }
251
+ dialog.sheet::backdrop { background: var(--backdrop); }
252
+ dialog.sheet form { position: relative; height: 100%; display: flex; flex-direction: column; }
253
+ .grabber { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 9px; flex: none; }
254
+ .sheet-close { position: absolute; top: 8px; right: 8px; color: var(--muted); z-index: 1; }
255
+ dialog.sheet .field { padding: 0 16px; }
256
+ dialog.sheet .field.compact { padding-right: 60px; }
257
+ dialog.sheet .field output { font-family: var(--mono); font-size: .8rem; padding: 10px 0; }
258
+ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; resize: none; }
259
+ .sheet-actions {
260
+ display: flex; justify-content: flex-end; gap: 8px;
261
+ padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
262
+ }
263
+ .sheet-actions button { height: 44px; display: inline-flex; align-items: center; gap: 8px; }
264
+ @media (min-width: 900px) {
265
+ dialog.sheet { margin: auto; width: 640px; height: min(640px, 80dvh); border-radius: 18px; }
266
+ dialog.sheet[open] { animation: none; }
267
+ .grabber { visibility: hidden; }
268
+ }
45
269
 
46
270
  /* Meta and labels */
47
271
  .meta {
@@ -53,34 +277,28 @@ header form { margin: 0; }
53
277
  font-family: var(--mono); font-size: .66rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
54
278
  padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg);
55
279
  }
56
- .badge.draft { border-color: var(--accent); color: var(--accent); }
57
- .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
280
+ .badge.draft { border-color: var(--accent); color: var(--accent-text); }
281
+ .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: auto; }
58
282
 
59
- /* Items */
283
+ /* Cards: drafts for review and devices */
60
284
  .card { border-top: 1px solid var(--line); padding: 24px 0; scroll-margin-top: 64px; }
61
- .card > .meta + .meta { margin-top: 6px; }
285
+ .card > .meta + .meta, .draft-head { margin-top: 8px; }
62
286
  .subject { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.02em; margin: 10px 0 4px; }
63
- .note { border-left: 2px solid var(--accent); padding: 2px 0 2px 14px; margin: 14px 0; white-space: pre-wrap; }
64
- .context summary { margin-top: 14px; }
65
- .context section { margin-top: 12px; padding-left: 14px; border-left: 1px solid var(--line); }
66
- .context .who { font-family: var(--mono); font-size: .75rem; color: var(--fg); overflow-wrap: anywhere; }
67
- .context dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 8px 0 0; font-family: var(--mono); font-size: .75rem; }
68
- .context dt { color: var(--muted); }
69
- .context dd { margin: 0; overflow-wrap: anywhere; }
70
- .context p { margin: 8px 0 0; white-space: pre-wrap; font-size: .8125rem; color: var(--muted); }
287
+ .note { background: var(--soft); border-radius: 10px; padding: 6px 10px; margin: 12px 0; white-space: pre-wrap; font-size: .8125rem; color: var(--muted); }
288
+ .messages .note { background: var(--chip); }
71
289
  .body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; font: inherit; }
72
- .images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 16px; }
73
- .images a { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--soft); }
290
+ .images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
291
+ .images a { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--soft); }
74
292
  .images img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
75
293
  .images a:hover img { opacity: .8; }
76
- .files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
294
+ .files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
77
295
  .file {
78
296
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
79
297
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
80
- font-family: var(--mono); font-size: .72rem; transition: border-color .15s;
298
+ font-family: var(--mono); font-size: .72rem; white-space: nowrap; transition: border-color .15s;
81
299
  }
82
300
  .file:hover { border-color: var(--focus); }
83
- .file span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
301
+ .file span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
84
302
  .file .size { color: var(--muted); flex: none; }
85
303
  .draft-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
86
304
  .draft-files .warn { flex-basis: 100%; margin: 0; color: var(--danger); font-family: var(--mono); font-size: .72rem; }
@@ -93,25 +311,20 @@ header form { margin: 0; }
93
311
  align-items: center; justify-content: center;
94
312
  border: 1px dashed var(--accent); border-radius: 8px;
95
313
  background: color-mix(in srgb, var(--bg) 88%, transparent);
96
- font-family: var(--mono); font-size: .8rem; color: var(--accent); pointer-events: none;
314
+ font-family: var(--mono); font-size: .8rem; color: var(--accent-text); pointer-events: none;
97
315
  }
98
316
  [data-drop].dragging .drop-hint { display: flex; }
99
317
  .notice { color: var(--muted); font-family: var(--mono); font-size: .8rem; }
100
- .thread-head { margin-bottom: 28px; }
101
- .domain { font-family: var(--mono); font-size: .72rem; letter-spacing: .02em; color: var(--muted); margin-bottom: 10px; }
102
318
  .pending { position: relative; }
103
319
  .pending-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: .9rem; }
104
320
  .pending-row span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
105
321
  .pending-row strong { color: var(--fg); font-weight: 500; }
106
322
  .countdown { position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--accent); transform-origin: left; animation: countdown linear forwards; }
323
+ .messages .countdown { left: 14px; right: 14px; width: auto; top: auto; bottom: 6px; }
107
324
  @keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
108
325
  .conflict { border-top: 2px solid var(--danger); }
109
326
  .conflict .warn { color: var(--danger); font-weight: 600; margin: 14px 0 4px; }
110
327
 
111
- .thread-row { display: block; transition: opacity .15s; }
112
- .thread-row:hover { opacity: .65; }
113
- .thread-row .subject { margin: 8px 0 2px; }
114
-
115
328
  details summary {
116
329
  cursor: pointer; list-style: none; margin-top: 18px;
117
330
  font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
@@ -127,11 +340,11 @@ button {
127
340
  font: inherit; font-size: .875rem; font-weight: 500;
128
341
  height: 36px; padding: 0 16px; border-radius: 999px;
129
342
  border: 1px solid var(--line); background: transparent; color: var(--fg);
130
- cursor: pointer; transition: border-color .15s, opacity .15s;
343
+ cursor: pointer; transition: border-color .15s, opacity .15s, background-color .15s;
131
344
  }
132
345
  button:hover { border-color: var(--focus); }
133
- button.primary { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-border); }
134
- button.primary:hover { border-color: var(--focus); opacity: .9; }
346
+ button.primary { background: var(--primary-bg); color: var(--primary-fg); border-color: var(--primary-bg); }
347
+ button.primary:hover { opacity: .9; }
135
348
  button.danger { color: var(--danger); border-color: transparent; }
136
349
  button.danger:hover { border-color: var(--danger); }
137
350
  button.link { height: auto; padding: 0; border: none; color: var(--muted); }
@@ -141,9 +354,10 @@ button.link:hover { color: var(--fg); }
141
354
  select {
142
355
  appearance: none; -webkit-appearance: none;
143
356
  font: inherit; font-size: .8rem; color: var(--fg); cursor: pointer;
144
- height: 32px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 999px;
357
+ height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 999px;
145
358
  background: transparent;
146
359
  }
360
+ select option { background: var(--bg); color: var(--fg); }
147
361
  .select { position: relative; display: inline-flex; color: var(--fg); }
148
362
  .select::after {
149
363
  content: ""; position: absolute; right: 13px; top: 50%; pointer-events: none;
@@ -153,27 +367,26 @@ select {
153
367
  select:hover, select:focus { border-color: var(--focus); outline: none; }
154
368
 
155
369
  /* Editor */
156
- .field { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
370
+ .field { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
157
371
  .field label {
158
372
  flex: 0 0 64px;
159
373
  font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
160
374
  }
161
- .field input { flex: 1; min-width: 0; border: none; background: none; padding: 12px 0; font: inherit; color: var(--fg); outline: none; }
375
+ .field input { flex: 1; min-width: 0; border: none; background: none; padding: 11px 0; font: inherit; color: var(--fg); outline: none; }
162
376
  .field:focus-within { border-bottom-color: var(--focus); }
163
377
  .field .link { font-family: var(--mono); font-size: .72rem; }
164
378
  textarea {
165
379
  display: block; width: 100%; min-height: 16rem; margin-top: 16px; padding: 0; resize: vertical;
166
380
  border: none; background: none; font: inherit; color: var(--fg); outline: none;
167
381
  }
382
+ .messages .editing textarea { min-height: 10rem; }
168
383
 
169
- /* Inbox filters */
170
- .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 8px; }
171
- .tabs { display: flex; gap: 16px; }
172
- .tabs a { color: var(--muted); font-weight: 500; padding: 4px 0; border-bottom: 1px solid transparent; }
173
- .tabs a:hover { color: var(--fg); }
174
- .tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--focus); }
384
+ /* Settings */
385
+ .setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
386
+ .setting label { font-weight: 500; }
387
+ .setting .danger { padding: 0; }
175
388
 
176
389
  /* States */
177
- .centered { max-width: 360px; margin: 20vh auto 0; text-align: center; }
390
+ .centered { max-width: 360px; margin: 20vh auto 0; padding: 0 16px; text-align: center; }
178
391
  .centered h1 { font-size: 1.75rem; }
179
- .empty { color: var(--muted); font-family: var(--mono); font-size: .8rem; border-top: 1px solid var(--line); padding: 48px 0; text-align: center; }
392
+ .empty { color: var(--muted); font-family: var(--mono); font-size: .8rem; border-top: 1px solid var(--line); padding: 48px 16px; text-align: center; }