Files
mongoose/tutorials/device-dashboard/web_root/style.css
T
2026-04-21 17:00:47 +01:00

579 lines
11 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;
--spacing-5: 1.25rem;
--spacing-6: 1.5rem;
}
* {
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-4);
}
.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;
white-space: nowrap;
}
.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-4) var(--spacing-4);
}
.tab-panel {
min-height: calc(100vh - 6rem);
}
.overview-grid {
display: grid;
grid-template-columns: repeat(5, 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-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
}
.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.72rem;
font-weight: 700;
letter-spacing: 0.07em;
text-transform: uppercase;
padding: 0.18rem 0.52rem;
border-radius: 0.4rem;
border: 1px solid transparent;
white-space: nowrap;
}
.metric-status-good {
color: #166534;
background: #dcfce7;
border-color: #86efac;
}
.metric-status-warn {
color: #92400e;
background: #fef3c7;
border-color: #fcd34d;
}
.metric-status-alert {
color: #991b1b;
background: #fee2e2;
border-color: #fca5a5;
}
.metric-status-info {
color: #075985;
background: #e0f2fe;
border-color: #7dd3fc;
}
.tab-panel[hidden] {
display: none;
}
/* ── Panel ──────────────────────────────────────── */
.panel-layout {
padding-top: 1rem;
max-width: 22rem;
}
.panel-body {
display: flex;
flex-direction: column;
gap: 0.75rem;
padding: 1rem 1.25rem;
flex: 1;
}
.panel-footer {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.5rem;
padding: 0.75rem 1.25rem;
border-top: 1px solid #e2e8f0;
}
/* ── Form fields ─────────────────────────────────── */
.field {
display: flex;
flex-direction: row;
align-items: center;
gap: 0.75rem;
}
.field-label {
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
color: #94a3b8;
width: 4.5rem;
flex-shrink: 0;
}
.field-input {
flex: 1;
min-width: 0;
padding: 0.45rem 0.75rem;
font-size: 0.88rem;
font-family: inherit;
color: #334155;
border: 1px solid #e2e8f0;
border-radius: 0.55rem;
outline: none;
transition: border-color 0.15s ease;
}
.field-input.edited, .select.edited, .slider.edited>* {
border-color: #00502040;
background: #00ff0020;
}
.field-input.error, .select.error, .slider.error>* {
border-color: #50000040;
background: #ff000020;
}
.field-input::placeholder {
color: #cbd5e1;
}
.field-input:hover {
border-color: #cbd5e1;
}
.field-input:focus {
border-color: #7dd3fc;
}
.field-input:disabled,
.field-input.disabled {
color: #cbd5e1;
border-color: #e2e8f0;
cursor: not-allowed;
pointer-events: none;
}
.select:disabled,
.select.disabled {
color: #cbd5e1;
border-color: #e2e8f0;
cursor: not-allowed;
pointer-events: none;
}
/* ── Buttons ─────────────────────────────────────── */
.btn {
display: inline-flex;
align-items: center;
padding: 0.42rem 1rem;
font-size: 0.82rem;
font-family: inherit;
font-weight: 600;
border-radius: 0.55rem;
border: 1px solid transparent;
cursor: pointer;
transition: all 0.15s ease;
white-space: nowrap;
}
.btn-secondary {
color: #64748b;
background: #ffffff;
border-color: #e2e8f0;
box-shadow: 0 1px 2px rgba(148, 163, 184, 0.1);
}
.btn-secondary:hover {
background: #f1f5f9;
border-color: #cbd5e1;
color: #475569;
}
.btn-primary {
color: #ffffff;
background: linear-gradient(160deg, #38bdf8, #0ea5e9);
border-color: #0284c7;
box-shadow: 0 1px 3px rgba(14, 165, 233, 0.3), 0 4px 10px rgba(14, 165, 233, 0.15);
}
.btn-primary:hover {
background: linear-gradient(160deg, #0ea5e9, #0284c7);
box-shadow: 0 1px 3px rgba(14, 165, 233, 0.4), 0 6px 14px rgba(14, 165, 233, 0.2);
}
.btn-primary:active,
.btn-secondary:active {
transform: translateY(0);
}
.btn:disabled,
.btn.disabled {
opacity: 0.45;
cursor: not-allowed;
pointer-events: none;
box-shadow: none;
transform: 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);
overflow: hidden;
display: flex;
flex-direction: column;
}
.panel-title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 0.95rem;
font-weight: 700;
color: #334155;
padding: 1rem 1.25rem 0.9rem;
border-bottom: 1px solid #e2e8f0;
flex-shrink: 0;
}
/* 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-panel {
/* column flex already set by .panel */
}
.controls-list {
display: flex;
flex-direction: column;
flex: 1;
}
.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 {
position: relative;
width: 2.75rem;
height: 1.6rem;
margin: 0;
vertical-align: top;
border: 1px solid transparent;
background: #d1d5db;
border-radius: 0.75rem;
outline: none;
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.toggle::after {
content: "";
position: absolute;
left: 1px;
top: 1px;
width: 1.35rem;
height: 1.35rem;
background: #fff;
border-radius: 50%;
transition: all 0.3s;
}
.toggle:checked {
background: #d1d5db;
}
.toggle:checked::after {
transform: translateX(calc(100% - 3px));
}
.toggle:disabled,
.toggle.disabled {
background: #d1d5db;
cursor: not-allowed;
}
.toggle.edited {
border-color: #0fe;
}
@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;
}
}