Files
apcupsd-client/app/static/css/style.css
T
Ketan Patel acb6b25657
Build and Deploy / build-and-deploy (push) Successful in 27s
Honor dashboard UI config flags
2026-06-20 10:52:12 -04:00

324 lines
10 KiB
CSS

/* ============================================================
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;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
padding: 16px 18px 28px;
border-radius: var(--radius-lg);
position: relative;
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); }
#ups-cards.resize-disabled .card { resize: none; }
.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: 6px;
align-items: center;
margin-bottom: 12px;
}
.ups-status {
display: inline-block;
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); }
/* ------- 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); }
/* ------- 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); }
/* ------- 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;
}
.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;
}
.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 .energy-summary { flex-direction: column; gap: 4px; text-align: center; }
.tile .energy-summary .big-value { font-size: 18px; line-height: 1.2; }
.tile .energy-cost { color: var(--success); font-size: 13px; font-weight: 700; }
.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);
}
.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: 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;
color: var(--accent);
user-select: none;
opacity: 0.75;
transition: opacity .15s, background .15s;
z-index: 20;
}
.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); }
/* ------- 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;
padding: 4px 8px;
font-size: 12px;
transition: background .15s, color .15s, border-color .15s;
}
.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; }
/* ------- 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; }
/* ------- Footer marquee ------- */
.ups-footer {
position: absolute;
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%); } }
/* ------- 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: 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);
}
/* ------- 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; }
/* ------- 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); }