Productionize WP Suite: auth, security hardening, sync, dashboard, PWA, email

Brings the Work Package Suite from a browser-local prototype to a
multi-tenant, SQL-backed deployment hardened for customer IP.

Auth & access control
- Local username/password login (bcrypt + JWT in an HttpOnly cookie),
  admin-managed users, per-project membership, and project-scoped API access.
- Admin console: change user roles, view the audit trail, manage settings.

Security hardening
- CSP / HSTS / X-Frame-Options / nosniff headers in nginx; Secure cookie via
  X-Forwarded-Proto; CSRF Origin check; attribute-safe output escaping.
- Login lockout, token_version session revocation, stronger password policy,
  fail-closed secret loading, encrypted (AES-256) database backups.

Persistence & schema
- SOPs and Work Packages are now DB-backed and shared across users, written
  through a durable client sync outbox that queues offline edits.
- Alembic migrations applied automatically on container start.

New capabilities
- Phase 2 dashboard (progress, gating, pagination, archive).
- Phase 3 PWA "Field View" with offline caching and auth fallback.
- WP owner assignment with OPTIONAL email notifications, OFF by default and
  toggled from the admin console. SMTP password is read only from the
  SMTP_PASSWORD env var (never stored); emails carry a WP number + deep link,
  never customer IP.

Also: IBM Carbon restyle, Help section, and DEPLOYMENT.md brought up to date.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-15 17:51:15 -07:00
parent dd37f1f551
commit 39b48055ff
48 changed files with 2867 additions and 507 deletions

View File

@@ -1,22 +1,25 @@
:root {
--primary: #2563eb;
--primary-light: #dbeafe;
--success: #16a34a;
--warning: #ea580c;
--danger: #dc2626;
--text: #1f2937;
--text-light: #6b7280;
--text-dim: #9ca3af;
--border: #e5e7eb;
--bg: #f9fafb;
--primary: #0f62fe;
--primary-light: #edf5ff;
--success: #198038;
--warning: #8e6a00;
--warning-bg: #fdf6dd;
--danger: #da1e28;
--text: #161616;
--text-light: #525252;
--text-dim: #8d8d8d;
--border: #e0e0e0;
--border-strong: #8d8d8d;
--bg: #f4f4f4;
--bg-card: #ffffff;
--shadow: 0 1px 3px rgba(0,0,0,0.1);
--shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
--appbar: #161616;
--shadow: none;
--shadow-lg: 0 4px 16px rgba(0,0,0,0.16);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
color: var(--text);
background: var(--bg);
line-height: 1.5;
@@ -28,43 +31,46 @@ body {
min-height: 100vh;
}
/* HEADER */
/* HEADER — dark UI Shell bar */
.header {
background: #ffffff;
color: var(--text);
padding: 1.5rem 2rem;
background: var(--appbar);
color: #fff;
padding: 0 16px;
height: 48px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: var(--shadow);
border-bottom: 1px solid var(--border);
}
.header-left {
flex: 1;
display: flex;
align-items: center;
gap: 1.5rem;
gap: 14px;
min-width: 0;
}
/* Prime logo (white-background wordmark) sits in a white chip on the dark bar */
.logo {
display: flex;
display: inline-flex;
align-items: center;
gap: 0.5rem;
justify-content: center;
background: #fff;
padding: 4px 8px;
border-radius: 4px;
text-decoration: none;
color: var(--text);
font-weight: 700;
font-size: 14px;
transition: opacity 0.2s;
flex-shrink: 0;
}
.logo:hover { opacity: 0.7; }
.logo:hover { opacity: 0.92; }
.logo img { height: 24px; width: auto; display: block; }
.logo-icon {
width: 36px;
height: 36px;
background: var(--primary-light);
border-radius: 6px;
border-radius: 0;
display: flex;
align-items: center;
justify-content: center;
@@ -73,84 +79,90 @@ body {
}
.header-title {
font-size: 24px;
font-weight: 700;
font-size: 15px;
font-weight: 600;
margin-bottom: 0;
color: var(--text);
color: #fff;
white-space: nowrap;
}
.header-subtitle {
font-size: 13px;
color: var(--text-light);
min-height: 20px;
font-size: 12px;
color: #c6c6c6;
min-height: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header-right {
.header-right {
display: flex;
align-items: center;
gap: 1.5rem;
gap: 8px;
}
.header-button {
padding: 0.5rem 1rem;
background: var(--bg);
color: var(--primary);
border: 1px solid var(--border);
border-radius: 6px;
padding: 7px 14px;
background: transparent;
color: #fff;
border: 1px solid #6f6f6f;
border-radius: 0;
cursor: pointer;
font-size: 13px;
font-weight: 600;
transition: all 0.2s;
font-size: 14px;
font-weight: 400;
transition: background 0.15s, border-color 0.15s;
}
.header-button:hover {
background: var(--primary-light);
border-color: var(--primary);
background: #353535;
border-color: #6f6f6f;
}
.step-counter {
background: var(--bg);
border: 1px solid var(--border);
color: var(--text-light);
padding: 0.4rem 0.8rem;
background: transparent;
border: 1px solid #6f6f6f;
color: #c6c6c6;
padding: 4px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
}
/* MAIN NAVIGATION */
/* MAIN NAVIGATION — underline tabs */
.main-nav {
display: flex;
gap: 0.5rem;
padding: 1rem 2rem;
gap: 0;
padding: 0 16px;
background: var(--bg-card);
border-bottom: 1px solid var(--border);
box-shadow: var(--shadow);
}
.nav-tab {
padding: 0.75rem 1.5rem;
background: var(--bg);
border: 2px solid var(--border);
border-radius: 6px;
padding: 13px 18px;
background: none;
border: none;
border-bottom: 3px solid transparent;
border-radius: 0;
cursor: pointer;
font-size: 14px;
font-weight: 600;
font-size: 15px;
font-weight: 400;
color: var(--text-light);
display: flex;
align-items: center;
gap: 0.5rem;
transition: all 0.2s;
transition: background 0.15s, color 0.15s;
}
.nav-tab:hover {
border-color: var(--primary);
color: var(--primary);
background: var(--bg);
color: var(--text);
}
.nav-tab.active {
background: var(--primary);
color: white;
border-color: var(--primary);
background: none;
color: var(--text);
border-bottom-color: var(--primary);
font-weight: 600;
}
.tab-icon { font-size: 16px; }
@@ -186,35 +198,37 @@ body {
}
.step-item {
padding: 0.75rem 1rem;
border-radius: 6px;
background: var(--bg);
border: 2px solid var(--border);
padding: 0.6rem 0.9rem;
border-radius: 0;
background: var(--bg-card);
border: 1px solid var(--border);
color: var(--text-light);
cursor: pointer;
font-size: 12px;
font-weight: 600;
font-weight: 500;
white-space: nowrap;
transition: all 0.2s;
transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.step-item:hover { background: var(--primary-light); border-color: var(--primary); }
.step-item.active { background: var(--primary); color: white; border-color: var(--primary); }
.step-item:hover { background: var(--bg); border-color: var(--border-strong); color: var(--text); }
.step-item.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }
/* STEP CONTENT */
.step-content {
background: var(--bg-card);
padding: 2rem;
border-radius: 8px;
box-shadow: var(--shadow);
border: 1px solid var(--border);
border-radius: 0;
margin-bottom: 2rem;
}
.step { display: none; }
.step h2 {
font-size: 20px;
font-weight: 700;
margin-bottom: 0.5rem;
font-size: 22px;
font-weight: 400;
letter-spacing: -0.01em;
margin-bottom: 0.75rem;
color: var(--text);
}
@@ -223,7 +237,7 @@ body {
color: var(--text-light);
background: var(--primary-light);
padding: 0.75rem 1rem;
border-radius: 6px;
border-radius: 0;
margin-bottom: 1.5rem;
border-left: 4px solid var(--primary);
}
@@ -253,7 +267,7 @@ body {
.field textarea {
padding: 0.75rem;
border: 1px solid var(--border);
border-radius: 6px;
border-radius: 0;
font-size: 14px;
font-family: inherit;
color: var(--text);
@@ -287,7 +301,7 @@ body {
align-items: center;
padding: 1rem;
background: var(--bg);
border-radius: 6px;
border-radius: 0;
border: 1px solid var(--border);
}
@@ -319,7 +333,7 @@ body {
align-items: center;
padding: 0.75rem 1rem;
background: var(--bg);
border-radius: 6px;
border-radius: 0;
margin-bottom: 0.5rem;
border: 1px solid var(--border);
}
@@ -339,31 +353,32 @@ body {
/* BUTTONS */
.add-btn {
padding: 0.75rem 1.25rem;
padding: 0.7rem 1.25rem;
background: var(--primary);
color: white;
border: none;
border-radius: 6px;
border-radius: 0;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
.add-btn:hover { background: #1d4ed8; }
.add-btn:hover { background: var(--cds-hover-primary, #0353e9); }
.nav-btn {
padding: 0.75rem 1.5rem;
background: var(--bg);
border: 2px solid var(--border);
border-radius: 6px;
padding: 0.7rem 1.4rem;
background: var(--bg-card);
border: 1px solid var(--border-strong);
border-radius: 0;
font-size: 14px;
font-weight: 600;
color: var(--text);
cursor: pointer;
transition: all 0.2s;
transition: all 0.15s;
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.nav-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--bg); }
.nav-btn.primary {
background: var(--success);
@@ -371,7 +386,7 @@ body {
border-color: var(--success);
}
.nav-btn.primary:hover { background: #15803d; border-color: #15803d; }
.nav-btn.primary:hover { background: #0e6027; border-color: #0e6027; color: white; }
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }
@@ -382,7 +397,7 @@ body {
justify-content: space-between;
padding: 1.5rem;
background: var(--bg-card);
border-radius: 8px;
border-radius: 0;
box-shadow: var(--shadow);
}
@@ -398,7 +413,7 @@ body {
background: var(--primary-light);
color: var(--primary);
border: 1px solid var(--primary);
border-radius: 6px;
border-radius: 0;
font-size: 13px;
font-weight: 600;
cursor: pointer;
@@ -411,7 +426,7 @@ body {
#sequence-list { display: flex; flex-direction: column; gap: 8px; }
.seq-step {
display: flex; align-items: center; gap: 12px; padding: 11px 14px;
background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
background: var(--bg-card); border: 1px solid var(--border); border-radius: 0;
box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s, opacity .12s;
}
.seq-step:hover { border-color: var(--primary); }
@@ -432,7 +447,7 @@ body {
width: 28px; height: 28px; cursor: pointer; font-weight: 600; flex-shrink: 0;
}
.seq-arrow { text-align: center; color: var(--text-dim); font-size: 13px; line-height: .4; margin: -2px 0; }
.seq-step.gate { border-color: var(--warning); background: #fff7ed; border-style: dashed; }
.seq-step.gate { border-color: var(--warning); background: var(--warning-bg); border-style: dashed; }
.seq-step.gate .seq-label { color: var(--warning); font-weight: 500; }
.seq-gate-badge {
flex-shrink: 0; padding: 3px 9px; border-radius: 20px; background: var(--warning); color: #fff;
@@ -448,7 +463,7 @@ body {
max-width: calc(100vw - 2rem);
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 8px;
border-radius: 0;
box-shadow: var(--shadow-lg);
padding: 1.25rem;
z-index: 1200;
@@ -488,7 +503,7 @@ body {
.modal-content {
background: var(--bg-card);
border-radius: 8px;
border-radius: 0;
padding: 2rem;
max-width: 600px;
max-height: 80vh;
@@ -528,7 +543,7 @@ body {
/* RESPONSIVE */
@media (max-width: 768px) {
.header { flex-direction: column; text-align: center; gap: 1rem; }
.header { height: auto; flex-direction: column; align-items: stretch; text-align: center; gap: 0.75rem; padding: 12px 16px; }
.main-nav { flex-wrap: wrap; }
.content-area { padding: 1rem; }
.step-content { padding: 1rem; }