body { font-family: Arial, sans-serif; padding: 20px; }
header { margin-bottom: 20px; }
form { margin-top: 10px; }

:root {
  --bg: #0e1117;
  --card: #151a24;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #3b82f6;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --border: #1f2937;
}

body {
  background: linear-gradient(135deg, #0b1220 0%, #0f172a 50%, #0b1324 100%);
  color: var(--text);
}

header h1 {
  color: #fff;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.device-id {
  font-size: 1rem;
}

.status {
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.status-online { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.status-offline { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.status-reconnecting { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.status-row {
  margin-bottom: 14px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.pill-online { background: rgba(34,197,94,0.12); color: #22c55e; }
.pill-offline { background: rgba(239,68,68,0.12); color: #ef4444; }
.pill-warn { background: rgba(245,158,11,0.12); color: #fbbf24; }

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.card-header {
  font-weight: 700;
  margin-bottom: 12px;
}

.sensor, .control {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.sensor:last-child, .control:last-child {
  border-bottom: none;
}

.value {
  font-size: 1.4rem;
  font-weight: 700;
}

.meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.log-card {
  margin-top: 18px;
}

.log-feed {
  font-family: Menlo, Monaco, monospace;
  background: #0b0f18;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  height: 200px;
  overflow-y: auto;
  color: #cbd5e1;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

@media (max-width: 720px) {
  body { padding: 12px; }
  .grid { grid-template-columns: 1fr; }
}
