:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --border: #e2e5ea;
  --accent: #2563eb;
  --on: #16a34a;
  --off: #6b7280;
  --danger: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1d2026;
    --text: #f1f2f4;
    --muted: #9aa1ac;
    --border: #2c3038;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 18px; margin: 0; }
main { max-width: 960px; margin: 0 auto; padding: 24px; }
section { margin-bottom: 32px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 12px; }
.house-group { margin-bottom: 20px; }
.house-group h3 { margin: 0 0 8px; font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.card .name { font-weight: 600; margin-bottom: 4px; }
.card .watts { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.toggle-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.toggle-btn.on { background: var(--on); color: white; }
.toggle-btn.off { background: var(--off); color: white; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
input, select, button {
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
button.primary { background: var(--accent); color: white; border: none; cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.login-box {
  max-width: 320px;
  margin: 15vh auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.login-box h1 { font-size: 18px; margin-top: 0; }
.login-box input { width: 100%; margin-bottom: 10px; }
.login-box button { width: 100%; }
