:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --surface: #121418;
  --surface-2: #17191e;
  --line: #26292f;
  --text: #f3f5f7;
  --muted: #8b919b;
  --blue: #70b8ff;
  --green: #72dfa1;
  --amber: #f2c76e;
  --red: #ff7777;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.dashboard {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0 32px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(27px, 3.4vw, 42px);
  line-height: 1;
  letter-spacing: -.045em;
}

h1 span { color: #696f78; font-weight: 520; }

.status-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status.healthy { color: var(--green); }
.status.warning { color: var(--amber); }
.status.alert { color: var(--red); }
.status.offline { color: var(--muted); }

#updated { color: var(--muted); font-size: 12px; }

.primary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-card,
.metric,
.chart-card {
  border: 1px solid var(--line);
  background: var(--surface);
}

.primary-card {
  min-height: 220px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.hero-value {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: auto 0 14px;
  line-height: .8;
}

.hero-value strong {
  font-size: clamp(74px, 10vw, 118px);
  font-weight: 580;
  letter-spacing: -.075em;
}

.hero-value span { color: var(--muted); font-size: 22px; font-weight: 550; }
.temperature-card .hero-value strong { color: var(--blue); }
.fan-card .hero-value strong { color: var(--green); }
.hint { margin: 0; color: var(--muted); font-size: 13px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.metric { padding: 19px 20px; }
.metric p { margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.metric strong { font-size: 30px; font-weight: 590; letter-spacing: -.045em; }
.metric span { margin-left: 5px; color: var(--muted); font-size: 12px; }
.metric-detail { min-height: 14px; margin-top: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.metric-detail span { margin-left: 0; font-size: inherit; }

.chart-card { margin-top: 12px; padding: 24px; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.025em; }

.ranges {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.ranges button {
  min-width: 42px;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.ranges button:hover { color: var(--text); }
.ranges button.active { background: var(--surface-2); color: var(--text); }
.ranges button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.legend {
  display: flex;
  gap: 22px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  margin: 0 7px 3px 0;
  background: currentColor;
}

.temperature-key { color: var(--blue); }
.fan-key { color: var(--green); }
.chart-wrap { position: relative; min-height: 292px; margin-top: 10px; }
#chart { display: block; width: 100%; height: 292px; }
.chart-message { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 13px; }
.chart-message.hidden { display: none; }

footer {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  padding-top: 14px;
  color: #5f646d;
  font-size: 10px;
  letter-spacing: .04em;
}

@media (max-width: 700px) {
  .dashboard { width: min(100% - 28px, 560px); padding-top: 30px; }
  .masthead { align-items: flex-start; margin-bottom: 22px; }
  h1 span { display: block; margin-top: 8px; font-size: 16px; letter-spacing: -.02em; }
  .status-wrap { gap: 6px; }
  .primary-grid { grid-template-columns: 1fr; }
  .primary-card { min-height: 168px; padding: 19px; }
  .hero-value { margin-top: 34px; }
  .hero-value strong { font-size: 72px; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric { padding: 15px 13px; }
  .metric p { min-height: 28px; margin-bottom: 7px; }
  .metric strong { font-size: 24px; }
  .chart-card { padding: 19px 14px 14px; }
  .chart-head { display: block; }
  .ranges { width: 100%; margin-top: 18px; }
  .ranges button { flex: 1; }
  .chart-wrap, #chart { min-height: 220px; height: 220px; }
  footer { justify-content: center; }
}

@media (max-width: 390px) {
  .metric-grid { gap: 6px; }
  .metric strong { font-size: 21px; }
  .metric span { margin-left: 2px; }
  footer { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
