Sign-in card

Putcode·18 hours ago
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #f3f2ee;
  color: #17181c;
  font: 14px/1.45 system-ui, sans-serif;
}

.signin {
  display: grid;
  gap: 14px;
  width: min(340px, 100% - 32px);
  padding: 28px;
  border: 1px solid #e3e0d9;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 50px -30px rgb(0 0 0 / 0.3);
}

.signin__title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.signin__sub {
  margin: -8px 0 4px;
  color: #6c6f78;
}

.signin__social {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.signin__social button,
.signin__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.65em;
  border: 1px solid #dcd9d1;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.signin__social button:hover {
  background: #f7f6f3;
}

.signin__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #9a9ca4;
  font-size: 0.8rem;
}

.signin__divider::before,
.signin__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e6e3dd;
}

.signin__field {
  display: grid;
  gap: 6px;
}

.signin__field > span:first-child {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.signin__field a {
  color: #6c6f78;
  font-weight: 400;
}

.signin__field input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.65em 0.8em;
  border: 1px solid #d6d3cb;
  border-radius: 10px;
  font: inherit;
  outline: none;
}

.signin__field input:focus {
  border-color: #17181c;
  box-shadow: 0 0 0 3px #ecebe6;
}

.signin__field small {
  display: none;
  color: #b42318;
}

.signin__field input:user-invalid {
  border-color: #b42318;
}

.signin__field:has(input:user-invalid) small {
  display: block;
}

.signin__password {
  position: relative;
}

.signin__reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: #f1f0ec;
  color: #4b4e57;
  font: inherit;
  font-size: 0.78rem;
  transform: translateY(-50%);
  cursor: pointer;
}

.signin__submit {
  margin-top: 4px;
  border-color: #17181c;
  background: #17181c;
  color: #fff;
}

.signin button:focus-visible {
  outline: 2px solid #17181c;
  outline-offset: 2px;
}

How to use it

Validation styles use :user-invalid, so fields don't turn red before the person has interacted with them. The password toggle switches the input type and updates aria-pressed.