Add /email route as standalone web email client; v1.1.11

Extracts the email inbox from /admin and builds it as a full-viewport
email client at /email with the same admin auth. Key improvements over
the old embedded panel:

- Full-height split-pane layout (sidebar list + detail pane)
- Subject line extracted and shown separately for inbound emails
- Inline reply composer inside the detail pane (no more page-jump)
- Compose-new button for outbound messages to arbitrary addresses
- Search/filter across name, email, subject, and body
- Unread dot indicators with localStorage tracking (marks read on open)
- Keyboard navigation: ↑/↓ or j/k to move, r to reply, e to archive, Esc to close
- Source badges (contact-form / inbound-email) on list items
- Sent history and reply templates accessible via footer drawers
- 30-second polling for new messages
- New POST /api/admin-email/compose server endpoint for outbound sends
- Dashboard card "Open Inbox" now links to /email

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-07-28 09:34:39 -04:00
parent e75a6d0e15
commit 7670b44d27
6 changed files with 1794 additions and 510 deletions
+809
View File
@@ -9253,3 +9253,812 @@
line-height: 1.65;
margin: 0;
}
/* ── Email Client (/email) ──────────────────────────────────────────────── */
.em-app {
display: flex;
flex-direction: column;
height: 100vh;
height: 100dvh;
overflow: hidden;
background: #0a0a08;
color: #f0ead8;
font-family: Georgia, serif;
}
.em-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 0.6rem 1.1rem;
border-bottom: 1px solid rgba(201, 168, 76, 0.22);
background: #0d0d0a;
flex-shrink: 0;
}
.em-header-left {
display: flex;
align-items: center;
gap: 0.75rem;
}
.em-header-brand {
font-family: Georgia, serif;
font-size: 1rem;
font-weight: 600;
color: #e0c070;
letter-spacing: 0.02em;
}
.em-header-actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
.em-body {
display: flex;
flex: 1;
overflow: hidden;
}
/* Sidebar */
.em-sidebar {
width: 300px;
flex-shrink: 0;
display: flex;
flex-direction: column;
border-right: 1px solid rgba(201, 168, 76, 0.18);
overflow: hidden;
background: #0b0b09;
}
.em-search-wrap {
padding: 0.55rem 0.65rem;
border-bottom: 1px solid rgba(201, 168, 76, 0.14);
}
.em-search {
width: 100%;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(201, 168, 76, 0.22);
border-radius: 8px;
padding: 0.45rem 0.65rem;
color: #f0ead8;
font-family: Georgia, serif;
font-size: 0.88rem;
outline: none;
box-sizing: border-box;
}
.em-search:focus {
border-color: rgba(201, 168, 76, 0.5);
}
.em-search::placeholder {
color: rgba(240, 234, 216, 0.35);
}
.em-mailbox-tabs {
display: flex;
border-bottom: 1px solid rgba(201, 168, 76, 0.14);
}
.em-mailbox-tab {
flex: 1;
background: none;
border: none;
padding: 0.55rem 0.5rem;
color: rgba(240, 234, 216, 0.6);
font-family: Georgia, serif;
font-size: 0.85rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 0.4rem;
border-bottom: 2px solid transparent;
transition: color 0.15s, border-color 0.15s;
}
.em-mailbox-tab--active {
color: #e0c070;
border-bottom-color: #e0c070;
}
.em-tab-badge {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 1.3rem;
height: 1.3rem;
padding: 0 0.3rem;
border-radius: 999px;
font-size: 0.72rem;
font-family: system-ui, sans-serif;
background: rgba(201, 168, 76, 0.18);
color: rgba(240, 234, 216, 0.7);
}
.em-tab-badge--unread {
background: rgba(201, 168, 76, 0.35);
color: #e0c070;
}
/* Message list */
.em-list {
flex: 1;
overflow-y: auto;
padding: 0.4rem 0.35rem;
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.em-list-empty {
padding: 1.25rem 0.75rem;
color: rgba(240, 234, 216, 0.45);
font-size: 0.88rem;
text-align: center;
margin: 0;
}
.em-list-item {
position: relative;
width: 100%;
text-align: left;
background: rgba(255,255,255,0.018);
border: 1px solid rgba(201, 168, 76, 0.12);
border-radius: 8px;
padding: 0.6rem 0.7rem 0.6rem 1rem;
cursor: pointer;
color: #f0ead8;
transition: border-color 0.12s, background 0.12s;
}
.em-list-item:hover {
background: rgba(255,255,255,0.04);
border-color: rgba(201, 168, 76, 0.25);
}
.em-list-item--active {
background: rgba(201, 168, 76, 0.08);
border-color: rgba(201, 168, 76, 0.45);
}
.em-list-item--unread .em-list-item-name {
color: #e0c070;
}
.em-unread-dot {
position: absolute;
left: 0.32rem;
top: 50%;
transform: translateY(-50%);
width: 5px;
height: 5px;
border-radius: 50%;
background: #c9a84c;
}
.em-list-item-head {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 0.4rem;
margin-bottom: 0.18rem;
}
.em-list-item-name {
font-size: 0.88rem;
font-weight: 600;
color: rgba(240,234,216,0.9);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.em-list-item-date {
font-size: 0.74rem;
color: rgba(240, 234, 216, 0.4);
white-space: nowrap;
flex-shrink: 0;
font-family: system-ui, sans-serif;
}
.em-list-item-subject {
font-size: 0.83rem;
color: rgba(240, 234, 216, 0.8);
margin-bottom: 0.14rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.em-list-item-preview {
font-size: 0.78rem;
color: rgba(240, 234, 216, 0.45);
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.em-source-badge {
display: inline-block;
font-size: 0.68rem;
font-family: system-ui, sans-serif;
padding: 0.12rem 0.4rem;
border-radius: 4px;
margin-top: 0.3rem;
letter-spacing: 0.04em;
}
.em-source-badge--inbound {
background: rgba(3, 105, 161, 0.25);
color: #7dd3fc;
}
.em-source-badge--contact-form {
background: rgba(22, 101, 52, 0.25);
color: #86efac;
}
.em-source-badge--download {
background: rgba(109, 40, 217, 0.2);
color: #c4b5fd;
}
.em-source-badge--subscribed {
background: rgba(201, 168, 76, 0.15);
color: #e0c070;
}
/* Detail pane */
.em-detail {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
min-width: 0;
}
.em-empty-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.5rem;
color: rgba(240, 234, 216, 0.35);
}
.em-empty-icon {
font-size: 2.5rem;
opacity: 0.5;
}
.em-empty-state p {
margin: 0;
font-size: 0.95rem;
}
.em-empty-hint {
font-size: 0.78rem !important;
font-family: system-ui, sans-serif;
opacity: 0.6;
}
.em-detail-header {
padding: 0.9rem 1.15rem 0.75rem;
border-bottom: 1px solid rgba(201, 168, 76, 0.16);
flex-shrink: 0;
background: #0d0d0a;
}
.em-detail-meta-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 1rem;
margin-bottom: 0.55rem;
}
.em-detail-from {
display: flex;
align-items: center;
gap: 0.65rem;
}
.em-detail-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: rgba(201, 168, 76, 0.22);
color: #e0c070;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.95rem;
font-weight: 700;
flex-shrink: 0;
}
.em-detail-from-name {
font-weight: 600;
font-size: 0.95rem;
color: #f0ead8;
}
.em-detail-from-email {
font-size: 0.8rem;
color: rgba(240, 234, 216, 0.5);
font-family: system-ui, sans-serif;
}
.em-detail-meta-right {
text-align: right;
flex-shrink: 0;
}
.em-detail-date {
font-size: 0.8rem;
color: rgba(240, 234, 216, 0.5);
font-family: system-ui, sans-serif;
}
.em-detail-to {
font-size: 0.75rem;
color: rgba(240, 234, 216, 0.4);
font-family: system-ui, sans-serif;
margin-top: 0.2rem;
}
.em-detail-subject-row {
display: flex;
align-items: center;
gap: 0.65rem;
flex-wrap: wrap;
}
.em-detail-subject {
margin: 0;
font-size: 1.05rem;
font-weight: 600;
color: #f0ead8;
}
.em-detail-badges {
display: flex;
gap: 0.35rem;
flex-wrap: wrap;
}
.em-detail-body {
flex: 1;
overflow-y: auto;
padding: 1rem 1.15rem;
}
.em-detail-iframe {
width: 100%;
border: none;
background: #fff;
border-radius: 6px;
display: block;
min-height: 200px;
}
.em-detail-plain {
margin: 0;
white-space: pre-wrap;
font-family: Georgia, serif;
font-size: 0.93rem;
line-height: 1.7;
color: rgba(240, 234, 216, 0.85);
}
.em-detail-footer {
padding: 0.65rem 1.15rem;
border-top: 1px solid rgba(201, 168, 76, 0.16);
flex-shrink: 0;
background: #0d0d0a;
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
.em-detail-actions {
display: flex;
gap: 0.4rem;
}
/* Reply / Compose */
.em-reply-composer {
border-top: 1px solid rgba(201, 168, 76, 0.25);
background: #0d0d0a;
flex-shrink: 0;
max-height: 55vh;
overflow-y: auto;
}
.em-compose-new {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
}
.em-compose-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.6rem 1.1rem 0.4rem;
border-bottom: 1px solid rgba(201, 168, 76, 0.14);
}
.em-compose-header-label {
font-size: 0.9rem;
color: #e0c070;
font-weight: 600;
}
.em-compose-close {
background: none;
border: none;
color: rgba(240, 234, 216, 0.5);
font-size: 1.3rem;
cursor: pointer;
padding: 0 0.25rem;
line-height: 1;
}
.em-compose-close:hover {
color: #f0ead8;
}
.em-compose-fields {
padding: 0.7rem 1.1rem 0.9rem;
display: flex;
flex-direction: column;
gap: 0.45rem;
}
.em-compose-row {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.em-compose-row--inline {
flex-wrap: nowrap;
}
.em-compose-label {
font-size: 0.8rem;
color: rgba(240, 234, 216, 0.5);
white-space: nowrap;
min-width: 48px;
font-family: system-ui, sans-serif;
}
.em-compose-input {
flex: 1;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(201, 168, 76, 0.2);
border-radius: 6px;
padding: 0.38rem 0.6rem;
color: #f0ead8;
font-family: Georgia, serif;
font-size: 0.88rem;
outline: none;
min-width: 0;
box-sizing: border-box;
}
.em-compose-input:focus {
border-color: rgba(201, 168, 76, 0.45);
}
.em-compose-select {
flex: 1;
background: #14130f;
border: 1px solid rgba(201, 168, 76, 0.2);
border-radius: 6px;
padding: 0.38rem 0.55rem;
color: #f0ead8;
font-family: Georgia, serif;
font-size: 0.85rem;
outline: none;
min-width: 0;
}
.em-compose-body {
width: 100%;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(201, 168, 76, 0.2);
border-radius: 8px;
padding: 0.6rem 0.75rem;
color: #f0ead8;
font-family: Georgia, serif;
font-size: 0.9rem;
line-height: 1.65;
resize: vertical;
outline: none;
box-sizing: border-box;
margin-top: 0.2rem;
}
.em-compose-body:focus {
border-color: rgba(201, 168, 76, 0.45);
}
.em-compose-signature {
font-size: 0.78rem;
color: rgba(240, 234, 216, 0.35);
font-style: italic;
padding-left: 0.5rem;
border-left: 2px solid rgba(201, 168, 76, 0.2);
display: flex;
gap: 0.6rem;
align-items: center;
}
.em-compose-signature-note {
font-size: 0.72rem;
font-style: normal;
font-family: system-ui, sans-serif;
opacity: 0.65;
}
.em-compose-actions {
display: flex;
gap: 0.4rem;
align-items: center;
flex-wrap: wrap;
margin-top: 0.2rem;
}
/* Buttons */
.em-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.3rem;
font-family: Georgia, serif;
font-size: 0.85rem;
padding: 0.42rem 0.9rem;
border-radius: 7px;
border: 1px solid transparent;
cursor: pointer;
text-decoration: none;
white-space: nowrap;
transition: opacity 0.12s;
}
.em-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.em-btn--primary {
background: #c9a84c;
color: #0a0a08;
font-weight: 700;
border-color: #e0c070;
}
.em-btn--primary:hover:not(:disabled) { opacity: 0.88; }
.em-btn--secondary {
background: rgba(201, 168, 76, 0.12);
color: #e0c070;
border-color: rgba(201, 168, 76, 0.3);
}
.em-btn--secondary:hover { background: rgba(201, 168, 76, 0.2); }
.em-btn--ghost {
background: rgba(255,255,255,0.06);
color: rgba(240, 234, 216, 0.7);
border-color: rgba(255,255,255,0.1);
}
.em-btn--ghost:hover { background: rgba(255,255,255,0.1); color: #f0ead8; }
.em-btn--danger {
background: rgba(220, 38, 38, 0.15);
color: #fca5a5;
border-color: rgba(220, 38, 38, 0.3);
}
.em-btn--danger:hover { background: rgba(220, 38, 38, 0.25); }
.em-btn--sm {
font-size: 0.78rem;
padding: 0.28rem 0.65rem;
}
/* Badges */
.em-badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.15rem 0.55rem;
border-radius: 999px;
font-size: 0.75rem;
font-family: system-ui, sans-serif;
}
.em-badge--alert {
background: rgba(201, 168, 76, 0.25);
color: #e0c070;
}
/* Status message */
.em-status-msg {
margin: 0;
font-size: 0.82rem;
color: rgba(240, 234, 216, 0.6);
font-family: system-ui, sans-serif;
}
.em-status-msg--inline {
display: inline;
}
/* Drawers */
.em-drawer-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.55);
z-index: 200;
display: flex;
align-items: flex-end;
justify-content: center;
}
.em-drawer {
background: #111009;
border: 1px solid rgba(201, 168, 76, 0.22);
border-radius: 14px 14px 0 0;
width: 100%;
max-width: 640px;
max-height: 70vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
.em-drawer--wide { max-width: 820px; }
.em-drawer-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.8rem 1.1rem;
border-bottom: 1px solid rgba(201, 168, 76, 0.18);
flex-shrink: 0;
}
.em-drawer-header h3 {
margin: 0;
font-size: 1rem;
font-weight: 600;
color: #e0c070;
}
.em-drawer-body {
flex: 1;
overflow-y: auto;
padding: 0.9rem 1.1rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.em-drawer-actions {
display: flex;
gap: 0.5rem;
justify-content: flex-end;
padding-top: 0.5rem;
}
/* Template cards */
.em-template-card {
display: flex;
flex-direction: column;
gap: 0.4rem;
background: rgba(255,255,255,0.03);
border: 1px solid rgba(201, 168, 76, 0.14);
border-radius: 8px;
padding: 0.75rem;
}
/* History */
.em-history-list {
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.em-history-item {
background: rgba(255,255,255,0.03);
border: 1px solid rgba(201, 168, 76, 0.12);
border-radius: 8px;
padding: 0.65rem 0.8rem;
}
.em-history-meta {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
margin-bottom: 0.2rem;
}
.em-history-date {
font-size: 0.77rem;
color: rgba(240, 234, 216, 0.4);
font-family: system-ui, sans-serif;
}
.em-history-flow {
font-size: 0.77rem;
color: rgba(240, 234, 216, 0.45);
font-family: system-ui, sans-serif;
}
.em-history-subject {
font-size: 0.88rem;
font-weight: 600;
color: #f0ead8;
margin-bottom: 0.2rem;
}
.em-history-preview {
font-size: 0.82rem;
color: rgba(240, 234, 216, 0.55);
}
/* Footer toolbar */
.em-footer-toolbar {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.35rem 0.9rem;
border-top: 1px solid rgba(201, 168, 76, 0.14);
background: #0b0b09;
flex-shrink: 0;
flex-wrap: wrap;
}
.em-footer-hint {
margin-left: auto;
font-size: 0.72rem;
font-family: system-ui, sans-serif;
color: rgba(240, 234, 216, 0.28);
}
.em-footer-warn {
font-size: 0.78rem;
font-family: system-ui, sans-serif;
color: #fca5a5;
}
/* Responsive */
@media (max-width: 700px) {
.em-sidebar {
width: 100%;
max-height: 42vh;
border-right: none;
border-bottom: 1px solid rgba(201, 168, 76, 0.18);
}
.em-body {
flex-direction: column;
}
.em-footer-hint { display: none; }
}