body {
  background: #e9ecef;
  padding-top: 78px;
}

.avatar-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}

.scada-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid #ced4da;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.floorplan {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-overlay {
  position: absolute;
  border-radius: 14px;
  transition: background 0.3s ease;
  pointer-events: none;
  border: 2px solid rgba(0, 0, 0, 0.15);
}

.room1 { left: 1.5%; top: 2.5%; width: 18.5%; height: 37%; }
.room2 { left: 44.5%; top: 2.5%; width: 18.5%; height: 37%; }
.room3 { left: 46.5%; top: 56%; width: 17%; height: 23%; }

.boiler-zone {
  position: absolute;
  left: 0.8%;
  bottom: 4%;
  width: 18%;
  height: 26%;
}

.boiler {
  position: absolute;
  left: 2%;
  bottom: 0;
  width: 42%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.15));
}

.flow-arrow {
  position: absolute;
  left: 31%;
  width: 42%;
  height: 20%;
}

.flow-arrow::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 72%;
  height: 0;
  border-top: 5px solid currentColor;
  transform: translateY(-50%);
}

.flow-arrow::after {
  content: '';
  position: absolute;
  right: 17%;
  top: 50%;
  transform: translateY(-50%);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}

.flow-hot {
  top: 28%;
  color: #d62828;
}

.flow-hot::after {
  border-left: 18px solid #d62828;
}

.flow-cold {
  top: 58%;
  color: #1971c2;
}

.flow-cold::after {
  border-right: 18px solid #1971c2;
  right: auto;
  left: 0;
}

.flow-cold::before {
  left: 18%;
}

.arrow-label {
  position: absolute;
  right: 0;
  top: -8px;
  display: inline-block;
  min-width: 86px;
  text-align: center;
  background: rgba(255,255,255,.95);
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: .92rem;
}

.flow-cold .arrow-label {
  left: 0;
  right: auto;
}

.sensor-tag {
  position: absolute;
  background: #ffeb3b;
  border: 2px solid #212529;
  padding: 6px 10px;
  font-weight: 700;
  border-radius: 8px;
  min-width: 86px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.15);
}

.s3 { left: 6%; top: 19%; }
.s4 { left: 50%; top: 17%; }
.s5 { left: 50%; top: 66%; }

.status-tower {
  position: absolute;
  right: 1.5%;
  top: 3.5%;
  display: grid;
  gap: 10px;
  width: 180px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,.94);
  border: 1px solid #dee2e6;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

.status-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
  background: #f1f3f5;
}

.status-icon svg {
  width: 18px;
  height: 18px;
  fill: #495057;
}

.alarm {
  background: rgba(220, 53, 69, .12);
  border-color: rgba(220, 53, 69, .45);
}

.alarm .fire-icon svg,
.alarm .water-icon svg,
.alarm .burglar-icon svg,
.alarm .co-icon svg {
  fill: #d62828;
}

.pulse-alert {
  animation: pulseAlert 1s infinite;
}

.fan-icon {
  background: #e7f5ff;
}

.fan-blade {
  width: 18px;
  height: 18px;
  border: 2px solid #1f1f1f;
  border-radius: 50%;
  position: relative;
  display: inline-block;
}

.fan-blade::before,
.fan-blade::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 16px;
  background: #1f1f1f;
  transform: translate(-50%, -50%);
}

.fan-blade::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.state-0 { animation: none; }
.state-1 { animation: spin 2.8s linear infinite; }
.state-2 { animation: spin 1s linear infinite; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseAlert {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214,40,40,.35); }
  70% { transform: scale(1.03); box-shadow: 0 0 0 10px rgba(214,40,40,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214,40,40,0); }
}

@media (max-width: 1200px) {
  .status-tower {
    width: 165px;
    gap: 8px;
  }

  .status-chip {
    font-size: .82rem;
    padding: 7px 10px;
  }
}