Adding the correct stylesheet

This commit is contained in:
Ketan Patel committed 2026-04-04 14:39:21 -04:00
1 parent fac7b9a082
commit 5a90ce51d8
7 files changed
+820 -626

No files matched your search

+269 -278
View File
@@ -1,328 +1,319 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 1rem;
background: #10151b;
color: #eef;
/* ============================================================
Dashboard — UPS cards, tiles, badges, charts.
Inherits design tokens from base.css. No body/header redefinition.
============================================================ */
/* Card grid */
#ups-cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
gap: 16px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid #333;
}
.header h1 {
margin: 0;
color: #eef;
}
.header nav {
display: flex;
gap: 1rem;
align-items: center;
}
.config-link {
color: #6c757d;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 4px;
transition: background-color 0.2s;
}
.config-link:hover {
background-color: #2d3748;
color: #eef;
}
.card {
background: #1d2530;
padding: 1.5rem;
margin: 0.5rem;
border-radius: 8px;
display: inline-block;
vertical-align: top;
min-width: 320px;
min-height: 260px;
.card {
background: var(--surface);
border: 1px solid var(--border);
padding: 16px 18px 28px;
border-radius: var(--radius-lg);
position: relative;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
position: relative;
resize: both; /* fallback native resize for browsers that support */
box-shadow: var(--shadow-sm);
min-height: 280px;
resize: both;
overflow: hidden;
transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--border-hi); box-shadow: var(--shadow-md); }
.card.resizing { outline: 2px dashed var(--accent); }
.card-header {
display: flex;
align-items: center;
gap: 8px;
padding-bottom: 12px;
margin-bottom: 12px;
border-bottom: 1px solid var(--border);
}
.card-header h2 {
margin: 0;
font-size: 15px;
color: var(--text);
display: flex;
align-items: center;
flex: 1;
}
.ups-connection {
font-size: 11px;
color: var(--text-dim);
font-family: var(--font-mono);
padding: 2px 6px;
background: var(--surface-2);
border-radius: var(--radius-sm);
}
/* ------- Highline (status + key badges) ------- */
.highline {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
gap: 6px;
align-items: center;
margin-bottom: 0.75rem;
}
.badge {
background: #243140;
padding: 2px 8px;
border-radius: 12px;
font-size: 0.7rem;
letter-spacing: 0.5px;
color: #cde;
font-weight: 600;
}
.badge[data-badge="runtime"] { background:#2c3e50; }
.badge[data-badge="watts"] { background:#1f4f61; }
.badge[data-badge="headroom"] { background:#3b3f2a; }
.badge[data-badge="energy"] { background:#28324a; }
/* Battery Gauge */
.gauge { width: 120px; height: 70px; position: relative; }
.gauge svg { width: 100%; height: 100%; }
.gauge-bg { fill: none; stroke: #243140; stroke-width: 10; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: #4a9eff; stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .4s ease, stroke .4s; }
.gauge-text { fill: #cde; font-size: 16px; font-weight: 600; dominant-baseline: middle; }
.gauge.low .gauge-fill { stroke: #d97745; }
.gauge.critical .gauge-fill { stroke: #d9534f; }
.gauge.good .gauge-fill { stroke: #3bb273; }
.events { margin-top: 0.75rem; }
.events-header { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.6; margin-bottom: 0.25rem; }
.events-list { list-style: none; padding: 0; margin: 0; max-height: 90px; overflow-y: auto; font-size: 0.65rem; line-height: 1.2; }
.events-list li { padding: 2px 0; border-bottom: 1px solid #233; }
.events-list li:last-child { border-bottom: none; }
.card-header {
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid #333;
display: flex;
gap: 0.5rem;
align-items: center;
}
.card h2 {
margin: 0 0 0.25rem 0;
color: #eef;
}
.ups-connection {
font-size: 0.8rem;
color: #999;
}
.metrics {
font-size: 0.9rem;
padding-bottom: 32px; /* Reserve space for footer */
position: relative;
}
.metric-row {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
}
.metric-row > div {
flex: 1;
}
.val {
font-weight: bold;
color: #4a9eff;
margin-bottom: 12px;
}
.ups-status {
display: inline-block;
padding: 2px 6px;
border-radius: 4px;
font-size: 0.8rem;
font-weight: bold;
padding: 3px 10px;
border-radius: var(--radius-sm);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: .5px;
border: 1px solid var(--border);
}
.ups-status.online { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.ups-status.onbattery { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.ups-status.unknown { background: var(--surface-2); color: var(--text-dim); }
.ups-status.offline { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.badge {
background: var(--surface-2);
padding: 3px 9px;
border-radius: 999px;
font-size: 10px;
letter-spacing: .5px;
color: var(--text-muted);
font-weight: 600;
border: 1px solid var(--border);
text-transform: uppercase;
}
.badge[data-badge="runtime"] { background: var(--surface-2); color: var(--accent); }
.badge[data-badge="watts"] { background: var(--surface-2); color: var(--info); }
.badge[data-badge="headroom"] { background: var(--surface-2); color: var(--warning); }
.badge[data-badge="energy"] { background: var(--surface-2); color: var(--success); }
.ups-status.online {
background-color: #155724;
color: #d4edda;
}
/* ------- Battery gauge ------- */
.gauge { width: 120px; height: 70px; position: relative; }
.gauge svg { width: 100%; height: 100%; }
.gauge-bg { fill: none; stroke: var(--surface-3); stroke-width: 10; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .4s ease, stroke .4s; }
.gauge-text { fill: var(--text); font-size: 16px; font-weight: 600; dominant-baseline: middle; }
.gauge.low .gauge-fill { stroke: var(--warning); }
.gauge.critical .gauge-fill { stroke: var(--danger); }
.gauge.good .gauge-fill { stroke: var(--success); }
.ups-status.onbattery {
background-color: #856404;
color: #fff3cd;
}
/* ------- Metrics layout ------- */
.metrics { font-size: 13px; padding-bottom: 28px; position: relative; }
.metric-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.metric-row > div { flex: 1; }
.val { font-weight: 600; color: var(--accent); }
.ups-status.unknown {
background-color: #383d41;
color: #d6d8db;
/* ------- Tile system ------- */
.tile-grid { position: relative; margin-top: 8px; min-height: 140px; }
.tile {
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 8px 10px;
position: absolute;
display: flex;
flex-direction: column;
min-height: 110px;
min-width: 140px;
box-sizing: border-box;
transition: border-color .15s;
}
.charts {
margin-top: 1rem;
.tile:hover { border-color: var(--border-hi); }
.tile h4 {
margin: 0 0 6px 0;
font-size: 10px;
letter-spacing: .5px;
text-transform: uppercase;
color: var(--text-dim);
font-weight: 600;
}
#ups-cards {
display: flex;
flex-wrap: wrap;
.tile .tile-body { flex: 1; display: flex; align-items: center; justify-content: center; }
.tile .big-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.tile canvas { width: 100% !important; height: 90px !important; }
.tile .gauge { margin: auto; }
.tile.small { min-height: 80px; }
.tile.hidden { display: none; }
.tile.dragging { opacity: 0.5; border: 1px dashed var(--accent); }
.tile.selected { outline: 2px solid var(--accent); }
.tile-controls { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.tile-controls select {
background: var(--surface-3);
border: 1px solid var(--border);
color: var(--text-muted);
font-size: 10px;
padding: 2px 4px;
border-radius: var(--radius-sm);
}
canvas.chart {
width: 300px;
margin-bottom: 0.5rem;
.tile-resize {
position: absolute; right: 4px; bottom: 4px; width: 12px; height: 12px;
cursor: nwse-resize; background: rgba(255,255,255,0.06);
border: 1px solid var(--border); border-radius: 2px;
}
.tile-resize:after {
content: ''; position: absolute; right: 2px; bottom: 2px;
width: 6px; height: 6px;
border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
}
/* ------- Card resize handle ------- */
.resize-handle {
position: absolute;
width: 14px;
height: 14px;
right: 4px;
bottom: 4px;
background: linear-gradient(135deg, #2f3b48 0%, #3e4c5c 60%, #4a5b6e 100%);
border: 1px solid #556;
width: 16px; height: 16px;
right: 4px; bottom: 4px;
background: var(--surface-3);
border: 1px solid var(--border-hi);
border-radius: 3px;
cursor: nwse-resize;
display: flex;
align-items: center;
justify-content: center;
font-size: 8px;
color: #9fb1c3;
color: var(--accent);
user-select: none;
opacity: 0.75;
transition: opacity .15s;
transition: opacity .15s, background .15s;
z-index: 20;
}
.resize-handle:hover { opacity: 1; }
.card.resizing { outline: 1px dashed #4a9eff; }
.empty-state {
text-align: center;
padding: 3rem;
color: #999;
width: 100%;
.resize-handle::before {
content: '';
width: 8px; height: 8px;
border-right: 2px solid currentColor;
border-bottom: 2px solid currentColor;
}
.resize-handle:hover { opacity: 1; background: var(--accent-dim); }
.empty-state h3 {
color: #eef;
margin-bottom: 0.5rem;
}
.empty-state a {
color: #4a9eff;
text-decoration: none;
}
.empty-state a:hover {
text-decoration: underline;
}
/* Mode toggle */
.mode-toggle {
margin-left: auto;
background: #2b3542;
color: #cdd6e2;
border: 1px solid #3a4756;
padding: 4px 6px;
border-radius: 4px;
/* ------- Card action buttons ------- */
.mode-toggle, .reset-layout-btn, .add-metric-btn {
background: var(--surface-2);
color: var(--text-muted);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 0.7rem;
padding: 4px 8px;
font-size: 12px;
transition: background .15s, color .15s, border-color .15s;
}
.mode-toggle:hover { background:#364250; }
.mode-toggle:hover, .reset-layout-btn:hover, .add-metric-btn:hover {
background: var(--surface-3);
color: var(--text);
border-color: var(--border-hi);
}
.add-metric-btn { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.reset-layout-btn { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
/* Add Metric Button */
.add-metric-btn { background:#2b3542; color:#9fb1c3; border:1px solid #3a4756; border-radius:4px; cursor:pointer; width:26px; height:26px; font-size:16px; line-height:1; display:flex; align-items:center; justify-content:center; }
.add-metric-btn:hover { background:#364250; }
/* ------- Events (legacy, used by some views) ------- */
.events { margin-top: 12px; }
.events-header {
font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
color: var(--text-dim); margin-bottom: 4px; font-weight: 600;
}
.events-list {
list-style: none; padding: 0; margin: 0;
max-height: 90px; overflow-y: auto;
font-size: 11px; line-height: 1.3;
}
.events-list li { padding: 3px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.events-list li:last-child { border-bottom: none; }
/* Reset layout button */
.reset-layout-btn { background:#2b3542; color:#9fb1c3; border:1px solid #3a4756; border-radius:4px; cursor:pointer; width:28px; height:26px; font-size:14px; display:flex; align-items:center; justify-content:center; }
.reset-layout-btn:hover { background:#364250; }
/* Metric Modal */
.metric-modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.55); display:flex; align-items:center; justify-content:center; z-index:1000; }
.metric-modal { background:#1d2530; border:1px solid #2c3846; padding:1rem 1.25rem; width:340px; border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,0.4); }
.metric-modal h3 { margin-top:0; margin-bottom:0.75rem; font-size:1rem; color:#eef; }
.metric-modal label { font-size:0.7rem; text-transform:uppercase; letter-spacing:1px; opacity:0.75; display:block; margin-top:0.75rem; margin-bottom:0.25rem; }
.metric-modal select, .metric-modal input { width:100%; background:#283240; color:#cdd6e2; border:1px solid #364250; border-radius:4px; padding:4px 6px; font-size:0.85rem; }
.metric-modal-actions { display:flex; justify-content:flex-end; gap:0.5rem; margin-top:1rem; }
.metric-modal button { background:#2b3542; border:1px solid #3a4756; color:#cdd6e2; padding:6px 10px; border-radius:4px; cursor:pointer; font-size:0.75rem; }
.metric-modal button.primary { background:#1f5d85; border-color:#2675aa; }
.metric-modal button.primary:hover { background:#2675aa; }
.metric-modal button:hover { background:#364250; }
/* Compact mode */
.card.compact .charts { display: none; }
.card.compact .events { display: none; }
.card.compact { min-height: 140px; }
.card.compact .metric-row { margin-bottom: 0.25rem; }
.card.compact .highline { margin-bottom: 0.4rem; }
/* Tile system */
.tile-grid { position: relative; margin-top: 0.6rem; min-height: 140px; }
.tile { background:#212b36; border:1px solid #2c3a48; border-radius:6px; padding:0.5rem 0.6rem; position:absolute; display:flex; flex-direction:column; min-height:110px; min-width:140px; box-sizing:border-box; }
.tile h4 { margin:0 0 0.4rem 0; font-size:0.7rem; letter-spacing:1px; text-transform:uppercase; opacity:0.7; font-weight:600; }
.tile .tile-body { flex:1; display:flex; align-items:center; justify-content:center; }
.tile .big-value { font-size:1.4rem; font-weight:600; color:#4a9eff; }
.tile canvas { width:100%!important; height:90px!important; }
.tile .gauge { margin:auto; }
.tile-controls { position:absolute; top:4px; right:4px; display:flex; gap:4px; }
.tile-controls select { background:#2b3542; border:1px solid #364250; color:#cdd6e2; font-size:0.6rem; padding:2px 4px; border-radius:4px; }
.tile.small { min-height:80px; }
.tile.hidden { display:none; }
.tile.dragging { opacity:0.5; border:1px dashed #4a9eff; }
.tile.selected { outline:2px solid #4a9eff; }
.tile-resize { position:absolute; right:4px; bottom:4px; width:12px; height:12px; cursor:nwse-resize; background:rgba(255,255,255,0.08); border:1px solid #3a4756; border-radius:2px; }
.tile-resize:after { content:''; position:absolute; right:2px; bottom:2px; width:6px; height:6px; border-right:2px solid #4a9eff; border-bottom:2px solid #4a9eff; }
/* Event footer */
.ups-footer {
/* ------- Footer marquee ------- */
.ups-footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
font-size: 0.65rem;
color: #9fb1c3;
border-top: 1px solid #2c3a48;
padding: 4px 8px;
min-height: 20px;
white-space: nowrap;
overflow: hidden;
background: rgba(29, 37, 48, 0.95);
border-radius: 0 0 8px 8px;
bottom: 0; left: 0; right: 0;
font-size: 11px;
color: var(--text-dim);
border-top: 1px solid var(--border);
padding: 5px 10px;
min-height: 22px;
white-space: nowrap;
overflow: hidden;
background: var(--surface);
border-radius: 0 0 var(--radius-lg) var(--radius-lg);
z-index: 10;
box-sizing: border-box;
}
.ups-footer .event-marquee { display: inline-block; animation: marquee 18s linear infinite; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }
/* Value tile display */
.big-value-container {
text-align: center;
display: flex;
align-items: baseline;
justify-content: center;
gap: 4px;
height: 100%;
padding: 10px;
/* ------- Big-value tile ------- */
.big-value-container {
text-align: center;
display: flex; align-items: baseline; justify-content: center;
gap: 4px; height: 100%; padding: 10px;
}
.big-value-container .big-value {
font-size: 2rem;
font-weight: 600;
color: #4a9eff;
}
.big-value-container .value-unit {
font-size: 0.9rem;
color: #9fb1c3;
font-weight: normal;
.big-value-container .big-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.big-value-container .value-unit { font-size: 0.9rem; color: var(--text-dim); font-weight: normal; }
/* Voltage status (within spec/out of spec) */
.voltage-good { color: var(--success) !important; }
.voltage-bad { color: var(--danger) !important; }
/* Legend */
.legend-badge {
background: var(--surface-2);
padding: 2px 8px;
border-radius: 999px;
font-size: 10px;
margin: 2px;
display: inline-block;
color: var(--text-muted);
border: 1px solid var(--border);
}
/* Voltage color coding based on US electrical specs */
.voltage-good {
color: #22c55e !important; /* Green for voltage in acceptable range (114V-126V) */
}
.voltage-bad {
color: #ef4444 !important; /* Red for voltage out of acceptable range */
}
/* ------- Compact mode ------- */
.card.compact .charts, .card.compact .events, .card.compact .tile-grid { display: none; }
.card.compact { min-height: 140px; }
.card.compact .metric-row { margin-bottom: 0.25rem; }
.card.compact .highline { margin-bottom: 0.4rem; }
@keyframes marquee { 0% { transform:translateX(0); } 100% { transform:translateX(-100%); } }
.legend-badge { background:#243140; padding:2px 6px; border-radius:10px; font-size:0.6rem; margin:2px; display:inline-block; }
.card.compact .tile-grid { display:none; }
/* ------- Metric modal ------- */
.metric-modal-backdrop {
position: fixed; inset: 0;
background: rgba(0,0,0,0.6);
display: flex; align-items: center; justify-content: center;
z-index: 1000;
backdrop-filter: blur(2px);
}
.metric-modal {
background: var(--surface);
border: 1px solid var(--border);
padding: 18px 20px;
width: 360px;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
}
.metric-modal h3 { margin-top: 0; margin-bottom: 12px; font-size: 15px; }
.metric-modal label {
font-size: 10px;
text-transform: uppercase;
letter-spacing: .5px;
color: var(--text-dim);
display: block;
margin-top: 12px;
margin-bottom: 4px;
font-weight: 600;
}
.metric-modal select, .metric-modal input {
width: 100%;
background: var(--surface-2);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius-sm);
padding: 6px 10px;
font-size: 13px;
}
.metric-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.metric-modal button {
background: var(--surface-2);
border: 1px solid var(--border);
color: var(--text);
padding: 7px 14px;
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 13px;
transition: background .15s;
}
.metric-modal button:hover { background: var(--surface-3); }
.metric-modal button.primary { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.metric-modal button.primary:hover { background: var(--accent); }