:root {
  --ink: #1b2420;
  --muted: #5d6b64;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #e4dcd0;
  --forest: #16352c;
  --forest-soft: #21493d;
  --gas: #c4622d;
  --elec: #1e4f7a;
  --sun: #2c7a4b;
  --heat: #8d3d3a;
  --gold: #a67c2d;
  --shadow: 0 1px 0 rgba(22, 53, 44, 0.04);
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, .kpi strong { font-family: Palatino, "Iowan Old Style", Georgia, serif; font-weight: 500; }
h1 { margin: 0; font-size: 2rem; letter-spacing: -0.03em; }
h2 { margin: 0; font-size: 1.8rem; letter-spacing: -0.03em; }
h3 { margin: 0; font-size: 1.15rem; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
aside {
  background: var(--forest);
  color: #f6f1e7;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand-kicker, .eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}
.brand-kicker { color: #c9b89a; }
.brand-sub { margin: 8px 0 0; color: #d5e4dc; font-size: 0.92rem; }
nav { display: flex; flex-direction: column; gap: 6px; }
.nav, button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.nav { color: #e7f0eb; }
a.nav { display: block; text-decoration: none; }
.nav.active, .nav:hover { background: var(--forest-soft); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 28px 24px; }
.login-card h2 { margin-bottom: 0; }
.login-card label { display: grid; gap: 6px; }
.login-card button {
  background: var(--forest);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  justify-self: start;
}
.side-status { margin-top: auto; display: grid; gap: 10px; font-size: 0.86rem; color: #d7e3dc; }
.pill {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
}
.pill b { display: block; color: white; font-weight: 600; }

main { padding: 28px 32px 48px; }
.top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 18px; }
.eyebrow { color: var(--muted); }
.range, .toggles, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range button, .row button, .form button {
  background: var(--forest);
  color: white;
  border-radius: 999px;
  padding: 8px 14px;
}
.range button { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.range button.active { background: var(--forest); color: white; border-color: var(--forest); }
.dates { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 0.9rem; }
input[type="date"], input[type="email"], input[type="password"], select {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
}
.banner, .warnings, .insight {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.banner { background: #f4e7d4; color: #6a4314; }
.warnings { background: #f8e8e4; color: #6d322c; }
.insight { background: #e7f0ea; color: #1d4334; }
.live { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.room {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 140px;
  box-shadow: var(--shadow);
}
.room span { display: block; color: var(--muted); font-size: 0.8rem; }
.room strong { font-size: 1.35rem; }
.room em { font-style: normal; color: var(--heat); font-size: 0.78rem; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpis.compact { grid-template-columns: repeat(4, minmax(110px, 1fr)); margin: 0; }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi span { display: block; color: var(--muted); font-size: 0.78rem; }
.kpi strong { font-size: 1.55rem; letter-spacing: -0.03em; }
.kpi small { color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.toggles label { display: flex; gap: 6px; align-items: center; font-size: 0.88rem; color: var(--muted); }
.swatch { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }
.swatch.gas { background: var(--gas); }
.swatch.elec { background: var(--elec); }
.swatch.sun { background: var(--sun); }
.swatch.heat { background: var(--heat); }
.swatch.gold { background: var(--gold); }
.swatch.outdoor { background: #5d6b73; }
.chart-wrap { position: relative; }
canvas { width: 100%; height: 280px; display: block; cursor: pointer; }
#temp-chart { height: 300px; }
#hour-chart { height: 220px; }
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--forest);
  color: white;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  z-index: 2;
}
.hint, .fine, .muted { color: var(--muted); }
.hint, .fine { font-size: 0.82rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f3ec; }
.back {
  background: transparent;
  padding: 0 0 12px;
  color: var(--forest);
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; font-size: 0.9rem; }
.ghost { background: transparent !important; color: var(--ink) !important; border: 1px solid var(--line); }
.code {
  font-family: ui-monospace, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
}
.profiles { display: grid; gap: 8px; }
.profiles label { grid-template-columns: auto 1fr; align-items: center; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  aside { padding: 18px; gap: 14px; }
  nav { flex-direction: row; }
  .side-status { margin-top: 0; grid-template-columns: 1fr 1fr; }
  .kpis, .split, .top { grid-template-columns: 1fr; display: grid; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 18px 14px 36px; }
  .card-head { align-items: flex-start; flex-direction: column; }
}
