Files
mongoose/tutorials/device-dashboard/full-dashboard/web_root/style.css
T
2026-04-19 08:58:14 +01:00

435 lines
7.7 KiB
CSS

/* Custom CSS for Dashboard */
:root {
--color-surface-sunken: #e9eff5;
--color-border-default: #d8e0ea;
--color-text-toolbar: rgb(71, 85, 105);
--color-text-strong: #24364d;
--color-accent-border: #bae6fd;
--color-accent-text: #0369a1;
--color-surface-elevated: #ffffff;
--font-size-body: 14px;
--font-size-toolbar: 1rem;
--max-width: 80rem;
--spacing-1: 0.25rem;
--spacing-2: 0.5rem;
--spacing-3: 0.75rem;
--spacing-4: 1rem;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: var(--font-size-body);
line-height: 1.5;
min-height: 100vh;
color: var(--color-text-strong);
}
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 50;
}
.header-container {
max-width: var(--max-width);
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--spacing-4);
padding: var(--spacing-2) var(--spacing-3);
}
.header-left {
display: flex;
align-items: center;
gap: var(--spacing-4);
}
.header-actions {
display: inline-flex;
align-items: center;
justify-content: flex-end;
gap: var(--spacing-3);
flex-wrap: wrap;
}
.logo {
height: 2.8rem;
margin-right: 1rem;
width: auto;
}
.connection-badge {
display: inline-flex;
align-items: center;
gap: 0.4rem;
color: rgb(4, 120, 87);
border: 1px solid rgb(167, 243, 208);
background: rgb(236, 253, 245);
padding: 4px 14px;
border-radius: 14px;
font-weight: 600;
}
.connection-dot {
width: 11px;
height: 11px;
border-radius: 50%;
background: rgb(16, 185, 129);
flex-shrink: 0;
}
.nav-tabs {
display: inline-flex;
align-items: center;
gap: var(--spacing-2);
background: rgb(248, 250, 252);
border: 1px solid rgb(226, 232, 240);
padding: calc(var(--spacing-1) + 2px);
border-radius: 1rem;
box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.05) 0px 2px 4px 0px inset;
}
.nav-link {
display: inline-flex;
align-items: center;
border-radius: 0.75rem;
border: 1px solid transparent;
padding: var(--spacing-2) var(--spacing-4);
font-weight: 600;
letter-spacing: -0.01em;
color: var(--color-text-toolbar);
background-color: transparent;
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
gap: var(--spacing-2);
text-decoration: none;
}
.nav-link-active {
color: rgb(3, 105, 161);
background: #fff;
border: 1px solid rgb(186, 230, 253);
}
.nav-link:hover {
}
.nav-icon {
height: 1rem;
width: 1rem;
flex-shrink: 0;
}
.tab-stage {
max-width: var(--max-width);
margin: 0 auto;
padding: 5.5rem var(--spacing-3) var(--spacing-3);
}
.tab-panel {
min-height: calc(100vh - 6rem);
/* border-radius: .5rem; */
/* background-color: #eee; */
/* border: 1px solid rgba(216, 224, 234, 0.78); */
/* padding: var(--spacing-4); */
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.72),
0 18px 40px rgba(148, 163, 184, 0.1);
}
.overview-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1rem;
}
.metric-tile {
padding: 0.75rem 1.5rem 0.75rem;
border-radius: 1rem;
background: #ffffff;
border: 1px solid rgba(203, 213, 225, 0.75);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 1),
0 2px 6px rgba(148, 163, 184, 0.1),
0 8px 24px rgba(148, 163, 184, 0.08);
display: flex;
flex-direction: column;
gap: 0.35rem;
transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.metric-tile:hover {
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 1),
0 4px 12px rgba(148, 163, 184, 0.18),
0 12px 32px rgba(148, 163, 184, 0.12);
transform: translateY(-1px);
}
.metric-label {
color: #94a3b8;
font-size: 0.9rem;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.metric-value {
display: flex;
align-items: baseline;
gap: 0.2rem;
color: #475569;
}
.metric-number {
font-size: 2rem;
font-weight: 700;
letter-spacing: -0.04em;
line-height: 1.1;
}
.metric-unit {
font-size: 1rem;
font-weight: 600;
color: #cbd5e1;
letter-spacing: -0.01em;
}
.metric-status {
font-size: 0.78rem;
font-weight: 600;
margin-top: 0.1rem;
display: none;
}
.metric-status-good {
color: #16a34a;
}
.metric-status-warn {
color: #d97706;
}
.metric-status-info {
color: #0369a1;
}
.tab-panel[hidden] {
display: none;
}
/* ── Detail row (chart + controls) ─────────────────────────────── */
.detail-row {
display: grid;
grid-template-columns: 1fr 300px;
gap: 1rem;
margin-top: 1rem;
align-items: stretch;
}
.panel {
background: #ffffff;
border: 1px solid rgba(203, 213, 225, 0.75);
border-radius: 1rem;
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 1),
0 2px 6px rgba(148, 163, 184, 0.1),
0 8px 24px rgba(148, 163, 184, 0.08);
padding: 1.5rem;
display: flex;
flex-direction: column;
}
.panel-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 1.1rem;
}
.panel-title {
font-size: 1.05rem;
font-weight: 700;
color: #18314f;
margin-bottom: 0.2rem;
}
.panel-subtitle {
color: #7d94ac;
font-size: 0.8rem;
}
/* Chart */
.chart-panel {
/* column flex already set by .panel */
}
.chart-wrapper {
flex: 1;
display: flex;
flex-direction: column;
min-height: 180px;
}
#chart {
width: 100%;
height: 12rem;
}
.chart-x-labels {
display: flex;
justify-content: space-between;
margin-top: 0.6rem;
color: #94a3b8;
font-size: 0.72rem;
font-weight: 500;
}
.chart-legend {
display: flex;
align-items: center;
gap: 1rem;
flex-shrink: 0;
}
.legend-item {
display: flex;
align-items: center;
gap: 0.35rem;
font-size: 0.75rem;
color: #5d7088;
font-weight: 600;
}
.legend-dot {
width: 10px;
height: 10px;
border-radius: 50%;
flex-shrink: 0;
}
.legend-dot-color2 { background: rgba(237, 126, 23, 1); }
.legend-dot-color1 { background: rgba(5, 141, 199, 1) }
/* Controls */
.controls-panel {
/* column flex already set by .panel */
}
.controls-list {
display: flex;
flex-direction: column;
flex: 1;
margin-top: 0.25rem;
}
.control-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem 0;
border-bottom: 1px solid #e8eef5;
}
.control-row:last-child {
border-bottom: none;
}
.control-name {
font-size: 0.88rem;
font-weight: 700;
color: #18314f;
margin-bottom: 0.15rem;
}
.control-desc {
font-size: 0.75rem;
color: #7d94ac;
}
/* Toggle switch */
.toggle {
position: relative;
display: inline-block;
width: 3rem;
height: 1.65rem;
cursor: pointer;
flex-shrink: 0;
}
.toggle input {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
.toggle-track {
position: absolute;
inset: 0;
border-radius: 999px;
background: #cbd5e1;
transition: background 0.22s ease;
}
.toggle-track::before {
content: '';
position: absolute;
width: 1.25rem;
height: 1.25rem;
border-radius: 50%;
background: #ffffff;
top: 50%;
left: 0.2rem;
transform: translateY(-50%);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
transition: left 0.22s ease;
}
.toggle input:checked + .toggle-track {
background: linear-gradient(135deg, #10b981, #06b6d4);
}
.toggle input:checked + .toggle-track::before {
left: calc(100% - 1.45rem);
}
.toggle input:focus-visible + .toggle-track {
outline: 2px solid #0ea5e9;
outline-offset: 2px;
}
@media (max-width: 900px) {
.detail-row {
grid-template-columns: 1fr;
}
}
@media (max-width: 900px) {
.overview-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 480px) {
.overview-grid {
grid-template-columns: 1fr;
}
}