CSS mendeteksi jika input memiliki nilai

input:not(:placeholder-shown) {
  border-color: green;
}

input:placeholder-shown {
  border-color: red;
}
Quite Diabolical