Files
meshcore-stats/src/meshmon/templates/styles.css
Jorijn Schrijvershof 0f8b0a3492 Initial release: MeshCore Stats monitoring system
A Python-based monitoring system for MeshCore LoRa mesh networks.
Collects metrics from companion and repeater nodes, stores them in
a SQLite database, and generates a static website with interactive
SVG charts and statistics.

Features:
- Data collection from local companion and remote repeater nodes
- SQLite database with EAV schema for flexible metric storage
- Interactive SVG chart generation with matplotlib
- Static HTML site with day/week/month/year views
- Monthly and yearly statistics reports (HTML, TXT, JSON)
- Light and dark theme support
- Circuit breaker for unreliable LoRa connections
- Battery percentage calculation from 18650 discharge curves
- Automated releases via release-please

Live demo: https://meshcore.jorijn.com
2026-01-04 19:37:57 +01:00

1108 lines
23 KiB
CSS

/* MeshCore Stats - Radio Observatory Design System */
/* Typography: JetBrains Mono (data) + Instrument Serif (display) + IBM Plex Sans (UI) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@300;400;500;600&display=swap');
/* ========================================
CSS Custom Properties - Light Theme (default)
======================================== */
:root {
/* Base palette - warm scientific paper */
--bg-primary: #faf8f5;
--bg-secondary: #f5f2ed;
--bg-tertiary: #eae6df;
--bg-elevated: #ffffff;
/* Text hierarchy */
--text-primary: #1a1915;
--text-secondary: #5c5850;
--text-tertiary: #8a857a;
--text-muted: #b5b0a5;
/* Accent - solar amber */
--accent-primary: #d97706;
--accent-secondary: #f59e0b;
--accent-muted: #fcd34d;
--accent-subtle: #fef3c7;
/* Status indicators */
--status-online: #15803d;
--status-online-bg: #dcfce7;
--status-stale: #a16207;
--status-stale-bg: #fef9c3;
--status-offline: #b91c1c;
--status-offline-bg: #fee2e2;
/* Borders and dividers */
--border-subtle: #e8e4dc;
--border-medium: #d4cfc4;
--border-strong: #b5b0a5;
/* Shadows */
--shadow-sm: 0 1px 2px rgba(26, 25, 21, 0.04);
--shadow-md: 0 4px 12px rgba(26, 25, 21, 0.06);
--shadow-lg: 0 8px 24px rgba(26, 25, 21, 0.08);
/* Chart-specific */
--chart-line: #b45309;
--chart-area: rgba(180, 83, 9, 0.15);
--chart-grid: #e8e4dc;
/* Spacing scale */
--space-xs: 0.25rem;
--space-sm: 0.5rem;
--space-md: 1rem;
--space-lg: 1.5rem;
--space-xl: 2rem;
--space-2xl: 3rem;
--space-3xl: 4rem;
/* Typography scale */
--text-xs: 0.75rem;
--text-sm: 0.8125rem;
--text-base: 0.9375rem;
--text-lg: 1.125rem;
--text-xl: 1.375rem;
--text-2xl: 1.75rem;
--text-3xl: 2.25rem;
/* Layout */
--sidebar-width: 360px;
--content-max-width: 1400px;
--border-radius: 3px;
}
/* ========================================
Dark Theme
======================================== */
@media (prefers-color-scheme: dark) {
:root {
/* Base palette - deep observatory night */
--bg-primary: #0f1114;
--bg-secondary: #161a1e;
--bg-tertiary: #1e2328;
--bg-elevated: #252a30;
/* Text hierarchy */
--text-primary: #f0efe8;
--text-secondary: #a8a598;
--text-tertiary: #706d62;
--text-muted: #4a473f;
/* Accent - solar amber (slightly adjusted for dark) */
--accent-primary: #f59e0b;
--accent-secondary: #fbbf24;
--accent-muted: #d97706;
--accent-subtle: #451a03;
/* Status indicators */
--status-online: #4ade80;
--status-online-bg: #14532d;
--status-stale: #facc15;
--status-stale-bg: #422006;
--status-offline: #f87171;
--status-offline-bg: #450a0a;
/* Borders and dividers */
--border-subtle: #252a30;
--border-medium: #2d333a;
--border-strong: #3d444d;
/* Shadows */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
--shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
/* Chart-specific */
--chart-line: #f59e0b;
--chart-area: rgba(245, 158, 11, 0.2);
--chart-grid: #252a30;
}
}
/* ========================================
Reset & Base Styles
======================================== */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 16px;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: 'JetBrains Mono', ui-monospace, monospace;
font-size: var(--text-base);
font-weight: 400;
line-height: 1.6;
color: var(--text-primary);
background-color: var(--bg-primary);
min-height: 100vh;
}
/* ========================================
Typography
======================================== */
h1, h2, h3, h4, h5, h6 {
font-family: 'Instrument Serif', Georgia, serif;
font-weight: 400;
line-height: 1.2;
color: var(--text-primary);
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
.mono {
font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.serif {
font-family: 'Instrument Serif', Georgia, serif;
}
.italic {
font-style: italic;
}
/* Data display - tight letter spacing for numerics */
.data-value {
font-family: 'JetBrains Mono', ui-monospace, monospace;
font-weight: 500;
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
}
.data-label {
font-size: var(--text-xs);
font-weight: 400;
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.08em;
}
.data-unit {
font-size: var(--text-sm);
font-weight: 300;
color: var(--text-tertiary);
margin-left: 0.15em;
}
/* ========================================
Layout - Observatory Control Panel
======================================== */
.layout {
display: grid;
grid-template-columns: var(--sidebar-width) 1fr;
min-height: 100vh;
}
@media (max-width: 900px) {
.layout {
grid-template-columns: 1fr;
}
}
/* ========================================
Sidebar - Instrument Panel
======================================== */
.sidebar {
background: var(--bg-secondary);
border-right: 1px solid var(--border-subtle);
padding: var(--space-xl);
display: flex;
flex-direction: column;
gap: var(--space-xl);
position: sticky;
top: 0;
height: 100vh;
overflow-y: auto;
}
@media (max-width: 900px) {
.sidebar {
position: relative;
height: auto;
border-right: none;
border-bottom: 1px solid var(--border-subtle);
}
}
/* Site header */
.site-header {
padding-bottom: var(--space-lg);
border-bottom: 1px solid var(--border-subtle);
}
.site-title {
font-family: 'Instrument Serif', Georgia, serif;
font-size: var(--text-lg);
font-style: italic;
color: var(--text-primary);
margin-bottom: var(--space-xs);
}
.site-subtitle {
font-size: var(--text-xs);
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.1em;
}
/* Node selector */
.node-selector {
display: flex;
gap: var(--space-xs);
background: var(--bg-tertiary);
padding: var(--space-xs);
border-radius: var(--border-radius);
}
.node-selector a {
flex: 1;
text-align: center;
padding: var(--space-sm) var(--space-md);
font-size: var(--text-sm);
font-weight: 500;
color: var(--text-secondary);
text-decoration: none;
border-radius: 2px;
transition: all 0.15s ease;
}
.node-selector a:hover {
color: var(--text-primary);
}
.node-selector a.active {
background: var(--bg-elevated);
color: var(--text-primary);
box-shadow: var(--shadow-sm);
}
/* Node info card */
.node-info {
background: var(--bg-elevated);
border: 1px solid var(--border-subtle);
border-radius: var(--border-radius);
padding: var(--space-lg);
}
.node-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: var(--space-md);
}
.node-name {
font-family: 'Instrument Serif', Georgia, serif;
font-size: var(--text-lg);
color: var(--text-primary);
}
.node-id {
font-size: var(--text-xs);
color: var(--text-tertiary);
margin-top: var(--space-xs);
}
/* Status indicator */
.status-badge {
display: inline-flex;
align-items: center;
gap: var(--space-xs);
padding: var(--space-xs) var(--space-sm);
font-size: var(--text-xs);
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.05em;
border-radius: 2px;
}
.status-badge::before {
content: '';
width: 6px;
height: 6px;
border-radius: 50%;
animation: pulse 2s infinite;
}
.status-badge.online {
background: var(--status-online-bg);
color: var(--status-online);
}
.status-badge.online::before {
background: var(--status-online);
}
.status-badge.stale {
background: var(--status-stale-bg);
color: var(--status-stale);
}
.status-badge.stale::before {
background: var(--status-stale);
animation: none;
}
.status-badge.offline {
background: var(--status-offline-bg);
color: var(--status-offline);
}
.status-badge.offline::before {
background: var(--status-offline);
animation: none;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* Critical metrics - the main instruments */
.critical-metrics {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--space-md);
margin-top: var(--space-md);
padding-top: var(--space-md);
padding-bottom: var(--space-md);
border-top: 1px solid var(--border-subtle);
}
.metric {
display: flex;
flex-direction: column;
gap: var(--space-xs);
}
.metric-value {
font-size: var(--text-xl);
font-weight: 500;
color: var(--text-primary);
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
}
.metric-value .unit {
font-size: var(--text-sm);
font-weight: 300;
color: var(--text-tertiary);
}
.metric-label {
font-size: var(--text-xs);
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.08em;
}
/* Secondary metrics */
.secondary-metrics {
display: flex;
flex-direction: column;
gap: var(--space-sm);
padding: var(--space-md) 0;
border-top: 1px solid var(--border-subtle);
}
.secondary-metric {
display: flex;
justify-content: space-between;
align-items: baseline;
font-size: var(--text-sm);
}
.secondary-metric .label {
color: var(--text-tertiary);
}
.secondary-metric .value {
color: var(--text-primary);
font-weight: 500;
font-variant-numeric: tabular-nums;
}
/* Last updated */
.last-updated {
margin-top: auto;
padding-top: var(--space-lg);
border-top: 1px solid var(--border-subtle);
font-size: var(--text-xs);
color: var(--text-tertiary);
}
.last-updated time {
display: block;
color: var(--text-secondary);
margin-top: var(--space-xs);
}
/* ========================================
Main Content - Observation Charts
======================================== */
.main-content {
padding: var(--space-xl);
background: var(--bg-primary);
}
@media (min-width: 901px) {
.main-content {
padding: var(--space-2xl) var(--space-3xl);
}
}
/* Period navigation */
.period-nav {
display: flex;
gap: var(--space-lg);
margin-bottom: var(--space-2xl);
border-bottom: 1px solid var(--border-subtle);
padding-bottom: var(--space-md);
}
.period-nav a {
font-size: var(--text-sm);
font-weight: 500;
color: var(--text-tertiary);
text-decoration: none;
padding-bottom: var(--space-md);
margin-bottom: -1px;
border-bottom: 2px solid transparent;
transition: all 0.15s ease;
}
.period-nav a:hover {
color: var(--text-secondary);
}
.period-nav a.active {
color: var(--accent-primary);
border-bottom-color: var(--accent-primary);
}
/* Page title */
.page-header {
margin-bottom: var(--space-2xl);
}
.page-title {
font-family: 'Instrument Serif', Georgia, serif;
font-size: var(--text-2xl);
font-style: italic;
color: var(--text-primary);
margin-bottom: var(--space-xs);
}
.page-subtitle {
font-size: var(--text-sm);
color: var(--text-tertiary);
}
/* Charts grid */
.charts-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
gap: var(--space-xl);
align-items: stretch;
}
@media (max-width: 500px) {
.charts-grid {
grid-template-columns: 1fr;
}
}
/* Chart card */
.chart-card {
background: var(--bg-elevated);
border: 1px solid var(--border-subtle);
border-radius: var(--border-radius);
overflow: hidden;
display: flex;
flex-direction: column;
}
.chart-header {
padding: var(--space-md) var(--space-lg);
border-bottom: 1px solid var(--border-subtle);
display: flex;
justify-content: space-between;
align-items: baseline;
}
.chart-title {
font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
font-size: var(--text-sm);
font-weight: 500;
color: var(--text-primary);
}
.chart-current {
font-size: var(--text-sm);
font-weight: 500;
color: var(--accent-primary);
font-variant-numeric: tabular-nums;
}
.chart-image {
display: block;
width: 100%;
height: auto;
}
/* SVG chart container and theme switching */
.chart-svg-container {
position: relative;
width: 100%;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
background: #faf8f5; /* Match matplotlib figure background (warm cream) */
}
@media (prefers-color-scheme: dark) {
.chart-svg-container {
background: #0f1114; /* Match matplotlib figure background (deep night) */
}
}
.chart-svg {
width: 100%;
}
.chart-svg svg {
display: block;
width: 100%;
height: auto;
max-width: 100%;
}
/* Light mode: show light theme, hide dark */
.chart-svg.dark-theme {
display: none;
}
.chart-svg.light-theme {
display: block;
}
/* Dark mode: show dark theme, hide light */
@media (prefers-color-scheme: dark) {
.chart-svg.light-theme {
display: none;
}
.chart-svg.dark-theme {
display: block;
}
}
/* Chart tooltip (for future JS enhancement) */
.chart-tooltip {
position: absolute;
pointer-events: none;
background: var(--bg-elevated);
border: 1px solid var(--border-medium);
border-radius: var(--border-radius);
padding: var(--space-sm) var(--space-md);
font-size: var(--text-xs);
box-shadow: var(--shadow-md);
z-index: 1000;
opacity: 0;
transition: opacity 0.15s ease;
}
.chart-tooltip.visible {
opacity: 1;
}
.chart-tooltip .tooltip-time {
color: var(--text-tertiary);
margin-bottom: var(--space-xs);
}
.chart-tooltip .tooltip-value {
font-weight: 500;
color: var(--text-primary);
font-variant-numeric: tabular-nums;
}
.chart-footer {
padding: var(--space-sm) var(--space-lg);
background: var(--bg-secondary);
display: flex;
justify-content: space-between;
font-size: var(--text-xs);
color: var(--text-tertiary);
}
.chart-stat {
display: flex;
gap: var(--space-xs);
}
.chart-stat .label {
color: var(--text-muted);
}
.chart-stat .value {
font-variant-numeric: tabular-nums;
}
/* Chart grouping */
.chart-group {
margin-bottom: var(--space-2xl);
}
.chart-group-title {
font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
font-size: var(--text-xs);
font-weight: 600;
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.1em;
margin-bottom: var(--space-lg);
padding-bottom: var(--space-sm);
border-bottom: 1px solid var(--border-subtle);
}
/* ========================================
Reports - Archive Pages
======================================== */
.reports-layout {
max-width: 1200px;
margin: 0 auto;
padding: var(--space-2xl);
}
.reports-header {
margin-bottom: var(--space-2xl);
padding-bottom: var(--space-lg);
border-bottom: 1px solid var(--border-subtle);
}
.reports-title {
font-family: 'Instrument Serif', Georgia, serif;
font-size: var(--text-2xl);
font-style: italic;
margin-bottom: var(--space-sm);
}
.reports-subtitle {
font-size: var(--text-sm);
color: var(--text-tertiary);
}
/* Report navigation breadcrumb */
.reports-breadcrumb {
display: flex;
gap: var(--space-sm);
font-size: var(--text-sm);
color: var(--text-tertiary);
margin-bottom: var(--space-xl);
}
.reports-breadcrumb a {
color: var(--text-secondary);
text-decoration: none;
}
.reports-breadcrumb a:hover {
color: var(--accent-primary);
}
.reports-breadcrumb span {
color: var(--text-muted);
}
/* Archive list */
.archive-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: var(--space-lg);
}
.archive-year {
background: var(--bg-elevated);
border: 1px solid var(--border-subtle);
border-radius: var(--border-radius);
padding: var(--space-lg);
}
.archive-year-title {
font-family: 'Instrument Serif', Georgia, serif;
font-size: var(--text-xl);
margin-bottom: var(--space-md);
}
.archive-year-title a {
color: var(--text-primary);
text-decoration: none;
}
.archive-year-title a:hover {
color: var(--accent-primary);
}
.archive-months {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: var(--space-sm);
}
.archive-month {
text-align: center;
padding: var(--space-sm);
font-size: var(--text-sm);
color: var(--text-secondary);
text-decoration: none;
border-radius: 2px;
transition: all 0.15s ease;
}
.archive-month:hover {
background: var(--accent-subtle);
color: var(--accent-primary);
}
.archive-month.empty {
color: var(--text-muted);
pointer-events: none;
}
/* Data tables */
.data-table-wrapper {
overflow-x: auto;
margin: var(--space-lg) 0;
}
.data-table {
width: 100%;
border-collapse: collapse;
font-size: var(--text-sm);
font-variant-numeric: tabular-nums;
}
.data-table th,
.data-table td {
padding: var(--space-sm) var(--space-md);
text-align: right;
border-bottom: 1px solid var(--border-subtle);
}
.data-table th {
font-size: var(--text-xs);
font-weight: 500;
color: var(--text-tertiary);
text-transform: uppercase;
letter-spacing: 0.05em;
background: var(--bg-secondary);
position: sticky;
top: 0;
}
.data-table th:first-child,
.data-table td:first-child {
text-align: left;
}
.data-table td {
color: var(--text-primary);
}
.data-table tbody tr:hover {
background: var(--bg-secondary);
}
.data-table .highlight {
color: var(--accent-primary);
font-weight: 500;
}
.data-table .muted {
color: var(--text-tertiary);
}
/* Table column groups */
.data-table .col-group-header {
font-size: var(--text-xs);
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.1em;
border-bottom: 2px solid var(--border-medium);
}
/* Summary row */
.data-table tfoot td {
font-weight: 500;
border-top: 2px solid var(--border-medium);
background: var(--bg-secondary);
}
/* ========================================
Location info
======================================== */
.location-info {
font-size: var(--text-xs);
color: var(--text-tertiary);
padding: var(--space-md);
background: var(--bg-secondary);
border-radius: var(--border-radius);
margin-bottom: var(--space-lg);
}
.location-info dt {
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
}
.location-info dd {
color: var(--text-secondary);
margin-bottom: var(--space-sm);
}
.location-info dd:last-child {
margin-bottom: 0;
}
/* ========================================
Device / Node details section
======================================== */
.node-details {
font-size: var(--text-xs);
color: var(--text-tertiary);
padding: var(--space-md) 0;
border-top: 1px solid var(--border-subtle);
}
.node-details-row {
display: flex;
justify-content: space-between;
padding: var(--space-xs) 0;
}
.node-details-row .label {
color: var(--text-muted);
}
.node-details-row .value {
color: var(--text-secondary);
}
/* ========================================
Radio configuration display
======================================== */
.radio-config {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--space-xs) var(--space-md);
font-size: var(--text-xs);
padding: var(--space-md);
background: var(--bg-tertiary);
border-radius: var(--border-radius);
margin-top: var(--space-md);
}
.radio-config dt {
color: var(--text-muted);
}
.radio-config dd {
color: var(--text-secondary);
text-align: right;
}
/* ========================================
Traffic metrics - table display
======================================== */
.traffic-table {
width: 100%;
border-collapse: collapse;
font-size: var(--text-xs);
border-top: 1px solid var(--border-subtle);
}
.traffic-table th,
.traffic-table td {
padding: var(--space-xs) var(--space-sm);
text-align: right;
}
.traffic-table th:first-child,
.traffic-table td:first-child {
padding-left: 0;
}
.traffic-table th:last-child,
.traffic-table td:last-child {
padding-right: 0;
}
.traffic-table th[scope="row"] {
text-align: left;
color: var(--text-muted);
font-weight: 400;
}
.traffic-table thead th {
color: var(--text-muted);
font-weight: 400;
padding-top: var(--space-md);
padding-bottom: var(--space-xs);
}
.traffic-table tbody tr:last-child th,
.traffic-table tbody tr:last-child td {
padding-bottom: var(--space-md);
}
.traffic-table td {
color: var(--text-secondary);
font-variant-numeric: tabular-nums;
cursor: help;
}
/* ========================================
Footer
======================================== */
.site-footer {
margin-top: auto;
padding: var(--space-lg) 0;
border-top: 1px solid var(--border-subtle);
font-size: var(--text-xs);
color: var(--text-tertiary);
text-align: center;
}
.site-footer a {
color: var(--text-secondary);
text-decoration: none;
}
.site-footer a:hover {
color: var(--accent-primary);
}
/* Site credit line */
footer.site-credit {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
gap: var(--space-xs);
margin-top: var(--space-2xl);
padding: var(--space-lg) 0;
font-size: var(--text-xs);
color: var(--text-muted);
}
footer.site-credit .separator {
color: var(--text-muted);
}
footer.site-credit a {
color: var(--text-muted);
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 0.25em;
border-radius: 2px;
}
footer.site-credit a:hover {
color: var(--text-secondary);
}
footer.site-credit a:focus-visible {
outline: 2px solid var(--accent-primary);
outline-offset: 2px;
}
footer.site-credit svg {
width: 1em;
height: 1em;
fill: currentColor;
flex-shrink: 0;
vertical-align: -0.125em;
}
/* ========================================
Utilities
======================================== */
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.text-accent {
color: var(--accent-primary);
}
.text-muted {
color: var(--text-muted);
}
.text-secondary {
color: var(--text-secondary);
}
/* ========================================
Animations - subtle load-in
======================================== */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.chart-card {
animation: fadeIn 0.4s ease-out backwards;
}
.chart-card:nth-child(1) { animation-delay: 0.05s; }
.chart-card:nth-child(2) { animation-delay: 0.1s; }
.chart-card:nth-child(3) { animation-delay: 0.15s; }
.chart-card:nth-child(4) { animation-delay: 0.2s; }
.chart-card:nth-child(5) { animation-delay: 0.25s; }
.chart-card:nth-child(6) { animation-delay: 0.3s; }
.chart-card:nth-child(7) { animation-delay: 0.35s; }
.chart-card:nth-child(8) { animation-delay: 0.4s; }
.chart-card:nth-child(9) { animation-delay: 0.45s; }
.chart-card:nth-child(10) { animation-delay: 0.5s; }
/* Reduce motion if preferred */
@media (prefers-reduced-motion: reduce) {
.chart-card {
animation: none;
}
.status-badge::before {
animation: none;
}
}