:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --border: #e2e2dd;
  --accent: #2563eb;
  --warn: #b45309;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #1f1f1d;
    --text: #ececea;
    --muted: #a0a09a;
    --border: #33332f;
    --accent: #60a5fa;
    --warn: #f59e0b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header, main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 8px; color: var(--muted); font-weight: 600; }

nav { display: flex; gap: 12px; align-items: center; }

.ranges { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }

.ranges button {
  border: 0;
  background: var(--surface);
  color: var(--text);
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
}

.ranges button + button { border-left: 1px solid var(--border); }
.ranges button[aria-pressed="true"] { background: var(--accent); color: #fff; }

button.link {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 6px 0;
}

#status { color: var(--muted); margin: 0 0 12px; min-height: 1.5em; }

#cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card, .chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.card .room { font-weight: 600; }
.card .temp { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .meta { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.card .stale { color: var(--warn); }

.chart { margin-bottom: 16px; }
.canvas-wrap { position: relative; height: 300px; }
