* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: #f4f6f8;
  color: #222;
  line-height: 1.5;
  padding-bottom: 40px;
}

/* 登录框 */
.login-box {
  max-width: 360px;
  margin: 80px auto 0;
  padding: 32px 24px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  text-align: center;
}
.login-box h1 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #2c3e50;
}
.login-box input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
}
.login-box input:focus {
  outline: none;
  border-color: #2c3e50;
}
.login-box button {
  width: 100%;
  padding: 10px;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
.login-box button:hover { background: #34495e; }
.login-error {
  margin-top: 12px;
  color: #e74c3c;
  font-size: 13px;
}

header {
  background: #2c3e50;
  color: #fff;
  padding: 16px 20px;
}

header h1 { font-size: 18px; margin-bottom: 4px; }
.logout-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
.logout-btn:hover { background: rgba(255,255,255,0.25); }
header { position: relative; }
#device-meta { font-size: 13px; opacity: 0.85; }
#device-meta span { margin-right: 12px; }

main {
  max-width: 720px;
  margin: 20px auto;
  padding: 0 16px;
}

.card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card h2 {
  font-size: 15px;
  margin-bottom: 12px;
  color: #34495e;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.metric {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
}

.metric .label { font-size: 12px; color: #7f8c8d; }
.metric .value { font-size: 15px; font-weight: 500; margin-top: 2px; }

.loading, .empty, .error {
  color: #95a5a6;
  font-size: 14px;
  padding: 8px 0;
}

.error { color: #e74c3c; }

.actuator-list, .task-list { list-style: none; }

.actuator-list li, .task-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #ecf0f1;
}

.actuator-list li:last-child,
.task-list li:last-child { border-bottom: none; }

.actuator-name { font-weight: 500; }

.actuator-status {
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 4px;
  margin: 0 8px;
}

.status-on  { background: #d4edda; color: #155724; }
.status-off { background: #f8d7da; color: #721c24; }

.actuator-actions button {
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 4px;
  color: #fff;
}

.btn-on  { background: #27ae60; }
.btn-off { background: #e74c3c; }

.btn-on:disabled, .btn-off:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.task-meta { color: #7f8c8d; font-size: 13px; }

.alias-form { display: flex; gap: 8px; }

.alias-form input {
  flex: 1;
  padding: 8px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 14px;
}

.alias-form button {
  padding: 8px 16px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.alias-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.92);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show { opacity: 1; }

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .actuator-list li { flex-wrap: wrap; gap: 6px; }
}
