feat(dashboard): add corpus dashboard at /dashboard/

Full private corpus dashboard for tools.dobetternorge.no users — each SSO
account gets an auto-provisioned CaveauAI tenant (clients row, corpus) on
first visit. Includes upload (file/paste/URL), RAG chat with SSE streaming
and citation chips, document CRUD, FalkorDB graph relations tab, and
improved save-from-tool flow with tag/preview support.

- dashboard/{index,documents,document,upload,chat,settings}.php
- api/dashboard/{corpus-init,documents,upload,ingest-status,chat-stream,
  save-from-tool,graph}.php
- includes/{CorpusProvision,layout_dashboard,layout_dashboard_footer}.php
- assets/css/dashboard.css  assets/js/corpus-save.js (routing upgrade)
- includes/{bootstrap,layout}.php extended for dashboard provisioning

Migration 141 (clients.dbn_sso_uid + import_method enum) applied on chloe.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 17:15:40 +02:00
parent 83fc71414f
commit 06d01a3bce
20 changed files with 2632 additions and 28 deletions
+173
View File
@@ -0,0 +1,173 @@
/* dashboard.css — Norwegian-legal twin of CaveauAI for tools.dobetternorge.no/dashboard/
*
* Pairs with tools.css design tokens (--dbn-paper, --dbn-blue, --dbn-red, --dbn-line).
* Keeps brand: paper + navy + burgundy. Adds gold accent for graph edges.
*/
:root {
--dash-gold: #b88a2c;
--dash-radius: 12px;
--dash-radius-sm: 8px;
--dash-shadow: 0 1px 0 rgba(22, 19, 15, 0.04), 0 12px 32px -22px rgba(0, 32, 91, 0.18);
--dash-row-hover: rgba(0, 32, 91, 0.05);
}
body[data-dashboard-page] {
background: var(--dbn-paper, #f6f2ea);
color: var(--dbn-ink, #16130f);
font-family: "IBM Plex Sans", "Inter", system-ui, sans-serif;
margin: 0;
min-height: 100vh;
}
.dash-shell { max-width: 1320px; margin: 0 auto; padding: 1.25rem clamp(1rem, 4vw, 2.25rem) 4rem; }
/* ── Topbar ───────────────────────────────────────────────────────────── */
.dash-topbar {
display: flex; align-items: center; justify-content: space-between;
padding: 0.75rem 0 1.25rem;
border-bottom: 1px solid var(--dbn-line, rgba(22, 19, 15, 0.16));
}
.dash-brand { display: flex; gap: 0.75rem; align-items: center; text-decoration: none; color: inherit; }
.dash-brand__mark {
width: 38px; height: 38px; border-radius: 10px;
background: var(--dbn-blue, #00205b); color: #fff;
display: grid; place-items: center; font-size: 1.1rem;
}
.dash-brand__text strong { font-family: "Crimson Pro", "Georgia", serif; font-size: 1.15rem; display: block; }
.dash-brand__text small { color: rgba(22, 19, 15, 0.55); font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; }
.dash-topbar__link { color: var(--dbn-blue, #00205b); text-decoration: none; font-size: 0.9rem; }
.dash-topbar__link:hover { text-decoration: underline; }
/* ── Layout (sidebar + main) ──────────────────────────────────────────── */
.dash-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.75rem; padding-top: 1.5rem; }
@media (max-width: 880px) { .dash-layout { grid-template-columns: 1fr; } }
.dash-sidebar { display: flex; flex-direction: column; gap: 0.25rem; }
.dash-sidebar__item {
display: block; padding: 0.7rem 0.85rem; border-radius: var(--dash-radius-sm);
text-decoration: none; color: var(--dbn-ink); transition: background 120ms;
border: 1px solid transparent;
}
.dash-sidebar__item:hover { background: var(--dash-row-hover); }
.dash-sidebar__item.is-active {
background: rgba(186, 12, 47, 0.08);
border-color: rgba(186, 12, 47, 0.18);
}
.dash-sidebar__item strong { display: block; font-size: 0.95rem; font-weight: 600; }
.dash-sidebar__item small { display: block; color: rgba(22, 19, 15, 0.55); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
/* ── Main column ──────────────────────────────────────────────────────── */
.dash-main { min-width: 0; }
.dash-main__head { margin-bottom: 1.5rem; }
.dash-main__head h1 {
font-family: "Crimson Pro", "Georgia", serif;
font-size: clamp(1.6rem, 2.4vw, 2.1rem);
margin: 0 0 0.35rem;
color: var(--dbn-blue, #00205b);
}
.dash-main__lead { color: rgba(22, 19, 15, 0.7); margin: 0; max-width: 64ch; }
/* ── KPI tiles ────────────────────────────────────────────────────────── */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.dash-kpi {
background: #fff; padding: 1rem 1.1rem; border-radius: var(--dash-radius);
border: 1px solid var(--dbn-line);
box-shadow: var(--dash-shadow);
}
.dash-kpi__label { font-size: 0.72rem; color: rgba(22, 19, 15, 0.55); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 0.4rem; }
.dash-kpi__value { font-family: "Crimson Pro", "Georgia", serif; font-size: 1.85rem; font-weight: 600; color: var(--dbn-blue); margin: 0; line-height: 1; }
.dash-kpi__hint { font-size: 0.78rem; color: rgba(22, 19, 15, 0.55); margin: 0.3rem 0 0; }
/* ── Card ────────────────────────────────────────────────────────────── */
.dash-card {
background: #fff; border-radius: var(--dash-radius); border: 1px solid var(--dbn-line);
box-shadow: var(--dash-shadow); padding: 1.25rem 1.4rem; margin-bottom: 1.5rem;
}
.dash-card__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; gap: 1rem; }
.dash-card__head h2 { font-family: "Crimson Pro", serif; font-size: 1.2rem; margin: 0; color: var(--dbn-blue); }
.dash-card__actions { display: flex; gap: 0.5rem; }
/* ── Buttons ─────────────────────────────────────────────────────────── */
.dash-btn {
display: inline-flex; align-items: center; gap: 0.4rem;
padding: 0.55rem 0.95rem; border-radius: var(--dash-radius-sm);
border: 1px solid var(--dbn-line); background: #fff; color: var(--dbn-ink);
font: inherit; cursor: pointer; text-decoration: none;
transition: border-color 120ms, background 120ms;
}
.dash-btn:hover { border-color: var(--dbn-blue); }
.dash-btn--primary { background: var(--dbn-blue); color: #fff; border-color: var(--dbn-blue); }
.dash-btn--primary:hover { background: #001543; }
.dash-btn--danger { background: #fff; color: var(--dbn-red, #ba0c2f); border-color: rgba(186, 12, 47, 0.4); }
.dash-btn--danger:hover { background: rgba(186, 12, 47, 0.07); }
/* ── Documents table ─────────────────────────────────────────────────── */
.dash-doctable { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.dash-doctable th, .dash-doctable td { padding: 0.7rem 0.85rem; text-align: left; border-bottom: 1px solid var(--dbn-line); }
.dash-doctable th { font-weight: 600; color: rgba(22, 19, 15, 0.6); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dash-doctable tbody tr { cursor: pointer; transition: background 100ms; }
.dash-doctable tbody tr:hover { background: var(--dash-row-hover); }
.dash-doctable__title { font-weight: 600; color: var(--dbn-blue); }
.dash-doctable__meta { color: rgba(22, 19, 15, 0.55); font-size: 0.78rem; }
/* ── Status pills ────────────────────────────────────────────────────── */
.dash-status { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
.dash-status--ready { background: rgba(15, 118, 110, 0.12); color: #0f766e; }
.dash-status--pending { background: rgba(184, 138, 44, 0.16); color: #8b6d18; }
.dash-status--processing { background: rgba(0, 32, 91, 0.10); color: var(--dbn-blue); }
.dash-status--error { background: rgba(186, 12, 47, 0.12); color: var(--dbn-red); }
/* ── Filters bar ─────────────────────────────────────────────────────── */
.dash-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-filters input, .dash-filters select {
padding: 0.5rem 0.7rem; border: 1px solid var(--dbn-line); border-radius: var(--dash-radius-sm);
font: inherit; background: #fff;
}
.dash-filters input { min-width: 280px; }
/* ── Empty / loading states ──────────────────────────────────────────── */
.dash-empty { text-align: center; padding: 3rem 1rem; color: rgba(22, 19, 15, 0.55); }
.dash-empty__icon { font-size: 2.5rem; opacity: 0.4; display: block; margin-bottom: 0.5rem; }
.dash-loading { padding: 2rem 1rem; text-align: center; color: rgba(22, 19, 15, 0.5); font-style: italic; }
.dash-error { padding: 1rem; border-radius: var(--dash-radius-sm); background: rgba(186, 12, 47, 0.07); color: var(--dbn-red); border: 1px solid rgba(186, 12, 47, 0.2); }
/* ── Document view ───────────────────────────────────────────────────── */
.dash-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1rem; }
.dash-doc-head h2 { font-family: "Crimson Pro", serif; font-size: 1.5rem; margin: 0; color: var(--dbn-blue); }
.dash-doc-meta { color: rgba(22, 19, 15, 0.55); font-size: 0.85rem; margin: 0.3rem 0 0; }
.dash-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--dbn-line); margin-bottom: 1rem; }
.dash-tab {
padding: 0.6rem 1rem; background: none; border: none; cursor: pointer;
color: rgba(22, 19, 15, 0.6); border-bottom: 2px solid transparent; margin-bottom: -1px;
font: inherit;
}
.dash-tab:hover { color: var(--dbn-blue); }
.dash-tab.is-active { color: var(--dbn-blue); border-bottom-color: var(--dbn-red); }
.dash-tab-panel { display: none; }
.dash-tab-panel.is-active { display: block; }
.dash-preview {
background: #fcfaf5; padding: 1.25rem 1.5rem; border-radius: var(--dash-radius-sm);
font-family: "Crimson Pro", serif; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word;
max-height: 60vh; overflow-y: auto;
}
.dash-chunk {
background: #fff; padding: 0.85rem 1rem; border-radius: var(--dash-radius-sm);
border: 1px solid var(--dbn-line); margin-bottom: 0.75rem; font-size: 0.9rem;
}
.dash-chunk__section { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(22, 19, 15, 0.5); margin: 0 0 0.4rem; }
/* ── Related (graph edges) ───────────────────────────────────────────── */
.dash-related { display: flex; flex-direction: column; gap: 0.5rem; }
.dash-related__edge {
display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.85rem;
border-radius: var(--dash-radius-sm); border: 1px solid var(--dbn-line);
border-left: 3px solid var(--dash-gold);
}
.dash-related__rel { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dash-gold); font-weight: 600; min-width: 90px; }
.dash-related__title { flex: 1; color: var(--dbn-blue); font-weight: 500; }
/* ── Pagination ──────────────────────────────────────────────────────── */
.dash-pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; color: rgba(22, 19, 15, 0.55); font-size: 0.85rem; }
.dash-pager__actions { display: flex; gap: 0.5rem; }