:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #edf2ef;
  color: #172126;
}

* { box-sizing: border-box; }

body { margin: 0; }

main {
  width: min(100%, 740px);
  margin: 0 auto;
  padding: 24px 16px 42px;
}

.topbar, .section-heading, .controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar { margin-bottom: 22px; }

h1, h2, p { margin: 0; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 20px; letter-spacing: 0; }
.eyebrow, .label { color: #637178; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.eyebrow { margin-bottom: 4px; }

.connection {
  border-radius: 999px;
  background: #dce8e0;
  color: #225436;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.connection.error { background: #f7dfdc; color: #8c2720; }

.current {
  background: #14323a;
  border-radius: 8px;
  color: #f5faf7;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  overflow: hidden;
}

.current-reading { padding: 28px 22px; }
.current .label { color: #acc1bc; }
.temperature { font-size: 56px; font-weight: 750; line-height: 1; margin: 10px 0 8px; }
.temperature span { color: #b8d1c8; font-size: 20px; margin-left: 5px; }
.updated { color: #b8d1c8; font-size: 13px; }

.metrics { background: #1e434b; display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 17px; }
.metrics div { padding: 10px 6px; }
.metrics dt { color: #b8d1c8; font-size: 12px; }
.metrics dd { font-size: 17px; font-weight: 700; margin: 4px 0 0; }

.controls {
  border-bottom: 1px solid #cbd6d0;
  padding: 18px 0;
}
.monitoring-copy { font-size: 14px; margin-top: 3px; }

.switch { cursor: pointer; display: inline-flex; }
.switch input { position: absolute; opacity: 0; }
.switch span { background: #9ba9a4; border-radius: 16px; height: 28px; position: relative; transition: background .2s; width: 50px; }
.switch span::after { background: #fff; border-radius: 50%; content: ""; height: 22px; left: 3px; position: absolute; top: 3px; transition: transform .2s; width: 22px; }
.switch input:checked + span { background: #197352; }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid #4b90b8; outline-offset: 2px; }

button {
  appearance: none;
  background: #fff;
  border: 1px solid #aebcb6;
  border-radius: 5px;
  color: #172126;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 11px;
}
button:hover { background: #e6efea; }
button:disabled { cursor: wait; opacity: .6; }
.measure-button { background: #197352; border-color: #197352; color: #fff; }
.measure-button:hover { background: #115c40; }

.chart-section { padding-top: 25px; }
.chart-summary { color: #637178; font-size: 13px; }
.range-picker { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.range-picker button { min-width: 47px; }
.range-picker button.active { background: #14323a; border-color: #14323a; color: #fff; }

.chart-wrap { background: #fff; border: 1px solid #cad5cf; border-radius: 6px; height: 285px; position: relative; }
canvas { display: block; height: 100%; width: 100%; }
.empty-chart { color: #637178; left: 0; position: absolute; right: 0; text-align: center; top: 47%; }

.custom-range { align-items: end; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.custom-range label { color: #4d5c61; display: grid; font-size: 12px; font-weight: 700; gap: 5px; }
input[type="datetime-local"] { border: 1px solid #aebcb6; border-radius: 5px; color: #172126; font: inherit; height: 38px; max-width: 190px; padding: 6px; }

@media (max-width: 560px) {
  .current { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .metrics div { padding: 5px 3px; }
  .metrics dd { font-size: 15px; }
  .controls { align-items: center; flex-wrap: wrap; }
  .measure-button { flex-basis: 100%; }
  .chart-wrap { height: 250px; }
}
