Mirror PilotVault's API Server layout and add the superadmin console,
plugin system, runtime PocketBase settings, and user/organization
management. The car domain (cars, service records, parts, sharing) is
carried over unchanged apart from the auth switch.
Layout: main.go -> cmd/server/main.go; module carcontrol/api ->
drivervault/apiserver. internal/api is split by concern (auth, users,
orgs, settings, plugins, status, health, respond).
Auth: replace the server-minted HS256 JWT and the sessions collection
with a PocketBase token proxy. /api/auth/login relays PocketBase's
{token, record}, and every protected request re-resolves that token
against PocketBase, so a role change or deletion takes effect at once
instead of waiting out a token. AUTH_SECRET is obsolete and internal/auth
is gone. Per-device session listing/revocation goes with it: PocketBase
tokens are stateless. Changing a password rotates the user's token key,
which invalidates every token already issued.
Roles: add superadmin alongside user/admin, plus an organizations
collection and users.organization. Admins are scoped to their own
organization; superadmins span all of them. Guards prevent changing your
own role, deleting your own account, an admin touching a superadmin, and
deleting an organization that still has members.
Plugins: new internal/plugins package with one contract over two kinds --
builtin (compiled in) and external (any HTTP service, registered at
runtime with no rebuild). State persists to plugins.json; secrets are
masked on read and preserved when saved back at the mask.
PocketBase settings: /api/admin/pb-config applies a new connection at
runtime and persists it to .env. It deliberately does not require a
working service account, so a wrong or unreachable connection can still
be fixed from the panel.
Panel: rebuilt as the superadmin console -- login gate, status, users,
organizations, PocketBase, plugins, and the endpoint reference.
Clients: update the Web App and Phone App for the PocketBase token shape,
the move of user management to /api/users ({users}/{user} envelopes, with
password resets folded into PATCH), and the removal of sessions. Both now
mirror the server's real guards rather than the old last-admin rule, and
parse PocketBase's field-level error shape.
Config: modern POCKETBASE_*/API_ADDR names with legacy PB_*/PORT
fallbacks, so existing .env files keep working. Also fixes /api/status
probing the Web App on 8090 instead of DriverVault's 5173.
Run scripts/setup-pocketbase.mjs to add the organizations collection and
grow users.role; every client must log in once more.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
321 lines
8.2 KiB
CSS
321 lines
8.2 KiB
CSS
@import "tailwindcss";
|
|
|
|
/* DriverVault webfonts — Archivo (UI + display, italic 800 is the brand voice) + DM Mono (data/labels). */
|
|
@import url("https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;0,700;0,800;1,700;1,800&family=DM+Mono:ital,wght@0,400;0,500&display=swap");
|
|
|
|
/* Tailwind v4 defaults dark: to prefers-color-scheme; switch to a class strategy
|
|
so theme.js can toggle `.dark` on <html>. */
|
|
@custom-variant dark (&:where(.dark, .dark *));
|
|
|
|
/* ============================================================================
|
|
DriverVault design tokens (subset used by the API panel). Raw ramps + semantic
|
|
aliases; html.dark re-points the aliases so utilities flip for free.
|
|
========================================================================== */
|
|
:root {
|
|
color-scheme: light;
|
|
|
|
--brand-900: #0b1730;
|
|
--brand-800: #0f1e3d;
|
|
--brand-700: #1e40af;
|
|
--brand-600: #2563eb;
|
|
--brand-500: #3b82f6;
|
|
--brand-400: #60a5fa;
|
|
--brand-300: #93c5fd;
|
|
--brand-200: #c7dbfb;
|
|
--brand-100: #e8f0fd;
|
|
|
|
--ink-900: #0f1e3d;
|
|
--ink-700: #28374f;
|
|
--ink-600: #3e4e68;
|
|
--ink-500: #5c6b85;
|
|
--ink-400: #7a8aa6;
|
|
--ink-300: #b4bece;
|
|
--ink-200: #d6deea;
|
|
--ink-100: #e4e9f2;
|
|
--ink-50: #eef2f8;
|
|
--ink-25: #f7f9fc;
|
|
--white: #ffffff;
|
|
|
|
--success-600: #1f8a5b;
|
|
--success-100: #e1f3ea;
|
|
--warning-600: #d9822b;
|
|
--warning-100: #fbeddd;
|
|
--danger-600: #dc2a45;
|
|
--danger-100: #fbe3e7;
|
|
--info-600: #2563eb;
|
|
--info-100: #e8f0fd;
|
|
|
|
--surface-page: var(--ink-25);
|
|
--surface-card: var(--white);
|
|
--surface-sunken: var(--ink-50);
|
|
|
|
--border-subtle: var(--ink-100);
|
|
--border-default: var(--ink-200);
|
|
--border-strong: var(--ink-300);
|
|
|
|
--text-strong: var(--ink-900);
|
|
--text-body: var(--ink-600);
|
|
--text-muted: var(--ink-400);
|
|
--text-brand: var(--brand-700);
|
|
|
|
--accent: var(--brand-600);
|
|
--accent-hover: var(--brand-700);
|
|
--focus-ring: var(--brand-400);
|
|
|
|
--shadow-xs: 0 1px 2px rgba(15, 30, 61, 0.06);
|
|
--shadow-sm: 0 1px 2px rgba(15, 30, 61, 0.04), 0 2px 6px rgba(15, 30, 61, 0.06);
|
|
--shadow-md: 0 1px 2px rgba(15, 30, 61, 0.04), 0 12px 30px -12px rgba(15, 30, 61, 0.14);
|
|
|
|
--font-display: "Archivo", system-ui, sans-serif;
|
|
--font-sans: "Archivo", system-ui, sans-serif;
|
|
--font-mono: "DM Mono", ui-monospace, "SF Mono", monospace;
|
|
}
|
|
|
|
html.dark {
|
|
color-scheme: dark;
|
|
|
|
--success-100: #12352a;
|
|
--warning-100: #3a2a16;
|
|
--danger-100: #3a1620;
|
|
--info-100: #122a4d;
|
|
|
|
--surface-page: #0b1730;
|
|
--surface-card: #13233f;
|
|
--surface-sunken: #0f1e38;
|
|
|
|
--border-subtle: #21324f;
|
|
--border-default: #2c3f5e;
|
|
--border-strong: #3c5173;
|
|
|
|
--text-strong: #f2f6fc;
|
|
--text-body: #b7c4d9;
|
|
--text-muted: #7c8ca8;
|
|
--text-brand: #93c5fd;
|
|
|
|
--accent: #3b82f6;
|
|
--accent-hover: #60a5fa;
|
|
--focus-ring: #60a5fa;
|
|
|
|
--success-600: #35b27a;
|
|
--warning-600: #e0a03a;
|
|
--danger-600: #e85c74;
|
|
|
|
--shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
|
|
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.4);
|
|
--shadow-md: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 30px -12px rgba(0, 0, 0, 0.55);
|
|
}
|
|
|
|
/* ============================================================================
|
|
Map tokens into Tailwind's theme so semantic utilities exist and flip in dark
|
|
mode without a dark: variant. Utility names mirror the DriverVault web app.
|
|
========================================================================== */
|
|
@theme inline {
|
|
--font-sans: var(--font-sans);
|
|
--font-mono: var(--font-mono);
|
|
|
|
--color-brand-300: var(--brand-300);
|
|
--color-brand-400: var(--brand-400);
|
|
--color-brand-500: var(--brand-500);
|
|
--color-brand-600: var(--brand-600);
|
|
--color-brand-700: var(--brand-700);
|
|
--color-brand-900: var(--brand-900);
|
|
|
|
--color-page: var(--surface-page);
|
|
--color-card: var(--surface-card);
|
|
--color-sunken: var(--surface-sunken);
|
|
|
|
--color-strong: var(--text-strong);
|
|
--color-body: var(--text-body);
|
|
--color-muted: var(--text-muted);
|
|
--color-brandtext: var(--text-brand);
|
|
|
|
--color-subtle: var(--border-subtle);
|
|
--color-default: var(--border-default);
|
|
--color-strongline: var(--border-strong);
|
|
|
|
--color-accent: var(--accent);
|
|
--color-accent-hover: var(--accent-hover);
|
|
|
|
--color-success: var(--success-600);
|
|
--color-success-soft: var(--success-100);
|
|
--color-warning: var(--warning-600);
|
|
--color-warning-soft: var(--warning-100);
|
|
--color-danger: var(--danger-600);
|
|
--color-danger-soft: var(--danger-100);
|
|
--color-info: var(--info-600);
|
|
--color-info-soft: var(--info-100);
|
|
|
|
--radius-control: 12px;
|
|
--radius-card: 18px;
|
|
--radius-pill: 999px;
|
|
|
|
--shadow-xs: var(--shadow-xs);
|
|
--shadow-sm: var(--shadow-sm);
|
|
--shadow-card: var(--shadow-md);
|
|
}
|
|
|
|
html,
|
|
body,
|
|
#app {
|
|
height: 100%;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
font-family: var(--font-sans);
|
|
background: var(--surface-page);
|
|
color: var(--text-body);
|
|
-webkit-font-smoothing: antialiased;
|
|
}
|
|
|
|
/* Small mono eyebrow labels (uppercase, tracked out). */
|
|
.eyebrow {
|
|
font-family: var(--font-mono);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.16em;
|
|
font-size: 11px;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
/* Monospaced data (methods, paths, latencies) so columns align. */
|
|
.data {
|
|
font-family: var(--font-mono);
|
|
letter-spacing: 0.02em;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
|
|
/* Secondary button (theme toggle). */
|
|
.dh-btn-ghost {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
height: 34px;
|
|
padding: 0 12px;
|
|
border-radius: var(--radius-control);
|
|
border: 1px solid var(--border-default);
|
|
background: var(--surface-card);
|
|
color: var(--text-strong);
|
|
font-family: var(--font-sans);
|
|
font-weight: 600;
|
|
font-size: 0.8125rem;
|
|
cursor: pointer;
|
|
transition: background-color 140ms ease, border-color 140ms ease;
|
|
}
|
|
.dh-btn-ghost:hover {
|
|
background: var(--surface-sunken);
|
|
border-color: var(--border-strong);
|
|
}
|
|
.dh-btn-ghost:focus-visible {
|
|
outline: none;
|
|
box-shadow: 0 0 0 3px var(--focus-ring);
|
|
}
|
|
|
|
/* Primary button (save, sign in, create). */
|
|
.dh-btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
height: 34px;
|
|
padding: 0 14px;
|
|
border-radius: var(--radius-control);
|
|
border: 1px solid transparent;
|
|
background: var(--accent);
|
|
color: #fff;
|
|
font-family: var(--font-sans);
|
|
font-weight: 600;
|
|
font-size: 0.8125rem;
|
|
cursor: pointer;
|
|
transition: background-color 140ms ease;
|
|
}
|
|
.dh-btn:hover:not(:disabled) {
|
|
background: var(--accent-hover);
|
|
}
|
|
.dh-btn:focus-visible {
|
|
outline: none;
|
|
box-shadow: 0 0 0 3px var(--focus-ring);
|
|
}
|
|
.dh-btn:disabled,
|
|
.dh-btn-ghost:disabled,
|
|
.dh-btn-danger:disabled {
|
|
opacity: 0.55;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Destructive button (delete a user, an org, an external plugin). */
|
|
.dh-btn-danger {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
height: 30px;
|
|
padding: 0 10px;
|
|
border-radius: var(--radius-control);
|
|
border: 1px solid var(--border-default);
|
|
background: transparent;
|
|
color: var(--danger-600);
|
|
font-family: var(--font-sans);
|
|
font-weight: 600;
|
|
font-size: 0.75rem;
|
|
cursor: pointer;
|
|
transition: background-color 140ms ease, border-color 140ms ease;
|
|
}
|
|
.dh-btn-danger:hover:not(:disabled) {
|
|
background: var(--danger-100);
|
|
border-color: var(--danger-600);
|
|
}
|
|
|
|
/* Form controls. */
|
|
.dh-input,
|
|
.dh-select {
|
|
width: 100%;
|
|
height: 36px;
|
|
padding: 0 10px;
|
|
border-radius: var(--radius-control);
|
|
border: 1px solid var(--border-default);
|
|
background: var(--surface-card);
|
|
color: var(--text-strong);
|
|
font-family: var(--font-sans);
|
|
font-size: 0.8125rem;
|
|
transition: border-color 140ms ease;
|
|
}
|
|
.dh-input::placeholder {
|
|
color: var(--text-muted);
|
|
}
|
|
.dh-input:focus,
|
|
.dh-select:focus {
|
|
outline: none;
|
|
border-color: var(--accent);
|
|
box-shadow: 0 0 0 3px var(--focus-ring);
|
|
}
|
|
.dh-label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-family: var(--font-mono);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.16em;
|
|
font-size: 10px;
|
|
color: var(--text-muted);
|
|
}
|
|
|
|
/* Status pill (health badges, roles, plugin kinds). */
|
|
.dh-pill {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 3px 9px;
|
|
border-radius: var(--radius-pill);
|
|
font-family: var(--font-mono);
|
|
font-size: 11px;
|
|
font-weight: 500;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.dh-card {
|
|
border: 1px solid var(--border-subtle);
|
|
background: var(--surface-card);
|
|
border-radius: var(--radius-card);
|
|
box-shadow: var(--shadow-sm);
|
|
}
|