:root {
  color-scheme: light;
  --ink: #18241f;
  --muted: #5e6b64;
  --line: #d9e0dc;
  --panel: #ffffff;
  --surface: #f5f7f4;
  --brand: #0f7d5b;
  --brand-dark: #084936;
  --heat: #d34f25;
  --amber: #c38a14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, Segoe UI, system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(18px, 4vw, 48px);
  background: var(--brand-dark);
  color: white;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-actions label {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  padding: 0 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar .eyebrow {
  color: #82e0be;
}

.status-pill {
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.overview,
.panel,
.sensor-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 12px;
}

.metrics div {
  border-left: 3px solid var(--brand);
  padding-left: 12px;
}

.metrics span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

small,
.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, .9fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 18px;
}

.panel-header,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
}

canvas {
  width: 100%;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.rules {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.sensor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.section-heading {
  margin-top: 24px;
}

.sensor-card {
  padding: 16px;
}

.sensor-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f5ef;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.badge.offline {
  background: #fff1e7;
  color: var(--heat);
}

.probe {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.probe span:first-child {
  display: grid;
}

.probe:last-child {
  padding-bottom: 0;
}

.temp {
  font-size: 22px;
  font-weight: 900;
}

.temp.hot {
  color: var(--heat);
}

.alarm-log {
  display: grid;
  gap: 10px;
}

.public-list {
  display: grid;
  gap: 12px;
}

.public-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.public-item strong,
.public-item small {
  display: block;
}

.public-item p {
  margin: 8px 0;
}

.alarm {
  border-left: 4px solid var(--amber);
  padding: 10px 12px;
  background: #fffaf0;
}

.alarm strong {
  display: block;
}

.api-box {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #eef2ef;
  padding: 9px;
}

@media (max-width: 820px) {
  .topbar,
  .top-actions,
  .overview,
  .panel-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid,
  .sensor-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    width: 100%;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 28px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
