body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f9;
  margin: 0;
  padding: 20px;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-danger:hover {
  background: #c0392b;
}

.tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid #ddd;
}

.tab-button {
  padding: 12px 24px;
  background: #f1f1f1;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

.tab-button.active {
  background: white;
  border-bottom: 3px solid #3498db;
  color: #3498db;
}

.tab-content {
  display: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

.filters label {
  font-weight: bold;
}

.filters input, .filters select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

#history-table th, #history-table td {
  padding: 10px;
  border: 1px solid #ddd;
  text-align: center;
}

#history-table th {
  background: #f4f6f9;
  font-weight: bold;
}

CSS.btn.active {
  opacity: 0.7;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  transform: scale(1.05);
}

.last-update {
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-bottom: 15px;
  text-align: right;
}

.card.updated-recently {
  background: #e8f5e9;  /* verde muy claro */
  border-left: 5px solid #4caf50;
  transition: background 3s ease-out;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

h1, h2 {
  text-align: center;
  color: #333;
}

.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 20px;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin: 0 0 15px;
  color: #2c3e50;
}

.card .value {
  font-size: 2.2rem;
  font-weight: bold;
  margin: 10px 0;
}

.card .label {
  color: #7f8c8d;
  font-size: 0.95rem;
}

.status-on { color: #27ae60; }
.status-off { color: #e74c3c; }

.control-buttons {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.btn-on { background: #2ecc71; color: white; }
.btn-off { background: #e74c3c; color: white; }
.btn-on:hover { background: #27ae60; }
.btn-off:hover { background: #c0392b; }

.charts-section {
  margin-top: 40px;
}

.chart-container {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin: 20px 0;
}