* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: #121212;
  color: #fff;
}
header {
  background-color: #1f1f1f;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo {
  height: 36px;
  max-width: 160px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  padding: 1px 5px;
}
.device-selector {
  background: #2c2c2c;
  border: none;
  padding: 0.4rem;
  color: #fff;
  border-radius: 5px;
  font-size: 1rem;
}
.nav-links {
  display: flex;
  gap: 1rem;
}
.nav-links a {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background-color 0.3s;
  font-size: 1rem;
}
.nav-links a:hover, .nav-links a.active {
  background-color: #00ff88;
  color: #000;
}
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 1rem;
  padding: 2px 0;
  z-index: 110;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 4px;
  background: #fff;
  border-radius: 2px;
  transition: 0.4s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px);}
.hamburger.open span:nth-child(2) { opacity: 0;}
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(6px, -7px);}
@media (max-width: 900px) { .nav-links { gap: 0.5rem; } }
@media (max-width: 700px) {
  .header-left { flex-direction: column; align-items: flex-start; gap: 0.3rem;}
  .logo { max-width: 110px;}
}
@media (max-width: 600px) {
  header { flex-wrap: wrap; flex-direction: row;}
  .logo { height: 32px; max-width: 90px;}
  .nav-links { flex-direction: column; width: 100%; display: none; background: #181818; position: absolute; left: 0; top: 62px; padding-bottom: 1rem;}
  .nav-links.active { display: flex;}
  .nav-links a { border-top: 1px solid #222; font-size: 1.06rem; padding: 0.85rem 1.5rem;}
  .hamburger { display: flex;}
}
main {
  padding: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}
h2 { margin-bottom: 1rem; color: #00ff88; }
.panel-header {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1rem;
  align-items: center;
}
.icon-btn {
  font-size: 2.1rem;
  color: #00ff88;
  background: #222;
  border-radius: 50%;
  padding: 0.35em 0.38em;
  box-shadow: 0 2px 8px #0002;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
  border: 2px solid #00ff88;
}
.icon-btn:hover { background: #00ff88; color: #222;}
.sensor {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  flex-wrap: wrap;
}
.data-box {
  font-size: 2rem;
  text-align: center;
  margin: 10px;
}
.icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 0.3rem;
}
.controls {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}
button.lamp {
  border: none;
  padding: 1rem 2.3rem;
  font-size: 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
  color: #fff;
  outline: none;
  box-shadow: 0 2px 8px #0002;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 500;
}
button.lamp.off { background-color: #ba2636; color: #fff;}
button.lamp.on { background-color: #00ff88; color: #111;}
.graph-controls {
  margin: 20px 0 5px 0;
  text-align: center;
}
input[type="date"] {
  padding: 0.5rem;
  border-radius: 5px;
  border: none;
  background-color: #2c2c2c;
  color: #fff;
  font-size: 1rem;
  margin-left: 0.5rem;
}
canvas {
  max-width: 100%;
  background: #1c1c1c;
  border-radius: 10px;
  box-shadow: 0 3px 15px #0002;
}
@media (max-width: 600px) {
  .sensor { flex-direction: column; align-items: center;}
  .controls { flex-direction: column; gap: 0.5rem;}
  main { padding: 1rem 2vw;}
}
/* Modal */
.modal-bg {
  position: fixed;
  z-index: 999;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0009;
  display: none;
  justify-content: center;
  align-items: center;
}
.modal-bg.active { display: flex; }
.modal {
  background: #232323;
  color: #fff;
  padding: 2em 1.2em;
  border-radius: 16px;
  min-width: 270px;
  max-width: 90vw;
  box-shadow: 0 5px 30px #0008;
}
.modal h3 { margin-top: 0; color: #00ff88;}
#reboot-list { max-height: 240px; overflow-y: auto; padding: 0; margin: 1em 0; list-style: none;}
#reboot-list li { padding: 0.5em 0; border-bottom: 1px solid #444; font-size: 0.97rem; display: flex; align-items: center; gap: 0.6em;}
#close-modal {
  background: #00ff88; color: #111; border: none; padding: 0.55em 2.1em;
  border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 1rem; margin-top: 1em;
}