initial commit

This commit is contained in:
2026-03-06 12:25:27 -05:00
commit 4f2556bb42
45 changed files with 8473 additions and 0 deletions

268
hameter/web/static/app.js Normal file
View File

@@ -0,0 +1,268 @@
/* HAMeter Web UI - JavaScript */
// ----------------------------------------------------------------
// SSE (Server-Sent Events) connection
// ----------------------------------------------------------------
let eventSource = null;
function connectSSE() {
if (eventSource) {
eventSource.close();
}
eventSource = new EventSource('/api/events');
eventSource.addEventListener('status', function(e) {
const data = JSON.parse(e.data);
updateStatus(data);
});
eventSource.addEventListener('readings', function(e) {
const data = JSON.parse(e.data);
updateReadings(data);
});
eventSource.addEventListener('costs', function(e) {
const data = JSON.parse(e.data);
updateCosts(data);
});
eventSource.addEventListener('discovery', function(e) {
const data = JSON.parse(e.data);
if (typeof window._onDiscoveryUpdate === 'function') {
window._onDiscoveryUpdate(data);
}
});
eventSource.addEventListener('logs', function(e) {
const data = JSON.parse(e.data);
if (typeof window._onLogUpdate === 'function') {
window._onLogUpdate(data);
}
});
eventSource.onerror = function() {
// Auto-reconnect is built into EventSource
updateStatusDot('error');
};
}
// ----------------------------------------------------------------
// Status updates
// ----------------------------------------------------------------
function updateStatus(data) {
updateStatusDot(data.status);
// Update sidebar status
const statusText = document.querySelector('.status-text');
if (statusText) {
const labels = {
'unconfigured': 'Not Configured',
'stopped': 'Stopped',
'starting': 'Starting...',
'running': 'Running',
'restarting': 'Restarting...',
'discovery': 'Discovery Mode',
'error': 'Error',
};
statusText.textContent = labels[data.status] || data.status;
}
}
function updateStatusDot(status) {
const dot = document.querySelector('.status-dot');
if (dot) {
dot.className = 'status-dot ' + status;
}
}
// ----------------------------------------------------------------
// Readings updates (dashboard)
// ----------------------------------------------------------------
function updateReadings(readings) {
for (const [meterId, data] of Object.entries(readings)) {
const readingEl = document.querySelector('#reading-' + meterId + ' .reading-value');
if (readingEl) {
readingEl.textContent = formatNumber(data.calibrated_consumption);
}
const rawEl = document.getElementById('raw-' + meterId);
if (rawEl) {
rawEl.textContent = formatNumber(data.raw_consumption);
}
const lastSeenEl = document.getElementById('lastseen-' + meterId);
if (lastSeenEl) {
lastSeenEl.textContent = data.timestamp || '--';
}
const countEl = document.getElementById('count-' + meterId);
if (countEl) {
countEl.textContent = data.count || 0;
}
// Update cost display if present
const costEl = document.getElementById('cost-' + meterId);
if (costEl && data.cumulative_cost !== undefined) {
costEl.textContent = '$' + Number(data.cumulative_cost).toFixed(2);
}
}
}
// ----------------------------------------------------------------
// Cost updates (dashboard)
// ----------------------------------------------------------------
function updateCosts(costs) {
for (const [meterId, data] of Object.entries(costs)) {
const costEl = document.getElementById('cost-' + meterId);
if (costEl) {
costEl.textContent = '$' + Number(data.cumulative_cost).toFixed(2);
}
const billingStartEl = document.getElementById('billing-start-' + meterId);
if (billingStartEl) {
billingStartEl.textContent = data.billing_period_start || '--';
}
const fixedEl = document.getElementById('fixed-charges-' + meterId);
if (fixedEl) {
fixedEl.textContent = '$' + Number(data.fixed_charges_applied).toFixed(2);
}
}
}
function formatNumber(n) {
if (n === null || n === undefined) return '--';
return Number(n).toLocaleString(undefined, {
minimumFractionDigits: 0,
maximumFractionDigits: 4,
});
}
// ----------------------------------------------------------------
// Toast notifications
// ----------------------------------------------------------------
function showToast(message, type) {
type = type || 'info';
const container = document.getElementById('toast-container');
if (!container) return;
const toast = document.createElement('div');
toast.className = 'toast toast-' + type;
toast.textContent = message;
container.appendChild(toast);
setTimeout(function() {
toast.style.opacity = '0';
toast.style.transition = 'opacity 0.3s';
setTimeout(function() { toast.remove(); }, 300);
}, 4000);
}
// ----------------------------------------------------------------
// Restart banner
// ----------------------------------------------------------------
function showRestartBanner() {
const banner = document.getElementById('restart-banner');
if (banner) {
banner.classList.remove('hidden');
} else {
// Create one dynamically if not on a page with one
showToast('Pipeline restart required to apply changes', 'info');
}
}
// ----------------------------------------------------------------
// Pipeline control
// ----------------------------------------------------------------
function restartPipeline() {
if (!confirm('Restart the pipeline? Meter monitoring will briefly pause.')) return;
fetch('/api/pipeline/restart', { method: 'POST' })
.then(function(r) { return r.json(); })
.then(function(data) {
if (data.ok) {
showToast('Pipeline restarting...', 'info');
// Hide restart banner if visible
const banner = document.getElementById('restart-banner');
if (banner) banner.classList.add('hidden');
}
})
.catch(function(e) {
showToast('Failed to restart: ' + e.message, 'error');
});
}
// ----------------------------------------------------------------
// Cost actions
// ----------------------------------------------------------------
function resetBillingPeriod(meterId) {
if (!confirm('Reset the billing period for this meter? Cost will be set to $0.00.')) return;
fetch('/api/costs/' + meterId + '/reset', { method: 'POST' })
.then(function(r) { return r.json(); })
.then(function(data) {
if (data.ok) {
showToast('Billing period reset', 'success');
var costEl = document.getElementById('cost-' + meterId);
if (costEl) costEl.textContent = '$0.00';
} else {
showToast(data.error || 'Reset failed', 'error');
}
})
.catch(function(e) {
showToast('Failed: ' + e.message, 'error');
});
}
function addFixedCharges(meterId) {
if (!confirm('Add fixed charges to this meter?')) return;
fetch('/api/costs/' + meterId + '/add-fixed', { method: 'POST' })
.then(function(r) { return r.json(); })
.then(function(data) {
if (data.ok) {
showToast('Added $' + Number(data.fixed_added).toFixed(2) + ' fixed charges', 'success');
var costEl = document.getElementById('cost-' + meterId);
if (costEl) costEl.textContent = '$' + Number(data.cumulative_cost).toFixed(2);
} else {
showToast(data.error || 'Failed to add charges', 'error');
}
})
.catch(function(e) {
showToast('Failed: ' + e.message, 'error');
});
}
// ----------------------------------------------------------------
// Sidebar toggle (mobile)
// ----------------------------------------------------------------
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
if (sidebar) {
sidebar.classList.toggle('open');
}
}
// ----------------------------------------------------------------
// Password toggle
// ----------------------------------------------------------------
function togglePassword(inputId) {
const input = document.getElementById(inputId);
if (!input) return;
if (input.type === 'password') {
input.type = 'text';
} else {
input.type = 'password';
}
}
// ----------------------------------------------------------------
// Init
// ----------------------------------------------------------------
document.addEventListener('DOMContentLoaded', function() {
// Only connect SSE on pages with the sidebar (not setup page)
if (document.querySelector('.sidebar')) {
connectSSE();
}
});

View File

@@ -0,0 +1,46 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" width="96" height="96">
<!-- Background: black rounded square -->
<rect width="96" height="96" rx="18" ry="18" fill="#000000"/>
<!-- Radio waves - left side -->
<path d="M 22 30 A 18 18 0 0 0 22 46" fill="none" stroke="#5cbf2a" stroke-width="2.5" stroke-linecap="round" opacity="0.9"/>
<path d="M 16 27 A 24 24 0 0 0 16 49" fill="none" stroke="#5cbf2a" stroke-width="2.5" stroke-linecap="round" opacity="0.6"/>
<!-- Radio waves - right side -->
<path d="M 74 30 A 18 18 0 0 1 74 46" fill="none" stroke="#5cbf2a" stroke-width="2.5" stroke-linecap="round" opacity="0.9"/>
<path d="M 80 27 A 24 24 0 0 1 80 49" fill="none" stroke="#5cbf2a" stroke-width="2.5" stroke-linecap="round" opacity="0.6"/>
<!-- Meter body - circular -->
<circle cx="48" cy="48" r="24" fill="#5cbf2a"/>
<!-- Meter face - dark inner circle -->
<circle cx="48" cy="46" r="18" fill="#1a2a1a"/>
<!-- Digital readout screen border -->
<rect x="30" y="38" width="36" height="14" rx="2" ry="2" fill="#1a2a1a" stroke="#5cbf2a" stroke-width="1.5"/>
<!-- Digital readout digits (5 zeros) -->
<!-- Digit 1 -->
<rect x="33" y="40.5" width="4.5" height="9" rx="1" ry="1" fill="none" stroke="#5cbf2a" stroke-width="1" opacity="0.9"/>
<!-- Digit 2 -->
<rect x="39.5" y="40.5" width="4.5" height="9" rx="1" ry="1" fill="none" stroke="#5cbf2a" stroke-width="1" opacity="0.9"/>
<!-- Digit 3 -->
<rect x="46" y="40.5" width="4.5" height="9" rx="1" ry="1" fill="none" stroke="#5cbf2a" stroke-width="1" opacity="0.9"/>
<!-- Digit 4 -->
<rect x="52.5" y="40.5" width="4.5" height="9" rx="1" ry="1" fill="none" stroke="#5cbf2a" stroke-width="1" opacity="0.9"/>
<!-- Digit 5 -->
<rect x="59" y="40.5" width="4.5" height="9" rx="1" ry="1" fill="none" stroke="#5cbf2a" stroke-width="1" opacity="0.9"/>
<!-- Small indicator blocks below readout -->
<rect x="35" y="55" width="6" height="3" rx="0.5" fill="#5cbf2a" opacity="0.5"/>
<rect x="45" y="55" width="6" height="3" rx="0.5" fill="#5cbf2a" opacity="0.5"/>
<rect x="55" y="55" width="6" height="3" rx="0.5" fill="#5cbf2a" opacity="0.5"/>
<!-- Base/bottom of meter -->
<path d="M 32 68 Q 32 72 36 74 L 60 74 Q 64 72 64 68 Z" fill="#5cbf2a"/>
<circle cx="48" cy="71" r="2" fill="#1a2a1a"/>
<!-- Bottom screws -->
<circle cx="38" cy="78" r="1.5" fill="#3a3a3a"/>
<circle cx="58" cy="78" r="1.5" fill="#3a3a3a"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,759 @@
/* HAMeter Web UI Styles */
:root {
--bg-primary: #1a1a2e;
--bg-secondary: #16213e;
--bg-card: #1e293b;
--bg-input: #0f172a;
--bg-sidebar: #0f172a;
--text-primary: #e2e8f0;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--accent: #3b82f6;
--accent-hover: #2563eb;
--success: #22c55e;
--warning: #f59e0b;
--error: #ef4444;
--danger: #dc2626;
--border: #334155;
--radius: 8px;
--sidebar-width: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
}
/* Layout */
.app-layout {
display: flex;
min-height: 100vh;
}
.sidebar {
width: var(--sidebar-width);
background: var(--bg-sidebar);
border-right: 1px solid var(--border);
padding: 1rem 0;
position: fixed;
top: 0;
left: 0;
height: 100vh;
overflow-y: auto;
z-index: 100;
transition: transform 0.3s;
}
.sidebar-header {
padding: 0 1.25rem 1rem;
border-bottom: 1px solid var(--border);
margin-bottom: 0.5rem;
}
.logo {
font-size: 1.5rem;
font-weight: 700;
color: var(--accent);
margin-bottom: 0.5rem;
}
.status-indicator {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.8rem;
color: var(--text-secondary);
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--text-muted);
display: inline-block;
}
.status-dot.running { background: var(--success); }
.status-dot.starting, .status-dot.restarting { background: var(--warning); }
.status-dot.error { background: var(--error); }
.status-dot.stopped, .status-dot.unconfigured { background: var(--text-muted); }
.status-dot.discovery { background: var(--accent); }
.nav-links {
list-style: none;
padding: 0.5rem 0;
}
.nav-separator {
padding: 1rem 1.25rem 0.25rem;
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
}
.nav-link {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.6rem 1.25rem;
color: var(--text-secondary);
text-decoration: none;
transition: background 0.15s, color 0.15s;
font-size: 0.9rem;
}
.nav-link:hover {
background: var(--bg-card);
color: var(--text-primary);
}
.nav-link.active {
background: var(--accent);
color: #fff;
font-weight: 500;
}
.nav-icon {
width: 1.2em;
text-align: center;
}
.main-content {
flex: 1;
margin-left: var(--sidebar-width);
display: flex;
flex-direction: column;
}
.top-bar {
display: flex;
align-items: center;
gap: 1rem;
padding: 1rem 1.5rem;
border-bottom: 1px solid var(--border);
background: var(--bg-secondary);
}
.top-bar .page-title {
font-size: 1.25rem;
font-weight: 600;
flex: 1;
}
.hamburger {
display: none;
background: none;
border: none;
color: var(--text-primary);
font-size: 1.5rem;
cursor: pointer;
}
.content-area {
padding: 1.5rem;
flex: 1;
max-width: 1200px;
width: 100%;
}
/* Buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1rem;
border: 1px solid transparent;
border-radius: var(--radius);
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
text-decoration: none;
transition: background 0.15s, border-color 0.15s;
white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-link { background: none; border: none; color: var(--accent); text-decoration: underline; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-icon { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-group { display: flex; gap: 0.5rem; }
/* Forms */
.config-form-container {
max-width: 600px;
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.3rem;
font-size: 0.875rem;
font-weight: 500;
color: var(--text-secondary);
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
width: 100%;
padding: 0.5rem 0.75rem;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-primary);
font-size: 0.9rem;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
outline: none;
border-color: var(--accent);
}
.form-group input[readonly] {
opacity: 0.6;
cursor: not-allowed;
}
.form-group small {
display: block;
margin-top: 0.25rem;
font-size: 0.78rem;
color: var(--text-muted);
}
.form-group .required { color: var(--error); }
.form-inline {
display: flex;
align-items: center;
gap: 0.75rem;
}
.form-inline label { margin-bottom: 0; }
.form-inline input { width: auto; }
.form-actions {
display: flex;
gap: 0.75rem;
margin-top: 1.5rem;
align-items: center;
}
.input-group {
display: flex;
gap: 0.5rem;
}
.input-group input { flex: 1; }
.checkbox-label {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 0.85rem;
color: var(--text-secondary);
cursor: pointer;
}
/* Tables */
.table-container {
overflow-x: auto;
}
.data-table {
width: 100%;
border-collapse: collapse;
}
.data-table th {
text-align: left;
padding: 0.6rem 0.75rem;
font-size: 0.78rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-muted);
border-bottom: 1px solid var(--border);
}
.data-table td {
padding: 0.6rem 0.75rem;
border-bottom: 1px solid var(--border);
font-size: 0.9rem;
}
.data-table tr:hover td {
background: rgba(59, 130, 246, 0.05);
}
.actions-cell {
display: flex;
gap: 0.4rem;
}
.empty-row td {
text-align: center;
color: var(--text-muted);
padding: 2rem;
}
/* Badges */
.badge {
display: inline-block;
padding: 0.15rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
}
.badge-protocol {
background: var(--bg-secondary);
color: var(--accent);
border: 1px solid var(--border);
}
.badge-cost {
background: var(--bg-secondary);
color: var(--success, #22c55e);
border: 1px solid var(--border);
}
/* Meter cards */
.meter-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1rem;
}
.meter-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
}
.meter-card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border);
}
.meter-card-header h3 {
font-size: 1rem;
font-weight: 600;
}
.meter-card-body {
padding: 1rem;
}
.meter-reading {
text-align: center;
padding: 0.75rem 0;
margin-bottom: 0.75rem;
}
.reading-value {
font-size: 2rem;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.reading-unit {
font-size: 1rem;
color: var(--text-secondary);
margin-left: 0.25rem;
}
.meter-details {
border-top: 1px solid var(--border);
padding-top: 0.75rem;
}
.detail-row {
display: flex;
justify-content: space-between;
padding: 0.2rem 0;
font-size: 0.85rem;
}
.detail-label { color: var(--text-muted); }
.detail-value { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
/* Flash / toast messages */
.flash {
padding: 0.75rem 1rem;
border-radius: var(--radius);
margin-bottom: 1rem;
font-size: 0.9rem;
}
.flash-success { background: rgba(34, 197, 94, 0.15); border: 1px solid var(--success); color: var(--success); }
.flash-error { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--error); color: var(--error); }
.flash-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--warning); color: var(--warning); }
.toast-container {
position: fixed;
bottom: 1rem;
right: 1rem;
z-index: 1000;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.toast {
padding: 0.75rem 1rem;
border-radius: var(--radius);
font-size: 0.875rem;
animation: slideIn 0.3s ease;
min-width: 250px;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--error); color: #fff; }
.toast-info { background: var(--accent); color: #fff; }
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
/* Restart banner */
.restart-banner {
background: rgba(245, 158, 11, 0.15);
border: 1px solid var(--warning);
color: var(--warning);
padding: 0.75rem 1rem;
border-radius: var(--radius);
margin-bottom: 1rem;
display: flex;
align-items: center;
justify-content: space-between;
}
/* Test result */
.test-result {
margin-top: 1rem;
padding: 0.5rem 0.75rem;
border-radius: var(--radius);
font-size: 0.875rem;
}
.test-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.test-error { background: rgba(239, 68, 68, 0.15); color: var(--error); }
/* Empty state */
.empty-state {
text-align: center;
padding: 3rem 1rem;
color: var(--text-muted);
}
.empty-state p { margin-bottom: 1rem; }
/* Log viewer */
.log-viewer {
background: #0d1117;
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 0.75rem;
font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
font-size: 0.8rem;
line-height: 1.5;
height: calc(100vh - 200px);
overflow-y: auto;
}
.log-line { padding: 1px 0; white-space: pre-wrap; word-break: break-all; }
.log-ts { color: var(--text-muted); }
.log-level { font-weight: 600; }
.log-name { color: var(--text-muted); }
.log-debug .log-level { color: var(--text-muted); }
.log-info .log-level { color: var(--text-primary); }
.log-warning .log-level { color: var(--warning); }
.log-error .log-level { color: var(--error); }
.log-controls {
display: flex;
align-items: center;
gap: 0.75rem;
}
.log-controls select,
.log-controls input[type="text"] {
padding: 0.3rem 0.5rem;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: 4px;
color: var(--text-primary);
font-size: 0.8rem;
}
/* Discovery page */
.discovery-info {
margin-bottom: 1rem;
color: var(--text-secondary);
font-size: 0.9rem;
}
.discovery-controls {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
}
.discovery-status {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--accent);
font-size: 0.9rem;
}
.spinner-sm {
width: 16px;
height: 16px;
border: 2px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
/* Calibration */
.calibration-info {
margin-bottom: 1.5rem;
color: var(--text-secondary);
font-size: 0.9rem;
}
.calibration-result {
margin-top: 1.5rem;
padding: 1rem;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.result-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 1rem;
margin: 1rem 0;
}
.result-item { text-align: center; }
.result-label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.result-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Setup page */
.setup-body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 1rem;
}
.setup-container {
width: 100%;
max-width: 480px;
position: relative;
}
.setup-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 2rem;
text-align: center;
}
.setup-card h2 {
margin-bottom: 0.75rem;
font-size: 1.5rem;
}
.setup-card p {
color: var(--text-secondary);
margin-bottom: 0.75rem;
font-size: 0.9rem;
}
.setup-card .form-group {
text-align: left;
}
.setup-card .form-actions {
justify-content: center;
flex-wrap: wrap;
}
.setup-logo {
font-size: 2.5rem;
font-weight: 700;
color: var(--accent);
margin-bottom: 1.5rem;
}
.setup-success {
font-size: 3rem;
color: var(--success);
margin-bottom: 1rem;
}
.setup-error {
position: fixed;
bottom: 1rem;
left: 50%;
transform: translateX(-50%);
background: var(--error);
color: #fff;
padding: 0.75rem 1.5rem;
border-radius: var(--radius);
font-size: 0.875rem;
z-index: 1000;
}
.spinner {
width: 24px;
height: 24px;
border: 3px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
margin: 1rem auto;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
code {
background: var(--bg-input);
padding: 0.1rem 0.4rem;
border-radius: 3px;
font-size: 0.85em;
}
/* Cost factor editor */
.cost-factor-row {
display: flex;
gap: 0.5rem;
align-items: center;
margin-top: 0.5rem;
}
.cost-factor-row .cf-name {
flex: 2;
padding: 0.4rem 0.6rem;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-primary);
font-size: 0.85rem;
}
.cost-factor-row .cf-rate {
flex: 1;
padding: 0.4rem 0.6rem;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-primary);
font-size: 0.85rem;
}
.cost-factor-row .cf-type {
width: 100px;
padding: 0.4rem 0.4rem;
background: var(--bg-input);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-primary);
font-size: 0.85rem;
}
/* Cost display on dashboard */
.meter-cost {
text-align: center;
padding: 0.75rem 0;
margin-bottom: 0.5rem;
border-bottom: 1px solid var(--border);
}
.cost-value {
font-size: 1.5rem;
font-weight: 700;
color: var(--success);
font-variant-numeric: tabular-nums;
}
.cost-label {
font-size: 0.78rem;
color: var(--text-muted);
margin-bottom: 0.5rem;
}
.cost-actions {
display: flex;
justify-content: center;
gap: 0.5rem;
}
/* Responsive */
@media (max-width: 768px) {
.sidebar {
transform: translateX(-100%);
}
.sidebar.open {
transform: translateX(0);
}
.main-content {
margin-left: 0;
}
.hamburger {
display: block;
}
.meter-grid {
grid-template-columns: 1fr;
}
.discovery-controls {
flex-direction: column;
align-items: stretch;
}
.log-controls {
flex-wrap: wrap;
}
}