Scaffold custom reports app (LXC 122 · /reports)

Framework for categorised custom reports pulling from NewBook, ResOS,
SambaPOS, and internal data. Report tree with collapsible categories
and subcategories; date-range params; run-audit log in reports_db.

Initial reports: NewBook arrivals/departures/stayovers/bookings-by-source,
ResOS covers/revenue, SambaPOS sales-summary/top-products, internal run-history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-06 12:58:19 +00:00
commit 0511ac8d82
31 changed files with 1818 additions and 0 deletions

397
frontend/src/index.css Normal file
View file

@ -0,0 +1,397 @@
/* Stack design system tokens */
:root {
--navy: #1a1a2e;
--gold: #c9a84c;
--body-bg: #f4f5f7;
--card-bg: #ffffff;
--text-primary: #1a1a2e;
--text-muted: #6b7280;
--border: #e5e7eb;
--radius: 8px;
--shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
--shadow-md: 0 4px 12px rgba(0,0,0,0.12);
/* App theme */
--app-primary: #1d4ed8;
--app-primary-light: #3b82f6;
--app-primary-dark: #1e40af;
/* Layout */
--sidebar-w: 220px;
--topbar-h: 56px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body, #root {
height: 100%;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--body-bg);
color: var(--text-primary);
font-size: 14px;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
/* ── App shell ──────────────────────────────────────────────────── */
.app-shell {
display: flex;
height: 100vh;
overflow: hidden;
}
/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
width: var(--sidebar-w);
background: var(--navy);
display: flex;
flex-direction: column;
flex-shrink: 0;
overflow-y: auto;
}
.sidebar-logo {
padding: 20px 16px 12px;
color: var(--gold);
font-size: 13px;
font-weight: 600;
letter-spacing: .05em;
text-transform: uppercase;
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.sidebar-nav {
flex: 1;
overflow-y: auto;
}
.sidebar-user {
padding: 12px 16px;
border-top: 1px solid rgba(255,255,255,.08);
color: rgba(255,255,255,.4);
font-size: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
}
/* ── Report tree ────────────────────────────────────────────────── */
.report-category {
border-bottom: 1px solid rgba(255,255,255,.05);
}
.report-cat-header {
width: 100%;
display: flex;
align-items: center;
gap: 8px;
padding: 9px 14px;
background: none;
border: none;
cursor: pointer;
color: rgba(255,255,255,.8);
font-size: 12.5px;
font-weight: 600;
letter-spacing: .03em;
text-transform: uppercase;
text-align: left;
transition: background .12s;
}
.report-cat-header:hover { background: rgba(255,255,255,.06); }
.report-cat-icon { opacity: .7; display: flex; }
.report-cat-label { flex: 1; }
.report-cat-body {
padding-bottom: 4px;
}
.report-sub-header {
width: 100%;
display: flex;
align-items: center;
gap: 6px;
padding: 7px 14px 7px 22px;
background: none;
border: none;
cursor: pointer;
color: rgba(255,255,255,.55);
font-size: 11.5px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: .04em;
text-align: left;
transition: color .12s;
}
.report-sub-header:hover { color: rgba(255,255,255,.8); }
.report-item {
width: 100%;
display: block;
padding: 7px 14px 7px 32px;
background: none;
border: none;
cursor: pointer;
color: rgba(255,255,255,.6);
font-size: 13px;
text-align: left;
transition: background .12s, color .12s;
}
.report-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.report-item.active { background: rgba(201,168,76,.12); color: var(--gold); }
/* ── Mobile top bar ─────────────────────────────────────────────── */
.top-bar {
display: none;
height: var(--topbar-h);
background: var(--navy);
color: #fff;
align-items: center;
padding: 0 14px;
gap: 10px;
flex-shrink: 0;
}
.top-bar-title {
flex: 1;
font-size: 15px;
font-weight: 600;
color: var(--gold);
}
/* ── Page content ───────────────────────────────────────────────── */
.page-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* ── Welcome / empty states ─────────────────────────────────────── */
.welcome-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
color: var(--text-muted);
padding: 40px;
}
.welcome-state h2 { margin: 0 0 8px; color: var(--text-primary); font-size: 20px; font-weight: 600; }
.welcome-state p { margin: 0; font-size: 14px; }
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 60px 20px;
color: var(--text-muted);
font-size: 14px;
}
/* ── Report view ────────────────────────────────────────────────── */
.report-view {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
padding: 24px 28px;
gap: 16px;
}
.report-header {
display: flex;
align-items: flex-start;
gap: 16px;
}
.report-title {
margin: 0 0 4px;
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
}
.report-description {
margin: 0;
font-size: 13px;
color: var(--text-muted);
max-width: 640px;
}
/* ── Controls bar ───────────────────────────────────────────────── */
.report-controls {
display: flex;
align-items: flex-end;
gap: 12px;
flex-wrap: wrap;
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 14px 16px;
}
.date-group {
display: flex;
flex-direction: column;
gap: 4px;
}
.date-group label {
font-size: 11px;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: .04em;
}
.date-input {
height: 34px;
padding: 0 10px;
border: 1px solid var(--border);
border-radius: 6px;
font-size: 13px;
color: var(--text-primary);
background: var(--body-bg);
cursor: pointer;
}
.date-input:focus { outline: 2px solid var(--app-primary); outline-offset: -1px; }
.btn-run {
display: flex;
align-items: center;
gap: 6px;
height: 34px;
padding: 0 16px;
background: var(--app-primary);
color: #fff;
border: none;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: background .15s;
white-space: nowrap;
}
.btn-run:hover:not(:disabled) { background: var(--app-primary-dark); }
.btn-run:disabled { opacity: .65; cursor: not-allowed; }
.btn-export {
display: flex;
align-items: center;
gap: 6px;
height: 34px;
padding: 0 14px;
background: none;
color: var(--text-muted);
border: 1px solid var(--border);
border-radius: 6px;
font-size: 13px;
cursor: pointer;
transition: border-color .15s, color .15s;
white-space: nowrap;
}
.btn-export:hover { border-color: var(--text-muted); color: var(--text-primary); }
/* ── Summary bar ────────────────────────────────────────────────── */
.summary-bar {
display: flex;
gap: 20px;
flex-wrap: wrap;
}
.summary-stat {
display: flex;
flex-direction: column;
gap: 2px;
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 10px 16px;
min-width: 110px;
}
.summary-label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: .04em;
color: var(--text-muted);
}
.summary-value {
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
}
/* ── Error ──────────────────────────────────────────────────────── */
.report-error {
display: flex;
align-items: flex-start;
gap: 8px;
background: #fef2f2;
border: 1px solid #fecaca;
border-radius: var(--radius);
color: #991b1b;
padding: 12px 14px;
font-size: 13px;
line-height: 1.5;
}
.report-error svg { flex-shrink: 0; margin-top: 1px; }
/* ── Results table ──────────────────────────────────────────────── */
.results-table-wrap {
flex: 1;
overflow: auto;
background: var(--card-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.results-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
white-space: nowrap;
}
.results-table thead {
position: sticky;
top: 0;
z-index: 1;
}
.results-table th {
background: #f8f9fb;
border-bottom: 1px solid var(--border);
padding: 9px 12px;
text-align: left;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: .04em;
color: var(--text-muted);
white-space: nowrap;
}
.results-table td {
padding: 8px 12px;
border-bottom: 1px solid var(--border);
color: var(--text-primary);
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:hover td { background: #f9fafb; }
.results-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.results-table th:has(+ .num) { text-align: right; }
/* ── Spinner ────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }
/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
.sidebar { display: none; }
.page-content { flex-direction: column; }
.top-bar { display: flex; }
.report-view { padding: 16px; }
.report-controls { gap: 8px; }
}