:root {
  --bg: #eef3f7;
  --card: #ffffff;
  --text: #182033;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #0f766e;
  --blue-dark: #115e59;
  --yellow: #f59e0b;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}
.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px;
}
.hero {
  background: linear-gradient(135deg, #0f766e, #134e4a);
  color: #fff;
  border-radius: 22px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.hero h1 { margin: 0 0 4px; font-size: 28px; }
.hero p { margin: 0; opacity: 0.92; }
.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 10px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
#connectionDot {
  width: 10px;
  height: 10px;
  background: var(--yellow);
  border-radius: 50%;
  display: inline-block;
}
.toolbar, .summary, .device-section {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
}
.toolbar {
  padding: 12px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  background: white;
}
button {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
  font-size: 15px;
  color: white;
  background: var(--blue);
}
button:hover { background: var(--blue-dark); }
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 12px;
  overflow: hidden;
}
.summary div {
  padding: 14px;
  border-right: 1px solid var(--line);
}
.summary div:last-child { border-right: none; }
.summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.summary strong { font-size: 26px; }
.lights { display: grid; gap: 12px; }
.device-section { overflow: hidden; }
.device-title {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.device-title h2 { margin: 0 0 5px; font-size: 20px; }
.device-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.online { background: #dcfce7; color: #166534; }
.badge.offline { background: #fee2e2; color: #991b1b; }
.light-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}
.light-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fff;
}
.light-card h3 { margin: 0 0 6px; font-size: 17px; }
.light-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}
.light-button {
  width: 100%;
  min-height: 58px;
  font-size: 20px;
  border-radius: 18px;
}
.light-button.on { background: var(--green); }
.light-button.off { background: var(--red); }
.light-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.loading, .empty {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 700px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 24px; }
  .toolbar { grid-template-columns: 1fr; }
  .light-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .app { padding: 8px; }
  .summary { grid-template-columns: 1fr; }
  .summary div {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .summary div:last-child { border-bottom: none; }
}
