* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  background: #111318;
  color: #f0f0f0;
  margin: 0;
  padding: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

h1 {
  font-size: 1.4rem;
  margin: 0;
}

button {
  background: #4a7dff;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

button:hover {
  background: #3565e0;
}

.lamp-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 560px) {
  .lamp-layout {
    grid-template-columns: 1fr;
  }
}

.lamp-slot {
  display: flex;
  flex-direction: column;
}

.slot-title {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9aa0ac;
}

.slot-content {
  flex: 1;
}

.other-devices-title {
  font-size: 0.95rem;
  color: #9aa0ac;
  margin: 8px 0 12px 0;
}

.other-devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.device-card {
  background: #1c1f27;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #2a2e3a;
}

.device-title {
  margin: 0 0 4px 0;
  font-size: 1.1rem;
}

.device-meta {
  margin: 0 0 16px 0;
  color: #9aa0ac;
  font-size: 0.85rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.row label {
  min-width: 90px;
  font-size: 0.9rem;
  color: #cfd3da;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: unset;
}

input[type="range"] {
  flex: 1;
}

.brightness-value {
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  color: #9aa0ac;
  grid-column: 1 / -1;
}

.device-error {
  margin: 8px 0 0 0;
  font-size: 0.85rem;
  color: #ff8a8a;
  min-height: 1.1em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button.secondary {
  background: #2a2e3a;
  color: #cfd3da;
}

button.secondary:hover {
  background: #353a48;
}

/* Pastille de connexion : grise tant que l'etat n'est pas connu, verte quand
   la lampe repond, rouge quand elle est injoignable. */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  background: #5c626e;
  vertical-align: middle;
}

.device-card[data-reachable="on"] .status-dot {
  background: #43c46a;
  box-shadow: 0 0 6px rgba(67, 196, 106, 0.6);
}

.device-card[data-reachable="off"] .status-dot {
  background: #e05c5c;
}

.device-card[data-reachable="off"] {
  border-color: #5a3038;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: #1c1f27;
  border: 1px solid #2a2e3a;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
}

.login-card h1 {
  margin: 0;
}

.login-hint {
  color: #9aa0ac;
  font-size: 0.85rem;
  margin: 4px 0 20px 0;
}

.login-card label {
  font-size: 0.85rem;
  color: #cfd3da;
  margin-bottom: 6px;
}

.login-card input {
  background: #111318;
  border: 1px solid #2a2e3a;
  border-radius: 8px;
  color: #f0f0f0;
  padding: 10px 12px;
  font-size: 1rem;
  margin-bottom: 16px;
}

.login-card input:focus {
  outline: none;
  border-color: #4a7dff;
}

.login-error {
  color: #ff8a8a;
  font-size: 0.85rem;
  margin: 0 0 12px 0;
}
