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

html {
  font-size: clamp(22px, 5vw, 32px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0c1a2e;
  color: #e0e0e0;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 32rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

header {
  text-align: center;
  width: 100%;
  margin-bottom: 0.8rem;
}

.empresa {
  font-size: 1.8rem;
  color: #8899aa;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 500;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  margin: 0.15rem 0;
}

.sensor-name {
  font-size: 1.2rem;
  color: #60a5fa;
  margin-bottom: 0.8rem;
}

#estado-conexion {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
}

.conectando { background:#2a3a5a; color:#8899bb; }
.online { background:#1a3a2a; color:#4ade80; border:1px solid #4ade8033; }
.error { background:#3a1a1a; color:#f87171; border:1px solid #f8717133; }

.ultima-actualizacion {
  text-align: center;
  color: #8899aa;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.7rem;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  width: 100%;
}

.grid { width: 100%; display: flex; justify-content: center; }

.card {
  background: rgba(255,255,255,0.06);
  border-radius: 1.2rem;
  padding: 3rem 1rem;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  width: 100%;
}

.card-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #8899aa;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.card-value {
  font-size: clamp(2.8rem, 12vw, 5rem);
  font-weight: 800;
  color: #fbbf24;
  line-height: 1;
  overflow-wrap: break-word;
}

.card-value.updated { color: #60a5fa; }

.card-unit {
  font-size: 1.2rem;
  color: #8899aa;
  margin-top: 0.3rem;
  font-weight: 500;
}

.chart-wrapper {
  width: 100%;
  height: 12rem;
  margin-top: 1.5rem;
  padding: 0.5rem;
  background: rgba(0,0,0,0.2);
  border-radius: 0.8rem;
  border: 1px solid rgba(255,255,255,0.06);
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #556677;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

#chart {
  width: 100% !important;
  height: 100% !important;
}

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
.loading .card-value { animation: pulse 1.5s ease-in-out infinite; }
