:root {
  font: 400 16px/1.3 system-ui, sans-serif;
  --red: #B24226;
  --border: #ccc;
  --font-base: system-ui, sans-serif;
}

body {
  background: #E4E4E4;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

html,
body {
  height: 100%;
}

main {
  max-width: 360px;
  width: 100%;
  background: white;
  padding: 40px 32px 40px 32px;
  font-size: 1rem;
  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 20px;
}


svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

label {
  font-size: 0.875rem;
  color: #666;
  order: 0;
}


input[type="text"],
input[type="password"] {
  display: flex;
  border: 1px solid var(--border);
  font-family: var(--font-base);
  font-size: 1rem;
  letter-spacing: 0.00625em;
  border: none !important;
  background-color: transparent;
  width: 100%;
  height: 100%;
  appearance: none;
  padding: 0;
  box-shadow: none;

  &:focus {
    outline: none;
  }
}

.input-box {
  display: flex;
  height: 46px;
  width: 100%;
  box-sizing: border-box;
  align-items: baseline;
  padding: 0 16px;
  margin: 8px 0 0 0;
  overflow: visible;
  -webkit-box-align: baseline;
  --outline: var(--action);
  border-radius: 4px;
  border: 1px solid var(--border);

  & .field_with_errors {
    display: flex;
    height: 100%;
    width: 100%;
  }


  &:hover {
    border-color: var(--inactive);
  }

  &:focus-within {
    outline: 2px solid var(--outline);
    outline-offset: -2px;
  }

  &:has(.field_with_errors) {
    --outline: var(--error);

    &:hover {
      border-color: var(--error);
    }
  }
}


button[type=submit] {
  background: #333;
  border: none;
  outline: none;
  font: 400 1rem system-ui, sans-serif;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  color: #FFF;

  &:active {
    background-color: #999;
  }
}

p[role=alert] {
  margin: 4px 0 0 0;
  color: var(--red);
  font-size: 0.875rem;
  order: 3;
}

form {
  margin: 0;

  &>div {
    margin-top: 32px;
    display: flex;
    flex-direction: column;

    &:last-of-type {
      text-align: right;
      display: block;
    }

  }


}

.with-errors {
  & label {
    color: var(--red);
  }

  & input[type=text],
  input[type=password] {
    border-color: var(--red);

    &:focus {
      border-color: var(--red);

      &+label {
        color: var(--red);
      }
    }
  }
}

footer {
  text-align: right;
  margin-top: 40px;
  font-size: 0.875rem;
  color: #666;
}